mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 01:30:38 +00:00
292fec2a0b
Original commit message from CVS: New mimetypes gone into effect today - this commit changes all old mimetypes over to the new mimetypes spec as described in the previous commit's document. Note: some plugins will break, some pipelines will break, expect HEAD to be broken or at least not 100% working for a few days, but don't forget to report bugs
113 lines
3.5 KiB
C
113 lines
3.5 KiB
C
/* GStreamer
|
|
* 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"
|
|
#include <gst/video/video.h>
|
|
|
|
/* 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",
|
|
"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));
|
|
}
|
|
|
|
static GstCaps*
|
|
raw_caps_factory (void)
|
|
{
|
|
return
|
|
gst_caps_new (
|
|
"jpeg_raw",
|
|
"video/x-raw-yuv",
|
|
GST_VIDEO_YUV_PAD_TEMPLATE_PROPS (
|
|
GST_PROPS_FOURCC (GST_MAKE_FOURCC ('I','4','2','0'))));
|
|
}
|
|
|
|
static gboolean
|
|
plugin_init (GModule *module, GstPlugin *plugin)
|
|
{
|
|
GstElementFactory *dec, *enc;
|
|
GstCaps *raw_caps, *jpeg_caps;
|
|
|
|
/* create an elementfactory for the jpegdec element */
|
|
enc = gst_element_factory_new("jpegenc",GST_TYPE_JPEGENC,
|
|
&gst_jpegenc_details);
|
|
g_return_val_if_fail(enc != NULL, FALSE);
|
|
|
|
raw_caps = raw_caps_factory ();
|
|
jpeg_caps = jpeg_caps_factory ();
|
|
|
|
/* register sink pads */
|
|
jpegenc_sink_template = gst_pad_template_new ("sink", GST_PAD_SINK,
|
|
GST_PAD_ALWAYS,
|
|
raw_caps, NULL);
|
|
gst_element_factory_add_pad_template (enc, jpegenc_sink_template);
|
|
|
|
/* register src pads */
|
|
jpegenc_src_template = gst_pad_template_new ("src", GST_PAD_SRC,
|
|
GST_PAD_ALWAYS,
|
|
jpeg_caps, NULL);
|
|
gst_element_factory_add_pad_template (enc, jpegenc_src_template);
|
|
|
|
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (enc));
|
|
|
|
/* create an elementfactory for the jpegdec element */
|
|
dec = gst_element_factory_new("jpegdec",GST_TYPE_JPEGDEC,
|
|
&gst_jpegdec_details);
|
|
g_return_val_if_fail(dec != NULL, FALSE);
|
|
gst_element_factory_set_rank (dec, GST_ELEMENT_RANK_PRIMARY);
|
|
|
|
/* register sink pads */
|
|
jpegdec_sink_template = gst_pad_template_new ("sink", GST_PAD_SINK,
|
|
GST_PAD_ALWAYS,
|
|
jpeg_caps, NULL);
|
|
gst_element_factory_add_pad_template (dec, jpegdec_sink_template);
|
|
|
|
/* register src pads */
|
|
jpegdec_src_template = gst_pad_template_new ("src", GST_PAD_SRC,
|
|
GST_PAD_ALWAYS,
|
|
raw_caps, NULL);
|
|
gst_element_factory_add_pad_template (dec, jpegdec_src_template);
|
|
|
|
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (dec));
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
GstPluginDesc plugin_desc = {
|
|
GST_VERSION_MAJOR,
|
|
GST_VERSION_MINOR,
|
|
"jpeg",
|
|
plugin_init
|
|
};
|