mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 14:56:36 +00:00
qtdemux: support wma & vc-1
https://bugzilla.gnome.org/show_bug.cgi?id=596321
This commit is contained in:
parent
6f05c5c050
commit
293e6a61b4
3 changed files with 99 additions and 0 deletions
|
@ -6149,6 +6149,30 @@ qtdemux_parse_trak (GstQTDemux * qtdemux, GNode * trak)
|
|||
qtdemux_parse_theora_extension (qtdemux, stream, xdxt);
|
||||
break;
|
||||
}
|
||||
case FOURCC_ovc1:
|
||||
{
|
||||
GNode *ovc1;
|
||||
gchar *ovc1_data;
|
||||
guint ovc1_len;
|
||||
GstBuffer *buf;
|
||||
|
||||
GST_DEBUG_OBJECT (qtdemux, "parse ovc1 header");
|
||||
ovc1 = qtdemux_tree_get_child_by_type (stsd, FOURCC_ovc1);
|
||||
if (!ovc1)
|
||||
break;
|
||||
ovc1_data = ovc1->data;
|
||||
ovc1_len = QT_UINT32 (ovc1_data);
|
||||
if (ovc1_len <= 198) {
|
||||
GST_WARNING_OBJECT (qtdemux, "Too small ovc1 header, skipping");
|
||||
break;
|
||||
}
|
||||
buf = gst_buffer_new_and_alloc (ovc1_len - 198);
|
||||
memcpy (GST_BUFFER_DATA (buf), ovc1_data + 198, ovc1_len - 198);
|
||||
gst_caps_set_simple (stream->caps,
|
||||
"codec_data", GST_TYPE_BUFFER, buf, NULL);
|
||||
gst_buffer_unref (buf);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -6321,6 +6345,67 @@ qtdemux_parse_trak (GstQTDemux * qtdemux, GNode * trak)
|
|||
}
|
||||
break;
|
||||
}
|
||||
case FOURCC_owma:
|
||||
{
|
||||
GNode *owma;
|
||||
const gchar *owma_data, *codec_name = NULL;
|
||||
guint owma_len;
|
||||
GstBuffer *buf;
|
||||
gint version = 1;
|
||||
/* from http://msdn.microsoft.com/en-us/library/dd757720(VS.85).aspx */
|
||||
typedef struct
|
||||
{
|
||||
gint16 wFormatTag;
|
||||
gint16 nChannels;
|
||||
gint32 nSamplesPerSec;
|
||||
gint32 nAvgBytesPerSec;
|
||||
gint16 nBlockAlign;
|
||||
gint16 wBitsPerSample;
|
||||
gint16 cbSize;
|
||||
} WAVEFORMATEX;
|
||||
WAVEFORMATEX *wfex;
|
||||
|
||||
GST_DEBUG_OBJECT (qtdemux, "parse owma");
|
||||
owma = qtdemux_tree_get_child_by_type (stsd, FOURCC_owma);
|
||||
if (!owma)
|
||||
break;
|
||||
owma_data = owma->data;
|
||||
owma_len = QT_UINT32 (owma_data);
|
||||
if (owma_len <= 54) {
|
||||
GST_WARNING_OBJECT (qtdemux, "Too small owma header, skipping");
|
||||
break;
|
||||
}
|
||||
wfex = (WAVEFORMATEX *) (owma_data + 36);
|
||||
buf = gst_buffer_new_and_alloc (owma_len - 54);
|
||||
memcpy (GST_BUFFER_DATA (buf), owma_data + 54, owma_len - 54);
|
||||
if (wfex->wFormatTag == 0x0161) {
|
||||
codec_name = "Windows Media Audio";
|
||||
version = 2;
|
||||
} else if (wfex->wFormatTag == 0x0162) {
|
||||
codec_name = "Windows Media Audio 9 Pro";
|
||||
version = 3;
|
||||
} else if (wfex->wFormatTag == 0x0163) {
|
||||
codec_name = "Windows Media Audio 9 Lossless";
|
||||
/* is that correct? gstffmpegcodecmap.c is missing it, but
|
||||
* fluendo codec seems to support it */
|
||||
version = 4;
|
||||
}
|
||||
|
||||
gst_caps_set_simple (stream->caps,
|
||||
"codec_data", GST_TYPE_BUFFER, buf,
|
||||
"wmaversion", G_TYPE_INT, version,
|
||||
"block_align", G_TYPE_INT, wfex->nBlockAlign,
|
||||
"bitrate", G_TYPE_INT, wfex->nAvgBytesPerSec,
|
||||
"width", G_TYPE_INT, wfex->wBitsPerSample,
|
||||
"depth", G_TYPE_INT, wfex->wBitsPerSample, NULL);
|
||||
gst_buffer_unref (buf);
|
||||
|
||||
if (codec_name) {
|
||||
g_free (codec);
|
||||
codec = g_strdup (codec_name);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -8327,6 +8412,12 @@ qtdemux_video_caps (GstQTDemux * qtdemux, QtDemuxStream * stream,
|
|||
case GST_MAKE_FOURCC ('V', 'P', '8', '0'):
|
||||
_codec ("On2 VP8");
|
||||
caps = gst_caps_from_string ("video/x-vp8");
|
||||
case FOURCC_ovc1:
|
||||
_codec ("VC-1");
|
||||
caps = gst_caps_new_simple ("video/x-wmv",
|
||||
"wmvversion", G_TYPE_INT, 3,
|
||||
"format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('W', 'V', 'C', '1'),
|
||||
NULL);
|
||||
break;
|
||||
case GST_MAKE_FOURCC ('k', 'p', 'c', 'd'):
|
||||
default:
|
||||
|
@ -8523,6 +8614,10 @@ qtdemux_audio_caps (GstQTDemux * qtdemux, QtDemuxStream * stream,
|
|||
_codec ("QualComm PureVoice");
|
||||
caps = gst_caps_from_string ("audio/qcelp");
|
||||
break;
|
||||
case FOURCC_owma:
|
||||
_codec ("WMA");
|
||||
caps = gst_caps_new_simple ("audio/x-wma", NULL);
|
||||
break;
|
||||
case GST_MAKE_FOURCC ('q', 't', 'v', 'r'):
|
||||
/* ? */
|
||||
default:
|
||||
|
|
|
@ -222,6 +222,8 @@ G_BEGIN_DECLS
|
|||
#define FOURCC_traf GST_MAKE_FOURCC('t','r','a','f')
|
||||
#define FOURCC_trex GST_MAKE_FOURCC('t','r','e','x')
|
||||
#define FOURCC_trun GST_MAKE_FOURCC('t','r','u','n')
|
||||
#define FOURCC_ovc1 GST_MAKE_FOURCC('o','v','c','1')
|
||||
#define FOURCC_owma GST_MAKE_FOURCC('o','w','m','a')
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -169,6 +169,8 @@ static const QtNodeType qt_node_types[] = {
|
|||
{FOURCC_mvex, "mvex", QT_FLAG_CONTAINER,},
|
||||
{FOURCC_mehd, "movie extends header", 0,
|
||||
qtdemux_dump_mehd},
|
||||
{FOURCC_ovc1, "ovc1", 0},
|
||||
{FOURCC_owma, "owma", 0},
|
||||
{0, "unknown", 0,},
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue