[FFmpeg-cvslog] avconv: stop accessing AVStream.parser

Anton Khirnov git at videolan.org
Tue Oct 29 21:45:09 CET 2013


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Mon Oct 28 15:10:21 2013 +0100| [c872d310cd9c605e5f994ad8ac79dc72303c0d29] | committer: Anton Khirnov

avconv: stop accessing AVStream.parser

It is private and must not be touched from outside of lavf.

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

 avconv.c |    9 ++++++++-
 avconv.h |    2 ++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/avconv.c b/avconv.c
index 0c0f3bf..be47da0 100644
--- a/avconv.c
+++ b/avconv.c
@@ -182,6 +182,8 @@ static void avconv_cleanup(int ret)
         output_streams[i]->bitstream_filters = NULL;
         avcodec_free_frame(&output_streams[i]->filtered_frame);
 
+        av_parser_close(output_streams[i]->parser);
+
         av_freep(&output_streams[i]->forced_keyframes);
         av_freep(&output_streams[i]->avfilter);
         av_freep(&output_streams[i]->logfile_prefix);
@@ -1013,7 +1015,10 @@ static void do_streamcopy(InputStream *ist, OutputStream *ost, const AVPacket *p
        && ost->st->codec->codec_id != AV_CODEC_ID_MPEG2VIDEO
        && ost->st->codec->codec_id != AV_CODEC_ID_VC1
        ) {
-        if (av_parser_change(ist->st->parser, ost->st->codec, &opkt.data, &opkt.size, pkt->data, pkt->size, pkt->flags & AV_PKT_FLAG_KEY)) {
+        if (av_parser_change(ost->parser, ost->st->codec,
+                             &opkt.data, &opkt.size,
+                             pkt->data, pkt->size,
+                             pkt->flags & AV_PKT_FLAG_KEY)) {
             opkt.buf = av_buffer_create(opkt.data, opkt.size, av_buffer_default_free, NULL, 0);
             if (!opkt.buf)
                 exit_program(1);
@@ -1546,6 +1551,8 @@ static int transcode_init(void)
             } else
                 codec->time_base = ist->st->time_base;
 
+            ost->parser = av_parser_init(codec->codec_id);
+
             switch (codec->codec_type) {
             case AVMEDIA_TYPE_AUDIO:
                 if (audio_volume != 256) {
diff --git a/avconv.h b/avconv.h
index eb7e37f..cb3005d 100644
--- a/avconv.h
+++ b/avconv.h
@@ -305,6 +305,8 @@ typedef struct OutputStream {
     int copy_initial_nonkeyframes;
 
     enum AVPixelFormat pix_fmts[2];
+
+    AVCodecParserContext *parser;
 } OutputStream;
 
 typedef struct OutputFile {



More information about the ffmpeg-cvslog mailing list