cog: minor cleanups

Improve element descriptions, remove unused files, code cleanup.
This commit is contained in:
David Schleef 2010-06-11 14:39:30 -07:00
parent 9b5498b013
commit 785fb87caf
8 changed files with 32 additions and 343 deletions

View file

@ -28,7 +28,6 @@ libgstcog_la_SOURCES = \
gstcog.c \
gstcogcolorspace.c \
gstcogdownsample.c \
gstcogfilter.c \
gstcogmse.c \
gstcogscale.c \
gstcogutils.c \

View file

@ -32,10 +32,6 @@ GType gst_cog_scale_get_type (void);
GType gst_colorconvert_get_type (void);
GType gst_logoinsert_get_type (void);
GType gst_mse_get_type (void);
#if 0
GType gst_decimate_get_type (void);
GType gst_motion_detect_get_type (void);
#endif
GST_DEBUG_CATEGORY (cog_debug);
@ -52,19 +48,11 @@ plugin_init (GstPlugin * plugin)
gst_cogcolorspace_get_type ());
gst_element_register (plugin, "cogscale", GST_RANK_NONE,
gst_cog_scale_get_type ());
gst_element_register (plugin, "colorconvert", GST_RANK_NONE,
gst_element_register (plugin, "cogcolorconvert", GST_RANK_NONE,
gst_colorconvert_get_type ());
gst_element_register (plugin, "coglogoinsert", GST_RANK_NONE,
gst_logoinsert_get_type ());
gst_element_register (plugin, "cogmse", GST_RANK_NONE, gst_mse_get_type ());
#if 0
gst_element_register (plugin, "cogdecimate", GST_RANK_NONE,
gst_decimate_get_type ());
gst_element_register (plugin, "motiondetect", GST_RANK_NONE,
gst_motion_detect_get_type ());
gst_element_register (plugin, "deblock", GST_RANK_NONE,
gst_deblock_get_type ());
#endif
return TRUE;
}

View file

@ -65,19 +65,9 @@ struct _GstCogdownsampleClass
GType gst_cogdownsample_get_type (void);
/* GstCogdownsample signals and args */
enum
{
/* FILL ME */
LAST_SIGNAL
};
enum
{
ARG_0,
ARG_WAVELET_TYPE,
ARG_LEVEL
/* FILL ME */
ARG_0
};
static void gst_cogdownsample_base_init (gpointer g_class);
@ -147,10 +137,9 @@ gst_cogdownsample_base_init (gpointer g_class)
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_cogdownsample_sink_template));
gst_element_class_set_details_simple (element_class, "Downsample video",
"Filter/Effect/Video",
"Decreases size of video by a factor of 2",
"David Schleef <ds@schleef.org>");
gst_element_class_set_details_simple (element_class,
"Scale down video by factor of 2", "Filter/Effect/Video",
"Scales down video by a factor of 2", "David Schleef <ds@schleef.org>");
}
static void
@ -167,15 +156,6 @@ gst_cogdownsample_class_init (gpointer g_class, gpointer class_data)
gobject_class->set_property = gst_cogdownsample_set_property;
gobject_class->get_property = gst_cogdownsample_get_property;
#if 0
g_object_class_install_property (gobject_class, ARG_WAVELET_TYPE,
g_param_spec_int ("wavelet-type", "wavelet type", "wavelet type",
0, 4, 0, G_PARAM_READWRITE));
g_object_class_install_property (gobject_class, ARG_LEVEL,
g_param_spec_int ("level", "level", "level",
0, 100, 0, G_PARAM_READWRITE));
#endif
base_transform_class->transform = gst_cogdownsample_transform;
base_transform_class->transform_caps = gst_cogdownsample_transform_caps;
base_transform_class->get_unit_size = gst_cogdownsample_get_unit_size;

View file

