aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/ogg.c
diff options
context:
space:
mode:
authorFabrice Bellard <fabrice@bellard.org>2003-01-25 13:05:39 +0000
committerFabrice Bellard <fabrice@bellard.org>2003-01-25 13:05:39 +0000
commita48835b9fe2d5606a8f0ab56b905047b2a17e42c (patch)
tree15910df7a2ffb6427c2eecdc1e72520ff38f87ef /libavformat/ogg.c
parente9a9e0c21090d18089d212c39e9249f9a7ed559c (diff)
downloadffmpeg-a48835b9fe2d5606a8f0ab56b905047b2a17e42c.tar.gz
removed unneeded mallocs
Originally committed as revision 1508 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/ogg.c')
-rw-r--r--libavformat/ogg.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/libavformat/ogg.c b/libavformat/ogg.c
index 7c7c96c61f..8997c18a4f 100644
--- a/libavformat/ogg.c
+++ b/libavformat/ogg.c
@@ -30,8 +30,9 @@ typedef struct OggContext {
} OggContext ;
-static int ogg_write_header(AVFormatContext *avfcontext) {
- OggContext *context ;
+static int ogg_write_header(AVFormatContext *avfcontext)
+{
+ OggContext *context = avfcontext->priv_data;
AVCodecContext *avccontext ;
vorbis_info vi ;
vorbis_dsp_state vd ;
@@ -40,10 +41,6 @@ static int ogg_write_header(AVFormatContext *avfcontext) {
ogg_packet header, header_comm, header_code ;
int n ;
- if(!(context = malloc(sizeof(OggContext))))
- return -1 ;
- avfcontext->priv_data = context ;
-
srand(time(NULL));
ogg_stream_init(&context->os, rand());
@@ -190,17 +187,11 @@ static int next_packet(AVFormatContext *avfcontext, ogg_packet *op) {
static int ogg_read_header(AVFormatContext *avfcontext, AVFormatParameters *ap)
{
- OggContext *context ;
+ OggContext *context = avfcontext->priv_data;
char *buf ;
ogg_page og ;
AVStream *ast ;
- if(!(context = malloc(sizeof(OggContext)))) {
- perror("malloc") ;
- return -1 ;
- }
- avfcontext->priv_data = context ;
-
ogg_sync_init(&context->oy) ;
buf = ogg_sync_buffer(&context->oy, DECODER_BUFFER_SIZE) ;