mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 22:36:33 +00:00
ffmpeg: Add codec mapping for AAC LATM/LOAS
Also add the stream-format fields to the CODEC_ID_AAC caps. Fixes bug #650695.
This commit is contained in:
parent
5ad61c55a6
commit
df40381a83
2 changed files with 36 additions and 4 deletions
|
@ -440,6 +440,7 @@ gst_ff_aud_caps_new (AVCodecContext * context, enum CodecID codec_id,
|
|||
case CODEC_ID_AC3:
|
||||
case CODEC_ID_EAC3:
|
||||
case CODEC_ID_AAC:
|
||||
case CODEC_ID_AAC_LATM:
|
||||
case CODEC_ID_DTS:
|
||||
maxchannels = 6;
|
||||
break;
|
||||
|
@ -957,8 +958,36 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
|
|||
break;
|
||||
|
||||
case CODEC_ID_AAC:
|
||||
{
|
||||
caps = gst_ff_aud_caps_new (context, codec_id, "audio/mpeg",
|
||||
"mpegversion", G_TYPE_INT, 4, NULL);
|
||||
|
||||
if (!encode) {
|
||||
GValue arr = { 0, };
|
||||
GValue item = { 0, };
|
||||
|
||||
g_value_init (&arr, GST_TYPE_LIST);
|
||||
g_value_init (&item, G_TYPE_STRING);
|
||||
g_value_set_string (&item, "raw");
|
||||
gst_value_list_append_value (&arr, &item);
|
||||
g_value_set_string (&item, "adts");
|
||||
gst_value_list_append_value (&arr, &item);
|
||||
g_value_set_string (&item, "adif");
|
||||
gst_value_list_append_value (&arr, &item);
|
||||
g_value_unset (&item);
|
||||
|
||||
gst_caps_set_value (caps, "stream-format", &arr);
|
||||
g_value_unset (&arr);
|
||||
} else {
|
||||
gst_caps_set_simple (caps, "stream-format", G_TYPE_STRING, "raw", NULL);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case CODEC_ID_AAC_LATM: /* LATM/LOAS AAC syntax */
|
||||
caps = gst_ff_aud_caps_new (context, codec_id, "audio/mpeg",
|
||||
"mpegversion", G_TYPE_INT, 4, "stream-format", G_TYPE_STRING, "loas",
|
||||
NULL);
|
||||
break;
|
||||
|
||||
case CODEC_ID_ASV1:
|
||||
|
|
|
@ -827,11 +827,13 @@ gst_ffmpegdec_setcaps (GstPad * pad, GstCaps * caps)
|
|||
ffmpegdec->context->flags |= CODEC_FLAG_EMU_EDGE;
|
||||
}
|
||||
|
||||
/* for AAC we only use av_parse if not on raw caps */
|
||||
if (oclass->in_plugin->id == CODEC_ID_AAC) {
|
||||
/* for AAC we only use av_parse if not on stream-format==raw or ==loas */
|
||||
if (oclass->in_plugin->id == CODEC_ID_AAC
|
||||
|| oclass->in_plugin->id == CODEC_ID_AAC_LATM) {
|
||||
const gchar *format = gst_structure_get_string (structure, "stream-format");
|
||||
|
||||
if (format == NULL || strcmp (format, "raw") == 0) {
|
||||
if (format == NULL || strcmp (format, "raw") == 0 ||
|
||||
oclass->in_plugin->id == CODEC_ID_AAC_LATM) {
|
||||
ffmpegdec->turnoff_parser = TRUE;
|
||||
}
|
||||
}
|
||||
|
@ -2134,7 +2136,8 @@ gst_ffmpegdec_audio_frame (GstFFMpegDec * ffmpegdec,
|
|||
|
||||
/* If we don't error out after the first failed read with the AAC decoder,
|
||||
* we must *not* carry on pushing data, else we'll cause segfaults... */
|
||||
if (len == -1 && in_plugin->id == CODEC_ID_AAC) {
|
||||
if (len == -1 && (in_plugin->id == CODEC_ID_AAC
|
||||
|| in_plugin->id == CODEC_ID_AAC_LATM)) {
|
||||
GST_ELEMENT_ERROR (ffmpegdec, STREAM, DECODE, (NULL),
|
||||
("Decoding of AAC stream by FFMPEG failed."));
|
||||
*ret = GST_FLOW_ERROR;
|
||||
|
|
Loading…
Reference in a new issue