From: <sl...@ke...> - 2008-11-29 20:07:27
|
CVS Root: /cvs/gstreamer Module: gst-plugins-bad Changes by: slomo Date: Sat Nov 29 2008 20:07:25 UTC Log message: * ext/jp2k/gstjasperdec.c: (gst_jasper_dec_sink_setcaps): Don't unref the element instance if we don't own a reference. Modified files: . : ChangeLog ext/jp2k : gstjasperdec.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-bad/ChangeLog.diff?r1=1.3764&r2=1.3765 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-bad/ext/jp2k/gstjasperdec.c.diff?r1=1.3&r2=1.4 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gst-plugins-bad/ChangeLog,v retrieving revision 1.3764 retrieving revision 1.3765 diff -u -d -r1.3764 -r1.3765 --- ChangeLog 29 Nov 2008 13:33:29 -0000 1.3764 +++ ChangeLog 29 Nov 2008 20:07:10 -0000 1.3765 @@ -1,5 +1,10 @@ 2008-11-29 Sebastian Dröge <seb...@co...> + * ext/jp2k/gstjasperdec.c: (gst_jasper_dec_sink_setcaps): + Don't unref the element instance if we don't own a reference. + +2008-11-29 Sebastian Dröge <seb...@co...> Patch by: Cygwin Ports maintainer <yselkowitz at users dot sourceforge dot net> Index: gstjasperdec.c RCS file: /cvs/gstreamer/gst-plugins-bad/ext/jp2k/gstjasperdec.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- gstjasperdec.c 13 Nov 2008 21:44:15 -0000 1.3 +++ gstjasperdec.c 29 Nov 2008 20:07:11 -0000 1.4 @@ -235,7 +235,6 @@ refuse_caps: { GST_WARNING_OBJECT (dec, "refused caps %" GST_PTR_FORMAT, caps); - gst_object_unref (dec); return FALSE; } } |
From: <sl...@ke...> - 2008-12-01 15:48:32
|
CVS Root: /cvs/gstreamer Module: gst-plugins-bad Changes by: slomo Date: Mon Dec 01 2008 15:48:27 UTC Log message: * ext/jp2k/gstjasperdec.c: (gst_jasper_dec_sink_setcaps): * ext/jp2k/gstjasperenc.c: (gst_jasper_enc_reset), (gst_jasper_enc_set_src_caps), (gst_jasper_enc_init_encoder), (gst_jasper_enc_sink_setcaps), (gst_jasper_enc_get_data): * ext/jp2k/gstjasperenc.h: Add image/x-jpc caps name for real, raw JPEG2000 codestream data. In 0.11 we should merge image/x-j2c and image/x-jpc and simply drop the non-standard boxing in the jasper elements and handle it in qtmux/qtdemux. image/x-jpc will be used by mxfdemux later. Also add support for JP2 output in jp2kenc. Modified files: . : ChangeLog ext/jp2k : gstjasperdec.c gstjasperenc.c gstjasperenc.h Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-bad/ChangeLog.diff?r1=1.3773&r2=1.3774 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-bad/ext/jp2k/gstjasperdec.c.diff?r1=1.4&r2=1.5 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-bad/ext/jp2k/gstjasperenc.c.diff?r1=1.1&r2=1.2 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-bad/ext/jp2k/gstjasperenc.h.diff?r1=1.1&r2=1.2 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gst-plugins-bad/ChangeLog,v retrieving revision 1.3773 retrieving revision 1.3774 diff -u -d -r1.3773 -r1.3774 --- ChangeLog 1 Dec 2008 15:24:35 -0000 1.3773 +++ ChangeLog 1 Dec 2008 15:48:12 -0000 1.3774 @@ -1,5 +1,20 @@ 2008-12-01 Sebastian Dröge <seb...@co...> + * ext/jp2k/gstjasperdec.c: (gst_jasper_dec_sink_setcaps): + * ext/jp2k/gstjasperenc.c: (gst_jasper_enc_reset), + (gst_jasper_enc_set_src_caps), (gst_jasper_enc_init_encoder), + (gst_jasper_enc_sink_setcaps), (gst_jasper_enc_get_data): + * ext/jp2k/gstjasperenc.h: + Add image/x-jpc caps name for real, raw JPEG2000 codestream data. + In 0.11 we should merge image/x-j2c and image/x-jpc and simply drop + the non-standard boxing in the jasper elements and handle it in + qtmux/qtdemux. + image/x-jpc will be used by mxfdemux later. + + Also add support for JP2 output in jp2kenc. +2008-12-01 Sebastian Dröge <seb...@co...> * gst/mxf/mxfaes-bwf.c: (mxf_bwf_create_caps): * gst/mxf/mxfalaw.c: (mxf_alaw_create_caps): * gst/mxf/mxfdemux.c: Index: gstjasperdec.c RCS file: /cvs/gstreamer/gst-plugins-bad/ext/jp2k/gstjasperdec.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- gstjasperdec.c 29 Nov 2008 20:07:11 -0000 1.4 +++ gstjasperdec.c 1 Dec 2008 15:48:13 -0000 1.5 @@ -48,12 +48,19 @@ ARG_0, }; +/* FIXME 0.11: Use a single caps name for jpeg2000 codestreams + * and drop the "boxed" variant + */ static GstStaticPadTemplate gst_jasper_dec_sink_template = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, GST_STATIC_CAPS ("image/x-j2c, " "framerate = " GST_VIDEO_FPS_RANGE ", " + "fields = (int) 1; " + "image/x-jpc, " + "framerate = " GST_VIDEO_FPS_RANGE ", " "fields = (int) 1; " "image/jp2") ); @@ -181,7 +188,7 @@ dec->codec_data = NULL; } - if (!strcmp (mimetype, "image/x-j2c")) { + if (!strcmp (mimetype, "image/x-j2c") || !strcmp (mimetype, "image/x-jpc")) { const GValue *codec_data; gint fields; @@ -207,7 +214,11 @@ dec->fmt = jas_image_strtofmt ("jpc"); /* strip the j2c box stuff it is embedded in */ - dec->strip = 8; + if (!strcmp (mimetype, "image/x-jpc")) + dec->strip = 0; + else + dec->strip = 8; codec_data = gst_structure_get_value (s, "codec_data"); if (codec_data) { dec->codec_data = gst_value_get_buffer (codec_data); Index: gstjasperenc.c RCS file: /cvs/gstreamer/gst-plugins-bad/ext/jp2k/gstjasperenc.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- gstjasperenc.c 13 Nov 2008 21:44:15 -0000 1.1 +++ gstjasperenc.c 1 Dec 2008 15:48:13 -0000 1.2 @@ -59,11 +59,14 @@ static GstStaticPadTemplate gst_jasper_enc_src_template = -GST_STATIC_PAD_TEMPLATE ("src", + GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, - "framerate = " GST_VIDEO_FPS_RANGE ", " "fields = (int) 1") + "framerate = " GST_VIDEO_FPS_RANGE ", " "fields = (int) 1; " + "image/jp2") static void gst_jasper_enc_base_init (gpointer g_class); @@ -155,6 +158,7 @@ jas_image_destroy (enc->image); enc->image = NULL; enc->fmt = -1; + enc->mode = GST_JP2ENC_MODE_J2C; enc->clrspc = JAS_CLRSPC_UNKNOWN; enc->format = GST_VIDEO_FORMAT_UNKNOWN; } @@ -165,6 +169,29 @@ GstCaps *caps; guint32 fourcc; gboolean ret; + GstCaps *peercaps; + peercaps = gst_pad_peer_get_caps (enc->srcpad); + if (peercaps) { + guint i, n; + n = gst_caps_get_size (peercaps); + for (i = 0; i < n; i++) { + GstStructure *s = gst_caps_get_structure (peercaps, i); + const gchar *name = gst_structure_get_name (s); + if (!strcmp (name, "image/x-j2c")) { + enc->mode = GST_JP2ENC_MODE_J2C; + break; + } else if (!strcmp (name, "image/x-jpc")) { + enc->mode = GST_JP2ENC_MODE_JPC; + } else if (!strcmp (name, "image/jp2")) { + enc->mode = GST_JP2ENC_MODE_JP2; + } + } + } /* enumerated colourspace */ if (gst_video_format_is_rgb (enc->format)) { @@ -173,9 +200,26 @@ fourcc = GST_MAKE_FOURCC ('s', 'Y', 'U', 'V'); - caps = gst_caps_new_simple ("image/x-j2c", "width", G_TYPE_INT, enc->width, - "height", G_TYPE_INT, enc->height, "fourcc", GST_TYPE_FOURCC, fourcc, - NULL); + switch (enc->mode) { + case GST_JP2ENC_MODE_J2C: + caps = + gst_caps_new_simple ("image/x-j2c", "width", G_TYPE_INT, enc->width, + "height", G_TYPE_INT, enc->height, "fourcc", GST_TYPE_FOURCC, fourcc, + NULL); + break; + case GST_JP2ENC_MODE_JPC: + gst_caps_new_simple ("image/x-jpc", "width", G_TYPE_INT, enc->width, + case GST_JP2ENC_MODE_JP2: + caps = gst_caps_new_simple ("image/jp2", "width", G_TYPE_INT, enc->width, if (enc->fps_den > 0) gst_caps_set_simple (caps, @@ -197,7 +241,15 @@ jas_image_cmptparm_t param[GST_JASPER_ENC_MAX_COMPONENT]; gint i; - enc->fmt = jas_image_strtofmt ("jpc"); + enc->fmt = jas_image_strtofmt ("jpc"); + enc->fmt = jas_image_strtofmt ("jp2"); if (gst_video_format_is_rgb (enc->format)) enc->clrspc = JAS_CLRSPC_SRGB; @@ -282,10 +334,12 @@ enc->inc[i] = gst_video_format_get_pixel_stride (format, i); + if (!gst_jasper_enc_set_src_caps (enc)) + goto setcaps_failed; if (!gst_jasper_enc_init_encoder (enc)) goto setup_failed; - return gst_jasper_enc_set_src_caps (enc); + return TRUE; /* ERRORS */ setup_failed: @@ -293,6 +347,12 @@ GST_ELEMENT_ERROR (enc, LIBRARY, SETTINGS, (NULL), (NULL)); return FALSE; +setcaps_failed: + { + GST_WARNING_OBJECT (enc, "Setting src caps failed"); + GST_ELEMENT_ERROR (enc, LIBRARY, SETTINGS, (NULL), (NULL)); + return FALSE; refuse_caps: { GST_WARNING_OBJECT (enc, "refused caps %" GST_PTR_FORMAT, caps); @@ -307,12 +367,14 @@ GstFlowReturn ret = GST_FLOW_OK; jas_stream_t *stream = NULL; - guint size; + guint size, boxsize; g_return_val_if_fail (outbuf != NULL, GST_FLOW_ERROR); *outbuf = NULL; + boxsize = (enc->mode == GST_JP2ENC_MODE_J2C) ? 8 : 0; if (!(stream = jas_stream_memopen (NULL, 0))) goto fail_stream; @@ -356,7 +418,8 @@ size = jas_stream_length (stream); ret = gst_pad_alloc_buffer_and_set_caps (enc->srcpad, - GST_BUFFER_OFFSET_NONE, size + 8, GST_PAD_CAPS (enc->srcpad), outbuf); + GST_BUFFER_OFFSET_NONE, size + boxsize, GST_PAD_CAPS (enc->srcpad), + outbuf); if (ret != GST_FLOW_OK) goto no_buffer; @@ -364,12 +427,14 @@ data = GST_BUFFER_DATA (*outbuf); if (jas_stream_flush (stream) || jas_stream_rewind (stream) < 0 || - jas_stream_read (stream, data + 8, size) < size) + jas_stream_read (stream, data + boxsize, size) < size) goto fail_image_out; - /* write atom prefix */ - GST_WRITE_UINT32_BE (data, size + 8); - GST_WRITE_UINT32_LE (data + 4, GST_MAKE_FOURCC ('j', 'p', '2', 'c')); + if (boxsize) { + /* write atom prefix */ + GST_WRITE_UINT32_BE (data, size + 8); + GST_WRITE_UINT32_LE (data + 4, GST_MAKE_FOURCC ('j', 'p', '2', 'c')); done: if (stream) Index: gstjasperenc.h RCS file: /cvs/gstreamer/gst-plugins-bad/ext/jp2k/gstjasperenc.h,v --- gstjasperenc.h 13 Nov 2008 21:44:15 -0000 1.1 +++ gstjasperenc.h 1 Dec 2008 15:48:13 -0000 1.2 @@ -42,6 +42,12 @@ typedef struct _GstJasperEnc GstJasperEnc; typedef struct _GstJasperEncClass GstJasperEncClass; +enum { + GST_JP2ENC_MODE_J2C = 0, + GST_JP2ENC_MODE_JPC, + GST_JP2ENC_MODE_JP2 +}; #define GST_JASPER_ENC_MAX_COMPONENT 4 struct _GstJasperEnc @@ -55,6 +61,7 @@ /* jasper image fmt */ gint fmt; + gint mode; jas_clrspc_t clrspc; /* stream/image properties */ |