History

avfilter/buffersrc: print relevant info when skipping filter reinit

The timestamp of the changed input frame as well as its relevant properties can be examined by the user. Only applicable when reinit_filter is disabled on the input stream.

Gyan Doshi committed 7 years ago

Commit b5b6f6a1 parent 8a788ff1 file · +12 −6Browse files

Unified · Split

libavfilter/buffersrc.c+12−6
@@ -33,6 +33,7 @@ · 32 unmodified lines
3333 #include "libavutil/internal.h"
3434 #include "libavutil/opt.h"
3535 #include "libavutil/samplefmt.h"
36+#include "libavutil/timestamp.h"
3637 #include "audio.h"
3738 #include "avfilter.h"
3839 #include "buffersrc.h"
@@ -67,15 +68,20 @@ typedef struct BufferSourceContext { · 28 unmodified lines
6768 int eof;
6869 } BufferSourceContext;
6970
70−#define CHECK_VIDEO_PARAM_CHANGE(s, c, width, height, format)\
71+#define CHECK_VIDEO_PARAM_CHANGE(s, c, width, height, format, pts)\
7172 if (c->w != width || c->h != height || c->pix_fmt != format) {\
72− av_log(s, AV_LOG_INFO, "Changing frame properties on the fly is not supported by all filters.\n");\
73+ av_log(s, AV_LOG_INFO, "filter context - w: %d h: %d fmt: %d, incoming frame - w: %d h: %d fmt: %d pts_time: %s\n",\
74+ c->w, c->h, c->pix_fmt, width, height, format, av_ts2timestr(pts, &s->outputs[0]->time_base));\
75+ av_log(s, AV_LOG_WARNING, "Changing video frame properties on the fly is not supported by all filters.\n");\
7376 }
7477
75−#define CHECK_AUDIO_PARAM_CHANGE(s, c, srate, ch_layout, ch_count, format)\
78+#define CHECK_AUDIO_PARAM_CHANGE(s, c, srate, ch_layout, ch_count, format, pts)\
7679 if (c->sample_fmt != format || c->sample_rate != srate ||\
7780 c->channel_layout != ch_layout || c->channels != ch_count) {\
78− av_log(s, AV_LOG_ERROR, "Changing frame properties on the fly is not supported.\n");\
81+ av_log(s, AV_LOG_INFO, "filter context - fmt: %s r: %d layout: %"PRIX64" ch: %d, incoming frame - fmt: %s r: %d layout: %"PRIX64" ch: %d pts_time: %s\n",\
82+ av_get_sample_fmt_name(c->sample_fmt), c->sample_rate, c->channel_layout, c->channels,\
83+ av_get_sample_fmt_name(format), srate, ch_layout, ch_count, av_ts2timestr(pts, &s->outputs[0]->time_base));\
84+ av_log(s, AV_LOG_ERROR, "Changing audio frame properties on the fly is not supported.\n");\
7985 return AVERROR(EINVAL);\
8086 }
8187
@@ -208,14 +214,14 @@ static int av_buffersrc_add_frame_internal(AVFilterContext *ctx, · 126 unmodified lines
208214 switch (ctx->outputs[0]->type) {
209215 case AVMEDIA_TYPE_VIDEO:
210216 CHECK_VIDEO_PARAM_CHANGE(ctx, s, frame->width, frame->height,
211− frame->format);
217+ frame->format, frame->pts);
212218 break;
213219 case AVMEDIA_TYPE_AUDIO:
214220 /* For layouts unknown on input but known on link after negotiation. */
215221 if (!frame->channel_layout)
216222 frame->channel_layout = s->channel_layout;
217223 CHECK_AUDIO_PARAM_CHANGE(ctx, s, frame->sample_rate, frame->channel_layout,
218− frame->channels, frame->format);
224+ frame->channels, frame->format, frame->pts);
219225 break;
220226 default:
221227 return AVERROR(EINVAL);

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