From e54ffc2c5fd84ecdd7e80dca87e8666eb8d70fc0 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Mon, 19 Dec 2005 15:00:38 +0000 Subject: [PATCH] ext/ogg/gstogmparse.c: Make sure pads are initialized correctly. Original commit message from CVS: * ext/ogg/gstogmparse.c: (gst_ogm_text_parse_base_init), (gst_ogm_parse_init), (gst_ogm_audio_parse_init), (gst_ogm_video_parse_init), (gst_ogm_text_parse_init), (gst_ogm_parse_chain): Make sure pads are initialized correctly. * gst-libs/gst/riff/riff-ids.h: * gst-libs/gst/riff/riff-media.c: (gst_riff_create_video_caps), (gst_riff_create_video_template_caps): Add a whole bunch of FOURCC <=> MimeType. Extend the riff video pad template to support the newly added fourcc. --- ChangeLog | 13 +++ ext/ogg/gstogmparse.c | 13 ++- gst-libs/gst/riff/riff-ids.h | 1 + gst-libs/gst/riff/riff-media.c | 170 +++++++++++++++++++++++++++++++-- 4 files changed, 188 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 645430954..3623745d0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2005-12-19 Edward Hervey + + * ext/ogg/gstogmparse.c: (gst_ogm_text_parse_base_init), + (gst_ogm_parse_init), (gst_ogm_audio_parse_init), + (gst_ogm_video_parse_init), (gst_ogm_text_parse_init), + (gst_ogm_parse_chain): + Make sure pads are initialized correctly. + * gst-libs/gst/riff/riff-ids.h: + * gst-libs/gst/riff/riff-media.c: (gst_riff_create_video_caps), + (gst_riff_create_video_template_caps): + Add a whole bunch of FOURCC <=> MimeType. + Extend the riff video pad template to support the newly added fourcc. + 2005-12-18 Jan Schmidt * ext/ogg/gstoggdemux.c: (gst_ogg_demux_deactivate_current_chain), diff --git a/ext/ogg/gstogmparse.c b/ext/ogg/gstogmparse.c index b83c0a28b..527c038a0 100644 --- a/ext/ogg/gstogmparse.c +++ b/ext/ogg/gstogmparse.c @@ -309,7 +309,7 @@ gst_ogm_text_parse_base_init (GstOgmParseClass * klass) "Codec/Decoder/Subtitle", "parse an OGM text header and stream", "Ronald Bultje "); - GstCaps *caps = gst_caps_new_simple ("text/plain", NULL); + GstCaps *caps = gst_caps_new_simple ("text/plain", NULL, NULL); gst_element_class_set_details (element_class, &gst_ogm_text_parse_details); @@ -336,6 +336,7 @@ gst_ogm_parse_init (GstOgmParse * ogm) /* initalize */ memset (&ogm->hdr, 0, sizeof (ogm->hdr)); ogm->next_granulepos = 0; + ogm->srcpad = NULL; } static void @@ -354,6 +355,7 @@ gst_ogm_audio_parse_init (GstOgmParse * ogm) gst_pad_use_explicit_caps (ogm->srcpad); gst_element_add_pad (GST_ELEMENT (ogm), ogm->srcpad); #endif + ogm->srcpad = NULL; ogm->srcpadtempl = audio_src_templ; } @@ -373,6 +375,7 @@ gst_ogm_video_parse_init (GstOgmParse * ogm) gst_pad_use_explicit_caps (ogm->srcpad); gst_element_add_pad (GST_ELEMENT (ogm), ogm->srcpad); #endif + ogm->srcpad = NULL; ogm->srcpadtempl = video_src_templ; } @@ -394,6 +397,7 @@ gst_ogm_text_parse_init (GstOgmParse * ogm) gst_pad_use_explicit_caps (ogm->srcpad); gst_element_add_pad (GST_ELEMENT (ogm), ogm->srcpad); #endif + ogm->srcpad = NULL; ogm->srcpadtempl = text_src_templ; } @@ -623,6 +627,13 @@ gst_ogm_parse_chain (GstPad * pad, GstBuffer * buffer) g_assert_not_reached (); } + if (ogm->srcpad) { + GST_WARNING_OBJECT (ogm, "Already an existing pad %s:%s", + GST_DEBUG_PAD_NAME (ogm->srcpad)); + gst_element_remove_pad (GST_ELEMENT (ogm), ogm->srcpad); + gst_object_unref (ogm->srcpad); + + } if (caps) { ogm->srcpad = gst_pad_new ("src", GST_PAD_SRC); gst_pad_set_caps (ogm->srcpad, caps); diff --git a/gst-libs/gst/riff/riff-ids.h b/gst-libs/gst/riff/riff-ids.h index 1aa599947..dfe1f13cd 100644 --- a/gst-libs/gst/riff/riff-ids.h +++ b/gst-libs/gst/riff/riff-ids.h @@ -188,6 +188,7 @@ G_BEGIN_DECLS #define GST_RIFF_m263 GST_MAKE_FOURCC ('m', '2', '6', '3') #define GST_RIFF_M263 GST_MAKE_FOURCC ('M', '2', '6', '3') #define GST_RIFF_H263 GST_MAKE_FOURCC ('H', '2', '6', '3') +#define GST_RIFF_h263 GST_MAKE_FOURCC ('h', '2', '6', '3') #define GST_RIFF_i263 GST_MAKE_FOURCC ('i', '2', '6', '3') #define GST_RIFF_L263 GST_MAKE_FOURCC ('L', '2', '6', '3') #define GST_RIFF_x263 GST_MAKE_FOURCC ('x', '2', '6', '3') diff --git a/gst-libs/gst/riff/riff-media.c b/gst-libs/gst/riff/riff-media.c index 231ef775e..07e9326a8 100644 --- a/gst-libs/gst/riff/riff-media.c +++ b/gst-libs/gst/riff/riff-media.c @@ -74,6 +74,10 @@ gst_riff_create_video_caps (guint32 codec_fcc, break; case GST_MAKE_FOURCC ('M', 'J', 'P', 'G'): /* YUY2 MJPEG */ + case GST_MAKE_FOURCC ('A', 'V', 'R', 'n'): + case GST_MAKE_FOURCC ('I', 'J', 'P', 'G'): + case GST_MAKE_FOURCC ('i', 'j', 'p', 'g'): + case GST_MAKE_FOURCC ('J', 'P', 'G', 'L'): caps = gst_caps_new_simple ("image/jpeg", NULL); if (codec_name) *codec_name = g_strdup ("Motion JPEG"); @@ -92,6 +96,17 @@ gst_riff_create_video_caps (guint32 codec_fcc, *codec_name = g_strdup ("Miro/Pinnacle Motion JPEG Video"); break; + case GST_MAKE_FOURCC ('S', 'P', '5', '3'): + case GST_MAKE_FOURCC ('S', 'P', '5', '4'): + case GST_MAKE_FOURCC ('S', 'P', '5', '5'): + case GST_MAKE_FOURCC ('S', 'P', '5', '6'): + case GST_MAKE_FOURCC ('S', 'P', '5', '7'): + case GST_MAKE_FOURCC ('S', 'P', '5', '8'): + caps = gst_caps_new_simple ("video/sp5x", NULL); + if (codec_name) + *codec_name = g_strdup ("Sp5x-like JPEG"); + break; + case GST_MAKE_FOURCC ('H', 'F', 'Y', 'U'): caps = gst_caps_new_simple ("video/x-huffyuv", NULL); if (strf) { @@ -106,6 +121,7 @@ gst_riff_create_video_caps (guint32 codec_fcc, case GST_MAKE_FOURCC ('M', 'P', 'G', 'I'): case GST_MAKE_FOURCC ('m', 'p', 'g', '1'): case GST_MAKE_FOURCC ('M', 'P', 'G', '1'): + case GST_MAKE_FOURCC ('P', 'I', 'M', '1'): caps = gst_caps_new_simple ("video/mpeg", "systemstream", G_TYPE_BOOLEAN, FALSE, "mpegversion", G_TYPE_INT, 1, NULL); @@ -122,15 +138,12 @@ gst_riff_create_video_caps (guint32 codec_fcc, break; case GST_MAKE_FOURCC ('H', '2', '6', '3'): - caps = gst_caps_new_simple ("video/x-h263", NULL); - if (codec_name) - *codec_name = g_strdup ("ITU H.26n"); - break; - + case GST_MAKE_FOURCC ('h', '2', '6', '3'): case GST_MAKE_FOURCC ('i', '2', '6', '3'): + case GST_MAKE_FOURCC ('U', '2', '6', '3'): caps = gst_caps_new_simple ("video/x-h263", NULL); if (codec_name) - *codec_name = g_strdup ("ITU H.263"); + *codec_name = g_strdup ("ITU H.26n"); break; case GST_MAKE_FOURCC ('L', '2', '6', '3'): @@ -191,6 +204,13 @@ gst_riff_create_video_caps (guint32 codec_fcc, case GST_MAKE_FOURCC ('d', 'i', 'v', '5'): case GST_MAKE_FOURCC ('D', 'I', 'V', '6'): case GST_MAKE_FOURCC ('d', 'i', 'v', '6'): + case GST_MAKE_FOURCC ('M', 'P', 'G', '3'): + case GST_MAKE_FOURCC ('m', 'p', 'g', '3'): + case GST_MAKE_FOURCC ('c', 'o', 'l', '0'): + case GST_MAKE_FOURCC ('C', 'O', 'L', '0'): + case GST_MAKE_FOURCC ('c', 'o', 'l', '1'): + case GST_MAKE_FOURCC ('C', 'O', 'L', '1'): + case GST_MAKE_FOURCC ('A', 'P', '4', '1'): caps = gst_caps_new_simple ("video/x-divx", "divxversion", G_TYPE_INT, 3, NULL); if (codec_name) @@ -258,6 +278,7 @@ gst_riff_create_video_caps (guint32 codec_fcc, break; case GST_MAKE_FOURCC ('F', 'M', 'P', '4'): + case GST_MAKE_FOURCC ('U', 'M', 'P', '4'): caps = gst_caps_new_simple ("video/mpeg", "mpegversion", G_TYPE_INT, 4, NULL); if (codec_name) @@ -273,6 +294,7 @@ gst_riff_create_video_caps (guint32 codec_fcc, case GST_MAKE_FOURCC ('D', 'V', 'S', 'D'): case GST_MAKE_FOURCC ('d', 'v', 's', 'd'): + case GST_MAKE_FOURCC ('C', 'D', 'V', 'C'): caps = gst_caps_new_simple ("video/x-dv", "systemstream", G_TYPE_BOOLEAN, FALSE, NULL); if (codec_name) @@ -342,20 +364,136 @@ gst_riff_create_video_caps (guint32 codec_fcc, *codec_name = g_strdup ("Xan Wing Commander 4"); break; + case GST_MAKE_FOURCC ('R', 'T', '2', '1'): + caps = gst_caps_new_simple ("video/x-indeo", + "indeoversion", G_TYPE_INT, 2, NULL); + if (codec_name) + *codec_name = g_strdup ("Intel Video 2"); + break; + + case GST_MAKE_FOURCC ('I', 'V', '3', '1'): case GST_MAKE_FOURCC ('I', 'V', '3', '2'): + case GST_MAKE_FOURCC ('i', 'v', '3', '1'): + case GST_MAKE_FOURCC ('i', 'v', '3', '2'): caps = gst_caps_new_simple ("video/x-indeo", "indeoversion", G_TYPE_INT, 3, NULL); if (codec_name) *codec_name = g_strdup ("Intel Video 3"); break; + case GST_MAKE_FOURCC ('I', 'V', '4', '1'): + case GST_MAKE_FOURCC ('i', 'v', '4', '1'): + caps = gst_caps_new_simple ("video/x-indeo", + "indeoversion", G_TYPE_INT, 4, NULL); + if (codec_name) + *codec_name = g_strdup ("Intel Video 4"); + break; + case GST_MAKE_FOURCC ('I', 'V', '5', '0'): - caps = gst_caps_new_simple ("video/x-intel", - "ivversion", G_TYPE_INT, 5, NULL); + caps = gst_caps_new_simple ("video/x-indeo", + "indeoversion", G_TYPE_INT, 5, NULL); if (codec_name) *codec_name = g_strdup ("Intel Video 5"); break; + case GST_MAKE_FOURCC ('M', 'S', 'Z', 'H'): + caps = gst_caps_new_simple ("video/x-mszh", NULL); + if (codec_name) + *codec_name = g_strdup ("Lossless MSZH Video"); + break; + + case GST_MAKE_FOURCC ('Z', 'L', 'I', 'B'): + caps = gst_caps_new_simple ("video/x-zlib", NULL); + if (codec_name) + *codec_name = g_strdup ("Lossless zlib video"); + break; + + case GST_MAKE_FOURCC ('C', 'L', 'J', 'R'): + caps = gst_caps_new_simple ("video/x-cirrus-logic-accupak", NULL); + if (codec_name) + *codec_name = g_strdup ("Cirrus Logipak AccuPak"); + break; + + case GST_MAKE_FOURCC ('C', 'Y', 'U', 'V'): + case GST_MAKE_FOURCC ('c', 'y', 'u', 'v'): + caps = gst_caps_new_simple ("video/x-compressed-yuv", NULL); + if (codec_name) + *codec_name = g_strdup ("CYUV Lossless"); + break; + + case GST_MAKE_FOURCC ('D', 'U', 'C', 'K'): + caps = gst_caps_new_simple ("video/x-truemotion", + "trueversion", G_TYPE_INT, 1, NULL); + if (codec_name) + *codec_name = g_strdup ("Duck Truemotion1"); + break; + + case GST_MAKE_FOURCC ('T', 'M', '2', '0'): + caps = gst_caps_new_simple ("video/x-truemotion", + "trueversion", G_TYPE_INT, 2, NULL); + if (codec_name) + *codec_name = g_strdup ("TrueMotion 2.0"); + break; + + case GST_MAKE_FOURCC ('V', 'P', '3', '0'): + case GST_MAKE_FOURCC ('v', 'p', '3', '0'): + case GST_MAKE_FOURCC ('V', 'P', '3', '1'): + case GST_MAKE_FOURCC ('v', 'p', '3', '1'): + case GST_MAKE_FOURCC ('V', 'P', '3', ' '): + caps = gst_caps_new_simple ("video/x-vp3", NULL); + if (codec_name) + *codec_name = g_strdup ("VP3"); + break; + + case GST_MAKE_FOURCC ('U', 'L', 'T', 'I'): + caps = gst_caps_new_simple ("video/x-ultimotion", NULL); + if (codec_name) + *codec_name = g_strdup ("IBM UltiMotion"); + break; + + case GST_MAKE_FOURCC ('T', 'S', 'C', 'C'): + case GST_MAKE_FOURCC ('t', 's', 'c', 'c'): + caps = gst_caps_new_simple ("video/x-camtasia", NULL); + if (codec_name) + *codec_name = g_strdup ("TechSmith Camtasia"); + break; + + case GST_MAKE_FOURCC ('V', 'C', 'R', '1'): + caps = gst_caps_new_simple ("video/x-ati-vcr", + "vcrversion", G_TYPE_INT, 1, NULL); + if (codec_name) + *codec_name = g_strdup ("ATI VCR 1"); + break; + + case GST_MAKE_FOURCC ('V', 'C', 'R', '2'): + caps = gst_caps_new_simple ("video/x-ati-vcr", + "vcrversion", G_TYPE_INT, 2, NULL); + if (codec_name) + *codec_name = g_strdup ("ATI VCR 2"); + break; + + case GST_MAKE_FOURCC ('A', 'S', 'V', '1'): + caps = gst_caps_new_simple ("video/x-asus", + "asusversion", G_TYPE_INT, 1, NULL); + if (codec_name) + *codec_name = g_strdup ("Asus Video 1"); + break; + + case GST_MAKE_FOURCC ('A', 'S', 'V', '2'): + caps = gst_caps_new_simple ("video/x-asus", + "asusversion", G_TYPE_INT, 2, NULL); + if (codec_name) + *codec_name = g_strdup ("Asus Video 2"); + break; + + case GST_MAKE_FOURCC ('M', 'P', 'N', 'G'): + case GST_MAKE_FOURCC ('m', 'p', 'n', 'g'): + case GST_MAKE_FOURCC ('P', 'N', 'G', ' '): + caps = gst_caps_new_simple ("image/png", NULL); + if (codec_name) + *codec_name = g_strdup ("PNG image"); + break; + default: GST_WARNING ("Unknown video fourcc %" GST_FOURCC_FORMAT, GST_FOURCC_ARGS (codec_fcc)); @@ -652,6 +790,22 @@ gst_riff_create_video_template_caps (void) GST_MAKE_FOURCC ('I', 'V', '3', '2'), GST_MAKE_FOURCC ('I', 'V', '5', '0'), GST_MAKE_FOURCC ('M', '4', 'S', '2'), + GST_MAKE_FOURCC ('M', 'S', 'Z', 'H'), + GST_MAKE_FOURCC ('Z', 'L', 'I', 'B'), + GST_MAKE_FOURCC ('A', 'S', 'V', '1'), + GST_MAKE_FOURCC ('A', 'S', 'V', '2'), + GST_MAKE_FOURCC ('V', 'C', 'R', '1'), + GST_MAKE_FOURCC ('V', 'C', 'R', '2'), + GST_MAKE_FOURCC ('C', 'L', 'J', 'R'), + GST_MAKE_FOURCC ('I', 'V', '4', '1'), + GST_MAKE_FOURCC ('R', 'T', '2', '1'), + GST_MAKE_FOURCC ('T', 'M', '2', '0'), + GST_MAKE_FOURCC ('U', 'L', 'T', 'I'), + GST_MAKE_FOURCC ('V', 'P', '3', ' '), + GST_MAKE_FOURCC ('T', 'S', 'C', 'C'), + GST_MAKE_FOURCC ('S', 'P', '5', '3'), + GST_MAKE_FOURCC ('P', 'N', 'G', ' '), + GST_MAKE_FOURCC ('C', 'Y', 'U', 'V'), /* FILL ME */ 0 }; -- 2.34.1