Commit 2a741974 authored by mru's avatar mru

cosmetics: don't needlessly open new blocks


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@7836 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent f99873e9
...@@ -208,10 +208,15 @@ dts_decode_frame(AVCodecContext * avctx, void *data, int *data_size, ...@@ -208,10 +208,15 @@ dts_decode_frame(AVCodecContext * avctx, void *data, int *data_size,
int bit_rate; int bit_rate;
int len; int len;
dts_state_t *state = avctx->priv_data; dts_state_t *state = avctx->priv_data;
level_t level;
sample_t bias;
int i;
*data_size = 0; *data_size = 0;
while(1) { while(1) {
int length;
len = end - start; len = end - start;
if(!len) if(!len)
break; break;
...@@ -225,60 +230,50 @@ dts_decode_frame(AVCodecContext * avctx, void *data, int *data_size, ...@@ -225,60 +230,50 @@ dts_decode_frame(AVCodecContext * avctx, void *data, int *data_size,
if(bufpos != buf + HEADER_SIZE) if(bufpos != buf + HEADER_SIZE)
break; break;
{ length = dts_syncinfo(state, buf, &flags, &sample_rate, &bit_rate,
int length; &frame_length);
if(!length) {
length = av_log(NULL, AV_LOG_INFO, "skip\n");
dts_syncinfo(state, buf, &flags, &sample_rate, &bit_rate, for(bufptr = buf; bufptr < buf + HEADER_SIZE - 1; bufptr++)
&frame_length); bufptr[0] = bufptr[1];
if(!length) { continue;
av_log(NULL, AV_LOG_INFO, "skip\n");
for(bufptr = buf; bufptr < buf + HEADER_SIZE - 1; bufptr++)
bufptr[0] = bufptr[1];
continue;
}
bufpos = buf + length;
} }
bufpos = buf + length;
}
flags = 2; /* ???????????? */
level = CONVERT_LEVEL;
bias = CONVERT_BIAS;
flags |= DTS_ADJUST_LEVEL;
if(dts_frame(state, buf, &flags, &level, bias)) {
av_log(avctx, AV_LOG_ERROR, "dts_frame() failed\n");
goto end;
} }
{ avctx->sample_rate = sample_rate;
level_t level; avctx->channels = channels_multi(flags);
sample_t bias; avctx->bit_rate = bit_rate;
int i;
for(i = 0; i < dts_blocks_num(state); i++) {
flags = 2; /* ???????????? */ int chans;
level = CONVERT_LEVEL;
bias = CONVERT_BIAS; if(dts_block(state)) {
av_log(avctx, AV_LOG_ERROR, "dts_block() failed\n");
flags |= DTS_ADJUST_LEVEL; goto end;
if(dts_frame(state, buf, &flags, &level, bias))
goto error;
avctx->sample_rate = sample_rate;
avctx->channels = channels_multi(flags);
avctx->bit_rate = bit_rate;
for(i = 0; i < dts_blocks_num(state); i++) {
if(dts_block(state))
goto error;
{
int chans;
chans = channels_multi(flags);
convert2s16_multi(dts_samples(state), out_samples,
flags & (DTS_CHANNEL_MASK | DTS_LFE));
out_samples += 256 * chans;
*data_size += 256 * sizeof(int16_t) * chans;
}
} }
bufptr = buf;
bufpos = buf + HEADER_SIZE; chans = channels_multi(flags);
return start - buff; convert2s16_multi(dts_samples(state), out_samples,
error: flags & (DTS_CHANNEL_MASK | DTS_LFE));
av_log(NULL, AV_LOG_ERROR, "error\n");
bufptr = buf; out_samples += 256 * chans;
bufpos = buf + HEADER_SIZE; *data_size += 256 * sizeof(int16_t) * chans;
} }
end:
bufptr = buf;
bufpos = buf + HEADER_SIZE;
return start - buff; return start - buff;
} }
......
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