@ -1,255 +0,0 @@
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
* Copyright (C) <2003> David Schleef <ds@schleef.org>
*
* 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.
*/
/*
* This file was (probably) generated from
* gstvideotemplate.c,v 1.18 2005/11/14 02:13:34 thomasvs Exp
* and
* $Id: make_filter,v 1.8 2004/04/19 22:51:57 ds Exp $
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gst/gst.h>
#include <gst/base/gstbasetransform.h>
#include <gst/video/video.h>
#include <cog/cogframe.h>
#include <string.h>
#include <math.h>
#define GST_TYPE_COG_FILTER \
(gst_cog_filter_get_type())
#define GST_COG_FILTER(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_COG_FILTER,GstCogFilter))
#define GST_COG_FILTER_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_COG_FILTER,GstCogFilterClass))
#define GST_IS_COG_FILTER(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_COG_FILTER))
#define GST_IS_COG_FILTER_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_COG_FILTER))
typedef struct _GstCogFilter GstCogFilter;
typedef struct _GstCogFilterClass GstCogFilterClass;
struct _GstCogFilter
{
GstBaseTransform base_transform;
int wavelet_type;
int level;
GstVideoFormat format;
CogFrame *tmp_frame;
int16_t *tmpbuf;
int frame_number;
};
struct _GstCogFilterClass
{
GstBaseTransformClass parent_class;
};
/* GstCogFilter signals and args */
enum
{
/* FILL ME */
LAST_SIGNAL
};
enum
{
ARG_0,
ARG_WAVELET_TYPE,
ARG_LEVEL
/* FILL ME */
};
GType gst_cog_filter_get_type (void);
static void gst_cog_filter_base_init (gpointer g_class);
static void gst_cog_filter_class_init (gpointer g_class, gpointer class_data);
static void gst_cog_filter_init (GTypeInstance * instance, gpointer g_class);
static void gst_cog_filter_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
static void gst_cog_filter_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
static GstFlowReturn gst_cog_filter_transform_ip (GstBaseTransform *
base_transform, GstBuffer * buf);
static GstStaticPadTemplate gst_cog_filter_sink_template =
GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("I420"))
);
static GstStaticPadTemplate gst_cog_filter_src_template =
GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("I420"))
);
GType
gst_cog_filter_get_type (void)
{
static GType compress_type = 0;
if (!compress_type) {
static const GTypeInfo compress_info = {
sizeof (GstCogFilterClass),
gst_cog_filter_base_init,
NULL,
gst_cog_filter_class_init,
NULL,
NULL,
sizeof (GstCogFilter),
0,
gst_cog_filter_init,
};
compress_type = g_type_register_static (GST_TYPE_BASE_TRANSFORM,
"GstCogFilter", &compress_info, 0);
}
return compress_type;
}
static void
gst_cog_filter_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_cog_filter_src_template));
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_cog_filter_sink_template));
gst_element_class_set_details_simple (element_class, "Cog Video Filter",
"Filter/Effect/Video",
"Applies a cog pre-filter to video", "David Schleef <ds@schleef.org>");
}
static void
gst_cog_filter_class_init (gpointer g_class, gpointer class_data)
{
GObjectClass *gobject_class;
GstBaseTransformClass *base_transform_class;
GstCogFilterClass *filter_class;
gobject_class = G_OBJECT_CLASS (g_class);
base_transform_class = GST_BASE_TRANSFORM_CLASS (g_class);
filter_class = GST_COG_FILTER_CLASS (g_class);
gobject_class->set_property = gst_cog_filter_set_property;
gobject_class->get_property = gst_cog_filter_get_property;
g_object_class_install_property (gobject_class, ARG_WAVELET_TYPE,
g_param_spec_int ("wavelet-type", "wavelet type", "wavelet type",
0, 4, 0, G_PARAM_READWRITE));
g_object_class_install_property (gobject_class, ARG_LEVEL,
g_param_spec_int ("level", "level", "level",
0, 100, 0, G_PARAM_READWRITE));
base_transform_class->transform_ip = gst_cog_filter_transform_ip;
}
static void
gst_cog_filter_init (GTypeInstance * instance, gpointer g_class)
{
GST_DEBUG ("gst_cog_filter_init");
}
static void
gst_cog_filter_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
GstCogFilter *src;
g_return_if_fail (GST_IS_COG_FILTER (object));
src = GST_COG_FILTER (object);
GST_DEBUG ("gst_cog_filter_set_property");
switch (prop_id) {
case ARG_WAVELET_TYPE:
src->wavelet_type = g_value_get_int (value);
break;
case ARG_LEVEL:
src->level = g_value_get_int (value);
break;
default:
break;
}
}
static void
gst_cog_filter_get_property (GObject * object, guint prop_id, GValue * value,
GParamSpec * pspec)
{
GstCogFilter *src;
g_return_if_fail (GST_IS_COG_FILTER (object));
src = GST_COG_FILTER (object);
switch (prop_id) {
case ARG_WAVELET_TYPE:
g_value_set_int (value, src->wavelet_type);
break;
case ARG_LEVEL:
g_value_set_int (value, src->level);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static GstFlowReturn
gst_cog_filter_transform_ip (GstBaseTransform * base_transform, GstBuffer * buf)
{
GstCogFilter *compress;
CogFrame *frame;
int width, height;
g_return_val_if_fail (GST_IS_COG_FILTER (base_transform), GST_FLOW_ERROR);
compress = GST_COG_FILTER (base_transform);
gst_structure_get_int (gst_caps_get_structure (buf->caps, 0),
"width", &width);
gst_structure_get_int (gst_caps_get_structure (buf->caps, 0),
"height", &height);
frame = cog_frame_new_from_data_I420 (GST_BUFFER_DATA (buf), width, height);
/* FIXME do something here */
return GST_FLOW_OK;
}

View file

@ -140,8 +140,10 @@ gst_mse_base_init (gpointer klass)
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_framestore_sink_test_template));
gst_element_class_set_details_simple (element_class, "FIXME",
"Filter/Effect", "FIXME example filter", "FIXME <fixme@fixme.com>");
gst_element_class_set_details_simple (element_class, "Calculate MSE",
"Filter/Effect",
"Calculates mean squared error between two video streams",
"David Schleef <ds@schleef.org>");
}
static void

