* commit '
1b9b6d6e5ea556b6d307f9d473f54f6406fdc3c8':
qcelp: decode directly to the user-provided AVFrame
pcm-bluray: decode directly to the user-provided AVFrame
nellymoser: decode directly to the user-provided AVFrame
mpc7/8: decode directly to the user-provided AVFrame
mpegaudio: decode directly to the user-provided AVFrame
mlp/truehd: decode directly to the user-provided AVFrame
Conflicts:
libavcodec/mpc7.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
buf_size -= 4;
/* get output buffer */
- c->frame.nb_samples = MPC_FRAME_SIZE;
- if ((ret = ff_get_buffer(avctx, &c->frame)) < 0) {
- frame->nb_samples = last_frame ? c->lastframelen : MPC_FRAME_SIZE;
++ frame->nb_samples = MPC_FRAME_SIZE;
+ if ((ret = ff_get_buffer(avctx, frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
for(ch = 0; ch < 2; ch++)
idx_to_quant(c, &gb, bands[i].res[ch], c->Q[ch] + off);
- ff_mpc_dequantize_and_synth(c, mb, (int16_t **)c->frame.extended_data, 2);
+ ff_mpc_dequantize_and_synth(c, mb, (int16_t **)frame->extended_data, 2);
+ if(last_frame)
- c->frame.nb_samples = c->lastframelen;
++ frame->nb_samples = c->lastframelen;
bits_used = get_bits_count(&gb);
bits_avail = buf_size * 8;
c->frames = 1 << (get_bits(&gb, 3) * 2);
avctx->sample_fmt = AV_SAMPLE_FMT_S16P;
- avctx->channel_layout = (avctx->channels==2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO;
+ avctx->channel_layout = (channels==2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO;
+ avctx->channels = channels;
- avcodec_get_frame_defaults(&c->frame);
- avctx->coded_frame = &c->frame;
-
if(vlc_initialized) return 0;
av_log(avctx, AV_LOG_DEBUG, "Initing VLC\n");
s->last_buf_size += i;
}
+ if(nb_frames < 0)
+ return nb_frames;
+
/* get output buffer */
if (!samples) {
- s->frame.nb_samples = s->avctx->frame_size;
- if ((ret = ff_get_buffer(s->avctx, &s->frame)) < 0) {
+ av_assert0(s->frame != NULL);
+ s->frame->nb_samples = s->avctx->frame_size;
+ if ((ret = ff_get_buffer(s->avctx, s->frame)) < 0) {
av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
static int decode_tag(AVCodecContext *avctx, void *data,
int *got_frame_ptr, AVPacket *avpkt)
{
+ AVFrame *frame = data;
const uint8_t *buf = avpkt->data;
+ const uint8_t *side=av_packet_get_side_data(avpkt, 'F', NULL);
int buf_size = avpkt->size;
NellyMoserDecodeContext *s = avctx->priv_data;
int blocks, i, ret;
* 22050 Hz - 4
* 44100 Hz - 8
*/
+ if(side && blocks>1 && avctx->sample_rate%11025==0 && (1<<((side[0]>>2)&3)) == blocks)
+ avctx->sample_rate= 11025*(blocks/2);
/* get output buffer */
- s->frame.nb_samples = NELLY_SAMPLES * blocks;
- if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) {
+ frame->nb_samples = NELLY_SAMPLES * blocks;
+ if ((ret = ff_get_buffer(avctx, frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}