qtmux: Allow MPEG-1 Layer 1 and 2 in addition to 3 in MP4
Via the MPEG-4 Part 3 spec we can support the other layers too. Also correct the samples per frame calculation for MP3 if it's MPEG-2 or MPEG-2.5. https://bugzilla.gnome.org/show_bug.cgi?id=765725
This commit is contained in:
parent
7c728db1f3
commit
f8b87c8a05
@ -3461,16 +3461,17 @@ gst_qt_mux_audio_sink_set_caps (GstQTPad * qtpad, GstCaps * caps)
|
|||||||
|
|
||||||
/* now map onto a fourcc, and some extra properties */
|
/* now map onto a fourcc, and some extra properties */
|
||||||
if (strcmp (mimetype, "audio/mpeg") == 0) {
|
if (strcmp (mimetype, "audio/mpeg") == 0) {
|
||||||
gint mpegversion = 0;
|
gint mpegversion = 0, mpegaudioversion = 0;
|
||||||
gint layer = -1;
|
gint layer = -1;
|
||||||
|
|
||||||
gst_structure_get_int (structure, "mpegversion", &mpegversion);
|
gst_structure_get_int (structure, "mpegversion", &mpegversion);
|
||||||
switch (mpegversion) {
|
switch (mpegversion) {
|
||||||
case 1:
|
case 1:
|
||||||
gst_structure_get_int (structure, "layer", &layer);
|
gst_structure_get_int (structure, "layer", &layer);
|
||||||
switch (layer) {
|
gst_structure_get_int (structure, "mpegaudioversion",
|
||||||
case 3:
|
&mpegaudioversion);
|
||||||
/* mp3 */
|
|
||||||
|
/* mp1/2/3 */
|
||||||
/* note: QuickTime player does not like mp3 either way in iso/mp4 */
|
/* note: QuickTime player does not like mp3 either way in iso/mp4 */
|
||||||
if (format == GST_QT_MUX_FORMAT_QT)
|
if (format == GST_QT_MUX_FORMAT_QT)
|
||||||
entry.fourcc = FOURCC__mp3;
|
entry.fourcc = FOURCC__mp3;
|
||||||
@ -3481,10 +3482,17 @@ gst_qt_mux_audio_sink_set_caps (GstQTPad * qtpad, GstCaps * caps)
|
|||||||
ESDS_STREAM_TYPE_AUDIO, codec_data, qtpad->avg_bitrate,
|
ESDS_STREAM_TYPE_AUDIO, codec_data, qtpad->avg_bitrate,
|
||||||
qtpad->max_bitrate);
|
qtpad->max_bitrate);
|
||||||
}
|
}
|
||||||
|
if (layer == 1) {
|
||||||
|
g_warn_if_fail (format == GST_QT_MUX_FORMAT_MP4);
|
||||||
|
entry.samples_per_packet = 384;
|
||||||
|
} else if (layer == 2) {
|
||||||
|
g_warn_if_fail (format == GST_QT_MUX_FORMAT_MP4);
|
||||||
entry.samples_per_packet = 1152;
|
entry.samples_per_packet = 1152;
|
||||||
entry.bytes_per_sample = 2;
|
} else {
|
||||||
break;
|
g_warn_if_fail (layer == 3);
|
||||||
|
entry.samples_per_packet = (mpegaudioversion <= 1) ? 1152 : 576;
|
||||||
}
|
}
|
||||||
|
entry.bytes_per_sample = 2;
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
|
|
||||||
|
@ -104,6 +104,12 @@
|
|||||||
"layer = (int) 3, " \
|
"layer = (int) 3, " \
|
||||||
COMMON_AUDIO_CAPS (2, MAX)
|
COMMON_AUDIO_CAPS (2, MAX)
|
||||||
|
|
||||||
|
#define MP123_CAPS \
|
||||||
|
"audio/mpeg, " \
|
||||||
|
"mpegversion = (int) 1, " \
|
||||||
|
"layer = (int) [1, 3], " \
|
||||||
|
COMMON_AUDIO_CAPS (2, MAX)
|
||||||
|
|
||||||
#define AAC_CAPS \
|
#define AAC_CAPS \
|
||||||
"audio/mpeg, " \
|
"audio/mpeg, " \
|
||||||
"mpegversion = (int) 4, " \
|
"mpegversion = (int) 4, " \
|
||||||
@ -190,7 +196,7 @@ GstQTMuxFormatProp gst_qt_mux_format_list[] = {
|
|||||||
GST_STATIC_CAPS ("video/quicktime, variant = (string) iso"),
|
GST_STATIC_CAPS ("video/quicktime, variant = (string) iso"),
|
||||||
GST_STATIC_CAPS (MPEG4V_CAPS "; " H264_CAPS ";"
|
GST_STATIC_CAPS (MPEG4V_CAPS "; " H264_CAPS ";"
|
||||||
"video/x-mp4-part," COMMON_VIDEO_CAPS),
|
"video/x-mp4-part," COMMON_VIDEO_CAPS),
|
||||||
GST_STATIC_CAPS (MP3_CAPS "; "
|
GST_STATIC_CAPS (MP123_CAPS "; "
|
||||||
AAC_CAPS " ; " AC3_CAPS " ; " ALAC_CAPS " ; " OPUS_CAPS),
|
AAC_CAPS " ; " AC3_CAPS " ; " ALAC_CAPS " ; " OPUS_CAPS),
|
||||||
GST_STATIC_CAPS (TEXT_UTF8)}
|
GST_STATIC_CAPS (TEXT_UTF8)}
|
||||||
,
|
,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user