diff options
author | Jeremy Simon <jsimon13@yahoo.fr> | 2004-01-26 20:01:35 +0000 |
---|---|---|
committer | Jeremy Simon <jsimon13@yahoo.fr> | 2004-01-26 20:01:35 +0000 |
commit | 71dff05e68a9a58697be0dcfeba21808b1bf345f (patch) | |
tree | 252d8b969fadc837db76712fd06d566f64b058de /gst | |
parent | 054dc28a32f44ea1dd497d8b5919316998f79955 (diff) | |
download | gst-plugins-bad-71dff05e68a9a58697be0dcfeba21808b1bf345f.tar.gz gst-plugins-bad-71dff05e68a9a58697be0dcfeba21808b1bf345f.tar.bz2 gst-plugins-bad-71dff05e68a9a58697be0dcfeba21808b1bf345f.zip |
Add SVQ3 specific flags to qtdemux and ffmpeg
Original commit message from CVS:
2004-01-26 Jeremy Simon <jesimon@libertysurf.fr>
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_codecid_to_caps),
(gst_ffmpeg_caps_to_extradata), (gst_ffmpeg_caps_to_pixfmt):
* gst/qtdemux/qtdemux.c: (plugin_init), (qtdemux_parse_trak),
(qtdemux_video_caps):
* gst/qtdemux/qtdemux.h:
Add SVQ3 specific flags to qtdemux and ffmpeg
Diffstat (limited to 'gst')
-rw-r--r-- | gst/qtdemux/qtdemux.c | 58 | ||||
-rw-r--r-- | gst/qtdemux/qtdemux.h | 1 |
2 files changed, 56 insertions, 3 deletions
diff --git a/gst/qtdemux/qtdemux.c b/gst/qtdemux/qtdemux.c index e950d681..a5ecf66a 100644 --- a/gst/qtdemux/qtdemux.c +++ b/gst/qtdemux/qtdemux.c @@ -152,7 +152,7 @@ static void qtdemux_parse(GstQTDemux *qtdemux, GNode *node, void *buffer, int le static QtNodeType *qtdemux_type_get(guint32 fourcc); static void qtdemux_node_dump(GstQTDemux *qtdemux, GNode *node); static void qtdemux_parse_tree(GstQTDemux *qtdemux); -static GstCaps *qtdemux_video_caps(GstQTDemux *qtdemux, guint32 fourcc); +static GstCaps *qtdemux_video_caps(GstQTDemux *qtdemux, guint32 fourcc, const guint8 *stsd_data); static GstCaps *qtdemux_audio_caps(GstQTDemux *qtdemux, guint32 fourcc); static GType gst_qtdemux_get_type (void) @@ -248,6 +248,9 @@ plugin_init (GstPlugin *plugin) if (!gst_library_load ("gstbytestream")) return FALSE; + if (!gst_library_load ("gstgetbits")) + return FALSE; + return gst_element_register (plugin, "qtdemux", GST_RANK_PRIMARY, GST_TYPE_QTDEMUX); } @@ -1278,7 +1281,7 @@ static void qtdemux_parse_trak(GstQTDemux *qtdemux, GNode *trak) g_print("frame count: %u\n", QTDEMUX_GUINT16_GET(stsd->data+offset+48)); stream->caps = qtdemux_video_caps(qtdemux, - QTDEMUX_FOURCC_GET(stsd->data+offset+4)); + QTDEMUX_FOURCC_GET(stsd->data+offset+4), stsd->data); g_print("caps %s\n",gst_caps_to_string(stream->caps)); }else if(stream->subtype == FOURCC_soun){ int version; @@ -1481,7 +1484,7 @@ done2: } -static GstCaps *qtdemux_video_caps(GstQTDemux *qtdemux, guint32 fourcc) +static GstCaps *qtdemux_video_caps(GstQTDemux *qtdemux, guint32 fourcc, const guint8 *stsd_data) { switch(fourcc){ case GST_MAKE_FOURCC('j','p','e','g'): @@ -1494,6 +1497,55 @@ static GstCaps *qtdemux_video_caps(GstQTDemux *qtdemux, guint32 fourcc) /* Motion-JPEG (format B) */ return gst_caps_from_string ("image/jpeg"); case GST_MAKE_FOURCC('S','V','Q','3'): + if (stsd_data != NULL) { + gst_getbits_t gb; + gint halfpel_flag; + gint thirdpel_flag; + gint unknown_svq3_flag; + gint low_delay; + gint size; + + size = QTDEMUX_GUINT32_GET(stsd_data + 16); + + gst_getbits_init (&gb, NULL, NULL); + gst_getbits_newbuf (&gb, (unsigned char *)stsd_data + 98 + 16 + 4 , (size - 102 + 16)); + + /* Infos ripped from ffmpeg see libavcodec/svq3.c */ + + /* 'frame size code' and optional 'width, height' */ + if (gst_getbitsn (&gb, 3) == 7) { + gst_getbitsn (&gb, 12); + gst_getbitsn (&gb, 12); + } + + halfpel_flag = gst_get1bit (&gb); + thirdpel_flag = gst_get1bit (&gb); + + /* unknown fields */ + gst_get1bit (&gb); + gst_get1bit (&gb); + gst_get1bit (&gb); + gst_get1bit (&gb); + + low_delay = gst_get1bit (&gb); + + /* unknown field */ + gst_get1bit (&gb); + + while (gst_get1bit (&gb)) { + gst_getbitsn (&gb, 8); + } + + unknown_svq3_flag = gst_get1bit (&gb); + + return gst_caps_new_simple ("video/x-svq", + "svqversion", G_TYPE_INT, 3, + "halfpel_flag", G_TYPE_INT, halfpel_flag, + "thirdpel_flag", G_TYPE_INT, thirdpel_flag, + "low_delay", G_TYPE_INT, low_delay, + "unknown_svq3_flag", G_TYPE_INT, unknown_svq3_flag, + NULL); + } return gst_caps_from_string ("video/x-svq, " "svqversion = (int) 3"); case GST_MAKE_FOURCC('s','v','q','i'): diff --git a/gst/qtdemux/qtdemux.h b/gst/qtdemux/qtdemux.h index 108faab1..249ef216 100644 --- a/gst/qtdemux/qtdemux.h +++ b/gst/qtdemux/qtdemux.h @@ -23,6 +23,7 @@ #include <gst/gst.h> #include <gst/bytestream/bytestream.h> +#include <gst/getbits/getbits.h> #ifdef __cplusplus extern "C" { |