# HG changeset patch # User bellard # Date 1043499939 0 # Node ID a16ccdf4a87c75e2c3a8a7084e791aa4b08b1756 # Parent f17e285df237a9def76b8abad4b2b538c8d86e50 removed unneeded mallocs diff -r f17e285df237 -r a16ccdf4a87c ogg.c --- a/ogg.c Thu Jan 23 23:34:29 2003 +0000 +++ b/ogg.c Sat Jan 25 13:05:39 2003 +0000 @@ -30,8 +30,9 @@ } 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 @@ 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 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) ;