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
|
2012-11-03 20:38:00 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
2001-12-22 23:26:33 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
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 "gstrtjpegenc.h"
|
2001-12-22 23:26:33 +00:00
|
|
|
|
|
|
|
/* GstRTJpegEnc 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_rtjpegenc_class_init (GstRTJpegEncClass * klass);
|
|
|
|
static void gst_rtjpegenc_base_init (GstRTJpegEncClass * klass);
|
|
|
|
static void gst_rtjpegenc_init (GstRTJpegEnc * rtjpegenc);
|
2001-12-22 23:26:33 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static void gst_rtjpegenc_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_rtjpegenc_signals[LAST_SIGNAL] = { 0 }; */
|
2001-12-22 23:26:33 +00:00
|
|
|
|
|
|
|
GType
|
|
|
|
gst_rtjpegenc_get_type (void)
|
|
|
|
{
|
|
|
|
static GType rtjpegenc_type = 0;
|
|
|
|
|
|
|
|
if (!rtjpegenc_type) {
|
|
|
|
static const GTypeInfo rtjpegenc_info = {
|
2004-03-14 22:34:33 +00:00
|
|
|
sizeof (GstRTJpegEncClass),
|
|
|
|
(GBaseInitFunc) gst_rtjpegenc_base_init,
|
2001-12-22 23:26:33 +00:00
|
|
|
NULL,
|
2004-03-14 22:34:33 +00:00
|
|
|
(GClassInitFunc) gst_rtjpegenc_class_init,
|
2001-12-22 23:26:33 +00:00
|
|
|
NULL,
|
|
|
|
NULL,
|
2004-03-14 22:34:33 +00:00
|
|
|
sizeof (GstRTJpegEnc),
|
2001-12-22 23:26:33 +00:00
|
|
|
0,
|
2004-03-14 22:34:33 +00:00
|
|
|
(GInstanceInitFunc) gst_rtjpegenc_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
|
|
|
rtjpegenc_type =
|
2004-03-15 19:32:27 +00:00
|
|
|
g_type_register_static (GST_TYPE_ELEMENT, "GstRTJpegEnc",
|
|
|
|
&rtjpegenc_info, 0);
|
2001-12-22 23:26:33 +00:00
|
|
|
}
|
|
|
|
return rtjpegenc_type;
|
|
|
|
}
|
|
|
|
|
2003-11-02 22:11:30 +00:00
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_rtjpegenc_base_init (GstRTJpegEncClass * 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 encoder",
|
2010-03-18 16:30:26 +00:00
|
|
|
"Codec/Encoder/Video",
|
|
|
|
"Encodes 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_rtjpegenc_class_init (GstRTJpegEncClass * 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_rtjpegenc_init (GstRTJpegEnc * rtjpegenc)
|
2001-12-22 23:26:33 +00:00
|
|
|
{
|
2004-03-14 22:34:33 +00:00
|
|
|
rtjpegenc->sinkpad = gst_pad_new ("sink", GST_PAD_SINK);
|
|
|
|
gst_element_add_pad (GST_ELEMENT (rtjpegenc), rtjpegenc->sinkpad);
|
|
|
|
gst_pad_set_chain_function (rtjpegenc->sinkpad, gst_rtjpegenc_chain);
|
|
|
|
rtjpegenc->srcpad = gst_pad_new ("src", GST_PAD_SRC);
|
|
|
|
gst_element_add_pad (GST_ELEMENT (rtjpegenc), rtjpegenc->srcpad);
|
2001-12-22 23:26:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_rtjpegenc_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
|
|
|
GstRTJpegEnc *rtjpegenc;
|
|
|
|
guchar *data;
|
|
|
|
gulong size;
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
g_return_if_fail (pad != NULL);
|
|
|
|
g_return_if_fail (GST_IS_PAD (pad));
|
|
|
|
g_return_if_fail (buf != NULL);
|
2001-12-22 23:26:33 +00:00
|
|
|
|
|
|
|
rtjpegenc = GST_RTJPEGENC (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 (rtjpegenc->srcpad, GST_DATA (buf));
|
2001-12-22 23:26:33 +00:00
|
|
|
}
|