comparison libmpdemux/demux_lavf.c @ 36301:8fd75794d4f4

Update for changed lavf API. The buffer now needs to have been allocated with av_malloc.
author reimar
date Sun, 04 Aug 2013 13:30:39 +0000
parents c297c1a78ae6
children b50212f27ffa
comparison
equal deleted inserted replaced
36300:b14b9f22d7ea 36301:8fd75794d4f4
68 68
69 typedef struct lavf_priv { 69 typedef struct lavf_priv {
70 AVInputFormat *avif; 70 AVInputFormat *avif;
71 AVFormatContext *avfc; 71 AVFormatContext *avfc;
72 AVIOContext *pb; 72 AVIOContext *pb;
73 uint8_t buffer[BIO_BUFFER_SIZE]; 73 uint8_t *buffer;
74 int audio_streams; 74 int audio_streams;
75 int video_streams; 75 int video_streams;
76 int sub_streams; 76 int sub_streams;
77 int64_t last_pts; 77 int64_t last_pts;
78 int astreams[MAX_A_STREAMS]; 78 int astreams[MAX_A_STREAMS];
549 av_strlcat(mp_filename, demuxer->stream->url, sizeof(mp_filename)); 549 av_strlcat(mp_filename, demuxer->stream->url, sizeof(mp_filename));
550 } else 550 } else
551 av_strlcat(mp_filename, "foobar.dummy", sizeof(mp_filename)); 551 av_strlcat(mp_filename, "foobar.dummy", sizeof(mp_filename));
552 552
553 if (!(priv->avif->flags & AVFMT_NOFILE)) { 553 if (!(priv->avif->flags & AVFMT_NOFILE)) {
554 priv->buffer = av_mallocz(BIO_BUFFER_SIZE);
554 priv->pb = avio_alloc_context(priv->buffer, BIO_BUFFER_SIZE, 0, 555 priv->pb = avio_alloc_context(priv->buffer, BIO_BUFFER_SIZE, 0,
555 demuxer, mp_read, NULL, mp_seek); 556 demuxer, mp_read, NULL, mp_seek);
556 priv->pb->read_seek = mp_read_seek; 557 priv->pb->read_seek = mp_read_seek;
557 if (!demuxer->stream->end_pos || (demuxer->stream->flags & MP_STREAM_SEEK) != MP_STREAM_SEEK) 558 if (!demuxer->stream->end_pos || (demuxer->stream->flags & MP_STREAM_SEEK) != MP_STREAM_SEEK)
558 priv->pb->seekable = 0; 559 priv->pb->seekable = 0;
868 if(priv->avfc) 869 if(priv->avfc)
869 { 870 {
870 av_freep(&priv->avfc->key); 871 av_freep(&priv->avfc->key);
871 avformat_close_input(&priv->avfc); 872 avformat_close_input(&priv->avfc);
872 } 873 }
874 av_freep(&priv->buffer);
873 av_freep(&priv->pb); 875 av_freep(&priv->pb);
874 free(priv); demuxer->priv= NULL; 876 free(priv); demuxer->priv= NULL;
875 } 877 }
876 } 878 }
877 879