mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-03-28 12:32:17 +02:00
ffplay: only configure video filters after we got the first frame
Otherwise the codec width, height and pixel format values may not be set. Signed-off-by: Marton Balint <cus@passwd.hu>
This commit is contained in:
parent
b12e61ac7f
commit
58f22f7012
33
ffplay.c
33
ffplay.c
@ -1625,13 +1625,6 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c
|
|||||||
is->in_video_filter = filt_src;
|
is->in_video_filter = filt_src;
|
||||||
is->out_video_filter = filt_out;
|
is->out_video_filter = filt_out;
|
||||||
|
|
||||||
if (codec->codec->capabilities & CODEC_CAP_DR1) {
|
|
||||||
is->use_dr1 = 1;
|
|
||||||
codec->get_buffer = codec_get_buffer;
|
|
||||||
codec->release_buffer = codec_release_buffer;
|
|
||||||
codec->opaque = &is->buffer_pool;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1646,28 +1639,26 @@ static int video_thread(void *arg)
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
#if CONFIG_AVFILTER
|
#if CONFIG_AVFILTER
|
||||||
|
AVCodecContext *codec = is->video_st->codec;
|
||||||
AVFilterGraph *graph = avfilter_graph_alloc();
|
AVFilterGraph *graph = avfilter_graph_alloc();
|
||||||
AVFilterContext *filt_out = NULL, *filt_in = NULL;
|
AVFilterContext *filt_out = NULL, *filt_in = NULL;
|
||||||
int last_w = is->video_st->codec->width;
|
int last_w = 0;
|
||||||
int last_h = is->video_st->codec->height;
|
int last_h = 0;
|
||||||
enum PixelFormat last_format = is->video_st->codec->pix_fmt;
|
enum PixelFormat last_format = -2;
|
||||||
|
|
||||||
if ((ret = configure_video_filters(graph, is, vfilters)) < 0) {
|
if (codec->codec->capabilities & CODEC_CAP_DR1) {
|
||||||
SDL_Event event;
|
is->use_dr1 = 1;
|
||||||
event.type = FF_QUIT_EVENT;
|
codec->get_buffer = codec_get_buffer;
|
||||||
event.user.data1 = is;
|
codec->release_buffer = codec_release_buffer;
|
||||||
SDL_PushEvent(&event);
|
codec->opaque = &is->buffer_pool;
|
||||||
goto the_end;
|
|
||||||
}
|
}
|
||||||
filt_in = is->in_video_filter;
|
|
||||||
filt_out = is->out_video_filter;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
AVPacket pkt;
|
AVPacket pkt;
|
||||||
#if CONFIG_AVFILTER
|
#if CONFIG_AVFILTER
|
||||||
AVFilterBufferRef *picref;
|
AVFilterBufferRef *picref;
|
||||||
AVRational tb = filt_out->inputs[0]->time_base;
|
AVRational tb;
|
||||||
#endif
|
#endif
|
||||||
while (is->paused && !is->videoq.abort_request)
|
while (is->paused && !is->videoq.abort_request)
|
||||||
SDL_Delay(10);
|
SDL_Delay(10);
|
||||||
@ -1691,6 +1682,10 @@ static int video_thread(void *arg)
|
|||||||
avfilter_graph_free(&graph);
|
avfilter_graph_free(&graph);
|
||||||
graph = avfilter_graph_alloc();
|
graph = avfilter_graph_alloc();
|
||||||
if ((ret = configure_video_filters(graph, is, vfilters)) < 0) {
|
if ((ret = configure_video_filters(graph, is, vfilters)) < 0) {
|
||||||
|
SDL_Event event;
|
||||||
|
event.type = FF_QUIT_EVENT;
|
||||||
|
event.user.data1 = is;
|
||||||
|
SDL_PushEvent(&event);
|
||||||
av_free_packet(&pkt);
|
av_free_packet(&pkt);
|
||||||
goto the_end;
|
goto the_end;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user