Commit bcbb48d3 authored by bellard's avatar bellard

removed unneeded mallocs


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@1508 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 472472b1
...@@ -30,8 +30,9 @@ typedef struct OggContext { ...@@ -30,8 +30,9 @@ typedef struct OggContext {
} OggContext ; } OggContext ;
static int ogg_write_header(AVFormatContext *avfcontext) { static int ogg_write_header(AVFormatContext *avfcontext)
OggContext *context ; {
OggContext *context = avfcontext->priv_data;
AVCodecContext *avccontext ; AVCodecContext *avccontext ;
vorbis_info vi ; vorbis_info vi ;
vorbis_dsp_state vd ; vorbis_dsp_state vd ;
...@@ -40,10 +41,6 @@ static int ogg_write_header(AVFormatContext *avfcontext) { ...@@ -40,10 +41,6 @@ static int ogg_write_header(AVFormatContext *avfcontext) {
ogg_packet header, header_comm, header_code ; ogg_packet header, header_comm, header_code ;
int n ; int n ;
if(!(context = malloc(sizeof(OggContext))))
return -1 ;
avfcontext->priv_data = context ;
srand(time(NULL)); srand(time(NULL));
ogg_stream_init(&context->os, rand()); ogg_stream_init(&context->os, rand());
...@@ -190,17 +187,11 @@ static int next_packet(AVFormatContext *avfcontext, ogg_packet *op) { ...@@ -190,17 +187,11 @@ static int next_packet(AVFormatContext *avfcontext, ogg_packet *op) {
static int ogg_read_header(AVFormatContext *avfcontext, AVFormatParameters *ap) static int ogg_read_header(AVFormatContext *avfcontext, AVFormatParameters *ap)
{ {
OggContext *context ; OggContext *context = avfcontext->priv_data;
char *buf ; char *buf ;
ogg_page og ; ogg_page og ;
AVStream *ast ; AVStream *ast ;
if(!(context = malloc(sizeof(OggContext)))) {
perror("malloc") ;
return -1 ;
}
avfcontext->priv_data = context ;
ogg_sync_init(&context->oy) ; ogg_sync_init(&context->oy) ;
buf = ogg_sync_buffer(&context->oy, DECODER_BUFFER_SIZE) ; buf = ogg_sync_buffer(&context->oy, DECODER_BUFFER_SIZE) ;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment