diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-01-27 13:20:54 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-01-27 13:21:02 +0100 |
commit | 010311d67337419b218f0834b019821b08552127 (patch) | |
tree | 6f3daedd52d146ccace63070686b03f36e111896 /doc | |
parent | a7fa1b9aa104491e44a0489e09febe036c70f4f9 (diff) | |
parent | 749a89d1b8bb73b4d4f14c48f33259a1300c1761 (diff) | |
download | ffmpeg-010311d67337419b218f0834b019821b08552127.tar.gz |
Merge commit '749a89d1b8bb73b4d4f14c48f33259a1300c1761'
* commit '749a89d1b8bb73b4d4f14c48f33259a1300c1761':
examples/transcode_aac: properly select the output sample format
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'doc')
-rw-r--r-- | doc/examples/transcode_aac.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/doc/examples/transcode_aac.c b/doc/examples/transcode_aac.c index 6998aac72b..1e0010d4f3 100644 --- a/doc/examples/transcode_aac.c +++ b/doc/examples/transcode_aac.c @@ -41,11 +41,9 @@ #include "libswresample/swresample.h" /** The output bit rate in kbit/s */ -#define OUTPUT_BIT_RATE 48000 +#define OUTPUT_BIT_RATE 96000 /** The number of output channels */ #define OUTPUT_CHANNELS 2 -/** The audio sample output format */ -#define OUTPUT_SAMPLE_FORMAT AV_SAMPLE_FMT_S16 /** * Convert an error code into a text message. @@ -179,9 +177,12 @@ static int open_output_file(const char *filename, (*output_codec_context)->channels = OUTPUT_CHANNELS; (*output_codec_context)->channel_layout = av_get_default_channel_layout(OUTPUT_CHANNELS); (*output_codec_context)->sample_rate = input_codec_context->sample_rate; - (*output_codec_context)->sample_fmt = AV_SAMPLE_FMT_S16; + (*output_codec_context)->sample_fmt = output_codec->sample_fmts[0]; (*output_codec_context)->bit_rate = OUTPUT_BIT_RATE; + /** Allow the use of the experimental AAC encoder */ + (*output_codec_context)->strict_std_compliance = FF_COMPLIANCE_EXPERIMENTAL; + /** * Some container formats (like MP4) require global headers to be present * Mark the encoder so that it behaves accordingly. @@ -271,10 +272,11 @@ static int init_resampler(AVCodecContext *input_codec_context, } /** Initialize a FIFO buffer for the audio samples to be encoded. */ -static int init_fifo(AVAudioFifo **fifo) +static int init_fifo(AVAudioFifo **fifo, AVCodecContext *output_codec_context) { /** Create the FIFO buffer based on the specified output sample format. */ - if (!(*fifo = av_audio_fifo_alloc(OUTPUT_SAMPLE_FORMAT, OUTPUT_CHANNELS, 1))) { + if (!(*fifo = av_audio_fifo_alloc(output_codec_context->sample_fmt, + output_codec_context->channels, 1))) { fprintf(stderr, "Could not allocate FIFO\n"); return AVERROR(ENOMEM); } @@ -659,7 +661,7 @@ int main(int argc, char **argv) &resample_context)) goto cleanup; /** Initialize the FIFO buffer to store audio samples to be encoded. */ - if (init_fifo(&fifo)) + if (init_fifo(&fifo, output_codec_context)) goto cleanup; /** Write the header of the output file container. */ if (write_output_file_header(output_format_context)) |