summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Dröge <slomo@circular-chaos.org>2008-12-09 13:44:45 +0000
committerSebastian Dröge <slomo@circular-chaos.org>2008-12-09 13:44:45 +0000
commitdb08161b6d2562fc0b60b394a612972d886a693b (patch)
treea4128d7452629b59cd2556747e98b45af4c7feba
parentd23484c483d1fc8f3d3020c7426a58c81144fec3 (diff)
downloadgst-plugins-bad-db08161b6d2562fc0b60b394a612972d886a693b.tar.gz
gst-plugins-bad-db08161b6d2562fc0b60b394a612972d886a693b.tar.bz2
gst-plugins-bad-db08161b6d2562fc0b60b394a612972d886a693b.zip
gst/mxf/mxfjpeg2000.c: Implement detection of the colorspace used by the
Original commit message from CVS: * gst/mxf/mxfjpeg2000.c: (mxf_jpeg2000_create_caps): Implement detection of the colorspace used by the JPEG2000 codestream. XYZ colorspace isn't supported by our decoders yet unfortunately.
-rw-r--r--ChangeLog7
-rw-r--r--gst/mxf/mxfjpeg2000.c67
2 files changed, 70 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 3c62fe74..012eb20a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-12-09 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
+ * gst/mxf/mxfjpeg2000.c: (mxf_jpeg2000_create_caps):
+ Implement detection of the colorspace used by the
+ JPEG2000 codestream. XYZ colorspace isn't supported by
+ our decoders yet unfortunately.
+
2008-12-08 Sebastian Dröge <sebastian.droege@collabora.co.uk>
* gst/mxf/mxfparse.c:
diff --git a/gst/mxf/mxfjpeg2000.c b/gst/mxf/mxfjpeg2000.c
index ae627dc4..c9e78fa9 100644
--- a/gst/mxf/mxfjpeg2000.c
+++ b/gst/mxf/mxfjpeg2000.c
@@ -87,6 +87,7 @@ mxf_jpeg2000_create_caps (MXFMetadataGenericPackage * package,
MXFMetadataGenericPictureEssenceDescriptor *p = NULL;
guint i;
GstCaps *caps = NULL;
+ guint32 fourcc;
g_return_val_if_fail (package != NULL, NULL);
g_return_val_if_fail (track != NULL, NULL);
@@ -106,8 +107,8 @@ mxf_jpeg2000_create_caps (MXFMetadataGenericPackage * package,
p = (MXFMetadataGenericPictureEssenceDescriptor *) track->descriptor[i];
f = track->descriptor[i];
break;
- } else if (((MXFMetadataGenericDescriptor *) track->descriptor[i])->
- is_file_descriptor
+ } else if (((MXFMetadataGenericDescriptor *) track->
+ descriptor[i])->is_file_descriptor
&& ((MXFMetadataGenericDescriptor *) track->descriptor[i])->type !=
MXF_METADATA_MULTIPLE_DESCRIPTOR) {
f = track->descriptor[i];
@@ -119,13 +120,71 @@ mxf_jpeg2000_create_caps (MXFMetadataGenericPackage * package,
return NULL;
}
+ fourcc = GST_MAKE_FOURCC ('s', 'R', 'G', 'B');
+ if (p
+ && ((MXFMetadataGenericDescriptor *) p)->type ==
+ MXF_METADATA_CDCI_PICTURE_ESSENCE_DESCRIPTOR) {
+ fourcc = GST_MAKE_FOURCC ('s', 'Y', 'U', 'V');
+ } else if (p
+ && ((MXFMetadataGenericDescriptor *) p)->type ==
+ MXF_METADATA_CDCI_PICTURE_ESSENCE_DESCRIPTOR) {
+ MXFMetadataRGBAPictureEssenceDescriptor *r =
+ (MXFMetadataRGBAPictureEssenceDescriptor *) p;
+ gboolean rgb = TRUE;
+ gboolean xyz = TRUE;
+ gboolean yuv = TRUE;
+ guint i;
+
+ if (r->pixel_layout) {
+ for (i = 0; i < r->n_pixel_layout; i++) {
+ guint8 c = r->pixel_layout[2 * i];
+
+ switch (c) {
+ case 'R':
+ case 'r':
+ case 'G':
+ case 'g':
+ case 'B':
+ case 'b':
+ xyz = yuv = FALSE;
+ break;
+ case 'Y':
+ case 'y':
+ rgb = FALSE;
+ break;
+ case 'U':
+ case 'u':
+ case 'V':
+ case 'v':
+ xyz = rgb = FALSE;
+ break;
+ case 'X':
+ case 'x':
+ case 'Z':
+ case 'z':
+ rgb = yuv = FALSE;
+ break;
+ default:
+ break;
+ }
+ }
+ if (rgb) {
+ fourcc = GST_MAKE_FOURCC ('s', 'R', 'G', 'B');
+ } else if (yuv) {
+ fourcc = GST_MAKE_FOURCC ('s', 'Y', 'U', 'V');
+ } else if (xyz) {
+ GST_ERROR ("JPEG2000 with XYZ colorspace not supported yet");
+ return NULL;
+ }
+ }
+ }
+
*handler = mxf_jpeg2000_handle_essence_element;
/* TODO: What about other field values? */
- /* FIXME: For now assume sRGB but get the correct value from the descriptor */
caps =
gst_caps_new_simple ("image/x-jpc", "fields", G_TYPE_INT, 1, "fourcc",
- GST_TYPE_FOURCC, GST_MAKE_FOURCC ('s', 'R', 'G', 'B'), NULL);
+ GST_TYPE_FOURCC, fourcc, NULL);
if (p) {
mxf_metadata_generic_picture_essence_descriptor_set_caps (p, caps);
} else {