diff options
-rw-r--r-- | gst/qtmux/atoms.c | 52 | ||||
-rw-r--r-- | gst/qtmux/atoms.h | 2 | ||||
-rw-r--r-- | gst/qtmux/gstqtmux.c | 8 | ||||
-rw-r--r-- | gst/qtmux/gstqtmuxmap.c | 24 |
4 files changed, 77 insertions, 9 deletions
diff --git a/gst/qtmux/atoms.c b/gst/qtmux/atoms.c index cbe66f62..df6958e0 100644 --- a/gst/qtmux/atoms.c +++ b/gst/qtmux/atoms.c @@ -2972,3 +2972,55 @@ build_codec_data_extension (guint32 fourcc, const GstBuffer * codec_data) return result; } + +AtomInfo * +build_amr_extension () +{ + guint8 ext[9]; + GstBuffer *buf; + AtomInfo *res; + + buf = gst_buffer_new (); + GST_BUFFER_DATA (buf) = ext; + GST_BUFFER_SIZE (buf) = sizeof (ext); + + /* vendor */ + GST_WRITE_UINT32_LE (ext, 0); + /* decoder version */ + GST_WRITE_UINT8 (ext + 4, 0); + /* mode set (all modes) */ + GST_WRITE_UINT16_BE (ext + 5, 0x81FF); + /* mode change period (no restriction) */ + GST_WRITE_UINT8 (ext + 7, 0); + /* frames per sample */ + GST_WRITE_UINT8 (ext + 8, 1); + + res = build_codec_data_extension (GST_MAKE_FOURCC ('d', 'a', 'm', 'r'), buf); + gst_buffer_unref (buf); + return res; +} + +AtomInfo * +build_h263_extension () +{ + guint8 ext[7]; + GstBuffer *buf; + AtomInfo *res; + + buf = gst_buffer_new (); + GST_BUFFER_DATA (buf) = ext; + GST_BUFFER_SIZE (buf) = sizeof (ext); + + /* vendor */ + GST_WRITE_UINT32_LE (ext, 0); + /* decoder version */ + GST_WRITE_UINT8 (ext + 4, 0); + /* level / profile */ + /* FIXME ? maybe ? obtain somewhere; baseline for now */ + GST_WRITE_UINT8 (ext + 5, 10); + GST_WRITE_UINT8 (ext + 6, 0); + + res = build_codec_data_extension (GST_MAKE_FOURCC ('d', '2', '6', '3'), buf); + gst_buffer_unref (buf); + return res; +} diff --git a/gst/qtmux/atoms.h b/gst/qtmux/atoms.h index 631aaf41..4d8dce19 100644 --- a/gst/qtmux/atoms.h +++ b/gst/qtmux/atoms.h @@ -631,6 +631,8 @@ 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, guint32 fourcc); +AtomInfo * build_amr_extension (); +AtomInfo * build_h263_extension (); /* diff --git a/gst/qtmux/gstqtmux.c b/gst/qtmux/gstqtmux.c index fe784f16..25fd4e37 100644 --- a/gst/qtmux/gstqtmux.c +++ b/gst/qtmux/gstqtmux.c @@ -1269,6 +1269,13 @@ gst_qt_mux_audio_sink_set_caps (GstPad * pad, GstCaps * caps) entry.sample_size = 16; entry.samples_per_packet = 160; entry.bytes_per_sample = 2; + ext_atom = build_amr_extension (); + } else if (strcmp (mimetype, "audio/AMR-WB") == 0) { + entry.fourcc = FOURCC_sawb; + entry.sample_size = 16; + entry.samples_per_packet = 320; + entry.bytes_per_sample = 2; + ext_atom = build_amr_extension (); } else if (strcmp (mimetype, "audio/x-raw-int") == 0) { gint width; gint depth; @@ -1472,6 +1479,7 @@ gst_qt_mux_video_sink_set_caps (GstPad * pad, GstCaps * caps) } } else if (strcmp (mimetype, "video/x-h263") == 0) { entry.fourcc = FOURCC_h263; + ext_atom = build_h263_extension (); } else if (strcmp (mimetype, "video/x-divx") == 0 || strcmp (mimetype, "video/mpeg") == 0) { gint version = 0; diff --git a/gst/qtmux/gstqtmuxmap.c b/gst/qtmux/gstqtmuxmap.c index af1cb31d..9b6ae581 100644 --- a/gst/qtmux/gstqtmuxmap.c +++ b/gst/qtmux/gstqtmuxmap.c @@ -56,6 +56,10 @@ "width = (int) [ 16, 4096 ], " \ "height = (int) [ 16, 4096 ] " +#define H263_CAPS \ + "video/x-h263, " \ + COMMON_VIDEO_CAPS + #define H264_CAPS \ "video/x-h264, " \ COMMON_VIDEO_CAPS @@ -112,6 +116,13 @@ "mpegversion = (int) 4, " \ COMMON_AUDIO_CAPS (8, MAX) +#define AMR_CAPS \ + "audio/AMR, " \ + "rate = (int) 8000, " \ + "channels = [ 1, 2 ]; " \ + "audio/AMR-WB, " \ + "rate = (int) 16000, " \ + "channels = [ 1, 2 ] " GstQTMuxFormatProp gst_qt_mux_format_list[] = { /* original QuickTime format; see Apple site (e.g. qtff.pdf) */ @@ -126,10 +137,8 @@ GstQTMuxFormatProp gst_qt_mux_format_list[] = { "video/x-raw-yuv, " "format = (fourcc) UYVY, " COMMON_VIDEO_CAPS "; " - "video/x-h263, " - "h263version = (string) h263, " - COMMON_VIDEO_CAPS "; " MPEG4V_CAPS "; " + H263_CAPS "; " H264_CAPS "; " "video/x-dv, " "systemstream = (boolean) false, " @@ -140,9 +149,7 @@ GstQTMuxFormatProp gst_qt_mux_format_list[] = { GST_STATIC_CAPS (PCM_CAPS_FULL "; " MP3_CAPS " ; " AAC_CAPS " ; " - "audio/x-alaw, " - COMMON_AUDIO_CAPS (2, MAX) "; " - "audio/x-mulaw, " COMMON_AUDIO_CAPS (2, MAX)) + "audio/x-alaw, " COMMON_AUDIO_CAPS (2, MAX) "; " AMR_CAPS) } , /* ISO 14496-14: mp42 as ISO base media extension @@ -167,9 +174,8 @@ GstQTMuxFormatProp gst_qt_mux_format_list[] = { "3GPP", "GstGPPMux", GST_STATIC_CAPS ("application/x-3gp"), - GST_STATIC_CAPS (H264_CAPS), - GST_STATIC_CAPS ("audio/AMR, " - COMMON_AUDIO_CAPS (8, MAX) "; " MP3_CAPS "; " AAC_CAPS) + GST_STATIC_CAPS (H263_CAPS "; " H264_CAPS), + GST_STATIC_CAPS (AMR_CAPS "; " MP3_CAPS "; " AAC_CAPS) } , /* ISO 15444-3: Motion-JPEG-2000 (also ISO base media extension) */ |