[MPlayer-cvslog] r36402 - trunk/libmpdemux/demux_lavf.c

reimar subversion at mplayerhq.hu
Mon Aug 5 08:46:43 CEST 2013


Author: reimar
Date: Mon Aug  5 08:46:41 2013
New Revision: 36402

Log:
Fix and simplify alloc/free of AVIO buffer.

Modified:
   trunk/libmpdemux/demux_lavf.c

Modified: trunk/libmpdemux/demux_lavf.c
==============================================================================
--- trunk/libmpdemux/demux_lavf.c	Sun Aug  4 22:19:58 2013	(r36401)
+++ trunk/libmpdemux/demux_lavf.c	Mon Aug  5 08:46:41 2013	(r36402)
@@ -70,7 +70,6 @@ typedef struct lavf_priv {
     AVInputFormat *avif;
     AVFormatContext *avfc;
     AVIOContext *pb;
-    uint8_t *buffer;
     int audio_streams;
     int video_streams;
     int sub_streams;
@@ -553,8 +552,8 @@ static demuxer_t* demux_open_lavf(demuxe
         av_strlcat(mp_filename, "foobar.dummy", sizeof(mp_filename));
 
     if (!(priv->avif->flags & AVFMT_NOFILE)) {
-        priv->buffer = av_mallocz(BIO_BUFFER_SIZE);
-        priv->pb = avio_alloc_context(priv->buffer, BIO_BUFFER_SIZE, 0,
+        uint8_t *buffer = av_mallocz(BIO_BUFFER_SIZE);
+        priv->pb = avio_alloc_context(buffer, BIO_BUFFER_SIZE, 0,
                                       demuxer, mp_read, NULL, mp_seek);
         priv->pb->read_seek = mp_read_seek;
         if (!demuxer->stream->end_pos || (demuxer->stream->flags & MP_STREAM_SEEK) != MP_STREAM_SEEK)
@@ -873,7 +872,7 @@ static void demux_close_lavf(demuxer_t *
          av_freep(&priv->avfc->key);
          avformat_close_input(&priv->avfc);
         }
-        av_freep(&priv->buffer);
+        av_freep(&priv->pb->buffer);
         av_freep(&priv->pb);
         free(priv); demuxer->priv= NULL;
     }


More information about the MPlayer-cvslog mailing list