2002-02-03 22:27:33 +00:00
|
|
|
/* GStreamer
|
2001-12-23 15:24:07 +00:00
|
|
|
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
2009-01-28 15:46:06 +00:00
|
|
|
/**
|
|
|
|
* SECTION:element-jpegenc
|
|
|
|
*
|
|
|
|
* Encodes jpeg images.
|
2009-01-29 07:42:56 +00:00
|
|
|
*
|
|
|
|
* <refsect2>
|
|
|
|
* <title>Example launch line</title>
|
|
|
|
* |[
|
|
|
|
* gst-launch videotestsrc num-buffers=50 ! video/x-raw-yuv, framerate='(fraction)'5/1 ! jpegenc ! avimux ! filesink location=mjpeg.avi
|
|
|
|
* ]| a pipeline to mux 5 JPEG frames per second into a 10 sec. long motion jpeg
|
|
|
|
* avi.
|
|
|
|
* </refsect2>
|
2009-01-28 15:46:06 +00:00
|
|
|
*/
|
2001-12-23 15:24:07 +00:00
|
|
|
|
2003-06-29 19:46:12 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
2001-12-23 15:24:07 +00:00
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "gstjpegenc.h"
|
2003-11-02 00:05:54 +00:00
|
|
|
#include <gst/video/video.h>
|
2001-12-23 15:24:07 +00:00
|
|
|
|
2009-07-21 07:04:36 +00:00
|
|
|
/* experimental */
|
|
|
|
/* setting smoothig seems to have no effect in libjepeg
|
|
|
|
#define ENABLE_SMOOTHING 1
|
|
|
|
*/
|
|
|
|
/*#define ENABLE_COLORSPACE_RGB 1 */
|
|
|
|
|
2001-12-23 15:24:07 +00:00
|
|
|
/* elementfactory information */
|
Define GstElementDetails as const and also static (when defined as global)
Original commit message from CVS:
* ext/aalib/gstaasink.c:
* ext/annodex/gstcmmldec.c:
* ext/annodex/gstcmmlenc.c:
* ext/cairo/gsttextoverlay.c:
* ext/cairo/gsttimeoverlay.c:
* ext/cdio/gstcdiocddasrc.c:
* ext/dv/gstdvdec.c:
* ext/dv/gstdvdemux.c:
* ext/esd/esdmon.c:
* ext/esd/esdsink.c:
* ext/flac/gstflacenc.c:
* ext/flac/gstflactag.c:
* ext/gconf/gstgconfaudiosink.c: (gst_gconf_audio_sink_base_init):
* ext/gconf/gstgconfaudiosrc.c: (gst_gconf_audio_src_base_init):
* ext/gconf/gstgconfvideosink.c: (gst_gconf_video_sink_base_init):
* ext/gconf/gstgconfvideosrc.c: (gst_gconf_video_src_base_init):
* ext/gdk_pixbuf/pixbufscale.c:
* ext/hal/gsthalaudiosink.c: (gst_hal_audio_sink_base_init):
* ext/hal/gsthalaudiosrc.c: (gst_hal_audio_src_base_init):
* ext/jpeg/gstjpegdec.c:
* ext/jpeg/gstjpegenc.c:
* ext/jpeg/gstsmokedec.c:
* ext/jpeg/gstsmokeenc.c:
* ext/libcaca/gstcacasink.c:
* ext/libmng/gstmngdec.c:
* ext/libmng/gstmngenc.c:
* ext/libpng/gstpngdec.c:
* ext/libpng/gstpngenc.c:
* ext/mikmod/gstmikmod.c:
* ext/raw1394/gstdv1394src.c:
* ext/shout2/gstshout2.c: (gst_shout2send_init):
* ext/shout2/gstshout2.h:
* ext/speex/gstspeexdec.c:
* ext/speex/gstspeexenc.c:
* gst/alpha/gstalpha.c:
* gst/alpha/gstalphacolor.c:
* gst/apetag/gstapedemux.c:
* gst/auparse/gstauparse.c:
* gst/autodetect/gstautoaudiosink.c:
(gst_auto_audio_sink_base_init):
* gst/autodetect/gstautovideosink.c:
(gst_auto_video_sink_base_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_base_init):
* gst/avi/gstavimux.c: (gst_avimux_base_init):
* gst/cutter/gstcutter.c:
* gst/debug/breakmydata.c:
* gst/debug/efence.c:
* gst/debug/gstnavigationtest.c:
* gst/debug/gstnavseek.c:
* gst/debug/negotiation.c:
* gst/debug/progressreport.c:
* gst/debug/testplugin.c:
* gst/effectv/gstaging.c:
* gst/effectv/gstdice.c:
* gst/effectv/gstedge.c:
* gst/effectv/gstquark.c:
* gst/effectv/gstrev.c:
* gst/effectv/gstshagadelic.c:
* gst/effectv/gstvertigo.c:
* gst/effectv/gstwarp.c:
* gst/flx/gstflxdec.c:
* gst/goom/gstgoom.c:
* gst/icydemux/gsticydemux.c:
* gst/id3demux/gstid3demux.c:
* gst/interleave/deinterleave.c:
* gst/interleave/interleave.c:
* gst/law/alaw-decode.c: (gst_alawdec_base_init):
* gst/law/alaw-encode.c: (gst_alawenc_base_init):
* gst/law/mulaw-decode.c: (gst_mulawdec_base_init):
* gst/law/mulaw-encode.c: (gst_mulawenc_base_init):
* gst/level/gstlevel.c:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_base_init):
* gst/matroska/matroska-mux.c: (gst_matroska_mux_base_init):
* gst/median/gstmedian.c:
* gst/monoscope/gstmonoscope.c:
* gst/multipart/multipartdemux.c:
* gst/multipart/multipartmux.c:
* gst/oldcore/gstaggregator.c:
* gst/oldcore/gstfdsink.c:
* gst/oldcore/gstmd5sink.c:
* gst/oldcore/gstmultifilesrc.c:
* gst/oldcore/gstpipefilter.c:
* gst/oldcore/gstshaper.c:
* gst/oldcore/gststatistics.c:
* gst/rtp/gstasteriskh263.c:
* gst/rtp/gstrtpL16depay.c:
* gst/rtp/gstrtpL16pay.c:
* gst/rtp/gstrtpamrdepay.c:
* gst/rtp/gstrtpamrpay.c:
* gst/rtp/gstrtpdepay.c:
* gst/rtp/gstrtpgsmpay.c:
* gst/rtp/gstrtph263pay.c:
* gst/rtp/gstrtph263pdepay.c:
* gst/rtp/gstrtph263ppay.c:
* gst/rtp/gstrtpilbcdepay.c:
* gst/rtp/gstrtpmp4gpay.c:
* gst/rtp/gstrtpmp4vdepay.c:
* gst/rtp/gstrtpmp4vpay.c:
* gst/rtp/gstrtpmpadepay.c:
* gst/rtp/gstrtpmpapay.c:
* gst/rtp/gstrtppcmadepay.c:
* gst/rtp/gstrtppcmapay.c:
* gst/rtp/gstrtppcmudepay.c:
* gst/rtp/gstrtppcmupay.c:
* gst/rtp/gstrtpspeexdepay.c:
* gst/rtp/gstrtpspeexpay.c:
* gst/rtsp/gstrtpdec.c:
* gst/rtsp/gstrtspsrc.c:
* gst/smpte/gstsmpte.c:
* gst/udp/gstdynudpsink.c:
* gst/udp/gstmultiudpsink.c:
* gst/udp/gstudpsink.c:
* gst/udp/gstudpsrc.c:
* gst/videobox/gstvideobox.c:
* gst/videofilter/gstgamma.c: (gst_gamma_base_init):
* gst/videofilter/gstvideobalance.c:
* gst/videofilter/gstvideoflip.c:
* gst/videofilter/gstvideotemplate.c:
(gst_videotemplate_base_init):
* gst/videomixer/videomixer.c:
* gst/wavparse/gstwavparse.c: (gst_wavparse_base_init),
(gst_wavparse_class_init), (gst_wavparse_dispose),
(gst_wavparse_reset), (gst_wavparse_init),
(gst_wavparse_perform_seek), (gst_wavparse_peek_chunk_info),
(gst_wavparse_peek_chunk), (gst_wavparse_stream_headers),
(gst_wavparse_parse_stream_init), (gst_wavparse_send_event),
(gst_wavparse_add_src_pad), (gst_wavparse_stream_data),
(gst_wavparse_chain), (gst_wavparse_srcpad_event),
(gst_wavparse_sink_activate), (gst_wavparse_sink_activate_pull),
(gst_wavparse_change_state):
* gst/wavparse/gstwavparse.h:
* sys/oss/gstossmixerelement.c:
* sys/oss/gstosssink.c:
* sys/oss/gstosssrc.c:
* sys/osxaudio/gstosxaudioelement.c:
* sys/osxaudio/gstosxaudiosink.c:
* sys/osxaudio/gstosxaudiosrc.c:
* sys/sunaudio/gstsunaudiomixer.c:
* sys/sunaudio/gstsunaudiosink.c:
Define GstElementDetails as const and also static (when defined as
global)
2006-04-25 21:39:46 +00:00
|
|
|
static const GstElementDetails gst_jpegenc_details =
|
2006-03-30 15:37:05 +00:00
|
|
|
GST_ELEMENT_DETAILS ("JPEG image encoder",
|
|
|
|
"Codec/Encoder/Image",
|
|
|
|
"Encode images in JPEG format",
|
|
|
|
"Wim Taymans <wim.taymans@tvd.be>");
|
2001-12-23 15:24:07 +00:00
|
|
|
|
2006-06-22 19:31:04 +00:00
|
|
|
GST_DEBUG_CATEGORY_STATIC (jpegenc_debug);
|
2004-04-23 16:55:40 +00:00
|
|
|
#define GST_CAT_DEFAULT jpegenc_debug
|
|
|
|
|
2009-07-30 14:57:53 +00:00
|
|
|
#define JPEG_DEFAULT_QUALITY 85
|
|
|
|
#define JPEG_DEFAULT_SMOOTHING 0
|
|
|
|
#define JPEG_DEFAULT_IDCT_METHOD JDCT_FASTEST
|
2004-04-23 16:55:40 +00:00
|
|
|
|
2005-02-18 10:38:34 +00:00
|
|
|
/* These macros are adapted from videotestsrc.c
|
|
|
|
* and/or gst-plugins/gst/games/gstvideoimage.c */
|
|
|
|
|
|
|
|
/* I420 */
|
2005-11-28 16:54:03 +00:00
|
|
|
#define I420_Y_ROWSTRIDE(width) (GST_ROUND_UP_4(width))
|
|
|
|
#define I420_U_ROWSTRIDE(width) (GST_ROUND_UP_8(width)/2)
|
|
|
|
#define I420_V_ROWSTRIDE(width) ((GST_ROUND_UP_8(I420_Y_ROWSTRIDE(width)))/2)
|
2005-02-18 10:38:34 +00:00
|
|
|
|
|
|
|
#define I420_Y_OFFSET(w,h) (0)
|
2005-11-28 16:54:03 +00:00
|
|
|
#define I420_U_OFFSET(w,h) (I420_Y_OFFSET(w,h)+(I420_Y_ROWSTRIDE(w)*GST_ROUND_UP_2(h)))
|
|
|
|
#define I420_V_OFFSET(w,h) (I420_U_OFFSET(w,h)+(I420_U_ROWSTRIDE(w)*GST_ROUND_UP_2(h)/2))
|
2005-02-18 10:38:34 +00:00
|
|
|
|
2005-11-28 16:54:03 +00:00
|
|
|
#define I420_SIZE(w,h) (I420_V_OFFSET(w,h)+(I420_V_ROWSTRIDE(w)*GST_ROUND_UP_2(h)/2))
|
2005-02-18 10:38:34 +00:00
|
|
|
|
2001-12-23 15:24:07 +00:00
|
|
|
/* JpegEnc signals and args */
|
2004-03-14 22:34:33 +00:00
|
|
|
enum
|
|
|
|
{
|
2001-12-23 15:24:07 +00:00
|
|
|
FRAME_ENCODED,
|
|
|
|
/* FILL ME */
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
enum
|
|
|
|
{
|
2009-07-21 07:04:36 +00:00
|
|
|
PROP_0,
|
|
|
|
PROP_QUALITY,
|
|
|
|
PROP_SMOOTHING,
|
|
|
|
PROP_IDCT_METHOD
|
2001-12-23 15:24:07 +00:00
|
|
|
};
|
|
|
|
|
2009-07-21 07:04:36 +00:00
|
|
|
extern GType gst_idct_method_get_type (void);
|
|
|
|
#define GST_TYPE_IDCT_METHOD (gst_idct_method_get_type())
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static void gst_jpegenc_base_init (gpointer g_class);
|
|
|
|
static void gst_jpegenc_class_init (GstJpegEnc * klass);
|
|
|
|
static void gst_jpegenc_init (GstJpegEnc * jpegenc);
|
2005-02-22 12:04:16 +00:00
|
|
|
static void gst_jpegenc_finalize (GObject * object);
|
2001-12-23 15:24:07 +00:00
|
|
|
|
2005-09-08 16:58:40 +00:00
|
|
|
static GstFlowReturn gst_jpegenc_chain (GstPad * pad, GstBuffer * buf);
|
|
|
|
static gboolean gst_jpegenc_setcaps (GstPad * pad, GstCaps * caps);
|
2004-03-14 22:34:33 +00:00
|
|
|
static GstCaps *gst_jpegenc_getcaps (GstPad * pad);
|
2003-07-06 20:49:52 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static void gst_jpegenc_resync (GstJpegEnc * jpegenc);
|
|
|
|
static void gst_jpegenc_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec);
|
|
|
|
static void gst_jpegenc_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * pspec);
|
2005-09-02 15:44:50 +00:00
|
|
|
static GstStateChangeReturn gst_jpegenc_change_state (GstElement * element,
|
|
|
|
GstStateChange transition);
|
2005-02-22 12:04:16 +00:00
|
|
|
|
2001-12-23 15:24:07 +00:00
|
|
|
|
|
|
|
static GstElementClass *parent_class = NULL;
|
|
|
|
static guint gst_jpegenc_signals[LAST_SIGNAL] = { 0 };
|
|
|
|
|
|
|
|
GType
|
|
|
|
gst_jpegenc_get_type (void)
|
|
|
|
{
|
|
|
|
static GType jpegenc_type = 0;
|
|
|
|
|
|
|
|
if (!jpegenc_type) {
|
|
|
|
static const GTypeInfo jpegenc_info = {
|
2004-03-14 22:34:33 +00:00
|
|
|
sizeof (GstJpegEnc),
|
2005-09-08 16:58:40 +00:00
|
|
|
(GBaseInitFunc) gst_jpegenc_base_init,
|
2001-12-23 15:24:07 +00:00
|
|
|
NULL,
|
2004-03-14 22:34:33 +00:00
|
|
|
(GClassInitFunc) gst_jpegenc_class_init,
|
2001-12-23 15:24:07 +00:00
|
|
|
NULL,
|
|
|
|
NULL,
|
2004-03-14 22:34:33 +00:00
|
|
|
sizeof (GstJpegEnc),
|
2001-12-23 15:24:07 +00:00
|
|
|
0,
|
2004-03-14 22:34:33 +00:00
|
|
|
(GInstanceInitFunc) gst_jpegenc_init,
|
2001-12-23 15:24:07 +00:00
|
|
|
};
|
2004-03-15 19:32:27 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
jpegenc_type =
|
2004-03-15 19:32:27 +00:00
|
|
|
g_type_register_static (GST_TYPE_ELEMENT, "GstJpegEnc", &jpegenc_info,
|
|
|
|
0);
|
2001-12-23 15:24:07 +00:00
|
|
|
}
|
|
|
|
return jpegenc_type;
|
|
|
|
}
|
|
|
|
|
ext/gdk_pixbuf/gstgdkpixbuf.c: Fix logic bug causing spurious errors.
Original commit message from CVS:
* ext/gdk_pixbuf/gstgdkpixbuf.c: (gst_gdk_pixbuf_sink_link),
(gst_gdk_pixbuf_chain): Fix logic bug causing spurious errors.
* ext/jpeg/gstjpegdec.c: (gst_jpegdec_base_init),
(gst_jpegdec_init), (gst_jpegdec_chain): Fix negotiation.
* ext/jpeg/gstjpegenc.c: (gst_jpegenc_base_init),
(gst_jpegenc_class_init), (gst_jpegenc_init),
(gst_jpegenc_getcaps), (gst_jpegenc_link), (gst_jpegenc_resync),
(gst_jpegenc_chain), (gst_jpegenc_set_property),
(gst_jpegenc_get_property): Fix negotiation. Add some properties.
* ext/jpeg/gstjpegenc.h: Fix negotiation.
2004-02-11 08:31:35 +00:00
|
|
|
static GstStaticPadTemplate gst_jpegenc_sink_pad_template =
|
2004-03-14 22:34:33 +00:00
|
|
|
GST_STATIC_PAD_TEMPLATE ("sink",
|
ext/gdk_pixbuf/gstgdkpixbuf.c: Fix logic bug causing spurious errors.
Original commit message from CVS:
* ext/gdk_pixbuf/gstgdkpixbuf.c: (gst_gdk_pixbuf_sink_link),
(gst_gdk_pixbuf_chain): Fix logic bug causing spurious errors.
* ext/jpeg/gstjpegdec.c: (gst_jpegdec_base_init),
(gst_jpegdec_init), (gst_jpegdec_chain): Fix negotiation.
* ext/jpeg/gstjpegenc.c: (gst_jpegenc_base_init),
(gst_jpegenc_class_init), (gst_jpegenc_init),
(gst_jpegenc_getcaps), (gst_jpegenc_link), (gst_jpegenc_resync),
(gst_jpegenc_chain), (gst_jpegenc_set_property),
(gst_jpegenc_get_property): Fix negotiation. Add some properties.
* ext/jpeg/gstjpegenc.h: Fix negotiation.
2004-02-11 08:31:35 +00:00
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS,
|
2004-03-14 22:34:33 +00:00
|
|
|
GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("I420"))
|
|
|
|
);
|
ext/gdk_pixbuf/gstgdkpixbuf.c: Fix logic bug causing spurious errors.
Original commit message from CVS:
* ext/gdk_pixbuf/gstgdkpixbuf.c: (gst_gdk_pixbuf_sink_link),
(gst_gdk_pixbuf_chain): Fix logic bug causing spurious errors.
* ext/jpeg/gstjpegdec.c: (gst_jpegdec_base_init),
(gst_jpegdec_init), (gst_jpegdec_chain): Fix negotiation.
* ext/jpeg/gstjpegenc.c: (gst_jpegenc_base_init),
(gst_jpegenc_class_init), (gst_jpegenc_init),
(gst_jpegenc_getcaps), (gst_jpegenc_link), (gst_jpegenc_resync),
(gst_jpegenc_chain), (gst_jpegenc_set_property),
(gst_jpegenc_get_property): Fix negotiation. Add some properties.
* ext/jpeg/gstjpegenc.h: Fix negotiation.
2004-02-11 08:31:35 +00:00
|
|
|
|
|
|
|
static GstStaticPadTemplate gst_jpegenc_src_pad_template =
|
2004-03-14 22:34:33 +00:00
|
|
|
GST_STATIC_PAD_TEMPLATE ("src",
|
ext/gdk_pixbuf/gstgdkpixbuf.c: Fix logic bug causing spurious errors.
Original commit message from CVS:
* ext/gdk_pixbuf/gstgdkpixbuf.c: (gst_gdk_pixbuf_sink_link),
(gst_gdk_pixbuf_chain): Fix logic bug causing spurious errors.
* ext/jpeg/gstjpegdec.c: (gst_jpegdec_base_init),
(gst_jpegdec_init), (gst_jpegdec_chain): Fix negotiation.
* ext/jpeg/gstjpegenc.c: (gst_jpegenc_base_init),
(gst_jpegenc_class_init), (gst_jpegenc_init),
(gst_jpegenc_getcaps), (gst_jpegenc_link), (gst_jpegenc_resync),
(gst_jpegenc_chain), (gst_jpegenc_set_property),
(gst_jpegenc_get_property): Fix negotiation. Add some properties.
* ext/jpeg/gstjpegenc.h: Fix negotiation.
2004-02-11 08:31:35 +00:00
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS ("image/jpeg, "
|
2004-03-15 19:32:27 +00:00
|
|
|
"width = (int) [ 16, 4096 ], "
|
2005-11-22 23:58:14 +00:00
|
|
|
"height = (int) [ 16, 4096 ], " "framerate = (fraction) [ 0/1, MAX ]")
|
2004-03-14 22:34:33 +00:00
|
|
|
);
|
2003-11-02 00:05:54 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
gst_jpegenc_base_init (gpointer g_class)
|
|
|
|
{
|
|
|
|
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
2004-03-14 22:34:33 +00:00
|
|
|
|
ext/gdk_pixbuf/gstgdkpixbuf.c: Fix logic bug causing spurious errors.
Original commit message from CVS:
* ext/gdk_pixbuf/gstgdkpixbuf.c: (gst_gdk_pixbuf_sink_link),
(gst_gdk_pixbuf_chain): Fix logic bug causing spurious errors.
* ext/jpeg/gstjpegdec.c: (gst_jpegdec_base_init),
(gst_jpegdec_init), (gst_jpegdec_chain): Fix negotiation.
* ext/jpeg/gstjpegenc.c: (gst_jpegenc_base_init),
(gst_jpegenc_class_init), (gst_jpegenc_init),
(gst_jpegenc_getcaps), (gst_jpegenc_link), (gst_jpegenc_resync),
(gst_jpegenc_chain), (gst_jpegenc_set_property),
(gst_jpegenc_get_property): Fix negotiation. Add some properties.
* ext/jpeg/gstjpegenc.h: Fix negotiation.
2004-02-11 08:31:35 +00:00
|
|
|
gst_element_class_add_pad_template (element_class,
|
|
|
|
gst_static_pad_template_get (&gst_jpegenc_sink_pad_template));
|
|
|
|
gst_element_class_add_pad_template (element_class,
|
|
|
|
gst_static_pad_template_get (&gst_jpegenc_src_pad_template));
|
2003-11-02 00:05:54 +00:00
|
|
|
gst_element_class_set_details (element_class, &gst_jpegenc_details);
|
|
|
|
}
|
|
|
|
|
2001-12-23 15:24:07 +00:00
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_jpegenc_class_init (GstJpegEnc * klass)
|
2001-12-23 15:24:07 +00:00
|
|
|
{
|
|
|
|
GObjectClass *gobject_class;
|
|
|
|
GstElementClass *gstelement_class;
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
gobject_class = (GObjectClass *) klass;
|
|
|
|
gstelement_class = (GstElementClass *) klass;
|
2001-12-23 15:24:07 +00:00
|
|
|
|
2006-04-08 21:21:45 +00:00
|
|
|
parent_class = g_type_class_peek_parent (klass);
|
2001-12-23 15:24:07 +00:00
|
|
|
|
|
|
|
gst_jpegenc_signals[FRAME_ENCODED] =
|
2004-03-14 22:34:33 +00:00
|
|
|
g_signal_new ("frame-encoded", G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstJpegEncClass, frame_encoded), NULL,
|
|
|
|
NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
|
2001-12-23 15:24:07 +00:00
|
|
|
|
2005-09-08 16:58:40 +00:00
|
|
|
gobject_class->set_property = gst_jpegenc_set_property;
|
|
|
|
gobject_class->get_property = gst_jpegenc_get_property;
|
|
|
|
|
|
|
|
|
2009-07-21 07:04:36 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_QUALITY,
|
ext/gdk_pixbuf/gstgdkpixbuf.c: Fix logic bug causing spurious errors.
Original commit message from CVS:
* ext/gdk_pixbuf/gstgdkpixbuf.c: (gst_gdk_pixbuf_sink_link),
(gst_gdk_pixbuf_chain): Fix logic bug causing spurious errors.
* ext/jpeg/gstjpegdec.c: (gst_jpegdec_base_init),
(gst_jpegdec_init), (gst_jpegdec_chain): Fix negotiation.
* ext/jpeg/gstjpegenc.c: (gst_jpegenc_base_init),
(gst_jpegenc_class_init), (gst_jpegenc_init),
(gst_jpegenc_getcaps), (gst_jpegenc_link), (gst_jpegenc_resync),
(gst_jpegenc_chain), (gst_jpegenc_set_property),
(gst_jpegenc_get_property): Fix negotiation. Add some properties.
* ext/jpeg/gstjpegenc.h: Fix negotiation.
2004-02-11 08:31:35 +00:00
|
|
|
g_param_spec_int ("quality", "Quality", "Quality of encoding",
|
2009-07-30 14:57:53 +00:00
|
|
|
0, 100, JPEG_DEFAULT_QUALITY, G_PARAM_READWRITE));
|
2009-07-21 07:04:36 +00:00
|
|
|
|
|
|
|
#if ENABLE_SMOOTHING
|
ext/gdk_pixbuf/gstgdkpixbuf.c: Fix logic bug causing spurious errors.
Original commit message from CVS:
* ext/gdk_pixbuf/gstgdkpixbuf.c: (gst_gdk_pixbuf_sink_link),
(gst_gdk_pixbuf_chain): Fix logic bug causing spurious errors.
* ext/jpeg/gstjpegdec.c: (gst_jpegdec_base_init),
(gst_jpegdec_init), (gst_jpegdec_chain): Fix negotiation.
* ext/jpeg/gstjpegenc.c: (gst_jpegenc_base_init),
(gst_jpegenc_class_init), (gst_jpegenc_init),
(gst_jpegenc_getcaps), (gst_jpegenc_link), (gst_jpegenc_resync),
(gst_jpegenc_chain), (gst_jpegenc_set_property),
(gst_jpegenc_get_property): Fix negotiation. Add some properties.
* ext/jpeg/gstjpegenc.h: Fix negotiation.
2004-02-11 08:31:35 +00:00
|
|
|
/* disabled, since it doesn't seem to work */
|
2009-07-21 07:04:36 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_SMOOTHING,
|
ext/gdk_pixbuf/gstgdkpixbuf.c: Fix logic bug causing spurious errors.
Original commit message from CVS:
* ext/gdk_pixbuf/gstgdkpixbuf.c: (gst_gdk_pixbuf_sink_link),
(gst_gdk_pixbuf_chain): Fix logic bug causing spurious errors.
* ext/jpeg/gstjpegdec.c: (gst_jpegdec_base_init),
(gst_jpegdec_init), (gst_jpegdec_chain): Fix negotiation.
* ext/jpeg/gstjpegenc.c: (gst_jpegenc_base_init),
(gst_jpegenc_class_init), (gst_jpegenc_init),
(gst_jpegenc_getcaps), (gst_jpegenc_link), (gst_jpegenc_resync),
(gst_jpegenc_chain), (gst_jpegenc_set_property),
(gst_jpegenc_get_property): Fix negotiation. Add some properties.
* ext/jpeg/gstjpegenc.h: Fix negotiation.
2004-02-11 08:31:35 +00:00
|
|
|
g_param_spec_int ("smoothing", "Smoothing", "Smoothing factor",
|
2009-07-30 14:57:53 +00:00
|
|
|
0, 100, JPEG_DEFAULT_SMOOTHING, G_PARAM_READWRITE));
|
ext/gdk_pixbuf/gstgdkpixbuf.c: Fix logic bug causing spurious errors.
Original commit message from CVS:
* ext/gdk_pixbuf/gstgdkpixbuf.c: (gst_gdk_pixbuf_sink_link),
(gst_gdk_pixbuf_chain): Fix logic bug causing spurious errors.
* ext/jpeg/gstjpegdec.c: (gst_jpegdec_base_init),
(gst_jpegdec_init), (gst_jpegdec_chain): Fix negotiation.
* ext/jpeg/gstjpegenc.c: (gst_jpegenc_base_init),
(gst_jpegenc_class_init), (gst_jpegenc_init),
(gst_jpegenc_getcaps), (gst_jpegenc_link), (gst_jpegenc_resync),
(gst_jpegenc_chain), (gst_jpegenc_set_property),
(gst_jpegenc_get_property): Fix negotiation. Add some properties.
* ext/jpeg/gstjpegenc.h: Fix negotiation.
2004-02-11 08:31:35 +00:00
|
|
|
#endif
|
|
|
|
|
2009-07-21 07:04:36 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_IDCT_METHOD,
|
|
|
|
g_param_spec_enum ("idct-method", "IDCT Method",
|
|
|
|
"The IDCT algorithm to use", GST_TYPE_IDCT_METHOD,
|
2009-07-30 14:57:53 +00:00
|
|
|
JPEG_DEFAULT_IDCT_METHOD, G_PARAM_READWRITE));
|
2009-07-21 07:04:36 +00:00
|
|
|
|
2005-02-22 12:04:16 +00:00
|
|
|
gstelement_class->change_state = gst_jpegenc_change_state;
|
|
|
|
|
|
|
|
gobject_class->finalize = gst_jpegenc_finalize;
|
2004-04-23 16:55:40 +00:00
|
|
|
|
|
|
|
GST_DEBUG_CATEGORY_INIT (jpegenc_debug, "jpegenc", 0,
|
|
|
|
"JPEG encoding element");
|
2001-12-23 15:24:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_jpegenc_init_destination (j_compress_ptr cinfo)
|
|
|
|
{
|
2003-06-29 19:46:12 +00:00
|
|
|
GST_DEBUG ("gst_jpegenc_chain: init_destination");
|
2001-12-23 15:24:07 +00:00
|
|
|
}
|
|
|
|
|
2007-01-08 12:45:10 +00:00
|
|
|
static boolean
|
2001-12-23 15:24:07 +00:00
|
|
|
gst_jpegenc_flush_destination (j_compress_ptr cinfo)
|
|
|
|
{
|
2003-06-29 19:46:12 +00:00
|
|
|
GST_DEBUG ("gst_jpegenc_chain: flush_destination: buffer too small !!!");
|
2001-12-23 15:24:07 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static void
|
|
|
|
gst_jpegenc_term_destination (j_compress_ptr cinfo)
|
2001-12-23 15:24:07 +00:00
|
|
|
{
|
2003-06-29 19:46:12 +00:00
|
|
|
GST_DEBUG ("gst_jpegenc_chain: term_source");
|
2001-12-23 15:24:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_jpegenc_init (GstJpegEnc * jpegenc)
|
2001-12-23 15:24:07 +00:00
|
|
|
{
|
|
|
|
/* create the sink and src pads */
|
2004-03-14 22:34:33 +00:00
|
|
|
jpegenc->sinkpad =
|
2006-03-15 16:17:12 +00:00
|
|
|
gst_pad_new_from_static_template (&gst_jpegenc_sink_pad_template, "sink");
|
2006-03-24 09:54:00 +00:00
|
|
|
gst_pad_set_chain_function (jpegenc->sinkpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_jpegenc_chain));
|
|
|
|
gst_pad_set_getcaps_function (jpegenc->sinkpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_jpegenc_getcaps));
|
|
|
|
gst_pad_set_setcaps_function (jpegenc->sinkpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_jpegenc_setcaps));
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (jpegenc), jpegenc->sinkpad);
|
|
|
|
|
|
|
|
jpegenc->srcpad =
|
2006-03-15 16:17:12 +00:00
|
|
|
gst_pad_new_from_static_template (&gst_jpegenc_src_pad_template, "src");
|
2006-03-24 09:54:00 +00:00
|
|
|
gst_pad_set_getcaps_function (jpegenc->sinkpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_jpegenc_getcaps));
|
2005-09-08 16:58:40 +00:00
|
|
|
/*gst_pad_set_setcaps_function (jpegenc->sinkpad, gst_jpegenc_setcaps); */
|
|
|
|
gst_pad_use_fixed_caps (jpegenc->sinkpad);
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (jpegenc), jpegenc->srcpad);
|
2001-12-23 15:24:07 +00:00
|
|
|
|
2002-02-03 22:27:33 +00:00
|
|
|
/* reset the initial video state */
|
2001-12-23 15:24:07 +00:00
|
|
|
jpegenc->width = -1;
|
|
|
|
jpegenc->height = -1;
|
|
|
|
|
|
|
|
/* setup jpeglib */
|
2004-03-14 22:34:33 +00:00
|
|
|
memset (&jpegenc->cinfo, 0, sizeof (jpegenc->cinfo));
|
|
|
|
memset (&jpegenc->jerr, 0, sizeof (jpegenc->jerr));
|
|
|
|
jpegenc->cinfo.err = jpeg_std_error (&jpegenc->jerr);
|
|
|
|
jpeg_create_compress (&jpegenc->cinfo);
|
2001-12-23 15:24:07 +00:00
|
|
|
|
|
|
|
jpegenc->jdest.init_destination = gst_jpegenc_init_destination;
|
|
|
|
jpegenc->jdest.empty_output_buffer = gst_jpegenc_flush_destination;
|
|
|
|
jpegenc->jdest.term_destination = gst_jpegenc_term_destination;
|
|
|
|
jpegenc->cinfo.dest = &jpegenc->jdest;
|
|
|
|
|
2009-07-21 07:04:36 +00:00
|
|
|
/* init properties */
|
2009-07-30 14:57:53 +00:00
|
|
|
jpegenc->quality = JPEG_DEFAULT_QUALITY;
|
|
|
|
jpegenc->smoothing = JPEG_DEFAULT_SMOOTHING;
|
|
|
|
jpegenc->idct_method = JPEG_DEFAULT_IDCT_METHOD;
|
ext/gdk_pixbuf/gstgdkpixbuf.c: Fix logic bug causing spurious errors.
Original commit message from CVS:
* ext/gdk_pixbuf/gstgdkpixbuf.c: (gst_gdk_pixbuf_sink_link),
(gst_gdk_pixbuf_chain): Fix logic bug causing spurious errors.
* ext/jpeg/gstjpegdec.c: (gst_jpegdec_base_init),
(gst_jpegdec_init), (gst_jpegdec_chain): Fix negotiation.
* ext/jpeg/gstjpegenc.c: (gst_jpegenc_base_init),
(gst_jpegenc_class_init), (gst_jpegenc_init),
(gst_jpegenc_getcaps), (gst_jpegenc_link), (gst_jpegenc_resync),
(gst_jpegenc_chain), (gst_jpegenc_set_property),
(gst_jpegenc_get_property): Fix negotiation. Add some properties.
* ext/jpeg/gstjpegenc.h: Fix negotiation.
2004-02-11 08:31:35 +00:00
|
|
|
}
|
|
|
|
|
2005-02-22 12:04:16 +00:00
|
|
|
static void
|
|
|
|
gst_jpegenc_finalize (GObject * object)
|
|
|
|
{
|
|
|
|
GstJpegEnc *filter = GST_JPEGENC (object);
|
|
|
|
|
|
|
|
jpeg_destroy_compress (&filter->cinfo);
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
|
|
|
}
|
|
|
|
|
ext/gdk_pixbuf/gstgdkpixbuf.c: Fix logic bug causing spurious errors.
Original commit message from CVS:
* ext/gdk_pixbuf/gstgdkpixbuf.c: (gst_gdk_pixbuf_sink_link),
(gst_gdk_pixbuf_chain): Fix logic bug causing spurious errors.
* ext/jpeg/gstjpegdec.c: (gst_jpegdec_base_init),
(gst_jpegdec_init), (gst_jpegdec_chain): Fix negotiation.
* ext/jpeg/gstjpegenc.c: (gst_jpegenc_base_init),
(gst_jpegenc_class_init), (gst_jpegenc_init),
(gst_jpegenc_getcaps), (gst_jpegenc_link), (gst_jpegenc_resync),
(gst_jpegenc_chain), (gst_jpegenc_set_property),
(gst_jpegenc_get_property): Fix negotiation. Add some properties.
* ext/jpeg/gstjpegenc.h: Fix negotiation.
2004-02-11 08:31:35 +00:00
|
|
|
static GstCaps *
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_jpegenc_getcaps (GstPad * pad)
|
ext/gdk_pixbuf/gstgdkpixbuf.c: Fix logic bug causing spurious errors.
Original commit message from CVS:
* ext/gdk_pixbuf/gstgdkpixbuf.c: (gst_gdk_pixbuf_sink_link),
(gst_gdk_pixbuf_chain): Fix logic bug causing spurious errors.
* ext/jpeg/gstjpegdec.c: (gst_jpegdec_base_init),
(gst_jpegdec_init), (gst_jpegdec_chain): Fix negotiation.
* ext/jpeg/gstjpegenc.c: (gst_jpegenc_base_init),
(gst_jpegenc_class_init), (gst_jpegenc_init),
(gst_jpegenc_getcaps), (gst_jpegenc_link), (gst_jpegenc_resync),
(gst_jpegenc_chain), (gst_jpegenc_set_property),
(gst_jpegenc_get_property): Fix negotiation. Add some properties.
* ext/jpeg/gstjpegenc.h: Fix negotiation.
2004-02-11 08:31:35 +00:00
|
|
|
{
|
|
|
|
GstJpegEnc *jpegenc = GST_JPEGENC (gst_pad_get_parent (pad));
|
|
|
|
GstPad *otherpad;
|
|
|
|
GstCaps *caps;
|
|
|
|
const char *name;
|
|
|
|
int i;
|
2004-04-26 13:47:38 +00:00
|
|
|
GstStructure *structure = NULL;
|
ext/gdk_pixbuf/gstgdkpixbuf.c: Fix logic bug causing spurious errors.
Original commit message from CVS:
* ext/gdk_pixbuf/gstgdkpixbuf.c: (gst_gdk_pixbuf_sink_link),
(gst_gdk_pixbuf_chain): Fix logic bug causing spurious errors.
* ext/jpeg/gstjpegdec.c: (gst_jpegdec_base_init),
(gst_jpegdec_init), (gst_jpegdec_chain): Fix negotiation.
* ext/jpeg/gstjpegenc.c: (gst_jpegenc_base_init),
(gst_jpegenc_class_init), (gst_jpegenc_init),
(gst_jpegenc_getcaps), (gst_jpegenc_link), (gst_jpegenc_resync),
(gst_jpegenc_chain), (gst_jpegenc_set_property),
(gst_jpegenc_get_property): Fix negotiation. Add some properties.
* ext/jpeg/gstjpegenc.h: Fix negotiation.
2004-02-11 08:31:35 +00:00
|
|
|
|
2004-04-26 13:47:38 +00:00
|
|
|
/* we want to proxy properties like width, height and framerate from the
|
|
|
|
other end of the element */
|
ext/gdk_pixbuf/gstgdkpixbuf.c: Fix logic bug causing spurious errors.
Original commit message from CVS:
* ext/gdk_pixbuf/gstgdkpixbuf.c: (gst_gdk_pixbuf_sink_link),
(gst_gdk_pixbuf_chain): Fix logic bug causing spurious errors.
* ext/jpeg/gstjpegdec.c: (gst_jpegdec_base_init),
(gst_jpegdec_init), (gst_jpegdec_chain): Fix negotiation.
* ext/jpeg/gstjpegenc.c: (gst_jpegenc_base_init),
(gst_jpegenc_class_init), (gst_jpegenc_init),
(gst_jpegenc_getcaps), (gst_jpegenc_link), (gst_jpegenc_resync),
(gst_jpegenc_chain), (gst_jpegenc_set_property),
(gst_jpegenc_get_property): Fix negotiation. Add some properties.
* ext/jpeg/gstjpegenc.h: Fix negotiation.
2004-02-11 08:31:35 +00:00
|
|
|
otherpad = (pad == jpegenc->srcpad) ? jpegenc->sinkpad : jpegenc->srcpad;
|
ext/jpeg/: Various cleanups, capsnego and leak fixes.
Original commit message from CVS:
* ext/jpeg/gstjpegenc.c: (gst_jpegenc_getcaps):
* ext/jpeg/gstsmokedec.c: (gst_smokedec_class_init),
(gst_smokedec_init), (gst_smokedec_finalize), (gst_smokedec_chain),
(gst_smokedec_change_state):
* ext/jpeg/gstsmokeenc.c: (gst_smokeenc_class_init),
(gst_smokeenc_init), (gst_smokeenc_finalize),
(gst_smokeenc_getcaps), (gst_smokeenc_setcaps),
(gst_smokeenc_resync), (gst_smokeenc_chain),
(gst_smokeenc_set_property), (gst_smokeenc_get_property),
(gst_smokeenc_change_state):
Various cleanups, capsnego and leak fixes.
2006-10-30 09:24:53 +00:00
|
|
|
|
|
|
|
caps = gst_pad_peer_get_caps (otherpad);
|
|
|
|
if (caps == NULL)
|
|
|
|
caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad));
|
|
|
|
else
|
|
|
|
caps = gst_caps_make_writable (caps);
|
|
|
|
|
ext/gdk_pixbuf/gstgdkpixbuf.c: Fix logic bug causing spurious errors.
Original commit message from CVS:
* ext/gdk_pixbuf/gstgdkpixbuf.c: (gst_gdk_pixbuf_sink_link),
(gst_gdk_pixbuf_chain): Fix logic bug causing spurious errors.
* ext/jpeg/gstjpegdec.c: (gst_jpegdec_base_init),
(gst_jpegdec_init), (gst_jpegdec_chain): Fix negotiation.
* ext/jpeg/gstjpegenc.c: (gst_jpegenc_base_init),
(gst_jpegenc_class_init), (gst_jpegenc_init),
(gst_jpegenc_getcaps), (gst_jpegenc_link), (gst_jpegenc_resync),
(gst_jpegenc_chain), (gst_jpegenc_set_property),
(gst_jpegenc_get_property): Fix negotiation. Add some properties.
* ext/jpeg/gstjpegenc.h: Fix negotiation.
2004-02-11 08:31:35 +00:00
|
|
|
if (pad == jpegenc->srcpad) {
|
|
|
|
name = "image/jpeg";
|
|
|
|
} else {
|
|
|
|
name = "video/x-raw-yuv";
|
|
|
|
}
|
ext/jpeg/: Various cleanups, capsnego and leak fixes.
Original commit message from CVS:
* ext/jpeg/gstjpegenc.c: (gst_jpegenc_getcaps):
* ext/jpeg/gstsmokedec.c: (gst_smokedec_class_init),
(gst_smokedec_init), (gst_smokedec_finalize), (gst_smokedec_chain),
(gst_smokedec_change_state):
* ext/jpeg/gstsmokeenc.c: (gst_smokeenc_class_init),
(gst_smokeenc_init), (gst_smokeenc_finalize),
(gst_smokeenc_getcaps), (gst_smokeenc_setcaps),
(gst_smokeenc_resync), (gst_smokeenc_chain),
(gst_smokeenc_set_property), (gst_smokeenc_get_property),
(gst_smokeenc_change_state):
Various cleanups, capsnego and leak fixes.
2006-10-30 09:24:53 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
for (i = 0; i < gst_caps_get_size (caps); i++) {
|
ext/gdk_pixbuf/gstgdkpixbuf.c: Fix logic bug causing spurious errors.
Original commit message from CVS:
* ext/gdk_pixbuf/gstgdkpixbuf.c: (gst_gdk_pixbuf_sink_link),
(gst_gdk_pixbuf_chain): Fix logic bug causing spurious errors.
* ext/jpeg/gstjpegdec.c: (gst_jpegdec_base_init),
(gst_jpegdec_init), (gst_jpegdec_chain): Fix negotiation.
* ext/jpeg/gstjpegenc.c: (gst_jpegenc_base_init),
(gst_jpegenc_class_init), (gst_jpegenc_init),
(gst_jpegenc_getcaps), (gst_jpegenc_link), (gst_jpegenc_resync),
(gst_jpegenc_chain), (gst_jpegenc_set_property),
(gst_jpegenc_get_property): Fix negotiation. Add some properties.
* ext/jpeg/gstjpegenc.h: Fix negotiation.
2004-02-11 08:31:35 +00:00
|
|
|
structure = gst_caps_get_structure (caps, i);
|
|
|
|
|
|
|
|
gst_structure_set_name (structure, name);
|
|
|
|
gst_structure_remove_field (structure, "format");
|
2004-04-29 17:37:01 +00:00
|
|
|
/* ... but for the sink pad, we only do I420 anyway, so add that */
|
|
|
|
if (pad == jpegenc->sinkpad) {
|
|
|
|
gst_structure_set (structure, "format", GST_TYPE_FOURCC,
|
|
|
|
GST_STR_FOURCC ("I420"), NULL);
|
|
|
|
}
|
ext/gdk_pixbuf/gstgdkpixbuf.c: Fix logic bug causing spurious errors.
Original commit message from CVS:
* ext/gdk_pixbuf/gstgdkpixbuf.c: (gst_gdk_pixbuf_sink_link),
(gst_gdk_pixbuf_chain): Fix logic bug causing spurious errors.
* ext/jpeg/gstjpegdec.c: (gst_jpegdec_base_init),
(gst_jpegdec_init), (gst_jpegdec_chain): Fix negotiation.
* ext/jpeg/gstjpegenc.c: (gst_jpegenc_base_init),
(gst_jpegenc_class_init), (gst_jpegenc_init),
(gst_jpegenc_getcaps), (gst_jpegenc_link), (gst_jpegenc_resync),
(gst_jpegenc_chain), (gst_jpegenc_set_property),
(gst_jpegenc_get_property): Fix negotiation. Add some properties.
* ext/jpeg/gstjpegenc.h: Fix negotiation.
2004-02-11 08:31:35 +00:00
|
|
|
}
|
close #333784 unref the result of gst_pad_get_parent() by: Christophe Fergeau.
Original commit message from CVS:
* ext/cairo/gsttextoverlay.c: (gst_text_overlay_setcaps):
* ext/esd/esdmon.c: (gst_esdmon_get):
* ext/flac/gstflactag.c: (gst_flac_tag_chain):
* ext/gdk_pixbuf/gstgdkpixbuf.c: (gst_gdk_pixbuf_sink_setcaps),
(gst_gdk_pixbuf_sink_getcaps):
* ext/jpeg/gstjpegenc.c: (gst_jpegenc_getcaps),
(gst_jpegenc_setcaps):
* ext/jpeg/gstsmokedec.c: (gst_smokedec_chain):
* ext/jpeg/gstsmokeenc.c: (gst_smokeenc_getcaps),
(gst_smokeenc_setcaps):
* ext/libmng/gstmngdec.c: (gst_mngdec_sinklink),
(gst_mngdec_src_getcaps):
* ext/libmng/gstmngenc.c: (gst_mngenc_sinklink),
(gst_mngenc_chain):
* ext/libpng/gstpngenc.c: (gst_pngenc_setcaps):
* ext/mikmod/gstmikmod.c: (gst_mikmod_srclink):
* ext/speex/gstspeexdec.c: (speex_dec_convert),
(speex_dec_src_event), (speex_dec_chain):
* gst/avi/gstavimux.c: (gst_avimux_vidsinkconnect),
(gst_avimux_audsinkconnect), (gst_avimux_handle_event):
* gst/debug/negotiation.c: (gst_negotiation_getcaps),
(gst_negotiation_pad_link), (gst_negotiation_chain):
* gst/flx/gstflxdec.c: (gst_flxdec_src_query_handler),
(gst_flxdec_chain):
* gst/interleave/deinterleave.c: (deinterleave_sink_link),
(deinterleave_chain):
* gst/law/mulaw-encode.c: (mulawenc_setcaps):
* gst/median/gstmedian.c: (gst_median_link):
* gst/monoscope/gstmonoscope.c: (gst_monoscope_srcconnect),
(gst_monoscope_chain):
* gst/rtp/gstrtpL16pay.c: (gst_rtpL16pay_sinkconnect):
* gst/wavenc/gstwavenc.c: (gst_wavenc_sink_setcaps):
* sys/osxaudio/gstosxaudiosink.c: (gst_osxaudiosink_chain):
* sys/osxaudio/gstosxaudiosrc.c: (gst_osxaudiosrc_get):
close #333784 unref the result of gst_pad_get_parent()
by: Christophe Fergeau.
2006-03-13 15:49:08 +00:00
|
|
|
gst_object_unref (jpegenc);
|
ext/gdk_pixbuf/gstgdkpixbuf.c: Fix logic bug causing spurious errors.
Original commit message from CVS:
* ext/gdk_pixbuf/gstgdkpixbuf.c: (gst_gdk_pixbuf_sink_link),
(gst_gdk_pixbuf_chain): Fix logic bug causing spurious errors.
* ext/jpeg/gstjpegdec.c: (gst_jpegdec_base_init),
(gst_jpegdec_init), (gst_jpegdec_chain): Fix negotiation.
* ext/jpeg/gstjpegenc.c: (gst_jpegenc_base_init),
(gst_jpegenc_class_init), (gst_jpegenc_init),
(gst_jpegenc_getcaps), (gst_jpegenc_link), (gst_jpegenc_resync),
(gst_jpegenc_chain), (gst_jpegenc_set_property),
(gst_jpegenc_get_property): Fix negotiation. Add some properties.
* ext/jpeg/gstjpegenc.h: Fix negotiation.
2004-02-11 08:31:35 +00:00
|
|
|
|
|
|
|
return caps;
|
2001-12-23 15:24:07 +00:00
|
|
|
}
|
|
|
|
|
2005-09-08 16:58:40 +00:00
|
|
|
static gboolean
|
|
|
|
gst_jpegenc_setcaps (GstPad * pad, GstCaps * caps)
|
2003-07-06 20:49:52 +00:00
|
|
|
{
|
|
|
|
GstJpegEnc *jpegenc = GST_JPEGENC (gst_pad_get_parent (pad));
|
2003-12-22 01:47:09 +00:00
|
|
|
GstStructure *structure;
|
ext/gdk_pixbuf/gstgdkpixbuf.c: Fix logic bug causing spurious errors.
Original commit message from CVS:
* ext/gdk_pixbuf/gstgdkpixbuf.c: (gst_gdk_pixbuf_sink_link),
(gst_gdk_pixbuf_chain): Fix logic bug causing spurious errors.
* ext/jpeg/gstjpegdec.c: (gst_jpegdec_base_init),
(gst_jpegdec_init), (gst_jpegdec_chain): Fix negotiation.
* ext/jpeg/gstjpegenc.c: (gst_jpegenc_base_init),
(gst_jpegenc_class_init), (gst_jpegenc_init),
(gst_jpegenc_getcaps), (gst_jpegenc_link), (gst_jpegenc_resync),
(gst_jpegenc_chain), (gst_jpegenc_set_property),
(gst_jpegenc_get_property): Fix negotiation. Add some properties.
* ext/jpeg/gstjpegenc.h: Fix negotiation.
2004-02-11 08:31:35 +00:00
|
|
|
GstCaps *othercaps;
|
|
|
|
GstPad *otherpad;
|
2005-09-08 16:58:40 +00:00
|
|
|
gboolean ret;
|
2005-11-22 23:58:14 +00:00
|
|
|
const GValue *framerate;
|
ext/gdk_pixbuf/gstgdkpixbuf.c: Fix logic bug causing spurious errors.
Original commit message from CVS:
* ext/gdk_pixbuf/gstgdkpixbuf.c: (gst_gdk_pixbuf_sink_link),
(gst_gdk_pixbuf_chain): Fix logic bug causing spurious errors.
* ext/jpeg/gstjpegdec.c: (gst_jpegdec_base_init),
(gst_jpegdec_init), (gst_jpegdec_chain): Fix negotiation.
* ext/jpeg/gstjpegenc.c: (gst_jpegenc_base_init),
(gst_jpegenc_class_init), (gst_jpegenc_init),
(gst_jpegenc_getcaps), (gst_jpegenc_link), (gst_jpegenc_resync),
(gst_jpegenc_chain), (gst_jpegenc_set_property),
(gst_jpegenc_get_property): Fix negotiation. Add some properties.
* ext/jpeg/gstjpegenc.h: Fix negotiation.
2004-02-11 08:31:35 +00:00
|
|
|
|
|
|
|
otherpad = (pad == jpegenc->srcpad) ? jpegenc->sinkpad : jpegenc->srcpad;
|
2003-07-06 20:49:52 +00:00
|
|
|
|
2003-12-22 01:47:09 +00:00
|
|
|
structure = gst_caps_get_structure (caps, 0);
|
2005-11-22 23:58:14 +00:00
|
|
|
framerate = gst_structure_get_value (structure, "framerate");
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_structure_get_int (structure, "width", &jpegenc->width);
|
|
|
|
gst_structure_get_int (structure, "height", &jpegenc->height);
|
|
|
|
|
ext/gdk_pixbuf/gstgdkpixbuf.c: Fix logic bug causing spurious errors.
Original commit message from CVS:
* ext/gdk_pixbuf/gstgdkpixbuf.c: (gst_gdk_pixbuf_sink_link),
(gst_gdk_pixbuf_chain): Fix logic bug causing spurious errors.
* ext/jpeg/gstjpegdec.c: (gst_jpegdec_base_init),
(gst_jpegdec_init), (gst_jpegdec_chain): Fix negotiation.
* ext/jpeg/gstjpegenc.c: (gst_jpegenc_base_init),
(gst_jpegenc_class_init), (gst_jpegenc_init),
(gst_jpegenc_getcaps), (gst_jpegenc_link), (gst_jpegenc_resync),
(gst_jpegenc_chain), (gst_jpegenc_set_property),
(gst_jpegenc_get_property): Fix negotiation. Add some properties.
* ext/jpeg/gstjpegenc.h: Fix negotiation.
2004-02-11 08:31:35 +00:00
|
|
|
othercaps = gst_caps_copy (gst_pad_get_pad_template_caps (otherpad));
|
2005-11-22 23:58:14 +00:00
|
|
|
if (framerate) {
|
|
|
|
gst_caps_set_simple (othercaps,
|
|
|
|
"width", G_TYPE_INT, jpegenc->width,
|
|
|
|
"height", G_TYPE_INT, jpegenc->height,
|
|
|
|
"framerate", GST_TYPE_FRACTION,
|
|
|
|
gst_value_get_fraction_numerator (framerate),
|
|
|
|
gst_value_get_fraction_denominator (framerate), NULL);
|
|
|
|
} else {
|
|
|
|
gst_caps_set_simple (othercaps,
|
|
|
|
"width", G_TYPE_INT, jpegenc->width,
|
|
|
|
"height", G_TYPE_INT, jpegenc->height, NULL);
|
|
|
|
}
|
2003-07-06 20:49:52 +00:00
|
|
|
|
2005-09-08 16:58:40 +00:00
|
|
|
ret = gst_pad_set_caps (jpegenc->srcpad, othercaps);
|
|
|
|
gst_caps_unref (othercaps);
|
ext/gdk_pixbuf/gstgdkpixbuf.c: Fix logic bug causing spurious errors.
Original commit message from CVS:
* ext/gdk_pixbuf/gstgdkpixbuf.c: (gst_gdk_pixbuf_sink_link),
(gst_gdk_pixbuf_chain): Fix logic bug causing spurious errors.
* ext/jpeg/gstjpegdec.c: (gst_jpegdec_base_init),
(gst_jpegdec_init), (gst_jpegdec_chain): Fix negotiation.
* ext/jpeg/gstjpegenc.c: (gst_jpegenc_base_init),
(gst_jpegenc_class_init), (gst_jpegenc_init),
(gst_jpegenc_getcaps), (gst_jpegenc_link), (gst_jpegenc_resync),
(gst_jpegenc_chain), (gst_jpegenc_set_property),
(gst_jpegenc_get_property): Fix negotiation. Add some properties.
* ext/jpeg/gstjpegenc.h: Fix negotiation.
2004-02-11 08:31:35 +00:00
|
|
|
|
2009-02-23 14:48:41 +00:00
|
|
|
if (ret)
|
ext/gdk_pixbuf/gstgdkpixbuf.c: Fix logic bug causing spurious errors.
Original commit message from CVS:
* ext/gdk_pixbuf/gstgdkpixbuf.c: (gst_gdk_pixbuf_sink_link),
(gst_gdk_pixbuf_chain): Fix logic bug causing spurious errors.
* ext/jpeg/gstjpegdec.c: (gst_jpegdec_base_init),
(gst_jpegdec_init), (gst_jpegdec_chain): Fix negotiation.
* ext/jpeg/gstjpegenc.c: (gst_jpegenc_base_init),
(gst_jpegenc_class_init), (gst_jpegenc_init),
(gst_jpegenc_getcaps), (gst_jpegenc_link), (gst_jpegenc_resync),
(gst_jpegenc_chain), (gst_jpegenc_set_property),
(gst_jpegenc_get_property): Fix negotiation. Add some properties.
* ext/jpeg/gstjpegenc.h: Fix negotiation.
2004-02-11 08:31:35 +00:00
|
|
|
gst_jpegenc_resync (jpegenc);
|
|
|
|
|
close #333784 unref the result of gst_pad_get_parent() by: Christophe Fergeau.
Original commit message from CVS:
* ext/cairo/gsttextoverlay.c: (gst_text_overlay_setcaps):
* ext/esd/esdmon.c: (gst_esdmon_get):
* ext/flac/gstflactag.c: (gst_flac_tag_chain):
* ext/gdk_pixbuf/gstgdkpixbuf.c: (gst_gdk_pixbuf_sink_setcaps),
(gst_gdk_pixbuf_sink_getcaps):
* ext/jpeg/gstjpegenc.c: (gst_jpegenc_getcaps),
(gst_jpegenc_setcaps):
* ext/jpeg/gstsmokedec.c: (gst_smokedec_chain):
* ext/jpeg/gstsmokeenc.c: (gst_smokeenc_getcaps),
(gst_smokeenc_setcaps):
* ext/libmng/gstmngdec.c: (gst_mngdec_sinklink),
(gst_mngdec_src_getcaps):
* ext/libmng/gstmngenc.c: (gst_mngenc_sinklink),
(gst_mngenc_chain):
* ext/libpng/gstpngenc.c: (gst_pngenc_setcaps):
* ext/mikmod/gstmikmod.c: (gst_mikmod_srclink):
* ext/speex/gstspeexdec.c: (speex_dec_convert),
(speex_dec_src_event), (speex_dec_chain):
* gst/avi/gstavimux.c: (gst_avimux_vidsinkconnect),
(gst_avimux_audsinkconnect), (gst_avimux_handle_event):
* gst/debug/negotiation.c: (gst_negotiation_getcaps),
(gst_negotiation_pad_link), (gst_negotiation_chain):
* gst/flx/gstflxdec.c: (gst_flxdec_src_query_handler),
(gst_flxdec_chain):
* gst/interleave/deinterleave.c: (deinterleave_sink_link),
(deinterleave_chain):
* gst/law/mulaw-encode.c: (mulawenc_setcaps):
* gst/median/gstmedian.c: (gst_median_link):
* gst/monoscope/gstmonoscope.c: (gst_monoscope_srcconnect),
(gst_monoscope_chain):
* gst/rtp/gstrtpL16pay.c: (gst_rtpL16pay_sinkconnect):
* gst/wavenc/gstwavenc.c: (gst_wavenc_sink_setcaps):
* sys/osxaudio/gstosxaudiosink.c: (gst_osxaudiosink_chain):
* sys/osxaudio/gstosxaudiosrc.c: (gst_osxaudiosrc_get):
close #333784 unref the result of gst_pad_get_parent()
by: Christophe Fergeau.
2006-03-13 15:49:08 +00:00
|
|
|
gst_object_unref (jpegenc);
|
|
|
|
|
ext/gdk_pixbuf/gstgdkpixbuf.c: Fix logic bug causing spurious errors.
Original commit message from CVS:
* ext/gdk_pixbuf/gstgdkpixbuf.c: (gst_gdk_pixbuf_sink_link),
(gst_gdk_pixbuf_chain): Fix logic bug causing spurious errors.
* ext/jpeg/gstjpegdec.c: (gst_jpegdec_base_init),
(gst_jpegdec_init), (gst_jpegdec_chain): Fix negotiation.
* ext/jpeg/gstjpegenc.c: (gst_jpegenc_base_init),
(gst_jpegenc_class_init), (gst_jpegenc_init),
(gst_jpegenc_getcaps), (gst_jpegenc_link), (gst_jpegenc_resync),
(gst_jpegenc_chain), (gst_jpegenc_set_property),
(gst_jpegenc_get_property): Fix negotiation. Add some properties.
* ext/jpeg/gstjpegenc.h: Fix negotiation.
2004-02-11 08:31:35 +00:00
|
|
|
return ret;
|
2003-07-06 20:49:52 +00:00
|
|
|
}
|
|
|
|
|
2001-12-23 15:24:07 +00:00
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_jpegenc_resync (GstJpegEnc * jpegenc)
|
2001-12-23 15:24:07 +00:00
|
|
|
{
|
|
|
|
gint width, height;
|
|
|
|
|
2005-11-28 16:54:03 +00:00
|
|
|
GST_DEBUG_OBJECT (jpegenc, "resync");
|
2001-12-23 15:24:07 +00:00
|
|
|
|
|
|
|
jpegenc->cinfo.image_width = width = jpegenc->width;
|
|
|
|
jpegenc->cinfo.image_height = height = jpegenc->height;
|
|
|
|
jpegenc->cinfo.input_components = 3;
|
|
|
|
|
2005-11-28 16:54:03 +00:00
|
|
|
GST_DEBUG_OBJECT (jpegenc, "width %d, height %d", width, height);
|
2001-12-23 15:24:07 +00:00
|
|
|
|
2009-07-21 07:04:36 +00:00
|
|
|
#if ENABLE_COLORSPACE_RGB
|
2001-12-23 15:24:07 +00:00
|
|
|
switch (jpegenc->format) {
|
|
|
|
case GST_COLORSPACE_RGB24:
|
2005-02-18 10:38:34 +00:00
|
|
|
jpegenc->bufsize = jpegenc->width * jpegenc->height * 3;
|
2003-06-29 19:46:12 +00:00
|
|
|
GST_DEBUG ("gst_jpegenc_resync: setting format to RGB24");
|
2001-12-23 15:24:07 +00:00
|
|
|
jpegenc->cinfo.in_color_space = JCS_RGB;
|
|
|
|
jpegenc->cinfo.raw_data_in = FALSE;
|
|
|
|
break;
|
|
|
|
case GST_COLORSPACE_YUV420P:
|
ext/gdk_pixbuf/gstgdkpixbuf.c: Fix logic bug causing spurious errors.
Original commit message from CVS:
* ext/gdk_pixbuf/gstgdkpixbuf.c: (gst_gdk_pixbuf_sink_link),
(gst_gdk_pixbuf_chain): Fix logic bug causing spurious errors.
* ext/jpeg/gstjpegdec.c: (gst_jpegdec_base_init),
(gst_jpegdec_init), (gst_jpegdec_chain): Fix negotiation.
* ext/jpeg/gstjpegenc.c: (gst_jpegenc_base_init),
(gst_jpegenc_class_init), (gst_jpegenc_init),
(gst_jpegenc_getcaps), (gst_jpegenc_link), (gst_jpegenc_resync),
(gst_jpegenc_chain), (gst_jpegenc_set_property),
(gst_jpegenc_get_property): Fix negotiation. Add some properties.
* ext/jpeg/gstjpegenc.h: Fix negotiation.
2004-02-11 08:31:35 +00:00
|
|
|
#endif
|
2009-05-05 14:24:16 +00:00
|
|
|
GST_DEBUG_OBJECT (jpegenc, "setting format to YUV420P");
|
|
|
|
|
2005-02-18 10:38:34 +00:00
|
|
|
jpegenc->bufsize = I420_SIZE (jpegenc->width, jpegenc->height);
|
2001-12-23 15:24:07 +00:00
|
|
|
jpegenc->cinfo.in_color_space = JCS_YCbCr;
|
2009-05-05 14:24:16 +00:00
|
|
|
|
|
|
|
jpeg_set_defaults (&jpegenc->cinfo);
|
2009-11-24 13:51:21 +00:00
|
|
|
/* these are set in _chain()
|
2009-07-21 07:04:36 +00:00
|
|
|
jpeg_set_quality (&jpegenc->cinfo, jpegenc->quality, TRUE);
|
|
|
|
jpegenc->cinfo.smoothing_factor = jpegenc->smoothing;
|
|
|
|
jpegenc->cinfo.dct_method = jpegenc->idct_method;
|
|
|
|
*/
|
2009-05-05 14:24:16 +00:00
|
|
|
|
|
|
|
jpegenc->cinfo.raw_data_in = TRUE;
|
2001-12-23 15:24:07 +00:00
|
|
|
|
|
|
|
if (height != -1) {
|
2004-03-15 19:32:27 +00:00
|
|
|
jpegenc->line[0] =
|
|
|
|
g_realloc (jpegenc->line[0], height * sizeof (char *));
|
|
|
|
jpegenc->line[1] =
|
|
|
|
g_realloc (jpegenc->line[1], height * sizeof (char *) / 2);
|
|
|
|
jpegenc->line[2] =
|
|
|
|
g_realloc (jpegenc->line[2], height * sizeof (char *) / 2);
|
2001-12-23 15:24:07 +00:00
|
|
|
}
|
|
|
|
|
2005-11-28 16:54:03 +00:00
|
|
|
GST_DEBUG_OBJECT (jpegenc, "setting format done");
|
2009-07-21 07:04:36 +00:00
|
|
|
#if ENABLE_COLORSPACE_RGB
|
2001-12-23 15:24:07 +00:00
|
|
|
break;
|
|
|
|
default:
|
2004-03-14 22:34:33 +00:00
|
|
|
printf ("gst_jpegenc_resync: unsupported colorspace, using RGB\n");
|
2005-02-18 10:38:34 +00:00
|
|
|
jpegenc->bufsize = jpegenc->width * jpegenc->height * 3;
|
2001-12-23 15:24:07 +00:00
|
|
|
jpegenc->cinfo.in_color_space = JCS_RGB;
|
|
|
|
break;
|
|
|
|
}
|
ext/gdk_pixbuf/gstgdkpixbuf.c: Fix logic bug causing spurious errors.
Original commit message from CVS:
* ext/gdk_pixbuf/gstgdkpixbuf.c: (gst_gdk_pixbuf_sink_link),
(gst_gdk_pixbuf_chain): Fix logic bug causing spurious errors.
* ext/jpeg/gstjpegdec.c: (gst_jpegdec_base_init),
(gst_jpegdec_init), (gst_jpegdec_chain): Fix negotiation.
* ext/jpeg/gstjpegenc.c: (gst_jpegenc_base_init),
(gst_jpegenc_class_init), (gst_jpegenc_init),
(gst_jpegenc_getcaps), (gst_jpegenc_link), (gst_jpegenc_resync),
(gst_jpegenc_chain), (gst_jpegenc_set_property),
(gst_jpegenc_get_property): Fix negotiation. Add some properties.
* ext/jpeg/gstjpegenc.h: Fix negotiation.
2004-02-11 08:31:35 +00:00
|
|
|
#endif
|
2001-12-23 15:24:07 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
jpeg_suppress_tables (&jpegenc->cinfo, TRUE);
|
2001-12-23 15:24:07 +00:00
|
|
|
|
2005-11-28 16:54:03 +00:00
|
|
|
GST_DEBUG_OBJECT (jpegenc, "resync done");
|
2001-12-23 15:24:07 +00:00
|
|
|
}
|
|
|
|
|
2005-09-08 16:58:40 +00:00
|
|
|
static GstFlowReturn
|
|
|
|
gst_jpegenc_chain (GstPad * pad, GstBuffer * buf)
|
2001-12-23 15:24:07 +00:00
|
|
|
{
|
2005-11-28 16:54:03 +00:00
|
|
|
GstFlowReturn ret;
|
2001-12-23 15:24:07 +00:00
|
|
|
GstJpegEnc *jpegenc;
|
2005-11-28 16:54:03 +00:00
|
|
|
guchar *data;
|
|
|
|
gulong size;
|
2001-12-23 15:24:07 +00:00
|
|
|
GstBuffer *outbuf;
|
2005-02-18 10:38:34 +00:00
|
|
|
guint height, width;
|
2006-03-24 09:54:00 +00:00
|
|
|
guchar *base[3], *end[3];
|
2004-03-14 22:34:33 +00:00
|
|
|
gint i, j, k;
|
2001-12-23 15:24:07 +00:00
|
|
|
|
|
|
|
jpegenc = GST_JPEGENC (GST_OBJECT_PARENT (pad));
|
|
|
|
|
2009-02-19 20:14:10 +00:00
|
|
|
if (G_UNLIKELY (jpegenc->width <= 0 || jpegenc->height <= 0))
|
|
|
|
goto not_negotiated;
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
data = GST_BUFFER_DATA (buf);
|
|
|
|
size = GST_BUFFER_SIZE (buf);
|
2001-12-23 15:24:07 +00:00
|
|
|
|
2009-07-21 07:04:36 +00:00
|
|
|
GST_LOG_OBJECT (jpegenc, "got buffer of %lu bytes", size);
|
2005-11-28 16:54:03 +00:00
|
|
|
|
2005-12-05 13:03:00 +00:00
|
|
|
ret =
|
|
|
|
gst_pad_alloc_buffer_and_set_caps (jpegenc->srcpad,
|
|
|
|
GST_BUFFER_OFFSET_NONE, jpegenc->bufsize, GST_PAD_CAPS (jpegenc->srcpad),
|
|
|
|
&outbuf);
|
2005-11-28 16:54:03 +00:00
|
|
|
|
|
|
|
if (ret != GST_FLOW_OK)
|
|
|
|
goto done;
|
2001-12-23 15:24:07 +00:00
|
|
|
|
2007-07-11 22:31:06 +00:00
|
|
|
gst_buffer_copy_metadata (outbuf, buf, GST_BUFFER_COPY_TIMESTAMPS);
|
2001-12-23 15:24:07 +00:00
|
|
|
|
|
|
|
width = jpegenc->width;
|
|
|
|
height = jpegenc->height;
|
|
|
|
|
2005-02-18 10:38:34 +00:00
|
|
|
base[0] = data + I420_Y_OFFSET (width, height);
|
|
|
|
base[1] = data + I420_U_OFFSET (width, height);
|
|
|
|
base[2] = data + I420_V_OFFSET (width, height);
|
2001-12-23 15:24:07 +00:00
|
|
|
|
2006-03-24 09:54:00 +00:00
|
|
|
end[0] = base[0] + height * I420_Y_ROWSTRIDE (width);
|
|
|
|
end[1] = base[1] + (height / 2) * I420_U_ROWSTRIDE (width);
|
|
|
|
end[2] = base[2] + (height / 2) * I420_V_ROWSTRIDE (width);
|
|
|
|
|
2005-11-28 16:54:03 +00:00
|
|
|
jpegenc->jdest.next_output_byte = GST_BUFFER_DATA (outbuf);
|
|
|
|
jpegenc->jdest.free_in_buffer = GST_BUFFER_SIZE (outbuf);
|
2001-12-23 15:24:07 +00:00
|
|
|
|
2009-07-24 07:47:44 +00:00
|
|
|
/* prepare for raw input */
|
|
|
|
#if JPEG_LIB_VERSION >= 70
|
|
|
|
jpegenc->cinfo.do_fancy_downsampling = FALSE;
|
|
|
|
#endif
|
ext/gdk_pixbuf/gstgdkpixbuf.c: Fix logic bug causing spurious errors.
Original commit message from CVS:
* ext/gdk_pixbuf/gstgdkpixbuf.c: (gst_gdk_pixbuf_sink_link),
(gst_gdk_pixbuf_chain): Fix logic bug causing spurious errors.
* ext/jpeg/gstjpegdec.c: (gst_jpegdec_base_init),
(gst_jpegdec_init), (gst_jpegdec_chain): Fix negotiation.
* ext/jpeg/gstjpegenc.c: (gst_jpegenc_base_init),
(gst_jpegenc_class_init), (gst_jpegenc_init),
(gst_jpegenc_getcaps), (gst_jpegenc_link), (gst_jpegenc_resync),
(gst_jpegenc_chain), (gst_jpegenc_set_property),
(gst_jpegenc_get_property): Fix negotiation. Add some properties.
* ext/jpeg/gstjpegenc.h: Fix negotiation.
2004-02-11 08:31:35 +00:00
|
|
|
jpegenc->cinfo.smoothing_factor = jpegenc->smoothing;
|
2009-07-21 07:04:36 +00:00
|
|
|
jpegenc->cinfo.dct_method = jpegenc->idct_method;
|
2004-03-14 22:34:33 +00:00
|
|
|
jpeg_set_quality (&jpegenc->cinfo, jpegenc->quality, TRUE);
|
|
|
|
jpeg_start_compress (&jpegenc->cinfo, TRUE);
|
2001-12-23 15:24:07 +00:00
|
|
|
|
2009-07-21 07:04:36 +00:00
|
|
|
GST_LOG_OBJECT (jpegenc, "compressing");
|
2001-12-23 15:24:07 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
for (i = 0; i < height; i += 2 * DCTSIZE) {
|
2005-02-18 10:38:34 +00:00
|
|
|
/*g_print ("next scanline: %d\n", jpegenc->cinfo.next_scanline); */
|
|
|
|
for (j = 0, k = 0; j < (2 * DCTSIZE); j += 2, k++) {
|
2004-03-14 22:34:33 +00:00
|
|
|
jpegenc->line[0][j] = base[0];
|
2006-03-24 09:54:00 +00:00
|
|
|
if (base[0] + I420_Y_ROWSTRIDE (width) < end[0])
|
|
|
|
base[0] += I420_Y_ROWSTRIDE (width);
|
2004-03-14 22:34:33 +00:00
|
|
|
jpegenc->line[0][j + 1] = base[0];
|
2006-03-24 09:54:00 +00:00
|
|
|
if (base[0] + I420_Y_ROWSTRIDE (width) < end[0])
|
|
|
|
base[0] += I420_Y_ROWSTRIDE (width);
|
2004-03-14 22:34:33 +00:00
|
|
|
jpegenc->line[1][k] = base[1];
|
2006-03-24 09:54:00 +00:00
|
|
|
if (base[1] + I420_U_ROWSTRIDE (width) < end[1])
|
|
|
|
base[1] += I420_U_ROWSTRIDE (width);
|
2004-03-14 22:34:33 +00:00
|
|
|
jpegenc->line[2][k] = base[2];
|
2006-03-24 09:54:00 +00:00
|
|
|
if (base[2] + I420_V_ROWSTRIDE (width) < end[2])
|
|
|
|
base[2] += I420_V_ROWSTRIDE (width);
|
2001-12-23 15:24:07 +00:00
|
|
|
}
|
2004-03-14 22:34:33 +00:00
|
|
|
jpeg_write_raw_data (&jpegenc->cinfo, jpegenc->line, 2 * DCTSIZE);
|
2001-12-23 15:24:07 +00:00
|
|
|
}
|
2005-02-18 10:38:34 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
jpeg_finish_compress (&jpegenc->cinfo);
|
2009-07-21 07:04:36 +00:00
|
|
|
GST_LOG_OBJECT (jpegenc, "compressing done");
|
2001-12-23 15:24:07 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
GST_BUFFER_SIZE (outbuf) =
|
2005-11-28 16:54:03 +00:00
|
|
|
GST_ROUND_UP_4 (jpegenc->bufsize - jpegenc->jdest.free_in_buffer);
|
2001-12-23 15:24:07 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
g_signal_emit (G_OBJECT (jpegenc), gst_jpegenc_signals[FRAME_ENCODED], 0);
|
2001-12-23 15:24:07 +00:00
|
|
|
|
2005-11-28 16:54:03 +00:00
|
|
|
ret = gst_pad_push (jpegenc->srcpad, outbuf);
|
|
|
|
|
|
|
|
done:
|
|
|
|
gst_buffer_unref (buf);
|
2005-09-08 16:58:40 +00:00
|
|
|
|
2005-11-28 16:54:03 +00:00
|
|
|
return ret;
|
2009-02-19 20:14:10 +00:00
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
not_negotiated:
|
|
|
|
{
|
|
|
|
GST_WARNING_OBJECT (jpegenc, "no input format set (no caps on buffer)");
|
|
|
|
ret = GST_FLOW_NOT_NEGOTIATED;
|
|
|
|
goto done;
|
|
|
|
}
|
2001-12-23 15:24:07 +00:00
|
|
|
}
|
ext/gdk_pixbuf/gstgdkpixbuf.c: Fix logic bug causing spurious errors.
Original commit message from CVS:
* ext/gdk_pixbuf/gstgdkpixbuf.c: (gst_gdk_pixbuf_sink_link),
(gst_gdk_pixbuf_chain): Fix logic bug causing spurious errors.
* ext/jpeg/gstjpegdec.c: (gst_jpegdec_base_init),
(gst_jpegdec_init), (gst_jpegdec_chain): Fix negotiation.
* ext/jpeg/gstjpegenc.c: (gst_jpegenc_base_init),
(gst_jpegenc_class_init), (gst_jpegenc_init),
(gst_jpegenc_getcaps), (gst_jpegenc_link), (gst_jpegenc_resync),
(gst_jpegenc_chain), (gst_jpegenc_set_property),
(gst_jpegenc_get_property): Fix negotiation. Add some properties.
* ext/jpeg/gstjpegenc.h: Fix negotiation.
2004-02-11 08:31:35 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
gst_jpegenc_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
2005-11-28 16:54:03 +00:00
|
|
|
GstJpegEnc *jpegenc = GST_JPEGENC (object);
|
ext/gdk_pixbuf/gstgdkpixbuf.c: Fix logic bug causing spurious errors.
Original commit message from CVS:
* ext/gdk_pixbuf/gstgdkpixbuf.c: (gst_gdk_pixbuf_sink_link),
(gst_gdk_pixbuf_chain): Fix logic bug causing spurious errors.
* ext/jpeg/gstjpegdec.c: (gst_jpegdec_base_init),
(gst_jpegdec_init), (gst_jpegdec_chain): Fix negotiation.
* ext/jpeg/gstjpegenc.c: (gst_jpegenc_base_init),
(gst_jpegenc_class_init), (gst_jpegenc_init),
(gst_jpegenc_getcaps), (gst_jpegenc_link), (gst_jpegenc_resync),
(gst_jpegenc_chain), (gst_jpegenc_set_property),
(gst_jpegenc_get_property): Fix negotiation. Add some properties.
* ext/jpeg/gstjpegenc.h: Fix negotiation.
2004-02-11 08:31:35 +00:00
|
|
|
|
2005-11-28 16:54:03 +00:00
|
|
|
GST_OBJECT_LOCK (jpegenc);
|
2004-03-14 22:34:33 +00:00
|
|
|
|
ext/gdk_pixbuf/gstgdkpixbuf.c: Fix logic bug causing spurious errors.
Original commit message from CVS:
* ext/gdk_pixbuf/gstgdkpixbuf.c: (gst_gdk_pixbuf_sink_link),
(gst_gdk_pixbuf_chain): Fix logic bug causing spurious errors.
* ext/jpeg/gstjpegdec.c: (gst_jpegdec_base_init),
(gst_jpegdec_init), (gst_jpegdec_chain): Fix negotiation.
* ext/jpeg/gstjpegenc.c: (gst_jpegenc_base_init),
(gst_jpegenc_class_init), (gst_jpegenc_init),
(gst_jpegenc_getcaps), (gst_jpegenc_link), (gst_jpegenc_resync),
(gst_jpegenc_chain), (gst_jpegenc_set_property),
(gst_jpegenc_get_property): Fix negotiation. Add some properties.
* ext/jpeg/gstjpegenc.h: Fix negotiation.
2004-02-11 08:31:35 +00:00
|
|
|
switch (prop_id) {
|
2009-07-21 07:04:36 +00:00
|
|
|
case PROP_QUALITY:
|
ext/gdk_pixbuf/gstgdkpixbuf.c: Fix logic bug causing spurious errors.
Original commit message from CVS:
* ext/gdk_pixbuf/gstgdkpixbuf.c: (gst_gdk_pixbuf_sink_link),
(gst_gdk_pixbuf_chain): Fix logic bug causing spurious errors.
* ext/jpeg/gstjpegdec.c: (gst_jpegdec_base_init),
(gst_jpegdec_init), (gst_jpegdec_chain): Fix negotiation.
* ext/jpeg/gstjpegenc.c: (gst_jpegenc_base_init),
(gst_jpegenc_class_init), (gst_jpegenc_init),
(gst_jpegenc_getcaps), (gst_jpegenc_link), (gst_jpegenc_resync),
(gst_jpegenc_chain), (gst_jpegenc_set_property),
(gst_jpegenc_get_property): Fix negotiation. Add some properties.
* ext/jpeg/gstjpegenc.h: Fix negotiation.
2004-02-11 08:31:35 +00:00
|
|
|
jpegenc->quality = g_value_get_int (value);
|
|
|
|
break;
|
2009-07-21 07:04:36 +00:00
|
|
|
#if ENABLE_SMOOTHING
|
|
|
|
case PROP_SMOOTHING:
|
ext/gdk_pixbuf/gstgdkpixbuf.c: Fix logic bug causing spurious errors.
Original commit message from CVS:
* ext/gdk_pixbuf/gstgdkpixbuf.c: (gst_gdk_pixbuf_sink_link),
(gst_gdk_pixbuf_chain): Fix logic bug causing spurious errors.
* ext/jpeg/gstjpegdec.c: (gst_jpegdec_base_init),
(gst_jpegdec_init), (gst_jpegdec_chain): Fix negotiation.
* ext/jpeg/gstjpegenc.c: (gst_jpegenc_base_init),
(gst_jpegenc_class_init), (gst_jpegenc_init),
(gst_jpegenc_getcaps), (gst_jpegenc_link), (gst_jpegenc_resync),
(gst_jpegenc_chain), (gst_jpegenc_set_property),
(gst_jpegenc_get_property): Fix negotiation. Add some properties.
* ext/jpeg/gstjpegenc.h: Fix negotiation.
2004-02-11 08:31:35 +00:00
|
|
|
jpegenc->smoothing = g_value_get_int (value);
|
|
|
|
break;
|
2009-07-21 07:04:36 +00:00
|
|
|
#endif
|
|
|
|
case PROP_IDCT_METHOD:
|
|
|
|
jpegenc->idct_method = g_value_get_enum (value);
|
|
|
|
break;
|
ext/gdk_pixbuf/gstgdkpixbuf.c: Fix logic bug causing spurious errors.
Original commit message from CVS:
* ext/gdk_pixbuf/gstgdkpixbuf.c: (gst_gdk_pixbuf_sink_link),
(gst_gdk_pixbuf_chain): Fix logic bug causing spurious errors.
* ext/jpeg/gstjpegdec.c: (gst_jpegdec_base_init),
(gst_jpegdec_init), (gst_jpegdec_chain): Fix negotiation.
* ext/jpeg/gstjpegenc.c: (gst_jpegenc_base_init),
(gst_jpegenc_class_init), (gst_jpegenc_init),
(gst_jpegenc_getcaps), (gst_jpegenc_link), (gst_jpegenc_resync),
(gst_jpegenc_chain), (gst_jpegenc_set_property),
(gst_jpegenc_get_property): Fix negotiation. Add some properties.
* ext/jpeg/gstjpegenc.h: Fix negotiation.
2004-02-11 08:31:35 +00:00
|
|
|
default:
|
2005-11-28 16:54:03 +00:00
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
ext/gdk_pixbuf/gstgdkpixbuf.c: Fix logic bug causing spurious errors.
Original commit message from CVS:
* ext/gdk_pixbuf/gstgdkpixbuf.c: (gst_gdk_pixbuf_sink_link),
(gst_gdk_pixbuf_chain): Fix logic bug causing spurious errors.
* ext/jpeg/gstjpegdec.c: (gst_jpegdec_base_init),
(gst_jpegdec_init), (gst_jpegdec_chain): Fix negotiation.
* ext/jpeg/gstjpegenc.c: (gst_jpegenc_base_init),
(gst_jpegenc_class_init), (gst_jpegenc_init),
(gst_jpegenc_getcaps), (gst_jpegenc_link), (gst_jpegenc_resync),
(gst_jpegenc_chain), (gst_jpegenc_set_property),
(gst_jpegenc_get_property): Fix negotiation. Add some properties.
* ext/jpeg/gstjpegenc.h: Fix negotiation.
2004-02-11 08:31:35 +00:00
|
|
|
break;
|
|
|
|
}
|
2005-11-28 16:54:03 +00:00
|
|
|
|
|
|
|
GST_OBJECT_UNLOCK (jpegenc);
|
2004-03-14 22:34:33 +00:00
|
|
|
}
|
ext/gdk_pixbuf/gstgdkpixbuf.c: Fix logic bug causing spurious errors.
Original commit message from CVS:
* ext/gdk_pixbuf/gstgdkpixbuf.c: (gst_gdk_pixbuf_sink_link),
(gst_gdk_pixbuf_chain): Fix logic bug causing spurious errors.
* ext/jpeg/gstjpegdec.c: (gst_jpegdec_base_init),
(gst_jpegdec_init), (gst_jpegdec_chain): Fix negotiation.
* ext/jpeg/gstjpegenc.c: (gst_jpegenc_base_init),
(gst_jpegenc_class_init), (gst_jpegenc_init),
(gst_jpegenc_getcaps), (gst_jpegenc_link), (gst_jpegenc_resync),
(gst_jpegenc_chain), (gst_jpegenc_set_property),
(gst_jpegenc_get_property): Fix negotiation. Add some properties.
* ext/jpeg/gstjpegenc.h: Fix negotiation.
2004-02-11 08:31:35 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
gst_jpegenc_get_property (GObject * object, guint prop_id, GValue * value,
|
|
|
|
GParamSpec * pspec)
|
|
|
|
{
|
2005-11-28 16:54:03 +00:00
|
|
|
GstJpegEnc *jpegenc = GST_JPEGENC (object);
|
ext/gdk_pixbuf/gstgdkpixbuf.c: Fix logic bug causing spurious errors.
Original commit message from CVS:
* ext/gdk_pixbuf/gstgdkpixbuf.c: (gst_gdk_pixbuf_sink_link),
(gst_gdk_pixbuf_chain): Fix logic bug causing spurious errors.
* ext/jpeg/gstjpegdec.c: (gst_jpegdec_base_init),
(gst_jpegdec_init), (gst_jpegdec_chain): Fix negotiation.
* ext/jpeg/gstjpegenc.c: (gst_jpegenc_base_init),
(gst_jpegenc_class_init), (gst_jpegenc_init),
(gst_jpegenc_getcaps), (gst_jpegenc_link), (gst_jpegenc_resync),
(gst_jpegenc_chain), (gst_jpegenc_set_property),
(gst_jpegenc_get_property): Fix negotiation. Add some properties.
* ext/jpeg/gstjpegenc.h: Fix negotiation.
2004-02-11 08:31:35 +00:00
|
|
|
|
2005-11-28 16:54:03 +00:00
|
|
|
GST_OBJECT_LOCK (jpegenc);
|
ext/gdk_pixbuf/gstgdkpixbuf.c: Fix logic bug causing spurious errors.
Original commit message from CVS:
* ext/gdk_pixbuf/gstgdkpixbuf.c: (gst_gdk_pixbuf_sink_link),
(gst_gdk_pixbuf_chain): Fix logic bug causing spurious errors.
* ext/jpeg/gstjpegdec.c: (gst_jpegdec_base_init),
(gst_jpegdec_init), (gst_jpegdec_chain): Fix negotiation.
* ext/jpeg/gstjpegenc.c: (gst_jpegenc_base_init),
(gst_jpegenc_class_init), (gst_jpegenc_init),
(gst_jpegenc_getcaps), (gst_jpegenc_link), (gst_jpegenc_resync),
(gst_jpegenc_chain), (gst_jpegenc_set_property),
(gst_jpegenc_get_property): Fix negotiation. Add some properties.
* ext/jpeg/gstjpegenc.h: Fix negotiation.
2004-02-11 08:31:35 +00:00
|
|
|
|
|
|
|
switch (prop_id) {
|
2009-07-21 07:04:36 +00:00
|
|
|
case PROP_QUALITY:
|
ext/gdk_pixbuf/gstgdkpixbuf.c: Fix logic bug causing spurious errors.
Original commit message from CVS:
* ext/gdk_pixbuf/gstgdkpixbuf.c: (gst_gdk_pixbuf_sink_link),
(gst_gdk_pixbuf_chain): Fix logic bug causing spurious errors.
* ext/jpeg/gstjpegdec.c: (gst_jpegdec_base_init),
(gst_jpegdec_init), (gst_jpegdec_chain): Fix negotiation.
* ext/jpeg/gstjpegenc.c: (gst_jpegenc_base_init),
(gst_jpegenc_class_init), (gst_jpegenc_init),
(gst_jpegenc_getcaps), (gst_jpegenc_link), (gst_jpegenc_resync),
(gst_jpegenc_chain), (gst_jpegenc_set_property),
(gst_jpegenc_get_property): Fix negotiation. Add some properties.
* ext/jpeg/gstjpegenc.h: Fix negotiation.
2004-02-11 08:31:35 +00:00
|
|
|
g_value_set_int (value, jpegenc->quality);
|
|
|
|
break;
|
2009-07-21 07:04:36 +00:00
|
|
|
#if ENABLE_SMOOTHING
|
|
|
|
case PROP_SMOOTHING:
|
ext/gdk_pixbuf/gstgdkpixbuf.c: Fix logic bug causing spurious errors.
Original commit message from CVS:
* ext/gdk_pixbuf/gstgdkpixbuf.c: (gst_gdk_pixbuf_sink_link),
(gst_gdk_pixbuf_chain): Fix logic bug causing spurious errors.
* ext/jpeg/gstjpegdec.c: (gst_jpegdec_base_init),
(gst_jpegdec_init), (gst_jpegdec_chain): Fix negotiation.
* ext/jpeg/gstjpegenc.c: (gst_jpegenc_base_init),
(gst_jpegenc_class_init), (gst_jpegenc_init),
(gst_jpegenc_getcaps), (gst_jpegenc_link), (gst_jpegenc_resync),
(gst_jpegenc_chain), (gst_jpegenc_set_property),
(gst_jpegenc_get_property): Fix negotiation. Add some properties.
* ext/jpeg/gstjpegenc.h: Fix negotiation.
2004-02-11 08:31:35 +00:00
|
|
|
g_value_set_int (value, jpegenc->smoothing);
|
|
|
|
break;
|
2009-07-21 07:04:36 +00:00
|
|
|
#endif
|
|
|
|
case PROP_IDCT_METHOD:
|
|
|
|
g_value_set_enum (value, jpegenc->idct_method);
|
|
|
|
break;
|
ext/gdk_pixbuf/gstgdkpixbuf.c: Fix logic bug causing spurious errors.
Original commit message from CVS:
* ext/gdk_pixbuf/gstgdkpixbuf.c: (gst_gdk_pixbuf_sink_link),
(gst_gdk_pixbuf_chain): Fix logic bug causing spurious errors.
* ext/jpeg/gstjpegdec.c: (gst_jpegdec_base_init),
(gst_jpegdec_init), (gst_jpegdec_chain): Fix negotiation.
* ext/jpeg/gstjpegenc.c: (gst_jpegenc_base_init),
(gst_jpegenc_class_init), (gst_jpegenc_init),
(gst_jpegenc_getcaps), (gst_jpegenc_link), (gst_jpegenc_resync),
(gst_jpegenc_chain), (gst_jpegenc_set_property),
(gst_jpegenc_get_property): Fix negotiation. Add some properties.
* ext/jpeg/gstjpegenc.h: Fix negotiation.
2004-02-11 08:31:35 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
2005-11-28 16:54:03 +00:00
|
|
|
|
|
|
|
GST_OBJECT_UNLOCK (jpegenc);
|
ext/gdk_pixbuf/gstgdkpixbuf.c: Fix logic bug causing spurious errors.
Original commit message from CVS:
* ext/gdk_pixbuf/gstgdkpixbuf.c: (gst_gdk_pixbuf_sink_link),
(gst_gdk_pixbuf_chain): Fix logic bug causing spurious errors.
* ext/jpeg/gstjpegdec.c: (gst_jpegdec_base_init),
(gst_jpegdec_init), (gst_jpegdec_chain): Fix negotiation.
* ext/jpeg/gstjpegenc.c: (gst_jpegenc_base_init),
(gst_jpegenc_class_init), (gst_jpegenc_init),
(gst_jpegenc_getcaps), (gst_jpegenc_link), (gst_jpegenc_resync),
(gst_jpegenc_chain), (gst_jpegenc_set_property),
(gst_jpegenc_get_property): Fix negotiation. Add some properties.
* ext/jpeg/gstjpegenc.h: Fix negotiation.
2004-02-11 08:31:35 +00:00
|
|
|
}
|
2005-02-22 12:04:16 +00:00
|
|
|
|
2005-09-02 15:44:50 +00:00
|
|
|
static GstStateChangeReturn
|
|
|
|
gst_jpegenc_change_state (GstElement * element, GstStateChange transition)
|
2005-02-22 12:04:16 +00:00
|
|
|
{
|
2005-11-28 16:54:03 +00:00
|
|
|
GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
|
2005-02-22 12:04:16 +00:00
|
|
|
GstJpegEnc *filter = GST_JPEGENC (element);
|
|
|
|
|
2005-09-02 15:44:50 +00:00
|
|
|
switch (transition) {
|
|
|
|
case GST_STATE_CHANGE_NULL_TO_READY:
|
2005-11-28 16:54:03 +00:00
|
|
|
GST_DEBUG_OBJECT (element, "setting line buffers");
|
2005-02-22 12:04:16 +00:00
|
|
|
filter->line[0] = NULL;
|
|
|
|
filter->line[1] = NULL;
|
|
|
|
filter->line[2] = NULL;
|
|
|
|
break;
|
2005-11-28 16:54:03 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
|
|
|
|
if (ret == GST_STATE_CHANGE_FAILURE)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
switch (transition) {
|
2005-09-02 15:44:50 +00:00
|
|
|
case GST_STATE_CHANGE_READY_TO_NULL:
|
2005-02-22 12:04:16 +00:00
|
|
|
g_free (filter->line[0]);
|
|
|
|
g_free (filter->line[1]);
|
|
|
|
g_free (filter->line[2]);
|
|
|
|
filter->line[0] = NULL;
|
|
|
|
filter->line[1] = NULL;
|
|
|
|
filter->line[2] = NULL;
|
2009-02-19 20:14:10 +00:00
|
|
|
filter->width = -1;
|
|
|
|
filter->height = -1;
|
2005-02-22 12:04:16 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2005-11-28 16:54:03 +00:00
|
|
|
return ret;
|
2005-02-22 12:04:16 +00:00
|
|
|
}
|