mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 22:36:33 +00:00
forward port from 0.9 and enable videoflip now that it works
Original commit message from CVS: forward port from 0.9 and enable videoflip now that it works
This commit is contained in:
parent
9cb331788c
commit
6c3ff34ee0
7 changed files with 83 additions and 69 deletions
16
ChangeLog
16
ChangeLog
|
@ -1,3 +1,19 @@
|
|||
2005-07-25 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||
|
||||
* gst/videofilter/Makefile.am:
|
||||
* gst/videofilter/gstgamma.c: (gst_gamma_setup):
|
||||
* gst/videofilter/gstvideobalance.c: (gst_videobalance_setup):
|
||||
* gst/videofilter/gstvideofilter.c: (gst_videofilter_class_init),
|
||||
(gst_videofilter_getcaps), (gst_videofilter_setcaps),
|
||||
(gst_videofilter_init), (gst_videofilter_chain),
|
||||
(gst_videofilter_set_property), (gst_videofilter_get_property),
|
||||
(gst_videofilter_setup), (gst_videofilter_class_add_pad_templates):
|
||||
* gst/videofilter/gstvideofilter.h:
|
||||
* gst/videofilter/gstvideoflip.c: (gst_videoflip_init),
|
||||
(gst_videoflip_set_property), (gst_videoflip_get_property),
|
||||
(plugin_init), (gst_videoflip_setup), (gst_videoflip_planar411):
|
||||
forward port from 0.9 and enable videoflip now that it works
|
||||
|
||||
2005-07-23 Edward Hervey <edward@fluendo.com>
|
||||
|
||||
* configure.ac:
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
lib_LTLIBRARIES = libgstvideofilter-@GST_MAJORMINOR@.la
|
||||
noinst_LTLIBRARIES = libgstvideoexample.la
|
||||
plugin_LTLIBRARIES = libgstvideoflip.la
|
||||
|
||||
noinst_HEADERS = gstvideofilter.h
|
||||
|
||||
|
@ -16,10 +16,10 @@ libgstvideoexample_la_CFLAGS = $(GST_CFLAGS)
|
|||
libgstvideoexample_la_LIBADD = libgstvideofilter-@GST_MAJORMINOR@.la
|
||||
libgstvideoexample_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
|
||||
|
||||
# libgstvideoflip_la_SOURCES = gstvideoflip.c
|
||||
# libgstvideoflip_la_CFLAGS = $(GST_CFLAGS)
|
||||
# libgstvideoflip_la_LIBADD =
|
||||
# libgstvideoflip_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
|
||||
libgstvideoflip_la_SOURCES = gstvideoflip.c
|
||||
libgstvideoflip_la_CFLAGS = $(GST_CFLAGS)
|
||||
libgstvideoflip_la_LIBADD = libgstvideofilter-@GST_MAJORMINOR@.la
|
||||
libgstvideoflip_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
|
||||
|
||||
# libgstvideobalance_la_SOURCES = gstvideobalance.c
|
||||
# libgstvideobalance_la_CFLAGS = $(GST_CFLAGS) $(LIBOIL_CFLAGS)
|
||||
|
|
|
@ -274,10 +274,11 @@ GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
|||
GST_VERSION_MINOR,
|
||||
"gamma",
|
||||
"Changes gamma on video images",
|
||||
plugin_init, VERSION, GST_LICENSE, GST_PACKAGE, GST_ORIGIN)
|
||||
plugin_init, VERSION, GST_LICENSE, GST_PACKAGE, GST_ORIGIN);
|
||||
|
||||
|
||||
static void gst_gamma_setup (GstVideofilter * videofilter)
|
||||
static void
|
||||
gst_gamma_setup (GstVideofilter * videofilter)
|
||||
{
|
||||
GstGamma *gamma;
|
||||
|
||||
|
|
|
@ -437,9 +437,10 @@ GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
|||
GST_VERSION_MINOR,
|
||||
"videobalance",
|
||||
"Changes hue, saturation, brightness etc. on video images",
|
||||
plugin_init, VERSION, GST_LICENSE, GST_PACKAGE, GST_ORIGIN)
|
||||
plugin_init, VERSION, GST_LICENSE, GST_PACKAGE, GST_ORIGIN);
|
||||
|
||||
static void gst_videobalance_setup (GstVideofilter * videofilter)
|
||||
static void
|
||||
gst_videobalance_setup (GstVideofilter * videofilter)
|
||||
{
|
||||
GstVideobalance *videobalance;
|
||||
|
||||
|
|
|
@ -26,7 +26,8 @@
|
|||
/*#define DEBUG_ENABLED */
|
||||
#include "gstvideofilter.h"
|
||||
|
||||
|
||||
GST_DEBUG_CATEGORY_STATIC (gst_videofilter_debug);
|
||||
#define GST_CAT_DEFAULT gst_videofilter_debug
|
||||
|
||||
/* GstVideofilter signals and args */
|
||||
enum
|
||||
|
@ -53,7 +54,6 @@ static void gst_videofilter_get_property (GObject * object, guint prop_id,
|
|||
|
||||
static GstFlowReturn gst_videofilter_chain (GstPad * pad, GstBuffer * buffer);
|
||||
GstCaps *gst_videofilter_class_get_capslist (GstVideofilterClass * klass);
|
||||
static void gst_videofilter_setup (GstVideofilter * videofilter);
|
||||
|
||||
static GstElementClass *parent_class = NULL;
|
||||
|
||||
|
@ -113,6 +113,9 @@ gst_videofilter_class_init (gpointer g_class, gpointer class_data)
|
|||
|
||||
gobject_class->set_property = gst_videofilter_set_property;
|
||||
gobject_class->get_property = gst_videofilter_get_property;
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (gst_videofilter_debug, "videofilter", 0,
|
||||
"videofilter");
|
||||
}
|
||||
|
||||
static GstStructure *
|
||||
|
@ -176,8 +179,8 @@ gst_videofilter_getcaps (GstPad * pad)
|
|||
GstPad *peer;
|
||||
int i;
|
||||
|
||||
GST_DEBUG ("gst_videofilter_getcaps");
|
||||
videofilter = GST_VIDEOFILTER (GST_PAD_PARENT (pad));
|
||||
GST_DEBUG_OBJECT (videofilter, "gst_videofilter_getcaps");
|
||||
|
||||
klass = GST_VIDEOFILTER_CLASS (G_OBJECT_GET_CLASS (videofilter));
|
||||
|
||||
|
@ -238,7 +241,7 @@ gst_videofilter_setcaps (GstPad * pad, GstCaps * caps)
|
|||
|
||||
gst_pad_set_caps (videofilter->srcpad, caps);
|
||||
|
||||
GST_DEBUG ("width %d height %d", width, height);
|
||||
GST_DEBUG_OBJECT (videofilter, "width %d height %d", width, height);
|
||||
|
||||
#if 0
|
||||
if (pad == videofilter->srcpad) {
|
||||
|
@ -266,7 +269,7 @@ gst_videofilter_init (GTypeInstance * instance, gpointer g_class)
|
|||
GstVideofilter *videofilter = GST_VIDEOFILTER (instance);
|
||||
GstPadTemplate *pad_template;
|
||||
|
||||
GST_DEBUG ("gst_videofilter_init");
|
||||
GST_DEBUG_OBJECT (videofilter, "gst_videofilter_init");
|
||||
|
||||
pad_template =
|
||||
gst_element_class_get_pad_template (GST_ELEMENT_CLASS (g_class), "sink");
|
||||
|
@ -296,9 +299,8 @@ gst_videofilter_chain (GstPad * pad, GstBuffer * buf)
|
|||
GstBuffer *outbuf;
|
||||
GstFlowReturn ret;
|
||||
|
||||
GST_DEBUG ("gst_videofilter_chain");
|
||||
|
||||
videofilter = GST_VIDEOFILTER (GST_PAD_PARENT (pad));
|
||||
GST_DEBUG_OBJECT (videofilter, "gst_videofilter_chain");
|
||||
|
||||
if (videofilter->passthru) {
|
||||
return gst_pad_push (videofilter->srcpad, buf);
|
||||
|
@ -311,18 +313,18 @@ gst_videofilter_chain (GstPad * pad, GstBuffer * buf)
|
|||
data = GST_BUFFER_DATA (buf);
|
||||
size = GST_BUFFER_SIZE (buf);
|
||||
|
||||
GST_DEBUG ("gst_videofilter_chain: got buffer of %ld bytes in '%s'", size,
|
||||
GST_LOG_OBJECT (videofilter, "got buffer of %ld bytes in '%s'", size,
|
||||
GST_OBJECT_NAME (videofilter));
|
||||
|
||||
GST_DEBUG
|
||||
("size=%ld from=%dx%d to=%dx%d fromsize=%ld (should be %d) tosize=%d",
|
||||
GST_LOG_OBJECT (videofilter,
|
||||
"size=%ld from=%dx%d to=%dx%d fromsize=%ld (should be %d) tosize=%d",
|
||||
size, videofilter->from_width, videofilter->from_height,
|
||||
videofilter->to_width, videofilter->to_height, size,
|
||||
videofilter->from_buf_size, videofilter->to_buf_size);
|
||||
|
||||
|
||||
if (size > videofilter->from_buf_size) {
|
||||
GST_INFO ("buffer size %ld larger than expected (%d)",
|
||||
GST_INFO_OBJECT (videofilter, "buffer size %ld larger than expected (%d)",
|
||||
size, videofilter->from_buf_size);
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
|
@ -332,11 +334,13 @@ gst_videofilter_chain (GstPad * pad, GstBuffer * buf)
|
|||
if (ret != GST_FLOW_OK)
|
||||
goto no_buffer;
|
||||
|
||||
g_return_val_if_fail (GST_BUFFER_DATA (outbuf), GST_FLOW_ERROR);
|
||||
|
||||
GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (buf);
|
||||
GST_BUFFER_DURATION (outbuf) = GST_BUFFER_DURATION (buf);
|
||||
|
||||
g_return_val_if_fail (videofilter->format, GST_FLOW_ERROR);
|
||||
GST_DEBUG ("format %s", videofilter->format->fourcc);
|
||||
GST_DEBUG_OBJECT (videofilter, "format %s", videofilter->format->fourcc);
|
||||
|
||||
videofilter->in_buf = buf;
|
||||
videofilter->out_buf = outbuf;
|
||||
|
@ -345,7 +349,7 @@ gst_videofilter_chain (GstPad * pad, GstBuffer * buf)
|
|||
data);
|
||||
gst_buffer_unref (buf);
|
||||
|
||||
GST_DEBUG ("gst_videofilter_chain: pushing buffer of %d bytes in '%s'",
|
||||
GST_LOG_OBJECT (videofilter, "pushing buffer of %d bytes in '%s'",
|
||||
GST_BUFFER_SIZE (outbuf), GST_OBJECT_NAME (videofilter));
|
||||
|
||||
ret = gst_pad_push (videofilter->srcpad, outbuf);
|
||||
|
@ -362,12 +366,12 @@ static void
|
|||
gst_videofilter_set_property (GObject * object, guint prop_id,
|
||||
const GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
GstVideofilter *src;
|
||||
GstVideofilter *videofilter;
|
||||
|
||||
g_return_if_fail (GST_IS_VIDEOFILTER (object));
|
||||
src = GST_VIDEOFILTER (object);
|
||||
videofilter = GST_VIDEOFILTER (object);
|
||||
|
||||
GST_DEBUG ("gst_videofilter_set_property");
|
||||
GST_DEBUG_OBJECT (videofilter, "gst_videofilter_set_property");
|
||||
switch (prop_id) {
|
||||
default:
|
||||
break;
|
||||
|
@ -378,10 +382,10 @@ static void
|
|||
gst_videofilter_get_property (GObject * object, guint prop_id, GValue * value,
|
||||
GParamSpec * pspec)
|
||||
{
|
||||
GstVideofilter *src;
|
||||
GstVideofilter *videofilter;
|
||||
|
||||
g_return_if_fail (GST_IS_VIDEOFILTER (object));
|
||||
src = GST_VIDEOFILTER (object);
|
||||
videofilter = GST_VIDEOFILTER (object);
|
||||
|
||||
switch (prop_id) {
|
||||
default:
|
||||
|
@ -431,14 +435,17 @@ gst_videofilter_set_output_size (GstVideofilter * videofilter,
|
|||
gst_pad_set_caps (videofilter->srcpad, srccaps);
|
||||
}
|
||||
|
||||
static void
|
||||
void
|
||||
gst_videofilter_setup (GstVideofilter * videofilter)
|
||||
{
|
||||
GstVideofilterClass *klass;
|
||||
|
||||
GST_DEBUG_OBJECT (videofilter, "setup");
|
||||
|
||||
klass = GST_VIDEOFILTER_CLASS (G_OBJECT_GET_CLASS (videofilter));
|
||||
|
||||
if (klass->setup) {
|
||||
GST_DEBUG_OBJECT (videofilter, "calling class setup method");
|
||||
klass->setup (videofilter);
|
||||
}
|
||||
|
||||
|
@ -462,6 +469,8 @@ gst_videofilter_setup (GstVideofilter * videofilter)
|
|||
(videofilter->to_width * videofilter->to_height *
|
||||
videofilter->format->bpp) / 8;
|
||||
|
||||
GST_DEBUG_OBJECT (videofilter, "from_buf_size %d to_buf_size %d",
|
||||
videofilter->from_buf_size, videofilter->to_buf_size);
|
||||
videofilter->inited = TRUE;
|
||||
}
|
||||
|
||||
|
@ -544,15 +553,3 @@ gst_videofilter_class_add_pad_templates (GstVideofilterClass *
|
|||
gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS,
|
||||
gst_videofilter_class_get_capslist (videofilter_class)));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
plugin_init (GstPlugin * plugin)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
||||
GST_VERSION_MINOR,
|
||||
"gstvideofilter",
|
||||
"Video filter parent class",
|
||||
plugin_init, VERSION, "LGPL", GST_PACKAGE, GST_ORIGIN)
|
||||
|
|
|
@ -97,6 +97,7 @@ void gst_videofilter_set_output_size(GstVideofilter *videofilter,
|
|||
GstVideofilterFormat *gst_videofilter_find_format_by_structure (GstVideofilter *filter,
|
||||
const GstStructure *structure);
|
||||
GstCaps *gst_videofilter_class_get_capslist(GstVideofilterClass *videofilterclass);
|
||||
void gst_videofilter_setup (GstVideofilter * videofilter);
|
||||
|
||||
void gst_videofilter_class_add_format(GstVideofilterClass *videofilterclass,
|
||||
GstVideofilterFormat *format);
|
||||
|
|
|
@ -45,6 +45,9 @@ enum
|
|||
/* FILL ME */
|
||||
};
|
||||
|
||||
GST_DEBUG_CATEGORY_STATIC (gst_videoflip_debug);
|
||||
#define GST_CAT_DEFAULT gst_videoflip_debug
|
||||
|
||||
static void gst_videoflip_base_init (gpointer g_class);
|
||||
static void gst_videoflip_class_init (gpointer g_class, gpointer class_data);
|
||||
static void gst_videoflip_init (GTypeInstance * instance, gpointer g_class);
|
||||
|
@ -164,7 +167,7 @@ gst_videoflip_init (GTypeInstance * instance, gpointer g_class)
|
|||
GstVideoflip *videoflip = GST_VIDEOFLIP (instance);
|
||||
GstVideofilter *videofilter;
|
||||
|
||||
GST_DEBUG ("gst_videoflip_init");
|
||||
GST_DEBUG_OBJECT (videoflip, "gst_videoflip_init");
|
||||
|
||||
videofilter = GST_VIDEOFILTER (videoflip);
|
||||
|
||||
|
@ -175,17 +178,21 @@ static void
|
|||
gst_videoflip_set_property (GObject * object, guint prop_id,
|
||||
const GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
GstVideoflip *src;
|
||||
GstVideoflip *videoflip;
|
||||
GstVideofilter *videofilter;
|
||||
|
||||
g_return_if_fail (GST_IS_VIDEOFLIP (object));
|
||||
src = GST_VIDEOFLIP (object);
|
||||
videoflip = GST_VIDEOFLIP (object);
|
||||
videofilter = GST_VIDEOFILTER (object);
|
||||
|
||||
GST_DEBUG ("gst_videoflip_set_property");
|
||||
GST_DEBUG_OBJECT (videoflip, "gst_videoflip_set_property");
|
||||
switch (prop_id) {
|
||||
case ARG_METHOD:
|
||||
src->method = g_value_get_enum (value);
|
||||
/* FIXME is this ok? (threading issues) */
|
||||
gst_videoflip_setup (GST_VIDEOFILTER (src));
|
||||
videoflip->method = g_value_get_enum (value);
|
||||
if (videofilter->inited) {
|
||||
GST_DEBUG_OBJECT (videoflip, "setting up videoflip again");
|
||||
gst_videofilter_setup (videofilter);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -196,14 +203,14 @@ static void
|
|||
gst_videoflip_get_property (GObject * object, guint prop_id, GValue * value,
|
||||
GParamSpec * pspec)
|
||||
{
|
||||
GstVideoflip *src;
|
||||
GstVideoflip *videoflip;
|
||||
|
||||
g_return_if_fail (GST_IS_VIDEOFLIP (object));
|
||||
src = GST_VIDEOFLIP (object);
|
||||
videoflip = GST_VIDEOFLIP (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case ARG_METHOD:
|
||||
g_value_set_enum (value, src->method);
|
||||
g_value_set_enum (value, videoflip->method);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
|
@ -214,8 +221,7 @@ gst_videoflip_get_property (GObject * object, guint prop_id, GValue * value,
|
|||
static gboolean
|
||||
plugin_init (GstPlugin * plugin)
|
||||
{
|
||||
if (!gst_library_load ("gstvideofilter"))
|
||||
return FALSE;
|
||||
GST_DEBUG_CATEGORY_INIT (gst_videoflip_debug, "videoflip", 0, "videoflip");
|
||||
|
||||
return gst_element_register (plugin, "videoflip", GST_RANK_NONE,
|
||||
GST_TYPE_VIDEOFLIP);
|
||||
|
@ -225,20 +231,20 @@ GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
|||
GST_VERSION_MINOR,
|
||||
"videoflip",
|
||||
"Flips and rotates video",
|
||||
plugin_init, VERSION, GST_LICENSE, GST_PACKAGE, GST_ORIGIN)
|
||||
plugin_init, VERSION, GST_LICENSE, GST_PACKAGE, GST_ORIGIN);
|
||||
|
||||
static void gst_videoflip_flip (GstVideoflip * videoflip,
|
||||
static void gst_videoflip_flip (GstVideoflip * videoflip,
|
||||
unsigned char *dest, unsigned char *src, int sw, int sh, int dw, int dh);
|
||||
|
||||
|
||||
static void gst_videoflip_setup (GstVideofilter * videofilter)
|
||||
static void
|
||||
gst_videoflip_setup (GstVideofilter * videofilter)
|
||||
{
|
||||
int from_width, from_height;
|
||||
GstVideoflip *videoflip;
|
||||
|
||||
GST_DEBUG ("gst_videoflip_setup");
|
||||
|
||||
videoflip = GST_VIDEOFLIP (videofilter);
|
||||
GST_DEBUG_OBJECT (videoflip, "gst_videoflip_setup");
|
||||
|
||||
from_width = gst_videofilter_get_input_width (videofilter);
|
||||
from_height = gst_videofilter_get_input_height (videofilter);
|
||||
|
@ -265,25 +271,16 @@ GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
|||
break;
|
||||
}
|
||||
|
||||
GST_DEBUG ("format=%p \"%s\" from %dx%d to %dx%d",
|
||||
GST_DEBUG_OBJECT (videoflip, "format=%p \"%s\" from %dx%d to %dx%d",
|
||||
videofilter->format, videofilter->format->fourcc,
|
||||
from_width, from_height, videofilter->to_width, videofilter->to_height);
|
||||
|
||||
if (videoflip->method == GST_VIDEOFLIP_METHOD_IDENTITY) {
|
||||
GST_DEBUG ("videoflip: using passthru");
|
||||
GST_DEBUG_OBJECT (videoflip, "videoflip: using passthru");
|
||||
videofilter->passthru = TRUE;
|
||||
} else {
|
||||
videofilter->passthru = FALSE;
|
||||
}
|
||||
|
||||
videofilter->from_buf_size =
|
||||
(videofilter->from_width * videofilter->from_height *
|
||||
videofilter->format->depth) / 8;
|
||||
videofilter->to_buf_size =
|
||||
(videofilter->to_width * videofilter->to_height *
|
||||
videofilter->format->depth) / 8;
|
||||
|
||||
videofilter->inited = TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -303,7 +300,8 @@ gst_videoflip_planar411 (GstVideofilter * videofilter, void *dest, void *src)
|
|||
dw = videofilter->to_width;
|
||||
dh = videofilter->to_height;
|
||||
|
||||
GST_DEBUG ("videoflip: scaling planar 4:1:1 %dx%d to %dx%d", sw, sh, dw, dh);
|
||||
GST_LOG_OBJECT (videoflip, "videoflip: scaling planar 4:1:1 %dx%d to %dx%d",
|
||||
sw, sh, dw, dh);
|
||||
|
||||
gst_videoflip_flip (videoflip, dest, src, sw, sh, dw, dh);
|
||||
|
||||
|
|
Loading…
Reference in a new issue