summaryrefslogtreecommitdiff
path: root/avplay.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2016-02-09 14:23:30 +0100
committerAnton Khirnov <anton@khirnov.net>2016-02-24 10:05:43 +0100
commitc23152a90371bfe971b063781ef4e7d9d5ef9d70 (patch)
tree0ac6e37ca64766321aecadd42327b85ccf340e81 /avplay.c
parent0705f5960c9d272cef1309c090000865b991c9c7 (diff)
avplay: convert do codecpar
Diffstat (limited to 'avplay.c')
-rw-r--r--avplay.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/avplay.c b/avplay.c
index 05984b3ed1..c8db03fbd3 100644
--- a/avplay.c
+++ b/avplay.c
@@ -2017,11 +2017,11 @@ static AVCodec *choose_decoder(PlayerState *is, AVFormatContext *ic, AVStream *s
}
if (codec_name) {
- AVCodec *codec = find_codec_or_die(codec_name, st->codec->codec_type);
- st->codec->codec_id = codec->id;
+ AVCodec *codec = find_codec_or_die(codec_name, st->codecpar->codec_type);
+ st->codecpar->codec_id = codec->id;
return codec;
} else
- return avcodec_find_decoder(st->codec->codec_id);
+ return avcodec_find_decoder(st->codecpar->codec_id);
}
/* open a given stream. Return 0 if OK */
@@ -2042,7 +2042,7 @@ static int stream_component_open(PlayerState *is, int stream_index)
if (!avctx)
return AVERROR(ENOMEM);
- ret = avcodec_copy_context(avctx, ic->streams[stream_index]->codec);
+ ret = avcodec_parameters_to_context(avctx, ic->streams[stream_index]->codecpar);
if (ret < 0) {
avcodec_free_context(&avctx);
return ret;
@@ -2160,13 +2160,13 @@ fail:
static void stream_component_close(PlayerState *is, int stream_index)
{
AVFormatContext *ic = is->ic;
- AVCodecContext *avctx;
+ AVCodecParameters *par;
if (stream_index < 0 || stream_index >= ic->nb_streams)
return;
- avctx = ic->streams[stream_index]->codec;
+ par = ic->streams[stream_index]->codecpar;
- switch (avctx->codec_type) {
+ switch (par->codec_type) {
case AVMEDIA_TYPE_AUDIO:
packet_queue_abort(&is->audioq);
@@ -2220,7 +2220,7 @@ static void stream_component_close(PlayerState *is, int stream_index)
}
ic->streams[stream_index]->discard = AVDISCARD_ALL;
- switch (avctx->codec_type) {
+ switch (par->codec_type) {
case AVMEDIA_TYPE_AUDIO:
avcodec_free_context(&is->audio_dec);
is->audio_st = NULL;
@@ -2311,7 +2311,7 @@ static int stream_setup(PlayerState *is)
orig_nb_streams = ic->nb_streams;
for (i = 0; i < ic->nb_streams; i++)
- ic->streams[i]->codec->codec = choose_decoder(is, ic, ic->streams[i]);
+ choose_decoder(is, ic, ic->streams[i]);
err = avformat_find_stream_info(ic, opts);
@@ -2596,12 +2596,12 @@ static void stream_cycle_channel(PlayerState *is, int codec_type)
if (stream_index == start_index)
return;
st = ic->streams[stream_index];
- if (st->codec->codec_type == codec_type) {
+ if (st->codecpar->codec_type == codec_type) {
/* check that parameters are OK */
switch (codec_type) {
case AVMEDIA_TYPE_AUDIO:
- if (st->codec->sample_rate != 0 &&
- st->codec->channels != 0)
+ if (st->codecpar->sample_rate != 0 &&
+ st->codecpar->channels != 0)
goto the_end;
break;
case AVMEDIA_TYPE_VIDEO: