2002-03-20 21:45:03 +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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include "gstjpegdec.h"
|
|
|
|
#include "gstjpegenc.h"
|
2003-07-06 20:49:52 +00:00
|
|
|
#include <gst/video/video.h>
|
2001-12-23 15:24:07 +00:00
|
|
|
|
|
|
|
/* elementfactory information */
|
|
|
|
extern GstElementDetails gst_jpegdec_details;
|
|
|
|
extern GstElementDetails gst_jpegenc_details;
|
|
|
|
|
|
|
|
GstPadTemplate *jpegdec_src_template, *jpegdec_sink_template;
|
|
|
|
GstPadTemplate *jpegenc_src_template, *jpegenc_sink_template;
|
|
|
|
|
|
|
|
static GstCaps*
|
|
|
|
jpeg_caps_factory (void)
|
|
|
|
{
|
|
|
|
return
|
|
|
|
gst_caps_new (
|
|
|
|
"jpeg_jpeg",
|
2003-07-06 20:49:52 +00:00
|
|
|
"video/x-jpeg",
|
|
|
|
gst_props_new (
|
|
|
|
"width", GST_PROPS_INT_RANGE (16, 4096),
|
|
|
|
"height", GST_PROPS_INT_RANGE (16, 4096),
|
|
|
|
"framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT),
|
|
|
|
NULL));
|
2001-12-23 15:24:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static GstCaps*
|
|
|
|
raw_caps_factory (void)
|
|
|
|
{
|
|
|
|
return
|
|
|
|
gst_caps_new (
|
|
|
|
"jpeg_raw",
|
2003-07-06 20:49:52 +00:00
|
|
|
"video/x-raw-yuv",
|
|
|
|
GST_VIDEO_YUV_PAD_TEMPLATE_PROPS (
|
|
|
|
GST_PROPS_FOURCC (GST_MAKE_FOURCC ('I','4','2','0'))));
|
2001-12-23 15:24:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
plugin_init (GModule *module, GstPlugin *plugin)
|
|
|
|
{
|
|
|
|
GstElementFactory *dec, *enc;
|
|
|
|
GstCaps *raw_caps, *jpeg_caps;
|
|
|
|
|
|
|
|
/* create an elementfactory for the jpegdec element */
|
2002-04-11 20:42:25 +00:00
|
|
|
enc = gst_element_factory_new("jpegenc",GST_TYPE_JPEGENC,
|
2001-12-23 15:24:07 +00:00
|
|
|
&gst_jpegenc_details);
|
|
|
|
g_return_val_if_fail(enc != NULL, FALSE);
|
|
|
|
|
|
|
|
raw_caps = raw_caps_factory ();
|
|
|
|
jpeg_caps = jpeg_caps_factory ();
|
|
|
|
|
|
|
|
/* register sink pads */
|
2002-04-11 20:42:25 +00:00
|
|
|
jpegenc_sink_template = gst_pad_template_new ("sink", GST_PAD_SINK,
|
2001-12-23 15:24:07 +00:00
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
raw_caps, NULL);
|
2002-04-11 20:42:25 +00:00
|
|
|
gst_element_factory_add_pad_template (enc, jpegenc_sink_template);
|
2001-12-23 15:24:07 +00:00
|
|
|
|
|
|
|
/* register src pads */
|
2002-04-11 20:42:25 +00:00
|
|
|
jpegenc_src_template = gst_pad_template_new ("src", GST_PAD_SRC,
|
2001-12-23 15:24:07 +00:00
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
jpeg_caps, NULL);
|
2002-04-11 20:42:25 +00:00
|
|
|
gst_element_factory_add_pad_template (enc, jpegenc_src_template);
|
2001-12-23 15:24:07 +00:00
|
|
|
|
|
|
|
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (enc));
|
|
|
|
|
|
|
|
/* create an elementfactory for the jpegdec element */
|
2002-04-11 20:42:25 +00:00
|
|
|
dec = gst_element_factory_new("jpegdec",GST_TYPE_JPEGDEC,
|
2001-12-23 15:24:07 +00:00
|
|
|
&gst_jpegdec_details);
|
|
|
|
g_return_val_if_fail(dec != NULL, FALSE);
|
2002-05-31 08:24:31 +00:00
|
|
|
gst_element_factory_set_rank (dec, GST_ELEMENT_RANK_PRIMARY);
|
2001-12-23 15:24:07 +00:00
|
|
|
|
|
|
|
/* register sink pads */
|
2002-04-11 20:42:25 +00:00
|
|
|
jpegdec_sink_template = gst_pad_template_new ("sink", GST_PAD_SINK,
|
2001-12-23 15:24:07 +00:00
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
jpeg_caps, NULL);
|
2002-04-11 20:42:25 +00:00
|
|
|
gst_element_factory_add_pad_template (dec, jpegdec_sink_template);
|
2001-12-23 15:24:07 +00:00
|
|
|
|
|
|
|
/* register src pads */
|
2002-04-11 20:42:25 +00:00
|
|
|
jpegdec_src_template = gst_pad_template_new ("src", GST_PAD_SRC,
|
2001-12-23 15:24:07 +00:00
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
raw_caps, NULL);
|
2002-04-11 20:42:25 +00:00
|
|
|
gst_element_factory_add_pad_template (dec, jpegdec_src_template);
|
2001-12-23 15:24:07 +00:00
|
|
|
|
|
|
|
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (dec));
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
GstPluginDesc plugin_desc = {
|
|
|
|
GST_VERSION_MAJOR,
|
|
|
|
GST_VERSION_MINOR,
|
|
|
|
"jpeg",
|
|
|
|
plugin_init
|
|
|
|
};
|