Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Schlaile <peter@schlaile.de>2006-05-19 17:30:23 +0400
committerPeter Schlaile <peter@schlaile.de>2006-05-19 17:30:23 +0400
commit33b8aba3e37986b98e60ae6e90e75cc8b9abbe25 (patch)
tree8396070fec71ad6a28a3ba432bc2bd01f25f07bf /source/blender/src/hddaudio.c
parent594b0bf041cc9fb4dbb3445ad1333930df700829 (diff)
=== Sequencer ===
Bugfixes: - Made the HDD-Audio-Code silence buffers in advance before doing a seek operation. Stops noise on end of file or decoding errors. - Corrected hanging of audio decoding loop bug on some MP3-files. (you had to close blender and restart) - Made preseeking code not seek before beginning of file. seqaudio: - made some "local globals" static. Problems remaining: VBR-MP3-length isn't detected correctly so the displayed sequence strip is too long...
Diffstat (limited to 'source/blender/src/hddaudio.c')
-rw-r--r--source/blender/src/hddaudio.c40
1 files changed, 28 insertions, 12 deletions
diff --git a/source/blender/src/hddaudio.c b/source/blender/src/hddaudio.c
index 7d8493ddb36..c7dd33ab977 100644
--- a/source/blender/src/hddaudio.c
+++ b/source/blender/src/hddaudio.c
@@ -274,6 +274,11 @@ static void sound_hdaudio_extract_small_block(
decode_pos -= bl_size;
+ memset(hdaudio->decode_cache + decode_pos, 0,
+ (hdaudio->decode_cache_size - decode_pos)
+ * sizeof(short));
+
+
while(av_read_frame(hdaudio->pFormatCtx, &packet) >= 0) {
int data_size;
int len;
@@ -296,16 +301,17 @@ static void sound_hdaudio_extract_small_block(
&data_size,
audio_pkt_data,
audio_pkt_size);
- if (data_size <= 0) {
- continue;
- }
- if (len < 0) {
+ if (len <= 0) {
audio_pkt_size = 0;
break;
}
audio_pkt_size -= len;
audio_pkt_data += len;
+
+ if (data_size <= 0) {
+ continue;
+ }
decode_pos += data_size / sizeof(short);
if (decode_pos + data_size
@@ -342,6 +348,8 @@ static void sound_hdaudio_extract_small_block(
long long pos = (long long) frame_position * AV_TIME_BASE
* hdaudio->frame_duration / AV_TIME_BASE;
+ long long seek_pos;
+
hdaudio->frame_position = frame_position;
if (st_time == AV_NOPTS_VALUE) {
@@ -355,14 +363,21 @@ static void sound_hdaudio_extract_small_block(
specified...)
*/
- av_seek_frame(hdaudio->pFormatCtx, -1,
- pos
- - (AV_TIME_BASE
+ seek_pos = pos - (AV_TIME_BASE
* hdaudio->frame_duration
- / AV_TIME_BASE / 10),
+ / AV_TIME_BASE / 10);
+ if (seek_pos < 0) {
+ seek_pos = pos;
+ }
+
+ av_seek_frame(hdaudio->pFormatCtx, -1,
+ seek_pos,
AVSEEK_FLAG_ANY | AVSEEK_FLAG_BACKWARD);
avcodec_flush_buffers(hdaudio->pCodecCtx);
+ memset(hdaudio->decode_cache, 0,
+ hdaudio->decode_cache_size * sizeof(short));
+
hdaudio->decode_cache_zero = 0;
while(av_read_frame(hdaudio->pFormatCtx, &packet) >= 0) {
@@ -430,16 +445,17 @@ static void sound_hdaudio_extract_small_block(
&data_size,
audio_pkt_data,
audio_pkt_size);
- if (data_size <= 0) {
- continue;
- }
- if (len < 0) {
+ if (len <= 0) {
audio_pkt_size = 0;
break;
}
audio_pkt_size -= len;
audio_pkt_data += len;
+
+ if (data_size <= 0) {
+ continue;
+ }
decode_pos += data_size / sizeof(short);
if (decode_pos + data_size