[FFmpeg-cvslog] avplay: convert do codecpar

Anton Khirnov git at videolan.org
Sun Apr 10 22:50:07 CEST 2016


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Tue Feb  9 14:23:30 2016 +0100| [c23152a90371bfe971b063781ef4e7d9d5ef9d70] | committer: Anton Khirnov

avplay: convert do codecpar

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c23152a90371bfe971b063781ef4e7d9d5ef9d70
---

 avplay.c |   24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/avplay.c b/avplay.c
index 05984b3..c8db03f 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:



More information about the ffmpeg-cvslog mailing list