qtmux: support for ALAC

Fixes #580731.
This commit is contained in:
Mark Nauwelaerts 2010-02-16 16:24:12 +01:00 committed by Tim-Philipp Müller
parent 76b6997b55
commit bcc9fe0463
4 changed files with 46 additions and 2 deletions

View file

@ -3157,6 +3157,16 @@ build_mov_aac_extension (AtomTRAK * trak, const GstBuffer * codec_data)
return build_mov_wave_extension (trak, FOURCC_mp4a, mp4a, esds, TRUE);
}
AtomInfo *
build_mov_alac_extension (AtomTRAK * trak, const GstBuffer * codec_data)
{
AtomInfo *alac;
alac = build_codec_data_extension (FOURCC_alac, codec_data);
return build_mov_wave_extension (trak, FOURCC_alac, NULL, alac, TRUE);
}
AtomInfo *
build_fiel_extension (gint fields)
{

View file

@ -721,6 +721,7 @@ void atom_trak_set_video_type (AtomTRAK * trak, AtomsContext * context,
AtomInfo * build_codec_data_extension (guint32 fourcc, const GstBuffer * codec_data);
AtomInfo * build_mov_aac_extension (AtomTRAK * trak, const GstBuffer * codec_data);
AtomInfo * build_mov_alac_extension (AtomTRAK * trak, const GstBuffer * codec_data);
AtomInfo * build_esds_extension (AtomTRAK * trak, guint8 object_type,
guint8 stream_type, const GstBuffer * codec_data);
AtomInfo * build_jp2h_extension (AtomTRAK * trak, gint width, gint height,

View file

@ -2065,6 +2065,35 @@ gst_qt_mux_audio_sink_set_caps (GstPad * pad, GstCaps * caps)
entry.compression_id = -1;
ext_atom = build_ima_adpcm_extension (channels, rate, blocksize);
} else if (strcmp (mimetype, "audio/x-alac") == 0) {
GstBuffer *codec_config;
gint len;
entry.fourcc = FOURCC_alac;
/* let's check if codec data already comes with 'alac' atom prefix */
if (!codec_data || (len = GST_BUFFER_SIZE (codec_data)) < 28) {
GST_DEBUG_OBJECT (qtmux, "broken caps, codec data missing");
goto refuse_caps;
}
if (GST_READ_UINT32_LE (GST_BUFFER_DATA (codec_data) + 4) == FOURCC_alac) {
len -= 8;
codec_config = gst_buffer_create_sub ((GstBuffer *) codec_data, 8, len);
} else {
codec_config = gst_buffer_ref ((GstBuffer *) codec_data);
}
if (len != 28) {
/* does not look good, but perhaps some trailing unneeded stuff */
GST_WARNING_OBJECT (qtmux, "unexpected codec-data size, possibly broken");
}
if (format == GST_QT_MUX_FORMAT_QT)
ext_atom = build_mov_alac_extension (qtpad->trak, codec_config);
else
ext_atom = build_codec_data_extension (FOURCC_alac, codec_config);
/* set some more info */
entry.bytes_per_sample = 2;
entry.samples_per_packet =
GST_READ_UINT32_BE (GST_BUFFER_DATA (codec_config) + 4);
gst_buffer_unref (codec_config);
}
if (!entry.fourcc)

View file

@ -137,6 +137,9 @@
"block_align = (int)[64, 8096], " \
COMMON_AUDIO_CAPS(2, MAX)
#define ALAC_CAPS \
"audio/x-alac, " \
COMMON_AUDIO_CAPS(2, MAX)
/* FIXME 0.11 - take a look at bugs #580005 and #340375 */
GstQTMuxFormatProp gst_qt_mux_format_list[] = {
@ -166,7 +169,8 @@ GstQTMuxFormatProp gst_qt_mux_format_list[] = {
MP3_CAPS " ; "
AAC_CAPS " ; "
ADPCM_CAPS " ; "
"audio/x-alaw, " COMMON_AUDIO_CAPS (2, MAX) "; " AMR_CAPS)
"audio/x-alaw, " COMMON_AUDIO_CAPS (2, MAX) "; "
AMR_CAPS " ; " ALAC_CAPS)
}
,
/* ISO 14496-14: mp42 as ISO base media extension
@ -179,7 +183,7 @@ GstQTMuxFormatProp gst_qt_mux_format_list[] = {
GST_STATIC_CAPS ("video/quicktime, variant = (string) iso"),
GST_STATIC_CAPS (MPEG4V_CAPS "; " H264_CAPS ";"
"video/x-mp4-part," COMMON_VIDEO_CAPS),
GST_STATIC_CAPS (MP3_CAPS "; " AAC_CAPS)
GST_STATIC_CAPS (MP3_CAPS "; " AAC_CAPS " ; " ALAC_CAPS)
}
,
/* 3GPP Technical Specification 26.244 V7.3.0