2002-03-20 21:45:04 +00:00
|
|
|
/* GStreamer
|
2001-12-22 23:26:33 +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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2003-06-29 19:46:13 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
2004-07-27 21:51:30 +00:00
|
|
|
#include "gstrtjpegdec.h"
|
2001-12-22 23:26:33 +00:00
|
|
|
|
|
|
|
/* GstRTJpegDec signals and args */
|
2004-03-14 22:34:33 +00:00
|
|
|
enum
|
|
|
|
{
|
2001-12-22 23:26:33 +00:00
|
|
|
/* FILL ME */
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
enum
|
|
|
|
{
|
2001-12-22 23:26:33 +00:00
|
|
|
ARG_0,
|
2004-05-21 22:39:30 +00:00
|
|
|
ARG_QUALITY
|
2001-12-22 23:26:33 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static void gst_rtjpegdec_class_init (GstRTJpegDecClass * klass);
|
|
|
|
static void gst_rtjpegdec_base_init (GstRTJpegDecClass * klass);
|
|
|
|
static void gst_rtjpegdec_init (GstRTJpegDec * rtjpegdec);
|
2001-12-22 23:26:33 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static void gst_rtjpegdec_chain (GstPad * pad, GstData * _data);
|
2001-12-22 23:26:33 +00:00
|
|
|
|
|
|
|
static GstElementClass *parent_class = NULL;
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2002-03-19 04:10:06 +00:00
|
|
|
/*static guint gst_rtjpegdec_signals[LAST_SIGNAL] = { 0 }; */
|
2001-12-22 23:26:33 +00:00
|
|
|
|
|
|
|
GType
|
|
|
|
gst_rtjpegdec_get_type (void)
|
|
|
|
{
|
|
|
|
static GType rtjpegdec_type = 0;
|
|
|
|
|
|
|
|
if (!rtjpegdec_type) {
|
|
|
|
static const GTypeInfo rtjpegdec_info = {
|
2004-03-14 22:34:33 +00:00
|
|
|
sizeof (GstRTJpegDecClass),
|
|
|
|
(GBaseInitFunc) gst_rtjpegdec_base_init,
|
2001-12-22 23:26:33 +00:00
|
|
|
NULL,
|
2004-03-14 22:34:33 +00:00
|
|
|
(GClassInitFunc) gst_rtjpegdec_class_init,
|
2001-12-22 23:26:33 +00:00
|
|
|
NULL,
|
|
|
|
NULL,
|
2004-03-14 22:34:33 +00:00
|
|
|
sizeof (GstRTJpegDec),
|
2001-12-22 23:26:33 +00:00
|
|
|
0,
|
2004-03-14 22:34:33 +00:00
|
|
|
(GInstanceInitFunc) gst_rtjpegdec_init,
|
2001-12-22 23:26:33 +00:00
|
|
|
};
|
2004-03-15 19:32:27 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
rtjpegdec_type =
|
2004-03-15 19:32:27 +00:00
|
|
|
g_type_register_static (GST_TYPE_ELEMENT, "GstRTJpegDec",
|
|
|
|
&rtjpegdec_info, 0);
|
2001-12-22 23:26:33 +00:00
|
|
|
}
|
|
|
|
return rtjpegdec_type;
|
|
|
|
}
|
|
|
|
|
2003-11-02 22:11:30 +00:00
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_rtjpegdec_base_init (GstRTJpegDecClass * klass)
|
2003-11-02 22:11:30 +00:00
|
|
|
{
|
|
|
|
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
|
|
|
|
2012-10-17 16:34:26 +00:00
|
|
|
gst_element_class_set_static_metadata (element_class, "RTjpeg video decoder",
|
2010-03-18 16:30:26 +00:00
|
|
|
"Codec/Decoder/Video",
|
|
|
|
"Decodes video in RTjpeg format", "Erik Walthinsen <omega@cse.ogi.edu>");
|
2003-11-02 22:11:30 +00:00
|
|
|
}
|
|
|
|
|
2001-12-22 23:26:33 +00:00
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_rtjpegdec_class_init (GstRTJpegDecClass * klass)
|
2001-12-22 23:26:33 +00:00
|
|
|
{
|
|
|
|
GstElementClass *gstelement_class;
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
gstelement_class = (GstElementClass *) klass;
|
2001-12-22 23:26:33 +00:00
|
|
|
|
2006-04-08 21:48:01 +00:00
|
|
|
parent_class = g_type_class_peek_parent (klass);
|
2001-12-22 23:26:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_rtjpegdec_init (GstRTJpegDec * rtjpegdec)
|
2001-12-22 23:26:33 +00:00
|
|
|
{
|
2004-03-14 22:34:33 +00:00
|
|
|
rtjpegdec->sinkpad = gst_pad_new ("sink", GST_PAD_SINK);
|
|
|
|
gst_element_add_pad (GST_ELEMENT (rtjpegdec), rtjpegdec->sinkpad);
|
|
|
|
gst_pad_set_chain_function (rtjpegdec->sinkpad, gst_rtjpegdec_chain);
|
|
|
|
rtjpegdec->srcpad = gst_pad_new ("src", GST_PAD_SRC);
|
|
|
|
gst_element_add_pad (GST_ELEMENT (rtjpegdec), rtjpegdec->srcpad);
|
2001-12-22 23:26:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_rtjpegdec_chain (GstPad * pad, GstData * _data)
|
2001-12-22 23:26:33 +00:00
|
|
|
{
|
2003-10-08 16:08:19 +00:00
|
|
|
GstBuffer *buf = GST_BUFFER (_data);
|
2001-12-22 23:26:33 +00:00
|
|
|
GstRTJpegDec *rtjpegdec;
|
|
|
|
guchar *data;
|
|
|
|
gulong size;
|
|
|
|
|
|
|
|
g_return_if_fail (pad != NULL);
|
|
|
|
g_return_if_fail (GST_IS_PAD (pad));
|
|
|
|
g_return_if_fail (buf != NULL);
|
|
|
|
|
|
|
|
rtjpegdec = GST_RTJPEGDEC (GST_OBJECT_PARENT (pad));
|
2004-03-14 22:34:33 +00:00
|
|
|
data = GST_BUFFER_DATA (buf);
|
|
|
|
size = GST_BUFFER_SIZE (buf);
|
2001-12-22 23:26:33 +00:00
|
|
|
|
2004-05-03 14:31:47 +00:00
|
|
|
g_warning ("would be encoding frame here\n");
|
2001-12-22 23:26:33 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_pad_push (rtjpegdec->srcpad, GST_DATA (buf));
|
2001-12-22 23:26:33 +00:00
|
|
|
}
|