summaryrefslogtreecommitdiff
path: root/ffplay.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-07-14 20:44:58 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-07-14 20:44:58 +0200
commit5dc6bd86f0f5cfffb44b47e6e916119f26b12091 (patch)
tree968252b8209375cdca411921e37bd6c9db66b487 /ffplay.c
parent1885824b20a493d25db4b8e5397666e3a68f45f2 (diff)
parent6cb11979295ae5d3b9bad0965cbd6a06d9c9783b (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: APIchanges: fill in missing hashes and dates. Add an APIChanges entry and bump minor versions for recent changes. ffmpeg: print the low bitrate warning after the codec is openend. doxygen: Move function documentation into the macro generating the function. doxygen: Make sure parameter names match between .c and .h files. h264: move fill_decode_neighbors()/fill_decode_caches() to h264_mvpred.h H.264: Add more x86 assembly for 10-bit H.264 predict functions lavf: fix invalid reads in avformat_find_stream_info() cmdutils: replace opt_default with opt_default2() and remove set_context_opts ffmpeg: use new avcodec_open2 and avformat_find_stream_info API. ffplay: use new avcodec_open2 and avformat_find_stream_info API. cmdutils: store all codec options in one dict instead of video/audio/sub ffmpeg: check experimental flag after codec is opened. ffmpeg: do not set GLOBAL_HEADER flag in the options context Conflicts: cmdutils.c doc/APIchanges ffmpeg.c ffplay.c libavcodec/version.h libavformat/version.h libswscale/swscale_unscaled.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'ffplay.c')
-rw-r--r--ffplay.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/ffplay.c b/ffplay.c
index afafd41aa7..257b026977 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -2111,11 +2111,15 @@ static int stream_component_open(VideoState *is, int stream_index)
AVCodecContext *avctx;
AVCodec *codec;
SDL_AudioSpec wanted_spec, spec;
+ AVDictionary *opts;
+ AVDictionaryEntry *t = NULL;
if (stream_index < 0 || stream_index >= ic->nb_streams)
return -1;
avctx = ic->streams[stream_index]->codec;
+ opts = filter_codec_opts(codec_opts, avctx->codec_id, 0);
+
/* prepare audio output */
if (avctx->codec_type == AVMEDIA_TYPE_AUDIO) {
if (avctx->channels > 0) {
@@ -2141,13 +2145,16 @@ static int stream_component_open(VideoState *is, int stream_index)
avctx->error_concealment= error_concealment;
avctx->thread_count= thread_count;
- set_context_opts(avctx, avcodec_opts[avctx->codec_type], 0, codec);
-
if(codec->capabilities & CODEC_CAP_DR1)
avctx->flags |= CODEC_FLAG_EMU_EDGE;
- if (avcodec_open(avctx, codec) < 0)
+ if (!codec ||
+ avcodec_open2(avctx, codec, &opts) < 0)
return -1;
+ if ((t = av_dict_get(opts, "", NULL, AV_DICT_IGNORE_SUFFIX))) {
+ av_log(NULL, AV_LOG_ERROR, "Option %s not found.\n", t->key);
+ return AVERROR_OPTION_NOT_FOUND;
+ }
/* prepare audio output */
if (avctx->codec_type == AVMEDIA_TYPE_AUDIO) {
@@ -2301,6 +2308,8 @@ static int read_thread(void *arg)
int eof=0;
int pkt_in_play_range = 0;
AVDictionaryEntry *t;
+ AVDictionary **opts;
+ int orig_nb_streams;
memset(st_index, -1, sizeof(st_index));
is->video_stream = -1;
@@ -2326,12 +2335,19 @@ static int read_thread(void *arg)
if(genpts)
ic->flags |= AVFMT_FLAG_GENPTS;
- err = av_find_stream_info(ic);
+ opts = setup_find_stream_info_opts(ic);
+ orig_nb_streams = ic->nb_streams;
+
+ err = avformat_find_stream_info(ic, opts);
if (err < 0) {
fprintf(stderr, "%s: could not find codec parameters\n", is->filename);
ret = -1;
goto fail;
}
+ for (i = 0; i < orig_nb_streams; i++)
+ av_dict_free(&opts[i]);
+ av_freep(&opts);
+
if(ic->pb)
ic->pb->eof_reached= 0; //FIXME hack, ffplay maybe should not use url_feof() to test for the end