# HG changeset patch # User benoit # Date 1264093813 0 # Node ID 1cdf9bbfbc7fbab7034be16e4d9f304902c42d53 # Parent 9934ca6589468af085c2e8b34fef06ebc213acf7 Make output-example.c handle AAC audio. Patch by Martin Storsj martin martin st diff -r 9934ca658946 -r 1cdf9bbfbc7f output-example.c --- a/output-example.c Thu Jan 21 15:42:05 2010 +0000 +++ b/output-example.c Thu Jan 21 17:10:13 2010 +0000 @@ -75,6 +75,11 @@ c->bit_rate = 64000; c->sample_rate = 44100; c->channels = 2; + + // some formats want stream headers to be separate + if(oc->oformat->flags & AVFMT_GLOBALHEADER) + c->flags |= CODEC_FLAG_GLOBAL_HEADER; + return st; } @@ -156,7 +161,7 @@ pkt.size= avcodec_encode_audio(c, audio_outbuf, audio_outbuf_size, samples); - if (c->coded_frame->pts != AV_NOPTS_VALUE) + if (c->coded_frame && c->coded_frame->pts != AV_NOPTS_VALUE) pkt.pts= av_rescale_q(c->coded_frame->pts, c->time_base, st->time_base); pkt.flags |= PKT_FLAG_KEY; pkt.stream_index= st->index;