gst_buffer_unref (codec_data);
}
- if ((err =
- aacDecoder_SetParam (self->dec, AAC_PCM_MAX_OUTPUT_CHANNELS,
- 0)) != AAC_DEC_OK) {
+ err = aacDecoder_SetParam (self->dec, AAC_PCM_MAX_OUTPUT_CHANNELS, 0);
+ if (err != AAC_DEC_OK) {
GST_ERROR_OBJECT (self, "Failed to disable downmixing: %d", err);
return FALSE;
}
/* Choose WAV channel mapping to get interleaving even with libfdk-aac 2.0.0
* The pChannelIndices retain the indices from the standard MPEG mapping so
* we're agnostic to the actual order. */
- if ((err =
- aacDecoder_SetParam (self->dec, AAC_PCM_OUTPUT_CHANNEL_MAPPING,
- 1)) != AAC_DEC_OK) {
+ err = aacDecoder_SetParam (self->dec, AAC_PCM_OUTPUT_CHANNEL_MAPPING, 1);
+ if (err != AAC_DEC_OK) {
GST_ERROR_OBJECT (self, "Failed to set output channel mapping: %d", err);
return FALSE;
}
gst_buffer_map (inbuf, &imap, GST_MAP_READ);
valid = size = imap.size;
- if ((err =
- aacDecoder_Fill (self->dec, (guint8 **) & imap.data, &size,
- &valid)) != AAC_DEC_OK) {
+ err = aacDecoder_Fill (self->dec, (guint8 **) & imap.data, &size, &valid);
+ if (err != AAC_DEC_OK) {
GST_AUDIO_DECODER_ERROR (self, 1, STREAM, DECODE, (NULL),
("filling error: %d", err), ret);
goto out;
}
- if (GST_BUFFER_IS_DISCONT (inbuf))
+ if (GST_BUFFER_IS_DISCONT (inbuf)) {
flags |= AACDEC_INTR;
+ }
} else {
flags |= AACDEC_FLUSH;
}
- if ((err =
- aacDecoder_DecodeFrame (self->dec, self->decode_buffer,
- self->decode_buffer_size, flags)) != AAC_DEC_OK) {
- if (err == AAC_DEC_TRANSPORT_SYNC_ERROR) {
- ret = GST_FLOW_OK;
- outbuf = NULL;
- goto finish;
- }
+ err = aacDecoder_DecodeFrame (self->dec, self->decode_buffer,
+ self->decode_buffer_size, flags);
+ if (err == AAC_DEC_TRANSPORT_SYNC_ERROR) {
+ ret = GST_FLOW_OK;
+ outbuf = NULL;
+ goto finish;
+ } else if (err != AAC_DEC_OK) {
GST_AUDIO_DECODER_ERROR (self, 1, STREAM, DECODE, (NULL),
("decoding error: %d", err), ret);
goto out;
if (self->dec) {
AAC_DECODER_ERROR err;
- if ((err =
- aacDecoder_DecodeFrame (self->dec, self->decode_buffer,
- self->decode_buffer_size, AACDEC_FLUSH)) != AAC_DEC_OK) {
+ err = aacDecoder_DecodeFrame (self->dec, self->decode_buffer,
+ self->decode_buffer_size, AACDEC_FLUSH);
+ if (err != AAC_DEC_OK) {
GST_ERROR_OBJECT (self, "flushing error: %d", err);
}
}
if (allowed_caps)
gst_caps_unref (allowed_caps);
- if ((err =
- aacEncOpen (&self->enc, 0,
- GST_AUDIO_INFO_CHANNELS (info))) != AACENC_OK) {
+ err = aacEncOpen (&self->enc, 0, GST_AUDIO_INFO_CHANNELS (info));
+ if (err != AACENC_OK) {
GST_ERROR_OBJECT (self, "Unable to open encoder: %d\n", err);
return FALSE;
}
out_desc.bufSizes = &out_sizes;
out_desc.bufElSizes = &out_el_sizes;
- if ((err = aacEncEncode (self->enc, &in_desc, &out_desc, &in_args,
- &out_args)) != AACENC_OK) {
- if (!inbuf && err == AACENC_ENCODE_EOF)
- goto out;
-
+ err = aacEncEncode (self->enc, &in_desc, &out_desc, &in_args, &out_args);
+ if (err == AACENC_ENCODE_EOF && !inbuf)
+ goto out;
+ else if (err != AACENC_OK) {
GST_ERROR_OBJECT (self, "Failed to encode data: %d", err);
ret = GST_FLOW_ERROR;
goto out;