Commit 52421466 authored by benoit's avatar benoit

Make output-example.c handle AAC audio.

Patch by Martin Storsjö martin martin st


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@21367 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent a05ce3c3
...@@ -75,6 +75,11 @@ static AVStream *add_audio_stream(AVFormatContext *oc, enum CodecID codec_id) ...@@ -75,6 +75,11 @@ static AVStream *add_audio_stream(AVFormatContext *oc, enum CodecID codec_id)
c->bit_rate = 64000; c->bit_rate = 64000;
c->sample_rate = 44100; c->sample_rate = 44100;
c->channels = 2; 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; return st;
} }
...@@ -156,7 +161,7 @@ static void write_audio_frame(AVFormatContext *oc, AVStream *st) ...@@ -156,7 +161,7 @@ static void write_audio_frame(AVFormatContext *oc, AVStream *st)
pkt.size= avcodec_encode_audio(c, audio_outbuf, audio_outbuf_size, samples); 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.pts= av_rescale_q(c->coded_frame->pts, c->time_base, st->time_base);
pkt.flags |= PKT_FLAG_KEY; pkt.flags |= PKT_FLAG_KEY;
pkt.stream_index= st->index; pkt.stream_index= st->index;
......
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