aboutsummaryrefslogtreecommitdiffstats
path: root/ffmpeg.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-04-06 02:59:49 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-04-06 02:59:49 +0200
commit11d78415ca1beaa39303c280d7896024edc45aa7 (patch)
treecea1da5ffc8ae3e09d7375241a1a334e27703610 /ffmpeg.c
parentee6db0de3760ceb7b7a9968a5322c1d8e8e23861 (diff)
parent5371803dd5d9f7bbc62d68274084d25f10a8dc61 (diff)
downloadffmpeg-11d78415ca1beaa39303c280d7896024edc45aa7.tar.gz
Merge remote branch 'qatar/master'
* qatar/master: psymodel: extend API to include PE and bit allocation. avio: always compile dyn_buf functions Remove unnecessary parameter from ff_thread_init() and fix behavior Revert "aac_latm_dec: use aac context and aac m4ac" configure: tell user if libva is enabled like the rest of external libs. Add silence support for AV_SAMPLE_FMT_U8. avio: make URL_PROTOCOL_FLAG_NESTED_SCHEME internal avio: deprecate av_url_read_seek avio: deprecate av_url_read_pause ac3enc: NEON optimised extract_exponents Conflicts: libavcodec/utils.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'ffmpeg.c')
-rw-r--r--ffmpeg.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/ffmpeg.c b/ffmpeg.c
index e2692de5e2..ad7e49d743 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1475,6 +1475,14 @@ static void print_report(AVFormatContext **output_files,
}
}
+static void generate_silence(uint8_t* buf, enum AVSampleFormat sample_fmt, size_t size)
+{
+ int fill_char = 0x00;
+ if (sample_fmt == AV_SAMPLE_FMT_U8)
+ fill_char = 0x80;
+ memset(buf, fill_char, size);
+}
+
/* pkt = NULL means EOF (needed to flush decoder buffers) */
static int output_packet(AVInputStream *ist, int ist_index,
AVOutputStream **ost_table, int nb_ostreams,
@@ -1826,7 +1834,7 @@ static int output_packet(AVInputStream *ist, int ist_index,
int frame_bytes = enc->frame_size*osize*enc->channels;
if (allocated_audio_buf_size < frame_bytes)
ffmpeg_exit(1);
- memset(audio_buf+fifo_bytes, 0, frame_bytes - fifo_bytes);
+ generate_silence(audio_buf+fifo_bytes, enc->sample_fmt, frame_bytes - fifo_bytes);
}
ret = avcodec_encode_audio(enc, bit_buffer, bit_buffer_size, (short *)audio_buf);