View file

@ -132,54 +132,43 @@ enum
GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("{ I420, YV12, YUY2, UYVY, AYUV, Y42B }") ";" \
GST_VIDEO_CAPS_ARGB)
#if 0
/* not supported */
GST_VIDEO_CAPS_RGBx
GST_VIDEO_CAPS_BGRx
GST_VIDEO_CAPS_xRGB
GST_VIDEO_CAPS_xBGR
GST_VIDEO_CAPS_RGBA
GST_VIDEO_CAPS_BGRA
GST_VIDEO_CAPS_ABGR GST_VIDEO_CAPS_RGB GST_VIDEO_CAPS_BGR
GST_VIDEO_CAPS_YUV ("{ Y41B, YVYU }")
#endif
static GstStaticPadTemplate gst_cog_scale_src_template =
GST_STATIC_PAD_TEMPLATE ("src",
static GstStaticPadTemplate gst_cog_scale_src_template =
GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
TEMPLATE_CAPS);
static GstStaticPadTemplate gst_cog_scale_sink_template =
GST_STATIC_PAD_TEMPLATE ("sink",
static GstStaticPadTemplate gst_cog_scale_sink_template =
GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
TEMPLATE_CAPS);
static void gst_cog_scale_base_init (gpointer g_class);
static void gst_cog_scale_class_init (GstCogScaleClass * klass);
static void gst_cog_scale_init (GstCogScale * videoscale);
static void gst_cog_scale_finalize (GstCogScale * videoscale);
static gboolean gst_cog_scale_src_event (GstBaseTransform * trans,
static void gst_cog_scale_base_init (gpointer g_class);
static void gst_cog_scale_class_init (GstCogScaleClass * klass);
static void gst_cog_scale_init (GstCogScale * videoscale);
static void gst_cog_scale_finalize (GstCogScale * videoscale);
static gboolean gst_cog_scale_src_event (GstBaseTransform * trans,
GstEvent * event);
/* base transform vmethods */
static GstCaps *gst_cog_scale_transform_caps (GstBaseTransform * trans,
static GstCaps *gst_cog_scale_transform_caps (GstBaseTransform * trans,
GstPadDirection direction, GstCaps * caps);
static gboolean gst_cog_scale_set_caps (GstBaseTransform * trans,
static gboolean gst_cog_scale_set_caps (GstBaseTransform * trans,
GstCaps * in, GstCaps * out);
static gboolean gst_cog_scale_get_unit_size (GstBaseTransform * trans,
static gboolean gst_cog_scale_get_unit_size (GstBaseTransform * trans,
GstCaps * caps, guint * size);
static GstFlowReturn gst_cog_scale_transform (GstBaseTransform * trans,
static GstFlowReturn gst_cog_scale_transform (GstBaseTransform * trans,
GstBuffer * in, GstBuffer * out);
static void gst_cog_scale_fixate_caps (GstBaseTransform * base,
static void gst_cog_scale_fixate_caps (GstBaseTransform * base,
GstPadDirection direction, GstCaps * caps, GstCaps * othercaps);
static void gst_cog_scale_set_property (GObject * object, guint prop_id,
static void gst_cog_scale_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
static void gst_cog_scale_get_property (GObject * object, guint prop_id,
static void gst_cog_scale_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
static GstElementClass *parent_class = NULL;
static GstElementClass *parent_class = NULL;
GType

View file

@ -65,14 +65,6 @@ struct _GstColorconvertClass
};
/* GstColorconvert signals and args */
enum
{
/* FILL ME */
LAST_SIGNAL
};
enum
{
ARG_0,
@ -145,9 +137,10 @@ gst_colorconvert_base_init (gpointer g_class)
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_colorconvert_sink_template));
gst_element_class_set_details_simple (element_class, "Video Filter Template",
gst_element_class_set_details_simple (element_class, "Convert colorspace",
"Filter/Effect/Video",
"Template for a video filter", "David Schleef <ds@schleef.org>");
"Convert between SDTV and HDTV colorspace",
"David Schleef <ds@schleef.org>");
}
static void

View file

@ -69,13 +69,6 @@ struct _GstLogoinsertClass
};
/* GstLogoinsert signals and args */
enum
{
/* FILL ME */
LAST_SIGNAL
};
enum
{
ARG_0,
@ -154,9 +147,9 @@ gst_logoinsert_base_init (gpointer g_class)
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_logoinsert_sink_template));
gst_element_class_set_details_simple (element_class, "Video Filter Template",
"Filter/Effect/Video",
"Template for a video filter", "David Schleef <ds@schleef.org>");
gst_element_class_set_details_simple (element_class,
"Overlay image onto video", "Filter/Effect/Video",
"Overlay image onto video", "David Schleef <ds@schleef.org>");
}
static void