These utilities are meant to be defined in avfilter.c, since they are generic and thus contain both audio and video code.
Unified · Split
| @@ -31,6 +31,46 @@ · 30 unmodified lines | ||
| 31 | 31 | #include "formats.h" |
| 32 | 32 | #include "internal.h" |
| 33 | 33 | |
| 34 | +char *ff_get_ref_perms_string(char *buf, size_t buf_size, int perms) | |
| 35 | +{ | |
| 36 | + snprintf(buf, buf_size, "%s%s%s%s%s%s", | |
| 37 | + perms & AV_PERM_READ ? "r" : "", | |
| 38 | + perms & AV_PERM_WRITE ? "w" : "", | |
| 39 | + perms & AV_PERM_PRESERVE ? "p" : "", | |
| 40 | + perms & AV_PERM_REUSE ? "u" : "", | |
| 41 | + perms & AV_PERM_REUSE2 ? "U" : "", | |
| 42 | + perms & AV_PERM_NEG_LINESIZES ? "n" : ""); | |
| 43 | + return buf; | |
| 44 | +} | |
| 45 | + | |
| 46 | +void ff_dlog_ref(void *ctx, AVFilterBufferRef *ref, int end) | |
| 47 | +{ | |
| 48 | + av_unused char buf[16]; | |
| 49 | + av_dlog(ctx, | |
| 50 | + "ref[%p buf:%p refcount:%d perms:%s data:%p linesize[%d, %d, %d, %d] pts:%"PRId64" pos:%"PRId64, | |
| 51 | + ref, ref->buf, ref->buf->refcount, ff_get_ref_perms_string(buf, sizeof(buf), ref->perms), ref->data[0], | |
| 52 | + ref->linesize[0], ref->linesize[1], ref->linesize[2], ref->linesize[3], | |
| 53 | + ref->pts, ref->pos); | |
| 54 | + | |
| 55 | + if (ref->video) { | |
| 56 | + av_dlog(ctx, " a:%d/%d s:%dx%d i:%c iskey:%d type:%c", | |
| 57 | + ref->video->sample_aspect_ratio.num, ref->video->sample_aspect_ratio.den, | |
| 58 | + ref->video->w, ref->video->h, | |
| 59 | + !ref->video->interlaced ? 'P' : /* Progressive */ | |
| 60 | + ref->video->top_field_first ? 'T' : 'B', /* Top / Bottom */ | |
| 61 | + ref->video->key_frame, | |
| 62 | + av_get_picture_type_char(ref->video->pict_type)); | |
| 63 | + } | |
| 64 | + if (ref->audio) { | |
| 65 | + av_dlog(ctx, " cl:%"PRId64"d n:%d r:%d", | |
| 66 | + ref->audio->channel_layout, | |
| 67 | + ref->audio->nb_samples, | |
| 68 | + ref->audio->sample_rate); | |
| 69 | + } | |
| 70 | + | |
| 71 | + av_dlog(ctx, "]%s", end ? "\n" : ""); | |
| 72 | +} | |
| 73 | + | |
| 34 | 74 | unsigned avfilter_version(void) { |
| 35 | 75 | av_assert0(LIBAVFILTER_VERSION_MICRO >= 100); |
| 36 | 76 | return LIBAVFILTER_VERSION_INT; |
| @@ -134,8 +134,14 @@ void ff_free_pool(AVFilterPool *pool); · 133 unmodified lines | ||
| 134 | 134 | |
| 135 | 135 | void ff_command_queue_pop(AVFilterContext *filter); |
| 136 | 136 | |
| 137 | +/* misc debug functions */ | |
| 138 | + | |
| 137 | 139 | #define FF_DPRINTF_START(ctx, func) av_dlog(NULL, "%-16s: ", #func) |
| 138 | 140 | |
| 141 | +char *ff_get_ref_perms_string(char *buf, size_t buf_size, int perms); | |
| 142 | + | |
| 143 | +void ff_dlog_ref(void *ctx, AVFilterBufferRef *ref, int end); | |
| 144 | + | |
| 139 | 145 | void ff_dlog_link(void *ctx, AVFilterLink *link, int end); |
| 140 | 146 | |
| 141 | 147 | #endif /* AVFILTER_INTERNAL_H */ |
| @@ -26,46 +26,6 @@ · 25 unmodified lines | ||
| 26 | 26 | #include "internal.h" |
| 27 | 27 | #include "video.h" |
| 28 | 28 | |
| 29 | −static char *ff_get_ref_perms_string(char *buf, size_t buf_size, int perms) | |
| 30 | −{ | |
| 31 | − snprintf(buf, buf_size, "%s%s%s%s%s%s", | |
| 32 | − perms & AV_PERM_READ ? "r" : "", | |
| 33 | − perms & AV_PERM_WRITE ? "w" : "", | |
| 34 | − perms & AV_PERM_PRESERVE ? "p" : "", | |
| 35 | − perms & AV_PERM_REUSE ? "u" : "", | |
| 36 | − perms & AV_PERM_REUSE2 ? "U" : "", | |
| 37 | − perms & AV_PERM_NEG_LINESIZES ? "n" : ""); | |
| 38 | − return buf; | |
| 39 | −} | |
| 40 | − | |
| 41 | −static void ff_dlog_ref(void *ctx, AVFilterBufferRef *ref, int end) | |
| 42 | −{ | |
| 43 | − av_unused char buf[16]; | |
| 44 | − av_dlog(ctx, | |
| 45 | − "ref[%p buf:%p refcount:%d perms:%s data:%p linesize[%d, %d, %d, %d] pts:%"PRId64" pos:%"PRId64, | |
| 46 | − ref, ref->buf, ref->buf->refcount, ff_get_ref_perms_string(buf, sizeof(buf), ref->perms), ref->data[0], | |
| 47 | − ref->linesize[0], ref->linesize[1], ref->linesize[2], ref->linesize[3], | |
| 48 | − ref->pts, ref->pos); | |
| 49 | − | |
| 50 | − if (ref->video) { | |
| 51 | − av_dlog(ctx, " a:%d/%d s:%dx%d i:%c iskey:%d type:%c", | |
| 52 | − ref->video->sample_aspect_ratio.num, ref->video->sample_aspect_ratio.den, | |
| 53 | − ref->video->w, ref->video->h, | |
| 54 | − !ref->video->interlaced ? 'P' : /* Progressive */ | |
| 55 | − ref->video->top_field_first ? 'T' : 'B', /* Top / Bottom */ | |
| 56 | − ref->video->key_frame, | |
| 57 | − av_get_picture_type_char(ref->video->pict_type)); | |
| 58 | − } | |
| 59 | − if (ref->audio) { | |
| 60 | − av_dlog(ctx, " cl:%"PRId64"d n:%d r:%d", | |
| 61 | − ref->audio->channel_layout, | |
| 62 | − ref->audio->nb_samples, | |
| 63 | − ref->audio->sample_rate); | |
| 64 | − } | |
| 65 | − | |
| 66 | − av_dlog(ctx, "]%s", end ? "\n" : ""); | |
| 67 | −} | |
| 68 | − | |
| 69 | 29 | AVFilterBufferRef *ff_null_get_video_buffer(AVFilterLink *link, int perms, int w, int h) |
| 70 | 30 | { |
| 71 | 31 | return avfilter_get_video_buffer(link->dst->outputs[0], perms, w, h); |