History

lavfi: move tracing utilities definition from video.c to avfilter.c

These utilities are meant to be defined in avfilter.c, since they are generic and thus contain both audio and video code.

Stefano Sabatini committed 14 years ago

Commit 1488c4d1 parent 1faf0d63 files · +46 −40Browse files

Unified · Split

3 files
  1. libavfilter/avfilter.c +40 −0
  2. libavfilter/internal.h +6 −0
  3. libavfilter/video.c +0 −40
libavfilter/avfilter.c+40−0
@@ -31,6 +31,46 @@ · 30 unmodified lines
3131 #include "formats.h"
3232 #include "internal.h"
3333
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+
3474 unsigned avfilter_version(void) {
3575 av_assert0(LIBAVFILTER_VERSION_MICRO >= 100);
3676 return LIBAVFILTER_VERSION_INT;
libavfilter/internal.h+6−0
@@ -134,8 +134,14 @@ void ff_free_pool(AVFilterPool *pool); · 133 unmodified lines
134134
135135 void ff_command_queue_pop(AVFilterContext *filter);
136136
137+/* misc debug functions */
138+
137139 #define FF_DPRINTF_START(ctx, func) av_dlog(NULL, "%-16s: ", #func)
138140
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+
139145 void ff_dlog_link(void *ctx, AVFilterLink *link, int end);
140146
141147 #endif /* AVFILTER_INTERNAL_H */
libavfilter/video.c+0−40
@@ -26,46 +26,6 @@ · 25 unmodified lines
2626 #include "internal.h"
2727 #include "video.h"
2828
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−
6929 AVFilterBufferRef *ff_null_get_video_buffer(AVFilterLink *link, int perms, int w, int h)
7030 {
7131 return avfilter_get_video_buffer(link->dst->outputs[0], perms, w, h);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t