summaryrefslogtreecommitdiff
path: root/gst
diff options
context:
space:
mode:
Diffstat (limited to 'gst')
-rw-r--r--gst/cdxaparse/gstcdxaparse.c145
-rw-r--r--gst/cdxaparse/gstcdxaparse.h53
-rw-r--r--gst/chart/gstchart.c325
-rw-r--r--gst/colorspace/gstcolorspace.c368
-rw-r--r--gst/colorspace/gstcolorspace.h31
-rw-r--r--gst/colorspace/yuv2rgb.c886
-rw-r--r--gst/colorspace/yuv2rgb.h33
-rw-r--r--gst/deinterlace/gstdeinterlace.c271
-rw-r--r--gst/deinterlace/gstdeinterlace.h13
-rw-r--r--gst/festival/gstfestival.c275
-rw-r--r--gst/festival/gstfestival.h52
-rw-r--r--gst/filter/gstbpwsinc.c185
-rw-r--r--gst/filter/gstfilter.c48
-rw-r--r--gst/filter/gstiir.c125
-rw-r--r--gst/filter/gstlpwsinc.c138
-rw-r--r--gst/filter/iir.c228
-rw-r--r--gst/filter/iir.h11
-rw-r--r--gst/flx/flx_color.c58
-rw-r--r--gst/flx/flx_color.h28
-rw-r--r--gst/flx/flx_fmt.h197
-rw-r--r--gst/flx/gstflxdec.c565
-rw-r--r--gst/flx/gstflxdec.h60
-rw-r--r--gst/mixmatrix/mixmatrix.c339
-rw-r--r--gst/modplug/gstmodplug.h111
-rw-r--r--gst/modplug/libmodplug/it_defs.h194
-rw-r--r--gst/modplug/libmodplug/modplug.h97
-rw-r--r--gst/modplug/libmodplug/sndfile.h1022
-rw-r--r--gst/modplug/libmodplug/stdafx.h44
-rw-r--r--gst/mpeg1sys/buffer.c407
-rw-r--r--gst/mpeg1sys/buffer.h194
-rw-r--r--gst/mpeg1sys/gstmpeg1systemencode.c474
-rw-r--r--gst/mpeg1sys/gstmpeg1systemencode.h93
-rw-r--r--gst/mpeg1sys/main.h111
-rw-r--r--gst/mpeg1sys/systems.c421
-rw-r--r--gst/mpeg1videoparse/gstmp1videoparse.c491
-rw-r--r--gst/mpeg1videoparse/gstmp1videoparse.h47
-rw-r--r--gst/mpeg2sub/gstmpeg2subt.c329
-rw-r--r--gst/mpeg2sub/gstmpeg2subt.h49
-rw-r--r--gst/mpegaudioparse/gstmpegaudioparse.c421
-rw-r--r--gst/mpegaudioparse/gstmpegaudioparse.h41
-rw-r--r--gst/overlay/gstoverlay.c268
-rw-r--r--gst/overlay/gstoverlay.h36
-rw-r--r--gst/passthrough/gstpassthrough.c209
-rw-r--r--gst/passthrough/gstpassthrough.h16
-rw-r--r--gst/playondemand/demo-mp3.c169
-rw-r--r--gst/playondemand/gstplayondemand.c517
-rw-r--r--gst/playondemand/gstplayondemand.h60
-rw-r--r--gst/qtdemux/qtdemux.c2016
-rw-r--r--gst/qtdemux/qtdemux.h57
-rw-r--r--gst/rtjpeg/RTjpeg.c4434
-rw-r--r--gst/rtjpeg/RTjpeg.h50
-rw-r--r--gst/rtjpeg/gstrtjpeg.c22
-rw-r--r--gst/rtjpeg/gstrtjpegdec.c59
-rw-r--r--gst/rtjpeg/gstrtjpegdec.h37
-rw-r--r--gst/rtjpeg/gstrtjpegenc.c65
-rw-r--r--gst/rtjpeg/gstrtjpegenc.h37
-rw-r--r--gst/smooth/gstsmooth.c236
-rw-r--r--gst/smooth/gstsmooth.h45
-rw-r--r--gst/smoothwave/demo-osssrc.c57
-rw-r--r--gst/smoothwave/gstsmoothwave.c202
-rw-r--r--gst/smoothwave/gstsmoothwave.h39
-rw-r--r--gst/smpte/barboxwipes.c1186
-rw-r--r--gst/smpte/gstmask.c20
-rw-r--r--gst/smpte/gstmask.h50
-rw-r--r--gst/smpte/gstsmpte.c292
-rw-r--r--gst/smpte/gstsmpte.h32
-rw-r--r--gst/smpte/paint.c162
-rw-r--r--gst/smpte/paint.h31
-rw-r--r--gst/spectrum/demo-osssrc.c78
-rw-r--r--gst/spectrum/fix_fft.c643
-rw-r--r--gst/spectrum/gstspectrum.c157
-rw-r--r--gst/spectrum/gstspectrum.h33
-rw-r--r--gst/speed/demo-mp3.c112
-rw-r--r--gst/speed/gstspeed.c189
-rw-r--r--gst/speed/gstspeed.h14
-rw-r--r--gst/stereo/gststereo.c172
-rw-r--r--gst/stereo/gststereo.h35
-rw-r--r--gst/switch/gstswitch.c364
-rw-r--r--gst/switch/gstswitch.h18
-rw-r--r--gst/vbidec/gstvbidec.c259
-rw-r--r--gst/vbidec/gstvbidec.h2
-rw-r--r--gst/vbidec/vbidata.c1840
-rw-r--r--gst/vbidec/vbidata.h20
-rw-r--r--gst/vbidec/vbiscreen.c1138
-rw-r--r--gst/vbidec/vbiscreen.h40
-rw-r--r--gst/videocrop/gstvideocrop.c218
-rw-r--r--gst/videodrop/gstvideodrop.c170
-rw-r--r--gst/videodrop/gstvideodrop.h14
-rw-r--r--gst/virtualdub/gstvirtualdub.c97
-rw-r--r--gst/virtualdub/gstvirtualdub.h12
-rw-r--r--gst/virtualdub/gstxsharpen.c349
-rw-r--r--gst/y4m/gsty4mencode.c204
-rw-r--r--gst/y4m/gsty4mencode.h37
93 files changed, 13080 insertions, 12519 deletions
diff --git a/gst/cdxaparse/gstcdxaparse.c b/gst/cdxaparse/gstcdxaparse.c
index 0cfa010e1..3241db24a 100644
--- a/gst/cdxaparse/gstcdxaparse.c
+++ b/gst/cdxaparse/gstcdxaparse.c
@@ -48,65 +48,63 @@ static GstElementDetails gst_cdxa_parse_details = {
};
/* CDXAParse signals and args */
-enum {
+enum
+{
/* FILL ME */
LAST_SIGNAL
};
-enum {
+enum
+{
ARG_0,
/* FILL ME */
};
-static GstStaticPadTemplate sink_templ =
-GST_STATIC_PAD_TEMPLATE (
- "sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ( "video/x-cdxa" )
-);
-
-static GstStaticPadTemplate src_templ =
-GST_STATIC_PAD_TEMPLATE (
- "src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ( "video/mpeg, "
- "systemstream = (boolean) TRUE"
- )
-);
-
-static void gst_cdxa_parse_base_init (gpointer g_class);
-static void gst_cdxa_parse_class_init (GstCDXAParseClass *klass);
-static void gst_cdxa_parse_init (GstCDXAParse *cdxa_parse);
-
-static void gst_cdxa_parse_loop (GstElement *element);
+static GstStaticPadTemplate sink_templ = GST_STATIC_PAD_TEMPLATE ("sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("video/x-cdxa")
+ );
-static GstElementStateReturn
- gst_cdxa_parse_change_state (GstElement *element);
+static GstStaticPadTemplate src_templ = GST_STATIC_PAD_TEMPLATE ("src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("video/mpeg, " "systemstream = (boolean) TRUE")
+ );
+
+static void gst_cdxa_parse_base_init (gpointer g_class);
+static void gst_cdxa_parse_class_init (GstCDXAParseClass * klass);
+static void gst_cdxa_parse_init (GstCDXAParse * cdxa_parse);
+
+static void gst_cdxa_parse_loop (GstElement * element);
+
+static GstElementStateReturn gst_cdxa_parse_change_state (GstElement * element);
static GstElementClass *parent_class = NULL;
+
/*static guint gst_cdxa_parse_signals[LAST_SIGNAL] = { 0 }; */
GType
-gst_cdxa_parse_get_type(void)
+gst_cdxa_parse_get_type (void)
{
static GType cdxa_parse_type = 0;
if (!cdxa_parse_type) {
static const GTypeInfo cdxa_parse_info = {
- sizeof(GstCDXAParseClass),
+ sizeof (GstCDXAParseClass),
gst_cdxa_parse_base_init,
NULL,
- (GClassInitFunc)gst_cdxa_parse_class_init,
+ (GClassInitFunc) gst_cdxa_parse_class_init,
NULL,
NULL,
- sizeof(GstCDXAParse),
+ sizeof (GstCDXAParse),
0,
- (GInstanceInitFunc)gst_cdxa_parse_init,
+ (GInstanceInitFunc) gst_cdxa_parse_init,
};
- cdxa_parse_type = g_type_register_static(GST_TYPE_ELEMENT, "GstCDXAParse", &cdxa_parse_info, 0);
+ cdxa_parse_type =
+ g_type_register_static (GST_TYPE_ELEMENT, "GstCDXAParse",
+ &cdxa_parse_info, 0);
}
return cdxa_parse_type;
}
@@ -124,30 +122,32 @@ gst_cdxa_parse_base_init (gpointer g_class)
}
static void
-gst_cdxa_parse_class_init (GstCDXAParseClass *klass)
+gst_cdxa_parse_class_init (GstCDXAParseClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
- gobject_class = (GObjectClass*)klass;
- gstelement_class = (GstElementClass*)klass;
+ gobject_class = (GObjectClass *) klass;
+ gstelement_class = (GstElementClass *) klass;
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
-
+
gstelement_class->change_state = gst_cdxa_parse_change_state;
}
-static void
-gst_cdxa_parse_init (GstCDXAParse *cdxa_parse)
+static void
+gst_cdxa_parse_init (GstCDXAParse * cdxa_parse)
{
GST_FLAG_SET (cdxa_parse, GST_ELEMENT_EVENT_AWARE);
-
- cdxa_parse->sinkpad = gst_pad_new_from_template (
- gst_static_pad_template_get (&sink_templ), "sink");
+
+ cdxa_parse->sinkpad =
+ gst_pad_new_from_template (gst_static_pad_template_get (&sink_templ),
+ "sink");
gst_element_add_pad (GST_ELEMENT (cdxa_parse), cdxa_parse->sinkpad);
- cdxa_parse->srcpad = gst_pad_new_from_template (
- gst_static_pad_template_get (&src_templ), "src");
+ cdxa_parse->srcpad =
+ gst_pad_new_from_template (gst_static_pad_template_get (&src_templ),
+ "src");
gst_element_add_pad (GST_ELEMENT (cdxa_parse), cdxa_parse->srcpad);
gst_element_set_loop_function (GST_ELEMENT (cdxa_parse), gst_cdxa_parse_loop);
@@ -155,15 +155,15 @@ gst_cdxa_parse_init (GstCDXAParse *cdxa_parse)
}
static gboolean
-gst_cdxa_parse_handle_event (GstCDXAParse *cdxa_parse)
+gst_cdxa_parse_handle_event (GstCDXAParse * cdxa_parse)
{
guint32 remaining;
GstEvent *event;
GstEventType type;
-
+
gst_bytestream_get_status (cdxa_parse->bs, &remaining, &event);
- type = event? GST_EVENT_TYPE (event) : GST_EVENT_UNKNOWN;
+ type = event ? GST_EVENT_TYPE (event) : GST_EVENT_UNKNOWN;
switch (type) {
case GST_EVENT_EOS:
@@ -195,15 +195,15 @@ CDXA starts with the following header:
*/
-typedef struct
+typedef struct
{
- gchar RIFF_tag[4];
+ gchar RIFF_tag[4];
guint32 riff_size;
- gchar CDXA_tag[4];
- gchar fmt_tag[4];
+ gchar CDXA_tag[4];
+ gchar fmt_tag[4];
guint32 fmt_size;
} CDXAParseHeader;
-
+
/*
A sectors is 2352 bytes long and is composed of:
@@ -215,7 +215,7 @@ We parse the data out of it and send it to the srcpad.
*/
static void
-gst_cdxa_parse_loop (GstElement *element)
+gst_cdxa_parse_loop (GstElement * element)
{
GstCDXAParse *cdxa_parse;
CDXAParseHeader *header;
@@ -237,17 +237,18 @@ gst_cdxa_parse_loop (GstElement *element)
return;
cdxa_parse->riff_size = GUINT32_FROM_LE (header->riff_size);
- fmt_size = (GUINT32_FROM_LE (header->fmt_size) + 1)&~1;
+ fmt_size = (GUINT32_FROM_LE (header->fmt_size) + 1) & ~1;
/* flush the header + fmt_size bytes + 4 bytes "data" */
if (!gst_bytestream_flush (cdxa_parse->bs, 20 + fmt_size + 4))
return;
-
+
/* get the data size */
- got_bytes = gst_bytestream_peek_bytes (cdxa_parse->bs, (guint8**)&buf, 4);
+ got_bytes =
+ gst_bytestream_peek_bytes (cdxa_parse->bs, (guint8 **) & buf, 4);
if (got_bytes < 4)
return;
- cdxa_parse->data_size = GUINT32_FROM_LE (*((guint32 *)buf));
+ cdxa_parse->data_size = GUINT32_FROM_LE (*((guint32 *) buf));
/* flush the data size */
if (!gst_bytestream_flush (cdxa_parse->bs, 4))
@@ -257,10 +258,9 @@ gst_cdxa_parse_loop (GstElement *element)
g_warning ("cdxa_parse: size not multiple of %d bytes", CDXA_SECTOR_SIZE);
cdxa_parse->sectors = cdxa_parse->data_size / CDXA_SECTOR_SIZE;
-
+
cdxa_parse->state = CDXA_PARSE_DATA;
- }
- else {
+ } else {
GstBuffer *buf;
GstBuffer *outbuf;
guint32 got_bytes;
@@ -279,7 +279,7 @@ gst_cdxa_parse_loop (GstElement *element)
}
static GstElementStateReturn
-gst_cdxa_parse_change_state (GstElement *element)
+gst_cdxa_parse_change_state (GstElement * element)
{
GstCDXAParse *cdxa_parse = GST_CDXA_PARSE (element);
@@ -309,25 +309,20 @@ gst_cdxa_parse_change_state (GstElement *element)
}
static gboolean
-plugin_init (GstPlugin *plugin)
+plugin_init (GstPlugin * plugin)
{
if (!gst_library_load ("gstbytestream"))
return FALSE;
- if (!gst_element_register (plugin, "cdxaparse", GST_RANK_NONE, GST_TYPE_CDXA_PARSE))
+ if (!gst_element_register (plugin, "cdxaparse", GST_RANK_NONE,
+ GST_TYPE_CDXA_PARSE))
return FALSE;
-
+
return TRUE;
}
-GST_PLUGIN_DEFINE (
- GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "cdxaparse",
- "Parse a .dat file (VCD) into raw mpeg1",
- plugin_init,
- VERSION,
- "LGPL",
- GST_PACKAGE,
- GST_ORIGIN)
-
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ "cdxaparse",
+ "Parse a .dat file (VCD) into raw mpeg1",
+ plugin_init, VERSION, "LGPL", GST_PACKAGE, GST_ORIGIN)
diff --git a/gst/cdxaparse/gstcdxaparse.h b/gst/cdxaparse/gstcdxaparse.h
index 32af55272..ef1475b2d 100644
--- a/gst/cdxaparse/gstcdxaparse.h
+++ b/gst/cdxaparse/gstcdxaparse.h
@@ -26,8 +26,9 @@
#include <gst/bytestream/bytestream.h>
#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
+extern "C"
+{
+#endif /* __cplusplus */
#define GST_TYPE_CDXA_PARSE \
(gst_cdxa_parse_get_type())
@@ -43,38 +44,40 @@ extern "C" {
#define CDXA_SECTOR_SIZE 2352
#define CDXA_DATA_SIZE 2324
-typedef enum
-{
- CDXA_PARSE_HEADER,
- CDXA_PARSE_DATA,
-} GstCDXAParseState;
+ typedef enum
+ {
+ CDXA_PARSE_HEADER,
+ CDXA_PARSE_DATA,
+ } GstCDXAParseState;
-typedef struct _GstCDXAParse GstCDXAParse;
-typedef struct _GstCDXAParseClass GstCDXAParseClass;
+ typedef struct _GstCDXAParse GstCDXAParse;
+ typedef struct _GstCDXAParseClass GstCDXAParseClass;
-struct _GstCDXAParse {
- GstElement element;
+ struct _GstCDXAParse
+ {
+ GstElement element;
- /* pads */
- GstPad *sinkpad, *srcpad;
+ /* pads */
+ GstPad *sinkpad, *srcpad;
- GstByteStream *bs;
+ GstByteStream *bs;
- GstCDXAParseState state;
+ GstCDXAParseState state;
- guint32 riff_size;
- guint32 data_size;
- guint32 sectors;
-};
+ guint32 riff_size;
+ guint32 data_size;
+ guint32 sectors;
+ };
-struct _GstCDXAParseClass {
- GstElementClass parent_class;
-};
+ struct _GstCDXAParseClass
+ {
+ GstElementClass parent_class;
+ };
-GType gst_cdxa_parse_get_type (void);
+ GType gst_cdxa_parse_get_type (void);
#ifdef __cplusplus
}
-#endif /* __cplusplus */
+#endif /* __cplusplus */
-#endif /* __GST_CDXA_PARSE_H__ */
+#endif /* __GST_CDXA_PARSE_H__ */
diff --git a/gst/chart/gstchart.c b/gst/chart/gstchart.c
index cafc14167..218327952 100644
--- a/gst/chart/gstchart.c
+++ b/gst/chart/gstchart.c
@@ -33,11 +33,12 @@
typedef struct _GstChart GstChart;
typedef struct _GstChartClass GstChartClass;
-struct _GstChart {
+struct _GstChart
+{
GstElement element;
/* pads */
- GstPad *sinkpad,*srcpad;
+ GstPad *sinkpad, *srcpad;
/* the timestamp of the next frame */
guint64 next_time;
@@ -49,16 +50,17 @@ struct _GstChart {
gint height;
gint samplerate;
- gdouble framerate; /* desired frame rate */
- gint samples_between_frames; /* number of samples between start of successive frames */
- gint samples_since_last_frame; /* number of samples between start of successive frames */
+ gdouble framerate; /* desired frame rate */
+ gint samples_between_frames; /* number of samples between start of successive frames */
+ gint samples_since_last_frame; /* number of samples between start of successive frames */
};
-struct _GstChartClass {
+struct _GstChartClass
+{
GstElementClass parent_class;
};
-GType gst_chart_get_type(void);
+GType gst_chart_get_type (void);
/* elementfactory information */
@@ -70,51 +72,50 @@ static GstElementDetails gst_chart_details = {
};
/* signals and args */
-enum {
+enum
+{
/* FILL ME */
LAST_SIGNAL
};
-enum {
+enum
+{
ARG_0,
/* FILL ME */
};
-static GstStaticPadTemplate src_factory =
-GST_STATIC_PAD_TEMPLATE (
- "src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ( GST_VIDEO_CAPS_RGB_16)
-);
-
-static GstStaticPadTemplate sink_factory =
-GST_STATIC_PAD_TEMPLATE (
- "sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("audio/x-raw-int, "
- "endianness = (int) BYTE_ORDER, "
- "signed = (boolean) TRUE, "
- "width = (int) 16, "
- "depth = (int) 16, "
- "rate = (int) [ 8000, 96000 ], "
- "channels = (int) 1")
-);
-
-static void gst_chart_base_init (gpointer g_class);
-static void gst_chart_class_init (GstChartClass *klass);
-static void gst_chart_init (GstChart *chart);
-
-static void gst_chart_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
-static void gst_chart_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
-
-static void gst_chart_chain (GstPad *pad, GstData *_data);
-
-static GstPadLinkReturn
- gst_chart_sinkconnect (GstPad *pad, const GstCaps *caps);
-static GstPadLinkReturn
- gst_chart_srcconnect (GstPad *pad, const GstCaps *caps);
+static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS (GST_VIDEO_CAPS_RGB_16)
+ );
+
+static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("audio/x-raw-int, "
+ "endianness = (int) BYTE_ORDER, "
+ "signed = (boolean) TRUE, "
+ "width = (int) 16, "
+ "depth = (int) 16, "
+ "rate = (int) [ 8000, 96000 ], " "channels = (int) 1")
+ );
+
+static void gst_chart_base_init (gpointer g_class);
+static void gst_chart_class_init (GstChartClass * klass);
+static void gst_chart_init (GstChart * chart);
+
+static void gst_chart_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec);
+static void gst_chart_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec);
+
+static void gst_chart_chain (GstPad * pad, GstData * _data);
+
+static GstPadLinkReturn
+gst_chart_sinkconnect (GstPad * pad, const GstCaps * caps);
+static GstPadLinkReturn
+gst_chart_srcconnect (GstPad * pad, const GstCaps * caps);
static GstElementClass *parent_class = NULL;
@@ -125,17 +126,17 @@ gst_chart_get_type (void)
if (!type) {
static const GTypeInfo info = {
- sizeof(GstChartClass),
+ sizeof (GstChartClass),
gst_chart_base_init,
NULL,
- (GClassInitFunc)gst_chart_class_init,
+ (GClassInitFunc) gst_chart_class_init,
NULL,
NULL,
- sizeof(GstChart),
+ sizeof (GstChart),
0,
- (GInstanceInitFunc)gst_chart_init,
+ (GInstanceInitFunc) gst_chart_init,
};
- type = g_type_register_static(GST_TYPE_ELEMENT, "GstChart", &info, 0);
+ type = g_type_register_static (GST_TYPE_ELEMENT, "GstChart", &info, 0);
}
return type;
}
@@ -145,36 +146,38 @@ gst_chart_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 (&src_factory));
- gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&sink_factory));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&src_factory));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&sink_factory));
gst_element_class_set_details (element_class, &gst_chart_details);
}
static void
-gst_chart_class_init(GstChartClass *klass)
+gst_chart_class_init (GstChartClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
- gobject_class = (GObjectClass*)klass;
- gstelement_class = (GstElementClass*)klass;
+ gobject_class = (GObjectClass *) klass;
+ gstelement_class = (GstElementClass *) klass;
- parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
+ parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
gobject_class->set_property = gst_chart_set_property;
gobject_class->get_property = gst_chart_get_property;
}
static void
-gst_chart_init (GstChart *chart)
+gst_chart_init (GstChart * chart)
{
/* create the sink and src pads */
- chart->sinkpad = gst_pad_new_from_template (
- gst_static_pad_template_get (&sink_factory),
- "sink");
- chart->srcpad = gst_pad_new_from_template (
- gst_static_pad_template_get (&src_factory),
- "src");
+ chart->sinkpad =
+ gst_pad_new_from_template (gst_static_pad_template_get (&sink_factory),
+ "sink");
+ chart->srcpad =
+ gst_pad_new_from_template (gst_static_pad_template_get (&src_factory),
+ "src");
gst_element_add_pad (GST_ELEMENT (chart), chart->sinkpad);
gst_element_add_pad (GST_ELEMENT (chart), chart->srcpad);
@@ -191,13 +194,13 @@ gst_chart_init (GstChart *chart)
chart->height = 128;
chart->samplerate = -1;
- chart->framerate = 25; /* desired frame rate */
- chart->samples_between_frames = 0; /* number of samples between start of successive frames */
+ chart->framerate = 25; /* desired frame rate */
+ chart->samples_between_frames = 0; /* number of samples between start of successive frames */
chart->samples_since_last_frame = 0;
}
static GstPadLinkReturn
-gst_chart_sinkconnect (GstPad *pad, const GstCaps *caps)
+gst_chart_sinkconnect (GstPad * pad, const GstCaps * caps)
{
GstChart *chart;
GstStructure *structure;
@@ -209,15 +212,14 @@ gst_chart_sinkconnect (GstPad *pad, const GstCaps *caps)
gst_structure_get_int (structure, "rate", &chart->samplerate);
chart->samples_between_frames = chart->samplerate / chart->framerate;
- GST_DEBUG ("CHART: new sink caps: rate %d",
- chart->samplerate);
+ GST_DEBUG ("CHART: new sink caps: rate %d", chart->samplerate);
/*gst_chart_sync_parms (chart); */
/* */
return GST_PAD_LINK_OK;
}
static GstPadLinkReturn
-gst_chart_srcconnect (GstPad *pad, const GstCaps*caps)
+gst_chart_srcconnect (GstPad * pad, const GstCaps * caps)
{
GstChart *chart;
GstStructure *structure;
@@ -234,63 +236,64 @@ gst_chart_srcconnect (GstPad *pad, const GstCaps*caps)
gst_structure_get_int (structure, "height", &chart->height);
GST_DEBUG ("CHART: new src caps: framerate %f, %dx%d",
- chart->framerate, chart->width, chart->height);
+ chart->framerate, chart->width, chart->height);
return GST_PAD_LINK_OK;
}
static void
-draw_chart_16bpp(guchar * output, gint width, gint height,
- gint16 * src_data, gint src_size)
+draw_chart_16bpp (guchar * output, gint width, gint height,
+ gint16 * src_data, gint src_size)
{
- gint i;
- guint16 *colstart;
- gint16 * in;
-
- GST_DEBUG ("CHART: drawing frame to %p, width = %d, height = %d, src_data = %p, src_size = %d",
- output, width, height, src_data, src_size);
-
- for (colstart = (guint16 *)output, in = (gint16 *)src_data, i = 0;
- i < width;
- colstart++, in++, i++) {
- guint16 * pos = colstart;
- gint h1;
-
- h1 = (((gint)(*in)) * height / (1 << 16)) + height / 2;
- if (h1 >= height) h1 = height;
-
- if (h1 < height / 2) {
- while (pos < colstart + h1 * width) {
- *pos = 0x0000;
- pos += width;
- }
- while (pos < colstart + height / 2 * width) {
- *pos = 0x07e0;
- pos += width;
- }
- while (pos < colstart + height * width) {
- *pos = 0x0000;
- pos += width;
- }
- } else {
- while (pos < colstart + height / 2 * width) {
- *pos = 0x0000;
- pos += width;
- }
- while (pos < colstart + h1 * width) {
- *pos = 0x07e0;
- pos += width;
- }
- while (pos < colstart + height * width) {
- *pos = 0x0000;
- pos += width;
- }
- }
+ gint i;
+ guint16 *colstart;
+ gint16 *in;
+
+ GST_DEBUG
+ ("CHART: drawing frame to %p, width = %d, height = %d, src_data = %p, src_size = %d",
+ output, width, height, src_data, src_size);
+
+ for (colstart = (guint16 *) output, in = (gint16 *) src_data, i = 0;
+ i < width; colstart++, in++, i++) {
+ guint16 *pos = colstart;
+ gint h1;
+
+ h1 = (((gint) (*in)) * height / (1 << 16)) + height / 2;
+ if (h1 >= height)
+ h1 = height;
+
+ if (h1 < height / 2) {
+ while (pos < colstart + h1 * width) {
+ *pos = 0x0000;
+ pos += width;
+ }
+ while (pos < colstart + height / 2 * width) {
+ *pos = 0x07e0;
+ pos += width;
+ }
+ while (pos < colstart + height * width) {
+ *pos = 0x0000;
+ pos += width;
+ }
+ } else {
+ while (pos < colstart + height / 2 * width) {
+ *pos = 0x0000;
+ pos += width;
+ }
+ while (pos < colstart + h1 * width) {
+ *pos = 0x07e0;
+ pos += width;
+ }
+ while (pos < colstart + height * width) {
+ *pos = 0x0000;
+ pos += width;
+ }
}
+ }
}
static void
-gst_chart_chain (GstPad *pad, GstData *_data)
+gst_chart_chain (GstPad * pad, GstData * _data)
{
GstBuffer *bufin = GST_BUFFER (_data);
GstChart *chart;
@@ -302,14 +305,14 @@ gst_chart_chain (GstPad *pad, GstData *_data)
g_return_if_fail (bufin != NULL);
g_return_if_fail (pad != NULL);
- g_return_if_fail (GST_IS_PAD(pad));
- g_return_if_fail (GST_IS_CHART(GST_OBJECT_PARENT(pad)));
- chart = GST_CHART(GST_OBJECT_PARENT (pad));
+ g_return_if_fail (GST_IS_PAD (pad));
+ g_return_if_fail (GST_IS_CHART (GST_OBJECT_PARENT (pad)));
+ chart = GST_CHART (GST_OBJECT_PARENT (pad));
g_return_if_fail (chart != NULL);
GST_DEBUG ("CHART: chainfunc called");
- samples_in = GST_BUFFER_SIZE (bufin) / sizeof(gint16);
+ samples_in = GST_BUFFER_SIZE (bufin) / sizeof (gint16);
datain = (gint16 *) (GST_BUFFER_DATA (bufin));
GST_DEBUG ("input buffer has %d samples", samples_in);
if (chart->next_time <= GST_BUFFER_TIMESTAMP (bufin)) {
@@ -319,43 +322,45 @@ gst_chart_chain (GstPad *pad, GstData *_data)
chart->samples_since_last_frame += samples_in;
if (chart->samples_between_frames <= chart->samples_since_last_frame) {
- chart->samples_since_last_frame = 0;
-
- /* get data to draw into buffer */
- if (samples_in >= chart->width) {
- /* make a new buffer for the output */
- bufout = gst_buffer_new ();
- sizeout = chart->bpp / 8 * chart->width * chart->height;
- dataout = g_malloc (sizeout);
- GST_BUFFER_SIZE(bufout) = sizeout;
- GST_BUFFER_DATA(bufout) = dataout;
- GST_DEBUG ("CHART: made new buffer: size %d, width %d, height %d",
- sizeout, chart->width, chart->height);
-
- /* take data and draw to new buffer */
- /* FIXME: call different routines for different properties */
- draw_chart_16bpp(dataout, chart->width, chart->height, (gint16 *)datain, samples_in);
-
- gst_buffer_unref(bufin);
-
- /* set timestamp */
- GST_BUFFER_TIMESTAMP (bufout) = chart->next_time;
-
- GST_DEBUG ("CHART: outputting buffer");
- /* output buffer */
- GST_BUFFER_FLAG_SET (bufout, GST_BUFFER_READONLY);
- gst_pad_push (chart->srcpad, GST_DATA (bufout));
- }
+ chart->samples_since_last_frame = 0;
+
+ /* get data to draw into buffer */
+ if (samples_in >= chart->width) {
+ /* make a new buffer for the output */
+ bufout = gst_buffer_new ();
+ sizeout = chart->bpp / 8 * chart->width * chart->height;
+ dataout = g_malloc (sizeout);
+ GST_BUFFER_SIZE (bufout) = sizeout;
+ GST_BUFFER_DATA (bufout) = dataout;
+ GST_DEBUG ("CHART: made new buffer: size %d, width %d, height %d",
+ sizeout, chart->width, chart->height);
+
+ /* take data and draw to new buffer */
+ /* FIXME: call different routines for different properties */
+ draw_chart_16bpp (dataout, chart->width, chart->height, (gint16 *) datain,
+ samples_in);
+
+ gst_buffer_unref (bufin);
+
+ /* set timestamp */
+ GST_BUFFER_TIMESTAMP (bufout) = chart->next_time;
+
+ GST_DEBUG ("CHART: outputting buffer");
+ /* output buffer */
+ GST_BUFFER_FLAG_SET (bufout, GST_BUFFER_READONLY);
+ gst_pad_push (chart->srcpad, GST_DATA (bufout));
+ }
} else {
- GST_DEBUG ("CHART: skipping buffer");
- gst_buffer_unref(bufin);
+ GST_DEBUG ("CHART: skipping buffer");
+ gst_buffer_unref (bufin);
}
GST_DEBUG ("CHART: exiting chainfunc");
}
static void
-gst_chart_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
+gst_chart_set_property (GObject * object, guint prop_id, const GValue * value,
+ GParamSpec * pspec)
{
GstChart *chart;
@@ -370,7 +375,8 @@ gst_chart_set_property (GObject *object, guint prop_id, const GValue *value, GPa
}
static void
-gst_chart_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+gst_chart_get_property (GObject * object, guint prop_id, GValue * value,
+ GParamSpec * pspec)
{
GstChart *chart;
@@ -385,21 +391,16 @@ gst_chart_get_property (GObject *object, guint prop_id, GValue *value, GParamSpe
}
static gboolean
-plugin_init (GstPlugin *plugin)
+plugin_init (GstPlugin * plugin)
{
if (!gst_element_register (plugin, "chart", GST_RANK_NONE, GST_TYPE_CHART))
return FALSE;
-
+
return TRUE;
}
-GST_PLUGIN_DEFINE (
- GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "chart",
- "Takes frames of data and outputs video frames of a chart of data",
- plugin_init,
- VERSION,
- "LGPL",
- GST_PACKAGE,
- GST_ORIGIN)
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ "chart",
+ "Takes frames of data and outputs video frames of a chart of data",
+ plugin_init, VERSION, "LGPL", GST_PACKAGE, GST_ORIGIN)
diff --git a/gst/colorspace/gstcolorspace.c b/gst/colorspace/gstcolorspace.c
index db4056eb7..8ec6fe8aa 100644
--- a/gst/colorspace/gstcolorspace.c
+++ b/gst/colorspace/gstcolorspace.c
@@ -28,84 +28,80 @@
static GstColorspaceFormat gst_colorspace_formats[] = {
- { GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV("I420")) },
- { GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV("YV12")) },
- { GST_STATIC_CAPS (GST_VIDEO_CAPS_xRGB) },
- { GST_STATIC_CAPS (GST_VIDEO_CAPS_RGB) },
- { GST_STATIC_CAPS (GST_VIDEO_CAPS_RGB_16) },
+ {GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("I420"))},
+ {GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("YV12"))},
+ {GST_STATIC_CAPS (GST_VIDEO_CAPS_xRGB)},
+ {GST_STATIC_CAPS (GST_VIDEO_CAPS_RGB)},
+ {GST_STATIC_CAPS (GST_VIDEO_CAPS_RGB_16)},
};
static GstColorspaceConverter gst_colorspace_converters[] = {
- { GST_COLORSPACE_I420, GST_COLORSPACE_RGB32, gst_colorspace_I420_to_rgb32 },
- { GST_COLORSPACE_YV12, GST_COLORSPACE_RGB32, gst_colorspace_YV12_to_rgb32 },
- { GST_COLORSPACE_I420, GST_COLORSPACE_RGB24, gst_colorspace_I420_to_rgb24 },
- { GST_COLORSPACE_YV12, GST_COLORSPACE_RGB24, gst_colorspace_YV12_to_rgb24 },
- { GST_COLORSPACE_I420, GST_COLORSPACE_RGB16, gst_colorspace_I420_to_rgb16 },
- { GST_COLORSPACE_YV12, GST_COLORSPACE_RGB16, gst_colorspace_YV12_to_rgb16 },
+ {GST_COLORSPACE_I420, GST_COLORSPACE_RGB32, gst_colorspace_I420_to_rgb32},
+ {GST_COLORSPACE_YV12, GST_COLORSPACE_RGB32, gst_colorspace_YV12_to_rgb32},
+ {GST_COLORSPACE_I420, GST_COLORSPACE_RGB24, gst_colorspace_I420_to_rgb24},
+ {GST_COLORSPACE_YV12, GST_COLORSPACE_RGB24, gst_colorspace_YV12_to_rgb24},
+ {GST_COLORSPACE_I420, GST_COLORSPACE_RGB16, gst_colorspace_I420_to_rgb16},
+ {GST_COLORSPACE_YV12, GST_COLORSPACE_RGB16, gst_colorspace_YV12_to_rgb16},
};
-static GstElementDetails colorspace_details = GST_ELEMENT_DETAILS (
- "Colorspace converter",
- "Filter/Converter/Video",
- "Converts video from one colorspace to another",
- "Wim Taymans <wim.taymans@chello.be>"
-);
+static GstElementDetails colorspace_details =
+GST_ELEMENT_DETAILS ("Colorspace converter",
+ "Filter/Converter/Video",
+ "Converts video from one colorspace to another",
+ "Wim Taymans <wim.taymans@chello.be>");
static GstStaticPadTemplate gst_colorspace_sink_template =
-GST_STATIC_PAD_TEMPLATE (
- "sink",
+GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("{ I420, YV12 }"))
-);
+ );
static GstStaticPadTemplate gst_colorspace_src_template =
-GST_STATIC_PAD_TEMPLATE (
- "src",
+ GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_STATIC_CAPS (
- GST_VIDEO_CAPS_xRGB "; "
- GST_VIDEO_CAPS_BGRx "; "
- GST_VIDEO_CAPS_RGB "; "
- GST_VIDEO_CAPS_RGB_16
- )
-);
+ GST_STATIC_CAPS (GST_VIDEO_CAPS_xRGB "; "
+ GST_VIDEO_CAPS_BGRx "; " GST_VIDEO_CAPS_RGB "; " GST_VIDEO_CAPS_RGB_16)
+ );
/* Stereo signals and args */
-enum {
+enum
+{
/* FILL ME */
LAST_SIGNAL
};
-enum {
+enum
+{
ARG_0,
ARG_SOURCE,
ARG_DEST,
};
-static void gst_colorspace_base_init (gpointer g_class);
-static void gst_colorspace_class_init (GstColorspaceClass *klass);
-static void gst_colorspace_init (GstColorspace *space);
+static void gst_colorspace_base_init (gpointer g_class);
+static void gst_colorspace_class_init (GstColorspaceClass * klass);
+static void gst_colorspace_init (GstColorspace * space);
-static void gst_colorspace_set_property (GObject *object, guint prop_id,
- const GValue *value, GParamSpec *pspec);
-static void gst_colorspace_get_property (GObject *object, guint prop_id,
- GValue *value, GParamSpec *pspec);
+static void gst_colorspace_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec);
+static void gst_colorspace_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec);
static GstPadLinkReturn
- gst_colorspace_link (GstPad *pad, const GstCaps *caps);
-static void gst_colorspace_chain (GstPad *pad, GstData *_data);
-static GstElementStateReturn
- gst_colorspace_change_state (GstElement *element);
+gst_colorspace_link (GstPad * pad, const GstCaps * caps);
+static void gst_colorspace_chain (GstPad * pad, GstData * _data);
+static GstElementStateReturn gst_colorspace_change_state (GstElement * element);
static GstElementClass *parent_class = NULL;
+
/*static guint gst_colorspace_signals[LAST_SIGNAL] = { 0 }; */
#if 0
-static gboolean
-colorspace_setup_converter (GstColorspace *space, GstCaps *from_caps, GstCaps *to_caps)
+static gboolean
+colorspace_setup_converter (GstColorspace * space, GstCaps * from_caps,
+ GstCaps * to_caps)
{
guint32 from_space, to_space;
GstStructure *from_struct;
@@ -117,138 +113,142 @@ colorspace_setup_converter (GstColorspace *space, GstCaps *from_caps, GstCaps *t
from_struct = gst_caps_get_structure (from_caps, 0);
to_struct = gst_caps_get_structure (to_caps, 0);
- from_space = GST_MAKE_FOURCC ('R','G','B',' ');
+ from_space = GST_MAKE_FOURCC ('R', 'G', 'B', ' ');
gst_structure_get_fourcc (from_struct, "format", &from_space);
- to_space = GST_MAKE_FOURCC ('R','G','B',' ');
+ to_space = GST_MAKE_FOURCC ('R', 'G', 'B', ' ');
gst_structure_get_fourcc (to_struct, "format", &to_space);
- GST_INFO ("set up converter for " GST_FOURCC_FORMAT
- " (%08x) to " GST_FOURCC_FORMAT " (%08x)",
- GST_FOURCC_ARGS (from_space), from_space,
- GST_FOURCC_ARGS (to_space), to_space);
+ GST_INFO ("set up converter for " GST_FOURCC_FORMAT
+ " (%08x) to " GST_FOURCC_FORMAT " (%08x)",
+ GST_FOURCC_ARGS (from_space), from_space,
+ GST_FOURCC_ARGS (to_space), to_space);
switch (from_space) {
- case GST_MAKE_FOURCC ('R','G','B',' '):
+ case GST_MAKE_FOURCC ('R', 'G', 'B', ' '):
{
gint from_bpp;
-
+
gst_structure_get_int (from_struct, "bpp", &from_bpp);
switch (to_space) {
- case GST_MAKE_FOURCC ('R','G','B',' '):
+ case GST_MAKE_FOURCC ('R', 'G', 'B', ' '):
#ifdef HAVE_HERMES
- {
- gint to_bpp;
-
- gst_structure_get_int (to_struct, "bpp", &to_bpp);
+ {
+ gint to_bpp;
+
+ gst_structure_get_int (to_struct, "bpp", &to_bpp);
- gst_structure_get_int (from_struct, "red_mask", &space->source.r);
+ gst_structure_get_int (from_struct, "red_mask", &space->source.r);
gst_structure_get_int (from_struct, "green_mask", &space->source.g);
- gst_structure_get_int (from_struct, "blue_mask", &space->source.b);
+ gst_structure_get_int (from_struct, "blue_mask", &space->source.b);
space->source.a = 0;
space->srcbpp = space->source.bits = from_bpp;
space->source.indexed = 0;
space->source.has_colorkey = 0;
- GST_INFO ( "source red mask %08x", space->source.r);
- GST_INFO ( "source green mask %08x", space->source.g);
- GST_INFO ( "source blue mask %08x", space->source.b);
- GST_INFO ( "source bpp %08x", space->srcbpp);
+ GST_INFO ("source red mask %08x", space->source.r);
+ GST_INFO ("source green mask %08x", space->source.g);
+ GST_INFO ("source blue mask %08x", space->source.b);
+ GST_INFO ("source bpp %08x", space->srcbpp);
- gst_structure_get_int (to_struct, "red_mask", &space->dest.r);
+ gst_structure_get_int (to_struct, "red_mask", &space->dest.r);
gst_structure_get_int (to_struct, "green_mask", &space->dest.g);
- gst_structure_get_int (to_struct, "blue_mask", &space->dest.b);
+ gst_structure_get_int (to_struct, "blue_mask", &space->dest.b);
space->dest.a = 0;
space->destbpp = space->dest.bits = to_bpp;
space->dest.indexed = 0;
space->dest.has_colorkey = 0;
- GST_INFO ( "dest red mask %08x", space->dest.r);
- GST_INFO ( "dest green mask %08x", space->dest.g);
- GST_INFO ( "dest blue mask %08x", space->dest.b);
- GST_INFO ( "dest bpp %08x", space->destbpp);
+ GST_INFO ("dest red mask %08x", space->dest.r);
+ GST_INFO ("dest green mask %08x", space->dest.g);
+ GST_INFO ("dest blue mask %08x", space->dest.b);
+ GST_INFO ("dest bpp %08x", space->destbpp);
- if (!Hermes_ConverterRequest (space->h_handle, &space->source, &space->dest)) {
+ if (!Hermes_ConverterRequest (space->h_handle, &space->source,
+ &space->dest)) {
g_warning ("Hermes: could not get converter\n");
return FALSE;
}
- GST_INFO ( "converter set up");
- space->type = GST_COLORSPACE_HERMES;
+ GST_INFO ("converter set up");
+ space->type = GST_COLORSPACE_HERMES;
return TRUE;
}
#else
g_warning ("colorspace: compiled without hermes!");
return FALSE;
#endif
- case GST_MAKE_FOURCC ('Y','V','1','2'):
+ case GST_MAKE_FOURCC ('Y', 'V', '1', '2'):
if (from_bpp == 32) {
- space->type = GST_COLORSPACE_RGB32_YV12;
+ space->type = GST_COLORSPACE_RGB32_YV12;
space->destbpp = 12;
return TRUE;
}
- case GST_MAKE_FOURCC ('I','4','2','0'):
+ case GST_MAKE_FOURCC ('I', '4', '2', '0'):
if (from_bpp == 32) {
- space->type = GST_COLORSPACE_RGB32_I420;
+ space->type = GST_COLORSPACE_RGB32_I420;
space->destbpp = 12;
return TRUE;
}
- case GST_MAKE_FOURCC ('Y','U','Y','2'):
- GST_INFO ( "colorspace: RGB to YUV with bpp %d not implemented!!", from_bpp);
+ case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'):
+ GST_INFO ("colorspace: RGB to YUV with bpp %d not implemented!!",
+ from_bpp);
return FALSE;
}
break;
}
- case GST_MAKE_FOURCC ('I','4','2','0'):
+ case GST_MAKE_FOURCC ('I', '4', '2', '0'):
switch (to_space) {
- case GST_MAKE_FOURCC ('R','G','B',' '):
- GST_INFO ( "colorspace: YUV to RGB");
+ case GST_MAKE_FOURCC ('R', 'G', 'B', ' '):
+ GST_INFO ("colorspace: YUV to RGB");
gst_structure_get_int (to_struct, "bpp", &space->destbpp);
- space->converter = gst_colorspace_yuv2rgb_get_converter (from_caps, to_caps);
- space->type = GST_COLORSPACE_YUV_RGB;
+ space->converter =
+ gst_colorspace_yuv2rgb_get_converter (from_caps, to_caps);
+ space->type = GST_COLORSPACE_YUV_RGB;
return TRUE;
- case GST_MAKE_FOURCC ('I','4','2','0'):
- space->type = GST_COLORSPACE_NONE;
+ case GST_MAKE_FOURCC ('I', '4', '2', '0'):
+ space->type = GST_COLORSPACE_NONE;
space->destbpp = 12;
return TRUE;
- case GST_MAKE_FOURCC ('Y','V','1','2'):
- space->type = GST_COLORSPACE_420_SWAP;
+ case GST_MAKE_FOURCC ('Y', 'V', '1', '2'):
+ space->type = GST_COLORSPACE_420_SWAP;
space->destbpp = 12;
return TRUE;
}
break;
- case GST_MAKE_FOURCC ('Y','U','Y','2'):
+ case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'):
switch (to_space) {
- case GST_MAKE_FOURCC ('I','4','2','0'):
- space->type = GST_COLORSPACE_YUY2_I420;
+ case GST_MAKE_FOURCC ('I', '4', '2', '0'):
+ space->type = GST_COLORSPACE_YUY2_I420;
space->destbpp = 12;
return TRUE;
- case GST_MAKE_FOURCC ('Y','U','Y','2'):
- space->type = GST_COLORSPACE_NONE;
+ case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'):
+ space->type = GST_COLORSPACE_NONE;
space->destbpp = 16;
return TRUE;
- case GST_MAKE_FOURCC ('R','G','B',' '):
- GST_INFO ( "colorspace: YUY2 to RGB not implemented!!");
+ case GST_MAKE_FOURCC ('R', 'G', 'B', ' '):
+ GST_INFO ("colorspace: YUY2 to RGB not implemented!!");
return FALSE;
}
break;
- case GST_MAKE_FOURCC ('Y','V','1','2'):
+ case GST_MAKE_FOURCC ('Y', 'V', '1', '2'):
switch (to_space) {
- case GST_MAKE_FOURCC ('R','G','B',' '):
- GST_INFO ( "colorspace: YV12 to RGB");
+ case GST_MAKE_FOURCC ('R', 'G', 'B', ' '):
+ GST_INFO ("colorspace: YV12 to RGB");
gst_structure_get_int (to_struct, "bpp", &space->destbpp);
- space->converter = gst_colorspace_yuv2rgb_get_converter (from_caps, to_caps);
- space->type = GST_COLORSPACE_YUV_RGB;
+ space->converter =
+ gst_colorspace_yuv2rgb_get_converter (from_caps, to_caps);
+ space->type = GST_COLORSPACE_YUV_RGB;
return TRUE;
- case GST_MAKE_FOURCC ('I','4','2','0'):
- space->type = GST_COLORSPACE_420_SWAP;
+ case GST_MAKE_FOURCC ('I', '4', '2', '0'):
+ space->type = GST_COLORSPACE_420_SWAP;
space->destbpp = 12;
return TRUE;
- case GST_MAKE_FOURCC ('Y','V','1','2'):
- space->type = GST_COLORSPACE_NONE;
+ case GST_MAKE_FOURCC ('Y', 'V', '1', '2'):
+ space->type = GST_COLORSPACE_NONE;
space->destbpp = 12;
return TRUE;
}
@@ -259,13 +259,13 @@ colorspace_setup_converter (GstColorspace *space, GstCaps *from_caps, GstCaps *t
#endif
static GstCaps *
-gst_colorspace_caps_remove_format_info (GstCaps *caps, const char *media_type)
+gst_colorspace_caps_remove_format_info (GstCaps * caps, const char *media_type)
{
int i;
GstStructure *structure;
GstCaps *rgbcaps;
- for (i=0; i<gst_caps_get_size (caps); i++) {
+ for (i = 0; i < gst_caps_get_size (caps); i++) {
structure = gst_caps_get_structure (caps, i);
gst_structure_set_name (structure, media_type);
@@ -284,14 +284,14 @@ gst_colorspace_caps_remove_format_info (GstCaps *caps, const char *media_type)
return rgbcaps;
}
-static GstCaps*
-gst_colorspace_getcaps (GstPad *pad)
+static GstCaps *
+gst_colorspace_getcaps (GstPad * pad)
{
GstColorspace *space;
GstPad *otherpad;
GstCaps *othercaps;
GstCaps *caps;
-
+
space = GST_COLORSPACE (gst_pad_get_parent (pad));
otherpad = (pad == space->srcpad) ? space->sinkpad : space->srcpad;
@@ -308,16 +308,16 @@ gst_colorspace_getcaps (GstPad *pad)
}
static GstColorSpaceFormatType
-gst_colorspace_get_format (const GstCaps *caps)
+gst_colorspace_get_format (const GstCaps * caps)
{
int i;
- for(i=0; i<G_N_ELEMENTS (gst_colorspace_formats); i++) {
+ for (i = 0; i < G_N_ELEMENTS (gst_colorspace_formats); i++) {
GstCaps *icaps;
GstCaps *fcaps;
-
- fcaps = gst_caps_copy (gst_static_caps_get (
- &gst_colorspace_formats[i].caps));
+
+ fcaps =
+ gst_caps_copy (gst_static_caps_get (&gst_colorspace_formats[i].caps));
icaps = gst_caps_intersect (caps, fcaps);
if (!gst_caps_is_empty (icaps)) {
@@ -327,7 +327,7 @@ gst_colorspace_get_format (const GstCaps *caps)
gst_caps_free (icaps);
}
- g_assert_not_reached();
+ g_assert_not_reached ();
return -1;
}
@@ -336,7 +336,7 @@ gst_colorspace_get_format (const GstCaps *caps)
#define ROUND_UP_8(x) (((x)+7)&~7)
static int
-gst_colorspace_format_get_size(GstColorSpaceFormatType index, int width,
+gst_colorspace_format_get_size (GstColorSpaceFormatType index, int width,
int height)
{
int size;
@@ -345,22 +345,22 @@ gst_colorspace_format_get_size(GstColorSpaceFormatType index, int width,
case GST_COLORSPACE_I420:
case GST_COLORSPACE_YV12:
size = ROUND_UP_4 (width) * ROUND_UP_2 (height);
- size += ROUND_UP_8 (width)/2 * ROUND_UP_2 (height)/2;
- size += ROUND_UP_8 (width)/2 * ROUND_UP_2 (height)/2;
+ size += ROUND_UP_8 (width) / 2 * ROUND_UP_2 (height) / 2;
+ size += ROUND_UP_8 (width) / 2 * ROUND_UP_2 (height) / 2;
return size;
break;
case GST_COLORSPACE_RGB32:
- return width*height*4;
+ return width * height * 4;
break;
case GST_COLORSPACE_RGB24:
- return ROUND_UP_4 (width*3) * height;
+ return ROUND_UP_4 (width * 3) * height;
break;
case GST_COLORSPACE_RGB16:
- return ROUND_UP_4 (width*2) * height;
+ return ROUND_UP_4 (width * 2) * height;
break;
}
- g_assert_not_reached();
+ g_assert_not_reached ();
return 0;
}
@@ -370,18 +370,19 @@ gst_colorspace_get_converter (GstColorSpaceFormatType from,
{
int i;
- for (i=0; i<G_N_ELEMENTS (gst_colorspace_converters); i++) {
+ for (i = 0; i < G_N_ELEMENTS (gst_colorspace_converters); i++) {
GstColorspaceConverter *converter = gst_colorspace_converters + i;
+
if (from == converter->from && to == converter->to) {
return i;
}
}
- g_assert_not_reached();
+ g_assert_not_reached ();
return -1;
}
static GstPadLinkReturn
-gst_colorspace_link (GstPad *pad, const GstCaps *caps)
+gst_colorspace_link (GstPad * pad, const GstCaps * caps)
{
GstColorspace *space;
GstPad *otherpad;
@@ -402,23 +403,22 @@ gst_colorspace_link (GstPad *pad, const GstCaps *caps)
structure = gst_caps_get_structure (caps, 0);
format_index = gst_colorspace_get_format (caps);
- g_print("format index is %d\n", format_index);
+ g_print ("format index is %d\n", format_index);
gst_structure_get_int (structure, "width", &width);
gst_structure_get_int (structure, "height", &height);
gst_structure_get_double (structure, "framerate", &fps);
- GST_INFO ( "size: %dx%d", space->width, space->height);
+ GST_INFO ("size: %dx%d", space->width, space->height);
if (gst_pad_is_negotiated (otherpad)) {
GstCaps *othercaps;
-
+
othercaps = gst_caps_copy (gst_pad_get_negotiated_caps (otherpad));
gst_caps_set_simple (othercaps,
- "width", G_TYPE_INT, width,
- "height", G_TYPE_INT, height,
- "framerate", G_TYPE_DOUBLE, fps, NULL);
+ "width", G_TYPE_INT, width,
+ "height", G_TYPE_INT, height, "framerate", G_TYPE_DOUBLE, fps, NULL);
link_ret = gst_pad_try_set_caps (otherpad, othercaps);
if (link_ret != GST_PAD_LINK_OK) {
@@ -433,20 +433,20 @@ gst_colorspace_link (GstPad *pad, const GstCaps *caps)
}
if (gst_pad_is_negotiated (otherpad)) {
- space->converter_index = gst_colorspace_get_converter (
- space->sink_format_index, space->src_format_index);
+ space->converter_index =
+ gst_colorspace_get_converter (space->sink_format_index,
+ space->src_format_index);
- g_print("using index %d\n", space->converter_index);
+ g_print ("using index %d\n", space->converter_index);
- space->sink_size = gst_colorspace_format_get_size(space->sink_format_index,
- width,height);
- space->src_size = gst_colorspace_format_get_size(space->src_format_index,
- width,height);
+ space->sink_size = gst_colorspace_format_get_size (space->sink_format_index,
+ width, height);
+ space->src_size = gst_colorspace_format_get_size (space->src_format_index,
+ width, height);
space->width = width;
space->height = height;
space->fps = fps;
}
-
#if 0
if (gst_pad_is_negotiated (otherpad)) {
g_warning ("could not get converter\n");
@@ -464,17 +464,19 @@ gst_colorspace_get_type (void)
if (!colorspace_type) {
static const GTypeInfo colorspace_info = {
- sizeof(GstColorspaceClass),
+ sizeof (GstColorspaceClass),
gst_colorspace_base_init,
NULL,
- (GClassInitFunc)gst_colorspace_class_init,
+ (GClassInitFunc) gst_colorspace_class_init,
NULL,
NULL,
- sizeof(GstColorspace),
+ sizeof (GstColorspace),
0,
- (GInstanceInitFunc)gst_colorspace_init,
+ (GInstanceInitFunc) gst_colorspace_init,
};
- colorspace_type = g_type_register_static(GST_TYPE_ELEMENT, "GstColorspace", &colorspace_info, 0);
+ colorspace_type =
+ g_type_register_static (GST_TYPE_ELEMENT, "GstColorspace",
+ &colorspace_info, 0);
}
return colorspace_type;
}
@@ -483,54 +485,54 @@ static void
gst_colorspace_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_colorspace_src_template));
gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gst_colorspace_sink_template));
+ gst_static_pad_template_get (&gst_colorspace_sink_template));
gst_element_class_set_details (element_class, &colorspace_details);
}
-
+
static void
-gst_colorspace_class_init (GstColorspaceClass *klass)
+gst_colorspace_class_init (GstColorspaceClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
- gobject_class = (GObjectClass*)klass;
- gstelement_class = (GstElementClass*)klass;
+ gobject_class = (GObjectClass *) klass;
+ gstelement_class = (GstElementClass *) klass;
- parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
+ parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
gobject_class->set_property = gst_colorspace_set_property;
gobject_class->get_property = gst_colorspace_get_property;
gstelement_class->change_state = gst_colorspace_change_state;
- gst_colorspace_table_init(NULL);
+ gst_colorspace_table_init (NULL);
}
static void
-gst_colorspace_init (GstColorspace *space)
+gst_colorspace_init (GstColorspace * space)
{
- space->sinkpad = gst_pad_new_from_template (
- gst_static_pad_template_get (&gst_colorspace_sink_template),
- "sink");
+ space->sinkpad =
+ gst_pad_new_from_template (gst_static_pad_template_get
+ (&gst_colorspace_sink_template), "sink");
gst_pad_set_link_function (space->sinkpad, gst_colorspace_link);
gst_pad_set_getcaps_function (space->sinkpad, gst_colorspace_getcaps);
- gst_pad_set_chain_function(space->sinkpad,gst_colorspace_chain);
- gst_element_add_pad(GST_ELEMENT(space),space->sinkpad);
+ gst_pad_set_chain_function (space->sinkpad, gst_colorspace_chain);
+ gst_element_add_pad (GST_ELEMENT (space), space->sinkpad);
- space->srcpad = gst_pad_new_from_template (
- gst_static_pad_template_get (&gst_colorspace_src_template),
- "src");
- gst_element_add_pad(GST_ELEMENT(space),space->srcpad);
+ space->srcpad =
+ gst_pad_new_from_template (gst_static_pad_template_get
+ (&gst_colorspace_src_template), "src");
+ gst_element_add_pad (GST_ELEMENT (space), space->srcpad);
gst_pad_set_link_function (space->srcpad, gst_colorspace_link);
}
static void
-gst_colorspace_chain (GstPad *pad,GstData *_data)
+gst_colorspace_chain (GstPad * pad, GstData * _data)
{
GstBuffer *buf = GST_BUFFER (_data);
GstColorspace *space;
@@ -542,7 +544,7 @@ gst_colorspace_chain (GstPad *pad,GstData *_data)
g_return_if_fail (buf != NULL);
space = GST_COLORSPACE (gst_pad_get_parent (pad));
-
+
g_return_if_fail (space != NULL);
g_return_if_fail (GST_IS_COLORSPACE (space));
@@ -552,10 +554,9 @@ gst_colorspace_chain (GstPad *pad,GstData *_data)
outbuf = gst_pad_alloc_buffer (space->srcpad, GST_BUFFER_OFFSET_NONE,
space->src_size);
-
+
converter = gst_colorspace_converters + space->converter_index;
- converter->convert (space, GST_BUFFER_DATA (outbuf),
- GST_BUFFER_DATA (buf));
+ converter->convert (space, GST_BUFFER_DATA (outbuf), GST_BUFFER_DATA (buf));
GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (buf);
GST_BUFFER_DURATION (outbuf) = GST_BUFFER_DURATION (buf);
@@ -565,7 +566,7 @@ gst_colorspace_chain (GstPad *pad,GstData *_data)
}
static GstElementStateReturn
-gst_colorspace_change_state (GstElement *element)
+gst_colorspace_change_state (GstElement * element)
{
GstColorspace *space;
@@ -584,13 +585,14 @@ gst_colorspace_change_state (GstElement *element)
}
static void
-gst_colorspace_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
+gst_colorspace_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec)
{
GstColorspace *space;
/* it's not null if we got it, but it might not be ours */
- g_return_if_fail(GST_IS_COLORSPACE(object));
- space = GST_COLORSPACE(object);
+ g_return_if_fail (GST_IS_COLORSPACE (object));
+ space = GST_COLORSPACE (object);
switch (prop_id) {
default:
@@ -599,13 +601,14 @@ gst_colorspace_set_property (GObject *object, guint prop_id, const GValue *value
}
static void
-gst_colorspace_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+gst_colorspace_get_property (GObject * object, guint prop_id, GValue * value,
+ GParamSpec * pspec)
{
GstColorspace *space;
/* it's not null if we got it, but it might not be ours */
- g_return_if_fail(GST_IS_COLORSPACE(object));
- space = GST_COLORSPACE(object);
+ g_return_if_fail (GST_IS_COLORSPACE (object));
+ space = GST_COLORSPACE (object);
switch (prop_id) {
default:
@@ -615,22 +618,17 @@ gst_colorspace_get_property (GObject *object, guint prop_id, GValue *value, GPar
}
static gboolean
-plugin_init (GstPlugin *plugin)
+plugin_init (GstPlugin * plugin)
{
if (!gst_element_register (plugin, "colorspace", GST_RANK_PRIMARY,
- GST_TYPE_COLORSPACE))
+ GST_TYPE_COLORSPACE))
return FALSE;
return TRUE;
}
-GST_PLUGIN_DEFINE (
- GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "colorspace",
- "internal colorspace converter",
- plugin_init,
- VERSION,
- "LGPL",
- GST_PACKAGE,
- GST_ORIGIN)
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ "colorspace",
+ "internal colorspace converter",
+ plugin_init, VERSION, "LGPL", GST_PACKAGE, GST_ORIGIN)
diff --git a/gst/colorspace/gstcolorspace.h b/gst/colorspace/gstcolorspace.h
index 22e2f7ec9..f777b41b1 100644
--- a/gst/colorspace/gstcolorspace.h
+++ b/gst/colorspace/gstcolorspace.h
@@ -23,7 +23,6 @@
#include <gst/gst.h>
G_BEGIN_DECLS
-
#define GST_TYPE_COLORSPACE \
(gst_colorspace_get_type())
#define GST_COLORSPACE(obj) \
@@ -34,11 +33,11 @@ G_BEGIN_DECLS
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_COLORSPACE))
#define GST_IS_COLORSPACE_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_COLORSPACE))
-
typedef struct _GstColorspace GstColorspace;
typedef struct _GstColorspaceClass GstColorspaceClass;
-typedef enum {
+typedef enum
+{
GST_COLORSPACE_NONE,
GST_COLORSPACE_HERMES,
GST_COLORSPACE_YUV_RGB,
@@ -48,10 +47,11 @@ typedef enum {
GST_COLORSPACE_420_SWAP,
} GstColorSpaceConverterType;
-struct _GstColorspace {
+struct _GstColorspace
+{
GstElement element;
- GstPad *sinkpad,*srcpad;
+ GstPad *sinkpad, *srcpad;
int converter_index;
@@ -60,7 +60,7 @@ struct _GstColorspace {
int src_size;
int sink_size;
-
+
int src_stride;
int sink_stride;
@@ -68,18 +68,21 @@ struct _GstColorspace {
gdouble fps;
};
-struct _GstColorspaceClass {
+struct _GstColorspaceClass
+{
GstElementClass parent_class;
};
-GType gst_colorspace_get_type(void);
+GType gst_colorspace_get_type (void);
-typedef struct _GstColorspaceFormat {
+typedef struct _GstColorspaceFormat
+{
GstStaticCaps caps;
} GstColorspaceFormat;
-typedef enum {
+typedef enum
+{
GST_COLORSPACE_I420,
GST_COLORSPACE_YV12,
GST_COLORSPACE_RGB32,
@@ -87,13 +90,13 @@ typedef enum {
GST_COLORSPACE_RGB16,
} GstColorSpaceFormatType;
-typedef struct _GstColorspaceConverter {
+typedef struct _GstColorspaceConverter
+{
GstColorSpaceFormatType from;
GstColorSpaceFormatType to;
- void (*convert) (GstColorspace *colorspace, unsigned char *dest, unsigned char *src);
+ void (*convert) (GstColorspace * colorspace, unsigned char *dest,
+ unsigned char *src);
} GstColorspaceConverter;
G_END_DECLS
-
#endif
-
diff --git a/gst/colorspace/yuv2rgb.c b/gst/colorspace/yuv2rgb.c
index 3627e8962..37eaa628e 100644
--- a/gst/colorspace/yuv2rgb.c
+++ b/gst/colorspace/yuv2rgb.c
@@ -28,14 +28,14 @@
#undef HAVE_LIBMMX
-#ifdef HAVE_LIBMMX
+#ifdef HAVE_LIBMMX
#include <mmx.h>
#endif
-static int V_r_tab [256];
-static int V_g_tab [256];
-static int U_g_tab [256];
-static int U_b_tab [256];
+static int V_r_tab[256];
+static int V_g_tab[256];
+static int U_g_tab[256];
+static int U_b_tab[256];
#define CB_BASE 1
#define CR_BASE (CB_BASE*CB_RANGE)
@@ -59,75 +59,69 @@ static int U_b_tab [256];
: Max(-128.0, ((x) * chromaCorrect)))
-void gst_colorspace_I420_to_rgb16 (GstColorspace *space, unsigned char *src, unsigned char *dest);
-void gst_colorspace_I420_to_rgb24 (GstColorspace *space, unsigned char *src, unsigned char *dest);
-void gst_colorspace_I420_to_rgb32 (GstColorspace *space, unsigned char *src, unsigned char *dest);
+void gst_colorspace_I420_to_rgb16 (GstColorspace * space, unsigned char *src,
+ unsigned char *dest);
+void gst_colorspace_I420_to_rgb24 (GstColorspace * space, unsigned char *src,
+ unsigned char *dest);
+void gst_colorspace_I420_to_rgb32 (GstColorspace * space, unsigned char *src,
+ unsigned char *dest);
#ifdef HAVE_LIBMMX
-void gst_colorspace_I420_to_bgr16_mmx (GstColorspace *space, unsigned char *src, unsigned char *dest);
-void gst_colorspace_I420_to_bgr32_mmx (GstColorspace *space, unsigned char *src, unsigned char *dest);
+void gst_colorspace_I420_to_bgr16_mmx (GstColorspace * space,
+ unsigned char *src, unsigned char *dest);
+void gst_colorspace_I420_to_bgr32_mmx (GstColorspace * space,
+ unsigned char *src, unsigned char *dest);
#endif
-void gst_colorspace_YV12_to_rgb16 (GstColorspace *space, unsigned char *src, unsigned char *dest);
-void gst_colorspace_YV12_to_rgb24 (GstColorspace *space, unsigned char *src, unsigned char *dest);
-void gst_colorspace_YV12_to_rgb32 (GstColorspace *space, unsigned char *src, unsigned char *dest);
+void gst_colorspace_YV12_to_rgb16 (GstColorspace * space, unsigned char *src,
+ unsigned char *dest);
+void gst_colorspace_YV12_to_rgb24 (GstColorspace * space, unsigned char *src,
+ unsigned char *dest);
+void gst_colorspace_YV12_to_rgb32 (GstColorspace * space, unsigned char *src,
+ unsigned char *dest);
#ifdef HAVE_LIBMMX
-void gst_colorspace_YV12_to_bgr16_mmx (GstColorspace *space, unsigned char *src, unsigned char *dest);
-void gst_colorspace_YV12_to_bgr32_mmx (GstColorspace *space, unsigned char *src, unsigned char *dest);
+void gst_colorspace_YV12_to_bgr16_mmx (GstColorspace * space,
+ unsigned char *src, unsigned char *dest);
+void gst_colorspace_YV12_to_bgr32_mmx (GstColorspace * space,
+ unsigned char *src, unsigned char *dest);
#endif
static void
-gst_colorspace_yuv_to_rgb16(GstColorspace *space,
- unsigned char *out,
- unsigned char *lum,
- unsigned char *cr,
- unsigned char *cb,
- int cols, int rows);
+gst_colorspace_yuv_to_rgb16 (GstColorspace * space,
+ unsigned char *out,
+ unsigned char *lum,
+ unsigned char *cr, unsigned char *cb, int cols, int rows);
static void
-gst_colorspace_yuv_to_rgb24(GstColorspace *space,
- unsigned char *out,
- unsigned char *lum,
- unsigned char *cr,
- unsigned char *cb,
- int cols, int rows);
+gst_colorspace_yuv_to_rgb24 (GstColorspace * space,
+ unsigned char *out,
+ unsigned char *lum,
+ unsigned char *cr, unsigned char *cb, int cols, int rows);
static void
-gst_colorspace_yuv_to_rgb32(GstColorspace *space,
- unsigned char *out,
- unsigned char *lum,
- unsigned char *cr,
- unsigned char *cb,
- int cols, int rows);
+gst_colorspace_yuv_to_rgb32 (GstColorspace * space,
+ unsigned char *out,
+ unsigned char *lum,
+ unsigned char *cr, unsigned char *cb, int cols, int rows);
#if 0
-static void gst_colorspace_yuv_to_rgb16(GstColorspaceYUVTables *tables,
- unsigned char *lum,
- unsigned char *cr,
- unsigned char *cb,
- unsigned char *out,
- int cols, int rows);
-static void gst_colorspace_yuv_to_rgb24(GstColorspaceYUVTables *tables,
- unsigned char *lum,
- unsigned char *cr,
- unsigned char *cb,
- unsigned char *out,
- int cols, int rows);
-static void gst_colorspace_yuv_to_rgb32(GstColorspaceYUVTables *tables,
- unsigned char *lum,
- unsigned char *cr,
- unsigned char *cb,
- unsigned char *out,
- int cols, int rows);
+static void gst_colorspace_yuv_to_rgb16 (GstColorspaceYUVTables * tables,
+ unsigned char *lum,
+ unsigned char *cr,
+ unsigned char *cb, unsigned char *out, int cols, int rows);
+static void gst_colorspace_yuv_to_rgb24 (GstColorspaceYUVTables * tables,
+ unsigned char *lum,
+ unsigned char *cr,
+ unsigned char *cb, unsigned char *out, int cols, int rows);
+static void gst_colorspace_yuv_to_rgb32 (GstColorspaceYUVTables * tables,
+ unsigned char *lum,
+ unsigned char *cr,
+ unsigned char *cb, unsigned char *out, int cols, int rows);
#ifdef HAVE_LIBMMX
-void gst_colorspace_yuv_to_bgr32_mmx(GstColorspaceYUVTables *tables,
- unsigned char *lum,
- unsigned char *cr,
- unsigned char *cb,
- unsigned char *out,
- int cols, int rows);
-extern void gst_colorspace_yuv_to_bgr16_mmx(GstColorspaceYUVTables *tables,
- unsigned char *lum,
- unsigned char *cr,
- unsigned char *cb,
- unsigned char *out,
- int cols, int rows);
+void gst_colorspace_yuv_to_bgr32_mmx (GstColorspaceYUVTables * tables,
+ unsigned char *lum,
+ unsigned char *cr,
+ unsigned char *cb, unsigned char *out, int cols, int rows);
+extern void gst_colorspace_yuv_to_bgr16_mmx (GstColorspaceYUVTables * tables,
+ unsigned char *lum,
+ unsigned char *cr,
+ unsigned char *cb, unsigned char *out, int cols, int rows);
#endif
#endif
@@ -136,159 +130,163 @@ extern void gst_colorspace_yuv_to_bgr16_mmx(GstColorspaceYUVTables *tables,
#define ROUND_UP_8(x) (((x)+7)&~7)
-void gst_colorspace_I420_to_rgb32(GstColorspace *space, unsigned char *dest,
- unsigned char *src)
+void
+gst_colorspace_I420_to_rgb32 (GstColorspace * space, unsigned char *dest,
+ unsigned char *src)
{
unsigned char *src_U;
unsigned char *src_V;
src_U = src + ROUND_UP_4 (space->width) * ROUND_UP_2 (space->height);
- src_V = src_U + ROUND_UP_8 (space->width)/2 * ROUND_UP_2 (space->height)/2;
+ src_V =
+ src_U + ROUND_UP_8 (space->width) / 2 * ROUND_UP_2 (space->height) / 2;
- gst_colorspace_yuv_to_rgb32(space,
- dest,
- src, src_U, src_V,
- space->width, space->height);
+ gst_colorspace_yuv_to_rgb32 (space,
+ dest, src, src_U, src_V, space->width, space->height);
}
-void gst_colorspace_I420_to_rgb24(GstColorspace *space, unsigned char *dest,
- unsigned char *src)
+void
+gst_colorspace_I420_to_rgb24 (GstColorspace * space, unsigned char *dest,
+ unsigned char *src)
{
unsigned char *src_U;
unsigned char *src_V;
src_U = src + ROUND_UP_4 (space->width) * ROUND_UP_2 (space->height);
- src_V = src_U + ROUND_UP_8 (space->width)/2 * ROUND_UP_2 (space->height)/2;
+ src_V =
+ src_U + ROUND_UP_8 (space->width) / 2 * ROUND_UP_2 (space->height) / 2;
- gst_colorspace_yuv_to_rgb24(space,
- dest,
- src, src_U, src_V,
- space->width, space->height);
+ gst_colorspace_yuv_to_rgb24 (space,
+ dest, src, src_U, src_V, space->width, space->height);
}
-void gst_colorspace_I420_to_rgb16(GstColorspace *space, unsigned char *dest,
- unsigned char *src)
+void
+gst_colorspace_I420_to_rgb16 (GstColorspace * space, unsigned char *dest,
+ unsigned char *src)
{
unsigned char *src_U;
unsigned char *src_V;
src_U = src + ROUND_UP_4 (space->width) * ROUND_UP_2 (space->height);
- src_V = src_U + ROUND_UP_8 (space->width)/2 * ROUND_UP_2 (space->height)/2;
+ src_V =
+ src_U + ROUND_UP_8 (space->width) / 2 * ROUND_UP_2 (space->height) / 2;
- gst_colorspace_yuv_to_rgb16(space,
- dest,
- src, src_U, src_V,
- space->width, space->height);
+ gst_colorspace_yuv_to_rgb16 (space,
+ dest, src, src_U, src_V, space->width, space->height);
}
-void gst_colorspace_YV12_to_rgb32(GstColorspace *space, unsigned char *dest,
- unsigned char *src)
+void
+gst_colorspace_YV12_to_rgb32 (GstColorspace * space, unsigned char *dest,
+ unsigned char *src)
{
unsigned char *src_U;
unsigned char *src_V;
src_V = src + ROUND_UP_4 (space->width) * ROUND_UP_2 (space->height);
- src_U = src_V + ROUND_UP_8 (space->width)/2 * ROUND_UP_2 (space->height)/2;
+ src_U =
+ src_V + ROUND_UP_8 (space->width) / 2 * ROUND_UP_2 (space->height) / 2;
- gst_colorspace_yuv_to_rgb32(space,
- dest,
- src, src_U, src_V,
- space->width, space->height);
+ gst_colorspace_yuv_to_rgb32 (space,
+ dest, src, src_U, src_V, space->width, space->height);
}
-void gst_colorspace_YV12_to_rgb24(GstColorspace *space, unsigned char *dest,
- unsigned char *src)
+void
+gst_colorspace_YV12_to_rgb24 (GstColorspace * space, unsigned char *dest,
+ unsigned char *src)
{
unsigned char *src_U;
unsigned char *src_V;
src_V = src + ROUND_UP_4 (space->width) * ROUND_UP_2 (space->height);
- src_U = src_V + ROUND_UP_8 (space->width)/2 * ROUND_UP_2 (space->height)/2;
+ src_U =
+ src_V + ROUND_UP_8 (space->width) / 2 * ROUND_UP_2 (space->height) / 2;
- gst_colorspace_yuv_to_rgb24(space,
- dest,
- src, src_U, src_V,
- space->width, space->height);
+ gst_colorspace_yuv_to_rgb24 (space,
+ dest, src, src_U, src_V, space->width, space->height);
}
-void gst_colorspace_YV12_to_rgb16(GstColorspace *space, unsigned char *dest,
- unsigned char *src)
+void
+gst_colorspace_YV12_to_rgb16 (GstColorspace * space, unsigned char *dest,
+ unsigned char *src)
{
unsigned char *src_U;
unsigned char *src_V;
src_V = src + ROUND_UP_4 (space->width) * ROUND_UP_2 (space->height);
- src_U = src_V + ROUND_UP_8 (space->width)/2 * ROUND_UP_2 (space->height)/2;
+ src_U =
+ src_V + ROUND_UP_8 (space->width) / 2 * ROUND_UP_2 (space->height) / 2;
- gst_colorspace_yuv_to_rgb16(space,
- dest,
- src, src_U, src_V,
- space->width, space->height);
+ gst_colorspace_yuv_to_rgb16 (space,
+ dest, src, src_U, src_V, space->width, space->height);
}
#ifdef HAVE_LIBMMX
-void gst_colorspace_I420_to_bgr32_mmx(GstColorspace *space, unsigned char *src, unsigned char *dest) {
+void
+gst_colorspace_I420_to_bgr32_mmx (GstColorspace * space, unsigned char *src,
+ unsigned char *dest)
+{
int size;
+
GST_DEBUG ("gst_colorspace_I420_to_rgb32_mmx");
size = space->width * space->height;
- gst_colorspace_yuv_to_bgr32_mmx(NULL,
- src, /* Y component */
- src+size, /* cr component */
- src+size+(size>>2), /* cb component */
- dest,
- space->height,
- space->width);
+ gst_colorspace_yuv_to_bgr32_mmx (NULL, src, /* Y component */
+ src + size, /* cr component */
+ src + size + (size >> 2), /* cb component */
+ dest, space->height, space->width);
}
-void gst_colorspace_I420_to_bgr16_mmx(GstColorspace *space, unsigned char *src, unsigned char *dest) {
+void
+gst_colorspace_I420_to_bgr16_mmx (GstColorspace * space, unsigned char *src,
+ unsigned char *dest)
+{
int size;
+
GST_DEBUG ("gst_colorspace_I420_to_bgr16_mmx ");
size = space->width * space->height;
- gst_colorspace_yuv_to_bgr16_mmx(NULL,
- src, /* Y component */
- src+size, /* cr component */
- src+size+(size>>2), /* cb component */
- dest,
- space->height,
- space->width);
+ gst_colorspace_yuv_to_bgr16_mmx (NULL, src, /* Y component */
+ src + size, /* cr component */
+ src + size + (size >> 2), /* cb component */
+ dest, space->height, space->width);
GST_DEBUG ("gst_colorspace_I420_to_bgr16_mmx done");
}
-void gst_colorspace_YV12_to_bgr32_mmx(GstColorspace *space, unsigned char *src, unsigned char *dest) {
+void
+gst_colorspace_YV12_to_bgr32_mmx (GstColorspace * space, unsigned char *src,
+ unsigned char *dest)
+{
int size;
+
GST_DEBUG ("gst_colorspace_YV12_to_rgb32_mmx");
size = space->width * space->height;
- gst_colorspace_yuv_to_bgr32_mmx(NULL,
- src, /* Y component */
- src+size+(size>>2), /* cb component */
- src+size, /* cr component */
- dest,
- space->height,
- space->width);
+ gst_colorspace_yuv_to_bgr32_mmx (NULL, src, /* Y component */
+ src + size + (size >> 2), /* cb component */
+ src + size, /* cr component */
+ dest, space->height, space->width);
}
-void gst_colorspace_YV12_to_bgr16_mmx(GstColorspace *space, unsigned char *src, unsigned char *dest) {
+void
+gst_colorspace_YV12_to_bgr16_mmx (GstColorspace * space, unsigned char *src,
+ unsigned char *dest)
+{
int size;
+
GST_DEBUG ("gst_colorspace_YV12_to_bgr16_mmx ");
size = space->width * space->height;
- gst_colorspace_yuv_to_bgr16_mmx(NULL,
- src, /* Y component */
- src+size+(size>>2), /* cb component */
- src+size, /* cr component */
- dest,
- space->height,
- space->width);
+ gst_colorspace_yuv_to_bgr16_mmx (NULL, src, /* Y component */
+ src + size + (size >> 2), /* cb component */
+ src + size, /* cr component */
+ dest, space->height, space->width);
GST_DEBUG ("gst_colorspace_YV12_to_bgr16_mmx done");
}
@@ -299,12 +297,14 @@ void gst_colorspace_YV12_to_bgr16_mmx(GstColorspace *space, unsigned char *src,
*/
static int
-number_of_bits_set(a)
-unsigned long a;
+number_of_bits_set (a)
+ unsigned long a;
{
- if(!a) return 0;
- if(a & 1) return 1 + number_of_bits_set(a >> 1);
- return(number_of_bits_set(a >> 1));
+ if (!a)
+ return 0;
+ if (a & 1)
+ return 1 + number_of_bits_set (a >> 1);
+ return (number_of_bits_set (a >> 1));
}
/*
@@ -312,14 +312,16 @@ unsigned long a;
* Low performance, do not call often.
*/
static int
-free_bits_at_top(a)
-unsigned long a;
+free_bits_at_top (a)
+ unsigned long a;
{
- /* assume char is 8 bits */
- if(!a) return sizeof(unsigned long) * 8;
- /* assume twos complement */
- if(((long)a) < 0l) return 0;
- return 1 + free_bits_at_top ( a << 1);
+ /* assume char is 8 bits */
+ if (!a)
+ return sizeof (unsigned long) * 8;
+ /* assume twos complement */
+ if (((long) a) < 0l)
+ return 0;
+ return 1 + free_bits_at_top (a << 1);
}
/*
@@ -327,13 +329,15 @@ unsigned long a;
* Low performance, do not call often.
*/
static int
-free_bits_at_bottom(a)
-unsigned long a;
+free_bits_at_bottom (a)
+ unsigned long a;
{
- /* assume char is 8 bits */
- if(!a) return sizeof(unsigned long) * 8;
- if(((long)a) & 1l) return 0;
- return 1 + free_bits_at_bottom ( a >> 1);
+ /* assume char is 8 bits */
+ if (!a)
+ return sizeof (unsigned long) * 8;
+ if (((long) a) & 1l)
+ return 0;
+ return 1 + free_bits_at_bottom (a >> 1);
}
/*
@@ -354,367 +358,359 @@ unsigned long a;
*/
void
-gst_colorspace_table_init (GstColorspace *space)
+gst_colorspace_table_init (GstColorspace * space)
{
int i;
- for (i=0; i<256; i++) {
- V_r_tab[i] = (0.419/0.299) * (i-128);
- V_g_tab[i] = -(0.299/0.419) * (i-128);
- U_g_tab[i] = -(0.114/0.331) * (i-128);
- U_b_tab[i] = (0.587/0.331) * (i-128);
+ for (i = 0; i < 256; i++) {
+ V_r_tab[i] = (0.419 / 0.299) * (i - 128);
+ V_g_tab[i] = -(0.299 / 0.419) * (i - 128);
+ U_g_tab[i] = -(0.114 / 0.331) * (i - 128);
+ U_b_tab[i] = (0.587 / 0.331) * (i - 128);
}
#if 0
- int CR, CB, i;
- int *L_tab, *Cr_r_tab, *Cr_g_tab, *Cb_g_tab, *Cb_b_tab;
- long *r_2_pix_alloc;
- long *g_2_pix_alloc;
- long *b_2_pix_alloc;
- long depth = 32;
- long red_mask = 0xff0000;
- long green_mask = 0x00ff00;
- long blue_mask = 0x0000ff;
-
- L_tab = space->L_tab = (int *)malloc(256*sizeof(int));
- Cr_r_tab = space->Cr_r_tab = (int *)malloc(256*sizeof(int));
- Cr_g_tab = space->Cr_g_tab = (int *)malloc(256*sizeof(int));
- Cb_g_tab = space->Cb_g_tab = (int *)malloc(256*sizeof(int));
- Cb_b_tab = space->Cb_b_tab = (int *)malloc(256*sizeof(int));
-
- r_2_pix_alloc = (long *)malloc(768*sizeof(long));
- g_2_pix_alloc = (long *)malloc(768*sizeof(long));
- b_2_pix_alloc = (long *)malloc(768*sizeof(long));
-
- if (L_tab == NULL ||
- Cr_r_tab == NULL ||
- Cr_g_tab == NULL ||
- Cb_g_tab == NULL ||
- Cb_b_tab == NULL ||
- r_2_pix_alloc == NULL ||
- g_2_pix_alloc == NULL ||
- b_2_pix_alloc == NULL) {
- fprintf(stderr, "Could not get enough memory in InitColorDither\n");
- exit(1);
- }
+ int CR, CB, i;
+ int *L_tab, *Cr_r_tab, *Cr_g_tab, *Cb_g_tab, *Cb_b_tab;
+ long *r_2_pix_alloc;
+ long *g_2_pix_alloc;
+ long *b_2_pix_alloc;
+ long depth = 32;
+ long red_mask = 0xff0000;
+ long green_mask = 0x00ff00;
+ long blue_mask = 0x0000ff;
+
+ L_tab = space->L_tab = (int *) malloc (256 * sizeof (int));
+ Cr_r_tab = space->Cr_r_tab = (int *) malloc (256 * sizeof (int));
+ Cr_g_tab = space->Cr_g_tab = (int *) malloc (256 * sizeof (int));
+ Cb_g_tab = space->Cb_g_tab = (int *) malloc (256 * sizeof (int));
+ Cb_b_tab = space->Cb_b_tab = (int *) malloc (256 * sizeof (int));
+
+ r_2_pix_alloc = (long *) malloc (768 * sizeof (long));
+ g_2_pix_alloc = (long *) malloc (768 * sizeof (long));
+ b_2_pix_alloc = (long *) malloc (768 * sizeof (long));
+
+ if (L_tab == NULL ||
+ Cr_r_tab == NULL ||
+ Cr_g_tab == NULL ||
+ Cb_g_tab == NULL ||
+ Cb_b_tab == NULL ||
+ r_2_pix_alloc == NULL || g_2_pix_alloc == NULL || b_2_pix_alloc == NULL) {
+ fprintf (stderr, "Could not get enough memory in InitColorDither\n");
+ exit (1);
+ }
- for (i=0; i<256; i++) {
- L_tab[i] = i;
- /*
- if (gammaCorrectFlag) {
- L_tab[i] = GAMMA_CORRECTION(i);
- }
- */
-
- CB = CR = i;
- /*
- if (chromaCorrectFlag) {
- CB -= 128;
- CB = CHROMA_CORRECTION128(CB);
- CR -= 128;
- CR = CHROMA_CORRECTION128(CR);
- }
- else
- */
- {
- CB -= 128; CR -= 128;
- }
- Cr_r_tab[i] = (0.419/0.299) * CR;
- Cr_g_tab[i] = -(0.299/0.419) * CR;
- Cb_g_tab[i] = -(0.114/0.331) * CB;
- Cb_b_tab[i] = (0.587/0.331) * CB;
+ for (i = 0; i < 256; i++) {
+ L_tab[i] = i;
+ /*
+ if (gammaCorrectFlag) {
+ L_tab[i] = GAMMA_CORRECTION(i);
+ }
+ */
+ CB = CR = i;
+ /*
+ if (chromaCorrectFlag) {
+ CB -= 128;
+ CB = CHROMA_CORRECTION128(CB);
+ CR -= 128;
+ CR = CHROMA_CORRECTION128(CR);
+ }
+ else
+ */
+ {
+ CB -= 128;
+ CR -= 128;
}
+ Cr_r_tab[i] = (0.419 / 0.299) * CR;
+ Cr_g_tab[i] = -(0.299 / 0.419) * CR;
+ Cb_g_tab[i] = -(0.114 / 0.331) * CB;
+ Cb_b_tab[i] = (0.587 / 0.331) * CB;
- /*
- * Set up entries 0-255 in rgb-to-pixel value tables.
+ }
+
+ /*
+ * Set up entries 0-255 in rgb-to-pixel value tables.
+ */
+ for (i = 0; i < 256; i++) {
+ r_2_pix_alloc[i + 256] = i >> (8 - number_of_bits_set (red_mask));
+ r_2_pix_alloc[i + 256] <<= free_bits_at_bottom (red_mask);
+ g_2_pix_alloc[i + 256] = i >> (8 - number_of_bits_set (green_mask));
+ g_2_pix_alloc[i + 256] <<= free_bits_at_bottom (green_mask);
+ b_2_pix_alloc[i + 256] = i >> (8 - number_of_bits_set (blue_mask));
+ b_2_pix_alloc[i + 256] <<= free_bits_at_bottom (blue_mask);
+ /*
+ * If we have 16-bit output depth, then we double the value
+ * in the top word. This means that we can write out both
+ * pixels in the pixel doubling mode with one op. It is
+ * harmless in the normal case as storing a 32-bit value
+ * through a short pointer will lose the top bits anyway.
+ * A similar optimisation for Alpha for 64 bit has been
+ * prepared for, but is not yet implemented.
*/
- for (i = 0; i < 256; i++) {
- r_2_pix_alloc[i + 256] = i >> (8 - number_of_bits_set(red_mask));
- r_2_pix_alloc[i + 256] <<= free_bits_at_bottom(red_mask);
- g_2_pix_alloc[i + 256] = i >> (8 - number_of_bits_set(green_mask));
- g_2_pix_alloc[i + 256] <<= free_bits_at_bottom(green_mask);
- b_2_pix_alloc[i + 256] = i >> (8 - number_of_bits_set(blue_mask));
- b_2_pix_alloc[i + 256] <<= free_bits_at_bottom(blue_mask);
- /*
- * If we have 16-bit output depth, then we double the value
- * in the top word. This means that we can write out both
- * pixels in the pixel doubling mode with one op. It is
- * harmless in the normal case as storing a 32-bit value
- * through a short pointer will lose the top bits anyway.
- * A similar optimisation for Alpha for 64 bit has been
- * prepared for, but is not yet implemented.
- */
- if(!(depth == 32) && !(depth == 24)) {
-
- r_2_pix_alloc[i + 256] |= (r_2_pix_alloc[i + 256]) << 16;
- g_2_pix_alloc[i + 256] |= (g_2_pix_alloc[i + 256]) << 16;
- b_2_pix_alloc[i + 256] |= (b_2_pix_alloc[i + 256]) << 16;
-
- }
-#ifdef SIXTYFOUR_BIT
- if(depth == 32) {
+ if (!(depth == 32) && !(depth == 24)) {
- r_2_pix_alloc[i + 256] |= (r_2_pix_alloc[i + 256]) << 32;
- g_2_pix_alloc[i + 256] |= (g_2_pix_alloc[i + 256]) << 32;
- b_2_pix_alloc[i + 256] |= (b_2_pix_alloc[i + 256]) << 32;
+ r_2_pix_alloc[i + 256] |= (r_2_pix_alloc[i + 256]) << 16;
+ g_2_pix_alloc[i + 256] |= (g_2_pix_alloc[i + 256]) << 16;
+ b_2_pix_alloc[i + 256] |= (b_2_pix_alloc[i + 256]) << 16;
- }
-#endif
}
+#ifdef SIXTYFOUR_BIT
+ if (depth == 32) {
+
+ r_2_pix_alloc[i + 256] |= (r_2_pix_alloc[i + 256]) << 32;
+ g_2_pix_alloc[i + 256] |= (g_2_pix_alloc[i + 256]) << 32;
+ b_2_pix_alloc[i + 256] |= (b_2_pix_alloc[i + 256]) << 32;
- /*
- * Spread out the values we have to the rest of the array so that
- * we do not need to check for overflow.
- */
- for (i = 0; i < 256; i++) {
- r_2_pix_alloc[i] = r_2_pix_alloc[256];
- r_2_pix_alloc[i+ 512] = r_2_pix_alloc[511];
- g_2_pix_alloc[i] = g_2_pix_alloc[256];
- g_2_pix_alloc[i+ 512] = g_2_pix_alloc[511];
- b_2_pix_alloc[i] = b_2_pix_alloc[256];
- b_2_pix_alloc[i+ 512] = b_2_pix_alloc[511];
}
+#endif
+ }
+
+ /*
+ * Spread out the values we have to the rest of the array so that
+ * we do not need to check for overflow.
+ */
+ for (i = 0; i < 256; i++) {
+ r_2_pix_alloc[i] = r_2_pix_alloc[256];
+ r_2_pix_alloc[i + 512] = r_2_pix_alloc[511];
+ g_2_pix_alloc[i] = g_2_pix_alloc[256];
+ g_2_pix_alloc[i + 512] = g_2_pix_alloc[511];
+ b_2_pix_alloc[i] = b_2_pix_alloc[256];
+ b_2_pix_alloc[i + 512] = b_2_pix_alloc[511];
+ }
- space->r_2_pix = r_2_pix_alloc + 256;
- space->g_2_pix = g_2_pix_alloc + 256;
- space->b_2_pix = b_2_pix_alloc + 256;
+ space->r_2_pix = r_2_pix_alloc + 256;
+ space->g_2_pix = g_2_pix_alloc + 256;
+ space->b_2_pix = b_2_pix_alloc + 256;
#endif
}
static void
-gst_colorspace_yuv_to_rgb32(GstColorspace *space,
- unsigned char *dest,
- unsigned char *Y,
- unsigned char *U,
- unsigned char *V,
- int width, int height)
+gst_colorspace_yuv_to_rgb32 (GstColorspace * space,
+ unsigned char *dest,
+ unsigned char *Y, unsigned char *U, unsigned char *V, int width, int height)
{
- int x,y;
+ int x, y;
int src_rowstride;
int dest_rowstride;
src_rowstride = ROUND_UP_4 (space->width);
dest_rowstride = width * 4;
- for(y=0;y<height;y++){
- for(x=0;x<width;x++){
- dest[x*4 + 0] = 0;
- dest[x*3 + 1] = CLAMP (Y[x] + V_r_tab[V[x/2]], 0, 255);
- dest[x*3 + 2] = CLAMP (Y[x] + U_g_tab[U[x/2]] + V_g_tab[V[x/2]], 0, 255);
- dest[x*3 + 3] = CLAMP (Y[x] + U_b_tab[U[x/2]], 0, 255);
+ for (y = 0; y < height; y++) {
+ for (x = 0; x < width; x++) {
+ dest[x * 4 + 0] = 0;
+ dest[x * 3 + 1] = CLAMP (Y[x] + V_r_tab[V[x / 2]], 0, 255);
+ dest[x * 3 + 2] =
+ CLAMP (Y[x] + U_g_tab[U[x / 2]] + V_g_tab[V[x / 2]], 0, 255);
+ dest[x * 3 + 3] = CLAMP (Y[x] + U_b_tab[U[x / 2]], 0, 255);
}
Y += src_rowstride;
dest += dest_rowstride;
- if (y&1) {
- U += src_rowstride/2;
- V += src_rowstride/2;
+ if (y & 1) {
+ U += src_rowstride / 2;
+ V += src_rowstride / 2;
}
}
}
static void
-gst_colorspace_yuv_to_rgb24(GstColorspace *space,
- unsigned char *dest,
- unsigned char *Y,
- unsigned char *U,
- unsigned char *V,
- int width, int height)
+gst_colorspace_yuv_to_rgb24 (GstColorspace * space,
+ unsigned char *dest,
+ unsigned char *Y, unsigned char *U, unsigned char *V, int width, int height)
{
- int x,y;
+ int x, y;
int src_rowstride;
int dest_rowstride;
src_rowstride = ROUND_UP_4 (space->width);
dest_rowstride = ROUND_UP_4 (width * 3);
- for(y=0;y<height;y++){
- for(x=0;x<width;x++){
- dest[x*3 + 0] = CLAMP (Y[x] + V_r_tab[V[x/2]], 0, 255);
- dest[x*3 + 1] = CLAMP (Y[x] + U_g_tab[U[x/2]] + V_g_tab[V[x/2]], 0, 255);
- dest[x*3 + 2] = CLAMP (Y[x] + U_b_tab[U[x/2]], 0, 255);
+ for (y = 0; y < height; y++) {
+ for (x = 0; x < width; x++) {
+ dest[x * 3 + 0] = CLAMP (Y[x] + V_r_tab[V[x / 2]], 0, 255);
+ dest[x * 3 + 1] =
+ CLAMP (Y[x] + U_g_tab[U[x / 2]] + V_g_tab[V[x / 2]], 0, 255);
+ dest[x * 3 + 2] = CLAMP (Y[x] + U_b_tab[U[x / 2]], 0, 255);
}
Y += src_rowstride;
dest += dest_rowstride;
- if (y&1) {
- U += src_rowstride/2;
- V += src_rowstride/2;
+ if (y & 1) {
+ U += src_rowstride / 2;
+ V += src_rowstride / 2;
}
}
}
static void
-gst_colorspace_yuv_to_rgb16(GstColorspace *space,
- unsigned char *dest,
- unsigned char *Y,
- unsigned char *U,
- unsigned char *V,
- int width, int height)
+gst_colorspace_yuv_to_rgb16 (GstColorspace * space,
+ unsigned char *dest,
+ unsigned char *Y, unsigned char *U, unsigned char *V, int width, int height)
{
- int x,y;
+ int x, y;
int src_rowstride;
int dest_rowstride;
int r, g, b;
src_rowstride = ROUND_UP_4 (space->width);
dest_rowstride = ROUND_UP_4 (width * 2);
- for(y=0;y<height;y++){
- for(x=0;x<width;x++){
- r = CLAMP (Y[x] + V_r_tab[V[x/2]], 0, 255);
- g = CLAMP (Y[x] + U_g_tab[U[x/2]] + V_g_tab[V[x/2]], 0, 255);
- b = CLAMP (Y[x] + U_b_tab[U[x/2]], 0, 255);
- *(unsigned short *)(dest + x*2) = ((r&0xf8)<<8) | ((g&0xfc)<<3) | (b>>3);
+ for (y = 0; y < height; y++) {
+ for (x = 0; x < width; x++) {
+ r = CLAMP (Y[x] + V_r_tab[V[x / 2]], 0, 255);
+ g = CLAMP (Y[x] + U_g_tab[U[x / 2]] + V_g_tab[V[x / 2]], 0, 255);
+ b = CLAMP (Y[x] + U_b_tab[U[x / 2]], 0, 255);
+ *(unsigned short *) (dest + x * 2) =
+ ((r & 0xf8) << 8) | ((g & 0xfc) << 3) | (b >> 3);
}
Y += src_rowstride;
dest += dest_rowstride;
- if (y&1) {
- U += src_rowstride/2;
- V += src_rowstride/2;
+ if (y & 1) {
+ U += src_rowstride / 2;
+ V += src_rowstride / 2;
}
}
}
#ifdef HAVE_LIBMMX
-static mmx_t MMX_80w = (mmx_t)(long long)0x0080008000800080LL; /*dd 00080 0080h, 000800080h */
+static mmx_t MMX_80w = (mmx_t) (long long) 0x0080008000800080LL; /*dd 00080 0080h, 000800080h */
-static mmx_t MMX_00FFw = (mmx_t)(long long)0x00ff00ff00ff00ffLL; /*dd 000FF 00FFh, 000FF00FFh */
-static mmx_t MMX_FF00w = (mmx_t)(long long)0xff00ff00ff00ff00LL; /*dd 000FF 00FFh, 000FF00FFh */
+static mmx_t MMX_00FFw = (mmx_t) (long long) 0x00ff00ff00ff00ffLL; /*dd 000FF 00FFh, 000FF00FFh */
+static mmx_t MMX_FF00w = (mmx_t) (long long) 0xff00ff00ff00ff00LL; /*dd 000FF 00FFh, 000FF00FFh */
-static mmx_t MMX32_Vredcoeff = (mmx_t)(long long)0x0059005900590059LL;
-static mmx_t MMX32_Ubluecoeff = (mmx_t)(long long)0x0072007200720072LL;
-static mmx_t MMX32_Ugrncoeff = (mmx_t)(long long)0xffeaffeaffeaffeaLL;
-static mmx_t MMX32_Vgrncoeff = (mmx_t)(long long)0xffd2ffd2ffd2ffd2LL;
+static mmx_t MMX32_Vredcoeff = (mmx_t) (long long) 0x0059005900590059LL;
+static mmx_t MMX32_Ubluecoeff = (mmx_t) (long long) 0x0072007200720072LL;
+static mmx_t MMX32_Ugrncoeff = (mmx_t) (long long) 0xffeaffeaffeaffeaLL;
+static mmx_t MMX32_Vgrncoeff = (mmx_t) (long long) 0xffd2ffd2ffd2ffd2LL;
static void
-gst_colorspace_yuv_to_bgr32_mmx(tables, lum, cr, cb, out, rows, cols)
- GstColorspaceYUVTables *tables;
- unsigned char *lum;
- unsigned char *cr;
- unsigned char *cb;
- unsigned char *out;
- int cols, rows;
+gst_colorspace_yuv_to_bgr32_mmx (tables, lum, cr, cb, out, rows, cols)
+ GstColorspaceYUVTables *tables;
+ unsigned char *lum;
+ unsigned char *cr;
+ unsigned char *cb;
+ unsigned char *out;
+ int cols, rows;
{
- guint32 *row1 = (guint32 *)out; /* 32 bit target */
- int cols4 = cols>>2;
-
- int y, x;
-
- for (y=rows>>1; y; y--) {
- for (x=cols4; x; x--) {
-
- /* create Cr (result in mm1) */
- movd_m2r(*(mmx_t *)cb, mm1); /* 0 0 0 0 v3 v2 v1 v0 */
- pxor_r2r(mm7, mm7); /* 00 00 00 00 00 00 00 00 */
- movd_m2r(*(mmx_t *)lum, mm2); /* 0 0 0 0 l3 l2 l1 l0 */
- punpcklbw_r2r(mm7, mm1); /* 0 v3 0 v2 00 v1 00 v0 */
- punpckldq_r2r(mm1, mm1); /* 00 v1 00 v0 00 v1 00 v0 */
- psubw_m2r(MMX_80w, mm1); /* mm1-128:r1 r1 r0 r0 r1 r1 r0 r0 */
-
- /* create Cr_g (result in mm0) */
- movq_r2r(mm1, mm0); /* r1 r1 r0 r0 r1 r1 r0 r0 */
- pmullw_m2r(MMX32_Vgrncoeff, mm0); /* red*-46dec=0.7136*64 */
- pmullw_m2r(MMX32_Vredcoeff, mm1); /* red*89dec=1.4013*64 */
- psraw_i2r(6, mm0); /* red=red/64 */
- psraw_i2r(6, mm1); /* red=red/64 */
-
- /* create L1 L2 (result in mm2,mm4) */
- /* L2=lum+cols */
- movq_m2r(*(mmx_t *)(lum+cols),mm3); /* 0 0 0 0 L3 L2 L1 L0 */
- punpckldq_r2r(mm3, mm2); /* L3 L2 L1 L0 l3 l2 l1 l0 */
- movq_r2r(mm2, mm4); /* L3 L2 L1 L0 l3 l2 l1 l0 */
- pand_m2r(MMX_FF00w, mm2); /* L3 0 L1 0 l3 0 l1 0 */
- pand_m2r(MMX_00FFw, mm4); /* 0 L2 0 L0 0 l2 0 l0 */
- psrlw_i2r(8, mm2); /* 0 L3 0 L1 0 l3 0 l1 */
-
- /* create R (result in mm6) */
- movq_r2r(mm2, mm5); /* 0 L3 0 L1 0 l3 0 l1 */
- movq_r2r(mm4, mm6); /* 0 L2 0 L0 0 l2 0 l0 */
- paddsw_r2r(mm1, mm5); /* lum1+red:x R3 x R1 x r3 x r1 */
- paddsw_r2r(mm1, mm6); /* lum1+red:x R2 x R0 x r2 x r0 */
- packuswb_r2r(mm5, mm5); /* R3 R1 r3 r1 R3 R1 r3 r1 */
- packuswb_r2r(mm6, mm6); /* R2 R0 r2 r0 R2 R0 r2 r0 */
- pxor_r2r(mm7, mm7); /* 00 00 00 00 00 00 00 00 */
- punpcklbw_r2r(mm5, mm6); /* R3 R2 R1 R0 r3 r2 r1 r0 */
-
- /* create Cb (result in mm1) */
- movd_m2r(*(mmx_t *)cr, mm1); /* 0 0 0 0 u3 u2 u1 u0 */
- punpcklbw_r2r(mm7, mm1); /* 0 u3 0 u2 00 u1 00 u0 */
- punpckldq_r2r(mm1, mm1); /* 00 u1 00 u0 00 u1 00 u0 */
- psubw_m2r(MMX_80w, mm1); /* mm1-128:u1 u1 u0 u0 u1 u1 u0 u0 */
- /* create Cb_g (result in mm5) */
- movq_r2r(mm1, mm5); /* u1 u1 u0 u0 u1 u1 u0 u0 */
- pmullw_m2r(MMX32_Ugrncoeff, mm5); /* blue*-109dec=1.7129*64 */
- pmullw_m2r(MMX32_Ubluecoeff, mm1); /* blue*114dec=1.78125*64 */
- psraw_i2r(6, mm5); /* blue=red/64 */
- psraw_i2r(6, mm1); /* blue=blue/64 */
-
- /* create G (result in mm7) */
- movq_r2r(mm2, mm3); /* 0 L3 0 L1 0 l3 0 l1 */
- movq_r2r(mm4, mm7); /* 0 L2 0 L0 0 l2 0 l1 */
- paddsw_r2r(mm5, mm3); /* lum1+Cb_g:x G3t x G1t x g3t x g1t */
- paddsw_r2r(mm5, mm7); /* lum1+Cb_g:x G2t x G0t x g2t x g0t */
- paddsw_r2r(mm0, mm3); /* lum1+Cr_g:x G3 x G1 x g3 x g1 */
- paddsw_r2r(mm0, mm7); /* lum1+blue:x G2 x G0 x g2 x g0 */
- packuswb_r2r(mm3, mm3); /* G3 G1 g3 g1 G3 G1 g3 g1 */
- packuswb_r2r(mm7, mm7); /* G2 G0 g2 g0 G2 G0 g2 g0 */
- punpcklbw_r2r(mm3, mm7); /* G3 G2 G1 G0 g3 g2 g1 g0 */
-
- /* create B (result in mm5) */
- movq_r2r(mm2, mm3); /* 0 L3 0 L1 0 l3 0 l1 */
- movq_r2r(mm4, mm5); /* 0 L2 0 L0 0 l2 0 l1 */
- paddsw_r2r(mm1, mm3); /* lum1+blue:x B3 x B1 x b3 x b1 */
- paddsw_r2r(mm1, mm5); /* lum1+blue:x B2 x B0 x b2 x b0 */
- packuswb_r2r(mm3, mm3); /* B3 B1 b3 b1 B3 B1 b3 b1 */
- packuswb_r2r(mm5, mm5); /* B2 B0 b2 b0 B2 B0 b2 b0 */
- punpcklbw_r2r(mm3, mm5); /* B3 B2 B1 B0 b3 b2 b1 b0 */
-
- /* fill destination row1 (needed are mm6=Rr,mm7=Gg,mm5=Bb) */
-
- pxor_r2r(mm2, mm2); /* 0 0 0 0 0 0 0 0 */
- pxor_r2r(mm4, mm4); /* 0 0 0 0 0 0 0 0 */
- movq_r2r(mm6, mm1); /* R3 R2 R1 R0 r3 r2 r1 r0 */
- movq_r2r(mm5, mm3); /* B3 B2 B1 B0 b3 b2 b1 b0 */
- /* process lower lum */
- punpcklbw_r2r(mm4, mm1); /* 0 r3 0 r2 0 r1 0 r0 */
- punpcklbw_r2r(mm4, mm3); /* 0 b3 0 b2 0 b1 0 b0 */
- movq_r2r(mm1, mm2); /* 0 r3 0 r2 0 r1 0 r0 */
- movq_r2r(mm3, mm0); /* 0 b3 0 b2 0 b1 0 b0 */
- punpcklwd_r2r(mm1, mm3); /* 0 r1 0 b1 0 r0 0 b0 */
- punpckhwd_r2r(mm2, mm0); /* 0 r3 0 b3 0 r2 0 b2 */
-
- pxor_r2r(mm2, mm2); /* 0 0 0 0 0 0 0 0 */
- movq_r2r(mm7, mm1); /* G3 G2 G1 G0 g3 g2 g1 g0 */
- punpcklbw_r2r(mm1, mm2); /* g3 0 g2 0 g1 0 g0 0 */
- punpcklwd_r2r(mm4, mm2); /* 0 0 g1 0 0 0 g0 0 */
- por_r2r(mm3, mm2); /* 0 r1 g1 b1 0 r0 g0 b0 */
- movq_r2m(mm2, *(mmx_t *)row1); /* wrote out ! row1 */
-
- pxor_r2r(mm2, mm2); /* 0 0 0 0 0 0 0 0 */
- punpcklbw_r2r(mm1, mm4); /* g3 0 g2 0 g1 0 g0 0 */
- punpckhwd_r2r(mm2, mm4); /* 0 0 g3 0 0 0 g2 0 */
- por_r2r(mm0, mm4); /* 0 r3 g3 b3 0 r2 g2 b2 */
- movq_r2m(mm4, *(mmx_t *)(row1+2)); /* wrote out ! row1 */
-
- /* fill destination row2 (needed are mm6=Rr,mm7=Gg,mm5=Bb) */
- /* this can be done "destructive" */
- pxor_r2r(mm2, mm2); /* 0 0 0 0 0 0 0 0 */
- punpckhbw_r2r(mm2, mm6); /* 0 R3 0 R2 0 R1 0 R0 */
- punpckhbw_r2r(mm1, mm5); /* G3 B3 G2 B2 G1 B1 G0 B0 */
- movq_r2r(mm5, mm1); /* G3 B3 G2 B2 G1 B1 G0 B0 */
- punpcklwd_r2r(mm6, mm1); /* 0 R1 G1 B1 0 R0 G0 B0 */
- movq_r2m(mm1, *(mmx_t *)(row1+cols)); /* wrote out ! row2 */
- punpckhwd_r2r(mm6, mm5); /* 0 R3 G3 B3 0 R2 G2 B2 */
- movq_r2m(mm5, *(mmx_t *)(row1+cols+2)); /* wrote out ! row2 */
-
- lum+=4;
- cr+=2;
- cb+=2;
- row1 +=4;
- }
- lum += cols;
- row1 += cols;
+ guint32 *row1 = (guint32 *) out; /* 32 bit target */
+ int cols4 = cols >> 2;
+
+ int y, x;
+
+ for (y = rows >> 1; y; y--) {
+ for (x = cols4; x; x--) {
+
+ /* create Cr (result in mm1) */
+ movd_m2r (*(mmx_t *) cb, mm1); /* 0 0 0 0 v3 v2 v1 v0 */
+ pxor_r2r (mm7, mm7); /* 00 00 00 00 00 00 00 00 */
+ movd_m2r (*(mmx_t *) lum, mm2); /* 0 0 0 0 l3 l2 l1 l0 */
+ punpcklbw_r2r (mm7, mm1); /* 0 v3 0 v2 00 v1 00 v0 */
+ punpckldq_r2r (mm1, mm1); /* 00 v1 00 v0 00 v1 00 v0 */
+ psubw_m2r (MMX_80w, mm1); /* mm1-128:r1 r1 r0 r0 r1 r1 r0 r0 */
+
+ /* create Cr_g (result in mm0) */
+ movq_r2r (mm1, mm0); /* r1 r1 r0 r0 r1 r1 r0 r0 */
+ pmullw_m2r (MMX32_Vgrncoeff, mm0); /* red*-46dec=0.7136*64 */
+ pmullw_m2r (MMX32_Vredcoeff, mm1); /* red*89dec=1.4013*64 */
+ psraw_i2r (6, mm0); /* red=red/64 */
+ psraw_i2r (6, mm1); /* red=red/64 */
+
+ /* create L1 L2 (result in mm2,mm4) */
+ /* L2=lum+cols */
+ movq_m2r (*(mmx_t *) (lum + cols), mm3); /* 0 0 0 0 L3 L2 L1 L0 */
+ punpckldq_r2r (mm3, mm2); /* L3 L2 L1 L0 l3 l2 l1 l0 */
+ movq_r2r (mm2, mm4); /* L3 L2 L1 L0 l3 l2 l1 l0 */
+ pand_m2r (MMX_FF00w, mm2); /* L3 0 L1 0 l3 0 l1 0 */
+ pand_m2r (MMX_00FFw, mm4); /* 0 L2 0 L0 0 l2 0 l0 */
+ psrlw_i2r (8, mm2); /* 0 L3 0 L1 0 l3 0 l1 */
+
+ /* create R (result in mm6) */
+ movq_r2r (mm2, mm5); /* 0 L3 0 L1 0 l3 0 l1 */
+ movq_r2r (mm4, mm6); /* 0 L2 0 L0 0 l2 0 l0 */
+ paddsw_r2r (mm1, mm5); /* lum1+red:x R3 x R1 x r3 x r1 */
+ paddsw_r2r (mm1, mm6); /* lum1+red:x R2 x R0 x r2 x r0 */
+ packuswb_r2r (mm5, mm5); /* R3 R1 r3 r1 R3 R1 r3 r1 */
+ packuswb_r2r (mm6, mm6); /* R2 R0 r2 r0 R2 R0 r2 r0 */
+ pxor_r2r (mm7, mm7); /* 00 00 00 00 00 00 00 00 */
+ punpcklbw_r2r (mm5, mm6); /* R3 R2 R1 R0 r3 r2 r1 r0 */
+
+ /* create Cb (result in mm1) */
+ movd_m2r (*(mmx_t *) cr, mm1); /* 0 0 0 0 u3 u2 u1 u0 */
+ punpcklbw_r2r (mm7, mm1); /* 0 u3 0 u2 00 u1 00 u0 */
+ punpckldq_r2r (mm1, mm1); /* 00 u1 00 u0 00 u1 00 u0 */
+ psubw_m2r (MMX_80w, mm1); /* mm1-128:u1 u1 u0 u0 u1 u1 u0 u0 */
+ /* create Cb_g (result in mm5) */
+ movq_r2r (mm1, mm5); /* u1 u1 u0 u0 u1 u1 u0 u0 */
+ pmullw_m2r (MMX32_Ugrncoeff, mm5); /* blue*-109dec=1.7129*64 */
+ pmullw_m2r (MMX32_Ubluecoeff, mm1); /* blue*114dec=1.78125*64 */
+ psraw_i2r (6, mm5); /* blue=red/64 */
+ psraw_i2r (6, mm1); /* blue=blue/64 */
+
+ /* create G (result in mm7) */
+ movq_r2r (mm2, mm3); /* 0 L3 0 L1 0 l3 0 l1 */
+ movq_r2r (mm4, mm7); /* 0 L2 0 L0 0 l2 0 l1 */
+ paddsw_r2r (mm5, mm3); /* lum1+Cb_g:x G3t x G1t x g3t x g1t */
+ paddsw_r2r (mm5, mm7); /* lum1+Cb_g:x G2t x G0t x g2t x g0t */
+ paddsw_r2r (mm0, mm3); /* lum1+Cr_g:x G3 x G1 x g3 x g1 */
+ paddsw_r2r (mm0, mm7); /* lum1+blue:x G2 x G0 x g2 x g0 */
+ packuswb_r2r (mm3, mm3); /* G3 G1 g3 g1 G3 G1 g3 g1 */
+ packuswb_r2r (mm7, mm7); /* G2 G0 g2 g0 G2 G0 g2 g0 */
+ punpcklbw_r2r (mm3, mm7); /* G3 G2 G1 G0 g3 g2 g1 g0 */
+
+ /* create B (result in mm5) */
+ movq_r2r (mm2, mm3); /* 0 L3 0 L1 0 l3 0 l1 */
+ movq_r2r (mm4, mm5); /* 0 L2 0 L0 0 l2 0 l1 */
+ paddsw_r2r (mm1, mm3); /* lum1+blue:x B3 x B1 x b3 x b1 */
+ paddsw_r2r (mm1, mm5); /* lum1+blue:x B2 x B0 x b2 x b0 */
+ packuswb_r2r (mm3, mm3); /* B3 B1 b3 b1 B3 B1 b3 b1 */
+ packuswb_r2r (mm5, mm5); /* B2 B0 b2 b0 B2 B0 b2 b0 */
+ punpcklbw_r2r (mm3, mm5); /* B3 B2 B1 B0 b3 b2 b1 b0 */
+
+ /* fill destination row1 (needed are mm6=Rr,mm7=Gg,mm5=Bb) */
+
+ pxor_r2r (mm2, mm2); /* 0 0 0 0 0 0 0 0 */
+ pxor_r2r (mm4, mm4); /* 0 0 0 0 0 0 0 0 */
+ movq_r2r (mm6, mm1); /* R3 R2 R1 R0 r3 r2 r1 r0 */
+ movq_r2r (mm5, mm3); /* B3 B2 B1 B0 b3 b2 b1 b0 */
+ /* process lower lum */
+ punpcklbw_r2r (mm4, mm1); /* 0 r3 0 r2 0 r1 0 r0 */
+ punpcklbw_r2r (mm4, mm3); /* 0 b3 0 b2 0 b1 0 b0 */
+ movq_r2r (mm1, mm2); /* 0 r3 0 r2 0 r1 0 r0 */
+ movq_r2r (mm3, mm0); /* 0 b3 0 b2 0 b1 0 b0 */
+ punpcklwd_r2r (mm1, mm3); /* 0 r1 0 b1 0 r0 0 b0 */
+ punpckhwd_r2r (mm2, mm0); /* 0 r3 0 b3 0 r2 0 b2 */
+
+ pxor_r2r (mm2, mm2); /* 0 0 0 0 0 0 0 0 */
+ movq_r2r (mm7, mm1); /* G3 G2 G1 G0 g3 g2 g1 g0 */
+ punpcklbw_r2r (mm1, mm2); /* g3 0 g2 0 g1 0 g0 0 */
+ punpcklwd_r2r (mm4, mm2); /* 0 0 g1 0 0 0 g0 0 */
+ por_r2r (mm3, mm2); /* 0 r1 g1 b1 0 r0 g0 b0 */
+ movq_r2m (mm2, *(mmx_t *) row1); /* wrote out ! row1 */
+
+ pxor_r2r (mm2, mm2); /* 0 0 0 0 0 0 0 0 */
+ punpcklbw_r2r (mm1, mm4); /* g3 0 g2 0 g1 0 g0 0 */
+ punpckhwd_r2r (mm2, mm4); /* 0 0 g3 0 0 0 g2 0 */
+ por_r2r (mm0, mm4); /* 0 r3 g3 b3 0 r2 g2 b2 */
+ movq_r2m (mm4, *(mmx_t *) (row1 + 2)); /* wrote out ! row1 */
+
+ /* fill destination row2 (needed are mm6=Rr,mm7=Gg,mm5=Bb) */
+ /* this can be done "destructive" */
+ pxor_r2r (mm2, mm2); /* 0 0 0 0 0 0 0 0 */
+ punpckhbw_r2r (mm2, mm6); /* 0 R3 0 R2 0 R1 0 R0 */
+ punpckhbw_r2r (mm1, mm5); /* G3 B3 G2 B2 G1 B1 G0 B0 */
+ movq_r2r (mm5, mm1); /* G3 B3 G2 B2 G1 B1 G0 B0 */
+ punpcklwd_r2r (mm6, mm1); /* 0 R1 G1 B1 0 R0 G0 B0 */
+ movq_r2m (mm1, *(mmx_t *) (row1 + cols)); /* wrote out ! row2 */
+ punpckhwd_r2r (mm6, mm5); /* 0 R3 G3 B3 0 R2 G2 B2 */
+ movq_r2m (mm5, *(mmx_t *) (row1 + cols + 2)); /* wrote out ! row2 */
+
+ lum += 4;
+ cr += 2;
+ cb += 2;
+ row1 += 4;
}
+ lum += cols;
+ row1 += cols;
+ }
- emms();
+ emms ();
}
#endif
-
diff --git a/gst/colorspace/yuv2rgb.h b/gst/colorspace/yuv2rgb.h
index be173bca9..ec987dfc7 100644
--- a/gst/colorspace/yuv2rgb.h
+++ b/gst/colorspace/yuv2rgb.h
@@ -26,11 +26,11 @@
#include <gstcolorspace.h>
G_BEGIN_DECLS
-
#if 0
typedef struct _GstColorspaceYUVTables GstColorspaceYUVTables;
-struct _GstColorspaceYUVTables {
+struct _GstColorspaceYUVTables
+{
int gammaCorrectFlag;
double gammaCorrect;
int chromaCorrectFlag;
@@ -50,9 +50,11 @@ struct _GstColorspaceYUVTables {
typedef struct _GstColorspaceConverter GstColorspaceConverter;
-typedef void (*GstColorspaceConvertFunction) (GstColorspaceConverter *space, guchar *src, guchar *dest);
+typedef void (*GstColorspaceConvertFunction) (GstColorspaceConverter * space,
+ guchar * src, guchar * dest);
-struct _GstColorspaceConverter {
+struct _GstColorspaceConverter
+{
guint width;
guint height;
guint insize;
@@ -63,35 +65,34 @@ struct _GstColorspaceConverter {
};
#endif
-void gst_colorspace_table_init (GstColorspace *space);
+void gst_colorspace_table_init (GstColorspace * space);
-void gst_colorspace_I420_to_rgb32(GstColorspace *space,
+void gst_colorspace_I420_to_rgb32 (GstColorspace * space,
unsigned char *src, unsigned char *dest);
-void gst_colorspace_I420_to_rgb24(GstColorspace *space,
+void gst_colorspace_I420_to_rgb24 (GstColorspace * space,
unsigned char *src, unsigned char *dest);
-void gst_colorspace_I420_to_rgb16(GstColorspace *space,
+void gst_colorspace_I420_to_rgb16 (GstColorspace * space,
unsigned char *src, unsigned char *dest);
-void gst_colorspace_YV12_to_rgb32(GstColorspace *space,
+void gst_colorspace_YV12_to_rgb32 (GstColorspace * space,
unsigned char *src, unsigned char *dest);
-void gst_colorspace_YV12_to_rgb24(GstColorspace *space,
+void gst_colorspace_YV12_to_rgb24 (GstColorspace * space,
unsigned char *src, unsigned char *dest);
-void gst_colorspace_YV12_to_rgb16(GstColorspace *space,
+void gst_colorspace_YV12_to_rgb16 (GstColorspace * space,
unsigned char *src, unsigned char *dest);
#if 0
-GstColorspaceYUVTables * gst_colorspace_init_yuv(long depth,
+GstColorspaceYUVTables *gst_colorspace_init_yuv (long depth,
long red_mask, long green_mask, long blue_mask);
#endif
#if 0
-GstColorspaceConverter* gst_colorspace_yuv2rgb_get_converter (const GstCaps *from, const GstCaps *to);
+GstColorspaceConverter *gst_colorspace_yuv2rgb_get_converter (const GstCaps *
+ from, const GstCaps * to);
#define gst_colorspace_convert(converter, src, dest) \
(converter)->convert((converter), (src), (dest))
-void gst_colorspace_converter_destroy (GstColorspaceConverter *space);
+void gst_colorspace_converter_destroy (GstColorspaceConverter * space);
#endif
G_END_DECLS
-
#endif
-
diff --git a/gst/deinterlace/gstdeinterlace.c b/gst/deinterlace/gstdeinterlace.c
index 31cc7a9df..8b174e39a 100644
--- a/gst/deinterlace/gstdeinterlace.c
+++ b/gst/deinterlace/gstdeinterlace.c
@@ -28,21 +28,22 @@
#include "gstdeinterlace.h"
/* elementfactory information */
-static GstElementDetails deinterlace_details = GST_ELEMENT_DETAILS (
- "Deinterlace",
- "Filter/Effect/Video",
- "Deinterlace video",
- "Wim Taymans <wim.taymans@chello.be>"
-);
+static GstElementDetails deinterlace_details =
+GST_ELEMENT_DETAILS ("Deinterlace",
+ "Filter/Effect/Video",
+ "Deinterlace video",
+ "Wim Taymans <wim.taymans@chello.be>");
/* Filter signals and args */
-enum {
+enum
+{
/* FILL ME */
LAST_SIGNAL
};
-enum {
+enum
+{
ARG_0,
ARG_DI_ONLY,
ARG_BLEND,
@@ -51,108 +52,102 @@ enum {
};
static GstStaticPadTemplate deinterlace_src_factory =
-GST_STATIC_PAD_TEMPLATE (
- "src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ( GST_VIDEO_CAPS_YUV ("I420"))
-);
+GST_STATIC_PAD_TEMPLATE ("src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("I420"))
+ );
static GstStaticPadTemplate deinterlace_sink_factory =
-GST_STATIC_PAD_TEMPLATE (
- "sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ( GST_VIDEO_CAPS_YUV ("I420"))
-);
+GST_STATIC_PAD_TEMPLATE ("sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("I420"))
+ );
-static GType gst_deinterlace_get_type (void);
+static GType gst_deinterlace_get_type (void);
-static void gst_deinterlace_base_init (gpointer g_class);
-static void gst_deinterlace_class_init (GstDeInterlaceClass *klass);
-static void gst_deinterlace_init (GstDeInterlace *filter);
+static void gst_deinterlace_base_init (gpointer g_class);
+static void gst_deinterlace_class_init (GstDeInterlaceClass * klass);
+static void gst_deinterlace_init (GstDeInterlace * filter);
-static void gst_deinterlace_set_property (GObject *object, guint prop_id,
- const GValue *value, GParamSpec *pspec);
-static void gst_deinterlace_get_property (GObject *object, guint prop_id,
- GValue *value, GParamSpec *pspec);
+static void gst_deinterlace_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec);
+static void gst_deinterlace_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec);
-static void gst_deinterlace_chain (GstPad *pad, GstData *_data);
+static void gst_deinterlace_chain (GstPad * pad, GstData * _data);
static GstElementClass *parent_class = NULL;
+
/*static guint gst_filter_signals[LAST_SIGNAL] = { 0 }; */
static GType
-gst_deinterlace_get_type(void) {
+gst_deinterlace_get_type (void)
+{
static GType deinterlace_type = 0;
if (!deinterlace_type) {
static const GTypeInfo deinterlace_info = {
- sizeof(GstDeInterlaceClass),
+ sizeof (GstDeInterlaceClass),
gst_deinterlace_base_init,
NULL,
- (GClassInitFunc)gst_deinterlace_class_init,
+ (GClassInitFunc) gst_deinterlace_class_init,
NULL,
NULL,
- sizeof(GstDeInterlace),
+ sizeof (GstDeInterlace),
0,
- (GInstanceInitFunc)gst_deinterlace_init,
+ (GInstanceInitFunc) gst_deinterlace_init,
};
- deinterlace_type = g_type_register_static(GST_TYPE_ELEMENT, "GstDeInterlace", &deinterlace_info, 0);
+ deinterlace_type =
+ g_type_register_static (GST_TYPE_ELEMENT, "GstDeInterlace",
+ &deinterlace_info, 0);
}
return deinterlace_type;
}
static void
gst_deinterlace_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 (&deinterlace_src_factory));
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&deinterlace_sink_factory));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&deinterlace_src_factory));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&deinterlace_sink_factory));
gst_element_class_set_details (element_class, &deinterlace_details);
}
static void
-gst_deinterlace_class_init (GstDeInterlaceClass *klass)
+gst_deinterlace_class_init (GstDeInterlaceClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
- gobject_class = (GObjectClass*)klass;
- gstelement_class = (GstElementClass*)klass;
+ gobject_class = (GObjectClass *) klass;
+ gstelement_class = (GstElementClass *) klass;
- parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
+ parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
- g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_DI_ONLY,
- g_param_spec_boolean("di_area_only","di_area_only","di_area_only",
- TRUE,G_PARAM_READWRITE)); /* CHECKME */
- g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_BLEND,
- g_param_spec_boolean("blend","blend","blend",
- TRUE,G_PARAM_READWRITE)); /* CHECKME */
- g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_THRESHOLD,
- g_param_spec_int("threshold","threshold","threshold",
- G_MININT,G_MAXINT,0,G_PARAM_READWRITE)); /* CHECKME */
- g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_EDGE_DETECT,
- g_param_spec_int("edge_detect","edge_detect","edge_detect",
- G_MININT,G_MAXINT,0,G_PARAM_READWRITE)); /* CHECKME */
+ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DI_ONLY, g_param_spec_boolean ("di_area_only", "di_area_only", "di_area_only", TRUE, G_PARAM_READWRITE)); /* CHECKME */
+ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BLEND, g_param_spec_boolean ("blend", "blend", "blend", TRUE, G_PARAM_READWRITE)); /* CHECKME */
+ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_THRESHOLD, g_param_spec_int ("threshold", "threshold", "threshold", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */
+ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_EDGE_DETECT, g_param_spec_int ("edge_detect", "edge_detect", "edge_detect", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */
gobject_class->set_property = gst_deinterlace_set_property;
gobject_class->get_property = gst_deinterlace_get_property;
}
static GstPadLinkReturn
-gst_deinterlace_link (GstPad *pad, const GstCaps *caps)
+gst_deinterlace_link (GstPad * pad, const GstCaps * caps)
{
GstDeInterlace *filter;
GstStructure *structure;
GstPadLinkReturn ret;
- filter = GST_DEINTERLACE(gst_pad_get_parent (pad));
-
+ filter = GST_DEINTERLACE (gst_pad_get_parent (pad));
+
ret = gst_pad_try_set_caps (filter->srcpad, caps);
if (GST_PAD_LINK_FAILED (ret)) {
return ret;
@@ -162,29 +157,31 @@ gst_deinterlace_link (GstPad *pad, const GstCaps *caps)
gst_structure_get_int (structure, "width", &filter->width);
gst_structure_get_int (structure, "height", &filter->height);
- if (filter->picsize != (filter->width*filter->height)) {
- if (filter->src)
- g_free(filter->src);
- filter->picsize = filter->width*filter->height;
- filter->src = g_malloc(filter->picsize);
+ if (filter->picsize != (filter->width * filter->height)) {
+ if (filter->src)
+ g_free (filter->src);
+ filter->picsize = filter->width * filter->height;
+ filter->src = g_malloc (filter->picsize);
}
return GST_PAD_LINK_OK;
}
static void
-gst_deinterlace_init (GstDeInterlace *filter)
+gst_deinterlace_init (GstDeInterlace * filter)
{
- filter->sinkpad = gst_pad_new_from_template(
- gst_static_pad_template_get(&deinterlace_sink_factory),"sink");
- gst_pad_set_chain_function(filter->sinkpad,gst_deinterlace_chain);
- gst_pad_set_link_function(filter->sinkpad,gst_deinterlace_link);
- gst_element_add_pad(GST_ELEMENT(filter),filter->sinkpad);
-
- filter->srcpad = gst_pad_new_from_template(
- gst_static_pad_template_get(&deinterlace_src_factory),"src");
- gst_pad_set_link_function(filter->srcpad,gst_deinterlace_link);
- gst_element_add_pad(GST_ELEMENT(filter),filter->srcpad);
+ filter->sinkpad =
+ gst_pad_new_from_template (gst_static_pad_template_get
+ (&deinterlace_sink_factory), "sink");
+ gst_pad_set_chain_function (filter->sinkpad, gst_deinterlace_chain);
+ gst_pad_set_link_function (filter->sinkpad, gst_deinterlace_link);
+ gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
+
+ filter->srcpad =
+ gst_pad_new_from_template (gst_static_pad_template_get
+ (&deinterlace_src_factory), "src");
+ gst_pad_set_link_function (filter->srcpad, gst_deinterlace_link);
+ gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);
filter->show_deinterlaced_area_only = FALSE;
filter->blend = FALSE;
@@ -197,7 +194,7 @@ gst_deinterlace_init (GstDeInterlace *filter)
}
static void
-gst_deinterlace_chain (GstPad *pad, GstData *_data)
+gst_deinterlace_chain (GstPad * pad, GstData * _data)
{
GstBuffer *buf = GST_BUFFER (_data);
GstDeInterlace *filter;
@@ -228,14 +225,14 @@ gst_deinterlace_chain (GstPad *pad, GstData *_data)
yuvptr = GST_BUFFER_DATA (buf);
bShowDeinterlacedAreaOnly = filter->show_deinterlaced_area_only;
- memcpy(filter->src, yuvptr, filter->picsize);
+ memcpy (filter->src, yuvptr, filter->picsize);
- y_dst = yuvptr; /* dst y pointer */
- /* we should not change u,v because one u, v value stands for */
- /* 2 pixels per 2 lines = 4 pixel and we don't want to change */
- /* the color of */
+ y_dst = yuvptr; /* dst y pointer */
+ /* we should not change u,v because one u, v value stands for */
+ /* 2 pixels per 2 lines = 4 pixel and we don't want to change */
+ /* the color of */
- y_line = width;
+ y_line = width;
y_src = src;
iThreshold = iThreshold * iThreshold * 4;
@@ -244,10 +241,10 @@ gst_deinterlace_chain (GstPad *pad, GstData *_data)
iEdgeDetect = 180;
iEdgeDetect = iEdgeDetect * iEdgeDetect;
- y1 = 0; /* Avoid compiler warning. The value is not used. */
+ y1 = 0; /* Avoid compiler warning. The value is not used. */
for (x = 0; x < width; x++) {
psrc3 = y_src + x;
- y3 = *psrc3;
+ y3 = *psrc3;
psrc2 = psrc3 + y_line;
y2 = *psrc2;
pdst1 = y_dst + x;
@@ -260,48 +257,49 @@ gst_deinterlace_chain (GstPad *pad, GstData *_data)
y1 = y2;
y2 = y3;
if (y < height - 1) {
- y3 = *psrc3;
+ y3 = *psrc3;
} else {
- y3 = y1;
+ y3 = y1;
}
iInterlaceValue0 = iInterlaceValue1;
iInterlaceValue1 = iInterlaceValue2;
if (y < height)
- iInterlaceValue2 = ((y1 - y2) * (y3 - y2) -
- ((iEdgeDetect * (y1 - y3) * (y1 - y3)) >> 12))*10;
+ iInterlaceValue2 = ((y1 - y2) * (y3 - y2) -
+ ((iEdgeDetect * (y1 - y3) * (y1 - y3)) >> 12)) * 10;
else
- iInterlaceValue2 = 0;
-
- if (y > 0) {
- if (iInterlaceValue0 + 2 * iInterlaceValue1 + iInterlaceValue2 > iThreshold) {
- if (bBlend) {
- *pdst1 = (unsigned char)((y0 + 2*y1 + y2) >> 2);
- } else {
- /* this method seems to work better than blending if the */
- /* quality is pretty bad and the half pics don't fit together */
- if ((y % 2)==1) { /* if odd simply copy the value */
- *pdst1 = *psrc1;
- /**pdst1 = 0; // FIXME this is for adjusting an initial iThreshold */
- } else { /* even interpolate the even line (upper + lower)/2 */
- *pdst1 = (unsigned char)((y0 + y2) >> 1);
- /**pdst1 = 0; // FIXME this is for adjusting an initial iThreshold */
- }
- }
- } else {
- /* so we went below the treshold and therefore we don't have to */
- /* change anything */
- if (bShowDeinterlacedAreaOnly) {
- /* this is for testing to see how we should tune the treshhold */
- /* and shows as the things that haven't change because the */
- /* threshhold was to low?? (or shows that everything is ok :-) */
- *pdst1 = 0; /* blank the point and so the interlac area */
- } else {
- *pdst1 = *psrc1;
- }
- }
- pdst1 = pdst1 + y_line;
+ iInterlaceValue2 = 0;
+
+ if (y > 0) {
+ if (iInterlaceValue0 + 2 * iInterlaceValue1 + iInterlaceValue2 >
+ iThreshold) {
+ if (bBlend) {
+ *pdst1 = (unsigned char) ((y0 + 2 * y1 + y2) >> 2);
+ } else {
+ /* this method seems to work better than blending if the */
+ /* quality is pretty bad and the half pics don't fit together */
+ if ((y % 2) == 1) { /* if odd simply copy the value */
+ *pdst1 = *psrc1;
+ /**pdst1 = 0; // FIXME this is for adjusting an initial iThreshold */
+ } else { /* even interpolate the even line (upper + lower)/2 */
+ *pdst1 = (unsigned char) ((y0 + y2) >> 1);
+ /**pdst1 = 0; // FIXME this is for adjusting an initial iThreshold */
+ }
+ }
+ } else {
+ /* so we went below the treshold and therefore we don't have to */
+ /* change anything */
+ if (bShowDeinterlacedAreaOnly) {
+ /* this is for testing to see how we should tune the treshhold */
+ /* and shows as the things that haven't change because the */
+ /* threshhold was to low?? (or shows that everything is ok :-) */
+ *pdst1 = 0; /* blank the point and so the interlac area */
+ } else {
+ *pdst1 = *psrc1;
+ }
+ }
+ pdst1 = pdst1 + y_line;
}
}
}
@@ -310,17 +308,17 @@ gst_deinterlace_chain (GstPad *pad, GstData *_data)
}
static void
-gst_deinterlace_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
+gst_deinterlace_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec)
{
GstDeInterlace *filter;
/* it's not null if we got it, but it might not be ours */
- g_return_if_fail(GST_IS_DEINTERLACE(object));
+ g_return_if_fail (GST_IS_DEINTERLACE (object));
- filter = GST_DEINTERLACE(object);
+ filter = GST_DEINTERLACE (object);
- switch (prop_id)
- {
+ switch (prop_id) {
case ARG_DI_ONLY:
filter->show_deinterlaced_area_only = g_value_get_boolean (value);
break;
@@ -339,14 +337,15 @@ gst_deinterlace_set_property (GObject *object, guint prop_id, const GValue *valu
}
static void
-gst_deinterlace_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+gst_deinterlace_get_property (GObject * object, guint prop_id, GValue * value,
+ GParamSpec * pspec)
{
GstDeInterlace *filter;
/* it's not null if we got it, but it might not be ours */
- g_return_if_fail(GST_IS_DEINTERLACE(object));
+ g_return_if_fail (GST_IS_DEINTERLACE (object));
- filter = GST_DEINTERLACE(object);
+ filter = GST_DEINTERLACE (object);
switch (prop_id) {
case ARG_DI_ONLY:
@@ -368,22 +367,16 @@ gst_deinterlace_get_property (GObject *object, guint prop_id, GValue *value, GPa
}
static gboolean
-plugin_init (GstPlugin *plugin)
+plugin_init (GstPlugin * plugin)
{
- if (!gst_element_register (plugin, "deinterlace", GST_RANK_NONE, gst_deinterlace_get_type()))
+ if (!gst_element_register (plugin, "deinterlace", GST_RANK_NONE,
+ gst_deinterlace_get_type ()))
return FALSE;
return TRUE;
}
-GST_PLUGIN_DEFINE (
- GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "deinterlace",
- "Deinterlace video",
- plugin_init,
- VERSION,
- "LGPL",
- GST_PACKAGE,
- GST_ORIGIN
-);
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ "deinterlace",
+ "Deinterlace video", plugin_init, VERSION, "LGPL", GST_PACKAGE, GST_ORIGIN);
diff --git a/gst/deinterlace/gstdeinterlace.h b/gst/deinterlace/gstdeinterlace.h
index 272073196..13f3d66f0 100644
--- a/gst/deinterlace/gstdeinterlace.h
+++ b/gst/deinterlace/gstdeinterlace.h
@@ -26,7 +26,6 @@
/* #include <gst/meta/audioraw.h> */
G_BEGIN_DECLS
-
#define GST_TYPE_DEINTERLACE \
(gst_deinterlace_get_type())
#define GST_DEINTERLACE(obj) \
@@ -37,11 +36,11 @@ G_BEGIN_DECLS
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DEINTERLACE))
#define GST_IS_DEINTERLACE_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DEINTERLACE))
-
typedef struct _GstDeInterlace GstDeInterlace;
typedef struct _GstDeInterlaceClass GstDeInterlaceClass;
-struct _GstDeInterlace {
+struct _GstDeInterlace
+{
GstElement element;
GstPad *sinkpad, *srcpad;
@@ -50,8 +49,8 @@ struct _GstDeInterlace {
gboolean show_deinterlaced_area_only;
gboolean blend;
- gint threshold_blend; /* here we start blending */
- gint threshold; /* here we start interpolating TODO FIXME */
+ gint threshold_blend; /* here we start blending */
+ gint threshold; /* here we start interpolating TODO FIXME */
gint edge_detect;
gint picsize;
@@ -59,10 +58,10 @@ struct _GstDeInterlace {
};
-struct _GstDeInterlaceClass {
+struct _GstDeInterlaceClass
+{
GstElementClass parent_class;
};
G_END_DECLS
-
#endif /* __GST_DEINTERLACE_H__ */
diff --git a/gst/festival/gstfestival.c b/gst/festival/gstfestival.c
index d59a85186..977455bda 100644
--- a/gst/festival/gstfestival.c
+++ b/gst/festival/gstfestival.c
@@ -77,88 +77,86 @@
#include "gstfestival.h"
#include <gst/audio/audio.h>
-static void gst_festival_base_init (gpointer g_class);
-static void gst_festival_class_init (GstFestivalClass *klass);
-static void gst_festival_init (GstFestival *festival);
+static void gst_festival_base_init (gpointer g_class);
+static void gst_festival_class_init (GstFestivalClass * klass);
+static void gst_festival_init (GstFestival * festival);
-static void gst_festival_chain (GstPad *pad, GstData *_data);
-static GstElementStateReturn
- gst_festival_change_state (GstElement *element);
+static void gst_festival_chain (GstPad * pad, GstData * _data);
+static GstElementStateReturn gst_festival_change_state (GstElement * element);
-static FT_Info* festival_default_info (void);
-static char* socket_receive_file_to_buff (int fd,int *size);
-static char* client_accept_s_expr (int fd);
+static FT_Info *festival_default_info (void);
+static char *socket_receive_file_to_buff (int fd, int *size);
+static char *client_accept_s_expr (int fd);
/* elementfactory information */
-static GstElementDetails gst_festival_details = GST_ELEMENT_DETAILS (
- "Festival synthesizer",
- "Filter/Effect/Audio",
- "Synthesizes plain text into audio",
- "Wim Taymans <wim.taymans@chello.be>"
-);
+static GstElementDetails gst_festival_details =
+GST_ELEMENT_DETAILS ("Festival synthesizer",
+ "Filter/Effect/Audio",
+ "Synthesizes plain text into audio",
+ "Wim Taymans <wim.taymans@chello.be>");
static GstStaticPadTemplate sink_template_factory =
-GST_STATIC_PAD_TEMPLATE (
- "festival_sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ( "text/plain" )
-);
+GST_STATIC_PAD_TEMPLATE ("festival_sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("text/plain")
+ );
static GstStaticPadTemplate src_template_factory =
-GST_STATIC_PAD_TEMPLATE (
- "festival_src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ( "audio/x-raw-int, "
- "endianness = (int) BYTE_ORDER, "
- "signed = (boolean) TRUE, "
- "width = (int) 16, "
- "depth = (int) 16, "
- "rate = (int) 16000, "
- "channels = (int) 1"
- )
-);
+GST_STATIC_PAD_TEMPLATE ("festival_src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("audio/x-raw-int, "
+ "endianness = (int) BYTE_ORDER, "
+ "signed = (boolean) TRUE, "
+ "width = (int) 16, "
+ "depth = (int) 16, " "rate = (int) 16000, " "channels = (int) 1")
+ );
/* Festival signals and args */
-enum {
+enum
+{
/* FILL ME */
LAST_SIGNAL
};
-enum {
+enum
+{
ARG_0,
/* FILL ME */
};
static GstElementClass *parent_class = NULL;
+
/*static guint gst_festival_signals[LAST_SIGNAL] = { 0 }; */
GType
-gst_festival_get_type (void)
+gst_festival_get_type (void)
{
static GType festival_type = 0;
if (!festival_type) {
static const GTypeInfo festival_info = {
- sizeof(GstFestivalClass),
+ sizeof (GstFestivalClass),
gst_festival_base_init,
NULL,
(GClassInitFunc) gst_festival_class_init,
NULL,
NULL,
- sizeof(GstFestival),
+ sizeof (GstFestival),
0,
(GInstanceInitFunc) gst_festival_init,
};
- festival_type = g_type_register_static (GST_TYPE_ELEMENT, "GstFestival", &festival_info, 0);
+ festival_type =
+ g_type_register_static (GST_TYPE_ELEMENT, "GstFestival", &festival_info,
+ 0);
}
return festival_type;
}
static void
gst_festival_base_init (gpointer g_class)
-{
+{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
/* register src pads */
@@ -167,38 +165,40 @@ gst_festival_base_init (gpointer g_class)
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&src_template_factory));
- gst_element_class_set_details (element_class, &gst_festival_details);
+ gst_element_class_set_details (element_class, &gst_festival_details);
}
static void
-gst_festival_class_init (GstFestivalClass *klass)
+gst_festival_class_init (GstFestivalClass * klass)
{
GstElementClass *gstelement_class;
- gstelement_class = (GstElementClass*) klass;
+ gstelement_class = (GstElementClass *) klass;
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
gstelement_class->change_state = gst_festival_change_state;
}
-static void
-gst_festival_init (GstFestival *festival)
+static void
+gst_festival_init (GstFestival * festival)
{
- festival->sinkpad = gst_pad_new_from_template (
- gst_static_pad_template_get (&sink_template_factory), "sink");
+ festival->sinkpad =
+ gst_pad_new_from_template (gst_static_pad_template_get
+ (&sink_template_factory), "sink");
gst_pad_set_chain_function (festival->sinkpad, gst_festival_chain);
gst_element_add_pad (GST_ELEMENT (festival), festival->sinkpad);
- festival->srcpad = gst_pad_new_from_template (
- gst_static_pad_template_get (&src_template_factory), "src");
+ festival->srcpad =
+ gst_pad_new_from_template (gst_static_pad_template_get
+ (&src_template_factory), "src");
gst_element_add_pad (GST_ELEMENT (festival), festival->srcpad);
- festival->info = festival_default_info();
+ festival->info = festival_default_info ();
}
static void
-gst_festival_chain (GstPad *pad, GstData *_data)
+gst_festival_chain (GstPad * pad, GstData * _data)
{
GstBuffer *buf = GST_BUFFER (_data);
gchar *wavefile;
@@ -218,102 +218,98 @@ gst_festival_chain (GstPad *pad, GstData *_data)
festival = GST_FESTIVAL (gst_pad_get_parent (pad));
GST_DEBUG ("gst_festival_chain: got buffer in '%s'",
- gst_object_get_name (GST_OBJECT (festival)));
+ gst_object_get_name (GST_OBJECT (festival)));
+
+ fd = fdopen (dup (festival->info->server_fd), "wb");
- fd = fdopen(dup(festival->info->server_fd),"wb");
-
size = GST_BUFFER_SIZE (buf);
/* Copy text over to server, escaping any quotes */
- fprintf(fd,"(tts_textall \"\n");
- for (p=GST_BUFFER_DATA(buf); p && (*p != '\0') && size; p++, size--)
- {
+ fprintf (fd, "(tts_textall \"\n");
+ for (p = GST_BUFFER_DATA (buf); p && (*p != '\0') && size; p++, size--) {
if ((*p == '"') || (*p == '\\'))
- putc('\\',fd);
- putc(*p,fd);
+ putc ('\\', fd);
+ putc (*p, fd);
}
- fprintf(fd,"\" \"%s\")\n",festival->info->text_mode);
- fclose(fd);
+ fprintf (fd, "\" \"%s\")\n", festival->info->text_mode);
+ fclose (fd);
/* Read back info from server */
/* This assumes only one waveform will come back, also LP is unlikely */
wavefile = NULL;
do {
- for (n=0; n < 3; )
- n += read(festival->info->server_fd,ack+n,3-n);
+ for (n = 0; n < 3;)
+ n += read (festival->info->server_fd, ack + n, 3 - n);
ack[3] = '\0';
- if (strcmp(ack,"WV\n") == 0) /* receive a waveform */
- wavefile = socket_receive_file_to_buff (festival->info->server_fd, &filesize);
- else if (strcmp(ack,"LP\n") == 0) /* receive an s-expr */
- client_accept_s_expr(festival->info->server_fd);
- else if (strcmp(ack,"ER\n") == 0) /* server got an error */
- {
- fprintf(stderr,"festival_client: server returned error\n");
- break;
+ if (strcmp (ack, "WV\n") == 0) /* receive a waveform */
+ wavefile =
+ socket_receive_file_to_buff (festival->info->server_fd, &filesize);
+ else if (strcmp (ack, "LP\n") == 0) /* receive an s-expr */
+ client_accept_s_expr (festival->info->server_fd);
+ else if (strcmp (ack, "ER\n") == 0) { /* server got an error */
+ fprintf (stderr, "festival_client: server returned error\n");
+ break;
}
if (wavefile) {
outbuf = gst_buffer_new ();
GST_BUFFER_DATA (outbuf) = wavefile;
GST_BUFFER_SIZE (outbuf) = filesize;
-
+
gst_pad_push (festival->srcpad, GST_DATA (outbuf));
wavefile = NULL;
}
- } while (strcmp(ack,"OK\n") != 0);
-
+ } while (strcmp (ack, "OK\n") != 0);
+
gst_buffer_unref (buf);
}
-static FT_Info*
+static FT_Info *
festival_default_info (void)
{
FT_Info *info;
- info = (FT_Info *)malloc(1 * sizeof(FT_Info));
-
+
+ info = (FT_Info *) malloc (1 * sizeof (FT_Info));
+
info->server_host = FESTIVAL_DEFAULT_SERVER_HOST;
info->server_port = FESTIVAL_DEFAULT_SERVER_PORT;
info->text_mode = FESTIVAL_DEFAULT_TEXT_MODE;
info->server_fd = -1;
-
+
return info;
}
static int
festival_socket_open (const char *host, int port)
-{
- /* Return an FD to a remote server */
+{
+ /* Return an FD to a remote server */
struct sockaddr_in serv_addr;
struct hostent *serverhost;
int fd;
- fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
+ fd = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
- if (fd < 0)
- {
- fprintf(stderr,"festival_client: can't get socket\n");
+ if (fd < 0) {
+ fprintf (stderr, "festival_client: can't get socket\n");
return -1;
}
- memset(&serv_addr, 0, sizeof(serv_addr));
- if ((serv_addr.sin_addr.s_addr = inet_addr(host)) == -1)
- {
+ memset (&serv_addr, 0, sizeof (serv_addr));
+ if ((serv_addr.sin_addr.s_addr = inet_addr (host)) == -1) {
/* its a name rather than an ipnum */
- serverhost = gethostbyname(host);
- if (serverhost == (struct hostent *)0)
- {
- fprintf(stderr,"festival_client: gethostbyname failed\n");
+ serverhost = gethostbyname (host);
+ if (serverhost == (struct hostent *) 0) {
+ fprintf (stderr, "festival_client: gethostbyname failed\n");
return -1;
}
- memmove(&serv_addr.sin_addr,serverhost->h_addr, serverhost->h_length);
+ memmove (&serv_addr.sin_addr, serverhost->h_addr, serverhost->h_length);
}
serv_addr.sin_family = AF_INET;
- serv_addr.sin_port = htons(port);
+ serv_addr.sin_port = htons (port);
- if (connect(fd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) != 0)
- {
- fprintf(stderr,"festival_client: connect to server failed\n");
+ if (connect (fd, (struct sockaddr *) &serv_addr, sizeof (serv_addr)) != 0) {
+ fprintf (stderr, "festival_client: connect to server failed\n");
return -1;
}
@@ -321,58 +317,57 @@ festival_socket_open (const char *host, int port)
}
-static char*
+static char *
client_accept_s_expr (int fd)
{
/* Read s-expression from server, as a char * */
char *expr;
int filesize;
- expr = socket_receive_file_to_buff(fd,&filesize);
+ expr = socket_receive_file_to_buff (fd, &filesize);
expr[filesize] = '\0';
return expr;
}
-static char*
+static char *
socket_receive_file_to_buff (int fd, int *size)
{
/* Receive file (probably a waveform file) from socket using */
/* Festival key stuff technique, but long winded I know, sorry */
/* but will receive any file without closeing the stream or */
/* using OOB data */
- static const char *file_stuff_key = "ft_StUfF_key"; /* must == Festival's key */
+ static const char *file_stuff_key = "ft_StUfF_key"; /* must == Festival's key */
char *buff;
int bufflen;
- int n,k,i;
+ int n, k, i;
char c;
bufflen = 1024;
- buff = (char *)malloc(bufflen);
- *size=0;
-
- for (k=0; file_stuff_key[k] != '\0';)
- {
- n = read(fd,&c,1);
- if (n==0) break; /* hit stream eof before end of file */
- if ((*size)+k+1 >= bufflen) {
+ buff = (char *) malloc (bufflen);
+ *size = 0;
+
+ for (k = 0; file_stuff_key[k] != '\0';) {
+ n = read (fd, &c, 1);
+ if (n == 0)
+ break; /* hit stream eof before end of file */
+ if ((*size) + k + 1 >= bufflen) {
/* +1 so you can add a NULL if you want */
- bufflen += bufflen/4;
- buff = (char *)realloc(buff,bufflen);
+ bufflen += bufflen / 4;
+ buff = (char *) realloc (buff, bufflen);
}
if (file_stuff_key[k] == c)
k++;
- else if ((c == 'X') && (file_stuff_key[k+1] == '\0')) {
+ else if ((c == 'X') && (file_stuff_key[k + 1] == '\0')) {
/* It looked like the key but wasn't */
- for (i=0; i < k; i++,(*size)++)
- buff[*size] = file_stuff_key[i];
- k=0;
+ for (i = 0; i < k; i++, (*size)++)
+ buff[*size] = file_stuff_key[i];
+ k = 0;
/* omit the stuffed 'X' */
- }
- else {
- for (i=0; i < k; i++,(*size)++)
- buff[*size] = file_stuff_key[i];
- k=0;
+ } else {
+ for (i = 0; i < k; i++, (*size)++)
+ buff[*size] = file_stuff_key[i];
+ k = 0;
buff[*size] = c;
(*size)++;
}
@@ -386,14 +381,15 @@ socket_receive_file_to_buff (int fd, int *size)
/***********************************************************************/
static gboolean
-gst_festival_open (GstFestival *festival)
+gst_festival_open (GstFestival * festival)
{
/* Open socket to server */
if (festival->info == NULL)
- festival->info = festival_default_info();
+ festival->info = festival_default_info ();
- festival->info->server_fd =
- festival_socket_open(festival->info->server_host, festival->info->server_port);
+ festival->info->server_fd =
+ festival_socket_open (festival->info->server_host,
+ festival->info->server_port);
if (festival->info->server_fd == -1)
return FALSE;
@@ -401,19 +397,19 @@ gst_festival_open (GstFestival *festival)
}
static void
-gst_festival_close (GstFestival *festival)
+gst_festival_close (GstFestival * festival)
{
if (festival->info == NULL)
return;
if (festival->info->server_fd != -1)
- close(festival->info->server_fd);
+ close (festival->info->server_fd);
return;
}
static GstElementStateReturn
-gst_festival_change_state (GstElement *element)
+gst_festival_change_state (GstElement * element)
{
g_return_val_if_fail (GST_IS_FESTIVAL (element), GST_STATE_FAILURE);
@@ -423,7 +419,7 @@ gst_festival_change_state (GstElement *element)
} else {
if (!GST_FLAG_IS_SET (element, GST_FESTIVAL_OPEN)) {
if (!gst_festival_open (GST_FESTIVAL (element)))
- return GST_STATE_FAILURE;
+ return GST_STATE_FAILURE;
}
}
@@ -434,22 +430,17 @@ gst_festival_change_state (GstElement *element)
}
static gboolean
-plugin_init (GstPlugin *plugin)
+plugin_init (GstPlugin * plugin)
{
- if (!gst_element_register (plugin, "festival", GST_RANK_NONE, GST_TYPE_FESTIVAL))
+ if (!gst_element_register (plugin, "festival", GST_RANK_NONE,
+ GST_TYPE_FESTIVAL))
return FALSE;
return TRUE;
}
-GST_PLUGIN_DEFINE (
- GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "festival",
- "Synthesizes plain text into audio",
- plugin_init,
- VERSION,
- "LGPL",
- GST_PACKAGE,
- GST_ORIGIN
-);
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ "festival",
+ "Synthesizes plain text into audio",
+ plugin_init, VERSION, "LGPL", GST_PACKAGE, GST_ORIGIN);
diff --git a/gst/festival/gstfestival.h b/gst/festival/gstfestival.h
index ab463106b..6c649e177 100644
--- a/gst/festival/gstfestival.h
+++ b/gst/festival/gstfestival.h
@@ -64,23 +64,24 @@
#include <gst/gst.h>
#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
+extern "C"
+{
+#endif /* __cplusplus */
#define FESTIVAL_DEFAULT_SERVER_HOST "localhost"
#define FESTIVAL_DEFAULT_SERVER_PORT 1314
#define FESTIVAL_DEFAULT_TEXT_MODE "fundamental"
-typedef struct FT_Info
-{
+ typedef struct FT_Info
+ {
int encoding;
char *server_host;
int server_port;
char *text_mode;
-
+
int server_fd;
-} FT_Info;
+ } FT_Info;
#define GST_TYPE_FESTIVAL \
(gst_festival_get_type())
@@ -93,32 +94,35 @@ typedef struct FT_Info
#define GST_IS_FESTIVAL_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_FESTIVAL))
-typedef enum {
- GST_FESTIVAL_OPEN = GST_ELEMENT_FLAG_LAST,
+ typedef enum
+ {
+ GST_FESTIVAL_OPEN = GST_ELEMENT_FLAG_LAST,
- GST_FESTIVAL_FLAG_LAST = GST_ELEMENT_FLAG_LAST + 2,
-} GstFestivalFlags;
+ GST_FESTIVAL_FLAG_LAST = GST_ELEMENT_FLAG_LAST + 2,
+ } GstFestivalFlags;
-typedef struct _GstFestival GstFestival;
-typedef struct _GstFestivalClass GstFestivalClass;
+ typedef struct _GstFestival GstFestival;
+ typedef struct _GstFestivalClass GstFestivalClass;
-struct _GstFestival {
- GstElement element;
+ struct _GstFestival
+ {
+ GstElement element;
- /* pads */
- GstPad *sinkpad,*srcpad;
+ /* pads */
+ GstPad *sinkpad, *srcpad;
- FT_Info *info;
-};
+ FT_Info *info;
+ };
-struct _GstFestivalClass {
- GstElementClass parent_class;
-};
+ struct _GstFestivalClass
+ {
+ GstElementClass parent_class;
+ };
-GType gst_festival_get_type(void);
+ GType gst_festival_get_type (void);
#ifdef __cplusplus
}
-#endif /* __cplusplus */
+#endif /* __cplusplus */
-#endif /* __GST_FESTIVAL_H__ */
+#endif /* __GST_FESTIVAL_H__ */
diff --git a/gst/filter/gstbpwsinc.c b/gst/filter/gstbpwsinc.c
index 775290530..a848cc26c 100644
--- a/gst/filter/gstbpwsinc.c
+++ b/gst/filter/gstbpwsinc.c
@@ -39,20 +39,19 @@
#include <string.h> /* memmove */
/* elementfactory information */
-static GstElementDetails gst_bpwsinc_details = GST_ELEMENT_DETAILS (
- "BPWSinc",
- "Filter/Effect/Audio",
- "Band-Pass Windowed sinc filter",
- "Thomas <thomas@apestaart.org>, "
- "Steven W. Smith"
-);
-
-enum {
+static GstElementDetails gst_bpwsinc_details = GST_ELEMENT_DETAILS ("BPWSinc",
+ "Filter/Effect/Audio",
+ "Band-Pass Windowed sinc filter",
+ "Thomas <thomas@apestaart.org>, " "Steven W. Smith");
+
+enum
+{
/* FILL ME */
LAST_SIGNAL
};
-enum {
+enum
+{
ARG_0,
ARG_LENGTH,
ARG_LOWER_FREQUENCY,
@@ -81,51 +80,52 @@ struct _GstBPWSinc
double frequency;
double lower_frequency, upper_frequency;
- int wing_size; /* length of a "wing" of the filter;
- actual length is 2 * wing_size + 1 */
+ int wing_size; /* length of a "wing" of the filter;
+ actual length is 2 * wing_size + 1 */
- gfloat *residue; /* buffer for left-over samples from previous buffer */
+ gfloat *residue; /* buffer for left-over samples from previous buffer */
double *kernel;
};
struct _GstBPWSincClass
{
- GstElementClass parent_class;
+ GstElementClass parent_class;
};
-static void gst_bpwsinc_base_init (gpointer g_class);
-static void gst_bpwsinc_class_init (GstBPWSincClass * klass);
-static void gst_bpwsinc_init (GstBPWSinc * filter);
+static void gst_bpwsinc_base_init (gpointer g_class);
+static void gst_bpwsinc_class_init (GstBPWSincClass * klass);
+static void gst_bpwsinc_init (GstBPWSinc * filter);
-static void gst_bpwsinc_set_property (GObject * object, guint prop_id,
- const GValue * value,
- GParamSpec * pspec);
-static void gst_bpwsinc_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
+static void gst_bpwsinc_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec);
+static void gst_bpwsinc_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec);
-static void gst_bpwsinc_chain (GstPad * pad, GstData *_data);
+static void gst_bpwsinc_chain (GstPad * pad, GstData * _data);
static GstPadLinkReturn
- gst_bpwsinc_sink_connect (GstPad * pad, const GstCaps * caps);
+gst_bpwsinc_sink_connect (GstPad * pad, const GstCaps * caps);
static GstElementClass *parent_class = NULL;
+
/*static guint gst_bpwsinc_signals[LAST_SIGNAL] = { 0 }; */
-GType gst_bpwsinc_get_type (void)
+GType
+gst_bpwsinc_get_type (void)
{
static GType bpwsinc_type = 0;
if (!bpwsinc_type) {
static const GTypeInfo bpwsinc_info = {
- sizeof (GstBPWSincClass),
- gst_bpwsinc_base_init,
+ sizeof (GstBPWSincClass),
+ gst_bpwsinc_base_init,
NULL,
(GClassInitFunc) gst_bpwsinc_class_init, NULL, NULL,
sizeof (GstBPWSinc), 0,
(GInstanceInitFunc) gst_bpwsinc_init,
};
- bpwsinc_type = g_type_register_static (GST_TYPE_ELEMENT, "GstBPWSinc",
- &bpwsinc_info, 0);
+ bpwsinc_type = g_type_register_static (GST_TYPE_ELEMENT, "GstBPWSinc",
+ &bpwsinc_info, 0);
}
return bpwsinc_type;
}
@@ -139,9 +139,9 @@ gst_bpwsinc_base_init (gpointer g_class)
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_filter_src_template));
gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gst_filter_sink_template));
+ gst_static_pad_template_get (&gst_filter_sink_template));
- gst_element_class_set_details (element_class, &gst_bpwsinc_details);
+ gst_element_class_set_details (element_class, &gst_bpwsinc_details);
}
static void
@@ -156,20 +156,17 @@ gst_bpwsinc_class_init (GstBPWSincClass * klass)
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LOWER_FREQUENCY,
- g_param_spec_double ("lower-frequency", "Lower Frequency",
- "Cut-off lower frequency (relative to sample rate)",
- 0.0, 0.5,
- 0, G_PARAM_READWRITE));
+ g_param_spec_double ("lower-frequency", "Lower Frequency",
+ "Cut-off lower frequency (relative to sample rate)",
+ 0.0, 0.5, 0, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_UPPER_FREQUENCY,
- g_param_spec_double ("upper-frequency", "Upper Frequency",
- "Cut-off upper frequency (relative to sample rate)",
- 0.0, 0.5,
- 0, G_PARAM_READWRITE));
+ g_param_spec_double ("upper-frequency", "Upper Frequency",
+ "Cut-off upper frequency (relative to sample rate)",
+ 0.0, 0.5, 0, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LENGTH,
- g_param_spec_int ("length", "Length",
- "N such that the filter length = 2N + 1",
- 1, G_MAXINT,
- 1, G_PARAM_READWRITE));
+ g_param_spec_int ("length", "Length",
+ "N such that the filter length = 2N + 1",
+ 1, G_MAXINT, 1, G_PARAM_READWRITE));
gobject_class->set_property = gst_bpwsinc_set_property;
gobject_class->get_property = gst_bpwsinc_get_property;
@@ -178,14 +175,16 @@ gst_bpwsinc_class_init (GstBPWSincClass * klass)
static void
gst_bpwsinc_init (GstBPWSinc * filter)
{
- filter->sinkpad = gst_pad_new_from_template (
- gst_static_pad_template_get (&gst_filter_sink_template), "sink");
+ filter->sinkpad =
+ gst_pad_new_from_template (gst_static_pad_template_get
+ (&gst_filter_sink_template), "sink");
gst_pad_set_chain_function (filter->sinkpad, gst_bpwsinc_chain);
gst_pad_set_link_function (filter->sinkpad, gst_bpwsinc_sink_connect);
gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
- filter->srcpad = gst_pad_new_from_template (
- gst_static_pad_template_get (&gst_filter_src_template), "src");
+ filter->srcpad =
+ gst_pad_new_from_template (gst_static_pad_template_get
+ (&gst_filter_src_template), "src");
gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);
filter->wing_size = 50;
@@ -202,65 +201,65 @@ gst_bpwsinc_sink_connect (GstPad * pad, const GstCaps * caps)
int len = 0;
double *kernel_lp, *kernel_hp;
GstPadLinkReturn set_retval;
-
+
GstBPWSinc *filter = GST_BPWSINC (gst_pad_get_parent (pad));
g_assert (GST_IS_PAD (pad));
g_assert (caps != NULL);
set_retval = gst_pad_try_set_caps (filter->srcpad, caps);
-
- if (set_retval > 0)
- {
+
+ if (set_retval > 0) {
len = filter->wing_size;
/* fill the lp kernel */
- GST_DEBUG (
- "bpwsinc: initializing LP kernel of length %d with cut-off %f",
- len * 2 + 1, filter->lower_frequency);
+ GST_DEBUG ("bpwsinc: initializing LP kernel of length %d with cut-off %f",
+ len * 2 + 1, filter->lower_frequency);
kernel_lp = (double *) g_malloc (sizeof (double) * (2 * len + 1));
- for (i = 0; i <= len * 2; ++i)
- {
+ for (i = 0; i <= len * 2; ++i) {
if (i == len)
kernel_lp[i] = 2 * M_PI * filter->lower_frequency;
else
- kernel_lp[i] = sin (2 * M_PI * filter->lower_frequency * (i - len))
- / (i - len);
+ kernel_lp[i] = sin (2 * M_PI * filter->lower_frequency * (i - len))
+ / (i - len);
/* Blackman windowing */
- kernel_lp[i] *= (0.42 - 0.5 * cos (M_PI * i / len)
- + 0.08 * cos (2 * M_PI * i / len));
+ kernel_lp[i] *= (0.42 - 0.5 * cos (M_PI * i / len)
+ + 0.08 * cos (2 * M_PI * i / len));
}
/* normalize for unity gain at DC
* FIXME: sure this is not supposed to be quadratic ? */
sum = 0.0;
- for (i = 0; i <= len * 2; ++i) sum += kernel_lp[i];
- for (i = 0; i <= len * 2; ++i) kernel_lp[i] /= sum;
+ for (i = 0; i <= len * 2; ++i)
+ sum += kernel_lp[i];
+ for (i = 0; i <= len * 2; ++i)
+ kernel_lp[i] /= sum;
/* fill the hp kernel */
- GST_DEBUG (
- "bpwsinc: initializing HP kernel of length %d with cut-off %f",
- len * 2 + 1, filter->upper_frequency);
+ GST_DEBUG ("bpwsinc: initializing HP kernel of length %d with cut-off %f",
+ len * 2 + 1, filter->upper_frequency);
kernel_hp = (double *) g_malloc (sizeof (double) * (2 * len + 1));
- for (i = 0; i <= len * 2; ++i)
- {
+ for (i = 0; i <= len * 2; ++i) {
if (i == len)
kernel_hp[i] = 2 * M_PI * filter->upper_frequency;
else
- kernel_hp[i] = sin (2 * M_PI * filter->upper_frequency * (i - len))
- / (i - len);
+ kernel_hp[i] = sin (2 * M_PI * filter->upper_frequency * (i - len))
+ / (i - len);
/* Blackman windowing */
- kernel_hp[i] *= (0.42 - 0.5 * cos (M_PI * i / len)
- + 0.08 * cos (2 * M_PI * i / len));
+ kernel_hp[i] *= (0.42 - 0.5 * cos (M_PI * i / len)
+ + 0.08 * cos (2 * M_PI * i / len));
}
/* normalize for unity gain at DC
* FIXME: sure this is not supposed to be quadratic ? */
sum = 0.0;
- for (i = 0; i <= len * 2; ++i) sum += kernel_hp[i];
- for (i = 0; i <= len * 2; ++i) kernel_hp[i] /= sum;
+ for (i = 0; i <= len * 2; ++i)
+ sum += kernel_hp[i];
+ for (i = 0; i <= len * 2; ++i)
+ kernel_hp[i] /= sum;
/* do spectral inversion to get a HP filter */
- for (i = 0; i <= len * 2; ++i) kernel_hp[i] = -kernel_hp[i];
+ for (i = 0; i <= len * 2; ++i)
+ kernel_hp[i] = -kernel_hp[i];
kernel_hp[len] += 1;
/* combine the two filters */
@@ -271,7 +270,8 @@ gst_bpwsinc_sink_connect (GstPad * pad, const GstCaps * caps)
filter->kernel[i] = kernel_lp[i] + kernel_hp[i];
/* do spectral inversion to go from band reject to bandpass */
- for (i = 0; i <= len * 2; ++i) filter->kernel[i] = -filter->kernel[i];
+ for (i = 0; i <= len * 2; ++i)
+ filter->kernel[i] = -filter->kernel[i];
filter->kernel[len] += 1;
/* free the helper kernels */
@@ -280,14 +280,15 @@ gst_bpwsinc_sink_connect (GstPad * pad, const GstCaps * caps)
/* set up the residue memory space */
filter->residue = (gfloat *) g_malloc (sizeof (gfloat) * (len * 2 + 1));
- for (i = 0; i <= len * 2; ++i) filter->residue[i] = 0.0;
+ for (i = 0; i <= len * 2; ++i)
+ filter->residue[i] = 0.0;
}
return set_retval;
}
static void
-gst_bpwsinc_chain (GstPad *pad, GstData *_data)
+gst_bpwsinc_chain (GstPad * pad, GstData * _data)
{
GstBuffer *buf = GST_BUFFER (_data);
GstBPWSinc *filter;
@@ -323,24 +324,24 @@ gst_bpwsinc_chain (GstPad *pad, GstData *_data)
memcpy (&input[residue_samples], src, sizeof (gfloat) * input_samples);
/* copy the tail of the current input buffer to the residue */
memcpy (filter->residue, &src[input_samples - residue_samples],
- sizeof (gfloat) * residue_samples);
+ sizeof (gfloat) * residue_samples);
/* convolution */
/* since we copied the previous set of samples we needed before the actual
* input data, we need to add the filter length to our indices for input */
- for (i = 0; i < input_samples; ++i)
- {
+ for (i = 0; i < input_samples; ++i) {
src[i] = 0.0;
for (j = 0; j < residue_samples; ++j)
src[i] += input[i - j + residue_samples] * filter->kernel[j];
}
-
+
g_free (input);
gst_pad_push (filter->srcpad, GST_DATA (buf));
}
static void
-gst_bpwsinc_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec)
+gst_bpwsinc_set_property (GObject * object, guint prop_id, const GValue * value,
+ GParamSpec * pspec)
{
GstBPWSinc *filter;
@@ -351,27 +352,28 @@ gst_bpwsinc_set_property (GObject * object, guint prop_id, const GValue * value,
switch (prop_id) {
case ARG_LENGTH:
- filter->wing_size = g_value_get_int (value);
- break;
+ filter->wing_size = g_value_get_int (value);
+ break;
case ARG_LOWER_FREQUENCY:
- filter->lower_frequency = g_value_get_double (value);
- break;
+ filter->lower_frequency = g_value_get_double (value);
+ break;
case ARG_UPPER_FREQUENCY:
- filter->upper_frequency = g_value_get_double (value);
- break;
+ filter->upper_frequency = g_value_get_double (value);
+ break;
default:
break;
}
}
static void
-gst_bpwsinc_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec)
+gst_bpwsinc_get_property (GObject * object, guint prop_id, GValue * value,
+ GParamSpec * pspec)
{
GstBPWSinc *filter;
/* it's not null if we got it, but it might not be ours */
g_return_if_fail (GST_IS_BPWSINC (object));
-
+
filter = GST_BPWSINC (object);
switch (prop_id) {
@@ -388,5 +390,4 @@ gst_bpwsinc_get_property (GObject * object, guint prop_id, GValue * value, GPara
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
-}
-
+}
diff --git a/gst/filter/gstfilter.c b/gst/filter/gstfilter.c
index 7a5d4248b..f723ae633 100644
--- a/gst/filter/gstfilter.c
+++ b/gst/filter/gstfilter.c
@@ -27,33 +27,30 @@
#include <gst/audio/audio.h>
-struct _elements_entry {
+struct _elements_entry
+{
gchar *name;
- GType (*type) (void);
+ GType (*type) (void);
};
static struct _elements_entry _elements[] = {
- { "iir", gst_iir_get_type },
- { "lpwsinc", gst_lpwsinc_get_type },
- { "bpwsinc", gst_bpwsinc_get_type },
- { NULL, 0 },
+ {"iir", gst_iir_get_type},
+ {"lpwsinc", gst_lpwsinc_get_type},
+ {"bpwsinc", gst_bpwsinc_get_type},
+ {NULL, 0},
};
-GstStaticPadTemplate gst_filter_src_template =
-GST_STATIC_PAD_TEMPLATE (
- "src",
+GstStaticPadTemplate gst_filter_src_template = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_STATIC_CAPS ( GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS )
-);
+ GST_STATIC_CAPS (GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS)
+ );
-GstStaticPadTemplate gst_filter_sink_template =
-GST_STATIC_PAD_TEMPLATE (
- "sink",
+GstStaticPadTemplate gst_filter_sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_STATIC_CAPS ( GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS )
-);
+ GST_STATIC_CAPS (GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS)
+ );
static gboolean
plugin_init (GstPlugin * plugin)
@@ -61,7 +58,8 @@ plugin_init (GstPlugin * plugin)
gint i = 0;
while (_elements[i].name) {
- if (!gst_element_register (plugin, _elements[i].name, GST_RANK_NONE, _elements[i].type()))
+ if (!gst_element_register (plugin, _elements[i].name, GST_RANK_NONE,
+ _elements[i].type ()))
return FALSE;
i++;
@@ -70,14 +68,8 @@ plugin_init (GstPlugin * plugin)
return TRUE;
}
-GST_PLUGIN_DEFINE (
- GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "filter",
- "IIR, lpwsinc and bpwsinc audio filter elements",
- plugin_init,
- VERSION,
- "LGPL",
- GST_PACKAGE,
- GST_ORIGIN
-);
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ "filter",
+ "IIR, lpwsinc and bpwsinc audio filter elements",
+ plugin_init, VERSION, "LGPL", GST_PACKAGE, GST_ORIGIN);
diff --git a/gst/filter/gstiir.c b/gst/filter/gstiir.c
index 4ccf9f094..5e44f3d0f 100644
--- a/gst/filter/gstiir.c
+++ b/gst/filter/gstiir.c
@@ -25,20 +25,19 @@
#include "gstfilter.h"
#include "iir.h"
-static GstElementDetails gst_iir_details = GST_ELEMENT_DETAILS (
- "IIR",
- "Filter/Effect/Audio",
- "IIR filter based on vorbis code",
- "Monty <monty@xiph.org>, "
- "Thomas <thomas@apestaart.org>"
-);
-
-enum {
+static GstElementDetails gst_iir_details = GST_ELEMENT_DETAILS ("IIR",
+ "Filter/Effect/Audio",
+ "IIR filter based on vorbis code",
+ "Monty <monty@xiph.org>, " "Thomas <thomas@apestaart.org>");
+
+enum
+{
/* FILL ME */
LAST_SIGNAL
};
-enum {
+enum
+{
ARG_0,
ARG_A,
ARG_B,
@@ -74,33 +73,34 @@ struct _GstIIR
struct _GstIIRClass
{
- GstElementClass parent_class;
+ GstElementClass parent_class;
};
-static void gst_iir_base_init (gpointer g_class);
-static void gst_iir_class_init (GstIIRClass * klass);
-static void gst_iir_init (GstIIR * filter);
+static void gst_iir_base_init (gpointer g_class);
+static void gst_iir_class_init (GstIIRClass * klass);
+static void gst_iir_init (GstIIR * filter);
-static void gst_iir_set_property (GObject * object, guint prop_id,
- const GValue * value,
- GParamSpec * pspec);
-static void gst_iir_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
+static void gst_iir_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec);
+static void gst_iir_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec);
-static void gst_iir_chain (GstPad * pad, GstData *_data);
+static void gst_iir_chain (GstPad * pad, GstData * _data);
static GstPadLinkReturn
- gst_iir_sink_connect (GstPad * pad, const GstCaps * caps);
+gst_iir_sink_connect (GstPad * pad, const GstCaps * caps);
static GstElementClass *parent_class = NULL;
+
/*static guint gst_iir_signals[LAST_SIGNAL] = { 0 }; */
-GType gst_iir_get_type (void)
+GType
+gst_iir_get_type (void)
{
static GType iir_type = 0;
if (!iir_type) {
static const GTypeInfo iir_info = {
- sizeof (GstIIRClass),
+ sizeof (GstIIRClass),
gst_iir_base_init,
NULL,
(GClassInitFunc) gst_iir_class_init, NULL, NULL,
@@ -108,8 +108,8 @@ GType gst_iir_get_type (void)
(GInstanceInitFunc) gst_iir_init,
};
- iir_type = g_type_register_static (GST_TYPE_ELEMENT, "GstIIR",
- &iir_info, 0);
+ iir_type = g_type_register_static (GST_TYPE_ELEMENT, "GstIIR",
+ &iir_info, 0);
}
return iir_type;
}
@@ -123,9 +123,9 @@ gst_iir_base_init (gpointer g_class)
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_filter_src_template));
gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gst_filter_sink_template));
+ gst_static_pad_template_get (&gst_filter_sink_template));
- gst_element_class_set_details (element_class, &gst_iir_details);
+ gst_element_class_set_details (element_class, &gst_iir_details);
}
static void
@@ -140,21 +140,17 @@ gst_iir_class_init (GstIIRClass * klass)
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_A,
- g_param_spec_double ("A", "A", "A filter coefficient",
- -G_MAXDOUBLE, G_MAXDOUBLE,
- 0, G_PARAM_READWRITE));
+ g_param_spec_double ("A", "A", "A filter coefficient",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_B,
- g_param_spec_double ("B", "B", "B filter coefficient",
- -G_MAXDOUBLE, G_MAXDOUBLE,
- 0, G_PARAM_READWRITE));
+ g_param_spec_double ("B", "B", "B filter coefficient",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_GAIN,
- g_param_spec_double ("gain", "Gain", "Filter gain",
- -G_MAXDOUBLE, G_MAXDOUBLE,
- 0, G_PARAM_READWRITE));
+ g_param_spec_double ("gain", "Gain", "Filter gain",
+ -G_MAXDOUBLE, G_MAXDOUBLE, 0, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_STAGES,
- g_param_spec_int ("stages", "Stages", "Number of filter stages",
- 1, G_MAXINT,
- 1, G_PARAM_READWRITE));
+ g_param_spec_int ("stages", "Stages", "Number of filter stages",
+ 1, G_MAXINT, 1, G_PARAM_READWRITE));
gobject_class->set_property = gst_iir_set_property;
gobject_class->get_property = gst_iir_get_property;
@@ -163,19 +159,21 @@ gst_iir_class_init (GstIIRClass * klass)
static void
gst_iir_init (GstIIR * filter)
{
- filter->sinkpad = gst_pad_new_from_template (
- gst_static_pad_template_get (&gst_filter_sink_template), "sink");
+ filter->sinkpad =
+ gst_pad_new_from_template (gst_static_pad_template_get
+ (&gst_filter_sink_template), "sink");
gst_pad_set_chain_function (filter->sinkpad, gst_iir_chain);
gst_pad_set_link_function (filter->sinkpad, gst_iir_sink_connect);
gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
- filter->srcpad = gst_pad_new_from_template (
- gst_static_pad_template_get (&gst_filter_src_template), "src");
+ filter->srcpad =
+ gst_pad_new_from_template (gst_static_pad_template_get
+ (&gst_filter_src_template), "src");
gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);
filter->A = 0.0;
filter->B = 0.0;
- filter->gain = 1.0; /* unity gain as default */
+ filter->gain = 1.0; /* unity gain as default */
filter->stages = 1;
filter->state = NULL;
}
@@ -185,23 +183,23 @@ gst_iir_sink_connect (GstPad * pad, const GstCaps * caps)
{
GstIIR *filter;
GstPadLinkReturn set_retval;
-
+
filter = GST_IIR (gst_pad_get_parent (pad));
-
- set_retval = gst_pad_try_set_caps(filter->srcpad, caps);
+
+ set_retval = gst_pad_try_set_caps (filter->srcpad, caps);
if (set_retval > 0) {
/* connection works, so init the filter */
/* FIXME: remember to free it */
filter->state = (IIR_state *) g_malloc (sizeof (IIR_state));
- IIR_init (filter->state, filter->stages,
- filter->gain, &(filter->A), &(filter->B));
+ IIR_init (filter->state, filter->stages,
+ filter->gain, &(filter->A), &(filter->B));
}
return set_retval;
}
static void
-gst_iir_chain (GstPad * pad, GstData *_data)
+gst_iir_chain (GstPad * pad, GstData * _data)
{
GstBuffer *buf = GST_BUFFER (_data);
GstIIR *filter;
@@ -223,7 +221,8 @@ gst_iir_chain (GstPad * pad, GstData *_data)
}
static void
-gst_iir_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec)
+gst_iir_set_property (GObject * object, guint prop_id, const GValue * value,
+ GParamSpec * pspec)
{
GstIIR *filter;
@@ -234,30 +233,31 @@ gst_iir_set_property (GObject * object, guint prop_id, const GValue * value, GPa
switch (prop_id) {
case ARG_A:
- filter->A = g_value_get_double (value);
- break;
+ filter->A = g_value_get_double (value);
+ break;
case ARG_B:
- filter->B = g_value_get_double (value);
- break;
+ filter->B = g_value_get_double (value);
+ break;
case ARG_GAIN:
- filter->gain = g_value_get_double (value);
- break;
+ filter->gain = g_value_get_double (value);
+ break;
case ARG_STAGES:
- filter->stages = g_value_get_int (value);
- break;
+ filter->stages = g_value_get_int (value);
+ break;
default:
break;
}
}
static void
-gst_iir_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec)
+gst_iir_get_property (GObject * object, guint prop_id, GValue * value,
+ GParamSpec * pspec)
{
GstIIR *filter;
/* it's not null if we got it, but it might not be ours */
g_return_if_fail (GST_IS_IIR (object));
-
+
filter = GST_IIR (object);
switch (prop_id) {
@@ -277,5 +277,4 @@ gst_iir_get_property (GObject * object, guint prop_id, GValue * value, GParamSpe
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
-}
-
+}
diff --git a/gst/filter/gstlpwsinc.c b/gst/filter/gstlpwsinc.c
index 603d8775e..0ce33b32c 100644
--- a/gst/filter/gstlpwsinc.c
+++ b/gst/filter/gstlpwsinc.c
@@ -38,20 +38,19 @@
#include <math.h> /* M_PI */
#include <string.h> /* memmove */
-static GstElementDetails gst_lpwsinc_details = GST_ELEMENT_DETAILS (
- "LPWSinc",
- "Filter/Effect/Audio",
- "Low-pass Windowed sinc filter",
- "Thomas <thomas@apestaart.org>, "
- "Steven W. Smith"
-);
-
-enum {
+static GstElementDetails gst_lpwsinc_details = GST_ELEMENT_DETAILS ("LPWSinc",
+ "Filter/Effect/Audio",
+ "Low-pass Windowed sinc filter",
+ "Thomas <thomas@apestaart.org>, " "Steven W. Smith");
+
+enum
+{
/* FILL ME */
LAST_SIGNAL
};
-enum {
+enum
+{
ARG_0,
ARG_LENGTH,
ARG_FREQUENCY,
@@ -78,42 +77,43 @@ struct _GstLPWSinc
GstPad *sinkpad, *srcpad;
double frequency;
- int wing_size; /* length of a "wing" of the filter;
- actual length is 2 * wing_size + 1 */
+ int wing_size; /* length of a "wing" of the filter;
+ actual length is 2 * wing_size + 1 */
- gfloat *residue; /* buffer for left-over samples from previous buffer */
+ gfloat *residue; /* buffer for left-over samples from previous buffer */
double *kernel;
};
struct _GstLPWSincClass
{
- GstElementClass parent_class;
+ GstElementClass parent_class;
};
-static void gst_lpwsinc_base_init (gpointer g_class);
-static void gst_lpwsinc_class_init (GstLPWSincClass * klass);
-static void gst_lpwsinc_init (GstLPWSinc * filter);
+static void gst_lpwsinc_base_init (gpointer g_class);
+static void gst_lpwsinc_class_init (GstLPWSincClass * klass);
+static void gst_lpwsinc_init (GstLPWSinc * filter);
-static void gst_lpwsinc_set_property (GObject * object, guint prop_id,
- const GValue * value,
- GParamSpec * pspec);
-static void gst_lpwsinc_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
+static void gst_lpwsinc_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec);
+static void gst_lpwsinc_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec);
-static void gst_lpwsinc_chain (GstPad * pad, GstData *_data);
+static void gst_lpwsinc_chain (GstPad * pad, GstData * _data);
static GstPadLinkReturn
- gst_lpwsinc_sink_connect (GstPad * pad, const GstCaps * caps);
+gst_lpwsinc_sink_connect (GstPad * pad, const GstCaps * caps);
static GstElementClass *parent_class = NULL;
+
/*static guint gst_lpwsinc_signals[LAST_SIGNAL] = { 0 }; */
-GType gst_lpwsinc_get_type (void)
+GType
+gst_lpwsinc_get_type (void)
{
static GType lpwsinc_type = 0;
if (!lpwsinc_type) {
static const GTypeInfo lpwsinc_info = {
- sizeof (GstLPWSincClass),
+ sizeof (GstLPWSincClass),
gst_lpwsinc_base_init,
NULL,
(GClassInitFunc) gst_lpwsinc_class_init, NULL, NULL,
@@ -121,8 +121,8 @@ GType gst_lpwsinc_get_type (void)
(GInstanceInitFunc) gst_lpwsinc_init,
};
- lpwsinc_type = g_type_register_static (GST_TYPE_ELEMENT, "GstLPWSinc",
- &lpwsinc_info, 0);
+ lpwsinc_type = g_type_register_static (GST_TYPE_ELEMENT, "GstLPWSinc",
+ &lpwsinc_info, 0);
}
return lpwsinc_type;
}
@@ -136,9 +136,9 @@ gst_lpwsinc_base_init (gpointer g_class)
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_filter_src_template));
gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gst_filter_sink_template));
+ gst_static_pad_template_get (&gst_filter_sink_template));
- gst_element_class_set_details (element_class, &gst_lpwsinc_details);
+ gst_element_class_set_details (element_class, &gst_lpwsinc_details);
}
static void
@@ -153,15 +153,13 @@ gst_lpwsinc_class_init (GstLPWSincClass * klass)
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FREQUENCY,
- g_param_spec_double ("frequency", "Frequency",
- "Cut-off Frequency relative to sample rate)",
- 0.0, 0.5,
- 0, G_PARAM_READWRITE));
+ g_param_spec_double ("frequency", "Frequency",
+ "Cut-off Frequency relative to sample rate)",
+ 0.0, 0.5, 0, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LENGTH,
- g_param_spec_int ("length", "Length",
- "N such that the filter length = 2N + 1",
- 1, G_MAXINT,
- 1, G_PARAM_READWRITE));
+ g_param_spec_int ("length", "Length",
+ "N such that the filter length = 2N + 1",
+ 1, G_MAXINT, 1, G_PARAM_READWRITE));
gobject_class->set_property = gst_lpwsinc_set_property;
gobject_class->get_property = gst_lpwsinc_get_property;
@@ -170,14 +168,16 @@ gst_lpwsinc_class_init (GstLPWSincClass * klass)
static void
gst_lpwsinc_init (GstLPWSinc * filter)
{
- filter->sinkpad = gst_pad_new_from_template (
- gst_static_pad_template_get (&gst_filter_sink_template), "sink");
+ filter->sinkpad =
+ gst_pad_new_from_template (gst_static_pad_template_get
+ (&gst_filter_sink_template), "sink");
gst_pad_set_chain_function (filter->sinkpad, gst_lpwsinc_chain);
gst_pad_set_link_function (filter->sinkpad, gst_lpwsinc_sink_connect);
gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
- filter->srcpad = gst_pad_new_from_template (
- gst_static_pad_template_get (&gst_filter_src_template), "src");
+ filter->srcpad =
+ gst_pad_new_from_template (gst_static_pad_template_get
+ (&gst_filter_src_template), "src");
gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);
filter->wing_size = 50;
@@ -197,45 +197,45 @@ gst_lpwsinc_sink_connect (GstPad * pad, const GstCaps * caps)
g_assert (GST_IS_PAD (pad));
g_assert (caps != NULL);
- set_retval = gst_pad_try_set_caps(filter->srcpad, caps);
-
- if (set_retval > 0)
- {
+ set_retval = gst_pad_try_set_caps (filter->srcpad, caps);
+
+ if (set_retval > 0) {
/* connection works, so init the filter */
/* FIXME: remember to free it */
/* fill the kernel */
g_print ("DEBUG: initing filter kernel\n");
len = filter->wing_size;
- GST_DEBUG (
- "lpwsinc: initializing filter kernel of length %d", len * 2 + 1);
+ GST_DEBUG ("lpwsinc: initializing filter kernel of length %d", len * 2 + 1);
filter->kernel = (double *) g_malloc (sizeof (double) * (2 * len + 1));
- for (i = 0; i <= len * 2; ++i)
- {
+ for (i = 0; i <= len * 2; ++i) {
if (i == len)
filter->kernel[i] = 2 * M_PI * filter->frequency;
else
- filter->kernel[i] = sin (2 * M_PI * filter->frequency * (i - len))
- / (i - len);
+ filter->kernel[i] = sin (2 * M_PI * filter->frequency * (i - len))
+ / (i - len);
/* windowing */
filter->kernel[i] *= (0.54 - 0.46 * cos (M_PI * i / len));
}
/* normalize for unity gain at DC
* FIXME: sure this is not supposed to be quadratic ? */
- for (i = 0; i <= len * 2; ++i) sum += filter->kernel[i];
- for (i = 0; i <= len * 2; ++i) filter->kernel[i] /= sum;
+ for (i = 0; i <= len * 2; ++i)
+ sum += filter->kernel[i];
+ for (i = 0; i <= len * 2; ++i)
+ filter->kernel[i] /= sum;
/* set up the residue memory space */
filter->residue = (gfloat *) g_malloc (sizeof (gfloat) * (len * 2 + 1));
- for (i = 0; i <= len * 2; ++i) filter->residue[i] = 0.0;
+ for (i = 0; i <= len * 2; ++i)
+ filter->residue[i] = 0.0;
}
return set_retval;
}
static void
-gst_lpwsinc_chain (GstPad * pad, GstData *_data)
+gst_lpwsinc_chain (GstPad * pad, GstData * _data)
{
GstBuffer *buf = GST_BUFFER (_data);
GstLPWSinc *filter;
@@ -271,24 +271,24 @@ gst_lpwsinc_chain (GstPad * pad, GstData *_data)
memcpy (&input[residue_samples], src, sizeof (gfloat) * input_samples);
/* copy the tail of the current input buffer to the residue */
memcpy (filter->residue, &src[input_samples - residue_samples],
- sizeof (gfloat) * residue_samples);
+ sizeof (gfloat) * residue_samples);
/* convolution */
/* since we copied the previous set of samples we needed before the actual
* input data, we need to add the filter length to our indices for input */
- for (i = 0; i < input_samples; ++i)
- {
+ for (i = 0; i < input_samples; ++i) {
src[i] = 0.0;
for (j = 0; j < residue_samples; ++j)
src[i] += input[i - j + residue_samples] * filter->kernel[j];
}
-
+
g_free (input);
gst_pad_push (filter->srcpad, GST_DATA (buf));
}
static void
-gst_lpwsinc_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec)
+gst_lpwsinc_set_property (GObject * object, guint prop_id, const GValue * value,
+ GParamSpec * pspec)
{
GstLPWSinc *filter;
@@ -299,24 +299,25 @@ gst_lpwsinc_set_property (GObject * object, guint prop_id, const GValue * value,
switch (prop_id) {
case ARG_LENGTH:
- filter->wing_size = g_value_get_int (value);
- break;
+ filter->wing_size = g_value_get_int (value);
+ break;
case ARG_FREQUENCY:
- filter->frequency = g_value_get_double (value);
- break;
+ filter->frequency = g_value_get_double (value);
+ break;
default:
break;
}
}
static void
-gst_lpwsinc_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec)
+gst_lpwsinc_get_property (GObject * object, guint prop_id, GValue * value,
+ GParamSpec * pspec)
{
GstLPWSinc *filter;
/* it's not null if we got it, but it might not be ours */
g_return_if_fail (GST_IS_LPWSINC (object));
-
+
filter = GST_LPWSINC (object);
switch (prop_id) {
@@ -330,5 +331,4 @@ gst_lpwsinc_get_property (GObject * object, guint prop_id, GValue * value, GPara
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
-}
-
+}
diff --git a/gst/filter/iir.c b/gst/filter/iir.c
index 13e2e937e..8bf629b6a 100644
--- a/gst/filter/iir.c
+++ b/gst/filter/iir.c
@@ -28,91 +28,103 @@
#include <math.h>
#include "iir.h"
-void IIR_init(IIR_state *s,int stages,double gain, double *A, double *B){
- memset(s,0,sizeof(IIR_state));
- s->stages=stages;
- s->gain=gain;
- s->coeff_A=malloc(stages*sizeof(double));
- s->coeff_B=malloc((stages+1)*sizeof(double));
- s->z_A=calloc(stages*2,sizeof(double));
- s->z_B=calloc(stages*2,sizeof(double));
-
- memcpy(s->coeff_A,A,stages*sizeof(double));
- memcpy(s->coeff_B,B,(stages+1)*sizeof(double));
+void
+IIR_init (IIR_state * s, int stages, double gain, double *A, double *B)
+{
+ memset (s, 0, sizeof (IIR_state));
+ s->stages = stages;
+ s->gain = gain;
+ s->coeff_A = malloc (stages * sizeof (double));
+ s->coeff_B = malloc ((stages + 1) * sizeof (double));
+ s->z_A = calloc (stages * 2, sizeof (double));
+ s->z_B = calloc (stages * 2, sizeof (double));
+
+ memcpy (s->coeff_A, A, stages * sizeof (double));
+ memcpy (s->coeff_B, B, (stages + 1) * sizeof (double));
}
-void IIR_clear(IIR_state *s){
- if(s){
- free(s->coeff_A);
- free(s->coeff_B);
- free(s->z_A);
- free(s->z_B);
- memset(s,0,sizeof(IIR_state));
+void
+IIR_clear (IIR_state * s)
+{
+ if (s) {
+ free (s->coeff_A);
+ free (s->coeff_B);
+ free (s->z_A);
+ free (s->z_B);
+ memset (s, 0, sizeof (IIR_state));
}
}
-double IIR_filter(IIR_state *s,double in){
- int stages=s->stages,i;
+double
+IIR_filter (IIR_state * s, double in)
+{
+ int stages = s->stages, i;
double newA;
- double newB=0;
- double *zA=s->z_A+s->ring;
+ double newB = 0;
+ double *zA = s->z_A + s->ring;
- newA=in/=s->gain;
- for(i=0;i<stages;i++){
- newA+= s->coeff_A[i] * zA[i];
- newB+= s->coeff_B[i] * zA[i];
+ newA = in /= s->gain;
+ for (i = 0; i < stages; i++) {
+ newA += s->coeff_A[i] * zA[i];
+ newB += s->coeff_B[i] * zA[i];
}
- newB+=newA*s->coeff_B[stages];
+ newB += newA * s->coeff_B[stages];
- zA[0]=zA[stages]=newA;
- if(++s->ring>=stages)s->ring=0;
+ zA[0] = zA[stages] = newA;
+ if (++s->ring >= stages)
+ s->ring = 0;
- return(newB);
+ return (newB);
}
/* this assumes the symmetrical structure of the feed-forward stage of
a Chebyshev bandpass to save multiplies */
-double IIR_filter_ChebBand(IIR_state *s,double in){
- int stages=s->stages,i;
+double
+IIR_filter_ChebBand (IIR_state * s, double in)
+{
+ int stages = s->stages, i;
double newA;
- double newB=0;
- double *zA=s->z_A+s->ring;
+ double newB = 0;
+ double *zA = s->z_A + s->ring;
- newA=in/=s->gain;
+ newA = in /= s->gain;
- newA+= s->coeff_A[0] * zA[0];
- for(i=1;i<(stages>>1);i++){
- newA+= s->coeff_A[i] * zA[i];
- newB+= s->coeff_B[i] * (zA[i]-zA[stages-i]);
+ newA += s->coeff_A[0] * zA[0];
+ for (i = 1; i < (stages >> 1); i++) {
+ newA += s->coeff_A[i] * zA[i];
+ newB += s->coeff_B[i] * (zA[i] - zA[stages - i]);
}
- newB+= s->coeff_B[i] * zA[i];
- for(;i<stages;i++)
- newA+= s->coeff_A[i] * zA[i];
+ newB += s->coeff_B[i] * zA[i];
+ for (; i < stages; i++)
+ newA += s->coeff_A[i] * zA[i];
- newB+= newA-zA[0];
+ newB += newA - zA[0];
- zA[0]=zA[stages]=newA;
- if(++s->ring>=stages)s->ring=0;
+ zA[0] = zA[stages] = newA;
+ if (++s->ring >= stages)
+ s->ring = 0;
- return(newB);
+ return (newB);
}
#ifdef _V_SELFTEST
/* z^-stage, z^-stage+1... */
-static double cheb_bandpass_B[]={-1.,0.,5.,0.,-10.,0.,10.,0.,-5.,0.,1};
-static double cheb_bandpass_A[]={-0.6665900311,
- 1.0070146601,
- -3.1262875409,
- 3.5017171569,
- -6.2779211945,
- 5.2966481740,
- -6.7570216587,
- 4.0760335768,
- -3.9134284363,
- 1.3997338886};
-
-static double data[128]={
+static double cheb_bandpass_B[] =
+ { -1., 0., 5., 0., -10., 0., 10., 0., -5., 0., 1 };
+static double cheb_bandpass_A[] = { -0.6665900311,
+ 1.0070146601,
+ -3.1262875409,
+ 3.5017171569,
+ -6.2779211945,
+ 5.2966481740,
+ -6.7570216587,
+ 4.0760335768,
+ -3.9134284363,
+ 1.3997338886
+};
+
+static double data[128] = {
0.0426331,
0.0384521,
0.0345764,
@@ -240,7 +252,8 @@ static double data[128]={
-0.0537415,
-0.0610046,
-0.0609741,
- -0.0547791};
+ -0.0547791
+};
/* comparison test code from http://www-users.cs.york.ac.uk/~fisher/mkfilter/
(the above page kicks ass, BTW)*/
@@ -249,58 +262,87 @@ static double data[128]={
#define NPOLES 10
#define GAIN 4.599477515e+02
-static float xv[NZEROS+1], yv[NPOLES+1];
-
-static double filterloop(double next){
- xv[0] = xv[1]; xv[1] = xv[2]; xv[2] = xv[3]; xv[3] = xv[4]; xv[4] = xv[5];
- xv[5] = xv[6]; xv[6] = xv[7]; xv[7] = xv[8]; xv[8] = xv[9]; xv[9] = xv[10];
+static float xv[NZEROS + 1], yv[NPOLES + 1];
+
+static double
+filterloop (double next)
+{
+ xv[0] = xv[1];
+ xv[1] = xv[2];
+ xv[2] = xv[3];
+ xv[3] = xv[4];
+ xv[4] = xv[5];
+ xv[5] = xv[6];
+ xv[6] = xv[7];
+ xv[7] = xv[8];
+ xv[8] = xv[9];
+ xv[9] = xv[10];
xv[10] = next / GAIN;
- yv[0] = yv[1]; yv[1] = yv[2]; yv[2] = yv[3]; yv[3] = yv[4]; yv[4] = yv[5];
- yv[5] = yv[6]; yv[6] = yv[7]; yv[7] = yv[8]; yv[8] = yv[9]; yv[9] = yv[10];
- yv[10] = (xv[10] - xv[0]) + 5 * (xv[2] - xv[8]) + 10 * (xv[6] - xv[4])
- + ( -0.6665900311 * yv[0]) + ( 1.0070146601 * yv[1])
- + ( -3.1262875409 * yv[2]) + ( 3.5017171569 * yv[3])
- + ( -6.2779211945 * yv[4]) + ( 5.2966481740 * yv[5])
- + ( -6.7570216587 * yv[6]) + ( 4.0760335768 * yv[7])
- + ( -3.9134284363 * yv[8]) + ( 1.3997338886 * yv[9]);
- return(yv[10]);
+ yv[0] = yv[1];
+ yv[1] = yv[2];
+ yv[2] = yv[3];
+ yv[3] = yv[4];
+ yv[4] = yv[5];
+ yv[5] = yv[6];
+ yv[6] = yv[7];
+ yv[7] = yv[8];
+ yv[8] = yv[9];
+ yv[9] = yv[10];
+ yv[10] = (xv[10] - xv[0]) + 5 * (xv[2] - xv[8]) + 10 * (xv[6] - xv[4])
+ + (-0.6665900311 * yv[0]) + (1.0070146601 * yv[1])
+ + (-3.1262875409 * yv[2]) + (3.5017171569 * yv[3])
+ + (-6.2779211945 * yv[4]) + (5.2966481740 * yv[5])
+ + (-6.7570216587 * yv[6]) + (4.0760335768 * yv[7])
+ + (-3.9134284363 * yv[8]) + (1.3997338886 * yv[9]);
+ return (yv[10]);
}
#include <stdio.h>
-int main(){
+int
+main ()
+{
/* run the pregenerated Chebyshev filter, then our own distillation
through the generic and specialized code */
- double *work=malloc(128*sizeof(double));
+ double *work = malloc (128 * sizeof (double));
IIR_state iir;
int i;
- for(i=0;i<128;i++)work[i]=filterloop(data[i]);
+ for (i = 0; i < 128; i++)
+ work[i] = filterloop (data[i]);
{
- FILE *out=fopen("IIR_ref.m","w");
- for(i=0;i<128;i++)fprintf(out,"%g\n",work[i]);
- fclose(out);
+ FILE *out = fopen ("IIR_ref.m", "w");
+
+ for (i = 0; i < 128; i++)
+ fprintf (out, "%g\n", work[i]);
+ fclose (out);
}
- IIR_init(&iir,NPOLES,GAIN,cheb_bandpass_A,cheb_bandpass_B);
- for(i=0;i<128;i++)work[i]=IIR_filter(&iir,data[i]);
+ IIR_init (&iir, NPOLES, GAIN, cheb_bandpass_A, cheb_bandpass_B);
+ for (i = 0; i < 128; i++)
+ work[i] = IIR_filter (&iir, data[i]);
{
- FILE *out=fopen("IIR_gen.m","w");
- for(i=0;i<128;i++)fprintf(out,"%g\n",work[i]);
- fclose(out);
+ FILE *out = fopen ("IIR_gen.m", "w");
+
+ for (i = 0; i < 128; i++)
+ fprintf (out, "%g\n", work[i]);
+ fclose (out);
}
- IIR_clear(&iir);
+ IIR_clear (&iir);
- IIR_init(&iir,NPOLES,GAIN,cheb_bandpass_A,cheb_bandpass_B);
- for(i=0;i<128;i++)work[i]=IIR_filter_ChebBand(&iir,data[i]);
+ IIR_init (&iir, NPOLES, GAIN, cheb_bandpass_A, cheb_bandpass_B);
+ for (i = 0; i < 128; i++)
+ work[i] = IIR_filter_ChebBand (&iir, data[i]);
{
- FILE *out=fopen("IIR_cheb.m","w");
- for(i=0;i<128;i++)fprintf(out,"%g\n",work[i]);
- fclose(out);
+ FILE *out = fopen ("IIR_cheb.m", "w");
+
+ for (i = 0; i < 128; i++)
+ fprintf (out, "%g\n", work[i]);
+ fclose (out);
}
- IIR_clear(&iir);
+ IIR_clear (&iir);
- return(0);
+ return (0);
}
#endif
diff --git a/gst/filter/iir.h b/gst/filter/iir.h
index 241cc1d2d..1cea56639 100644
--- a/gst/filter/iir.h
+++ b/gst/filter/iir.h
@@ -19,7 +19,8 @@
#ifndef _V_IIR_H_
#define _V_IIR_H_
-typedef struct {
+typedef struct
+{
int stages;
double *coeff_A;
double *coeff_B;
@@ -29,9 +30,9 @@ typedef struct {
double gain;
} IIR_state;
-void IIR_init(IIR_state *s,int stages,double gain, double *A, double *B);
-void IIR_clear(IIR_state *s);
-double IIR_filter(IIR_state *s,double in);
-double IIR_filter_ChebBand(IIR_state *s,double in);
+void IIR_init (IIR_state * s, int stages, double gain, double *A, double *B);
+void IIR_clear (IIR_state * s);
+double IIR_filter (IIR_state * s, double in);
+double IIR_filter_ChebBand (IIR_state * s, double in);
#endif
diff --git a/gst/flx/flx_color.c b/gst/flx/flx_color.c
index b64c90c44..738468458 100644
--- a/gst/flx/flx_color.c
+++ b/gst/flx/flx_color.c
@@ -27,40 +27,41 @@
#include "flx_color.h"
FlxColorSpaceConverter *
-flx_colorspace_converter_new(gint width, gint height)
+flx_colorspace_converter_new (gint width, gint height)
{
- FlxColorSpaceConverter *new = g_malloc(sizeof(FlxColorSpaceConverter));
+ FlxColorSpaceConverter *new = g_malloc (sizeof (FlxColorSpaceConverter));
new->width = width;
new->height = height;
- memset(new->palvec, 0, sizeof(new->palvec));
+ memset (new->palvec, 0, sizeof (new->palvec));
return new;
}
void
-flx_colorspace_converter_destroy(FlxColorSpaceConverter *flxpal)
+flx_colorspace_converter_destroy (FlxColorSpaceConverter * flxpal)
{
- g_return_if_fail(flxpal != NULL);
+ g_return_if_fail (flxpal != NULL);
- g_free(flxpal);
+ g_free (flxpal);
}
void
-flx_colorspace_convert(FlxColorSpaceConverter *flxpal, guchar *src, guchar *dest)
+flx_colorspace_convert (FlxColorSpaceConverter * flxpal, guchar * src,
+ guchar * dest)
{
guint size, col;
- g_return_if_fail(flxpal != NULL);
- g_return_if_fail(src != dest);
+ g_return_if_fail (flxpal != NULL);
+ g_return_if_fail (src != dest);
size = flxpal->width * flxpal->height;
- while(size--) {
- col = (*src++ * 3);
- *dest++ = flxpal->palvec[col+2];
- *dest++ = flxpal->palvec[col+1];
+ while (size--) {
+ col = (*src++ * 3);
+ *dest++ = flxpal->palvec[col + 2];
+ *dest++ = flxpal->palvec[col + 1];
*dest++ = flxpal->palvec[col];
*dest++ = 0;
}
@@ -68,13 +69,14 @@ flx_colorspace_convert(FlxColorSpaceConverter *flxpal, guchar *src, guchar *dest
}
-void
-flx_set_palette_vector(FlxColorSpaceConverter *flxpal, guint start, guint num, guchar *newpal, gint scale)
+void
+flx_set_palette_vector (FlxColorSpaceConverter * flxpal, guint start, guint num,
+ guchar * newpal, gint scale)
{
- guint grab;
-
- g_return_if_fail(flxpal != NULL);
- g_return_if_fail(start < 0x100);
+ guint grab;
+
+ g_return_if_fail (flxpal != NULL);
+ g_return_if_fail (start < 0x100);
grab = ((start + num) > 0x100 ? 0x100 - start : num);
@@ -88,23 +90,21 @@ flx_set_palette_vector(FlxColorSpaceConverter *flxpal, guint start, guint num, g
flxpal->palvec[start++] = newpal[i++] << scale;
grab--;
}
- }
- else {
- memcpy(&flxpal->palvec[start * 3], newpal, grab * 3);
+ } else {
+ memcpy (&flxpal->palvec[start * 3], newpal, grab * 3);
}
}
void
-flx_set_color(FlxColorSpaceConverter *flxpal, guint colr, guint red, guint green, guint blue, gint scale)
+flx_set_color (FlxColorSpaceConverter * flxpal, guint colr, guint red,
+ guint green, guint blue, gint scale)
{
-
- g_return_if_fail(flxpal != NULL);
- g_return_if_fail(colr < 0x100);
- flxpal->palvec[(colr * 3)] = red << scale;
+ g_return_if_fail (flxpal != NULL);
+ g_return_if_fail (colr < 0x100);
+
+ flxpal->palvec[(colr * 3)] = red << scale;
flxpal->palvec[(colr * 3) + 1] = green << scale;
flxpal->palvec[(colr * 3) + 2] = blue << scale;
}
-
-
diff --git a/gst/flx/flx_color.h b/gst/flx/flx_color.h
index d423ab873..2ad852fad 100644
--- a/gst/flx/flx_color.h
+++ b/gst/flx/flx_color.h
@@ -17,7 +17,8 @@
* Boston, MA 02111-1307, USA.
*/
-typedef enum {
+typedef enum
+{
FLX_COLORSPACE_RGB8,
FLX_COLORSPACE_RGB32,
} FlxColorSpaceType;
@@ -25,19 +26,20 @@ typedef enum {
typedef struct _FlxColorSpaceConverter FlxColorSpaceConverter;
-struct _FlxColorSpaceConverter {
- guint width;
- guint height;
- guchar palvec[768];
+struct _FlxColorSpaceConverter
+{
+ guint width;
+ guint height;
+ guchar palvec[768];
};
-void flx_colorspace_converter_destroy(FlxColorSpaceConverter *flxpal);
-void flx_colorspace_convert(FlxColorSpaceConverter *flxpal, guchar *src, guchar *dest);
-FlxColorSpaceConverter * flx_colorspace_converter_new(gint width, gint height);
-
-void flx_set_palette_vector(FlxColorSpaceConverter *flxpal, guint start, guint num,
- guchar *newpal, gint scale);
-void flx_set_color(FlxColorSpaceConverter *flxpal, guint colr, guint red, guint green,
- guint blue, gint scale);
+void flx_colorspace_converter_destroy (FlxColorSpaceConverter * flxpal);
+void flx_colorspace_convert (FlxColorSpaceConverter * flxpal, guchar * src,
+ guchar * dest);
+FlxColorSpaceConverter *flx_colorspace_converter_new (gint width, gint height);
+void flx_set_palette_vector (FlxColorSpaceConverter * flxpal, guint start,
+ guint num, guchar * newpal, gint scale);
+void flx_set_color (FlxColorSpaceConverter * flxpal, guint colr, guint red,
+ guint green, guint blue, gint scale);
diff --git a/gst/flx/flx_fmt.h b/gst/flx/flx_fmt.h
index ac2062edc..1457551a3 100644
--- a/gst/flx/flx_fmt.h
+++ b/gst/flx/flx_fmt.h
@@ -24,113 +24,114 @@
#include <gst/gst.h>
#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-enum Flx_TypeChunk
-{
- /* frame chunks */
- FLX_PREFIX_TYPE = 0xf100,
- FLX_SCRIPT_CHUNK = 0xf1e0,
- FLX_FRAME_TYPE = 0xf1fa,
- FLX_SEGMENT_TABLE = 0xf1fb,
- FLX_HUFFMAN_TABLE = 0xf1fc,
-
- /* sub chunks */
- FLX_CEL_DATA = 3,
- FLX_COLOR256 = 4,
- FLX_SS2 = 7,
- FLX_COLOR64 = 11,
- FLX_LC = 12,
- FLX_BLACK = 13,
- FLX_BRUN = 15,
- FLX_COPY = 16,
- FLX_MINI = 18,
- FLX_DTA_RUN = 25,
- FLX_DTA_COPY = 26,
- FLX_DTA_LC = 27,
- FLX_LABEL = 31,
- FLX_BMP_MASK = 32,
- FLX_MLEV_MASK = 33,
- FLX_SEGMENT = 34,
- FLX_KEY_IMAGE = 35,
- FLX_KEY_PAL = 36,
- FLX_REGION = 37,
- FLX_WAVE = 38,
- FLX_USERSTRING = 39,
- FLX_RGN_MASK = 40,
-
-};
-
-enum Flx_MagicHdr
+extern "C"
{
- FLX_MAGICHDR_FLI = 0xaf11,
- FLX_MAGICHDR_FLC = 0xaf12,
- FLX_MAGICHDR_FLX = 0xaf44,
- FLX_MAGICHDR_HUFFBWT = 0xaf30,
-};
-
-
-
-typedef struct _FlxHeader
-{
- guint32 size;
- guint16 type;
- guint16 frames;
- guint16 width,height,depth,flags;
- guint32 speed;
- guint16 reserved1;
- /* FLC */
- guint32 created,creator,updated,updater;
- guint16 aspect_dx, aspect_dy;
- /* EGI */
- guint16 ext_flags,keyframes,totalframes;
- guint32 req_memory;
- guint16 max_regions,transp_num;
- guchar reserved2[24];
- /* FLC */
- guint32 oframe1,oframe2;
- guchar reserved3[40];
-} FlxHeader;
+#endif /* __cplusplus */
+
+ enum Flx_TypeChunk
+ {
+ /* frame chunks */
+ FLX_PREFIX_TYPE = 0xf100,
+ FLX_SCRIPT_CHUNK = 0xf1e0,
+ FLX_FRAME_TYPE = 0xf1fa,
+ FLX_SEGMENT_TABLE = 0xf1fb,
+ FLX_HUFFMAN_TABLE = 0xf1fc,
+
+ /* sub chunks */
+ FLX_CEL_DATA = 3,
+ FLX_COLOR256 = 4,
+ FLX_SS2 = 7,
+ FLX_COLOR64 = 11,
+ FLX_LC = 12,
+ FLX_BLACK = 13,
+ FLX_BRUN = 15,
+ FLX_COPY = 16,
+ FLX_MINI = 18,
+ FLX_DTA_RUN = 25,
+ FLX_DTA_COPY = 26,
+ FLX_DTA_LC = 27,
+ FLX_LABEL = 31,
+ FLX_BMP_MASK = 32,
+ FLX_MLEV_MASK = 33,
+ FLX_SEGMENT = 34,
+ FLX_KEY_IMAGE = 35,
+ FLX_KEY_PAL = 36,
+ FLX_REGION = 37,
+ FLX_WAVE = 38,
+ FLX_USERSTRING = 39,
+ FLX_RGN_MASK = 40,
+
+ };
+
+ enum Flx_MagicHdr
+ {
+ FLX_MAGICHDR_FLI = 0xaf11,
+ FLX_MAGICHDR_FLC = 0xaf12,
+ FLX_MAGICHDR_FLX = 0xaf44,
+ FLX_MAGICHDR_HUFFBWT = 0xaf30,
+ };
+
+
+
+ typedef struct _FlxHeader
+ {
+ guint32 size;
+ guint16 type;
+ guint16 frames;
+ guint16 width, height, depth, flags;
+ guint32 speed;
+ guint16 reserved1;
+ /* FLC */
+ guint32 created, creator, updated, updater;
+ guint16 aspect_dx, aspect_dy;
+ /* EGI */
+ guint16 ext_flags, keyframes, totalframes;
+ guint32 req_memory;
+ guint16 max_regions, transp_num;
+ guchar reserved2[24];
+ /* FLC */
+ guint32 oframe1, oframe2;
+ guchar reserved3[40];
+ } FlxHeader;
#define FlxHeaderSize 128
-typedef struct _FlxFrameChunk
-{
- guint32 size;
- guint16 id;
-} FlxFrameChunk;
+ typedef struct _FlxFrameChunk
+ {
+ guint32 size;
+ guint16 id;
+ } FlxFrameChunk;
#define FlxFrameChunkSize 6
-typedef struct _FlxPrefixChunk
-{
- guint16 chunks;
- guchar reserved[8];
-} FlxPrefixChunk;
-
-typedef struct _FlxSegmentTable
-{
- guint16 segments;
-} FlxSegmentTable;
-
-typedef struct _FlxHuffmanTable
-{
- guint16 codelength;
- guint16 numcodes;
- guchar reserved[6];
-} FlxHuffmanTable;
-
-typedef struct _FlxFrameType
-{
- guint16 chunks;
- guint16 delay;
- guchar reserved[6];
-} FlxFrameType;
+ typedef struct _FlxPrefixChunk
+ {
+ guint16 chunks;
+ guchar reserved[8];
+ } FlxPrefixChunk;
+
+ typedef struct _FlxSegmentTable
+ {
+ guint16 segments;
+ } FlxSegmentTable;
+
+ typedef struct _FlxHuffmanTable
+ {
+ guint16 codelength;
+ guint16 numcodes;
+ guchar reserved[6];
+ } FlxHuffmanTable;
+
+ typedef struct _FlxFrameType
+ {
+ guint16 chunks;
+ guint16 delay;
+ guchar reserved[6];
+ } FlxFrameType;
#define FlxFrameTypeSize 10
#ifdef __cplusplus
}
-#endif /* __cplusplus */
+#endif /* __cplusplus */
-#endif /* __GST_FLX_FMT_H__ */
+#endif /* __GST_FLX_FMT_H__ */
diff --git a/gst/flx/gstflxdec.c b/gst/flx/gstflxdec.c
index aaddee585..a84ce2d26 100644
--- a/gst/flx/gstflxdec.c
+++ b/gst/flx/gstflxdec.c
@@ -37,120 +37,122 @@ static GstElementDetails flxdec_details = {
};
/* Flx signals and args */
-enum {
+enum
+{
/* FILL ME */
LAST_SIGNAL
};
-enum {
+enum
+{
ARG_0
};
/* input */
-static GstStaticPadTemplate sink_factory =
-GST_STATIC_PAD_TEMPLATE (
- "sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ( "video/x-fli" )
-);
+static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("video/x-fli")
+ );
/* output */
-static GstStaticPadTemplate src_video_factory =
-GST_STATIC_PAD_TEMPLATE (
- "src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ( GST_VIDEO_CAPS_xRGB_HOST_ENDIAN )
-);
+static GstStaticPadTemplate src_video_factory = GST_STATIC_PAD_TEMPLATE ("src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS (GST_VIDEO_CAPS_xRGB_HOST_ENDIAN)
+ );
-static void gst_flxdec_class_init (GstFlxDecClass *klass);
-static void gst_flxdec_base_init (GstFlxDecClass *klass);
-static void gst_flxdec_init (GstFlxDec *flxdec);
+static void gst_flxdec_class_init (GstFlxDecClass * klass);
+static void gst_flxdec_base_init (GstFlxDecClass * klass);
+static void gst_flxdec_init (GstFlxDec * flxdec);
-static void gst_flxdec_loop (GstElement *element);
+static void gst_flxdec_loop (GstElement * element);
-static GstElementStateReturn
- gst_flxdec_change_state (GstElement *element);
+static GstElementStateReturn gst_flxdec_change_state (GstElement * element);
-static void gst_flxdec_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
-static void gst_flxdec_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
+static void gst_flxdec_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec);
+static void gst_flxdec_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec);
-static void flx_decode_color (GstFlxDec *, guchar *, guchar *, gint);
-static void flx_decode_brun (GstFlxDec *, guchar *, guchar *);
-static void flx_decode_delta_fli (GstFlxDec *, guchar *, guchar *);
-static void flx_decode_delta_flc (GstFlxDec *, guchar *, guchar *);
+static void flx_decode_color (GstFlxDec *, guchar *, guchar *, gint);
+static void flx_decode_brun (GstFlxDec *, guchar *, guchar *);
+static void flx_decode_delta_fli (GstFlxDec *, guchar *, guchar *);
+static void flx_decode_delta_flc (GstFlxDec *, guchar *, guchar *);
#define rndalign(off) ((off) + ((off) % 2))
static GstElementClass *parent_class = NULL;
GType
-gst_flxdec_get_type(void)
+gst_flxdec_get_type (void)
{
static GType flxdec_type = 0;
if (!flxdec_type) {
static const GTypeInfo flxdec_info = {
- sizeof(GstFlxDecClass),
- (GBaseInitFunc)gst_flxdec_base_init,
+ sizeof (GstFlxDecClass),
+ (GBaseInitFunc) gst_flxdec_base_init,
NULL,
- (GClassInitFunc)gst_flxdec_class_init,
+ (GClassInitFunc) gst_flxdec_class_init,
NULL,
NULL,
- sizeof(GstFlxDec),
+ sizeof (GstFlxDec),
0,
- (GInstanceInitFunc)gst_flxdec_init,
+ (GInstanceInitFunc) gst_flxdec_init,
};
- flxdec_type = g_type_register_static(GST_TYPE_ELEMENT, "GstFlxDec", &flxdec_info, 0);
+ flxdec_type =
+ g_type_register_static (GST_TYPE_ELEMENT, "GstFlxDec", &flxdec_info, 0);
}
return flxdec_type;
}
static void
-gst_flxdec_base_init (GstFlxDecClass *klass)
+gst_flxdec_base_init (GstFlxDecClass * klass)
{
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
-
+
gst_element_class_set_details (gstelement_class, &flxdec_details);
gst_element_class_add_pad_template (gstelement_class,
- gst_static_pad_template_get (&sink_factory));
+ gst_static_pad_template_get (&sink_factory));
gst_element_class_add_pad_template (gstelement_class,
- gst_static_pad_template_get (&src_video_factory));
+ gst_static_pad_template_get (&src_video_factory));
}
-static void
-gst_flxdec_class_init (GstFlxDecClass *klass)
+static void
+gst_flxdec_class_init (GstFlxDecClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
- gobject_class = (GObjectClass*)klass;
- gstelement_class = (GstElementClass*)klass;
+ gobject_class = (GObjectClass *) klass;
+ gstelement_class = (GstElementClass *) klass;
- parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
+ parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
- gobject_class->set_property = gst_flxdec_set_property;
+ gobject_class->set_property = gst_flxdec_set_property;
gobject_class->get_property = gst_flxdec_get_property;
gstelement_class->change_state = gst_flxdec_change_state;
}
-
-static void
-gst_flxdec_init(GstFlxDec *flxdec)
+
+static void
+gst_flxdec_init (GstFlxDec * flxdec)
{
- flxdec->sinkpad = gst_pad_new_from_template (
- gst_static_pad_template_get (&sink_factory), "sink");
- gst_element_add_pad(GST_ELEMENT(flxdec),flxdec->sinkpad);
- gst_element_set_loop_function(GST_ELEMENT(flxdec),gst_flxdec_loop);
+ flxdec->sinkpad =
+ gst_pad_new_from_template (gst_static_pad_template_get (&sink_factory),
+ "sink");
+ gst_element_add_pad (GST_ELEMENT (flxdec), flxdec->sinkpad);
+ gst_element_set_loop_function (GST_ELEMENT (flxdec), gst_flxdec_loop);
- flxdec->srcpad = gst_pad_new_from_template (
- gst_static_pad_template_get (&src_video_factory), "src");
- gst_element_add_pad(GST_ELEMENT(flxdec),flxdec->srcpad);
+ flxdec->srcpad =
+ gst_pad_new_from_template (gst_static_pad_template_get
+ (&src_video_factory), "src");
+ gst_element_add_pad (GST_ELEMENT (flxdec), flxdec->srcpad);
flxdec->bs = NULL;
flxdec->frame = NULL;
@@ -158,75 +160,74 @@ gst_flxdec_init(GstFlxDec *flxdec)
}
static void
-flx_decode_chunks (GstFlxDec *flxdec , gulong count, gchar *data, gchar *dest)
+flx_decode_chunks (GstFlxDec * flxdec, gulong count, gchar * data, gchar * dest)
{
- FlxFrameChunk *hdr;
+ FlxFrameChunk *hdr;
- g_return_if_fail(data != NULL);
+ g_return_if_fail (data != NULL);
while (count--) {
- hdr = (FlxFrameChunk *) data;
+ hdr = (FlxFrameChunk *) data;
data += FlxFrameChunkSize;
- switch(hdr->id)
- {
+ switch (hdr->id) {
case FLX_COLOR64:
- flx_decode_color(flxdec, data, dest, 2);
- data += rndalign(hdr->size) - FlxFrameChunkSize;
- break;
+ flx_decode_color (flxdec, data, dest, 2);
+ data += rndalign (hdr->size) - FlxFrameChunkSize;
+ break;
case FLX_COLOR256:
- flx_decode_color(flxdec, data, dest, 0);
- data += rndalign(hdr->size) - FlxFrameChunkSize;
- break;
+ flx_decode_color (flxdec, data, dest, 0);
+ data += rndalign (hdr->size) - FlxFrameChunkSize;
+ break;
case FLX_BRUN:
- flx_decode_brun(flxdec, data, dest);
- data += rndalign(hdr->size) - FlxFrameChunkSize;
- break;
+ flx_decode_brun (flxdec, data, dest);
+ data += rndalign (hdr->size) - FlxFrameChunkSize;
+ break;
case FLX_LC:
- flx_decode_delta_fli(flxdec, data, dest);
- data += rndalign(hdr->size) - FlxFrameChunkSize;
- break;
+ flx_decode_delta_fli (flxdec, data, dest);
+ data += rndalign (hdr->size) - FlxFrameChunkSize;
+ break;
case FLX_SS2:
- flx_decode_delta_flc(flxdec, data, dest);
- data += rndalign(hdr->size) - FlxFrameChunkSize;
- break;
+ flx_decode_delta_flc (flxdec, data, dest);
+ data += rndalign (hdr->size) - FlxFrameChunkSize;
+ break;
case FLX_BLACK:
- memset(dest, 0, flxdec->size);
- break;
+ memset (dest, 0, flxdec->size);
+ break;
case FLX_MINI:
- data += rndalign(hdr->size) - FlxFrameChunkSize;
- break;
+ data += rndalign (hdr->size) - FlxFrameChunkSize;
+ break;
default:
- g_print("GstFlxDec: Unimplented chunk type: 0x%02x size: %d\n",
- hdr->id, hdr->size);
- g_print("GstFlxDec: Skipping...\n");
- data += rndalign(hdr->size) - FlxFrameChunkSize;
- break;
+ g_print ("GstFlxDec: Unimplented chunk type: 0x%02x size: %d\n",
+ hdr->id, hdr->size);
+ g_print ("GstFlxDec: Skipping...\n");
+ data += rndalign (hdr->size) - FlxFrameChunkSize;
+ break;
}
}
}
static void
-flx_decode_color(GstFlxDec *flxdec, guchar *data, guchar *dest, gint scale)
+flx_decode_color (GstFlxDec * flxdec, guchar * data, guchar * dest, gint scale)
{
guint packs, count, indx;
- g_return_if_fail(flxdec != NULL);
+ g_return_if_fail (flxdec != NULL);
packs = (data[0] + (data[1] << 8));
data += 2;
- indx = 0;
+ indx = 0;
- g_print("GstFlxDec: cmap packs: %d\n", packs);
+ g_print ("GstFlxDec: cmap packs: %d\n", packs);
while (packs--) {
/* color map index + skip count */
indx += *data++;
@@ -236,23 +237,23 @@ flx_decode_color(GstFlxDec *flxdec, guchar *data, guchar *dest, gint scale)
if (count == 0)
count = 256;
- g_print("GstFlxDec: cmap count: %d (indx: %d)\n", count, indx);
- flx_set_palette_vector(flxdec->converter, indx, count, data, scale);
+ g_print ("GstFlxDec: cmap count: %d (indx: %d)\n", count, indx);
+ flx_set_palette_vector (flxdec->converter, indx, count, data, scale);
data += (count * 3);
}
}
-static void
-flx_decode_brun(GstFlxDec *flxdec, guchar *data, guchar *dest)
+static void
+flx_decode_brun (GstFlxDec * flxdec, guchar * data, guchar * dest)
{
- gulong count, lines, row;
- guchar x;
-
- g_return_if_fail(flxdec != NULL);
+ gulong count, lines, row;
+ guchar x;
+
+ g_return_if_fail (flxdec != NULL);
lines = flxdec->hdr.height;
- while(lines--) {
+ while (lines--) {
/* packet count.
* should not be used anymore, since the flc format can
* contain more then 255 RLE packets. we use the frame
@@ -261,101 +262,101 @@ flx_decode_brun(GstFlxDec *flxdec, guchar *data, guchar *dest)
data++;
row = flxdec->hdr.width;
- while(row) {
+ while (row) {
count = *data++;
- if (count > 0x7f) {
- /* literal run */
- count = 0x100 - count;
- row -= count;
+ if (count > 0x7f) {
+ /* literal run */
+ count = 0x100 - count;
+ row -= count;
+
+ while (count--)
+ *dest++ = *data++;
- while(count--)
- *dest++ = *data++;
-
} else {
- /* replicate run */
- row -= count;
- x = *data++;
+ /* replicate run */
+ row -= count;
+ x = *data++;
- while(count--)
- *dest++ = x;
+ while (count--)
+ *dest++ = x;
}
}
}
}
-static void
-flx_decode_delta_fli(GstFlxDec *flxdec, guchar *data, guchar *dest)
+static void
+flx_decode_delta_fli (GstFlxDec * flxdec, guchar * data, guchar * dest)
{
- gulong count, packets, lines, start_line, start_l;
- guchar *start_p, x;
-
- g_return_if_fail(flxdec != NULL);
- g_return_if_fail(flxdec->delta != NULL);
+ gulong count, packets, lines, start_line, start_l;
+ guchar *start_p, x;
+
+ g_return_if_fail (flxdec != NULL);
+ g_return_if_fail (flxdec->delta != NULL);
/* use last frame for delta */
- memcpy(dest, GST_BUFFER_DATA(flxdec->delta),
- GST_BUFFER_SIZE(flxdec->delta));
+ memcpy (dest, GST_BUFFER_DATA (flxdec->delta),
+ GST_BUFFER_SIZE (flxdec->delta));
start_line = (data[0] + (data[1] << 8));
- lines = (data[2] + (data[3] << 8));
- data += 4;
+ lines = (data[2] + (data[3] << 8));
+ data += 4;
/* start position of delta */
dest += (flxdec->hdr.width * start_line);
start_p = dest;
start_l = lines;
- while(lines--) {
+ while (lines--) {
/* packet count */
packets = *data++;
- while(packets--) {
+ while (packets--) {
/* skip count */
dest += *data++;
/* RLE count */
count = *data++;
- if (count > 0x7f) {
- /* literal run */
- count = 0x100 - count;
- x = *data++;
+ if (count > 0x7f) {
+ /* literal run */
+ count = 0x100 - count;
+ x = *data++;
- while (count--)
- *dest++ = x;
+ while (count--)
+ *dest++ = x;
} else {
- /* replicate run */
- while (count--)
- *dest++ = *data++;
+ /* replicate run */
+ while (count--)
+ *dest++ = *data++;
}
}
start_p += flxdec->hdr.width;
dest = start_p;
- }
+ }
}
-static void
-flx_decode_delta_flc(GstFlxDec *flxdec, guchar *data, guchar *dest)
+static void
+flx_decode_delta_flc (GstFlxDec * flxdec, guchar * data, guchar * dest)
{
- gulong count, lines, start_l, opcode;
- guchar *start_p;
-
- g_return_if_fail(flxdec != NULL);
- g_return_if_fail(flxdec->delta != NULL);
+ gulong count, lines, start_l, opcode;
+ guchar *start_p;
+
+ g_return_if_fail (flxdec != NULL);
+ g_return_if_fail (flxdec->delta != NULL);
/* use last frame for delta */
- memcpy(dest, GST_BUFFER_DATA(flxdec->delta),
- GST_BUFFER_SIZE(flxdec->delta));
+ memcpy (dest, GST_BUFFER_DATA (flxdec->delta),
+ GST_BUFFER_SIZE (flxdec->delta));
- lines = (data[0] + (data[1] << 8));
- data += 2;
+ lines = (data[0] + (data[1] << 8));
+ data += 2;
- start_p = dest;
- start_l = lines;
+ start_p = dest;
+ start_l = lines;
while (lines) {
dest = start_p + (flxdec->hdr.width * (start_l - lines));
@@ -364,47 +365,47 @@ flx_decode_delta_flc(GstFlxDec *flxdec, guchar *data, guchar *dest)
while ((opcode = (data[0] + (data[1] << 8))) & 0xc000) {
data += 2;
if ((opcode & 0xc000) == 0xc000) {
- /* skip count */
- start_l += (0x10000 - opcode);
- dest += flxdec->hdr.width * (0x10000 - opcode);
+ /* skip count */
+ start_l += (0x10000 - opcode);
+ dest += flxdec->hdr.width * (0x10000 - opcode);
} else {
- /* last pixel */
- dest += flxdec->hdr.width;
- *dest++ = (opcode & 0xff);
- }
+ /* last pixel */
+ dest += flxdec->hdr.width;
+ *dest++ = (opcode & 0xff);
+ }
}
data += 2;
/* last opcode is the packet count */
- while(opcode--) {
+ while (opcode--) {
/* skip count */
dest += *data++;
-
+
/* RLE count */
count = *data++;
-
+
if (count > 0x7f) {
- /* replicate word run */
- count = 0x100 - count;
- while (count--) {
- *dest++ = data[0];
- *dest++ = data[1];
- }
- data += 2;
+ /* replicate word run */
+ count = 0x100 - count;
+ while (count--) {
+ *dest++ = data[0];
+ *dest++ = data[1];
+ }
+ data += 2;
} else {
- /* literal word run */
- while (count--) {
- *dest++ = *data++;
- *dest++ = *data++;
- }
+ /* literal word run */
+ while (count--) {
+ *dest++ = *data++;
+ *dest++ = *data++;
+ }
}
}
lines--;
}
}
-
-static GstBuffer*
-flx_get_data(GstFlxDec *flxdec, gulong size)
+
+static GstBuffer *
+flx_get_data (GstFlxDec * flxdec, gulong size)
{
GstBuffer *retbuf;
guint32 got_bytes;
@@ -424,36 +425,36 @@ flx_get_data(GstFlxDec *flxdec, gulong size)
}
-static void
-gst_flxdec_loop (GstElement *element)
+static void
+gst_flxdec_loop (GstElement * element)
{
- GstBuffer *buf;
- GstBuffer *databuf;
- guchar *data, *chunk;
- GstCaps *caps;
-
- GstFlxDec *flxdec;
- FlxHeader *flxh;
- FlxFrameChunk *flxfh;
-
+ GstBuffer *buf;
+ GstBuffer *databuf;
+ guchar *data, *chunk;
+ GstCaps *caps;
+
+ GstFlxDec *flxdec;
+ FlxHeader *flxh;
+ FlxFrameChunk *flxfh;
+
g_return_if_fail (element != NULL);
- g_return_if_fail (GST_IS_FLXDEC(element));
+ g_return_if_fail (GST_IS_FLXDEC (element));
GST_DEBUG ("entering loop function");
-
- flxdec = GST_FLXDEC(element);
+
+ flxdec = GST_FLXDEC (element);
if (flxdec->state == GST_FLXDEC_READ_HEADER) {
- databuf = flx_get_data(flxdec, FlxHeaderSize);
+ databuf = flx_get_data (flxdec, FlxHeaderSize);
if (!databuf) {
g_print ("empty buffer\n");
return;
}
- data = GST_BUFFER_DATA(databuf);
+ data = GST_BUFFER_DATA (databuf);
- memcpy((char *) &flxdec->hdr, data, sizeof(FlxHeader));
+ memcpy ((char *) &flxdec->hdr, data, sizeof (FlxHeader));
gst_buffer_unref (databuf);
@@ -461,119 +462,115 @@ gst_flxdec_loop (GstElement *element)
/* check header */
if (flxh->type != FLX_MAGICHDR_FLI &&
- flxh->type != FLX_MAGICHDR_FLC &&
- flxh->type != FLX_MAGICHDR_FLX) {
- GST_ELEMENT_ERROR (element, STREAM, WRONG_TYPE, (NULL), ("not a flx file (type %d)\n", flxh->type));
+ flxh->type != FLX_MAGICHDR_FLC && flxh->type != FLX_MAGICHDR_FLX) {
+ GST_ELEMENT_ERROR (element, STREAM, WRONG_TYPE, (NULL),
+ ("not a flx file (type %d)\n", flxh->type));
return;
}
-
-
- g_print("GstFlxDec: size : %d\n", flxh->size);
- g_print("GstFlxDec: frames : %d\n", flxh->frames);
- g_print("GstFlxDec: width : %d\n", flxh->width);
- g_print("GstFlxDec: height : %d\n", flxh->height);
- g_print("GstFlxDec: depth : %d\n", flxh->depth);
- g_print("GstFlxDec: speed : %d\n", flxh->speed);
+
+
+ g_print ("GstFlxDec: size : %d\n", flxh->size);
+ g_print ("GstFlxDec: frames : %d\n", flxh->frames);
+ g_print ("GstFlxDec: width : %d\n", flxh->width);
+ g_print ("GstFlxDec: height : %d\n", flxh->height);
+ g_print ("GstFlxDec: depth : %d\n", flxh->depth);
+ g_print ("GstFlxDec: speed : %d\n", flxh->speed);
flxdec->next_time = 0;
if (flxh->type == FLX_MAGICHDR_FLI) {
flxdec->frame_time = JIFFIE * flxh->speed;
- }
- else {
+ } else {
flxdec->frame_time = flxh->speed * GST_MSECOND;
}
-
+
caps = gst_caps_from_string (GST_VIDEO_CAPS_xRGB_HOST_ENDIAN);
gst_caps_set_simple (caps,
- "width", G_TYPE_INT, flxh->width,
+ "width", G_TYPE_INT, flxh->width,
"height", G_TYPE_INT, flxh->height,
- "framerate", G_TYPE_DOUBLE, GST_SECOND/flxdec->frame_time, NULL);
+ "framerate", G_TYPE_DOUBLE, GST_SECOND / flxdec->frame_time, NULL);
- if (flxh->depth <= 8)
- flxdec->converter = flx_colorspace_converter_new(flxh->width, flxh->height);
+ if (flxh->depth <= 8)
+ flxdec->converter =
+ flx_colorspace_converter_new (flxh->width, flxh->height);
- if (flxh->type == FLX_MAGICHDR_FLC ||
- flxh->type == FLX_MAGICHDR_FLX) {
- g_print("GstFlxDec: (FLC) aspect_dx : %d\n", flxh->aspect_dx);
- g_print("GstFlxDec: (FLC) aspect_dy : %d\n", flxh->aspect_dy);
- g_print("GstFlxDec: (FLC) oframe1 : 0x%08x\n", flxh->oframe1);
- g_print("GstFlxDec: (FLC) oframe2 : 0x%08x\n", flxh->oframe2);
+ if (flxh->type == FLX_MAGICHDR_FLC || flxh->type == FLX_MAGICHDR_FLX) {
+ g_print ("GstFlxDec: (FLC) aspect_dx : %d\n", flxh->aspect_dx);
+ g_print ("GstFlxDec: (FLC) aspect_dy : %d\n", flxh->aspect_dy);
+ g_print ("GstFlxDec: (FLC) oframe1 : 0x%08x\n", flxh->oframe1);
+ g_print ("GstFlxDec: (FLC) oframe2 : 0x%08x\n", flxh->oframe2);
}
-
+
flxdec->size = (flxh->width * flxh->height);
-
+
/* create delta and output frame */
- flxdec->frame = gst_buffer_new();
- flxdec->delta = gst_buffer_new();
- GST_BUFFER_DATA(flxdec->frame) = g_malloc(flxdec->size);
- GST_BUFFER_SIZE(flxdec->frame) = flxdec->size;
- GST_BUFFER_DATA(flxdec->delta) = g_malloc(flxdec->size);
- GST_BUFFER_SIZE(flxdec->delta) = flxdec->size;
+ flxdec->frame = gst_buffer_new ();
+ flxdec->delta = gst_buffer_new ();
+ GST_BUFFER_DATA (flxdec->frame) = g_malloc (flxdec->size);
+ GST_BUFFER_SIZE (flxdec->frame) = flxdec->size;
+ GST_BUFFER_DATA (flxdec->delta) = g_malloc (flxdec->size);
+ GST_BUFFER_SIZE (flxdec->delta) = flxdec->size;
flxdec->state = GST_FLXDEC_PLAYING;
- }
- else if (flxdec->state == GST_FLXDEC_PLAYING) {
+ } else if (flxdec->state == GST_FLXDEC_PLAYING) {
GstBuffer *out;
- databuf = flx_get_data(flxdec, FlxFrameChunkSize);
+ databuf = flx_get_data (flxdec, FlxFrameChunkSize);
if (!databuf)
return;
- flxfh = (FlxFrameChunk *) GST_BUFFER_DATA(databuf);
-
- switch(flxfh->id) {
+ flxfh = (FlxFrameChunk *) GST_BUFFER_DATA (databuf);
+
+ switch (flxfh->id) {
case FLX_FRAME_TYPE:
- buf = flx_get_data(flxdec, flxfh->size-FlxFrameChunkSize);
-
- chunk = GST_BUFFER_DATA(buf);
-
- if (((FlxFrameType *)chunk)->chunks == 0)
- break;
-
- /* create 32 bits output frame */
- out = gst_buffer_new();
- GST_BUFFER_DATA(out) = g_malloc(flxdec->size * 4);
- GST_BUFFER_SIZE(out) = flxdec->size * 4;
-
- /* decode chunks */
- flx_decode_chunks(flxdec,
- ((FlxFrameType *)chunk)->chunks,
- GST_BUFFER_DATA(buf) + FlxFrameTypeSize,
- GST_BUFFER_DATA(flxdec->frame));
-
- /* destroy input buffer*/
- gst_buffer_unref(buf);
-
- /* save copy of the current frame for possible delta. */
- memcpy(GST_BUFFER_DATA(flxdec->delta),
- GST_BUFFER_DATA(flxdec->frame),
- GST_BUFFER_SIZE(flxdec->delta));
-
- /* convert current frame. */
- flx_colorspace_convert(flxdec->converter,
- GST_BUFFER_DATA(flxdec->frame),
- GST_BUFFER_DATA(out));
+ buf = flx_get_data (flxdec, flxfh->size - FlxFrameChunkSize);
+
+ chunk = GST_BUFFER_DATA (buf);
+
+ if (((FlxFrameType *) chunk)->chunks == 0)
+ break;
+
+ /* create 32 bits output frame */
+ out = gst_buffer_new ();
+ GST_BUFFER_DATA (out) = g_malloc (flxdec->size * 4);
+ GST_BUFFER_SIZE (out) = flxdec->size * 4;
+
+ /* decode chunks */
+ flx_decode_chunks (flxdec,
+ ((FlxFrameType *) chunk)->chunks,
+ GST_BUFFER_DATA (buf) + FlxFrameTypeSize,
+ GST_BUFFER_DATA (flxdec->frame));
+
+ /* destroy input buffer */
+ gst_buffer_unref (buf);
+
+ /* save copy of the current frame for possible delta. */
+ memcpy (GST_BUFFER_DATA (flxdec->delta),
+ GST_BUFFER_DATA (flxdec->frame), GST_BUFFER_SIZE (flxdec->delta));
+
+ /* convert current frame. */
+ flx_colorspace_convert (flxdec->converter,
+ GST_BUFFER_DATA (flxdec->frame), GST_BUFFER_DATA (out));
GST_BUFFER_TIMESTAMP (out) = flxdec->next_time;
flxdec->next_time += flxdec->frame_time;
- gst_pad_push(flxdec->srcpad, GST_DATA (out));
-
- break;
+ gst_pad_push (flxdec->srcpad, GST_DATA (out));
+
+ break;
}
/* destroy header buffer */
- gst_buffer_unref(databuf);
+ gst_buffer_unref (databuf);
}
}
-static GstElementStateReturn
-gst_flxdec_change_state (GstElement *element)
+static GstElementStateReturn
+gst_flxdec_change_state (GstElement * element)
{
GstFlxDec *flxdec;
- flxdec = GST_FLXDEC(element);
+ flxdec = GST_FLXDEC (element);
switch (GST_STATE_TRANSITION (element)) {
case GST_STATE_NULL_TO_READY:
@@ -596,20 +593,21 @@ gst_flxdec_change_state (GstElement *element)
case GST_STATE_READY_TO_NULL:
break;
}
-
+
parent_class->change_state (element);
return GST_STATE_SUCCESS;
}
-static void
-gst_flxdec_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
+static void
+gst_flxdec_set_property (GObject * object, guint prop_id, const GValue * value,
+ GParamSpec * pspec)
{
GstFlxDec *flxdec;
/* it's not null if we got it, but it might not be ours */
- g_return_if_fail(GST_IS_FLXDEC(object));
- flxdec = GST_FLXDEC(object);
+ g_return_if_fail (GST_IS_FLXDEC (object));
+ flxdec = GST_FLXDEC (object);
switch (prop_id) {
default:
@@ -617,14 +615,15 @@ gst_flxdec_set_property (GObject *object, guint prop_id, const GValue *value, GP
}
}
-static void
-gst_flxdec_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+static void
+gst_flxdec_get_property (GObject * object, guint prop_id, GValue * value,
+ GParamSpec * pspec)
{
GstFlxDec *flxdec;
/* it's not null if we got it, but it might not be ours */
- g_return_if_fail(GST_IS_FLXDEC(object));
- flxdec = GST_FLXDEC(object);
+ g_return_if_fail (GST_IS_FLXDEC (object));
+ flxdec = GST_FLXDEC (object);
switch (prop_id) {
default:
@@ -634,23 +633,17 @@ gst_flxdec_get_property (GObject *object, guint prop_id, GValue *value, GParamSp
}
static gboolean
-plugin_init (GstPlugin *plugin)
+plugin_init (GstPlugin * plugin)
{
if (!gst_library_load ("gstbytestream"))
return FALSE;
return gst_element_register (plugin, "flxdec",
- GST_RANK_PRIMARY, GST_TYPE_FLXDEC);
+ GST_RANK_PRIMARY, GST_TYPE_FLXDEC);
}
-GST_PLUGIN_DEFINE (
- GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "flxdec",
- "FLX video decoder",
- plugin_init,
- VERSION,
- GST_LICENSE,
- GST_PACKAGE,
- GST_ORIGIN
-)
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ "flxdec",
+ "FLX video decoder",
+ plugin_init, VERSION, GST_LICENSE, GST_PACKAGE, GST_ORIGIN)
diff --git a/gst/flx/gstflxdec.h b/gst/flx/gstflxdec.h
index c7d6f3864..c5ce60ecd 100644
--- a/gst/flx/gstflxdec.h
+++ b/gst/flx/gstflxdec.h
@@ -27,42 +27,46 @@
#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
+extern "C"
+{
+#endif /* __cplusplus */
+
+ typedef enum
+ {
+ GST_FLXDEC_READ_HEADER,
+ GST_FLXDEC_PLAYING,
+ } GstFlxDecState;
-typedef enum {
- GST_FLXDEC_READ_HEADER,
- GST_FLXDEC_PLAYING,
-} GstFlxDecState;
-
/* Definition of structure storing data for this element. */
-typedef struct _GstFlxDec GstFlxDec;
+ typedef struct _GstFlxDec GstFlxDec;
-struct _GstFlxDec {
- GstElement element;
+ struct _GstFlxDec
+ {
+ GstElement element;
- GstPad *sinkpad,*srcpad;
+ GstPad *sinkpad, *srcpad;
- gboolean active, new_meta;
+ gboolean active, new_meta;
- GstBuffer *delta, *frame;
- GstByteStream *bs;
- gulong size;
- GstFlxDecState state;
- glong frame_time;
- gint64 next_time;
+ GstBuffer *delta, *frame;
+ GstByteStream *bs;
+ gulong size;
+ GstFlxDecState state;
+ glong frame_time;
+ gint64 next_time;
- FlxColorSpaceConverter *converter;
+ FlxColorSpaceConverter *converter;
- FlxHeader hdr;
-};
+ FlxHeader hdr;
+ };
/* Standard definition defining a class for this element. */
-typedef struct _GstFlxDecClass GstFlxDecClass;
-struct _GstFlxDecClass {
- GstElementClass parent_class;
-};
+ typedef struct _GstFlxDecClass GstFlxDecClass;
+ struct _GstFlxDecClass
+ {
+ GstElementClass parent_class;
+ };
/* Standard macros for defining types for this element. */
#define GST_TYPE_FLXDEC \
@@ -77,12 +81,12 @@ struct _GstFlxDecClass {
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_FLXDEC))
/* Standard function returning type information. */
-GType gst_flxdec_get_type(void);
+ GType gst_flxdec_get_type (void);
#ifdef __cplusplus
}
-#endif /* __cplusplus */
+#endif /* __cplusplus */
-#endif /* __GST_FLX_DECODER_H__ */
+#endif /* __GST_FLX_DECODER_H__ */
diff --git a/gst/mixmatrix/mixmatrix.c b/gst/mixmatrix/mixmatrix.c
index 0551cac02..f7095e278 100644
--- a/gst/mixmatrix/mixmatrix.c
+++ b/gst/mixmatrix/mixmatrix.c
@@ -40,7 +40,8 @@
typedef struct _GstMixMatrix GstMixMatrix;
typedef struct _GstMixMatrixClass GstMixMatrixClass;
-struct _GstMixMatrix {
+struct _GstMixMatrix
+{
GstElement element;
GstCaps *caps;
@@ -59,10 +60,11 @@ struct _GstMixMatrix {
gfloat **matrix;
};
-struct _GstMixMatrixClass {
+struct _GstMixMatrixClass
+{
GstElementClass parent_class;
- void (*resize) (GstMixMatrix *mix);
+ void (*resize) (GstMixMatrix * mix);
};
/* elementfactory information */
@@ -73,13 +75,15 @@ static GstElementDetails mixmatrix_details = {
"Erik Walthinsen <omega@temple-baptist.com>"
};
-enum {
+enum
+{
/* FILL ME */
RESIZE_SIGNAL,
LAST_SIGNAL,
};
-enum {
+enum
+{
ARG_0,
ARG_GRPSIZE,
ARG_OUTSIZE,
@@ -89,59 +93,64 @@ enum {
};
static GstStaticPadTemplate mixmatrix_sink_template =
-GST_STATIC_PAD_TEMPLATE (
- "sink%d",
- GST_PAD_SINK,
- GST_PAD_REQUEST,
- GST_STATIC_CAPS ( GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS )
-);
+GST_STATIC_PAD_TEMPLATE ("sink%d",
+ GST_PAD_SINK,
+ GST_PAD_REQUEST,
+ GST_STATIC_CAPS (GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS)
+ );
static GstStaticPadTemplate mixmatrix_src_template =
-GST_STATIC_PAD_TEMPLATE (
- "src%d",
- GST_PAD_SRC,
- GST_PAD_REQUEST,
- GST_STATIC_CAPS ( GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS )
-);
+GST_STATIC_PAD_TEMPLATE ("src%d",
+ GST_PAD_SRC,
+ GST_PAD_REQUEST,
+ GST_STATIC_CAPS (GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS)
+ );
-static void gst_mixmatrix_class_init (GstMixMatrixClass *klass);
-static void gst_mixmatrix_base_init (GstMixMatrixClass *klass);
-static void gst_mixmatrix_init (GstMixMatrix *element);
+static void gst_mixmatrix_class_init (GstMixMatrixClass * klass);
+static void gst_mixmatrix_base_init (GstMixMatrixClass * klass);
+static void gst_mixmatrix_init (GstMixMatrix * element);
-static void gst_mixmatrix_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
-static void gst_mixmatrix_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
-static GstPad * gst_mixmatrix_request_new_pad (GstElement *element, GstPadTemplate *temp, const gchar *name);
+static void gst_mixmatrix_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec);
+static void gst_mixmatrix_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec);
+static GstPad *gst_mixmatrix_request_new_pad (GstElement * element,
+ GstPadTemplate * temp, const gchar * name);
-static GstPadLinkReturn gst_mixmatrix_connect (GstPad *pad, const GstCaps *caps);
+static GstPadLinkReturn gst_mixmatrix_connect (GstPad * pad,
+ const GstCaps * caps);
-static void gst_mixmatrix_loop (GstElement *element);
+static void gst_mixmatrix_loop (GstElement * element);
-static guint gst_mixmatrix_signals[LAST_SIGNAL] = { 0 };
-static GstElementClass *parent_class = NULL;
+static guint gst_mixmatrix_signals[LAST_SIGNAL] = { 0 };
+static GstElementClass *parent_class = NULL;
GType
-gst_mixmatrix_get_type(void) {
+gst_mixmatrix_get_type (void)
+{
static GType mixmatrix_type = 0;
if (!mixmatrix_type) {
static const GTypeInfo mixmatrix_info = {
- sizeof(GstMixMatrixClass),
- (GBaseInitFunc)gst_mixmatrix_base_init,
+ sizeof (GstMixMatrixClass),
+ (GBaseInitFunc) gst_mixmatrix_base_init,
NULL,
- (GClassInitFunc)gst_mixmatrix_class_init,
+ (GClassInitFunc) gst_mixmatrix_class_init,
NULL,
NULL,
- sizeof(GstMixMatrix),
+ sizeof (GstMixMatrix),
0,
- (GInstanceInitFunc)gst_mixmatrix_init,
+ (GInstanceInitFunc) gst_mixmatrix_init,
};
- mixmatrix_type = g_type_register_static(GST_TYPE_ELEMENT, "GstMixMatrix", &mixmatrix_info, 0);
+ mixmatrix_type =
+ g_type_register_static (GST_TYPE_ELEMENT, "GstMixMatrix",
+ &mixmatrix_info, 0);
}
return mixmatrix_type;
}
static void
-gst_mixmatrix_base_init (GstMixMatrixClass *klass)
+gst_mixmatrix_base_init (GstMixMatrixClass * klass)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
@@ -153,36 +162,34 @@ gst_mixmatrix_base_init (GstMixMatrixClass *klass)
}
static void
-gst_mixmatrix_class_init (GstMixMatrixClass *klass)
+gst_mixmatrix_class_init (GstMixMatrixClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
- gobject_class = (GObjectClass *)klass;
- gstelement_class = (GstElementClass *)klass;
+ gobject_class = (GObjectClass *) klass;
+ gstelement_class = (GstElementClass *) klass;
- parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
+ parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
gst_mixmatrix_signals[RESIZE_SIGNAL] =
- g_signal_new("resize",
- G_TYPE_FROM_CLASS(klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(GstMixMatrixClass, resize),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_SINKPADS,
- g_param_spec_int("sinkpads","Sink Pads","Number of sink pads in matrix",
- 0, G_MAXINT, 8, G_PARAM_READABLE));
-
- g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_SRCPADS,
- g_param_spec_int("srcpads","Src Pads","Number of src pads in matrix",
- 0, G_MAXINT, 8, G_PARAM_READABLE));
-
- g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_MATRIXPTR,
- g_param_spec_pointer("matrixptr","Matrix Pointer","Pointer to gfloat mix matrix",
- G_PARAM_READABLE));
+ g_signal_new ("resize",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GstMixMatrixClass, resize),
+ NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
+
+ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SINKPADS,
+ g_param_spec_int ("sinkpads", "Sink Pads",
+ "Number of sink pads in matrix", 0, G_MAXINT, 8, G_PARAM_READABLE));
+
+ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SRCPADS,
+ g_param_spec_int ("srcpads", "Src Pads", "Number of src pads in matrix",
+ 0, G_MAXINT, 8, G_PARAM_READABLE));
+
+ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MATRIXPTR,
+ g_param_spec_pointer ("matrixptr", "Matrix Pointer",
+ "Pointer to gfloat mix matrix", G_PARAM_READABLE));
gobject_class->set_property = gst_mixmatrix_set_property;
gobject_class->get_property = gst_mixmatrix_get_property;
@@ -190,32 +197,34 @@ gst_mixmatrix_class_init (GstMixMatrixClass *klass)
}
static gfloat **
-mixmatrix_alloc_matrix (int x,int y)
+mixmatrix_alloc_matrix (int x, int y)
{
gfloat **matrix;
int i;
- GST_DEBUG ("mixmatrix: allocating a %dx%d matrix of floats\n",x,y);
- matrix = g_new(gfloat *,x);
- GST_DEBUG ("mixmatrix: %p: ",matrix);
- for (i=0;i<x;i++) {
- matrix[i] = g_new(gfloat,y);
- GST_DEBUG ("%p, ",matrix[i]);
+
+ GST_DEBUG ("mixmatrix: allocating a %dx%d matrix of floats\n", x, y);
+ matrix = g_new (gfloat *, x);
+ GST_DEBUG ("mixmatrix: %p: ", matrix);
+ for (i = 0; i < x; i++) {
+ matrix[i] = g_new (gfloat, y);
+ GST_DEBUG ("%p, ", matrix[i]);
}
GST_DEBUG ("\n");
return matrix;
}
static void
-mixmatrix_free_matrix (gfloat **matrix,int x)
+mixmatrix_free_matrix (gfloat ** matrix, int x)
{
int i;
- for (i=0;i<x;i++)
- g_free(matrix[i]);
- g_free(matrix);
+
+ for (i = 0; i < x; i++)
+ g_free (matrix[i]);
+ g_free (matrix);
}
static void
-gst_mixmatrix_init (GstMixMatrix *mix)
+gst_mixmatrix_init (GstMixMatrix * mix)
{
mix->grpsize = 8;
mix->outsize = 1024;
@@ -225,29 +234,31 @@ gst_mixmatrix_init (GstMixMatrix *mix)
mix->srcpadalloc = mix->grpsize;
// allocate the pads
- mix->sinkpads = g_new(GstPad *,mix->sinkpadalloc);
- mix->sinkbs = g_new(GstByteStream *,mix->sinkpadalloc);
+ mix->sinkpads = g_new (GstPad *, mix->sinkpadalloc);
+ mix->sinkbs = g_new (GstByteStream *, mix->sinkpadalloc);
- mix->srcpads = g_new(GstPad *,mix->srcpadalloc);
+ mix->srcpads = g_new (GstPad *, mix->srcpadalloc);
// allocate a similarly sized matrix
- mix->matrix = mixmatrix_alloc_matrix(mix->sinkpadalloc,mix->srcpadalloc);
+ mix->matrix = mixmatrix_alloc_matrix (mix->sinkpadalloc, mix->srcpadalloc);
// set the loop function that does all the work
- gst_element_set_loop_function(GST_ELEMENT(mix), gst_mixmatrix_loop);
+ gst_element_set_loop_function (GST_ELEMENT (mix), gst_mixmatrix_loop);
}
#define ROUND_UP(val,bound) ((((val)/bound)+1)*bound)
-static void **grow_ptrlist(void **origlist,int origsize,int newsize) {
- void **newlist = g_new(void *,newsize);
- memcpy(newlist,origlist,sizeof(void*)*origsize);
- g_free(origlist);
+static void **
+grow_ptrlist (void **origlist, int origsize, int newsize)
+{
+ void **newlist = g_new (void *, newsize);
+ memcpy (newlist, origlist, sizeof (void *) * origsize);
+ g_free (origlist);
return newlist;
}
void
-mixmatrix_resize(GstMixMatrix *mix, int sinkpads, int srcpads)
+mixmatrix_resize (GstMixMatrix * mix, int sinkpads, int srcpads)
{
int sinkresize = (sinkpads != mix->sinkpadalloc);
int srcresize = (srcpads != mix->srcpadalloc);
@@ -259,32 +270,37 @@ mixmatrix_resize(GstMixMatrix *mix, int sinkpads, int srcpads)
// check the sinkpads list
if (sinkresize) {
- mix->sinkpads = (GstPad **)grow_ptrlist((void **)mix->sinkpads,mix->sinkpadalloc,sinkpads);
- mix->sinkbs = (GstByteStream **)grow_ptrlist((void **)mix->sinkbs,mix->sinkpadalloc,sinkpads);
+ mix->sinkpads =
+ (GstPad **) grow_ptrlist ((void **) mix->sinkpads, mix->sinkpadalloc,
+ sinkpads);
+ mix->sinkbs =
+ (GstByteStream **) grow_ptrlist ((void **) mix->sinkbs,
+ mix->sinkpadalloc, sinkpads);
}
-
// check the srcpads list
if (srcresize) {
- mix->srcpads = (GstPad **)grow_ptrlist((void **)mix->srcpads,mix->srcpadalloc,srcpads);
+ mix->srcpads =
+ (GstPad **) grow_ptrlist ((void **) mix->srcpads, mix->srcpadalloc,
+ srcpads);
}
-
// now resize the matrix if either has changed
if (sinkresize || srcresize) {
// allocate the new matrix
- newmatrix = mixmatrix_alloc_matrix(sinkpads,srcpads);
+ newmatrix = mixmatrix_alloc_matrix (sinkpads, srcpads);
// if only the srcpad count changed (y axis), we can just copy
if (!sinkresize) {
- memcpy(newmatrix,mix->matrix,sizeof(gfloat *)*sinkpads);
- // otherwise we have to copy line by line
+ memcpy (newmatrix, mix->matrix, sizeof (gfloat *) * sinkpads);
+ // otherwise we have to copy line by line
} else {
- for (i=0;i<mix->srcpadalloc;i++)
- memcpy(newmatrix[i], mix->matrix[i], sizeof(gfloat) * mix->srcpadalloc);
+ for (i = 0; i < mix->srcpadalloc; i++)
+ memcpy (newmatrix[i], mix->matrix[i],
+ sizeof (gfloat) * mix->srcpadalloc);
}
// would signal here!
// free old matrix and replace it
- mixmatrix_free_matrix(mix->matrix, mix->sinkpadalloc);
+ mixmatrix_free_matrix (mix->matrix, mix->sinkpadalloc);
mix->matrix = newmatrix;
}
@@ -319,76 +335,79 @@ gst_mixmatrix_set_all_caps (GstMixMatrix *mix)
*/
static GstPadLinkReturn
-gst_mixmatrix_connect (GstPad *pad, const GstCaps *caps)
+gst_mixmatrix_connect (GstPad * pad, const GstCaps * caps)
{
- GstMixMatrix *mix = GST_MIXMATRIX(GST_PAD_PARENT(pad));
+ GstMixMatrix *mix = GST_MIXMATRIX (GST_PAD_PARENT (pad));
gint i;
- for (i=0;i<mix->srcpadalloc;i++) {
+ for (i = 0; i < mix->srcpadalloc; i++) {
if (mix->srcpads[i]) {
- if (GST_PAD_CAPS(mix->srcpads[i]) == NULL) {
- if (gst_pad_try_set_caps(mix->srcpads[i], caps) <= 0) {
+ if (GST_PAD_CAPS (mix->srcpads[i]) == NULL) {
+ if (gst_pad_try_set_caps (mix->srcpads[i], caps) <= 0) {
return GST_PAD_LINK_REFUSED;
}
}
}
}
- mix->caps = gst_caps_copy(caps);
+ mix->caps = gst_caps_copy (caps);
return GST_PAD_LINK_OK;
}
static GstPad *
-gst_mixmatrix_request_new_pad (GstElement *element, GstPadTemplate *templ, const gchar *name)
+gst_mixmatrix_request_new_pad (GstElement * element, GstPadTemplate * templ,
+ const gchar * name)
{
GstMixMatrix *mix;
gint padnum;
GstPad *pad = NULL;
- g_return_val_if_fail(element != NULL, NULL);
- g_return_val_if_fail(GST_IS_MIXMATRIX(element), NULL);
+ g_return_val_if_fail (element != NULL, NULL);
+ g_return_val_if_fail (GST_IS_MIXMATRIX (element), NULL);
- mix = GST_MIXMATRIX(element);
+ mix = GST_MIXMATRIX (element);
// figure out if it's a sink pad
- if (sscanf(name,"sink%d",&padnum)) {
+ if (sscanf (name, "sink%d", &padnum)) {
// check to see if it already exists
if (padnum < mix->sinkpadalloc && mix->sinkpads[padnum])
return mix->sinkpads[padnum];
// determine if it's bigger than the current size
if (padnum >= mix->sinkpadalloc)
- mixmatrix_resize(mix, ROUND_UP(padnum,mix->grpsize), mix->sinkpadalloc);
-
- pad = gst_pad_new_from_template(
- gst_static_pad_template_get (&mixmatrix_sink_template), name);
- GST_PAD_ELEMENT_PRIVATE(pad) = GINT_TO_POINTER(padnum);
- gst_element_add_pad(GST_ELEMENT(mix), pad);
+ mixmatrix_resize (mix, ROUND_UP (padnum, mix->grpsize),
+ mix->sinkpadalloc);
+
+ pad =
+ gst_pad_new_from_template (gst_static_pad_template_get
+ (&mixmatrix_sink_template), name);
+ GST_PAD_ELEMENT_PRIVATE (pad) = GINT_TO_POINTER (padnum);
+ gst_element_add_pad (GST_ELEMENT (mix), pad);
// g_signal_connect(G_OBJECT(pad), "unlink", G_CALLBACK(sink_unlinked), mix);
gst_pad_set_link_function (pad, gst_mixmatrix_connect);
// create a bytestream for it
- mix->sinkbs[padnum] = gst_bytestream_new(pad);
+ mix->sinkbs[padnum] = gst_bytestream_new (pad);
// store away the pad and account for it
mix->sinkpads[padnum] = pad;
}
-
// or it's a src pad
- else if (sscanf(name,"src%d",&padnum)) {
+ else if (sscanf (name, "src%d", &padnum)) {
// check to see if it already exists
if (padnum < mix->srcpadalloc && mix->srcpads[padnum])
return mix->srcpads[padnum];
// determine if it's bigger than the current size
if (padnum >= mix->srcpadalloc)
- mixmatrix_resize(mix, ROUND_UP(padnum,mix->grpsize), mix->srcpadalloc);
+ mixmatrix_resize (mix, ROUND_UP (padnum, mix->grpsize), mix->srcpadalloc);
- pad = gst_pad_new_from_template(
- gst_static_pad_template_get (&mixmatrix_src_template), name);
- GST_PAD_ELEMENT_PRIVATE(pad) = GINT_TO_POINTER(padnum);
- gst_element_add_pad(GST_ELEMENT(mix), pad);
+ pad =
+ gst_pad_new_from_template (gst_static_pad_template_get
+ (&mixmatrix_src_template), name);
+ GST_PAD_ELEMENT_PRIVATE (pad) = GINT_TO_POINTER (padnum);
+ gst_element_add_pad (GST_ELEMENT (mix), pad);
// g_signal_connect(G_OBJECT(pad), "unlink", G_CALLBACK(sink_unlinked), mix);
//gst_pad_set_link_function (pad, gst_mixmatrix_connect);
@@ -400,38 +419,38 @@ gst_mixmatrix_request_new_pad (GstElement *element, GstPadTemplate *templ, const
}
static void
-gst_mixmatrix_loop (GstElement *element)
+gst_mixmatrix_loop (GstElement * element)
{
- GstMixMatrix *mix = GST_MIXMATRIX(element);
- int i,j,k;
+ GstMixMatrix *mix = GST_MIXMATRIX (element);
+ int i, j, k;
GstBuffer **inbufs;
gfloat **infloats;
GstBuffer **outbufs;
gfloat **outfloats;
- int bytesize = sizeof(gfloat)*mix->outsize;
+ int bytesize = sizeof (gfloat) * mix->outsize;
gfloat gain;
// create the output buffers
- outbufs = g_new(GstBuffer *,mix->srcpadalloc);
- outfloats = g_new(gfloat *,mix->srcpadalloc);
- for (i=0;i<mix->srcpadalloc;i++) {
+ outbufs = g_new (GstBuffer *, mix->srcpadalloc);
+ outfloats = g_new (gfloat *, mix->srcpadalloc);
+ for (i = 0; i < mix->srcpadalloc; i++) {
if (mix->srcpads[i] != NULL) {
- outbufs[i] = gst_buffer_new_and_alloc(bytesize);
- outfloats[i] = (gfloat *)GST_BUFFER_DATA(outbufs[i]);
- memset(outfloats[i],0,bytesize);
+ outbufs[i] = gst_buffer_new_and_alloc (bytesize);
+ outfloats[i] = (gfloat *) GST_BUFFER_DATA (outbufs[i]);
+ memset (outfloats[i], 0, bytesize);
}
}
// go through all the input buffers and pull them
- inbufs = g_new(GstBuffer *,mix->sinkpadalloc);
- infloats = g_new(gfloat *,mix->sinkpadalloc);
- for (i=0;i<mix->sinkpadalloc;i++) {
+ inbufs = g_new (GstBuffer *, mix->sinkpadalloc);
+ infloats = g_new (gfloat *, mix->sinkpadalloc);
+ for (i = 0; i < mix->sinkpadalloc; i++) {
if (mix->sinkpads[i] != NULL) {
- gst_bytestream_read(mix->sinkbs[i],&inbufs[i],bytesize);
- infloats[i] = (gfloat *)GST_BUFFER_DATA(inbufs[i]);
+ gst_bytestream_read (mix->sinkbs[i], &inbufs[i], bytesize);
+ infloats[i] = (gfloat *) GST_BUFFER_DATA (inbufs[i]);
// loop through each src pad
- for (j=0;j<mix->srcpadalloc;j++) {
- if (mix->srcpads[j] != NULL) {
+ for (j = 0; j < mix->srcpadalloc; j++) {
+ if (mix->srcpads[j] != NULL) {
/*
{
int z;
@@ -442,31 +461,32 @@ gst_mixmatrix_loop (GstElement *element)
}
fprintf(stderr,"attempting to get gain for %dx%d\n",i,j);
*/
- gain = mix->matrix[i][j];
+ gain = mix->matrix[i][j];
// fprintf(stderr,"%d->%d=%0.2f ",i,j,gain);
- for (k=0;k<mix->outsize;k++) {
- outfloats[j][k] += infloats[i][k] * gain;
- }
- }
+ for (k = 0; k < mix->outsize; k++) {
+ outfloats[j][k] += infloats[i][k] * gain;
+ }
+ }
}
}
}
// fprintf(stderr,"\n");
- for (i=0;i<mix->srcpadalloc;i++) {
+ for (i = 0; i < mix->srcpadalloc; i++) {
if (mix->srcpads[i] != NULL) {
- gst_pad_push(mix->srcpads[i],GST_DATA (outbufs[i]));
+ gst_pad_push (mix->srcpads[i], GST_DATA (outbufs[i]));
}
}
}
static void
-gst_mixmatrix_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
+gst_mixmatrix_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec)
{
GstMixMatrix *mix;
- g_return_if_fail(GST_IS_MIXMATRIX(object));
- mix = GST_MIXMATRIX(object);
+ g_return_if_fail (GST_IS_MIXMATRIX (object));
+ mix = GST_MIXMATRIX (object);
switch (prop_id) {
default:
@@ -475,22 +495,23 @@ gst_mixmatrix_set_property (GObject *object, guint prop_id, const GValue *value,
}
static void
-gst_mixmatrix_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+gst_mixmatrix_get_property (GObject * object, guint prop_id, GValue * value,
+ GParamSpec * pspec)
{
GstMixMatrix *mix;
- g_return_if_fail(GST_IS_MIXMATRIX(object));
- mix = GST_MIXMATRIX(object);
+ g_return_if_fail (GST_IS_MIXMATRIX (object));
+ mix = GST_MIXMATRIX (object);
switch (prop_id) {
case ARG_SINKPADS:
- g_value_set_int(value, mix->sinkpadalloc);
+ g_value_set_int (value, mix->sinkpadalloc);
break;
case ARG_SRCPADS:
- g_value_set_int(value, mix->srcpadalloc);
+ g_value_set_int (value, mix->srcpadalloc);
break;
case ARG_MATRIXPTR:
- g_value_set_pointer(value, mix->matrix);
+ g_value_set_pointer (value, mix->matrix);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -499,23 +520,17 @@ gst_mixmatrix_get_property (GObject *object, guint prop_id, GValue *value, GPara
}
static gboolean
-plugin_init (GstPlugin *plugin)
+plugin_init (GstPlugin * plugin)
{
if (!gst_library_load ("gstbytestream"))
return FALSE;
return gst_element_register (plugin, "mixmatrix",
- GST_RANK_NONE, GST_TYPE_MIXMATRIX);
+ GST_RANK_NONE, GST_TYPE_MIXMATRIX);
}
-GST_PLUGIN_DEFINE (
- GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "mixmatrix",
- "An audio mixer matrix",
- plugin_init,
- VERSION,
- GST_LICENSE,
- GST_PACKAGE,
- GST_ORIGIN
-)
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ "mixmatrix",
+ "An audio mixer matrix",
+ plugin_init, VERSION, GST_LICENSE, GST_PACKAGE, GST_ORIGIN)
diff --git a/gst/modplug/gstmodplug.h b/gst/modplug/gstmodplug.h
index c4a98b867..f32c9a9ab 100644
--- a/gst/modplug/gstmodplug.h
+++ b/gst/modplug/gstmodplug.h
@@ -22,15 +22,16 @@
#define __GST_MODPLUG_H__
#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
+extern "C"
+{
+#endif /* __cplusplus */
#include <gst/gst.h>
#include <gst/bytestream/bytestream.h>
-
+
#define GST_TYPE_MODPLUG \
(gst_modplug_get_type())
-
+
#define GST_MODPLUG(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_MODPLUG,GstModPlug))
#define GST_MODPLUG_CLASS(klass) \
@@ -39,57 +40,59 @@ extern "C" {
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_MODPLUG))
#define GST_IS_MODPLUG_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_MODPLUG))
-
-struct _GstModPlug {
- GstElement element;
- GstPad *sinkpad, *srcpad;
- guint8 *buffer_in;
- GstByteStream *bs;
-
- const gchar *songname;
- gboolean reverb;
- gint reverb_depth;
- gint reverb_delay;
- gboolean megabass;
- gint megabass_amount;
- gint megabass_range;
- gboolean surround;
- gint surround_depth;
- gint surround_delay;
- gboolean noise_reduction;
- gboolean _16bit;
- gboolean oversamp;
- gint channel;
- gint frequency;
-
- guchar *audiobuffer;
- gint32 length;
- guint state;
- guint bitsPerSample;
- gboolean need_discont;
- gboolean eos;
- gint64 seek_at;
- guint64 song_size;
- guint64 timestamp;
-
- CSoundFile *mSoundFile;
- gboolean opened; /* set to TRUE when mSoundFile is created */
-};
-
-struct _GstModPlugClass {
- GstElementClass parent_class;
-};
-
-typedef struct _GstModPlug GstModPlug;
-typedef struct _GstModPlugClass GstModPlugClass;
-
-GstPad *srcpad;
-int need_sync;
-
-GType gst_modplug_get_type(void);
+
+ struct _GstModPlug
+ {
+ GstElement element;
+ GstPad *sinkpad, *srcpad;
+ guint8 *buffer_in;
+ GstByteStream *bs;
+
+ const gchar *songname;
+ gboolean reverb;
+ gint reverb_depth;
+ gint reverb_delay;
+ gboolean megabass;
+ gint megabass_amount;
+ gint megabass_range;
+ gboolean surround;
+ gint surround_depth;
+ gint surround_delay;
+ gboolean noise_reduction;
+ gboolean _16bit;
+ gboolean oversamp;
+ gint channel;
+ gint frequency;
+
+ guchar *audiobuffer;
+ gint32 length;
+ guint state;
+ guint bitsPerSample;
+ gboolean need_discont;
+ gboolean eos;
+ gint64 seek_at;
+ guint64 song_size;
+ guint64 timestamp;
+
+ CSoundFile *mSoundFile;
+ gboolean opened; /* set to TRUE when mSoundFile is created */
+ };
+
+ struct _GstModPlugClass
+ {
+ GstElementClass parent_class;
+ };
+
+ typedef struct _GstModPlug GstModPlug;
+ typedef struct _GstModPlugClass GstModPlugClass;
+
+ GstPad *srcpad;
+ int need_sync;
+
+ GType gst_modplug_get_type (void);
#ifdef __cplusplus
}
-#endif /* __cplusplus */
+#endif /* __cplusplus */
-#endif /* __GST_MODPLUG_H__ */
+#endif /* __GST_MODPLUG_H__ */
diff --git a/gst/modplug/libmodplug/it_defs.h b/gst/modplug/libmodplug/it_defs.h
index 732ce45c0..48ff0b151 100644
--- a/gst/modplug/libmodplug/it_defs.h
+++ b/gst/modplug/libmodplug/it_defs.h
@@ -5,125 +5,125 @@
typedef struct tagITFILEHEADER
{
- DWORD id; /* 0x4D504D49 */
- CHAR songname[26];
- WORD reserved1; /* 0x1004 */
- WORD ordnum;
- WORD insnum;
- WORD smpnum;
- WORD patnum;
- WORD cwtv;
- WORD cmwt;
- WORD flags;
- WORD special;
- BYTE globalvol;
- BYTE mv;
- BYTE speed;
- BYTE tempo;
- BYTE sep;
- BYTE zero;
- WORD msglength;
- DWORD msgoffset;
- DWORD reserved2;
- BYTE chnpan[64];
- BYTE chnvol[64];
+ DWORD id; /* 0x4D504D49 */
+ CHAR songname[26];
+ WORD reserved1; /* 0x1004 */
+ WORD ordnum;
+ WORD insnum;
+ WORD smpnum;
+ WORD patnum;
+ WORD cwtv;
+ WORD cmwt;
+ WORD flags;
+ WORD special;
+ BYTE globalvol;
+ BYTE mv;
+ BYTE speed;
+ BYTE tempo;
+ BYTE sep;
+ BYTE zero;
+ WORD msglength;
+ DWORD msgoffset;
+ DWORD reserved2;
+ BYTE chnpan[64];
+ BYTE chnvol[64];
} ITFILEHEADER;
typedef struct tagITENVELOPE
{
- BYTE flags;
- BYTE num;
- BYTE lpb;
- BYTE lpe;
- BYTE slb;
- BYTE sle;
- BYTE data[25*3];
- BYTE reserved;
+ BYTE flags;
+ BYTE num;
+ BYTE lpb;
+ BYTE lpe;
+ BYTE slb;
+ BYTE sle;
+ BYTE data[25 * 3];
+ BYTE reserved;
} ITENVELOPE;
/* Old Impulse Instrument Format (cmwt < 0x200) */
typedef struct tagITOLDINSTRUMENT
{
- DWORD id; /* IMPI = 0x49504D49 */
- CHAR filename[12]; /* DOS file name */
- BYTE zero;
- BYTE flags;
- BYTE vls;
- BYTE vle;
- BYTE sls;
- BYTE sle;
- WORD reserved1;
- WORD fadeout;
- BYTE nna;
- BYTE dnc;
- WORD trkvers;
- BYTE nos;
- BYTE reserved2;
- CHAR name[26];
- WORD reserved3[3];
- BYTE keyboard[240];
- BYTE volenv[200];
- BYTE nodes[50];
+ DWORD id; /* IMPI = 0x49504D49 */
+ CHAR filename[12]; /* DOS file name */
+ BYTE zero;
+ BYTE flags;
+ BYTE vls;
+ BYTE vle;
+ BYTE sls;
+ BYTE sle;
+ WORD reserved1;
+ WORD fadeout;
+ BYTE nna;
+ BYTE dnc;
+ WORD trkvers;
+ BYTE nos;
+ BYTE reserved2;
+ CHAR name[26];
+ WORD reserved3[3];
+ BYTE keyboard[240];
+ BYTE volenv[200];
+ BYTE nodes[50];
} ITOLDINSTRUMENT;
/* Impulse Instrument Format */
typedef struct tagITINSTRUMENT
{
- DWORD id;
- CHAR filename[12];
- BYTE zero;
- BYTE nna;
- BYTE dct;
- BYTE dca;
- WORD fadeout;
- signed char pps;
- BYTE ppc;
- BYTE gbv;
- BYTE dfp;
- BYTE rv;
- BYTE rp;
- WORD trkvers;
- BYTE nos;
- BYTE reserved1;
- CHAR name[26];
- BYTE ifc;
- BYTE ifr;
- BYTE mch;
- BYTE mpr;
- WORD mbank;
- BYTE keyboard[240];
- ITENVELOPE volenv;
- ITENVELOPE panenv;
- ITENVELOPE pitchenv;
- BYTE dummy[4]; /* was 7, but IT v2.17 saves 554 bytes */
+ DWORD id;
+ CHAR filename[12];
+ BYTE zero;
+ BYTE nna;
+ BYTE dct;
+ BYTE dca;
+ WORD fadeout;
+ signed char pps;
+ BYTE ppc;
+ BYTE gbv;
+ BYTE dfp;
+ BYTE rv;
+ BYTE rp;
+ WORD trkvers;
+ BYTE nos;
+ BYTE reserved1;
+ CHAR name[26];
+ BYTE ifc;
+ BYTE ifr;
+ BYTE mch;
+ BYTE mpr;
+ WORD mbank;
+ BYTE keyboard[240];
+ ITENVELOPE volenv;
+ ITENVELOPE panenv;
+ ITENVELOPE pitchenv;
+ BYTE dummy[4]; /* was 7, but IT v2.17 saves 554 bytes */
} ITINSTRUMENT;
/* IT Sample Format */
typedef struct ITSAMPLESTRUCT
{
- DWORD id; /* 0x53504D49 */
- CHAR filename[12];
- BYTE zero;
- BYTE gvl;
- BYTE flags;
- BYTE vol;
- CHAR name[26];
- BYTE cvt;
- BYTE dfp;
- DWORD length;
- DWORD loopbegin;
- DWORD loopend;
- DWORD C5Speed;
- DWORD susloopbegin;
- DWORD susloopend;
- DWORD samplepointer;
- BYTE vis;
- BYTE vid;
- BYTE vir;
- BYTE vit;
+ DWORD id; /* 0x53504D49 */
+ CHAR filename[12];
+ BYTE zero;
+ BYTE gvl;
+ BYTE flags;
+ BYTE vol;
+ CHAR name[26];
+ BYTE cvt;
+ BYTE dfp;
+ DWORD length;
+ DWORD loopbegin;
+ DWORD loopend;
+ DWORD C5Speed;
+ DWORD susloopbegin;
+ DWORD susloopend;
+ DWORD samplepointer;
+ BYTE vis;
+ BYTE vid;
+ BYTE vir;
+ BYTE vit;
} ITSAMPLESTRUCT;
#pragma pack()
diff --git a/gst/modplug/libmodplug/modplug.h b/gst/modplug/libmodplug/modplug.h
index fd8ec02f9..877060d0b 100644
--- a/gst/modplug/libmodplug/modplug.h
+++ b/gst/modplug/libmodplug/modplug.h
@@ -8,30 +8,31 @@
#define MODPLUG_H__INCLUDED
#ifdef __cplusplus
-extern "C" {
+extern "C"
+{
#endif
-struct _ModPlugFile;
-typedef struct _ModPlugFile ModPlugFile;
+ struct _ModPlugFile;
+ typedef struct _ModPlugFile ModPlugFile;
/* Load a mod file. [data] should point to a block of memory containing the complete
* file, and [size] should be the size of that block.
* Return the loaded mod file on success, or NULL on failure. */
-ModPlugFile* ModPlug_Load(const void* data, int size);
+ ModPlugFile *ModPlug_Load (const void *data, int size);
/* Unload a mod file. */
-void ModPlug_Unload(ModPlugFile* file);
+ void ModPlug_Unload (ModPlugFile * file);
/* Read sample data into the buffer. Returns the number of bytes read. If the end
* of the mod has been reached, zero is returned. */
-int ModPlug_Read(ModPlugFile* file, void* buffer, int size);
+ int ModPlug_Read (ModPlugFile * file, void *buffer, int size);
/* Get the name of the mod. The returned buffer is stored within the ModPlugFile
* structure and will remain valid until you unload the file. */
-const char* ModPlug_GetName(ModPlugFile* file);
+ const char *ModPlug_GetName (ModPlugFile * file);
/* Get the length of the mod, in milliseconds. Note that this result is not always
* accurate, especially in the case of mods with loops. */
-int ModPlug_GetLength(ModPlugFile* file);
+ int ModPlug_GetLength (ModPlugFile * file);
/* Seek to a particular position in the song. Note that seeking and MODs don't mix very
* well. Some mods will be missing instruments for a short time after a seek, as ModPlug
@@ -39,54 +40,54 @@ int ModPlug_GetLength(ModPlugFile* file);
* playing at that time. (Doing so would be difficult and not very reliable.) Also,
* note that seeking is not very exact in some mods -- especially those for which
* ModPlug_GetLength() does not report the full length. */
-void ModPlug_Seek(ModPlugFile* file, int millisecond);
+ void ModPlug_Seek (ModPlugFile * file, int millisecond);
-enum _ModPlug_Flags
-{
- MODPLUG_ENABLE_OVERSAMPLING = 1 << 0, /* Enable oversampling (*highly* recommended) */
- MODPLUG_ENABLE_NOISE_REDUCTION = 1 << 1, /* Enable noise reduction */
- MODPLUG_ENABLE_REVERB = 1 << 2, /* Enable reverb */
- MODPLUG_ENABLE_MEGABASS = 1 << 3, /* Enable megabass */
- MODPLUG_ENABLE_SURROUND = 1 << 4 /* Enable surround sound. */
-};
-
-enum _ModPlug_ResamplingMode
-{
- MODPLUG_RESAMPLE_NEAREST = 0, /* No interpolation (very fast, extremely bad sound quality) */
- MODPLUG_RESAMPLE_LINEAR = 1, /* Linear interpolation (fast, good quality) */
- MODPLUG_RESAMPLE_SPLINE = 2, /* Cubic spline interpolation (high quality) */
- MODPLUG_RESAMPLE_FIR = 3 /* 8-tap fir filter (extremely high quality) */
-};
+ enum _ModPlug_Flags
+ {
+ MODPLUG_ENABLE_OVERSAMPLING = 1 << 0, /* Enable oversampling (*highly* recommended) */
+ MODPLUG_ENABLE_NOISE_REDUCTION = 1 << 1, /* Enable noise reduction */
+ MODPLUG_ENABLE_REVERB = 1 << 2, /* Enable reverb */
+ MODPLUG_ENABLE_MEGABASS = 1 << 3, /* Enable megabass */
+ MODPLUG_ENABLE_SURROUND = 1 << 4 /* Enable surround sound. */
+ };
-typedef struct _ModPlug_Settings
-{
- int mFlags; /* One or more of the MODPLUG_ENABLE_* flags above, bitwise-OR'ed */
-
- /* Note that ModPlug always decodes sound at 44100kHz, 32 bit, stereo and then
- * down-mixes to the settings you choose. */
- int mChannels; /* Number of channels - 1 for mono or 2 for stereo */
- int mBits; /* Bits per sample - 8, 16, or 32 */
- int mFrequency; /* Sampling rate - 11025, 22050, or 44100 */
- int mResamplingMode; /* One of MODPLUG_RESAMPLE_*, above */
-
- int mReverbDepth; /* Reverb level 0(quiet)-100(loud) */
- int mReverbDelay; /* Reverb delay in ms, usually 40-200ms */
- int mBassAmount; /* XBass level 0(quiet)-100(loud) */
- int mBassRange; /* XBass cutoff in Hz 10-100 */
- int mSurroundDepth; /* Surround level 0(quiet)-100(heavy) */
- int mSurroundDelay; /* Surround delay in ms, usually 5-40ms */
- int mLoopCount; /* Number of times to loop. Zero prevents looping.
- -1 loops forever. */
-} ModPlug_Settings;
+ enum _ModPlug_ResamplingMode
+ {
+ MODPLUG_RESAMPLE_NEAREST = 0, /* No interpolation (very fast, extremely bad sound quality) */
+ MODPLUG_RESAMPLE_LINEAR = 1, /* Linear interpolation (fast, good quality) */
+ MODPLUG_RESAMPLE_SPLINE = 2, /* Cubic spline interpolation (high quality) */
+ MODPLUG_RESAMPLE_FIR = 3 /* 8-tap fir filter (extremely high quality) */
+ };
+
+ typedef struct _ModPlug_Settings
+ {
+ int mFlags; /* One or more of the MODPLUG_ENABLE_* flags above, bitwise-OR'ed */
+
+ /* Note that ModPlug always decodes sound at 44100kHz, 32 bit, stereo and then
+ * down-mixes to the settings you choose. */
+ int mChannels; /* Number of channels - 1 for mono or 2 for stereo */
+ int mBits; /* Bits per sample - 8, 16, or 32 */
+ int mFrequency; /* Sampling rate - 11025, 22050, or 44100 */
+ int mResamplingMode; /* One of MODPLUG_RESAMPLE_*, above */
+
+ int mReverbDepth; /* Reverb level 0(quiet)-100(loud) */
+ int mReverbDelay; /* Reverb delay in ms, usually 40-200ms */
+ int mBassAmount; /* XBass level 0(quiet)-100(loud) */
+ int mBassRange; /* XBass cutoff in Hz 10-100 */
+ int mSurroundDepth; /* Surround level 0(quiet)-100(heavy) */
+ int mSurroundDelay; /* Surround delay in ms, usually 5-40ms */
+ int mLoopCount; /* Number of times to loop. Zero prevents looping.
+ -1 loops forever. */
+ } ModPlug_Settings;
/* Get and set the mod decoder settings. All options, except for channels, bits-per-sample,
* sampling rate, and loop count, will take effect immediately. Those options which don't
* take effect immediately will take effect the next time you load a mod. */
-void ModPlug_GetSettings(ModPlug_Settings* settings);
-void ModPlug_SetSettings(const ModPlug_Settings* settings);
+ void ModPlug_GetSettings (ModPlug_Settings * settings);
+ void ModPlug_SetSettings (const ModPlug_Settings * settings);
#ifdef __cplusplus
-} /* extern "C" */
+} /* extern "C" */
#endif
#endif
diff --git a/gst/modplug/libmodplug/sndfile.h b/gst/modplug/libmodplug/sndfile.h
index 0fe6f459d..ebfd4afd2 100644
--- a/gst/modplug/libmodplug/sndfile.h
+++ b/gst/modplug/libmodplug/sndfile.h
@@ -9,7 +9,7 @@
#define __SNDFILE_H
#ifndef LPCBYTE
-typedef const BYTE * LPCBYTE;
+typedef const BYTE *LPCBYTE;
#endif
#define MOD_AMIGAC2 0x1AB
@@ -60,7 +60,7 @@ typedef const BYTE * LPCBYTE;
#define MOD_TYPE_AMF0 0x200000
#define MOD_TYPE_PSM 0x400000
#define MOD_TYPE_J2B 0x800000
-#define MOD_TYPE_UMX 0x80000000 /* Fake type */
+#define MOD_TYPE_UMX 0x80000000 /* Fake type */
#define MAX_MODTYPE 23
@@ -202,9 +202,9 @@ typedef const BYTE * LPCBYTE;
#define RS_STIPCM16U (RS_PCM16U|0x40|RSF_STEREO) /* stereo 16-bit unsigned */
#define RS_STIPCM16M (RS_PCM16M|0x40|RSF_STEREO) /* stereo 16-bit signed big endian */
/* 24-bit signed */
-#define RS_PCM24S (RS_PCM16S|0x80) /* mono 24-bit signed */
+#define RS_PCM24S (RS_PCM16S|0x80) /* mono 24-bit signed */
#define RS_STIPCM24S (RS_PCM16S|0x80|RSF_STEREO) /* stereo 24-bit signed */
-#define RS_PCM32S (RS_PCM16S|0xC0) /* mono 24-bit signed */
+#define RS_PCM32S (RS_PCM16S|0xC0) /* mono 24-bit signed */
#define RS_STIPCM32S (RS_PCM16S|0xC0|RSF_STEREO) /* stereo 24-bit signed */
/* NNA types */
@@ -269,176 +269,178 @@ typedef const BYTE * LPCBYTE;
/* Reverb Types (GM2 Presets) */
-enum {
- REVERBTYPE_SMALLROOM,
- REVERBTYPE_MEDIUMROOM,
- REVERBTYPE_LARGEROOM,
- REVERBTYPE_SMALLHALL,
- REVERBTYPE_MEDIUMHALL,
- REVERBTYPE_LARGEHALL,
- NUM_REVERBTYPES
+enum
+{
+ REVERBTYPE_SMALLROOM,
+ REVERBTYPE_MEDIUMROOM,
+ REVERBTYPE_LARGEROOM,
+ REVERBTYPE_SMALLHALL,
+ REVERBTYPE_MEDIUMHALL,
+ REVERBTYPE_LARGEHALL,
+ NUM_REVERBTYPES
};
-enum {
- SRCMODE_NEAREST,
- SRCMODE_LINEAR,
- SRCMODE_SPLINE,
- SRCMODE_POLYPHASE,
- NUM_SRC_MODES
+enum
+{
+ SRCMODE_NEAREST,
+ SRCMODE_LINEAR,
+ SRCMODE_SPLINE,
+ SRCMODE_POLYPHASE,
+ NUM_SRC_MODES
};
/* Sample Struct */
typedef struct _MODINSTRUMENT
{
- UINT nLength,nLoopStart,nLoopEnd;
- UINT nSustainStart, nSustainEnd;
- signed char *pSample;
- UINT nC4Speed;
- WORD nPan;
- WORD nVolume;
- WORD nGlobalVol;
- WORD uFlags;
- signed char RelativeTone;
- signed char nFineTune;
- BYTE nVibType;
- BYTE nVibSweep;
- BYTE nVibDepth;
- BYTE nVibRate;
- CHAR name[22];
+ UINT nLength, nLoopStart, nLoopEnd;
+ UINT nSustainStart, nSustainEnd;
+ signed char *pSample;
+ UINT nC4Speed;
+ WORD nPan;
+ WORD nVolume;
+ WORD nGlobalVol;
+ WORD uFlags;
+ signed char RelativeTone;
+ signed char nFineTune;
+ BYTE nVibType;
+ BYTE nVibSweep;
+ BYTE nVibDepth;
+ BYTE nVibRate;
+ CHAR name[22];
} MODINSTRUMENT;
/* Instrument Struct */
typedef struct _INSTRUMENTHEADER
{
- UINT nFadeOut;
- DWORD dwFlags;
- WORD nGlobalVol;
- WORD nPan;
- WORD VolPoints[MAX_ENVPOINTS];
- WORD PanPoints[MAX_ENVPOINTS];
- WORD PitchPoints[MAX_ENVPOINTS];
- BYTE VolEnv[MAX_ENVPOINTS];
- BYTE PanEnv[MAX_ENVPOINTS];
- BYTE PitchEnv[MAX_ENVPOINTS];
- BYTE Keyboard[128];
- BYTE NoteMap[128];
-
- BYTE nVolEnv;
- BYTE nPanEnv;
- BYTE nPitchEnv;
- BYTE nVolLoopStart;
- BYTE nVolLoopEnd;
- BYTE nVolSustainBegin;
- BYTE nVolSustainEnd;
- BYTE nPanLoopStart;
- BYTE nPanLoopEnd;
- BYTE nPanSustainBegin;
- BYTE nPanSustainEnd;
- BYTE nPitchLoopStart;
- BYTE nPitchLoopEnd;
- BYTE nPitchSustainBegin;
- BYTE nPitchSustainEnd;
- BYTE nNNA;
- BYTE nDCT;
- BYTE nDNA;
- BYTE nPanSwing;
- BYTE nVolSwing;
- BYTE nIFC;
- BYTE nIFR;
- WORD wMidiBank;
- BYTE nMidiProgram;
- BYTE nMidiChannel;
- BYTE nMidiDrumKey;
- signed char nPPS;
- unsigned char nPPC;
- CHAR name[32];
- CHAR filename[12];
+ UINT nFadeOut;
+ DWORD dwFlags;
+ WORD nGlobalVol;
+ WORD nPan;
+ WORD VolPoints[MAX_ENVPOINTS];
+ WORD PanPoints[MAX_ENVPOINTS];
+ WORD PitchPoints[MAX_ENVPOINTS];
+ BYTE VolEnv[MAX_ENVPOINTS];
+ BYTE PanEnv[MAX_ENVPOINTS];
+ BYTE PitchEnv[MAX_ENVPOINTS];
+ BYTE Keyboard[128];
+ BYTE NoteMap[128];
+
+ BYTE nVolEnv;
+ BYTE nPanEnv;
+ BYTE nPitchEnv;
+ BYTE nVolLoopStart;
+ BYTE nVolLoopEnd;
+ BYTE nVolSustainBegin;
+ BYTE nVolSustainEnd;
+ BYTE nPanLoopStart;
+ BYTE nPanLoopEnd;
+ BYTE nPanSustainBegin;
+ BYTE nPanSustainEnd;
+ BYTE nPitchLoopStart;
+ BYTE nPitchLoopEnd;
+ BYTE nPitchSustainBegin;
+ BYTE nPitchSustainEnd;
+ BYTE nNNA;
+ BYTE nDCT;
+ BYTE nDNA;
+ BYTE nPanSwing;
+ BYTE nVolSwing;
+ BYTE nIFC;
+ BYTE nIFR;
+ WORD wMidiBank;
+ BYTE nMidiProgram;
+ BYTE nMidiChannel;
+ BYTE nMidiDrumKey;
+ signed char nPPS;
+ unsigned char nPPC;
+ CHAR name[32];
+ CHAR filename[12];
} INSTRUMENTHEADER;
/* Channel Struct */
typedef struct _MODCHANNEL
{
- /* First 32-bytes: Most used mixing information: don't change it */
- signed char * pCurrentSample;
- DWORD nPos;
- DWORD nPosLo; /* actually 16-bit */
- LONG nInc; /* 16.16 */
- LONG nRightVol;
- LONG nLeftVol;
- LONG nRightRamp;
- LONG nLeftRamp;
- /* 2nd cache line */
- DWORD nLength;
- DWORD dwFlags;
- DWORD nLoopStart;
- DWORD nLoopEnd;
- LONG nRampRightVol;
- LONG nRampLeftVol;
- LONG nFilter_Y1, nFilter_Y2, nFilter_Y3, nFilter_Y4;
- LONG nFilter_A0, nFilter_B0, nFilter_B1;
- LONG nROfs, nLOfs;
- LONG nRampLength;
- /* Information not used in the mixer */
- signed char * pSample;
- LONG nNewRightVol, nNewLeftVol;
- LONG nRealVolume, nRealPan;
- LONG nVolume, nPan, nFadeOutVol;
- LONG nPeriod, nC4Speed, nPortamentoDest;
- INSTRUMENTHEADER *pHeader;
- MODINSTRUMENT *pInstrument;
- DWORD nVolEnvPosition, nPanEnvPosition, nPitchEnvPosition;
- DWORD nMasterChn, nVUMeter;
- LONG nGlobalVol, nInsVol;
- LONG nFineTune, nTranspose;
- LONG nPortamentoSlide, nAutoVibDepth;
- UINT nAutoVibPos, nVibratoPos, nTremoloPos, nPanbrelloPos;
- /* 16-bit members */
- signed short nVolSwing, nPanSwing;
- /* 8-bit members */
- BYTE nNote, nNNA;
- BYTE nNewNote, nNewIns, nCommand, nArpeggio;
- BYTE nOldVolumeSlide, nOldFineVolUpDown;
- BYTE nOldPortaUpDown, nOldFinePortaUpDown;
- BYTE nOldPanSlide, nOldChnVolSlide;
- BYTE nVibratoType, nVibratoSpeed, nVibratoDepth;
- BYTE nTremoloType, nTremoloSpeed, nTremoloDepth;
- BYTE nPanbrelloType, nPanbrelloSpeed, nPanbrelloDepth;
- BYTE nOldCmdEx, nOldVolParam, nOldTempo;
- BYTE nOldOffset, nOldHiOffset;
- BYTE nCutOff, nResonance;
- BYTE nRetrigCount, nRetrigParam;
- BYTE nTremorCount, nTremorParam;
- BYTE nPatternLoop, nPatternLoopCount;
- BYTE nRowNote, nRowInstr;
- BYTE nRowVolCmd, nRowVolume;
- BYTE nRowCommand, nRowParam;
- BYTE nLeftVU, nRightVU;
- BYTE nActiveMacro, nPadding;
+ /* First 32-bytes: Most used mixing information: don't change it */
+ signed char *pCurrentSample;
+ DWORD nPos;
+ DWORD nPosLo; /* actually 16-bit */
+ LONG nInc; /* 16.16 */
+ LONG nRightVol;
+ LONG nLeftVol;
+ LONG nRightRamp;
+ LONG nLeftRamp;
+ /* 2nd cache line */
+ DWORD nLength;
+ DWORD dwFlags;
+ DWORD nLoopStart;
+ DWORD nLoopEnd;
+ LONG nRampRightVol;
+ LONG nRampLeftVol;
+ LONG nFilter_Y1, nFilter_Y2, nFilter_Y3, nFilter_Y4;
+ LONG nFilter_A0, nFilter_B0, nFilter_B1;
+ LONG nROfs, nLOfs;
+ LONG nRampLength;
+ /* Information not used in the mixer */
+ signed char *pSample;
+ LONG nNewRightVol, nNewLeftVol;
+ LONG nRealVolume, nRealPan;
+ LONG nVolume, nPan, nFadeOutVol;
+ LONG nPeriod, nC4Speed, nPortamentoDest;
+ INSTRUMENTHEADER *pHeader;
+ MODINSTRUMENT *pInstrument;
+ DWORD nVolEnvPosition, nPanEnvPosition, nPitchEnvPosition;
+ DWORD nMasterChn, nVUMeter;
+ LONG nGlobalVol, nInsVol;
+ LONG nFineTune, nTranspose;
+ LONG nPortamentoSlide, nAutoVibDepth;
+ UINT nAutoVibPos, nVibratoPos, nTremoloPos, nPanbrelloPos;
+ /* 16-bit members */
+ signed short nVolSwing, nPanSwing;
+ /* 8-bit members */
+ BYTE nNote, nNNA;
+ BYTE nNewNote, nNewIns, nCommand, nArpeggio;
+ BYTE nOldVolumeSlide, nOldFineVolUpDown;
+ BYTE nOldPortaUpDown, nOldFinePortaUpDown;
+ BYTE nOldPanSlide, nOldChnVolSlide;
+ BYTE nVibratoType, nVibratoSpeed, nVibratoDepth;
+ BYTE nTremoloType, nTremoloSpeed, nTremoloDepth;
+ BYTE nPanbrelloType, nPanbrelloSpeed, nPanbrelloDepth;
+ BYTE nOldCmdEx, nOldVolParam, nOldTempo;
+ BYTE nOldOffset, nOldHiOffset;
+ BYTE nCutOff, nResonance;
+ BYTE nRetrigCount, nRetrigParam;
+ BYTE nTremorCount, nTremorParam;
+ BYTE nPatternLoop, nPatternLoopCount;
+ BYTE nRowNote, nRowInstr;
+ BYTE nRowVolCmd, nRowVolume;
+ BYTE nRowCommand, nRowParam;
+ BYTE nLeftVU, nRightVU;
+ BYTE nActiveMacro, nPadding;
} MODCHANNEL;
typedef struct _MODCHANNELSETTINGS
{
- UINT nPan;
- UINT nVolume;
- DWORD dwFlags;
- UINT nMixPlugin;
- char szName[MAX_CHANNELNAME]; /* changed from CHAR */
+ UINT nPan;
+ UINT nVolume;
+ DWORD dwFlags;
+ UINT nMixPlugin;
+ char szName[MAX_CHANNELNAME]; /* changed from CHAR */
} MODCHANNELSETTINGS;
typedef struct _MODCOMMAND
{
- BYTE note;
- BYTE instr;
- BYTE volcmd;
- BYTE command;
- BYTE vol;
- BYTE param;
+ BYTE note;
+ BYTE instr;
+ BYTE volcmd;
+ BYTE command;
+ BYTE vol;
+ BYTE param;
} MODCOMMAND, *LPMODCOMMAND;
/*////////////////////////////////////////////////////////////////// */
@@ -448,14 +450,15 @@ typedef struct _MODCOMMAND
class IMixPlugin
{
public:
- virtual int AddRef() = 0;
- virtual int Release() = 0;
- virtual void SaveAllParameters() = 0;
- virtual void RestoreAllParameters() = 0;
- virtual void Process(float *pOutL, float *pOutR, unsigned long nSamples) = 0;
- virtual void Init(unsigned long nFreq, int bReset) = 0;
- virtual void MidiSend(DWORD dwMidiCode) = 0;
- virtual void MidiCommand(UINT nMidiCh, UINT nMidiProg, UINT note, UINT vol) = 0;
+ virtual int AddRef () = 0;
+ virtual int Release () = 0;
+ virtual void SaveAllParameters () = 0;
+ virtual void RestoreAllParameters () = 0;
+ virtual void Process (float *pOutL, float *pOutR, unsigned long nSamples) = 0;
+ virtual void Init (unsigned long nFreq, int bReset) = 0;
+ virtual void MidiSend (DWORD dwMidiCode) = 0;
+ virtual void MidiCommand (UINT nMidiCh, UINT nMidiProg, UINT note, UINT vol) =
+ 0;
};
@@ -465,59 +468,60 @@ public:
typedef struct _SNDMIXPLUGINSTATE
{
- DWORD dwFlags; /* MIXPLUG_XXXX */
- LONG nVolDecayL, nVolDecayR; /* Buffer click removal */
- int *pMixBuffer; /* Stereo effect send buffer */
- float *pOutBufferL; /* Temp storage for int -> float conversion */
- float *pOutBufferR;
+ DWORD dwFlags; /* MIXPLUG_XXXX */
+ LONG nVolDecayL, nVolDecayR; /* Buffer click removal */
+ int *pMixBuffer; /* Stereo effect send buffer */
+ float *pOutBufferL; /* Temp storage for int -> float conversion */
+ float *pOutBufferR;
} SNDMIXPLUGINSTATE, *PSNDMIXPLUGINSTATE;
typedef struct _SNDMIXPLUGININFO
{
- DWORD dwPluginId1;
- DWORD dwPluginId2;
- DWORD dwInputRouting; /* MIXPLUG_INPUTF_XXXX */
- DWORD dwOutputRouting; /* 0=mix 0x80+=fx */
- DWORD dwReserved[4]; /* Reserved for routing info */
- CHAR szName[32];
- CHAR szLibraryName[64]; /* original DLL name */
-} SNDMIXPLUGININFO, *PSNDMIXPLUGININFO; /* Size should be 128 */
+ DWORD dwPluginId1;
+ DWORD dwPluginId2;
+ DWORD dwInputRouting; /* MIXPLUG_INPUTF_XXXX */
+ DWORD dwOutputRouting; /* 0=mix 0x80+=fx */
+ DWORD dwReserved[4]; /* Reserved for routing info */
+ CHAR szName[32];
+ CHAR szLibraryName[64]; /* original DLL name */
+} SNDMIXPLUGININFO, *PSNDMIXPLUGININFO; /* Size should be 128 */
typedef struct _SNDMIXPLUGIN
{
- IMixPlugin *pMixPlugin;
- PSNDMIXPLUGINSTATE pMixState;
- ULONG nPluginDataSize;
- PVOID pPluginData;
- SNDMIXPLUGININFO Info;
+ IMixPlugin *pMixPlugin;
+ PSNDMIXPLUGINSTATE pMixState;
+ ULONG nPluginDataSize;
+ PVOID pPluginData;
+ SNDMIXPLUGININFO Info;
} SNDMIXPLUGIN, *PSNDMIXPLUGIN;
-typedef BOOL (*PMIXPLUGINCREATEPROC)(PSNDMIXPLUGIN);
+typedef BOOL (*PMIXPLUGINCREATEPROC) (PSNDMIXPLUGIN);
/*////////////////////////////////////////////////////////////////// */
-enum {
- MIDIOUT_START=0,
- MIDIOUT_STOP,
- MIDIOUT_TICK,
- MIDIOUT_NOTEON,
- MIDIOUT_NOTEOFF,
- MIDIOUT_VOLUME,
- MIDIOUT_PAN,
- MIDIOUT_BANKSEL,
- MIDIOUT_PROGRAM
+enum
+{
+ MIDIOUT_START = 0,
+ MIDIOUT_STOP,
+ MIDIOUT_TICK,
+ MIDIOUT_NOTEON,
+ MIDIOUT_NOTEOFF,
+ MIDIOUT_VOLUME,
+ MIDIOUT_PAN,
+ MIDIOUT_BANKSEL,
+ MIDIOUT_PROGRAM
};
typedef struct MODMIDICFG
{
- char szMidiGlb[9*32]; /* changed from CHAR */
- char szMidiSFXExt[16*32]; /* changed from CHAR */
- char szMidiZXXExt[128*32]; /* changed from CHAR */
+ char szMidiGlb[9 * 32]; /* changed from CHAR */
+ char szMidiSFXExt[16 * 32]; /* changed from CHAR */
+ char szMidiZXXExt[128 * 32]; /* changed from CHAR */
} MODMIDICFG, *LPMODMIDICFG;
-typedef VOID (* LPSNDMIXHOOKPROC)(int *, unsigned long, unsigned long); /* buffer, samples, channels */
+typedef VOID (*LPSNDMIXHOOKPROC) (int *, unsigned long, unsigned long); /* buffer, samples, channels */
@@ -525,251 +529,343 @@ typedef VOID (* LPSNDMIXHOOKPROC)(int *, unsigned long, unsigned long); /* buffe
class CSoundFile
/*============== */
{
-public: /* Static Members */
- static UINT m_nXBassDepth, m_nXBassRange;
- static UINT m_nReverbDepth, m_nReverbDelay, gnReverbType;
- static UINT m_nProLogicDepth, m_nProLogicDelay;
- static UINT m_nStereoSeparation;
- static UINT m_nMaxMixChannels;
- static LONG m_nStreamVolume;
- static DWORD gdwSysInfo, gdwSoundSetup, gdwMixingFreq, gnBitsPerSample, gnChannels;
- static UINT gnAGC, gnVolumeRampSamples, gnVUMeter, gnCPUUsage;
- static LPSNDMIXHOOKPROC gpSndMixHook;
- static PMIXPLUGINCREATEPROC gpMixPluginCreateProc;
-
-public: /* for Editing */
- MODCHANNEL Chn[MAX_CHANNELS]; /* Channels */
- UINT ChnMix[MAX_CHANNELS]; /* Channels to be mixed */
- MODINSTRUMENT Ins[MAX_SAMPLES]; /* Instruments */
- INSTRUMENTHEADER *Headers[MAX_INSTRUMENTS]; /* Instrument Headers */
- MODCHANNELSETTINGS ChnSettings[MAX_BASECHANNELS]; /* Channels settings */
- MODCOMMAND *Patterns[MAX_PATTERNS]; /* Patterns */
- WORD PatternSize[MAX_PATTERNS]; /* Patterns Lengths */
- BYTE Order[MAX_ORDERS]; /* Pattern Orders */
- MODMIDICFG m_MidiCfg; /* Midi macro config table */
- SNDMIXPLUGIN m_MixPlugins[MAX_MIXPLUGINS]; /* Mix plugins */
- UINT m_nDefaultSpeed, m_nDefaultTempo, m_nDefaultGlobalVolume;
- DWORD m_dwSongFlags; /* Song flags SONG_XXXX */
- UINT m_nChannels, m_nMixChannels, m_nMixStat, m_nBufferCount;
- UINT m_nType, m_nSamples, m_nInstruments;
- UINT m_nTickCount, m_nTotalCount, m_nPatternDelay, m_nFrameDelay;
- UINT m_nMusicSpeed, m_nMusicTempo;
- UINT m_nNextRow, m_nRow;
- UINT m_nPattern,m_nCurrentPattern,m_nNextPattern,m_nRestartPos;
- UINT m_nMasterVolume, m_nGlobalVolume, m_nSongPreAmp;
- UINT m_nFreqFactor, m_nTempoFactor, m_nOldGlbVolSlide;
- LONG m_nMinPeriod, m_nMaxPeriod, m_nRepeatCount, m_nInitialRepeatCount;
- DWORD m_nGlobalFadeSamples, m_nGlobalFadeMaxSamples;
- UINT m_nMaxOrderPosition;
- UINT m_nPatternNames;
- LPSTR m_lpszSongComments, m_lpszPatternNames;
- char m_szNames[MAX_INSTRUMENTS][32]; /* changed from CHAR */
- CHAR CompressionTable[16];
+public: /* Static Members */
+ static UINT m_nXBassDepth, m_nXBassRange;
+ static UINT m_nReverbDepth, m_nReverbDelay, gnReverbType;
+ static UINT m_nProLogicDepth, m_nProLogicDelay;
+ static UINT m_nStereoSeparation;
+ static UINT m_nMaxMixChannels;
+ static LONG m_nStreamVolume;
+ static DWORD gdwSysInfo, gdwSoundSetup, gdwMixingFreq, gnBitsPerSample,
+ gnChannels;
+ static UINT gnAGC, gnVolumeRampSamples, gnVUMeter, gnCPUUsage;
+ static LPSNDMIXHOOKPROC gpSndMixHook;
+ static PMIXPLUGINCREATEPROC gpMixPluginCreateProc;
+
+public: /* for Editing */
+ MODCHANNEL Chn[MAX_CHANNELS]; /* Channels */
+ UINT ChnMix[MAX_CHANNELS]; /* Channels to be mixed */
+ MODINSTRUMENT Ins[MAX_SAMPLES]; /* Instruments */
+ INSTRUMENTHEADER *Headers[MAX_INSTRUMENTS]; /* Instrument Headers */
+ MODCHANNELSETTINGS ChnSettings[MAX_BASECHANNELS]; /* Channels settings */
+ MODCOMMAND *Patterns[MAX_PATTERNS]; /* Patterns */
+ WORD PatternSize[MAX_PATTERNS]; /* Patterns Lengths */
+ BYTE Order[MAX_ORDERS]; /* Pattern Orders */
+ MODMIDICFG m_MidiCfg; /* Midi macro config table */
+ SNDMIXPLUGIN m_MixPlugins[MAX_MIXPLUGINS]; /* Mix plugins */
+ UINT m_nDefaultSpeed, m_nDefaultTempo, m_nDefaultGlobalVolume;
+ DWORD m_dwSongFlags; /* Song flags SONG_XXXX */
+ UINT m_nChannels, m_nMixChannels, m_nMixStat, m_nBufferCount;
+ UINT m_nType, m_nSamples, m_nInstruments;
+ UINT m_nTickCount, m_nTotalCount, m_nPatternDelay, m_nFrameDelay;
+ UINT m_nMusicSpeed, m_nMusicTempo;
+ UINT m_nNextRow, m_nRow;
+ UINT m_nPattern, m_nCurrentPattern, m_nNextPattern, m_nRestartPos;
+ UINT m_nMasterVolume, m_nGlobalVolume, m_nSongPreAmp;
+ UINT m_nFreqFactor, m_nTempoFactor, m_nOldGlbVolSlide;
+ LONG m_nMinPeriod, m_nMaxPeriod, m_nRepeatCount, m_nInitialRepeatCount;
+ DWORD m_nGlobalFadeSamples, m_nGlobalFadeMaxSamples;
+ UINT m_nMaxOrderPosition;
+ UINT m_nPatternNames;
+ LPSTR m_lpszSongComments, m_lpszPatternNames;
+ char m_szNames[MAX_INSTRUMENTS][32]; /* changed from CHAR */
+ CHAR CompressionTable[16];
public:
- CSoundFile();
- ~CSoundFile();
+ CSoundFile ();
+ ~CSoundFile ();
public:
- BOOL Create(LPCBYTE lpStream, DWORD dwMemLength=0);
- BOOL Destroy();
- UINT GetType() const { return m_nType; }
- UINT GetNumChannels() const;
- UINT GetLogicalChannels() const { return m_nChannels; }
- BOOL SetMasterVolume(UINT vol, BOOL bAdjustAGC=FALSE);
- UINT GetMasterVolume() const { return m_nMasterVolume; }
- UINT GetNumPatterns() const;
- UINT GetNumInstruments() const;
- UINT GetNumSamples() const { return m_nSamples; }
- UINT GetCurrentPos() const;
- UINT GetCurrentPattern() const { return m_nPattern; }
- UINT GetCurrentOrder() const { return m_nCurrentPattern; }
- UINT GetSongComments(LPSTR s, UINT cbsize, UINT linesize=32);
- UINT GetRawSongComments(LPSTR s, UINT cbsize, UINT linesize=32);
- UINT GetMaxPosition() const;
- void SetCurrentPos(UINT nPos);
- void SetCurrentOrder(UINT nOrder);
- void GetTitle(LPSTR s) const { lstrcpyn(s,m_szNames[0],32); }
- LPCSTR GetTitle() const { return m_szNames[0]; }
- UINT GetSampleName(UINT nSample,LPSTR s=NULL) const;
- UINT GetInstrumentName(UINT nInstr,LPSTR s=NULL) const;
- UINT GetMusicSpeed() const { return m_nMusicSpeed; }
- UINT GetMusicTempo() const { return m_nMusicTempo; }
- DWORD GetLength(BOOL bAdjust, BOOL bTotal=FALSE);
- DWORD GetSongTime() { return GetLength(FALSE, TRUE); }
- void SetRepeatCount(int n) { m_nRepeatCount = n; m_nInitialRepeatCount = n; }
- int GetRepeatCount() const { return m_nRepeatCount; }
- BOOL IsPaused() const { return (m_dwSongFlags & SONG_PAUSED) ? TRUE : FALSE; }
- void LoopPattern(int nPat, int nRow=0);
- void CheckCPUUsage(UINT nCPU);
- BOOL SetPatternName(UINT nPat, LPCSTR lpszName);
- BOOL GetPatternName(UINT nPat, LPSTR lpszName, UINT cbSize=MAX_PATTERNNAME) const;
- /* Module Loaders */
- BOOL ReadXM(LPCBYTE lpStream, DWORD dwMemLength);
- BOOL ReadS3M(LPCBYTE lpStream, DWORD dwMemLength);
- BOOL ReadMod(LPCBYTE lpStream, DWORD dwMemLength);
- BOOL ReadMed(LPCBYTE lpStream, DWORD dwMemLength);
- BOOL ReadMTM(LPCBYTE lpStream, DWORD dwMemLength);
- BOOL ReadSTM(LPCBYTE lpStream, DWORD dwMemLength);
- BOOL ReadIT(LPCBYTE lpStream, DWORD dwMemLength);
- BOOL Read669(LPCBYTE lpStream, DWORD dwMemLength);
- BOOL ReadUlt(LPCBYTE lpStream, DWORD dwMemLength);
- BOOL ReadWav(LPCBYTE lpStream, DWORD dwMemLength);
- BOOL ReadDSM(LPCBYTE lpStream, DWORD dwMemLength);
- BOOL ReadFAR(LPCBYTE lpStream, DWORD dwMemLength);
- BOOL ReadAMS(LPCBYTE lpStream, DWORD dwMemLength);
- BOOL ReadAMS2(LPCBYTE lpStream, DWORD dwMemLength);
- BOOL ReadMDL(LPCBYTE lpStream, DWORD dwMemLength);
- BOOL ReadOKT(LPCBYTE lpStream, DWORD dwMemLength);
- BOOL ReadDMF(LPCBYTE lpStream, DWORD dwMemLength);
- BOOL ReadPTM(LPCBYTE lpStream, DWORD dwMemLength);
- BOOL ReadDBM(LPCBYTE lpStream, DWORD dwMemLength);
- BOOL ReadAMF(LPCBYTE lpStream, DWORD dwMemLength);
- BOOL ReadMT2(LPCBYTE lpStream, DWORD dwMemLength);
- BOOL ReadPSM(LPCBYTE lpStream, DWORD dwMemLength);
- BOOL ReadJ2B(LPCBYTE lpStream, DWORD dwMemLength);
- BOOL ReadUMX(LPCBYTE lpStream, DWORD dwMemLength);
- /* Save Functions */
+ BOOL Create (LPCBYTE lpStream, DWORD dwMemLength = 0);
+ BOOL Destroy ();
+ UINT GetType () const
+ {
+ return m_nType;
+ }
+ UINT GetNumChannels () const;
+ UINT GetLogicalChannels () const
+ {
+ return m_nChannels;
+ }
+ BOOL SetMasterVolume (UINT vol, BOOL bAdjustAGC = FALSE);
+ UINT GetMasterVolume () const
+ {
+ return m_nMasterVolume;
+ }
+ UINT GetNumPatterns () const;
+ UINT GetNumInstruments () const;
+ UINT GetNumSamples () const
+ {
+ return m_nSamples;
+ }
+ UINT GetCurrentPos () const;
+ UINT GetCurrentPattern () const
+ {
+ return m_nPattern;
+ }
+ UINT GetCurrentOrder () const
+ {
+ return m_nCurrentPattern;
+ }
+ UINT GetSongComments (LPSTR s, UINT cbsize, UINT linesize = 32);
+ UINT GetRawSongComments (LPSTR s, UINT cbsize, UINT linesize = 32);
+ UINT GetMaxPosition () const;
+ void SetCurrentPos (UINT nPos);
+ void SetCurrentOrder (UINT nOrder);
+ void GetTitle (LPSTR s) const
+ {
+ lstrcpyn (s, m_szNames[0], 32);
+ }
+ LPCSTR GetTitle () const
+ {
+ return m_szNames[0];
+ }
+ UINT GetSampleName (UINT nSample, LPSTR s = NULL) const;
+ UINT GetInstrumentName (UINT nInstr, LPSTR s = NULL) const;
+ UINT GetMusicSpeed () const
+ {
+ return m_nMusicSpeed;
+ }
+ UINT GetMusicTempo () const
+ {
+ return m_nMusicTempo;
+ }
+ DWORD GetLength (BOOL bAdjust, BOOL bTotal = FALSE);
+ DWORD GetSongTime ()
+ {
+ return GetLength (FALSE, TRUE);
+ }
+ void SetRepeatCount (int n)
+ {
+ m_nRepeatCount = n;
+ m_nInitialRepeatCount = n;
+ }
+ int GetRepeatCount () const
+ {
+ return m_nRepeatCount;
+ }
+ BOOL IsPaused () const
+ {
+ return (m_dwSongFlags & SONG_PAUSED) ? TRUE : FALSE;
+ }
+ void LoopPattern (int nPat, int nRow = 0);
+ void CheckCPUUsage (UINT nCPU);
+ BOOL SetPatternName (UINT nPat, LPCSTR lpszName);
+ BOOL GetPatternName (UINT nPat, LPSTR lpszName, UINT cbSize =
+ MAX_PATTERNNAME) const;
+ /* Module Loaders */
+ BOOL ReadXM (LPCBYTE lpStream, DWORD dwMemLength);
+ BOOL ReadS3M (LPCBYTE lpStream, DWORD dwMemLength);
+ BOOL ReadMod (LPCBYTE lpStream, DWORD dwMemLength);
+ BOOL ReadMed (LPCBYTE lpStream, DWORD dwMemLength);
+ BOOL ReadMTM (LPCBYTE lpStream, DWORD dwMemLength);
+ BOOL ReadSTM (LPCBYTE lpStream, DWORD dwMemLength);
+ BOOL ReadIT (LPCBYTE lpStream, DWORD dwMemLength);
+ BOOL Read669 (LPCBYTE lpStream, DWORD dwMemLength);
+ BOOL ReadUlt (LPCBYTE lpStream, DWORD dwMemLength);
+ BOOL ReadWav (LPCBYTE lpStream, DWORD dwMemLength);
+ BOOL ReadDSM (LPCBYTE lpStream, DWORD dwMemLength);
+ BOOL ReadFAR (LPCBYTE lpStream, DWORD dwMemLength);
+ BOOL ReadAMS (LPCBYTE lpStream, DWORD dwMemLength);
+ BOOL ReadAMS2 (LPCBYTE lpStream, DWORD dwMemLength);
+ BOOL ReadMDL (LPCBYTE lpStream, DWORD dwMemLength);
+ BOOL ReadOKT (LPCBYTE lpStream, DWORD dwMemLength);
+ BOOL ReadDMF (LPCBYTE lpStream, DWORD dwMemLength);
+ BOOL ReadPTM (LPCBYTE lpStream, DWORD dwMemLength);
+ BOOL ReadDBM (LPCBYTE lpStream, DWORD dwMemLength);
+ BOOL ReadAMF (LPCBYTE lpStream, DWORD dwMemLength);
+ BOOL ReadMT2 (LPCBYTE lpStream, DWORD dwMemLength);
+ BOOL ReadPSM (LPCBYTE lpStream, DWORD dwMemLength);
+ BOOL ReadJ2B (LPCBYTE lpStream, DWORD dwMemLength);
+ BOOL ReadUMX (LPCBYTE lpStream, DWORD dwMemLength);
+
+ /* Save Functions */
#ifndef MODPLUG_NO_FILESAVE
- UINT WriteSample(FILE *f, MODINSTRUMENT *pins, UINT nFlags, UINT nMaxLen=0);
- BOOL SaveXM(LPCSTR lpszFileName, UINT nPacking=0);
- BOOL SaveS3M(LPCSTR lpszFileName, UINT nPacking=0);
- BOOL SaveMod(LPCSTR lpszFileName, UINT nPacking=0);
- BOOL SaveIT(LPCSTR lpszFileName, UINT nPacking=0);
+ UINT WriteSample (FILE * f, MODINSTRUMENT * pins, UINT nFlags, UINT nMaxLen =
+ 0);
+ BOOL SaveXM (LPCSTR lpszFileName, UINT nPacking = 0);
+ BOOL SaveS3M (LPCSTR lpszFileName, UINT nPacking = 0);
+ BOOL SaveMod (LPCSTR lpszFileName, UINT nPacking = 0);
+ BOOL SaveIT (LPCSTR lpszFileName, UINT nPacking = 0);
#endif /* MODPLUG_NO_FILESAVE */
- /* MOD Convert function */
- UINT GetBestSaveFormat() const;
- UINT GetSaveFormats() const;
- void ConvertModCommand(MODCOMMAND *) const;
- void S3MConvert(MODCOMMAND *m, BOOL bIT) const;
- void S3MSaveConvert(UINT *pcmd, UINT *pprm, BOOL bIT) const;
- WORD ModSaveCommand(const MODCOMMAND *m, BOOL bXM) const;
+ /* MOD Convert function */
+ UINT GetBestSaveFormat () const;
+ UINT GetSaveFormats () const;
+ void ConvertModCommand (MODCOMMAND *) const;
+ void S3MConvert (MODCOMMAND * m, BOOL bIT) const;
+ void S3MSaveConvert (UINT * pcmd, UINT * pprm, BOOL bIT) const;
+ WORD ModSaveCommand (const MODCOMMAND * m, BOOL bXM) const;
public:
- /* Real-time sound functions */
- VOID ResetChannels();
-
- UINT Read(LPVOID lpBuffer, UINT cbBuffer);
- UINT CreateStereoMix(int count);
- BOOL FadeSong(UINT msec);
- BOOL GlobalFadeSong(UINT msec);
- UINT GetTotalTickCount() const { return m_nTotalCount; }
- VOID ResetTotalTickCount() { m_nTotalCount = 0; }
+ /* Real-time sound functions */
+ VOID ResetChannels ();
+
+ UINT Read (LPVOID lpBuffer, UINT cbBuffer);
+ UINT CreateStereoMix (int count);
+ BOOL FadeSong (UINT msec);
+ BOOL GlobalFadeSong (UINT msec);
+ UINT GetTotalTickCount () const
+ {
+ return m_nTotalCount;
+ }
+ VOID ResetTotalTickCount ()
+ {
+ m_nTotalCount = 0;
+ }
public:
- /* Mixer Config */
- static BOOL InitPlayer(BOOL bReset=FALSE);
- static BOOL SetWaveConfig(UINT nRate,UINT nBits,UINT nChannels,BOOL bMMX=FALSE);
- static BOOL SetResamplingMode(UINT nMode); /* SRCMODE_XXXX */
- static BOOL IsStereo() { return (gnChannels > 1) ? TRUE : FALSE; }
- static DWORD GetSampleRate() { return gdwMixingFreq; }
- static DWORD GetBitsPerSample() { return gnBitsPerSample; }
- static DWORD InitSysInfo();
- static DWORD GetSysInfo() { return gdwSysInfo; }
- /* AGC */
- static BOOL GetAGC() { return (gdwSoundSetup & SNDMIX_AGC) ? TRUE : FALSE; }
- static void SetAGC(BOOL b);
- static void ResetAGC();
- static void ProcessAGC(int count);
-
- /*GCCFIX -- added these functions back in! */
- static BOOL SetWaveConfigEx(BOOL bSurround,BOOL bNoOverSampling,BOOL bReverb,BOOL hqido,BOOL bMegaBass,BOOL bNR,BOOL bEQ);
- /* DSP Effects */
- static void InitializeDSP(BOOL bReset);
- static void ProcessStereoDSP(int count);
- static void ProcessMonoDSP(int count);
- /* [Reverb level 0(quiet)-100(loud)], [delay in ms, usually 40-200ms] */
- static BOOL SetReverbParameters(UINT nDepth, UINT nDelay);
- /* [XBass level 0(quiet)-100(loud)], [cutoff in Hz 10-100] */
- static BOOL SetXBassParameters(UINT nDepth, UINT nRange);
- /* [Surround level 0(quiet)-100(heavy)] [delay in ms, usually 5-40ms] */
- static BOOL SetSurroundParameters(UINT nDepth, UINT nDelay);
+ /* Mixer Config */
+ static BOOL InitPlayer (BOOL bReset = FALSE);
+ static BOOL SetWaveConfig (UINT nRate, UINT nBits, UINT nChannels, BOOL bMMX =
+ FALSE);
+ static BOOL SetResamplingMode (UINT nMode); /* SRCMODE_XXXX */
+ static BOOL IsStereo ()
+ {
+ return (gnChannels > 1) ? TRUE : FALSE;
+ }
+ static DWORD GetSampleRate ()
+ {
+ return gdwMixingFreq;
+ }
+ static DWORD GetBitsPerSample ()
+ {
+ return gnBitsPerSample;
+ }
+ static DWORD InitSysInfo ();
+ static DWORD GetSysInfo ()
+ {
+ return gdwSysInfo;
+ }
+ /* AGC */
+ static BOOL GetAGC ()
+ {
+ return (gdwSoundSetup & SNDMIX_AGC) ? TRUE : FALSE;
+ }
+ static void SetAGC (BOOL b);
+ static void ResetAGC ();
+ static void ProcessAGC (int count);
+
+ /*GCCFIX -- added these functions back in! */
+ static BOOL SetWaveConfigEx (BOOL bSurround, BOOL bNoOverSampling,
+ BOOL bReverb, BOOL hqido, BOOL bMegaBass, BOOL bNR, BOOL bEQ);
+ /* DSP Effects */
+ static void InitializeDSP (BOOL bReset);
+ static void ProcessStereoDSP (int count);
+ static void ProcessMonoDSP (int count);
+
+ /* [Reverb level 0(quiet)-100(loud)], [delay in ms, usually 40-200ms] */
+ static BOOL SetReverbParameters (UINT nDepth, UINT nDelay);
+
+ /* [XBass level 0(quiet)-100(loud)], [cutoff in Hz 10-100] */
+ static BOOL SetXBassParameters (UINT nDepth, UINT nRange);
+
+ /* [Surround level 0(quiet)-100(heavy)] [delay in ms, usually 5-40ms] */
+ static BOOL SetSurroundParameters (UINT nDepth, UINT nDelay);
+
public:
- BOOL ReadNote();
- BOOL ProcessRow();
- BOOL ProcessEffects();
- UINT GetNNAChannel(UINT nChn) const;
- void CheckNNA(UINT nChn, UINT instr, int note, BOOL bForceCut);
- void NoteChange(UINT nChn, int note, BOOL bPorta=FALSE, BOOL bResetEnv=TRUE);
- void InstrumentChange(MODCHANNEL *pChn, UINT instr, BOOL bPorta=FALSE,BOOL bUpdVol=TRUE,BOOL bResetEnv=TRUE);
- /* Channel Effects */
- void PortamentoUp(MODCHANNEL *pChn, UINT param);
- void PortamentoDown(MODCHANNEL *pChn, UINT param);
- void FinePortamentoUp(MODCHANNEL *pChn, UINT param);
- void FinePortamentoDown(MODCHANNEL *pChn, UINT param);
- void ExtraFinePortamentoUp(MODCHANNEL *pChn, UINT param);
- void ExtraFinePortamentoDown(MODCHANNEL *pChn, UINT param);
- void TonePortamento(MODCHANNEL *pChn, UINT param);
- void Vibrato(MODCHANNEL *pChn, UINT param);
- void FineVibrato(MODCHANNEL *pChn, UINT param);
- void VolumeSlide(MODCHANNEL *pChn, UINT param);
- void PanningSlide(MODCHANNEL *pChn, UINT param);
- void ChannelVolSlide(MODCHANNEL *pChn, UINT param);
- void FineVolumeUp(MODCHANNEL *pChn, UINT param);
- void FineVolumeDown(MODCHANNEL *pChn, UINT param);
- void Tremolo(MODCHANNEL *pChn, UINT param);
- void Panbrello(MODCHANNEL *pChn, UINT param);
- void RetrigNote(UINT nChn, UINT param);
- void NoteCut(UINT nChn, UINT nTick);
- void KeyOff(UINT nChn);
- int PatternLoop(MODCHANNEL *, UINT param);
- void ExtendedMODCommands(UINT nChn, UINT param);
- void ExtendedS3MCommands(UINT nChn, UINT param);
- void ExtendedChannelEffect(MODCHANNEL *, UINT param);
- void ProcessMidiMacro(UINT nChn, LPCSTR pszMidiMacro, UINT param=0);
- void SetupChannelFilter(MODCHANNEL *pChn, BOOL bReset, int flt_modifier=256) const;
- /* Low-Level effect processing */
- void DoFreqSlide(MODCHANNEL *pChn, LONG nFreqSlide);
- /* Global Effects */
- void SetTempo(UINT param);
- void SetSpeed(UINT param);
- void GlobalVolSlide(UINT param);
- DWORD IsSongFinished(UINT nOrder, UINT nRow) const;
- BOOL IsValidBackwardJump(UINT nStartOrder, UINT nStartRow, UINT nJumpOrder, UINT nJumpRow) const;
- /* Read/Write sample functions */
- signed char GetDeltaValue(signed char prev, UINT n) const { return (signed char)(prev + CompressionTable[n & 0x0F]); }
- UINT PackSample(int &sample, int next);
- BOOL CanPackSample(LPSTR pSample, UINT nLen, UINT nPacking, BYTE *result=NULL);
- UINT ReadSample(MODINSTRUMENT *pIns, UINT nFlags, LPCSTR pMemFile, DWORD dwMemLength);
- BOOL DestroySample(UINT nSample);
- BOOL DestroyInstrument(UINT nInstr);
- BOOL IsSampleUsed(UINT nSample);
- BOOL IsInstrumentUsed(UINT nInstr);
- BOOL RemoveInstrumentSamples(UINT nInstr);
- UINT DetectUnusedSamples(BOOL *);
- BOOL RemoveSelectedSamples(BOOL *);
- void AdjustSampleLoop(MODINSTRUMENT *pIns);
- /* I/O from another sound file */
- BOOL ReadInstrumentFromSong(UINT nInstr, CSoundFile *, UINT nSrcInstrument);
- BOOL ReadSampleFromSong(UINT nSample, CSoundFile *, UINT nSrcSample);
- /* Period/Note functions */
- UINT GetNoteFromPeriod(UINT period) const;
- UINT GetPeriodFromNote(UINT note, int nFineTune, UINT nC4Speed) const;
- UINT GetFreqFromPeriod(UINT period, UINT nC4Speed, int nPeriodFrac=0) const;
- /* Misc functions */
- MODINSTRUMENT *GetSample(UINT n) { return Ins+n; }
- void ResetMidiCfg();
- UINT MapMidiInstrument(DWORD dwProgram, UINT nChannel, UINT nNote);
- BOOL ITInstrToMPT(const void *p, INSTRUMENTHEADER *penv, UINT trkvers);
- UINT SaveMixPlugins(FILE *f=NULL, BOOL bUpdate=TRUE);
- UINT LoadMixPlugins(const void *pData, UINT nLen);
+ BOOL ReadNote ();
+ BOOL ProcessRow ();
+ BOOL ProcessEffects ();
+ UINT GetNNAChannel (UINT nChn) const;
+ void CheckNNA (UINT nChn, UINT instr, int note, BOOL bForceCut);
+ void NoteChange (UINT nChn, int note, BOOL bPorta = FALSE, BOOL bResetEnv =
+ TRUE);
+ void InstrumentChange (MODCHANNEL * pChn, UINT instr, BOOL bPorta =
+ FALSE, BOOL bUpdVol = TRUE, BOOL bResetEnv = TRUE);
+ /* Channel Effects */
+ void PortamentoUp (MODCHANNEL * pChn, UINT param);
+ void PortamentoDown (MODCHANNEL * pChn, UINT param);
+ void FinePortamentoUp (MODCHANNEL * pChn, UINT param);
+ void FinePortamentoDown (MODCHANNEL * pChn, UINT param);
+ void ExtraFinePortamentoUp (MODCHANNEL * pChn, UINT param);
+ void ExtraFinePortamentoDown (MODCHANNEL * pChn, UINT param);
+ void TonePortamento (MODCHANNEL * pChn, UINT param);
+ void Vibrato (MODCHANNEL * pChn, UINT param);
+ void FineVibrato (MODCHANNEL * pChn, UINT param);
+ void VolumeSlide (MODCHANNEL * pChn, UINT param);
+ void PanningSlide (MODCHANNEL * pChn, UINT param);
+ void ChannelVolSlide (MODCHANNEL * pChn, UINT param);
+ void FineVolumeUp (MODCHANNEL * pChn, UINT param);
+ void FineVolumeDown (MODCHANNEL * pChn, UINT param);
+ void Tremolo (MODCHANNEL * pChn, UINT param);
+ void Panbrello (MODCHANNEL * pChn, UINT param);
+ void RetrigNote (UINT nChn, UINT param);
+ void NoteCut (UINT nChn, UINT nTick);
+ void KeyOff (UINT nChn);
+ int PatternLoop (MODCHANNEL *, UINT param);
+ void ExtendedMODCommands (UINT nChn, UINT param);
+ void ExtendedS3MCommands (UINT nChn, UINT param);
+ void ExtendedChannelEffect (MODCHANNEL *, UINT param);
+ void ProcessMidiMacro (UINT nChn, LPCSTR pszMidiMacro, UINT param = 0);
+ void SetupChannelFilter (MODCHANNEL * pChn, BOOL bReset, int flt_modifier =
+ 256) const;
+ /* Low-Level effect processing */
+ void DoFreqSlide (MODCHANNEL * pChn, LONG nFreqSlide);
+
+ /* Global Effects */
+ void SetTempo (UINT param);
+ void SetSpeed (UINT param);
+ void GlobalVolSlide (UINT param);
+ DWORD IsSongFinished (UINT nOrder, UINT nRow) const;
+ BOOL IsValidBackwardJump (UINT nStartOrder, UINT nStartRow, UINT nJumpOrder,
+ UINT nJumpRow) const;
+ /* Read/Write sample functions */
+ signed char GetDeltaValue (signed char prev, UINT n) const
+ {
+ return (signed char) (prev + CompressionTable[n & 0x0F]);
+ }
+ UINT PackSample (int &sample, int next);
+ BOOL CanPackSample (LPSTR pSample, UINT nLen, UINT nPacking, BYTE * result =
+ NULL);
+ UINT ReadSample (MODINSTRUMENT * pIns, UINT nFlags, LPCSTR pMemFile,
+ DWORD dwMemLength);
+ BOOL DestroySample (UINT nSample);
+ BOOL DestroyInstrument (UINT nInstr);
+ BOOL IsSampleUsed (UINT nSample);
+ BOOL IsInstrumentUsed (UINT nInstr);
+ BOOL RemoveInstrumentSamples (UINT nInstr);
+ UINT DetectUnusedSamples (BOOL *);
+ BOOL RemoveSelectedSamples (BOOL *);
+ void AdjustSampleLoop (MODINSTRUMENT * pIns);
+
+ /* I/O from another sound file */
+ BOOL ReadInstrumentFromSong (UINT nInstr, CSoundFile *, UINT nSrcInstrument);
+ BOOL ReadSampleFromSong (UINT nSample, CSoundFile *, UINT nSrcSample);
+
+ /* Period/Note functions */
+ UINT GetNoteFromPeriod (UINT period) const;
+ UINT GetPeriodFromNote (UINT note, int nFineTune, UINT nC4Speed) const;
+ UINT GetFreqFromPeriod (UINT period, UINT nC4Speed, int nPeriodFrac =
+ 0) const;
+ /* Misc functions */
+ MODINSTRUMENT *GetSample (UINT n)
+ {
+ return Ins + n;
+ }
+ void ResetMidiCfg ();
+ UINT MapMidiInstrument (DWORD dwProgram, UINT nChannel, UINT nNote);
+ BOOL ITInstrToMPT (const void *p, INSTRUMENTHEADER * penv, UINT trkvers);
+ UINT SaveMixPlugins (FILE * f = NULL, BOOL bUpdate = TRUE);
+ UINT LoadMixPlugins (const void *pData, UINT nLen);
+
#ifndef NO_FILTER
- DWORD CutOffToFrequency(UINT nCutOff, int flt_modifier=256) const; /* [0-255] => [1-10KHz] */
+ DWORD CutOffToFrequency (UINT nCutOff, int flt_modifier = 256) const; /* [0-255] => [1-10KHz] */
#endif
- /* Static helper functions */
+ /* Static helper functions */
public:
- static DWORD TransposeToFrequency(int transp, int ftune=0);
- static int FrequencyToTranspose(DWORD freq);
- static void FrequencyToTranspose(MODINSTRUMENT *psmp);
+ static DWORD TransposeToFrequency (int transp, int ftune = 0);
+ static int FrequencyToTranspose (DWORD freq);
+ static void FrequencyToTranspose (MODINSTRUMENT * psmp);
- /* System-Dependant functions */
+ /* System-Dependant functions */
public:
- static MODCOMMAND *AllocatePattern(UINT rows, UINT nchns);
- static signed char* AllocateSample(UINT nbytes);
- static void FreePattern(LPVOID pat);
- static void FreeSample(LPVOID p);
- static UINT Normalize24BitBuffer(LPBYTE pbuffer, UINT cbsizebytes, DWORD lmax24, DWORD dwByteInc);
+ static MODCOMMAND *AllocatePattern (UINT rows, UINT nchns);
+ static signed char *AllocateSample (UINT nbytes);
+ static void FreePattern (LPVOID pat);
+ static void FreeSample (LPVOID p);
+ static UINT Normalize24BitBuffer (LPBYTE pbuffer, UINT cbsizebytes,
+ DWORD lmax24, DWORD dwByteInc);
};
@@ -812,88 +908,88 @@ public:
typedef struct WAVEFILEHEADER
{
- DWORD id_RIFF; /* "RIFF" */
- DWORD filesize; /* file length-8 */
- DWORD id_WAVE;
+ DWORD id_RIFF; /* "RIFF" */
+ DWORD filesize; /* file length-8 */
+ DWORD id_WAVE;
} WAVEFILEHEADER;
typedef struct WAVEFORMATHEADER
{
- DWORD id_fmt; /* "fmt " */
- DWORD hdrlen; /* 16 */
- WORD format; /* 1 */
- WORD channels; /* 1:mono, 2:stereo */
- DWORD freqHz; /* sampling freq */
- DWORD bytessec; /* bytes/sec=freqHz*samplesize */
- WORD samplesize; /* sizeof(sample) */
- WORD bitspersample; /* bits per sample (8/16) */
+ DWORD id_fmt; /* "fmt " */
+ DWORD hdrlen; /* 16 */
+ WORD format; /* 1 */
+ WORD channels; /* 1:mono, 2:stereo */
+ DWORD freqHz; /* sampling freq */
+ DWORD bytessec; /* bytes/sec=freqHz*samplesize */
+ WORD samplesize; /* sizeof(sample) */
+ WORD bitspersample; /* bits per sample (8/16) */
} WAVEFORMATHEADER;
typedef struct WAVEDATAHEADER
{
- DWORD id_data; /* "data" */
- DWORD length; /* length of data */
+ DWORD id_data; /* "data" */
+ DWORD length; /* length of data */
} WAVEDATAHEADER;
typedef struct WAVESMPLHEADER
{
- /* SMPL */
- DWORD smpl_id; /* "smpl" -> 0x6C706D73 */
- DWORD smpl_len; /* length of smpl: 3Ch (54h with sustain loop) */
- DWORD dwManufacturer;
- DWORD dwProduct;
- DWORD dwSamplePeriod; /* 1000000000/freqHz */
- DWORD dwBaseNote; /* 3Ch = C-4 -> 60 + RelativeTone */
- DWORD dwPitchFraction;
- DWORD dwSMPTEFormat;
- DWORD dwSMPTEOffset;
- DWORD dwSampleLoops; /* number of loops */
- DWORD cbSamplerData;
+ /* SMPL */
+ DWORD smpl_id; /* "smpl" -> 0x6C706D73 */
+ DWORD smpl_len; /* length of smpl: 3Ch (54h with sustain loop) */
+ DWORD dwManufacturer;
+ DWORD dwProduct;
+ DWORD dwSamplePeriod; /* 1000000000/freqHz */
+ DWORD dwBaseNote; /* 3Ch = C-4 -> 60 + RelativeTone */
+ DWORD dwPitchFraction;
+ DWORD dwSMPTEFormat;
+ DWORD dwSMPTEOffset;
+ DWORD dwSampleLoops; /* number of loops */
+ DWORD cbSamplerData;
} WAVESMPLHEADER;
typedef struct SAMPLELOOPSTRUCT
{
- DWORD dwIdentifier;
- DWORD dwLoopType; /* 0=normal, 1=bidi */
- DWORD dwLoopStart;
- DWORD dwLoopEnd; /* Byte offset ? */
- DWORD dwFraction;
- DWORD dwPlayCount; /* Loop Count, 0=infinite */
+ DWORD dwIdentifier;
+ DWORD dwLoopType; /* 0=normal, 1=bidi */
+ DWORD dwLoopStart;
+ DWORD dwLoopEnd; /* Byte offset ? */
+ DWORD dwFraction;
+ DWORD dwPlayCount; /* Loop Count, 0=infinite */
} SAMPLELOOPSTRUCT;
typedef struct WAVESAMPLERINFO
{
- WAVESMPLHEADER wsiHdr;
- SAMPLELOOPSTRUCT wsiLoops[2];
+ WAVESMPLHEADER wsiHdr;
+ SAMPLELOOPSTRUCT wsiLoops[2];
} WAVESAMPLERINFO;
typedef struct WAVELISTHEADER
{
- DWORD list_id; /* "LIST" -> 0x5453494C */
- DWORD list_len;
- DWORD info; /* "INFO" */
+ DWORD list_id; /* "LIST" -> 0x5453494C */
+ DWORD list_len;
+ DWORD info; /* "INFO" */
} WAVELISTHEADER;
typedef struct WAVEEXTRAHEADER
{
- DWORD xtra_id; /* "xtra" -> 0x61727478 */
- DWORD xtra_len;
- DWORD dwFlags;
- WORD wPan;
- WORD wVolume;
- WORD wGlobalVol;
- WORD wReserved;
- BYTE nVibType;
- BYTE nVibSweep;
- BYTE nVibDepth;
- BYTE nVibRate;
+ DWORD xtra_id; /* "xtra" -> 0x61727478 */
+ DWORD xtra_len;
+ DWORD dwFlags;
+ WORD wPan;
+ WORD wVolume;
+ WORD wGlobalVol;
+ WORD wReserved;
+ BYTE nVibType;
+ BYTE nVibSweep;
+ BYTE nVibDepth;
+ BYTE nVibRate;
} WAVEEXTRAHEADER;
#pragma pack()
@@ -923,8 +1019,8 @@ typedef struct WAVEEXTRAHEADER
#define MOD2XMFineTune(k) ((int)( (signed char)((k)<<4) ))
#define XM2MODFineTune(k) ((int)( (k>>4)&0x0f ))
-int _muldiv(long a, long b, long c);
-int _muldivr(long a, long b, long c);
+int _muldiv (long a, long b, long c);
+int _muldivr (long a, long b, long c);
/* Byte swapping functions from the GNU C Library and libsdl */
@@ -954,8 +1050,8 @@ bswap_16 (unsigned short int __bsx)
static inline unsigned int
bswap_32 (unsigned int __bsx)
{
- return ((((__bsx) & 0xff000000) >> 24) | (((__bsx) & 0x00ff0000) >> 8) |
- (((__bsx) & 0x0000ff00) << 8) | (((__bsx) & 0x000000ff) << 24));
+ return ((((__bsx) & 0xff000000) >> 24) | (((__bsx) & 0x00ff0000) >> 8) |
+ (((__bsx) & 0x0000ff00) << 8) | (((__bsx) & 0x000000ff) << 24));
}
#endif
diff --git a/gst/modplug/libmodplug/stdafx.h b/gst/modplug/libmodplug/stdafx.h
index dc71ea8fa..76b8f67fb 100644
--- a/gst/modplug/libmodplug/stdafx.h
+++ b/gst/modplug/libmodplug/stdafx.h
@@ -19,7 +19,10 @@
#include <mmsystem.h>
#include <stdio.h>
-inline void ProcessPlugins(int n) {}
+inline void
+ProcessPlugins (int n)
+{
+}
#else
@@ -29,7 +32,7 @@ inline void ProcessPlugins(int n) {}
typedef signed char CHAR;
typedef unsigned char UCHAR;
-typedef unsigned char* PUCHAR;
+typedef unsigned char *PUCHAR;
typedef unsigned short USHORT;
typedef unsigned long ULONG;
typedef unsigned long UINT;
@@ -37,23 +40,24 @@ typedef unsigned long DWORD;
typedef long LONG;
typedef unsigned short WORD;
typedef unsigned char BYTE;
-typedef unsigned char * LPBYTE;
+typedef unsigned char *LPBYTE;
typedef bool BOOL;
-typedef char * LPSTR;
-typedef void * LPVOID;
-typedef long * LPLONG;
-typedef unsigned long * LPDWORD;
-typedef unsigned short * LPWORD;
-typedef const char * LPCSTR;
+typedef char *LPSTR;
+typedef void *LPVOID;
+typedef long *LPLONG;
+typedef unsigned long *LPDWORD;
+typedef unsigned short *LPWORD;
+typedef const char *LPCSTR;
typedef long long LONGLONG;
-typedef void * PVOID;
+typedef void *PVOID;
typedef void VOID;
-inline LONG MulDiv (long a, long b, long c)
+inline LONG
+MulDiv (long a, long b, long c)
{
/* if (!c) return 0; */
- return ((unsigned long long) a * (unsigned long long) b ) / c;
+ return ((unsigned long long) a * (unsigned long long) b) / c;
}
#define MODPLUG_NO_FILESAVE
@@ -67,15 +71,20 @@ inline LONG MulDiv (long a, long b, long c)
#define GHND 0
-inline signed char * GlobalAllocPtr(unsigned int, size_t size)
+inline signed char *
+GlobalAllocPtr (unsigned int, size_t size)
{
- signed char * p = (signed char *) malloc(size);
+ signed char *p = (signed char *) malloc (size);
- if (p != NULL) memset(p, 0, size);
+ if (p != NULL)
+ memset (p, 0, size);
return p;
}
-inline void ProcessPlugins(int n) {}
+inline void
+ProcessPlugins (int n)
+{
+}
#define GlobalFreePtr(p) free((void *)(p))
@@ -93,6 +102,3 @@ inline void ProcessPlugins(int n) {}
#endif /* MSC_VER */
#endif
-
-
-
diff --git a/gst/mpeg1sys/buffer.c b/gst/mpeg1sys/buffer.c
index 0d029529b..ceb67d074 100644
--- a/gst/mpeg1sys/buffer.c
+++ b/gst/mpeg1sys/buffer.c
@@ -36,7 +36,7 @@
#define AUDIO_SYNCWORD 0xfff
-#define CLOCKS 90000.0
+#define CLOCKS 90000.0
#ifdef G_HAVE_ISO_VARARGS
@@ -49,26 +49,26 @@
#endif
/* This must match decoder and encoder tables */
-static double picture_rates [16] =
-{
- 0.0,
- 24000.0/1001.,
- 24.0,
- 25.0,
- 30000.0/1001.,
- 30.0,
- 50.0,
- 60000.0/1001.,
- 60.0,
-
- 1,
- 5,
- 10,
- 12,
- 15,
- 0,
- 0
+static double picture_rates[16] = {
+ 0.0,
+ 24000.0 / 1001.,
+ 24.0,
+ 25.0,
+ 30000.0 / 1001.,
+ 30.0,
+ 50.0,
+ 60000.0 / 1001.,
+ 60.0,
+
+ 1,
+ 5,
+ 10,
+ 12,
+ 15,
+ 0,
+ 0
};
+
/* defined but not used
static double ratio [16] = { 0., 1., 0.6735, 0.7031, 0.7615, 0.8055,
0.8437, 0.8935, 0.9157, 0.9815, 1.0255, 1.0695, 1.0950, 1.1575,
@@ -76,26 +76,25 @@ static double ratio [16] = { 0., 1., 0.6735, 0.7031, 0.7615, 0.8055,
*/
#ifndef GST_DISABLE_GST_DEBUG
-static char picture_types [4][3] =
- { "I", "P", "B", "D" };
+static char picture_types[4][3] = { "I", "P", "B", "D" };
#endif
static int bitrate_index[2][3][16] =
-{ { {0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448, },
- {0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, },
- {0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, } },
- { {0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256, },
- {0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, },
- {0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, } },
+ { {{0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448,},
+ {0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384,},
+ {0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320,}},
+{{0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256,},
+ {0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160,},
+ {0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160,}},
};
static long frequency[9] =
-{44100, 48000, 32000, 22050, 24000, 16000, 11025, 12000, 8000};
+ { 44100, 48000, 32000, 22050, 24000, 16000, 11025, 12000, 8000 };
+
+static double dfrequency[9] = { 44.1, 48, 32, 22.05, 24, 16, 11.025, 12, 8 };
-static double dfrequency[9] =
-{44.1, 48, 32, 22.05, 24, 16, 11.025, 12, 8};
+static unsigned int samples[4] = { 192, 384, 1152, 1152 };
-static unsigned int samples [4] = {192, 384, 1152, 1152};
/* deined but not used
static char mode [4][15] =
{ "stereo", "joint stereo", "dual channel", "single channel" };
@@ -106,11 +105,13 @@ static char original [2][10] =
static char emphasis [4][20] =
{ "none", "50/15 microseconds", "reserved", "CCITT J.17" };
*/
-static void mpeg1mux_buffer_update_video_info(Mpeg1MuxBuffer *mb);
-static void mpeg1mux_buffer_update_audio_info(Mpeg1MuxBuffer *mb);
+static void mpeg1mux_buffer_update_video_info (Mpeg1MuxBuffer * mb);
+static void mpeg1mux_buffer_update_audio_info (Mpeg1MuxBuffer * mb);
-Mpeg1MuxBuffer *mpeg1mux_buffer_new(guchar type, guchar id) {
- Mpeg1MuxBuffer *new = g_malloc(sizeof(Mpeg1MuxBuffer));
+Mpeg1MuxBuffer *
+mpeg1mux_buffer_new (guchar type, guchar id)
+{
+ Mpeg1MuxBuffer *new = g_malloc (sizeof (Mpeg1MuxBuffer));
new->buffer = NULL;
new->length = 0;
@@ -127,47 +128,50 @@ Mpeg1MuxBuffer *mpeg1mux_buffer_new(guchar type, guchar id) {
return new;
}
-void mpeg1mux_buffer_queue(Mpeg1MuxBuffer *mb, GstBuffer *buf) {
+void
+mpeg1mux_buffer_queue (Mpeg1MuxBuffer * mb, GstBuffer * buf)
+{
if (mb->buffer == NULL) {
- mb->buffer = g_malloc(GST_BUFFER_SIZE(buf));
- mb->length = GST_BUFFER_SIZE(buf);
- memcpy(mb->buffer, GST_BUFFER_DATA(buf), GST_BUFFER_SIZE(buf));
- }
- else {
- mb->buffer = g_realloc(mb->buffer, mb->length + GST_BUFFER_SIZE(buf));
- memcpy(mb->buffer+mb->length, GST_BUFFER_DATA(buf), GST_BUFFER_SIZE(buf));
- mb->length += GST_BUFFER_SIZE(buf);
+ mb->buffer = g_malloc (GST_BUFFER_SIZE (buf));
+ mb->length = GST_BUFFER_SIZE (buf);
+ memcpy (mb->buffer, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
+ } else {
+ mb->buffer = g_realloc (mb->buffer, mb->length + GST_BUFFER_SIZE (buf));
+ memcpy (mb->buffer + mb->length, GST_BUFFER_DATA (buf),
+ GST_BUFFER_SIZE (buf));
+ mb->length += GST_BUFFER_SIZE (buf);
}
GST_DEBUG ("queuing buffer %lu", mb->length);
if (mb->buffer_type == BUFFER_TYPE_VIDEO) {
- mpeg1mux_buffer_update_video_info(mb);
- }
- else {
- mpeg1mux_buffer_update_audio_info(mb);
+ mpeg1mux_buffer_update_video_info (mb);
+ } else {
+ mpeg1mux_buffer_update_audio_info (mb);
}
}
-gulong mpeg1mux_buffer_update_queued(Mpeg1MuxBuffer *mb, guint64 scr) {
+gulong
+mpeg1mux_buffer_update_queued (Mpeg1MuxBuffer * mb, guint64 scr)
+{
GList *queued_list;
Mpeg1MuxTimecode *tc;
gulong total_queued = 0;
-
+
GST_DEBUG ("queued in buffer on SCR=%" G_GUINT64_FORMAT, scr);
- queued_list = g_list_first(mb->queued_list);
+ queued_list = g_list_first (mb->queued_list);
while (queued_list) {
tc = (Mpeg1MuxTimecode *) queued_list->data;
if (tc->DTS < scr) {
/* this buffer should be sent out */
- mb->queued_list = g_list_remove(mb->queued_list, tc);
- queued_list = g_list_first(mb->queued_list);
- }
- else {
- GST_DEBUG ("queued in buffer %ld, %" G_GUINT64_FORMAT, tc->original_length, tc->DTS);
+ mb->queued_list = g_list_remove (mb->queued_list, tc);
+ queued_list = g_list_first (mb->queued_list);
+ } else {
+ GST_DEBUG ("queued in buffer %ld, %" G_GUINT64_FORMAT,
+ tc->original_length, tc->DTS);
total_queued += tc->original_length;
- queued_list = g_list_next(queued_list);
+ queued_list = g_list_next (queued_list);
}
}
GST_DEBUG ("queued in buffer %lu", total_queued);
@@ -175,7 +179,9 @@ gulong mpeg1mux_buffer_update_queued(Mpeg1MuxBuffer *mb, guint64 scr) {
return total_queued;
}
-void mpeg1mux_buffer_shrink(Mpeg1MuxBuffer *mb, gulong size) {
+void
+mpeg1mux_buffer_shrink (Mpeg1MuxBuffer * mb, gulong size)
+{
GList *timecode_list;
Mpeg1MuxTimecode *tc;
gulong consumed = 0;
@@ -183,35 +189,37 @@ void mpeg1mux_buffer_shrink(Mpeg1MuxBuffer *mb, gulong size) {
GST_DEBUG ("shrinking buffer %lu", size);
- g_assert(mb->length >= size);
+ g_assert (mb->length >= size);
- memcpy(mb->buffer, mb->buffer+size, mb->length-size);
- mb->buffer = g_realloc(mb->buffer, mb->length-size);
+ memcpy (mb->buffer, mb->buffer + size, mb->length - size);
+ mb->buffer = g_realloc (mb->buffer, mb->length - size);
mb->length -= size;
mb->scan_pos -= size;
mb->current_start -= size;
- timecode_list = g_list_first(mb->timecode_list);
+ timecode_list = g_list_first (mb->timecode_list);
tc = (Mpeg1MuxTimecode *) timecode_list->data;
-
+
if (tc->length > size) {
tc->length -= size;
mb->new_frame = FALSE;
- }
- else {
+ } else {
consumed += tc->length;
while (size >= consumed) {
- GST_DEBUG ("removing timecode: %" G_GUINT64_FORMAT " %" G_GUINT64_FORMAT " %lu %lu", tc->DTS, tc->PTS, tc->length, consumed);
- mb->timecode_list = g_list_remove_link(mb->timecode_list, timecode_list);
- mb->queued_list = g_list_append(mb->queued_list, tc);
- timecode_list = g_list_first(mb->timecode_list);
+ GST_DEBUG ("removing timecode: %" G_GUINT64_FORMAT " %" G_GUINT64_FORMAT
+ " %lu %lu", tc->DTS, tc->PTS, tc->length, consumed);
+ mb->timecode_list = g_list_remove_link (mb->timecode_list, timecode_list);
+ mb->queued_list = g_list_append (mb->queued_list, tc);
+ timecode_list = g_list_first (mb->timecode_list);
tc = (Mpeg1MuxTimecode *) timecode_list->data;
consumed += tc->length;
- GST_DEBUG ("next timecode: %" G_GUINT64_FORMAT " %" G_GUINT64_FORMAT " %lu %lu", tc->DTS, tc->PTS, tc->length, consumed);
+ GST_DEBUG ("next timecode: %" G_GUINT64_FORMAT " %" G_GUINT64_FORMAT
+ " %lu %lu", tc->DTS, tc->PTS, tc->length, consumed);
}
mb->new_frame = TRUE;
- GST_DEBUG ("leftover frame size from %lu to %lu ", tc->length, consumed-size);
+ GST_DEBUG ("leftover frame size from %lu to %lu ", tc->length,
+ consumed - size);
tc->length = consumed - size;
}
@@ -219,128 +227,143 @@ void mpeg1mux_buffer_shrink(Mpeg1MuxBuffer *mb, gulong size) {
mb->info.video.DTS = tc->DTS;
mb->info.video.PTS = tc->PTS;
mb->next_frame_time = tc->DTS;
- }
- else {
+ } else {
mb->info.audio.PTS = tc->PTS;
mb->next_frame_time = tc->PTS;
}
- GST_DEBUG ("next frame time timecode: %" G_GUINT64_FORMAT " %lu", mb->next_frame_time, tc->length);
+ GST_DEBUG ("next frame time timecode: %" G_GUINT64_FORMAT " %lu",
+ mb->next_frame_time, tc->length);
/* check buffer consistency */
- timecode_list = g_list_first(mb->timecode_list);
+ timecode_list = g_list_first (mb->timecode_list);
count = 0;
while (timecode_list) {
tc = (Mpeg1MuxTimecode *) timecode_list->data;
count += tc->length;
-
- timecode_list = g_list_next(timecode_list);
+
+ timecode_list = g_list_next (timecode_list);
}
- if (count != mb->current_start) g_print("********** error %lu != %lu\n", count, mb->current_start);
+ if (count != mb->current_start)
+ g_print ("********** error %lu != %lu\n", count, mb->current_start);
mb->base += size;
}
-static void mpeg1mux_buffer_update_video_info(Mpeg1MuxBuffer *mb) {
+static void
+mpeg1mux_buffer_update_video_info (Mpeg1MuxBuffer * mb)
+{
gboolean have_sync = FALSE;
guchar *data = mb->buffer;
gulong offset = mb->scan_pos;
guint sync_zeros = 0;
- gulong id=0;
+ gulong id = 0;
guint temporal_reference, temp;
gst_getbits_t gb;
-
+
GST_DEBUG ("mpeg1mux::update_video_info %lu %lu", mb->base, mb->scan_pos);
if (mb->base == 0 && mb->scan_pos == 0) {
- if ((SYNCWORD_START<<8)+*(mb->buffer+3) == SEQUENCE_HEADER) {
-
- gst_getbits_init(&gb, NULL, NULL);
- gst_getbits_newbuf(&gb, data+4, mb->length);
- mb->info.video.horizontal_size = gst_getbits12(&gb);
- mb->info.video.vertical_size = gst_getbits12(&gb);
- mb->info.video.aspect_ratio = gst_getbits4(&gb);
- mb->info.video.picture_rate = gst_getbits4(&gb);
- mb->info.video.bit_rate = gst_getbits18(&gb);
- if (gst_getbits1(&gb) != 1) {
- g_print("mpeg1mux::update_video_info: marker bit error\n");
+ if ((SYNCWORD_START << 8) + *(mb->buffer + 3) == SEQUENCE_HEADER) {
+
+ gst_getbits_init (&gb, NULL, NULL);
+ gst_getbits_newbuf (&gb, data + 4, mb->length);
+ mb->info.video.horizontal_size = gst_getbits12 (&gb);
+ mb->info.video.vertical_size = gst_getbits12 (&gb);
+ mb->info.video.aspect_ratio = gst_getbits4 (&gb);
+ mb->info.video.picture_rate = gst_getbits4 (&gb);
+ mb->info.video.bit_rate = gst_getbits18 (&gb);
+ if (gst_getbits1 (&gb) != 1) {
+ g_print ("mpeg1mux::update_video_info: marker bit error\n");
}
- mb->info.video.vbv_buffer_size = gst_getbits10(&gb);
- mb->info.video.CSPF = gst_getbits1(&gb);
-
- mb->info.video.secs_per_frame = 1. / picture_rates[mb->info.video.picture_rate];
- mb->info.video.decoding_order=0;
- mb->info.video.group_order=0;
- GST_DEBUG ("mpeg1mux::update_video_info: secs per frame %g", mb->info.video.secs_per_frame);
- }
- else {
- g_print("mpeg1mux::update_video_info: Invalid MPEG Video header\n");
+ mb->info.video.vbv_buffer_size = gst_getbits10 (&gb);
+ mb->info.video.CSPF = gst_getbits1 (&gb);
+
+ mb->info.video.secs_per_frame =
+ 1. / picture_rates[mb->info.video.picture_rate];
+ mb->info.video.decoding_order = 0;
+ mb->info.video.group_order = 0;
+ GST_DEBUG ("mpeg1mux::update_video_info: secs per frame %g",
+ mb->info.video.secs_per_frame);
+ } else {
+ g_print ("mpeg1mux::update_video_info: Invalid MPEG Video header\n");
}
}
- while (offset < mb->length-6) {
+ while (offset < mb->length - 6) {
if (!have_sync) {
- guchar byte = *(data+offset);
+ guchar byte = *(data + offset);
+
/*GST_DEBUG ("mpeg1mux::update_video_info: found #%d at %lu",byte,offset); */
offset++;
/* if it's zero, increment the zero count */
if (byte == 0) {
- sync_zeros++;
- /*GST_DEBUG ("mpeg1mux::update_video_info: found zero #%d at %lu",sync_zeros,offset-1); */
+ sync_zeros++;
+ /*GST_DEBUG ("mpeg1mux::update_video_info: found zero #%d at %lu",sync_zeros,offset-1); */
}
/* if it's a one and we have two previous zeros, we have sync */
else if ((byte == 1) && (sync_zeros >= 2)) {
- GST_DEBUG ("mpeg1mux::update_video_info: synced at %lu",offset-1);
- have_sync = TRUE;
- sync_zeros = 0;
+ GST_DEBUG ("mpeg1mux::update_video_info: synced at %lu", offset - 1);
+ have_sync = TRUE;
+ sync_zeros = 0;
}
/* if it's anything else, we've lost it completely */
- else sync_zeros = 0;
- /* then snag the chunk ID */
+ else
+ sync_zeros = 0;
+ /* then snag the chunk ID */
} else if (id == 0) {
- id = *(data+offset);
- GST_DEBUG ("mpeg1mux::update_video_info: got id 0x%02lX",id);
- id = (SYNCWORD_START<<8)+id;
+ id = *(data + offset);
+ GST_DEBUG ("mpeg1mux::update_video_info: got id 0x%02lX", id);
+ id = (SYNCWORD_START << 8) + id;
switch (id) {
case SEQUENCE_HEADER:
- GST_DEBUG ("mpeg1mux::update_video_info: sequence header");
+ GST_DEBUG ("mpeg1mux::update_video_info: sequence header");
break;
case GROUP_START:
- GST_DEBUG ("mpeg1mux::update_video_info: group start");
- mb->info.video.group_order=0;
+ GST_DEBUG ("mpeg1mux::update_video_info: group start");
+ mb->info.video.group_order = 0;
break;
case PICTURE_START:
/* skip the first access unit */
if (mb->info.video.decoding_order != 0) {
Mpeg1MuxTimecode *tc;
- GST_DEBUG ("mpeg1mux::update_video_info: PTS %" G_GUINT64_FORMAT ", DTS %" G_GUINT64_FORMAT ", length %lu", mb->info.video.current_PTS,
- mb->info.video.current_DTS, offset - mb->current_start-3);
- tc = (Mpeg1MuxTimecode *) g_malloc(sizeof(Mpeg1MuxTimecode));
- tc->length = offset - mb->current_start-3;
+ GST_DEBUG ("mpeg1mux::update_video_info: PTS %" G_GUINT64_FORMAT
+ ", DTS %" G_GUINT64_FORMAT ", length %lu",
+ mb->info.video.current_PTS, mb->info.video.current_DTS,
+ offset - mb->current_start - 3);
+
+ tc = (Mpeg1MuxTimecode *) g_malloc (sizeof (Mpeg1MuxTimecode));
+ tc->length = offset - mb->current_start - 3;
tc->original_length = tc->length;
tc->frame_type = mb->info.video.current_type;
tc->DTS = mb->info.video.current_DTS;
tc->PTS = mb->info.video.current_PTS;
- mb->timecode_list = g_list_append(mb->timecode_list, tc);
+ mb->timecode_list = g_list_append (mb->timecode_list, tc);
if (mb->info.video.decoding_order == 0) {
mb->next_frame_time = tc->DTS;
}
- mb->current_start = offset-3;
+ mb->current_start = offset - 3;
}
- temp= (*(data+offset+1)<<8)+*(data+offset+2);
+ temp = (*(data + offset + 1) << 8) + *(data + offset + 2);
temporal_reference = (temp & 0xffc0) >> 6;
mb->info.video.current_type = (temp & 0x0038) >> 3;
- GST_DEBUG ("mpeg1mux::update_video_info: picture start temporal_ref:%d type:%s Frame", temporal_reference,
- picture_types[mb->info.video.current_type-1]);
-
- mb->info.video.current_DTS = mb->info.video.decoding_order * mb->info.video.secs_per_frame * CLOCKS;
- mb->info.video.current_PTS = (temporal_reference - mb->info.video.group_order + 1 +
- mb->info.video.decoding_order) *mb->info.video.secs_per_frame*CLOCKS;
+ GST_DEBUG
+ ("mpeg1mux::update_video_info: picture start temporal_ref:%d type:%s Frame",
+ temporal_reference,
+ picture_types[mb->info.video.current_type - 1]);
+
+ mb->info.video.current_DTS =
+ mb->info.video.decoding_order * mb->info.video.secs_per_frame *
+ CLOCKS;
+ mb->info.video.current_PTS =
+ (temporal_reference - mb->info.video.group_order + 1 +
+ mb->info.video.decoding_order) * mb->info.video.secs_per_frame *
+ CLOCKS;
mb->info.video.decoding_order++;
mb->info.video.group_order++;
@@ -349,7 +372,7 @@ static void mpeg1mux_buffer_update_video_info(Mpeg1MuxBuffer *mb) {
offset++;
break;
case SEQUENCE_END:
- GST_DEBUG ("mpeg1mux::update_video_info: sequence end");
+ GST_DEBUG ("mpeg1mux::update_video_info: sequence end");
break;
}
/* prepare for next sync */
@@ -362,105 +385,115 @@ static void mpeg1mux_buffer_update_video_info(Mpeg1MuxBuffer *mb) {
mb->scan_pos = offset;
}
-static void mpeg1mux_buffer_update_audio_info(Mpeg1MuxBuffer *mb) {
+static void
+mpeg1mux_buffer_update_audio_info (Mpeg1MuxBuffer * mb)
+{
guchar *data = mb->buffer;
gulong offset = mb->scan_pos;
- guint32 id=0;
+ guint32 id = 0;
guint padding_bit;
gst_getbits_t gb;
guint startup_delay = 0;
- int layer_index,lsf,samplerate_index,padding;
+ int layer_index, lsf, samplerate_index, padding;
long bpf;
Mpeg1MuxTimecode *tc;
-
+
GST_DEBUG ("mpeg1mux::update_audio_info %lu %lu", mb->base, mb->scan_pos);
if (mb->base == 0 && mb->scan_pos == 0) {
- id = GUINT32_FROM_BE(*((guint32 *)(data)));
+ id = GUINT32_FROM_BE (*((guint32 *) (data)));
- printf("MPEG audio id = %08x\n", (unsigned int)id);
- if ((id & 0xfff00000) == AUDIO_SYNCWORD<<20) {
+ printf ("MPEG audio id = %08x\n", (unsigned int) id);
+ if ((id & 0xfff00000) == AUDIO_SYNCWORD << 20) {
/* mpegver = (header >> 19) & 0x3; don't need this for bpf */
layer_index = (id >> 17) & 0x3;
mb->info.audio.layer = 4 - layer_index;
lsf = (id & (1 << 20)) ? ((id & (1 << 19)) ? 0 : 1) : 1;
- mb->info.audio.bit_rate = bitrate_index[lsf][mb->info.audio.layer - 1][((id >> 12) & 0xf)];
+ mb->info.audio.bit_rate =
+ bitrate_index[lsf][mb->info.audio.layer - 1][((id >> 12) & 0xf)];
samplerate_index = (id >> 10) & 0x3;
padding = (id >> 9) & 0x1;
if (mb->info.audio.layer == 1) {
- bpf = mb->info.audio.bit_rate * 12000;
- bpf /= frequency[samplerate_index];
- bpf = ((bpf + padding) << 2);
+ bpf = mb->info.audio.bit_rate * 12000;
+ bpf /= frequency[samplerate_index];
+ bpf = ((bpf + padding) << 2);
} else {
- bpf = mb->info.audio.bit_rate * 144000;
- bpf /= frequency[samplerate_index];
- bpf += padding;
+ bpf = mb->info.audio.bit_rate * 144000;
+ bpf /= frequency[samplerate_index];
+ bpf += padding;
}
mb->info.audio.framesize = bpf;
- GST_DEBUG ("mpeg1mux::update_audio_info: samples per second %d", samplerate_index);
+ GST_DEBUG ("mpeg1mux::update_audio_info: samples per second %d",
+ samplerate_index);
- gst_getbits_init(&gb, NULL, NULL);
- gst_getbits_newbuf(&gb, data, mb->length);
+ gst_getbits_init (&gb, NULL, NULL);
+ gst_getbits_newbuf (&gb, data, mb->length);
- gst_flushbitsn(&gb, 12);
- if (gst_getbits1(&gb) != 1) {
- g_print("mpeg1mux::update_audio_info: marker bit error\n");
+ gst_flushbitsn (&gb, 12);
+ if (gst_getbits1 (&gb) != 1) {
+ g_print ("mpeg1mux::update_audio_info: marker bit error\n");
}
- gst_flushbitsn(&gb, 2);
- mb->info.audio.protection = gst_getbits1(&gb);
- gst_flushbitsn(&gb, 4);
- mb->info.audio.frequency = gst_getbits2(&gb);
- padding_bit = gst_getbits1(&gb);
- gst_flushbitsn(&gb, 1);
- mb->info.audio.mode = gst_getbits2(&gb);
- mb->info.audio.mode_extension = gst_getbits2(&gb);
- mb->info.audio.copyright = gst_getbits1(&gb);
- mb->info.audio.original_copy = gst_getbits1(&gb);
- mb->info.audio.emphasis = gst_getbits2(&gb);
+ gst_flushbitsn (&gb, 2);
+ mb->info.audio.protection = gst_getbits1 (&gb);
+ gst_flushbitsn (&gb, 4);
+ mb->info.audio.frequency = gst_getbits2 (&gb);
+ padding_bit = gst_getbits1 (&gb);
+ gst_flushbitsn (&gb, 1);
+ mb->info.audio.mode = gst_getbits2 (&gb);
+ mb->info.audio.mode_extension = gst_getbits2 (&gb);
+ mb->info.audio.copyright = gst_getbits1 (&gb);
+ mb->info.audio.original_copy = gst_getbits1 (&gb);
+ mb->info.audio.emphasis = gst_getbits2 (&gb);
GST_DEBUG ("mpeg1mux::update_audio_info: layer %d", mb->info.audio.layer);
- GST_DEBUG ("mpeg1mux::update_audio_info: bit_rate %d", mb->info.audio.bit_rate);
- GST_DEBUG ("mpeg1mux::update_audio_info: frequency %d", mb->info.audio.frequency);
+ GST_DEBUG ("mpeg1mux::update_audio_info: bit_rate %d",
+ mb->info.audio.bit_rate);
+ GST_DEBUG ("mpeg1mux::update_audio_info: frequency %d",
+ mb->info.audio.frequency);
- mb->info.audio.samples_per_second = (double)dfrequency [mb->info.audio.frequency];
+ mb->info.audio.samples_per_second =
+ (double) dfrequency[mb->info.audio.frequency];
- GST_DEBUG ("mpeg1mux::update_audio_info: samples per second %g", mb->info.audio.samples_per_second);
+ GST_DEBUG ("mpeg1mux::update_audio_info: samples per second %g",
+ mb->info.audio.samples_per_second);
- mb->info.audio.decoding_order=0;
+ mb->info.audio.decoding_order = 0;
- tc = (Mpeg1MuxTimecode *) g_malloc(sizeof(Mpeg1MuxTimecode));
+ tc = (Mpeg1MuxTimecode *) g_malloc (sizeof (Mpeg1MuxTimecode));
tc->length = mb->info.audio.framesize;
tc->original_length = tc->length;
tc->frame_type = FRAME_TYPE_AUDIO;
- mb->info.audio.current_PTS = mb->info.audio.decoding_order * samples [mb->info.audio.layer] /
- mb->info.audio.samples_per_second * 90. + startup_delay;
+ mb->info.audio.current_PTS =
+ mb->info.audio.decoding_order * samples[mb->info.audio.layer] /
+ mb->info.audio.samples_per_second * 90. + startup_delay;
- GST_DEBUG ("mpeg1mux::update_audio_info: PTS %" G_GUINT64_FORMAT ", length %u", mb->info.audio.current_PTS, mb->info.audio.framesize);
+ GST_DEBUG ("mpeg1mux::update_audio_info: PTS %" G_GUINT64_FORMAT
+ ", length %u", mb->info.audio.current_PTS, mb->info.audio.framesize);
tc->PTS = mb->info.audio.current_PTS;
tc->DTS = mb->info.audio.current_PTS;
- mb->timecode_list = g_list_append(mb->timecode_list, tc);
+ mb->timecode_list = g_list_append (mb->timecode_list, tc);
mb->next_frame_time = tc->PTS;
mb->info.audio.decoding_order++;
offset += tc->length;
- }
- else {
- g_print("mpeg1mux::update_audio_info: Invalid MPEG Video header\n");
+ } else {
+ g_print ("mpeg1mux::update_audio_info: Invalid MPEG Video header\n");
}
}
- while (offset < mb->length-4) {
- id = GUINT32_FROM_BE(*((guint32 *)(data+offset)));
+ while (offset < mb->length - 4) {
+ id = GUINT32_FROM_BE (*((guint32 *) (data + offset)));
/* mpegver = (header >> 19) & 0x3; don't need this for bpf */
layer_index = (id >> 17) & 0x3;
mb->info.audio.layer = 4 - layer_index;
lsf = (id & (1 << 20)) ? ((id & (1 << 19)) ? 0 : 1) : 1;
- mb->info.audio.bit_rate = bitrate_index[lsf][mb->info.audio.layer - 1][((id >> 12) & 0xf)];
+ mb->info.audio.bit_rate =
+ bitrate_index[lsf][mb->info.audio.layer - 1][((id >> 12) & 0xf)];
samplerate_index = (id >> 10) & 0x3;
padding = (id >> 9) & 0x1;
@@ -473,21 +506,25 @@ static void mpeg1mux_buffer_update_audio_info(Mpeg1MuxBuffer *mb) {
bpf /= frequency[samplerate_index];
bpf += padding;
}
- tc = (Mpeg1MuxTimecode *) g_malloc(sizeof(Mpeg1MuxTimecode));
+ tc = (Mpeg1MuxTimecode *) g_malloc (sizeof (Mpeg1MuxTimecode));
tc->length = bpf;
tc->original_length = tc->length;
tc->frame_type = FRAME_TYPE_AUDIO;
mb->current_start = offset + bpf;
- mb->info.audio.samples_per_second = (double)dfrequency [mb->info.audio.frequency];
+ mb->info.audio.samples_per_second =
+ (double) dfrequency[mb->info.audio.frequency];
- mb->info.audio.current_PTS = (mb->info.audio.decoding_order * samples [mb->info.audio.layer]) /
- mb->info.audio.samples_per_second * 90. ;
+ mb->info.audio.current_PTS =
+ (mb->info.audio.decoding_order * samples[mb->info.audio.layer]) /
+ mb->info.audio.samples_per_second * 90.;
tc->DTS = tc->PTS = mb->info.audio.current_PTS;
- GST_DEBUG ("mpeg1mux::update_audio_info: PTS %" G_GUINT64_FORMAT ", %" G_GUINT64_FORMAT " length %lu", mb->info.audio.current_PTS, tc->PTS, tc->length);
- mb->timecode_list = g_list_append(mb->timecode_list, tc);
+ GST_DEBUG ("mpeg1mux::update_audio_info: PTS %" G_GUINT64_FORMAT ", %"
+ G_GUINT64_FORMAT " length %lu", mb->info.audio.current_PTS, tc->PTS,
+ tc->length);
+ mb->timecode_list = g_list_append (mb->timecode_list, tc);
mb->info.audio.decoding_order++;
offset += tc->length;
diff --git a/gst/mpeg1sys/buffer.h b/gst/mpeg1sys/buffer.h
index 0624c3aab..2a9fb71f5 100644
--- a/gst/mpeg1sys/buffer.h
+++ b/gst/mpeg1sys/buffer.h
@@ -24,8 +24,9 @@
#include <gst/gst.h>
#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
+extern "C"
+{
+#endif /* __cplusplus */
#define MPEG1MUX_BUFFER_QUEUED(mb) (g_list_length((mb)->timecode_list))
#define MPEG1MUX_BUFFER_SPACE(mb) ((mb)->length)
@@ -41,101 +42,104 @@ extern "C" {
#define FRAME_TYPE_PFRAME 3
#define FRAME_TYPE_AUDIO 4
-typedef struct _Mpeg1MuxBuffer Mpeg1MuxBuffer;
-typedef struct _Mpeg1MuxTimecode Mpeg1MuxTimecode;
-
-typedef struct video_struc /* Informationen ueber Video Stream */
-{
- unsigned int stream_length ;
- unsigned int num_sequence ;
- unsigned int num_seq_end ;
- unsigned int num_pictures ;
- unsigned int num_groups ;
- unsigned int num_frames[4] ;
- unsigned int avg_frames[4] ;
-
- unsigned int horizontal_size;
- unsigned int vertical_size ;
- unsigned int aspect_ratio ;
- unsigned int picture_rate ;
- unsigned int bit_rate ;
- unsigned int comp_bit_rate ;
- unsigned int vbv_buffer_size;
- unsigned int CSPF ;
-
- guint64 PTS;
- guint64 DTS;
-
- guint64 current_PTS;
- guint64 current_DTS;
- guchar current_type;
-
- double secs_per_frame;
- gulong group_order, decoding_order;
-} Video_struc;
-
-typedef struct audio_struc /* Informationen ueber Audio Stream */
-{
- unsigned int stream_length ;
- unsigned int num_syncword ;
- unsigned int num_frames [2] ;
- unsigned int framesize ;
- unsigned int layer ;
- unsigned int protection ;
- unsigned int bit_rate ;
- unsigned int frequency ;
- unsigned int mode ;
- unsigned int mode_extension ;
- unsigned int copyright ;
- unsigned int original_copy ;
- unsigned int emphasis ;
-
- guint64 PTS;
-
- guint64 current_PTS;
-
- double samples_per_second;
- gulong decoding_order;
-} Audio_struc;
-
-struct _Mpeg1MuxTimecode {
- gulong length;
- gulong original_length;
- guchar frame_type;
- guint64 PTS;
- guint64 DTS;
-};
-
-struct _Mpeg1MuxBuffer {
- unsigned char *buffer;
- gulong length;
- gulong base;
- gulong scan_pos;
- gulong last_pos;
- gulong current_start;
- guchar buffer_type;
- guchar stream_id;
- gboolean new_frame;
- guint64 next_frame_time;
-
- union {
- Video_struc video;
- Audio_struc audio;
- } info;
-
- GList *timecode_list;
- GList *queued_list;
-};
-
-Mpeg1MuxBuffer *mpeg1mux_buffer_new(guchar type, guchar id);
-
-void mpeg1mux_buffer_queue(Mpeg1MuxBuffer *mb, GstBuffer *buf);
-void mpeg1mux_buffer_shrink(Mpeg1MuxBuffer *mb, gulong size);
-gulong mpeg1mux_buffer_update_queued(Mpeg1MuxBuffer *mb, guint64 scr);
+ typedef struct _Mpeg1MuxBuffer Mpeg1MuxBuffer;
+ typedef struct _Mpeg1MuxTimecode Mpeg1MuxTimecode;
+
+ typedef struct video_struc /* Informationen ueber Video Stream */
+ {
+ unsigned int stream_length;
+ unsigned int num_sequence;
+ unsigned int num_seq_end;
+ unsigned int num_pictures;
+ unsigned int num_groups;
+ unsigned int num_frames[4];
+ unsigned int avg_frames[4];
+
+ unsigned int horizontal_size;
+ unsigned int vertical_size;
+ unsigned int aspect_ratio;
+ unsigned int picture_rate;
+ unsigned int bit_rate;
+ unsigned int comp_bit_rate;
+ unsigned int vbv_buffer_size;
+ unsigned int CSPF;
+
+ guint64 PTS;
+ guint64 DTS;
+
+ guint64 current_PTS;
+ guint64 current_DTS;
+ guchar current_type;
+
+ double secs_per_frame;
+ gulong group_order, decoding_order;
+ } Video_struc;
+
+ typedef struct audio_struc /* Informationen ueber Audio Stream */
+ {
+ unsigned int stream_length;
+ unsigned int num_syncword;
+ unsigned int num_frames[2];
+ unsigned int framesize;
+ unsigned int layer;
+ unsigned int protection;
+ unsigned int bit_rate;
+ unsigned int frequency;
+ unsigned int mode;
+ unsigned int mode_extension;
+ unsigned int copyright;
+ unsigned int original_copy;
+ unsigned int emphasis;
+
+ guint64 PTS;
+
+ guint64 current_PTS;
+
+ double samples_per_second;
+ gulong decoding_order;
+ } Audio_struc;
+
+ struct _Mpeg1MuxTimecode
+ {
+ gulong length;
+ gulong original_length;
+ guchar frame_type;
+ guint64 PTS;
+ guint64 DTS;
+ };
+
+ struct _Mpeg1MuxBuffer
+ {
+ unsigned char *buffer;
+ gulong length;
+ gulong base;
+ gulong scan_pos;
+ gulong last_pos;
+ gulong current_start;
+ guchar buffer_type;
+ guchar stream_id;
+ gboolean new_frame;
+ guint64 next_frame_time;
+
+ union
+ {
+ Video_struc video;
+ Audio_struc audio;
+ } info;
+
+ GList *timecode_list;
+ GList *queued_list;
+ };
+
+ Mpeg1MuxBuffer *mpeg1mux_buffer_new (guchar type, guchar id);
+
+ void mpeg1mux_buffer_queue (Mpeg1MuxBuffer * mb, GstBuffer * buf);
+ void mpeg1mux_buffer_shrink (Mpeg1MuxBuffer * mb, gulong size);
+ gulong mpeg1mux_buffer_update_queued (Mpeg1MuxBuffer * mb, guint64 scr);
#ifdef __cplusplus
}
-#endif /* __cplusplus */
+#endif /* __cplusplus */
-#endif /* __BUFFER_H__ */
+#endif /* __BUFFER_H__ */
diff --git a/gst/mpeg1sys/gstmpeg1systemencode.c b/gst/mpeg1sys/gstmpeg1systemencode.c
index e3d38d9ae..a071f0c4b 100644
--- a/gst/mpeg1sys/gstmpeg1systemencode.c
+++ b/gst/mpeg1sys/gstmpeg1systemencode.c
@@ -39,59 +39,54 @@ static GstElementDetails system_encode_details = {
};
/* GstMPEG1SystemEncode signals and args */
-enum {
+enum
+{
/* FILL ME */
LAST_SIGNAL
};
-enum {
+enum
+{
ARG_0,
/* FILL ME */
};
-static GstStaticPadTemplate src_factory =
-GST_STATIC_PAD_TEMPLATE (
- "src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("video/mpeg, "
- "systemstream = (boolean) TRUE")
-);
+static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("video/mpeg, " "systemstream = (boolean) TRUE")
+ );
static GstStaticPadTemplate video_sink_factory =
-GST_STATIC_PAD_TEMPLATE (
- "video_%d",
- GST_PAD_SINK,
- GST_PAD_REQUEST,
- GST_STATIC_CAPS ("video/mpeg, "
- "mpegversion = (int) 1, "
- "systemstream = (boolean) FALSE")
-);
+GST_STATIC_PAD_TEMPLATE ("video_%d",
+ GST_PAD_SINK,
+ GST_PAD_REQUEST,
+ GST_STATIC_CAPS ("video/mpeg, "
+ "mpegversion = (int) 1, " "systemstream = (boolean) FALSE")
+ );
static GstStaticPadTemplate audio_sink_factory =
-GST_STATIC_PAD_TEMPLATE (
- "audio_%d",
- GST_PAD_SINK,
- GST_PAD_REQUEST,
- GST_STATIC_CAPS ("audio/mpeg, "
- "mpegversion = (int) 1, "
- "layer = (int) [ 1, 2 ] "
- )
-);
-
-static void gst_system_encode_class_init (GstMPEG1SystemEncodeClass *klass);
-static void gst_system_encode_base_init (GstMPEG1SystemEncodeClass *klass);
-static void gst_system_encode_init (GstMPEG1SystemEncode *system_encode);
-
-static GstPad* gst_system_encode_request_new_pad (GstElement *element, GstPadTemplate *templ,
- const gchar *unused);
-static void gst_system_encode_chain (GstPad *pad, GstData *_data);
-
-static void gst_system_encode_set_property (GObject *object, guint prop_id,
- const GValue *value, GParamSpec *pspec);
-static void gst_system_encode_get_property (GObject *object, guint prop_id,
- GValue *value, GParamSpec *pspec);
+GST_STATIC_PAD_TEMPLATE ("audio_%d",
+ GST_PAD_SINK,
+ GST_PAD_REQUEST,
+ GST_STATIC_CAPS ("audio/mpeg, "
+ "mpegversion = (int) 1, " "layer = (int) [ 1, 2 ] ")
+ );
+
+static void gst_system_encode_class_init (GstMPEG1SystemEncodeClass * klass);
+static void gst_system_encode_base_init (GstMPEG1SystemEncodeClass * klass);
+static void gst_system_encode_init (GstMPEG1SystemEncode * system_encode);
+
+static GstPad *gst_system_encode_request_new_pad (GstElement * element,
+ GstPadTemplate * templ, const gchar * unused);
+static void gst_system_encode_chain (GstPad * pad, GstData * _data);
+
+static void gst_system_encode_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec);
+static void gst_system_encode_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec);
static GstElementClass *parent_class = NULL;
+
/*static guint gst_system_encode_signals[LAST_SIGNAL] = { 0 }; */
GType
@@ -101,46 +96,48 @@ gst_mpeg1_system_encode_get_type (void)
if (!system_encode_type) {
static const GTypeInfo system_encode_info = {
- sizeof(GstMPEG1SystemEncodeClass),
- (GBaseInitFunc)gst_system_encode_base_init,
+ sizeof (GstMPEG1SystemEncodeClass),
+ (GBaseInitFunc) gst_system_encode_base_init,
NULL,
- (GClassInitFunc)gst_system_encode_class_init,
+ (GClassInitFunc) gst_system_encode_class_init,
NULL,
NULL,
- sizeof(GstMPEG1SystemEncode),
+ sizeof (GstMPEG1SystemEncode),
0,
- (GInstanceInitFunc)gst_system_encode_init,
+ (GInstanceInitFunc) gst_system_encode_init,
NULL
};
- system_encode_type = g_type_register_static(GST_TYPE_ELEMENT, "GstMPEG1SystemEncode", &system_encode_info, 0);
+ system_encode_type =
+ g_type_register_static (GST_TYPE_ELEMENT, "GstMPEG1SystemEncode",
+ &system_encode_info, 0);
}
return system_encode_type;
}
static void
-gst_system_encode_base_init (GstMPEG1SystemEncodeClass *klass)
+gst_system_encode_base_init (GstMPEG1SystemEncodeClass * klass)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&src_factory));
+ gst_static_pad_template_get (&src_factory));
gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&audio_sink_factory));
+ gst_static_pad_template_get (&audio_sink_factory));
gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&video_sink_factory));
+ gst_static_pad_template_get (&video_sink_factory));
gst_element_class_set_details (element_class, &system_encode_details);
}
static void
-gst_system_encode_class_init (GstMPEG1SystemEncodeClass *klass)
+gst_system_encode_class_init (GstMPEG1SystemEncodeClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
- gobject_class = (GObjectClass*)klass;
- gstelement_class = (GstElementClass*)klass;
+ gobject_class = (GObjectClass *) klass;
+ gstelement_class = (GstElementClass *) klass;
- parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
+ parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
gobject_class->set_property = gst_system_encode_set_property;
gobject_class->get_property = gst_system_encode_get_property;
@@ -149,10 +146,11 @@ gst_system_encode_class_init (GstMPEG1SystemEncodeClass *klass)
}
static void
-gst_system_encode_init (GstMPEG1SystemEncode *system_encode)
+gst_system_encode_init (GstMPEG1SystemEncode * system_encode)
{
- system_encode->srcpad = gst_pad_new_from_template (
- gst_static_pad_template_get (&src_factory), "src");
+ system_encode->srcpad =
+ gst_pad_new_from_template (gst_static_pad_template_get (&src_factory),
+ "src");
gst_element_add_pad (GST_ELEMENT (system_encode), system_encode->srcpad);
system_encode->video_buffer = mpeg1mux_buffer_new (BUFFER_TYPE_VIDEO, 0xE0);
@@ -160,7 +158,7 @@ gst_system_encode_init (GstMPEG1SystemEncode *system_encode)
system_encode->have_setup = FALSE;
system_encode->mta = NULL;
system_encode->packet_size = 2048;
- system_encode->lock = g_mutex_new();
+ system_encode->lock = g_mutex_new ();
system_encode->current_pack = system_encode->packets_per_pack = 3;
system_encode->video_delay_ms = 0;
system_encode->audio_delay_ms = 0;
@@ -175,8 +173,9 @@ gst_system_encode_init (GstMPEG1SystemEncode *system_encode)
}
-static GstPad*
-gst_system_encode_request_new_pad (GstElement *element, GstPadTemplate *templ, const gchar *unused)
+static GstPad *
+gst_system_encode_request_new_pad (GstElement * element, GstPadTemplate * templ,
+ const gchar * unused)
{
GstMPEG1SystemEncode *system_encode;
gchar *name = NULL;
@@ -194,23 +193,23 @@ gst_system_encode_request_new_pad (GstElement *element, GstPadTemplate *templ, c
name = g_strdup_printf ("audio_%02d", system_encode->num_audio_pads);
g_print ("%s\n", name);
newpad = gst_pad_new_from_template (templ, name);
- gst_pad_set_element_private (newpad, GINT_TO_POINTER (system_encode->num_audio_pads));
+ gst_pad_set_element_private (newpad,
+ GINT_TO_POINTER (system_encode->num_audio_pads));
system_encode->audio_pad[system_encode->num_audio_pads] = newpad;
system_encode->num_audio_pads++;
system_encode->which_streams |= STREAMS_AUDIO;
- }
- else if (templ == gst_static_pad_template_get (&video_sink_factory)) {
+ } else if (templ == gst_static_pad_template_get (&video_sink_factory)) {
name = g_strdup_printf ("video_%02d", system_encode->num_video_pads);
g_print ("%s\n", name);
newpad = gst_pad_new_from_template (templ, name);
- gst_pad_set_element_private (newpad, GINT_TO_POINTER (system_encode->num_video_pads));
+ gst_pad_set_element_private (newpad,
+ GINT_TO_POINTER (system_encode->num_video_pads));
system_encode->video_pad[system_encode->num_video_pads] = newpad;
system_encode->num_video_pads++;
system_encode->which_streams |= STREAMS_VIDEO;
- }
- else {
+ } else {
g_warning ("system_encode: this is not our template!\n");
return NULL;
}
@@ -222,59 +221,67 @@ gst_system_encode_request_new_pad (GstElement *element, GstPadTemplate *templ, c
}
/* return a list of all the highest prioripty streams */
-static GList*
-gst_system_encode_pick_streams (GList *mta, GstMPEG1SystemEncode *system_encode)
+static GList *
+gst_system_encode_pick_streams (GList * mta,
+ GstMPEG1SystemEncode * system_encode)
{
guint64 lowest = ~1;
- GST_DEBUG ("pick_streams: %" G_GINT64_FORMAT ", %" G_GINT64_FORMAT, system_encode->video_buffer->next_frame_time,
- system_encode->audio_buffer->next_frame_time);
+ GST_DEBUG ("pick_streams: %" G_GINT64_FORMAT ", %" G_GINT64_FORMAT,
+ system_encode->video_buffer->next_frame_time,
+ system_encode->audio_buffer->next_frame_time);
if (system_encode->which_streams & STREAMS_VIDEO) {
- if (system_encode->video_buffer->next_frame_time < lowest-system_encode->video_delay) {
+ if (system_encode->video_buffer->next_frame_time <
+ lowest - system_encode->video_delay) {
lowest = system_encode->video_buffer->next_frame_time;
}
}
if (system_encode->which_streams & STREAMS_AUDIO) {
- if (system_encode->audio_buffer->next_frame_time < lowest-system_encode->audio_delay) {
+ if (system_encode->audio_buffer->next_frame_time <
+ lowest - system_encode->audio_delay) {
lowest = system_encode->audio_buffer->next_frame_time;
}
}
if (system_encode->which_streams & STREAMS_VIDEO) {
if (system_encode->video_buffer->next_frame_time == lowest) {
- mta = g_list_append(mta, system_encode->video_buffer);
+ mta = g_list_append (mta, system_encode->video_buffer);
}
}
if (system_encode->which_streams & STREAMS_AUDIO) {
if (system_encode->audio_buffer->next_frame_time == lowest) {
- mta = g_list_append(mta, system_encode->audio_buffer);
+ mta = g_list_append (mta, system_encode->audio_buffer);
}
}
return mta;
}
static gboolean
-gst_system_encode_have_data (GstMPEG1SystemEncode *system_encode)
+gst_system_encode_have_data (GstMPEG1SystemEncode * system_encode)
{
if (system_encode->which_streams == (STREAMS_VIDEO | STREAMS_AUDIO)) {
- if (MPEG1MUX_BUFFER_QUEUED(system_encode->audio_buffer) > 2 &&
- MPEG1MUX_BUFFER_SPACE(system_encode->audio_buffer) > system_encode->packet_size*2 &&
- MPEG1MUX_BUFFER_QUEUED(system_encode->video_buffer) > 2 &&
- MPEG1MUX_BUFFER_SPACE(system_encode->video_buffer) > system_encode->packet_size*2) {
+ if (MPEG1MUX_BUFFER_QUEUED (system_encode->audio_buffer) > 2 &&
+ MPEG1MUX_BUFFER_SPACE (system_encode->audio_buffer) >
+ system_encode->packet_size * 2
+ && MPEG1MUX_BUFFER_QUEUED (system_encode->video_buffer) > 2
+ && MPEG1MUX_BUFFER_SPACE (system_encode->video_buffer) >
+ system_encode->packet_size * 2) {
return TRUE;
}
}
if (system_encode->which_streams == STREAMS_VIDEO) {
- if (MPEG1MUX_BUFFER_QUEUED(system_encode->video_buffer) > 2 &&
- MPEG1MUX_BUFFER_SPACE(system_encode->video_buffer) > system_encode->packet_size*2) {
+ if (MPEG1MUX_BUFFER_QUEUED (system_encode->video_buffer) > 2 &&
+ MPEG1MUX_BUFFER_SPACE (system_encode->video_buffer) >
+ system_encode->packet_size * 2) {
return TRUE;
}
}
if (system_encode->which_streams == STREAMS_VIDEO) {
- if (MPEG1MUX_BUFFER_QUEUED(system_encode->audio_buffer) > 2 &&
- MPEG1MUX_BUFFER_SPACE(system_encode->audio_buffer) > system_encode->packet_size*2) {
+ if (MPEG1MUX_BUFFER_QUEUED (system_encode->audio_buffer) > 2 &&
+ MPEG1MUX_BUFFER_SPACE (system_encode->audio_buffer) >
+ system_encode->packet_size * 2) {
return TRUE;
}
}
@@ -282,67 +289,85 @@ gst_system_encode_have_data (GstMPEG1SystemEncode *system_encode)
return FALSE;
}
-static GList*
-gst_system_encode_update_mta (GstMPEG1SystemEncode *system_encode, GList *mta, gulong size)
+static GList *
+gst_system_encode_update_mta (GstMPEG1SystemEncode * system_encode, GList * mta,
+ gulong size)
{
- GList *streams = g_list_first(mta);
- Mpeg1MuxBuffer *mb = (Mpeg1MuxBuffer *)streams->data;
+ GList *streams = g_list_first (mta);
+ Mpeg1MuxBuffer *mb = (Mpeg1MuxBuffer *) streams->data;
GST_DEBUG ("system_encode::multiplex: update mta");
- mpeg1mux_buffer_shrink(mb, size);
+ mpeg1mux_buffer_shrink (mb, size);
- mta = g_list_remove(mta, mb);
+ mta = g_list_remove (mta, mb);
return mta;
}
static void
-gst_system_setup_multiplex (GstMPEG1SystemEncode *system_encode)
+gst_system_setup_multiplex (GstMPEG1SystemEncode * system_encode)
{
Mpeg1MuxTimecode *video_tc, *audio_tc;
- system_encode->audio_buffer_size = 4*1024;
- system_encode->video_buffer_size = 46*1024;
+ system_encode->audio_buffer_size = 4 * 1024;
+ system_encode->video_buffer_size = 46 * 1024;
system_encode->bytes_output = 0;
- system_encode->min_packet_data = system_encode->packet_size - PACK_HEADER_SIZE - SYS_HEADER_SIZE -
- PACKET_HEADER_SIZE - AFTER_PACKET_LENGTH;
- system_encode->max_packet_data = system_encode->packet_size - PACKET_HEADER_SIZE - AFTER_PACKET_LENGTH;
+ system_encode->min_packet_data =
+ system_encode->packet_size - PACK_HEADER_SIZE - SYS_HEADER_SIZE -
+ PACKET_HEADER_SIZE - AFTER_PACKET_LENGTH;
+ system_encode->max_packet_data =
+ system_encode->packet_size - PACKET_HEADER_SIZE - AFTER_PACKET_LENGTH;
if (system_encode->which_streams & STREAMS_VIDEO) {
- system_encode->video_rate = system_encode->video_buffer->info.video.bit_rate * 50;
- }
- else system_encode->video_rate = 0;
+ system_encode->video_rate =
+ system_encode->video_buffer->info.video.bit_rate * 50;
+ } else
+ system_encode->video_rate = 0;
if (system_encode->which_streams & STREAMS_AUDIO)
- system_encode->audio_rate = system_encode->audio_buffer->info.audio.bit_rate * 128;
- else system_encode->audio_rate = 0;
-
- system_encode->data_rate = system_encode->video_rate + system_encode->audio_rate;
-
- system_encode->dmux_rate = ceil((double)(system_encode->data_rate) *
- ((double)(system_encode->packet_size)/(double)(system_encode->min_packet_data) +
- ((double)(system_encode->packet_size)/(double)(system_encode->max_packet_data) *
- (double)(system_encode->packets_per_pack-1.))) / (double)(system_encode->packets_per_pack) );
- system_encode->data_rate = ceil(system_encode->dmux_rate/50.)*50;
-
- GST_DEBUG ("system_encode::multiplex: data_rate %u, video_rate: %u, audio_rate: %u", system_encode->data_rate,
- system_encode->video_rate, system_encode->audio_rate);
-
- system_encode->video_delay = (double)system_encode->video_delay_ms*(double)(CLOCKS/1000);
- system_encode->audio_delay = (double)system_encode->audio_delay_ms*(double)(CLOCKS/1000);
-
- system_encode->mux_rate = ceil(system_encode->dmux_rate/50.);
- system_encode->dmux_rate= system_encode->mux_rate * 50.;
-
- video_tc = MPEG1MUX_BUFFER_FIRST_TIMECODE(system_encode->video_buffer);
- audio_tc = MPEG1MUX_BUFFER_FIRST_TIMECODE(system_encode->audio_buffer);
-
- GST_DEBUG ("system_encode::video tc %" G_GINT64_FORMAT ", audio tc %" G_GINT64_FORMAT ":", video_tc->DTS, audio_tc->DTS);
-
- system_encode->delay = ((double)system_encode->sectors_delay +
- ceil((double)video_tc->length/(double)system_encode->min_packet_data) +
- ceil((double)video_tc->length/(double)system_encode->min_packet_data )) *
- (double)system_encode->packet_size/system_encode->dmux_rate*(double)CLOCKS;
+ system_encode->audio_rate =
+ system_encode->audio_buffer->info.audio.bit_rate * 128;
+ else
+ system_encode->audio_rate = 0;
+
+ system_encode->data_rate =
+ system_encode->video_rate + system_encode->audio_rate;
+
+ system_encode->dmux_rate = ceil ((double) (system_encode->data_rate) *
+ ((double) (system_encode->packet_size) /
+ (double) (system_encode->min_packet_data) +
+ ((double) (system_encode->packet_size) /
+ (double) (system_encode->max_packet_data) *
+ (double) (system_encode->packets_per_pack -
+ 1.))) / (double) (system_encode->packets_per_pack));
+ system_encode->data_rate = ceil (system_encode->dmux_rate / 50.) * 50;
+
+ GST_DEBUG
+ ("system_encode::multiplex: data_rate %u, video_rate: %u, audio_rate: %u",
+ system_encode->data_rate, system_encode->video_rate,
+ system_encode->audio_rate);
+
+ system_encode->video_delay =
+ (double) system_encode->video_delay_ms * (double) (CLOCKS / 1000);
+ system_encode->audio_delay =
+ (double) system_encode->audio_delay_ms * (double) (CLOCKS / 1000);
+
+ system_encode->mux_rate = ceil (system_encode->dmux_rate / 50.);
+ system_encode->dmux_rate = system_encode->mux_rate * 50.;
+
+ video_tc = MPEG1MUX_BUFFER_FIRST_TIMECODE (system_encode->video_buffer);
+ audio_tc = MPEG1MUX_BUFFER_FIRST_TIMECODE (system_encode->audio_buffer);
+
+ GST_DEBUG ("system_encode::video tc %" G_GINT64_FORMAT ", audio tc %"
+ G_GINT64_FORMAT ":", video_tc->DTS, audio_tc->DTS);
+
+ system_encode->delay = ((double) system_encode->sectors_delay +
+ ceil ((double) video_tc->length /
+ (double) system_encode->min_packet_data) +
+ ceil ((double) video_tc->length /
+ (double) system_encode->min_packet_data)) *
+ (double) system_encode->packet_size / system_encode->dmux_rate *
+ (double) CLOCKS;
system_encode->audio_delay += system_encode->delay;
system_encode->video_delay += system_encode->delay;
@@ -351,134 +376,142 @@ gst_system_setup_multiplex (GstMPEG1SystemEncode *system_encode)
system_encode->video_delay = 0;
system_encode->delay = 0;
- GST_DEBUG ("system_encode::multiplex: delay %g, mux_rate: %lu", system_encode->delay, system_encode->mux_rate);
+ GST_DEBUG ("system_encode::multiplex: delay %g, mux_rate: %lu",
+ system_encode->delay, system_encode->mux_rate);
}
static void
-gst_system_encode_multiplex(GstMPEG1SystemEncode *system_encode)
+gst_system_encode_multiplex (GstMPEG1SystemEncode * system_encode)
{
GList *streams;
- Mpeg1MuxBuffer *mb = (Mpeg1MuxBuffer *)streams->data;
+ Mpeg1MuxBuffer *mb = (Mpeg1MuxBuffer *) streams->data;
guchar timestamps;
guchar buffer_scale;
GstBuffer *outbuf;
- Pack_struc *pack;
- Sys_header_struc *sys_header;
+ Pack_struc *pack;
+ Sys_header_struc *sys_header;
Mpeg1MuxTimecode *tc;
gulong buffer_size, non_scaled_buffer_size, total_queued;
guint64 PTS, DTS;
- g_mutex_lock(system_encode->lock);
+ g_mutex_lock (system_encode->lock);
- while (gst_system_encode_have_data(system_encode)) {
+ while (gst_system_encode_have_data (system_encode)) {
GST_DEBUG ("system_encode::multiplex: multiplexing");
if (!system_encode->have_setup) {
- gst_system_setup_multiplex(system_encode);
+ gst_system_setup_multiplex (system_encode);
system_encode->have_setup = TRUE;
}
if (system_encode->mta == NULL) {
- system_encode->mta = gst_system_encode_pick_streams(system_encode->mta, system_encode);
+ system_encode->mta =
+ gst_system_encode_pick_streams (system_encode->mta, system_encode);
}
- if (system_encode->mta == NULL) break;
+ if (system_encode->mta == NULL)
+ break;
- system_encode->SCR = (guint64)(system_encode->bytes_output+LAST_SCR_BYTE_IN_PACK)*CLOCKS/system_encode->dmux_rate;
+ system_encode->SCR =
+ (guint64) (system_encode->bytes_output +
+ LAST_SCR_BYTE_IN_PACK) * CLOCKS / system_encode->dmux_rate;
- streams = g_list_first(system_encode->mta);
- mb = (Mpeg1MuxBuffer *)streams->data;
+ streams = g_list_first (system_encode->mta);
+ mb = (Mpeg1MuxBuffer *) streams->data;
if (system_encode->current_pack == system_encode->packets_per_pack) {
- create_pack(system_encode->pack, system_encode->SCR, system_encode->mux_rate);
- create_sys_header (system_encode->sys_header, system_encode->mux_rate, 1, 1, 1, 1, 1, 1,
- AUDIO_STR_0, 0, system_encode->audio_buffer_size/128,
- VIDEO_STR_0, 1, system_encode->video_buffer_size/1024, system_encode->which_streams );
+ create_pack (system_encode->pack, system_encode->SCR,
+ system_encode->mux_rate);
+ create_sys_header (system_encode->sys_header, system_encode->mux_rate, 1,
+ 1, 1, 1, 1, 1, AUDIO_STR_0, 0, system_encode->audio_buffer_size / 128,
+ VIDEO_STR_0, 1, system_encode->video_buffer_size / 1024,
+ system_encode->which_streams);
system_encode->current_pack = 0;
pack = system_encode->pack;
sys_header = system_encode->sys_header;
- }
- else {
+ } else {
system_encode->current_pack++;
pack = NULL;
sys_header = NULL;
}
- tc = MPEG1MUX_BUFFER_FIRST_TIMECODE(mb);
+ tc = MPEG1MUX_BUFFER_FIRST_TIMECODE (mb);
if (mb->new_frame) {
GST_DEBUG ("system_encode::multiplex: new frame");
- if (tc->frame_type == FRAME_TYPE_AUDIO || tc->frame_type == FRAME_TYPE_IFRAME || tc->frame_type == FRAME_TYPE_PFRAME) {
- timestamps = TIMESTAMPS_PTS;
- }
- else {
- timestamps = TIMESTAMPS_PTS_DTS;
+ if (tc->frame_type == FRAME_TYPE_AUDIO
+ || tc->frame_type == FRAME_TYPE_IFRAME
+ || tc->frame_type == FRAME_TYPE_PFRAME) {
+ timestamps = TIMESTAMPS_PTS;
+ } else {
+ timestamps = TIMESTAMPS_PTS_DTS;
}
- }
- else {
+ } else {
timestamps = TIMESTAMPS_NO;
}
if (tc->frame_type != FRAME_TYPE_AUDIO) {
- if (tc->PTS<system_encode->startup_delay)
+ if (tc->PTS < system_encode->startup_delay)
system_encode->startup_delay = tc->PTS;
}
if (tc->frame_type == FRAME_TYPE_AUDIO) {
buffer_scale = 0;
non_scaled_buffer_size = system_encode->audio_buffer_size;
- buffer_size = system_encode->audio_buffer_size/128;
+ buffer_size = system_encode->audio_buffer_size / 128;
PTS = tc->PTS + system_encode->audio_delay + system_encode->startup_delay;
DTS = tc->PTS + system_encode->audio_delay + system_encode->startup_delay;
- }
- else {
+ } else {
buffer_scale = 1;
non_scaled_buffer_size = system_encode->video_buffer_size;
- buffer_size = system_encode->video_buffer_size/1024;
+ buffer_size = system_encode->video_buffer_size / 1024;
PTS = tc->PTS + system_encode->video_delay;
DTS = tc->DTS + system_encode->video_delay;
}
- total_queued = mpeg1mux_buffer_update_queued(mb, system_encode->SCR);
+ total_queued = mpeg1mux_buffer_update_queued (mb, system_encode->SCR);
if (non_scaled_buffer_size - total_queued >= system_encode->packet_size) {
/* write the pack/packet here */
create_sector (system_encode->sector, pack, sys_header,
- system_encode->packet_size,
- MPEG1MUX_BUFFER_DATA(mb), mb->stream_id, buffer_scale,
- buffer_size, TRUE, PTS, DTS,
- timestamps, system_encode->which_streams);
- /* update mta */
- system_encode->mta = gst_system_encode_update_mta(system_encode, system_encode->mta,
- system_encode->sector->length_of_packet_data);
- }
- else {
+ system_encode->packet_size,
+ MPEG1MUX_BUFFER_DATA (mb), mb->stream_id, buffer_scale,
+ buffer_size, TRUE, PTS, DTS,
+ timestamps, system_encode->which_streams);
+ /* update mta */
+ system_encode->mta =
+ gst_system_encode_update_mta (system_encode, system_encode->mta,
+ system_encode->sector->length_of_packet_data);
+ } else {
/* write a padding packet */
create_sector (system_encode->sector, pack, sys_header,
- system_encode->packet_size, NULL, PADDING_STR, 0,
- 0, FALSE, 0, 0,
- TIMESTAMPS_NO, system_encode->which_streams);
+ system_encode->packet_size, NULL, PADDING_STR, 0,
+ 0, FALSE, 0, 0, TIMESTAMPS_NO, system_encode->which_streams);
}
- outbuf = gst_buffer_new();
- GST_BUFFER_DATA(outbuf) = g_malloc(system_encode->sector->length_of_sector);
- GST_BUFFER_SIZE(outbuf) = system_encode->sector->length_of_sector;
- memcpy(GST_BUFFER_DATA(outbuf),system_encode->sector->buf, system_encode->sector->length_of_sector);
- system_encode->bytes_output += GST_BUFFER_SIZE(outbuf);
- gst_pad_push(system_encode->srcpad,GST_DATA (outbuf));
+ outbuf = gst_buffer_new ();
+ GST_BUFFER_DATA (outbuf) =
+ g_malloc (system_encode->sector->length_of_sector);
+ GST_BUFFER_SIZE (outbuf) = system_encode->sector->length_of_sector;
+ memcpy (GST_BUFFER_DATA (outbuf), system_encode->sector->buf,
+ system_encode->sector->length_of_sector);
+ system_encode->bytes_output += GST_BUFFER_SIZE (outbuf);
+ gst_pad_push (system_encode->srcpad, GST_DATA (outbuf));
GST_DEBUG ("system_encode::multiplex: writing %02x", mb->stream_id);
}
- gst_info("system_encode::multiplex: data left in video buffer %lu\n", MPEG1MUX_BUFFER_SPACE(system_encode->video_buffer));
- gst_info("system_encode::multiplex: data left in audio buffer %lu\n", MPEG1MUX_BUFFER_SPACE(system_encode->audio_buffer));
+ gst_info ("system_encode::multiplex: data left in video buffer %lu\n",
+ MPEG1MUX_BUFFER_SPACE (system_encode->video_buffer));
+ gst_info ("system_encode::multiplex: data left in audio buffer %lu\n",
+ MPEG1MUX_BUFFER_SPACE (system_encode->audio_buffer));
- g_mutex_unlock(system_encode->lock);
+ g_mutex_unlock (system_encode->lock);
}
static void
-gst_system_encode_chain (GstPad *pad, GstData *_data)
+gst_system_encode_chain (GstPad * pad, GstData * _data)
{
GstBuffer *buf = GST_BUFFER (_data);
GstMPEG1SystemEncode *system_encode;
@@ -487,46 +520,50 @@ gst_system_encode_chain (GstPad *pad, GstData *_data)
const gchar *padname;
gint channel;
- g_return_if_fail(pad != NULL);
- g_return_if_fail(GST_IS_PAD(pad));
- g_return_if_fail(buf != NULL);
+ g_return_if_fail (pad != NULL);
+ g_return_if_fail (GST_IS_PAD (pad));
+ g_return_if_fail (buf != NULL);
system_encode = GST_SYSTEM_ENCODE (GST_OBJECT_PARENT (pad));
- data = GST_BUFFER_DATA(buf);
- size = GST_BUFFER_SIZE(buf);
+ data = GST_BUFFER_DATA (buf);
+ size = GST_BUFFER_SIZE (buf);
- GST_DEBUG ("system_encode::chain: system_encode: have buffer of size %lu",size);
+ GST_DEBUG ("system_encode::chain: system_encode: have buffer of size %lu",
+ size);
padname = GST_OBJECT_NAME (pad);
- if (strncmp(padname, "audio_", 6) == 0) {
- channel = atoi(&padname[6]);
- GST_DEBUG ("gst_system_encode_chain: got audio buffer in from audio channel %02d", channel);
+ if (strncmp (padname, "audio_", 6) == 0) {
+ channel = atoi (&padname[6]);
+ GST_DEBUG
+ ("gst_system_encode_chain: got audio buffer in from audio channel %02d",
+ channel);
- mpeg1mux_buffer_queue(system_encode->audio_buffer, buf);
- }
- else if (strncmp(padname, "video_", 6) == 0) {
- channel = atoi(&padname[6]);
- GST_DEBUG ("gst_system_encode_chain: got video buffer in from video channel %02d", channel);
+ mpeg1mux_buffer_queue (system_encode->audio_buffer, buf);
+ } else if (strncmp (padname, "video_", 6) == 0) {
+ channel = atoi (&padname[6]);
+ GST_DEBUG
+ ("gst_system_encode_chain: got video buffer in from video channel %02d",
+ channel);
- mpeg1mux_buffer_queue(system_encode->video_buffer, buf);
+ mpeg1mux_buffer_queue (system_encode->video_buffer, buf);
+ } else {
+ g_assert_not_reached ();
}
- else {
- g_assert_not_reached ();
- }
- gst_system_encode_multiplex(system_encode);
+ gst_system_encode_multiplex (system_encode);
- gst_buffer_unref(buf);
+ gst_buffer_unref (buf);
}
static void
-gst_system_encode_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
+gst_system_encode_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec)
{
GstMPEG1SystemEncode *system_encode;
/* it's not null if we got it, but it might not be ours */
- g_return_if_fail(GST_IS_SYSTEM_ENCODE(object));
- system_encode = GST_SYSTEM_ENCODE(object);
+ g_return_if_fail (GST_IS_SYSTEM_ENCODE (object));
+ system_encode = GST_SYSTEM_ENCODE (object);
switch (prop_id) {
default:
@@ -536,13 +573,14 @@ gst_system_encode_set_property (GObject *object, guint prop_id, const GValue *va
}
static void
-gst_system_encode_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+gst_system_encode_get_property (GObject * object, guint prop_id, GValue * value,
+ GParamSpec * pspec)
{
GstMPEG1SystemEncode *src;
/* it's not null if we got it, but it might not be ours */
- g_return_if_fail(GST_IS_SYSTEM_ENCODE(object));
- src = GST_SYSTEM_ENCODE(object);
+ g_return_if_fail (GST_IS_SYSTEM_ENCODE (object));
+ src = GST_SYSTEM_ENCODE (object);
switch (prop_id) {
default:
@@ -552,24 +590,18 @@ gst_system_encode_get_property (GObject *object, guint prop_id, GValue *value, G
}
static gboolean
-plugin_init (GstPlugin *plugin)
+plugin_init (GstPlugin * plugin)
{
/* this filter needs the getbits functions */
if (!gst_library_load ("gstgetbits"))
return FALSE;
return gst_element_register (plugin, "system_encode",
- GST_RANK_NONE, GST_TYPE_SYSTEM_ENCODE);
+ GST_RANK_NONE, GST_TYPE_SYSTEM_ENCODE);
}
-GST_PLUGIN_DEFINE (
- GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "system_encode",
- "MPEG-1 system stream encoder",
- plugin_init,
- VERSION,
- "GPL",
- GST_PACKAGE,
- GST_ORIGIN
-)
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ "system_encode",
+ "MPEG-1 system stream encoder",
+ plugin_init, VERSION, "GPL", GST_PACKAGE, GST_ORIGIN)
diff --git a/gst/mpeg1sys/gstmpeg1systemencode.h b/gst/mpeg1sys/gstmpeg1systemencode.h
index 44555332f..0580cedc9 100644
--- a/gst/mpeg1sys/gstmpeg1systemencode.h
+++ b/gst/mpeg1sys/gstmpeg1systemencode.h
@@ -29,8 +29,9 @@
#include "main.h"
#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
+extern "C"
+{
+#endif /* __cplusplus */
#define GST_TYPE_SYSTEM_ENCODE \
@@ -44,66 +45,68 @@ extern "C" {
#define GST_IS_SYSTEM_ENCODE_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SYSTEM_ENCODE))
-typedef struct _GstMPEG1SystemEncode GstMPEG1SystemEncode;
-typedef struct _GstMPEG1SystemEncodeClass GstMPEG1SystemEncodeClass;
+ typedef struct _GstMPEG1SystemEncode GstMPEG1SystemEncode;
+ typedef struct _GstMPEG1SystemEncodeClass GstMPEG1SystemEncodeClass;
-struct _GstMPEG1SystemEncode {
- GstElement element;
+ struct _GstMPEG1SystemEncode
+ {
+ GstElement element;
- GstPad *srcpad;
+ GstPad *srcpad;
- gboolean have_setup;
+ gboolean have_setup;
- GMutex *lock;
+ GMutex *lock;
- guint num_audio_pads;
- guint num_video_pads;
+ guint num_audio_pads;
+ guint num_video_pads;
- Mpeg1MuxBuffer *audio_buffer;
- Mpeg1MuxBuffer *video_buffer;
+ Mpeg1MuxBuffer *audio_buffer;
+ Mpeg1MuxBuffer *video_buffer;
- Pack_struc *pack;
- Sys_header_struc *sys_header;
- Sector_struc *sector;
+ Pack_struc *pack;
+ Sys_header_struc *sys_header;
+ Sector_struc *sector;
- guint data_rate, video_rate, audio_rate;
- gdouble delay, audio_delay, video_delay;
- gdouble clock_cycles;
- gulong sectors_delay, video_delay_ms, audio_delay_ms;
- gulong startup_delay;
- gulong audio_buffer_size;
- gulong video_buffer_size;
- gulong mux_rate, dmux_rate;
- guint64 SCR;
- gint which_streams;
+ guint data_rate, video_rate, audio_rate;
+ gdouble delay, audio_delay, video_delay;
+ gdouble clock_cycles;
+ gulong sectors_delay, video_delay_ms, audio_delay_ms;
+ gulong startup_delay;
+ gulong audio_buffer_size;
+ gulong video_buffer_size;
+ gulong mux_rate, dmux_rate;
+ guint64 SCR;
+ gint which_streams;
- gint current_pack;
- gulong min_packet_data;
- gulong max_packet_data;
- gint packets_per_pack;
- gulong packet_size;
- gulong bytes_output;
+ gint current_pack;
+ gulong min_packet_data;
+ gulong max_packet_data;
+ gint packets_per_pack;
+ gulong packet_size;
+ gulong bytes_output;
- GList *mta;
+ GList *mta;
- /* stream input pads */
- GstPad *private_1_pad[8]; /* up to 8 ac3 audio tracks <grumble> */
- GstPad *private_2_pad;
- GstPad *video_pad[16];
- GstPad *audio_pad[32];
-};
+ /* stream input pads */
+ GstPad *private_1_pad[8]; /* up to 8 ac3 audio tracks <grumble> */
+ GstPad *private_2_pad;
+ GstPad *video_pad[16];
+ GstPad *audio_pad[32];
+ };
-struct _GstMPEG1SystemEncodeClass {
- GstElementClass parent_class;
-};
+ struct _GstMPEG1SystemEncodeClass
+ {
+ GstElementClass parent_class;
+ };
-GType gst_mpeg1_system_encode_get_type(void);
+ GType gst_mpeg1_system_encode_get_type (void);
/* multplex.c */
#ifdef __cplusplus
}
-#endif /* __cplusplus */
+#endif /* __cplusplus */
-#endif /* __SYSTEM_ENCODE_H__ */
+#endif /* __SYSTEM_ENCODE_H__ */
diff --git a/gst/mpeg1sys/main.h b/gst/mpeg1sys/main.h
index 434f57f5d..c09fc41b4 100644
--- a/gst/mpeg1sys/main.h
+++ b/gst/mpeg1sys/main.h
@@ -45,79 +45,82 @@
#define ISO11172_END 0x000001b9
#define PACKET_START 0x000001
-#define CLOCKS 90000.0 /* System Clock Hertz */
+#define CLOCKS 90000.0 /* System Clock Hertz */
-#define AFTER_PACKET_LENGTH 15 /* No of non-data-bytes */
- /* following the packet */
- /* length field */
-#define LAST_SCR_BYTE_IN_PACK 9 /* No of bytes in pack */
- /* preceding, and */
- /* including, the SCR */
+#define AFTER_PACKET_LENGTH 15 /* No of non-data-bytes */
+ /* following the packet */
+ /* length field */
+#define LAST_SCR_BYTE_IN_PACK 9 /* No of bytes in pack */
+ /* preceding, and */
+ /* including, the SCR */
/* The following values for sys_header_length & size are only valid for */
/* System streams consisting of two basic streams. When wrapping around */
/* the system layer on a single video or a single audio stream, those */
/* values get decreased by 3. */
-#define SYS_HEADER_LENGTH 12 /* length of Sys Header */
- /* after start code and */
- /* length field */
+#define SYS_HEADER_LENGTH 12 /* length of Sys Header */
+ /* after start code and */
+ /* length field */
-#define SYS_HEADER_SIZE 18 /* incl. start code and */
- /* length field */
+#define SYS_HEADER_SIZE 18 /* incl. start code and */
+ /* length field */
#define PACK_HEADER_SIZE 12
#define PACKET_HEADER_SIZE 6
-#define MAX_SECTOR_SIZE 0x20000 /* Max Sektor Groesse */
+#define MAX_SECTOR_SIZE 0x20000 /* Max Sektor Groesse */
#define STREAMS_VIDEO 1
#define STREAMS_AUDIO 2
#define STREAMS_BOTH 3
-#define AUDIO_STREAMS 0xb8 /* Marker Audio Streams */
-#define VIDEO_STREAMS 0xb9 /* Marker Video Streams */
-#define AUDIO_STR_0 0xc0 /* Marker Audio Stream0 */
-#define VIDEO_STR_0 0xe0 /* Marker Video Stream0 */
-#define PADDING_STR 0xbe /* Marker Padding Stream*/
+#define AUDIO_STREAMS 0xb8 /* Marker Audio Streams */
+#define VIDEO_STREAMS 0xb9 /* Marker Video Streams */
+#define AUDIO_STR_0 0xc0 /* Marker Audio Stream0 */
+#define VIDEO_STR_0 0xe0 /* Marker Video Stream0 */
+#define PADDING_STR 0xbe /* Marker Padding Stream */
#define ZERO_STUFFING_BYTE 0
#define STUFFING_BYTE 0xff
#define RESERVED_BYTE 0xff
-#define TIMESTAMPS_NO 0 /* Flag NO timestamps */
-#define TIMESTAMPS_PTS 1 /* Flag PTS timestamp */
-#define TIMESTAMPS_PTS_DTS 2 /* Flag BOTH timestamps */
+#define TIMESTAMPS_NO 0 /* Flag NO timestamps */
+#define TIMESTAMPS_PTS 1 /* Flag PTS timestamp */
+#define TIMESTAMPS_PTS_DTS 2 /* Flag BOTH timestamps */
-#define MARKER_SCR 2 /* Marker SCR */
-#define MARKER_JUST_PTS 2 /* Marker only PTS */
-#define MARKER_PTS 3 /* Marker PTS */
-#define MARKER_DTS 1 /* Marker DTS */
-#define MARKER_NO_TIMESTAMPS 0x0f /* Marker NO timestamps */
+#define MARKER_SCR 2 /* Marker SCR */
+#define MARKER_JUST_PTS 2 /* Marker only PTS */
+#define MARKER_PTS 3 /* Marker PTS */
+#define MARKER_DTS 1 /* Marker DTS */
+#define MARKER_NO_TIMESTAMPS 0x0f /* Marker NO timestamps */
-#define STATUS_AUDIO_END 0 /* Statusmessage A end */
-#define STATUS_VIDEO_END 1 /* Statusmessage V end */
-#define STATUS_AUDIO_TIME_OUT 2 /* Statusmessage A out */
-#define STATUS_VIDEO_TIME_OUT 3 /* Statusmessage V out */
+#define STATUS_AUDIO_END 0 /* Statusmessage A end */
+#define STATUS_VIDEO_END 1 /* Statusmessage V end */
+#define STATUS_AUDIO_TIME_OUT 2 /* Statusmessage A out */
+#define STATUS_VIDEO_TIME_OUT 3 /* Statusmessage V out */
/*************************************************************************
Typ- und Strukturdefinitionen
*************************************************************************/
-typedef struct sector_struc /* A sector, can contain pack, sys header */
- /* and packet. */
-{ unsigned char buf [MAX_SECTOR_SIZE] ;
- unsigned int length_of_sector ;
- unsigned int length_of_packet_data ;
- guint64 TS ;
+typedef struct sector_struc /* A sector, can contain pack, sys header */
+ /* and packet. */
+{
+ unsigned char buf[MAX_SECTOR_SIZE];
+ unsigned int length_of_sector;
+ unsigned int length_of_packet_data;
+ guint64 TS;
} Sector_struc;
-typedef struct pack_struc /* Pack Info */
-{ unsigned char buf [PACK_HEADER_SIZE];
- guint64 SCR;
+typedef struct pack_struc /* Pack Info */
+{
+ unsigned char buf[PACK_HEADER_SIZE];
+ guint64 SCR;
} Pack_struc;
-typedef struct sys_header_struc /* System Header Info */
-{ unsigned char buf [SYS_HEADER_SIZE];
+typedef struct sys_header_struc /* System Header Info */
+{
+ unsigned char buf[SYS_HEADER_SIZE];
} Sys_header_struc;
/*************************************************************************
@@ -125,16 +128,20 @@ typedef struct sys_header_struc /* System Header Info */
*************************************************************************/
/* systems.c */
-void create_sector (Sector_struc *sector, Pack_struc *pack, Sys_header_struc *sys_header,
- unsigned int packet_size, unsigned char *inputbuffer, unsigned char type, unsigned char buffer_scale,
- unsigned int buffer_size, unsigned char buffers, guint64 PTS, guint64 DTS,
- unsigned char timestamps, unsigned int which_streams);
-
-void create_pack (Pack_struc *pack, guint64 SCR, unsigned int mux_rate);
-
-void create_sys_header (Sys_header_struc *sys_header, unsigned int rate_bound, unsigned char audio_bound,
- unsigned char fixed, unsigned char CSPS, unsigned char audio_lock, unsigned char video_lock,
- unsigned char video_bound, unsigned char stream1, unsigned char buffer1_scale, unsigned int buffer1_size,
- unsigned char stream2, unsigned char buffer2_scale, unsigned int buffer2_size, unsigned int which_streams);
+void create_sector (Sector_struc * sector, Pack_struc * pack,
+ Sys_header_struc * sys_header, unsigned int packet_size,
+ unsigned char *inputbuffer, unsigned char type, unsigned char buffer_scale,
+ unsigned int buffer_size, unsigned char buffers, guint64 PTS, guint64 DTS,
+ unsigned char timestamps, unsigned int which_streams);
+
+void create_pack (Pack_struc * pack, guint64 SCR, unsigned int mux_rate);
+
+void create_sys_header (Sys_header_struc * sys_header, unsigned int rate_bound,
+ unsigned char audio_bound, unsigned char fixed, unsigned char CSPS,
+ unsigned char audio_lock, unsigned char video_lock,
+ unsigned char video_bound, unsigned char stream1,
+ unsigned char buffer1_scale, unsigned int buffer1_size,
+ unsigned char stream2, unsigned char buffer2_scale,
+ unsigned int buffer2_size, unsigned int which_streams);
#endif
diff --git a/gst/mpeg1sys/systems.c b/gst/mpeg1sys/systems.c
index aa6de41ac..20e7bd901 100644
--- a/gst/mpeg1sys/systems.c
+++ b/gst/mpeg1sys/systems.c
@@ -6,25 +6,26 @@
#include "main.h"
-static void buffer_timecode (timecode, marker, buffer)
-guint64 timecode;
-unsigned char marker;
-unsigned char **buffer;
+static void
+buffer_timecode (timecode, marker, buffer)
+ guint64 timecode;
+ unsigned char marker;
+ unsigned char **buffer;
{
unsigned char temp;
- temp = (marker << 4) | ((timecode>>29) & 0x38) |
- ((timecode >> 29) & 0x6) | 1;
- *((*buffer)++)=temp;
+ temp = (marker << 4) | ((timecode >> 29) & 0x38) |
+ ((timecode >> 29) & 0x6) | 1;
+ *((*buffer)++) = temp;
temp = (timecode & 0x3fc00000) >> 22;
- *((*buffer)++)=temp;
+ *((*buffer)++) = temp;
temp = ((timecode & 0x003f8000) >> 14) | 1;
- *((*buffer)++)=temp;
+ *((*buffer)++) = temp;
temp = (timecode & 0x7f80) >> 7;
- *((*buffer)++)=temp;
+ *((*buffer)++) = temp;
temp = ((timecode & 0x007f) << 1) | 1;
- *((*buffer)++)=temp;
+ *((*buffer)++) = temp;
}
/*************************************************************************
@@ -35,152 +36,151 @@ unsigned char **buffer;
*************************************************************************/
-void create_sector (sector, pack, sys_header,
- packet_size, inputbuffer, type,
- buffer_scale, buffer_size, buffers,
- PTS, DTS, timestamps, which_streams )
+void
+create_sector (sector, pack, sys_header,
+ packet_size, inputbuffer, type,
+ buffer_scale, buffer_size, buffers, PTS, DTS, timestamps, which_streams)
-Sector_struc *sector;
-Pack_struc *pack;
-Sys_header_struc *sys_header;
-unsigned int packet_size;
-unsigned char *inputbuffer;
+ Sector_struc *sector;
+ Pack_struc *pack;
+ Sys_header_struc *sys_header;
+ unsigned int packet_size;
+ unsigned char *inputbuffer;
-unsigned char type;
-unsigned char buffer_scale;
-unsigned int buffer_size;
-unsigned char buffers;
-guint64 PTS;
-guint64 DTS;
-unsigned char timestamps;
-unsigned int which_streams;
+ unsigned char type;
+ unsigned char buffer_scale;
+ unsigned int buffer_size;
+ unsigned char buffers;
+ guint64 PTS;
+ guint64 DTS;
+ unsigned char timestamps;
+ unsigned int which_streams;
{
- int i,j,tmp;
- unsigned char *index;
- unsigned char *size_offset;
+ int i, j, tmp;
+ unsigned char *index;
+ unsigned char *size_offset;
- /* printf("creating sector\n"); */
+ /* printf("creating sector\n"); */
- index = sector->buf;
- sector->length_of_sector=0;
+ index = sector->buf;
+ sector->length_of_sector = 0;
/* Should we copy Pack Header information ? */
- if (pack != NULL)
- {
- i = sizeof(pack->buf);
- bcopy (pack->buf, index, i);
- index += i;
- sector->length_of_sector += i;
- }
+ if (pack != NULL) {
+ i = sizeof (pack->buf);
+ bcopy (pack->buf, index, i);
+ index += i;
+ sector->length_of_sector += i;
+ }
/* Should we copy System Header information ? */
- if (sys_header != NULL)
- {
- i = sizeof(sys_header->buf);
+ if (sys_header != NULL) {
+ i = sizeof (sys_header->buf);
- /* only one stream? 3 bytes less in sys header */
- if (which_streams != STREAMS_BOTH) i -= 3;
+ /* only one stream? 3 bytes less in sys header */
+ if (which_streams != STREAMS_BOTH)
+ i -= 3;
- bcopy (sys_header->buf, index, i);
- index += i;
- sector->length_of_sector += i;
- }
+ bcopy (sys_header->buf, index, i);
+ index += i;
+ sector->length_of_sector += i;
+ }
- /* write constant packet header data */
+ /* write constant packet header data */
- *(index++) = (unsigned char)(PACKET_START)>>16;
- *(index++) = (unsigned char)(PACKET_START & 0x00ffff)>>8;
- *(index++) = (unsigned char)(PACKET_START & 0x0000ff);
- *(index++) = type;
+ *(index++) = (unsigned char) (PACKET_START) >> 16;
+ *(index++) = (unsigned char) (PACKET_START & 0x00ffff) >> 8;
+ *(index++) = (unsigned char) (PACKET_START & 0x0000ff);
+ *(index++) = type;
- /* we remember this offset in case we will have to shrink this packet */
-
- size_offset = index;
- *(index++) = (unsigned char)((packet_size - PACKET_HEADER_SIZE)>>8);
- *(index++) = (unsigned char)((packet_size - PACKET_HEADER_SIZE)&0xff);
+ /* we remember this offset in case we will have to shrink this packet */
- *(index++) = STUFFING_BYTE;
- *(index++) = STUFFING_BYTE;
- *(index++) = STUFFING_BYTE;
+ size_offset = index;
+ *(index++) = (unsigned char) ((packet_size - PACKET_HEADER_SIZE) >> 8);
+ *(index++) = (unsigned char) ((packet_size - PACKET_HEADER_SIZE) & 0xff);
- i = 0;
+ *(index++) = STUFFING_BYTE;
+ *(index++) = STUFFING_BYTE;
+ *(index++) = STUFFING_BYTE;
- if (!buffers) i +=2;
- if (timestamps == TIMESTAMPS_NO) i+=9;
- else if (timestamps == TIMESTAMPS_PTS) i+=5;
+ i = 0;
- /* printf("%i stuffing %d\n", i, timestamps); */
-
- for (j=0; j<i; j++)
- *(index++) = STUFFING_BYTE;
+ if (!buffers)
+ i += 2;
+ if (timestamps == TIMESTAMPS_NO)
+ i += 9;
+ else if (timestamps == TIMESTAMPS_PTS)
+ i += 5;
- /* should we write buffer info ? */
+ /* printf("%i stuffing %d\n", i, timestamps); */
- if (buffers)
- {
- *(index++) = (unsigned char) (0x40 |
- (buffer_scale << 5) | (buffer_size >> 8));
- *(index++) = (unsigned char) (buffer_size & 0xff);
- }
+ for (j = 0; j < i; j++)
+ *(index++) = STUFFING_BYTE;
- /* should we write PTS, PTS & DTS or nothing at all ? */
-
- switch (timestamps)
- {
- case TIMESTAMPS_NO:
- *(index++) = MARKER_NO_TIMESTAMPS;
- break;
- case TIMESTAMPS_PTS:
- buffer_timecode (PTS, MARKER_JUST_PTS, &index);
- sector->TS = PTS;
- break;
- case TIMESTAMPS_PTS_DTS:
- buffer_timecode (PTS, MARKER_PTS, &index);
- buffer_timecode (DTS, MARKER_DTS, &index);
- sector->TS = DTS;
- break;
- }
+ /* should we write buffer info ? */
+
+ if (buffers) {
+ *(index++) = (unsigned char) (0x40 |
+ (buffer_scale << 5) | (buffer_size >> 8));
+ *(index++) = (unsigned char) (buffer_size & 0xff);
+ }
+
+ /* should we write PTS, PTS & DTS or nothing at all ? */
+
+ switch (timestamps) {
+ case TIMESTAMPS_NO:
+ *(index++) = MARKER_NO_TIMESTAMPS;
+ break;
+ case TIMESTAMPS_PTS:
+ buffer_timecode (PTS, MARKER_JUST_PTS, &index);
+ sector->TS = PTS;
+ break;
+ case TIMESTAMPS_PTS_DTS:
+ buffer_timecode (PTS, MARKER_PTS, &index);
+ buffer_timecode (DTS, MARKER_DTS, &index);
+ sector->TS = DTS;
+ break;
+ }
/* read in packet data */
-
- i = (packet_size - PACKET_HEADER_SIZE - AFTER_PACKET_LENGTH);
-
- if (type == PADDING_STR)
- {
- for (j=0; j<i; j++)
- *(index++)=(unsigned char) STUFFING_BYTE;
- tmp = i;
- }
- else
- {
- /*tmp = fread (index, sizeof (unsigned char), i, inputstream);*/
- memcpy(index, inputbuffer, i); tmp = i;
- index += tmp;
-
- /* if we did not get enough data bytes, shorten the Packet length */
-
- if (tmp != i)
- {
- packet_size -= (i-tmp);
- *(size_offset++) = (unsigned char)((packet_size - PACKET_HEADER_SIZE)>>8);
- *(size_offset++) = (unsigned char)((packet_size - PACKET_HEADER_SIZE)&0xff);
-
+
+ i = (packet_size - PACKET_HEADER_SIZE - AFTER_PACKET_LENGTH);
+
+ if (type == PADDING_STR) {
+ for (j = 0; j < i; j++)
+ *(index++) = (unsigned char) STUFFING_BYTE;
+ tmp = i;
+ } else {
+ /*tmp = fread (index, sizeof (unsigned char), i, inputstream); */
+ memcpy (index, inputbuffer, i);
+ tmp = i;
+ index += tmp;
+
+ /* if we did not get enough data bytes, shorten the Packet length */
+
+ if (tmp != i) {
+ packet_size -= (i - tmp);
+ *(size_offset++) =
+ (unsigned char) ((packet_size - PACKET_HEADER_SIZE) >> 8);
+ *(size_offset++) =
+ (unsigned char) ((packet_size - PACKET_HEADER_SIZE) & 0xff);
+
/* zero byte stuffing in the last Packet of a stream */
/* we don't need this any more, since we shortenend the packet */
/* for (j=tmp; j<i; j++) */
/* *(index++)=(unsigned char) ZERO_STUFFING_BYTE; */
- }
}
+ }
- /* write other struct data */
+ /* write other struct data */
+
+ sector->length_of_sector += packet_size;
+ sector->length_of_packet_data = tmp;
- sector->length_of_sector += packet_size;
- sector->length_of_packet_data = tmp;
-
}
/*************************************************************************
@@ -189,26 +189,27 @@ unsigned int which_streams;
the sector buffer
*************************************************************************/
-void create_pack (pack, SCR, mux_rate)
+void
+create_pack (pack, SCR, mux_rate)
-Pack_struc *pack;
-unsigned int mux_rate;
-guint64 SCR;
+ Pack_struc *pack;
+ unsigned int mux_rate;
+ guint64 SCR;
{
- unsigned char *index;
-
- index = pack->buf;
-
- *(index++) = (unsigned char)((PACK_START)>>24);
- *(index++) = (unsigned char)((PACK_START & 0x00ff0000)>>16);
- *(index++) = (unsigned char)((PACK_START & 0x0000ff00)>>8);
- *(index++) = (unsigned char)(PACK_START & 0x000000ff);
- buffer_timecode (SCR, MARKER_SCR, &index);
- *(index++) = (unsigned char)(0x80 | (mux_rate >>15));
- *(index++) = (unsigned char)(0xff & (mux_rate >> 7));
- *(index++) = (unsigned char)(0x01 | ((mux_rate & 0x7f)<<1));
- pack->SCR = SCR;
+ unsigned char *index;
+
+ index = pack->buf;
+
+ *(index++) = (unsigned char) ((PACK_START) >> 24);
+ *(index++) = (unsigned char) ((PACK_START & 0x00ff0000) >> 16);
+ *(index++) = (unsigned char) ((PACK_START & 0x0000ff00) >> 8);
+ *(index++) = (unsigned char) (PACK_START & 0x000000ff);
+ buffer_timecode (SCR, MARKER_SCR, &index);
+ *(index++) = (unsigned char) (0x80 | (mux_rate >> 15));
+ *(index++) = (unsigned char) (0xff & (mux_rate >> 7));
+ *(index++) = (unsigned char) (0x01 | ((mux_rate & 0x7f) << 1));
+ pack->SCR = SCR;
}
@@ -218,77 +219,77 @@ guint64 SCR;
the sector buffer
*************************************************************************/
-void create_sys_header (sys_header, rate_bound, audio_bound,
- fixed, CSPS, audio_lock, video_lock,
- video_bound,
- stream1, buffer1_scale, buffer1_size,
- stream2, buffer2_scale, buffer2_size,
- which_streams)
-
-Sys_header_struc *sys_header;
-unsigned int rate_bound;
-unsigned char audio_bound;
-unsigned char fixed;
-unsigned char CSPS;
-unsigned char audio_lock;
-unsigned char video_lock;
-unsigned char video_bound;
-
-unsigned char stream1;
-unsigned char buffer1_scale;
-unsigned int buffer1_size;
-unsigned char stream2;
-unsigned char buffer2_scale;
-unsigned int buffer2_size;
-unsigned int which_streams;
+void
+create_sys_header (sys_header, rate_bound, audio_bound,
+ fixed, CSPS, audio_lock, video_lock,
+ video_bound,
+ stream1, buffer1_scale, buffer1_size,
+ stream2, buffer2_scale, buffer2_size, which_streams)
+
+ Sys_header_struc *sys_header;
+ unsigned int rate_bound;
+ unsigned char audio_bound;
+ unsigned char fixed;
+ unsigned char CSPS;
+ unsigned char audio_lock;
+ unsigned char video_lock;
+ unsigned char video_bound;
+
+ unsigned char stream1;
+ unsigned char buffer1_scale;
+ unsigned int buffer1_size;
+ unsigned char stream2;
+ unsigned char buffer2_scale;
+ unsigned int buffer2_size;
+ unsigned int which_streams;
{
- unsigned char *index;
-
- index = sys_header->buf;
-
- /* if we are not using both streams, we should clear some
- options here */
-
- if (!(which_streams & STREAMS_AUDIO))
- audio_bound = 0;
- if (!(which_streams & STREAMS_VIDEO))
- video_bound = 0;
-
- *(index++) = (unsigned char)((SYS_HEADER_START)>>24);
- *(index++) = (unsigned char)((SYS_HEADER_START & 0x00ff0000)>>16);
- *(index++) = (unsigned char)((SYS_HEADER_START & 0x0000ff00)>>8);
- *(index++) = (unsigned char)(SYS_HEADER_START & 0x000000ff);
-
- if (which_streams == STREAMS_BOTH) {
- *(index++) = (unsigned char)(SYS_HEADER_LENGTH >> 8);
- *(index++) = (unsigned char)(SYS_HEADER_LENGTH & 0xff);
- } else {
- *(index++) = (unsigned char)((SYS_HEADER_LENGTH-3) >> 8);
- *(index++) = (unsigned char)((SYS_HEADER_LENGTH-3) & 0xff);
- }
-
- *(index++) = (unsigned char)(0x80 | (rate_bound >>15));
- *(index++) = (unsigned char)(0xff & (rate_bound >> 7));
- *(index++) = (unsigned char)(0x01 | ((rate_bound & 0x7f)<<1));
- *(index++) = (unsigned char)((audio_bound << 2)|(fixed << 1)|CSPS);
- *(index++) = (unsigned char)((audio_lock << 7)|
- (video_lock << 6)|0x20|video_bound);
-
- *(index++) = (unsigned char)RESERVED_BYTE;
-
- if (which_streams & STREAMS_AUDIO) {
- *(index++) = stream1;
- *(index++) = (unsigned char) (0xc0 |
- (buffer1_scale << 5) | (buffer1_size >> 8));
- *(index++) = (unsigned char) (buffer1_size & 0xff);
- }
-
- if (which_streams & STREAMS_VIDEO) {
- *(index++) = stream2;
- *(index++) = (unsigned char) (0xc0 |
- (buffer2_scale << 5) | (buffer2_size >> 8));
- *(index++) = (unsigned char) (buffer2_size & 0xff);
- }
+ unsigned char *index;
+
+ index = sys_header->buf;
+
+ /* if we are not using both streams, we should clear some
+ options here */
+
+ if (!(which_streams & STREAMS_AUDIO))
+ audio_bound = 0;
+ if (!(which_streams & STREAMS_VIDEO))
+ video_bound = 0;
+
+ *(index++) = (unsigned char) ((SYS_HEADER_START) >> 24);
+ *(index++) = (unsigned char) ((SYS_HEADER_START & 0x00ff0000) >> 16);
+ *(index++) = (unsigned char) ((SYS_HEADER_START & 0x0000ff00) >> 8);
+ *(index++) = (unsigned char) (SYS_HEADER_START & 0x000000ff);
+
+ if (which_streams == STREAMS_BOTH) {
+ *(index++) = (unsigned char) (SYS_HEADER_LENGTH >> 8);
+ *(index++) = (unsigned char) (SYS_HEADER_LENGTH & 0xff);
+ } else {
+ *(index++) = (unsigned char) ((SYS_HEADER_LENGTH - 3) >> 8);
+ *(index++) = (unsigned char) ((SYS_HEADER_LENGTH - 3) & 0xff);
+ }
+
+ *(index++) = (unsigned char) (0x80 | (rate_bound >> 15));
+ *(index++) = (unsigned char) (0xff & (rate_bound >> 7));
+ *(index++) = (unsigned char) (0x01 | ((rate_bound & 0x7f) << 1));
+ *(index++) = (unsigned char) ((audio_bound << 2) | (fixed << 1) | CSPS);
+ *(index++) = (unsigned char) ((audio_lock << 7) |
+ (video_lock << 6) | 0x20 | video_bound);
+
+ *(index++) = (unsigned char) RESERVED_BYTE;
+
+ if (which_streams & STREAMS_AUDIO) {
+ *(index++) = stream1;
+ *(index++) = (unsigned char) (0xc0 |
+ (buffer1_scale << 5) | (buffer1_size >> 8));
+ *(index++) = (unsigned char) (buffer1_size & 0xff);
+ }
+
+ if (which_streams & STREAMS_VIDEO) {
+ *(index++) = stream2;
+ *(index++) = (unsigned char) (0xc0 |
+ (buffer2_scale << 5) | (buffer2_size >> 8));
+ *(index++) = (unsigned char) (buffer2_size & 0xff);
+ }
}
diff --git a/gst/mpeg1videoparse/gstmp1videoparse.c b/gst/mpeg1videoparse/gstmp1videoparse.c
index 06897e877..e1b5b0898 100644
--- a/gst/mpeg1videoparse/gstmp1videoparse.c
+++ b/gst/mpeg1videoparse/gstmp1videoparse.c
@@ -36,62 +36,57 @@
#define SEQ_END_CODE 0x000001b7
/* elementfactory information */
-static GstElementDetails mpeg1videoparse_details = GST_ELEMENT_DETAILS (
- "MPEG 1 Video Parser",
- "Codec/Parser/Video",
- "Parses and frames MPEG 1 video streams, provides seek",
- "Wim Taymans <wim.taymans@chello.be>"
-);
-
-static GstStaticPadTemplate src_factory =
-GST_STATIC_PAD_TEMPLATE (
- "src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("video/mpeg, "
- "mpegversion = (int) 1, "
- "systemstream = (boolean) false, "
- "width = (int) [ 16, 4096 ], "
- "height = (int) [ 16, 4096 ], "
- "pixel_width = (int) [ 1, 255 ], "
- "pixel_height = (int) [ 1, 255 ], "
- "framerate = (double) [ 0, MAX ]"
- )
-);
-
-static GstStaticPadTemplate sink_factory =
-GST_STATIC_PAD_TEMPLATE (
- "sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("video/mpeg, "
- "mpegversion = (int) 1, "
- "systemstream = (boolean) false"
- )
-);
+static GstElementDetails mpeg1videoparse_details =
+GST_ELEMENT_DETAILS ("MPEG 1 Video Parser",
+ "Codec/Parser/Video",
+ "Parses and frames MPEG 1 video streams, provides seek",
+ "Wim Taymans <wim.taymans@chello.be>");
+
+static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("video/mpeg, "
+ "mpegversion = (int) 1, "
+ "systemstream = (boolean) false, "
+ "width = (int) [ 16, 4096 ], "
+ "height = (int) [ 16, 4096 ], "
+ "pixel_width = (int) [ 1, 255 ], "
+ "pixel_height = (int) [ 1, 255 ], " "framerate = (double) [ 0, MAX ]")
+ );
+
+static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("video/mpeg, "
+ "mpegversion = (int) 1, " "systemstream = (boolean) false")
+ );
/* Mp1VideoParse signals and args */
-enum {
+enum
+{
/* FILL ME */
LAST_SIGNAL
};
-enum {
+enum
+{
ARG_0,
/* FILL ME */
};
-static void gst_mp1videoparse_class_init (Mp1VideoParseClass *klass);
-static void gst_mp1videoparse_base_init (Mp1VideoParseClass *klass);
-static void gst_mp1videoparse_init (Mp1VideoParse *mp1videoparse);
+static void gst_mp1videoparse_class_init (Mp1VideoParseClass * klass);
+static void gst_mp1videoparse_base_init (Mp1VideoParseClass * klass);
+static void gst_mp1videoparse_init (Mp1VideoParse * mp1videoparse);
-static void gst_mp1videoparse_chain (GstPad *pad, GstData *_data);
-static void gst_mp1videoparse_real_chain (Mp1VideoParse *mp1videoparse, GstBuffer *buf, GstPad *outpad);
-static void gst_mp1videoparse_flush (Mp1VideoParse *mp1videoparse);
+static void gst_mp1videoparse_chain (GstPad * pad, GstData * _data);
+static void gst_mp1videoparse_real_chain (Mp1VideoParse * mp1videoparse,
+ GstBuffer * buf, GstPad * outpad);
+static void gst_mp1videoparse_flush (Mp1VideoParse * mp1videoparse);
static GstElementStateReturn
- gst_mp1videoparse_change_state (GstElement *element);
+gst_mp1videoparse_change_state (GstElement * element);
static GstElementClass *parent_class = NULL;
+
/*static guint gst_mp1videoparse_signals[LAST_SIGNAL] = { 0 }; */
GType
@@ -101,56 +96,60 @@ mp1videoparse_get_type (void)
if (!mp1videoparse_type) {
static const GTypeInfo mp1videoparse_info = {
- sizeof(Mp1VideoParseClass),
- (GBaseInitFunc)gst_mp1videoparse_base_init,
+ sizeof (Mp1VideoParseClass),
+ (GBaseInitFunc) gst_mp1videoparse_base_init,
NULL,
- (GClassInitFunc)gst_mp1videoparse_class_init,
+ (GClassInitFunc) gst_mp1videoparse_class_init,
NULL,
NULL,
- sizeof(Mp1VideoParse),
+ sizeof (Mp1VideoParse),
0,
- (GInstanceInitFunc)gst_mp1videoparse_init,
+ (GInstanceInitFunc) gst_mp1videoparse_init,
};
- mp1videoparse_type = g_type_register_static(GST_TYPE_ELEMENT, "Mp1VideoParse", &mp1videoparse_info, 0);
+ mp1videoparse_type =
+ g_type_register_static (GST_TYPE_ELEMENT, "Mp1VideoParse",
+ &mp1videoparse_info, 0);
}
return mp1videoparse_type;
}
static void
-gst_mp1videoparse_base_init (Mp1VideoParseClass *klass)
+gst_mp1videoparse_base_init (Mp1VideoParseClass * klass)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&src_factory));
+ gst_static_pad_template_get (&src_factory));
gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&sink_factory));
+ gst_static_pad_template_get (&sink_factory));
gst_element_class_set_details (element_class, &mpeg1videoparse_details);
}
static void
-gst_mp1videoparse_class_init (Mp1VideoParseClass *klass)
+gst_mp1videoparse_class_init (Mp1VideoParseClass * klass)
{
GstElementClass *gstelement_class;
- gstelement_class = (GstElementClass*)klass;
+ gstelement_class = (GstElementClass *) klass;
- parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
+ parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
gstelement_class->change_state = gst_mp1videoparse_change_state;
}
static void
-gst_mp1videoparse_init (Mp1VideoParse *mp1videoparse)
+gst_mp1videoparse_init (Mp1VideoParse * mp1videoparse)
{
- mp1videoparse->sinkpad = gst_pad_new_from_template (
- gst_static_pad_template_get (&sink_factory), "sink");
- gst_element_add_pad(GST_ELEMENT(mp1videoparse),mp1videoparse->sinkpad);
- gst_pad_set_chain_function(mp1videoparse->sinkpad,gst_mp1videoparse_chain);
-
- mp1videoparse->srcpad = gst_pad_new_from_template (
- gst_static_pad_template_get (&src_factory), "src");
- gst_element_add_pad(GST_ELEMENT(mp1videoparse),mp1videoparse->srcpad);
+ mp1videoparse->sinkpad =
+ gst_pad_new_from_template (gst_static_pad_template_get (&sink_factory),
+ "sink");
+ gst_element_add_pad (GST_ELEMENT (mp1videoparse), mp1videoparse->sinkpad);
+ gst_pad_set_chain_function (mp1videoparse->sinkpad, gst_mp1videoparse_chain);
+
+ mp1videoparse->srcpad =
+ gst_pad_new_from_template (gst_static_pad_template_get (&src_factory),
+ "src");
+ gst_element_add_pad (GST_ELEMENT (mp1videoparse), mp1videoparse->srcpad);
gst_pad_use_explicit_caps (mp1videoparse->srcpad);
mp1videoparse->partialbuf = NULL;
@@ -162,38 +161,39 @@ gst_mp1videoparse_init (Mp1VideoParse *mp1videoparse)
}
static void
-mp1videoparse_parse_seq (Mp1VideoParse *mp1videoparse, GstBuffer *buf)
+mp1videoparse_parse_seq (Mp1VideoParse * mp1videoparse, GstBuffer * buf)
{
gint width, height, asr_idx, fps_idx;
gfloat asr_table[] = { 0., 1.,
- 0.6735, 0.7031, 0.7615, 0.8055, 0.8437,
- 0.8935, 0.9157, 0.9815, 1.0255, 1.0695,
- 1.0950, 1.1575, 1.2015 };
- gfloat fps_table[] = { 0., 24./1.001, 24., 25.,
- 30./1.001, 30.,
- 50., 60./1.001, 60. };
+ 0.6735, 0.7031, 0.7615, 0.8055, 0.8437,
+ 0.8935, 0.9157, 0.9815, 1.0255, 1.0695,
+ 1.0950, 1.1575, 1.2015
+ };
+ gfloat fps_table[] = { 0., 24. / 1.001, 24., 25.,
+ 30. / 1.001, 30.,
+ 50., 60. / 1.001, 60.
+ };
guint32 n = GUINT32_FROM_BE (*(guint32 *) GST_BUFFER_DATA (buf));
- width = (n & 0xfff00000) >> 20;
- height = (n & 0x000fff00) >> 8;
- asr_idx = (n & 0x000000f0) >> 4;
- fps_idx = (n & 0x0000000f) >> 0;
+ width = (n & 0xfff00000) >> 20;
+ height = (n & 0x000fff00) >> 8;
+ asr_idx = (n & 0x000000f0) >> 4;
+ fps_idx = (n & 0x0000000f) >> 0;
if (fps_idx >= 9 || fps_idx <= 0)
- fps_idx = 3; /* well, we need a default */
+ fps_idx = 3; /* well, we need a default */
if (asr_idx >= 15 || asr_idx <= 0)
- asr_idx = 1; /* no aspect ratio */
+ asr_idx = 1; /* no aspect ratio */
- if (asr_table[asr_idx] != mp1videoparse->asr ||
- fps_table[fps_idx] != mp1videoparse->fps ||
- width != mp1videoparse->width ||
- height != mp1videoparse->height) {
+ if (asr_table[asr_idx] != mp1videoparse->asr ||
+ fps_table[fps_idx] != mp1videoparse->fps ||
+ width != mp1videoparse->width || height != mp1videoparse->height) {
GstCaps *caps;
gint p_w, p_h;
- mp1videoparse->asr = asr_table[asr_idx];
- mp1videoparse->fps = fps_table[fps_idx];
- mp1videoparse->width = width;
+ mp1videoparse->asr = asr_table[asr_idx];
+ mp1videoparse->fps = fps_table[fps_idx];
+ mp1videoparse->width = width;
mp1videoparse->height = height;
p_w = (asr_table[asr_idx] < 1.0) ? (100 / asr_table[asr_idx]) : 1;
@@ -201,12 +201,11 @@ mp1videoparse_parse_seq (Mp1VideoParse *mp1videoparse, GstBuffer *buf)
caps = gst_caps_new_simple ("video/mpeg",
"systemstream", G_TYPE_BOOLEAN, FALSE,
- "mpegversion", G_TYPE_INT, 1,
- "width", G_TYPE_INT, width,
- "height", G_TYPE_INT, height,
- "framerate", G_TYPE_DOUBLE, fps_table[fps_idx],
- "pixel_width", G_TYPE_INT, p_w,
- "pixel_height", G_TYPE_INT, p_h, NULL);
+ "mpegversion", G_TYPE_INT, 1,
+ "width", G_TYPE_INT, width,
+ "height", G_TYPE_INT, height,
+ "framerate", G_TYPE_DOUBLE, fps_table[fps_idx],
+ "pixel_width", G_TYPE_INT, p_w, "pixel_height", G_TYPE_INT, p_h, NULL);
GST_DEBUG ("New mpeg1videoparse caps: " GST_PTR_FORMAT, caps);
@@ -215,13 +214,15 @@ mp1videoparse_parse_seq (Mp1VideoParse *mp1videoparse, GstBuffer *buf)
}
static gboolean
-mp1videoparse_valid_sync (Mp1VideoParse *mp1videoparse, guint32 head, GstBuffer *buf)
+mp1videoparse_valid_sync (Mp1VideoParse * mp1videoparse, guint32 head,
+ GstBuffer * buf)
{
switch (head) {
- case SEQ_START_CODE: {
+ case SEQ_START_CODE:{
GstBuffer *subbuf = gst_buffer_create_sub (buf, 4,
- GST_BUFFER_SIZE (buf) - 4);
- mp1videoparse_parse_seq(mp1videoparse, subbuf);
+ GST_BUFFER_SIZE (buf) - 4);
+
+ mp1videoparse_parse_seq (mp1videoparse, subbuf);
gst_buffer_unref (subbuf);
return TRUE;
}
@@ -231,42 +232,39 @@ mp1videoparse_valid_sync (Mp1VideoParse *mp1videoparse, guint32 head, GstBuffer
case EXT_START_CODE:
return TRUE;
default:
- if (head >= SLICE_MIN_START_CODE &&
- head <= SLICE_MAX_START_CODE)
- return TRUE;
+ if (head >= SLICE_MIN_START_CODE && head <= SLICE_MAX_START_CODE)
+ return TRUE;
}
return FALSE;
}
static gint
-mp1videoparse_find_next_gop (Mp1VideoParse *mp1videoparse, GstBuffer *buf)
+mp1videoparse_find_next_gop (Mp1VideoParse * mp1videoparse, GstBuffer * buf)
{
- guchar *data = GST_BUFFER_DATA(buf);
- gulong size = GST_BUFFER_SIZE(buf);
+ guchar *data = GST_BUFFER_DATA (buf);
+ gulong size = GST_BUFFER_SIZE (buf);
gulong offset = 0;
gint sync_zeros = 0;
gboolean have_sync = FALSE;
while (offset < size) {
- guchar byte = *(data+offset);
+ guchar byte = *(data + offset);
+
offset++;
if (byte == 0) {
sync_zeros++;
- }
- else if (byte == 1 && sync_zeros >=2 ) {
+ } else if (byte == 1 && sync_zeros >= 2) {
sync_zeros = 0;
have_sync = TRUE;
- }
- else if (have_sync) {
+ } else if (have_sync) {
if (byte == (SEQ_START_CODE & 0xff) || byte == (GOP_START_CODE & 0xff)) {
- return offset - 4;
+ return offset - 4;
} else {
- sync_zeros = 0;
+ sync_zeros = 0;
have_sync = FALSE;
}
- }
- else {
+ } else {
sync_zeros = 0;
}
}
@@ -275,24 +273,23 @@ mp1videoparse_find_next_gop (Mp1VideoParse *mp1videoparse, GstBuffer *buf)
}
static guint64
-gst_mp1videoparse_time_code (guchar *gop,
- gfloat fps)
+gst_mp1videoparse_time_code (guchar * gop, gfloat fps)
{
- guint32 data = GUINT32_FROM_BE (* (guint32 *) gop);
+ guint32 data = GUINT32_FROM_BE (*(guint32 *) gop);
- return ((((data & 0xfc000000) >> 26) * 3600 * GST_SECOND) + /* hours */
- (((data & 0x03f00000) >> 20) * 60 * GST_SECOND) + /* minutes */
- (((data & 0x0007e000) >> 13) * GST_SECOND) + /* seconds */
- (((data & 0x00001f80) >> 7) * GST_SECOND / fps)); /* frames */
+ return ((((data & 0xfc000000) >> 26) * 3600 * GST_SECOND) + /* hours */
+ (((data & 0x03f00000) >> 20) * 60 * GST_SECOND) + /* minutes */
+ (((data & 0x0007e000) >> 13) * GST_SECOND) + /* seconds */
+ (((data & 0x00001f80) >> 7) * GST_SECOND / fps)); /* frames */
}
static void
-gst_mp1videoparse_flush (Mp1VideoParse *mp1videoparse)
+gst_mp1videoparse_flush (Mp1VideoParse * mp1videoparse)
{
GST_DEBUG ("mp1videoparse: flushing");
if (mp1videoparse->partialbuf) {
- gst_buffer_unref(mp1videoparse->partialbuf);
- mp1videoparse->partialbuf= NULL;
+ gst_buffer_unref (mp1videoparse->partialbuf);
+ mp1videoparse->partialbuf = NULL;
}
mp1videoparse->need_resync = TRUE;
mp1videoparse->in_flush = TRUE;
@@ -300,7 +297,7 @@ gst_mp1videoparse_flush (Mp1VideoParse *mp1videoparse)
}
static void
-gst_mp1videoparse_chain (GstPad *pad,GstData *_data)
+gst_mp1videoparse_chain (GstPad * pad, GstData * _data)
{
GstBuffer *buf = GST_BUFFER (_data);
Mp1VideoParse *mp1videoparse;
@@ -311,11 +308,12 @@ gst_mp1videoparse_chain (GstPad *pad,GstData *_data)
mp1videoparse = GST_MP1VIDEOPARSE (GST_OBJECT_PARENT (pad));
- gst_mp1videoparse_real_chain(mp1videoparse, buf, mp1videoparse->srcpad);
+ gst_mp1videoparse_real_chain (mp1videoparse, buf, mp1videoparse->srcpad);
}
static void
-gst_mp1videoparse_real_chain (Mp1VideoParse *mp1videoparse, GstBuffer *buf, GstPad *outpad)
+gst_mp1videoparse_real_chain (Mp1VideoParse * mp1videoparse, GstBuffer * buf,
+ GstPad * outpad)
{
guchar *data;
gulong size, offset = 0;
@@ -328,7 +326,7 @@ gst_mp1videoparse_real_chain (Mp1VideoParse *mp1videoparse, GstBuffer *buf, GstP
guint64 time_stamp;
GstBuffer *temp;
- time_stamp = GST_BUFFER_TIMESTAMP(buf);
+ time_stamp = GST_BUFFER_TIMESTAMP (buf);
if (GST_IS_EVENT (buf)) {
GstEvent *event = GST_EVENT (buf);
@@ -336,90 +334,91 @@ gst_mp1videoparse_real_chain (Mp1VideoParse *mp1videoparse, GstBuffer *buf, GstP
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_FLUSH:
case GST_EVENT_DISCONTINUOUS:
- gst_mp1videoparse_flush(mp1videoparse);
- break;
+ gst_mp1videoparse_flush (mp1videoparse);
+ break;
case GST_EVENT_EOS:
- gst_mp1videoparse_flush(mp1videoparse);
- gst_event_ref(event);
- gst_pad_push(outpad, GST_DATA (event));
- gst_element_set_eos (GST_ELEMENT (mp1videoparse));
- break;
+ gst_mp1videoparse_flush (mp1videoparse);
+ gst_event_ref (event);
+ gst_pad_push (outpad, GST_DATA (event));
+ gst_element_set_eos (GST_ELEMENT (mp1videoparse));
+ break;
default:
- GST_DEBUG ("Unhandled event type %d",
- GST_EVENT_TYPE (event));
- break;
+ GST_DEBUG ("Unhandled event type %d", GST_EVENT_TYPE (event));
+ break;
}
-
+
gst_event_unref (event);
return;
}
-
+
if (mp1videoparse->partialbuf) {
GstBuffer *merge;
- offset = GST_BUFFER_SIZE(mp1videoparse->partialbuf);
- merge = gst_buffer_merge(mp1videoparse->partialbuf, buf);
+ offset = GST_BUFFER_SIZE (mp1videoparse->partialbuf);
+ merge = gst_buffer_merge (mp1videoparse->partialbuf, buf);
- gst_buffer_unref(mp1videoparse->partialbuf);
- gst_buffer_unref(buf);
+ gst_buffer_unref (mp1videoparse->partialbuf);
+ gst_buffer_unref (buf);
mp1videoparse->partialbuf = merge;
- }
- else {
+ } else {
mp1videoparse->partialbuf = buf;
offset = 0;
}
- data = GST_BUFFER_DATA(mp1videoparse->partialbuf);
- size = GST_BUFFER_SIZE(mp1videoparse->partialbuf);
+ data = GST_BUFFER_DATA (mp1videoparse->partialbuf);
+ size = GST_BUFFER_SIZE (mp1videoparse->partialbuf);
- GST_DEBUG ("mp1videoparse: received buffer of %ld bytes %" G_GINT64_FORMAT,size, GST_BUFFER_TIMESTAMP(buf));
+ GST_DEBUG ("mp1videoparse: received buffer of %ld bytes %" G_GINT64_FORMAT,
+ size, GST_BUFFER_TIMESTAMP (buf));
do {
- data = GST_BUFFER_DATA(mp1videoparse->partialbuf);
- size = GST_BUFFER_SIZE(mp1videoparse->partialbuf);
+ data = GST_BUFFER_DATA (mp1videoparse->partialbuf);
+ size = GST_BUFFER_SIZE (mp1videoparse->partialbuf);
- head = GUINT32_FROM_BE(*((guint32 *)data));
+ head = GUINT32_FROM_BE (*((guint32 *) data));
- GST_DEBUG ("mp1videoparse: head is %08x", (unsigned int)head);
+ GST_DEBUG ("mp1videoparse: head is %08x", (unsigned int) head);
- if (!mp1videoparse_valid_sync(mp1videoparse, head,
- mp1videoparse->partialbuf) ||
- mp1videoparse->need_resync) {
- sync_pos = mp1videoparse_find_next_gop(mp1videoparse, mp1videoparse->partialbuf);
+ if (!mp1videoparse_valid_sync (mp1videoparse, head,
+ mp1videoparse->partialbuf) || mp1videoparse->need_resync) {
+ sync_pos =
+ mp1videoparse_find_next_gop (mp1videoparse,
+ mp1videoparse->partialbuf);
if (sync_pos >= 0) {
- mp1videoparse->need_resync = FALSE;
- GST_DEBUG ("mp1videoparse: found new gop at %d", sync_pos);
-
- if (sync_pos != 0) {
- temp = gst_buffer_create_sub(mp1videoparse->partialbuf, sync_pos, size-sync_pos);
- g_assert(temp != NULL);
- gst_buffer_unref(mp1videoparse->partialbuf);
+ mp1videoparse->need_resync = FALSE;
+ GST_DEBUG ("mp1videoparse: found new gop at %d", sync_pos);
+
+ if (sync_pos != 0) {
+ temp =
+ gst_buffer_create_sub (mp1videoparse->partialbuf, sync_pos,
+ size - sync_pos);
+ g_assert (temp != NULL);
+ gst_buffer_unref (mp1videoparse->partialbuf);
mp1videoparse->partialbuf = temp;
- data = GST_BUFFER_DATA(mp1videoparse->partialbuf);
- size = GST_BUFFER_SIZE(mp1videoparse->partialbuf);
+ data = GST_BUFFER_DATA (mp1videoparse->partialbuf);
+ size = GST_BUFFER_SIZE (mp1videoparse->partialbuf);
offset = 0;
- }
-
- head = GUINT32_FROM_BE(*((guint32 *)data));
- /* re-call this function so that if we hadn't already, we can
- * now read the sequence header and parse video properties,
- * set caps, stream data, be happy, bla, bla, bla... */
- if (!mp1videoparse_valid_sync (mp1videoparse, head,
- mp1videoparse->partialbuf))
- g_error ("Found sync but no valid sync point at pos 0x0");
- }
- else {
- GST_DEBUG ("mp1videoparse: could not sync");
- gst_buffer_unref(mp1videoparse->partialbuf);
- mp1videoparse->partialbuf = NULL;
- return;
+ }
+
+ head = GUINT32_FROM_BE (*((guint32 *) data));
+ /* re-call this function so that if we hadn't already, we can
+ * now read the sequence header and parse video properties,
+ * set caps, stream data, be happy, bla, bla, bla... */
+ if (!mp1videoparse_valid_sync (mp1videoparse, head,
+ mp1videoparse->partialbuf))
+ g_error ("Found sync but no valid sync point at pos 0x0");
+ } else {
+ GST_DEBUG ("mp1videoparse: could not sync");
+ gst_buffer_unref (mp1videoparse->partialbuf);
+ mp1videoparse->partialbuf = NULL;
+ return;
}
}
if (mp1videoparse->picture_in_buffer == 1 &&
- time_stamp != GST_CLOCK_TIME_NONE) {
+ time_stamp != GST_CLOCK_TIME_NONE) {
mp1videoparse->last_pts = time_stamp;
}
@@ -428,143 +427,139 @@ gst_mp1videoparse_real_chain (Mp1VideoParse *mp1videoparse, GstBuffer *buf, GstP
GST_DEBUG ("mp1videoparse: searching sync");
- while (offset < size-1) {
+ while (offset < size - 1) {
sync_byte = *(data + offset);
if (sync_byte == 0) {
- sync_state++;
- }
- else if ((sync_byte == 1) && (sync_state >=2)) {
- GST_DEBUG ("mp1videoparse: code 0x000001%02x",data[offset+1]);
- if (data[offset+1] == (PICTURE_START_CODE & 0xff)) {
+ sync_state++;
+ } else if ((sync_byte == 1) && (sync_state >= 2)) {
+ GST_DEBUG ("mp1videoparse: code 0x000001%02x", data[offset + 1]);
+ if (data[offset + 1] == (PICTURE_START_CODE & 0xff)) {
mp1videoparse->picture_in_buffer++;
if (mp1videoparse->picture_in_buffer == 1) {
if (time_stamp != GST_CLOCK_TIME_NONE) {
- mp1videoparse->last_pts = time_stamp;
+ mp1videoparse->last_pts = time_stamp;
}
sync_state = 0;
+ } else if (mp1videoparse->picture_in_buffer == 2) {
+ have_sync = TRUE;
+ break;
+ } else {
+ GST_DEBUG ("mp1videoparse: %d in buffer",
+ mp1videoparse->picture_in_buffer);
+ g_assert_not_reached ();
}
- else if (mp1videoparse->picture_in_buffer == 2) {
- have_sync = TRUE;
- break;
- }
- else {
- GST_DEBUG ("mp1videoparse: %d in buffer", mp1videoparse->picture_in_buffer);
- g_assert_not_reached();
- }
- }
- /* A new sequence (or GOP) is a valid sync too. Note that the
- * sequence header should be put in the next buffer, not here. */
- else if (data[offset+1] == (SEQ_START_CODE & 0xFF) ||
- data[offset+1] == (GOP_START_CODE & 0xFF)) {
- if (mp1videoparse->picture_in_buffer == 0 &&
- data[offset+1] == (GOP_START_CODE & 0xFF)) {
+ }
+ /* A new sequence (or GOP) is a valid sync too. Note that the
+ * sequence header should be put in the next buffer, not here. */
+ else if (data[offset + 1] == (SEQ_START_CODE & 0xFF) ||
+ data[offset + 1] == (GOP_START_CODE & 0xFF)) {
+ if (mp1videoparse->picture_in_buffer == 0 &&
+ data[offset + 1] == (GOP_START_CODE & 0xFF)) {
mp1videoparse->last_pts = gst_mp1videoparse_time_code (&data[2],
- mp1videoparse->fps);
- }
- else if (mp1videoparse->picture_in_buffer == 1) {
+ mp1videoparse->fps);
+ } else if (mp1videoparse->picture_in_buffer == 1) {
have_sync = TRUE;
break;
} else {
g_assert (mp1videoparse->picture_in_buffer == 0);
}
- }
- /* end-of-sequence is a valid sync point and should be included
- * in the current picture, not the next. */
- else if (data[offset+1] == (SEQ_END_CODE & 0xFF)) {
- if (mp1videoparse->picture_in_buffer == 1) {
- offset += 4;
+ }
+ /* end-of-sequence is a valid sync point and should be included
+ * in the current picture, not the next. */
+ else if (data[offset + 1] == (SEQ_END_CODE & 0xFF)) {
+ if (mp1videoparse->picture_in_buffer == 1) {
+ offset += 4;
have_sync = TRUE;
break;
} else {
g_assert (mp1videoparse->picture_in_buffer == 0);
}
- }
- else sync_state = 0;
+ } else
+ sync_state = 0;
}
/* something else... */
- else sync_state = 0;
+ else
+ sync_state = 0;
/* go down the buffer */
offset++;
}
if (have_sync) {
offset -= 2;
- GST_DEBUG ("mp1videoparse: synced at %ld code 0x000001%02x",offset,data[offset+3]);
+ GST_DEBUG ("mp1videoparse: synced at %ld code 0x000001%02x", offset,
+ data[offset + 3]);
- outbuf = gst_buffer_create_sub(mp1videoparse->partialbuf, 0, offset+4);
- g_assert(outbuf != NULL);
- GST_BUFFER_TIMESTAMP(outbuf) = mp1videoparse->last_pts;
- GST_BUFFER_DURATION(outbuf) = GST_SECOND / mp1videoparse->fps;
+ outbuf = gst_buffer_create_sub (mp1videoparse->partialbuf, 0, offset + 4);
+ g_assert (outbuf != NULL);
+ GST_BUFFER_TIMESTAMP (outbuf) = mp1videoparse->last_pts;
+ GST_BUFFER_DURATION (outbuf) = GST_SECOND / mp1videoparse->fps;
mp1videoparse->last_pts += GST_BUFFER_DURATION (outbuf);
if (mp1videoparse->in_flush) {
- /* FIXME, send a flush event here */
- mp1videoparse->in_flush = FALSE;
+ /* FIXME, send a flush event here */
+ mp1videoparse->in_flush = FALSE;
}
if (GST_PAD_CAPS (outpad) != NULL) {
- GST_DEBUG ("mp1videoparse: pushing %d bytes %" G_GUINT64_FORMAT, GST_BUFFER_SIZE(outbuf), GST_BUFFER_TIMESTAMP(outbuf));
- gst_pad_push(outpad, GST_DATA (outbuf));
- GST_DEBUG ("mp1videoparse: pushing done");
+ GST_DEBUG ("mp1videoparse: pushing %d bytes %" G_GUINT64_FORMAT,
+ GST_BUFFER_SIZE (outbuf), GST_BUFFER_TIMESTAMP (outbuf));
+ gst_pad_push (outpad, GST_DATA (outbuf));
+ GST_DEBUG ("mp1videoparse: pushing done");
} else {
- GST_DEBUG ("No capsnego yet, delaying buffer push");
- gst_buffer_unref (outbuf);
+ GST_DEBUG ("No capsnego yet, delaying buffer push");
+ gst_buffer_unref (outbuf);
}
mp1videoparse->picture_in_buffer = 0;
- temp = gst_buffer_create_sub(mp1videoparse->partialbuf, offset, size-offset);
- gst_buffer_unref(mp1videoparse->partialbuf);
+ temp =
+ gst_buffer_create_sub (mp1videoparse->partialbuf, offset,
+ size - offset);
+ gst_buffer_unref (mp1videoparse->partialbuf);
mp1videoparse->partialbuf = temp;
offset = 0;
- }
- else {
+ } else {
if (time_stamp != GST_CLOCK_TIME_NONE) {
- mp1videoparse->last_pts = time_stamp;
+ mp1videoparse->last_pts = time_stamp;
break;
}
}
} while (1);
}
-static GstElementStateReturn
-gst_mp1videoparse_change_state (GstElement *element)
+static GstElementStateReturn
+gst_mp1videoparse_change_state (GstElement * element)
{
Mp1VideoParse *mp1videoparse;
- g_return_val_if_fail(GST_IS_MP1VIDEOPARSE(element),GST_STATE_FAILURE);
- mp1videoparse = GST_MP1VIDEOPARSE(element);
+ g_return_val_if_fail (GST_IS_MP1VIDEOPARSE (element), GST_STATE_FAILURE);
+
+ mp1videoparse = GST_MP1VIDEOPARSE (element);
switch (GST_STATE_TRANSITION (element)) {
case GST_STATE_PAUSED_TO_READY:
- gst_mp1videoparse_flush(mp1videoparse);
+ gst_mp1videoparse_flush (mp1videoparse);
mp1videoparse->width = mp1videoparse->height = -1;
- mp1videoparse->fps = mp1videoparse->asr = 0.;
+ mp1videoparse->fps = mp1videoparse->asr = 0.;
break;
default:
break;
}
- if (GST_ELEMENT_CLASS(parent_class)->change_state)
- return GST_ELEMENT_CLASS(parent_class)->change_state(element);
+ if (GST_ELEMENT_CLASS (parent_class)->change_state)
+ return GST_ELEMENT_CLASS (parent_class)->change_state (element);
return GST_STATE_SUCCESS;
}
static gboolean
-plugin_init (GstPlugin *plugin)
+plugin_init (GstPlugin * plugin)
{
return gst_element_register (plugin, "mpeg1videoparse",
- GST_RANK_NONE, GST_TYPE_MP1VIDEOPARSE);
+ GST_RANK_NONE, GST_TYPE_MP1VIDEOPARSE);
}
-GST_PLUGIN_DEFINE (
- GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "mpeg1videoparse",
- "MPEG-1 video parser",
- plugin_init,
- VERSION,
- GST_LICENSE,
- GST_PACKAGE,
- GST_ORIGIN
-)
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ "mpeg1videoparse",
+ "MPEG-1 video parser",
+ plugin_init, VERSION, GST_LICENSE, GST_PACKAGE, GST_ORIGIN)
diff --git a/gst/mpeg1videoparse/gstmp1videoparse.h b/gst/mpeg1videoparse/gstmp1videoparse.h
index b8b4f0164..0fb4f161a 100644
--- a/gst/mpeg1videoparse/gstmp1videoparse.h
+++ b/gst/mpeg1videoparse/gstmp1videoparse.h
@@ -26,8 +26,9 @@
#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
+extern "C"
+{
+#endif /* __cplusplus */
#define GST_TYPE_MP1VIDEOPARSE \
@@ -41,35 +42,37 @@ extern "C" {
#define GST_IS_MP1VIDEOPARSE_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_MP1VIDEOPARSE))
-typedef struct _Mp1VideoParse Mp1VideoParse;
-typedef struct _Mp1VideoParseClass Mp1VideoParseClass;
+ typedef struct _Mp1VideoParse Mp1VideoParse;
+ typedef struct _Mp1VideoParseClass Mp1VideoParseClass;
-struct _Mp1VideoParse {
- GstElement element;
+ struct _Mp1VideoParse
+ {
+ GstElement element;
- GstPad *sinkpad,*srcpad;
+ GstPad *sinkpad, *srcpad;
- GstBuffer *partialbuf; /* previous buffer (if carryover) */
- gulong next_buffer_offset;
- gboolean need_resync;
- gboolean in_flush;
- guint64 last_pts;
- gint picture_in_buffer;
+ GstBuffer *partialbuf; /* previous buffer (if carryover) */
+ gulong next_buffer_offset;
+ gboolean need_resync;
+ gboolean in_flush;
+ guint64 last_pts;
+ gint picture_in_buffer;
- gint width, height;
- gfloat fps, asr;
-};
+ gint width, height;
+ gfloat fps, asr;
+ };
-struct _Mp1VideoParseClass {
- GstElementClass parent_class;
-};
+ struct _Mp1VideoParseClass
+ {
+ GstElementClass parent_class;
+ };
-GType gst_mp1videoparse_get_type(void);
+ GType gst_mp1videoparse_get_type (void);
#ifdef __cplusplus
}
-#endif /* __cplusplus */
+#endif /* __cplusplus */
-#endif /* __MP1VIDEOPARSE_H__ */
+#endif /* __MP1VIDEOPARSE_H__ */
diff --git a/gst/mpeg2sub/gstmpeg2subt.c b/gst/mpeg2sub/gstmpeg2subt.c
index d267932a7..65047297d 100644
--- a/gst/mpeg2sub/gstmpeg2subt.c
+++ b/gst/mpeg2sub/gstmpeg2subt.c
@@ -24,17 +24,20 @@
#endif
#include <gstmpeg2subt.h>
-static void gst_mpeg2subt_class_init (GstMpeg2SubtClass *klass);
-static void gst_mpeg2subt_base_init (GstMpeg2SubtClass *klass);
-static void gst_mpeg2subt_init (GstMpeg2Subt *mpeg2subt);
+static void gst_mpeg2subt_class_init (GstMpeg2SubtClass * klass);
+static void gst_mpeg2subt_base_init (GstMpeg2SubtClass * klass);
+static void gst_mpeg2subt_init (GstMpeg2Subt * mpeg2subt);
-static void gst_mpeg2subt_chain_video (GstPad *pad,GstData *_data);
-static void gst_mpeg2subt_chain_subtitle (GstPad *pad,GstData *_data);
+static void gst_mpeg2subt_chain_video (GstPad * pad, GstData * _data);
+static void gst_mpeg2subt_chain_subtitle (GstPad * pad, GstData * _data);
-static void gst_mpeg2subt_merge_title (GstMpeg2Subt *mpeg2subt, GstBuffer *buf);
+static void gst_mpeg2subt_merge_title (GstMpeg2Subt * mpeg2subt,
+ GstBuffer * buf);
-static void gst_mpeg2subt_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
-static void gst_mpeg2subt_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
+static void gst_mpeg2subt_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec);
+static void gst_mpeg2subt_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec);
/* elementfactory information */
static GstElementDetails mpeg2subt_details = {
@@ -45,12 +48,14 @@ static GstElementDetails mpeg2subt_details = {
};
/* GstMpeg2Subt signals and args */
-enum {
+enum
+{
/* FILL ME */
LAST_SIGNAL
};
-enum {
+enum
+{
ARG_0,
ARG_SKIP,
/* FILL ME */
@@ -79,6 +84,7 @@ static guchar yuv_color[16] = {
static GstElementClass *parent_class = NULL;
+
/*static guint gst_mpeg2subt_signals[LAST_SIGNAL] = { 0 };*/
GType
@@ -88,23 +94,25 @@ gst_mpeg2subt_get_type (void)
if (!mpeg2subt_type) {
static const GTypeInfo mpeg2subt_info = {
- sizeof(GstMpeg2SubtClass),
- (GBaseInitFunc)gst_mpeg2subt_base_init,
+ sizeof (GstMpeg2SubtClass),
+ (GBaseInitFunc) gst_mpeg2subt_base_init,
NULL,
- (GClassInitFunc)gst_mpeg2subt_class_init,
+ (GClassInitFunc) gst_mpeg2subt_class_init,
NULL,
NULL,
- sizeof(GstMpeg2Subt),
+ sizeof (GstMpeg2Subt),
0,
- (GInstanceInitFunc)gst_mpeg2subt_init,
+ (GInstanceInitFunc) gst_mpeg2subt_init,
};
- mpeg2subt_type = g_type_register_static(GST_TYPE_ELEMENT, "GstMpeg2Subt", &mpeg2subt_info, 0);
+ mpeg2subt_type =
+ g_type_register_static (GST_TYPE_ELEMENT, "GstMpeg2Subt",
+ &mpeg2subt_info, 0);
}
return mpeg2subt_type;
}
static void
-gst_mpeg2subt_base_init (GstMpeg2SubtClass *klass)
+gst_mpeg2subt_base_init (GstMpeg2SubtClass * klass)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
@@ -112,19 +120,17 @@ gst_mpeg2subt_base_init (GstMpeg2SubtClass *klass)
}
static void
-gst_mpeg2subt_class_init (GstMpeg2SubtClass *klass)
+gst_mpeg2subt_class_init (GstMpeg2SubtClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
- gobject_class = (GObjectClass*)klass;
- gstelement_class = (GstElementClass*)klass;
+ gobject_class = (GObjectClass *) klass;
+ gstelement_class = (GstElementClass *) klass;
- g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_SKIP,
- g_param_spec_int("skip","skip","skip",
- G_MININT,G_MAXINT,0,G_PARAM_READWRITE)); /* CHECKME */
+ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SKIP, g_param_spec_int ("skip", "skip", "skip", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */
- parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
+ parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
gobject_class->set_property = gst_mpeg2subt_set_property;
gobject_class->get_property = gst_mpeg2subt_get_property;
@@ -132,150 +138,153 @@ gst_mpeg2subt_class_init (GstMpeg2SubtClass *klass)
}
static void
-gst_mpeg2subt_init (GstMpeg2Subt *mpeg2subt)
+gst_mpeg2subt_init (GstMpeg2Subt * mpeg2subt)
{
- mpeg2subt->videopad = gst_pad_new("video",GST_PAD_SINK);
- gst_element_add_pad(GST_ELEMENT(mpeg2subt),mpeg2subt->videopad);
- gst_pad_set_chain_function(mpeg2subt->videopad,gst_mpeg2subt_chain_video);
+ mpeg2subt->videopad = gst_pad_new ("video", GST_PAD_SINK);
+ gst_element_add_pad (GST_ELEMENT (mpeg2subt), mpeg2subt->videopad);
+ gst_pad_set_chain_function (mpeg2subt->videopad, gst_mpeg2subt_chain_video);
- mpeg2subt->subtitlepad = gst_pad_new("subtitle",GST_PAD_SINK);
- gst_element_add_pad(GST_ELEMENT(mpeg2subt),mpeg2subt->subtitlepad);
- gst_pad_set_chain_function(mpeg2subt->subtitlepad,gst_mpeg2subt_chain_subtitle);
+ mpeg2subt->subtitlepad = gst_pad_new ("subtitle", GST_PAD_SINK);
+ gst_element_add_pad (GST_ELEMENT (mpeg2subt), mpeg2subt->subtitlepad);
+ gst_pad_set_chain_function (mpeg2subt->subtitlepad,
+ gst_mpeg2subt_chain_subtitle);
- mpeg2subt->srcpad = gst_pad_new("src",GST_PAD_SRC);
- gst_element_add_pad(GST_ELEMENT(mpeg2subt),mpeg2subt->srcpad);
+ mpeg2subt->srcpad = gst_pad_new ("src", GST_PAD_SRC);
+ gst_element_add_pad (GST_ELEMENT (mpeg2subt), mpeg2subt->srcpad);
mpeg2subt->partialbuf = NULL;
mpeg2subt->have_title = FALSE;
}
static void
-gst_mpeg2subt_chain_video (GstPad *pad, GstData *_data)
+gst_mpeg2subt_chain_video (GstPad * pad, GstData * _data)
{
GstBuffer *buf = GST_BUFFER (_data);
GstMpeg2Subt *mpeg2subt;
guchar *data;
glong size;
- g_return_if_fail(pad != NULL);
- g_return_if_fail(GST_IS_PAD(pad));
- g_return_if_fail(buf != NULL);
+ g_return_if_fail (pad != NULL);
+ g_return_if_fail (GST_IS_PAD (pad));
+ g_return_if_fail (buf != NULL);
mpeg2subt = GST_MPEG2SUBT (GST_OBJECT_PARENT (pad));
- data = GST_BUFFER_DATA(buf);
- size = GST_BUFFER_SIZE(buf);
+ data = GST_BUFFER_DATA (buf);
+ size = GST_BUFFER_SIZE (buf);
if (mpeg2subt->have_title && mpeg2subt->duration != 0) {
- gst_mpeg2subt_merge_title(mpeg2subt, buf);
+ gst_mpeg2subt_merge_title (mpeg2subt, buf);
mpeg2subt->duration--;
}
- gst_pad_push(mpeg2subt->srcpad, GST_DATA (buf));
+ gst_pad_push (mpeg2subt->srcpad, GST_DATA (buf));
}
static void
-gst_mpeg2subt_parse_header (GstMpeg2Subt *mpeg2subt)
+gst_mpeg2subt_parse_header (GstMpeg2Subt * mpeg2subt)
{
- guchar *buffer = GST_BUFFER_DATA(mpeg2subt->partialbuf);
+ guchar *buffer = GST_BUFFER_DATA (mpeg2subt->partialbuf);
guchar dummy;
guint i;
i = mpeg2subt->data_size + 4;
- while (i < mpeg2subt->packet_size)
- {
- dummy = buffer [i];
- switch (dummy)
- {
- case 0x01: /* null packet ? */
- i++;
- break;
- case 0x02: /* 02 ff (ff) is the end of the packet */
- i = mpeg2subt->packet_size;
- break;
- case 0x03: /* palette */
- mpeg2subt->color[0] = yuv_color[buffer [i+1] >> 4];
- mpeg2subt->color[1] = yuv_color[buffer [i+1] & 0xf];
- mpeg2subt->color[2] = yuv_color[buffer [i+2] >> 4];
- mpeg2subt->color[3] = yuv_color[buffer [i+2] & 0xf];
- mpeg2subt->color[4] = yuv_color[0xf];
- GST_DEBUG ("mpeg2subt: colors %d %d %d %d", mpeg2subt->color[0],mpeg2subt->color[1],mpeg2subt->color[2],mpeg2subt->color[3]);
- i += 3;
- break;
- case 0x04: /* transparency palette */
- mpeg2subt->trans[3] = buffer [i+1] >> 4;
- mpeg2subt->trans[2] = buffer [i+1] & 0xf;
- mpeg2subt->trans[1] = buffer [i+2] >> 4;
- mpeg2subt->trans[0] = buffer [i+2] & 0xf;
- GST_DEBUG ("mpeg2subt: transparency %d %d %d %d", mpeg2subt->trans[0],mpeg2subt->trans[1],mpeg2subt->trans[2],mpeg2subt->trans[3]);
+ while (i < mpeg2subt->packet_size) {
+ dummy = buffer[i];
+ switch (dummy) {
+ case 0x01: /* null packet ? */
+ i++;
+ break;
+ case 0x02: /* 02 ff (ff) is the end of the packet */
+ i = mpeg2subt->packet_size;
+ break;
+ case 0x03: /* palette */
+ mpeg2subt->color[0] = yuv_color[buffer[i + 1] >> 4];
+ mpeg2subt->color[1] = yuv_color[buffer[i + 1] & 0xf];
+ mpeg2subt->color[2] = yuv_color[buffer[i + 2] >> 4];
+ mpeg2subt->color[3] = yuv_color[buffer[i + 2] & 0xf];
+ mpeg2subt->color[4] = yuv_color[0xf];
+ GST_DEBUG ("mpeg2subt: colors %d %d %d %d", mpeg2subt->color[0],
+ mpeg2subt->color[1], mpeg2subt->color[2], mpeg2subt->color[3]);
i += 3;
break;
- case 0x05: /* image coordinates */
- mpeg2subt->width = 1 + ( ((buffer[i+2] & 0x0f) << 8) + buffer[i+3] )
- - ( (((unsigned int)buffer[i+1]) << 4) + (buffer[i+2] >> 4) );
- mpeg2subt->height = 1 + ( ((buffer[i+5] & 0x0f) << 8) + buffer[i+6] )
- - ( (((unsigned int)buffer[i+4]) << 4) + (buffer[i+5] >> 4) );
- i += 7;
+ case 0x04: /* transparency palette */
+ mpeg2subt->trans[3] = buffer[i + 1] >> 4;
+ mpeg2subt->trans[2] = buffer[i + 1] & 0xf;
+ mpeg2subt->trans[1] = buffer[i + 2] >> 4;
+ mpeg2subt->trans[0] = buffer[i + 2] & 0xf;
+ GST_DEBUG ("mpeg2subt: transparency %d %d %d %d", mpeg2subt->trans[0],
+ mpeg2subt->trans[1], mpeg2subt->trans[2], mpeg2subt->trans[3]);
+ i += 3;
break;
- case 0x06: /* image 1 / image 2 offsets */
- mpeg2subt->offset[0] = (((unsigned int)buffer[i+1]) << 8) + buffer[i+2];
- mpeg2subt->offset[1] = (((unsigned int)buffer[i+3]) << 8) + buffer[i+4];
+ case 0x05: /* image coordinates */
+ mpeg2subt->width = 1 + (((buffer[i + 2] & 0x0f) << 8) + buffer[i + 3])
+ - ((((unsigned int) buffer[i + 1]) << 4) + (buffer[i + 2] >> 4));
+ mpeg2subt->height = 1 + (((buffer[i + 5] & 0x0f) << 8) + buffer[i + 6])
+ - ((((unsigned int) buffer[i + 4]) << 4) + (buffer[i + 5] >> 4));
+ i += 7;
+ break;
+ case 0x06: /* image 1 / image 2 offsets */
+ mpeg2subt->offset[0] =
+ (((unsigned int) buffer[i + 1]) << 8) + buffer[i + 2];
+ mpeg2subt->offset[1] =
+ (((unsigned int) buffer[i + 3]) << 8) + buffer[i + 4];
i += 5;
break;
- case 0xff: /* "ff xx yy zz uu" with 'zz uu' == start of control packet
- * xx and yy are the end time in 90th/sec
- */
- mpeg2subt->duration = (((buffer[i+1] << 8) + buffer[i+2]) * 25)/90;
+ case 0xff: /* "ff xx yy zz uu" with 'zz uu' == start of control packet
+ * xx and yy are the end time in 90th/sec
+ */
+ mpeg2subt->duration =
+ (((buffer[i + 1] << 8) + buffer[i + 2]) * 25) / 90;
GST_DEBUG ("duration %d", mpeg2subt->duration);
- if ( (buffer[i+3] != buffer[mpeg2subt->data_size+2])
- || (buffer[i+4] != buffer[mpeg2subt->data_size+3]) )
- {
- g_print("mpeg2subt: invalid control header (%.2x%.2x != %.2x%.2x) !\n",
- buffer[i+3], buffer[i+4], buffer[mpeg2subt->data_size+2], buffer[mpeg2subt->data_size+3] );
+ if ((buffer[i + 3] != buffer[mpeg2subt->data_size + 2])
+ || (buffer[i + 4] != buffer[mpeg2subt->data_size + 3])) {
+ g_print
+ ("mpeg2subt: invalid control header (%.2x%.2x != %.2x%.2x) !\n",
+ buffer[i + 3], buffer[i + 4], buffer[mpeg2subt->data_size + 2],
+ buffer[mpeg2subt->data_size + 3]);
/* FIXME */
/* exit(1); */
}
i += 5;
break;
default:
- g_print("mpeg2subt: invalid sequence in control header (%.2x) !\n", dummy);
+ g_print ("mpeg2subt: invalid sequence in control header (%.2x) !\n",
+ dummy);
break;
}
}
}
static int
-get_nibble (guchar *buffer, gint *offset, gint id, gint *aligned)
+get_nibble (guchar * buffer, gint * offset, gint id, gint * aligned)
{
static int next;
- if (*aligned)
- {
+ if (*aligned) {
next = buffer[offset[id]];
offset[id]++;
*aligned = 0;
return next >> 4;
- }
- else
- {
+ } else {
*aligned = 1;
return next & 0xf;
}
}
static void
-gst_mpeg2subt_merge_title (GstMpeg2Subt *mpeg2subt, GstBuffer *buf)
+gst_mpeg2subt_merge_title (GstMpeg2Subt * mpeg2subt, GstBuffer * buf)
{
- gint x=0, y=0;
+ gint x = 0, y = 0;
gint width = mpeg2subt->width;
gint height = mpeg2subt->height;
- guchar *buffer = GST_BUFFER_DATA(mpeg2subt->partialbuf);
- guchar *target = GST_BUFFER_DATA(buf);
- gint id=0, aligned=1;
+ guchar *buffer = GST_BUFFER_DATA (mpeg2subt->partialbuf);
+ guchar *target = GST_BUFFER_DATA (buf);
+ gint id = 0, aligned = 1;
gint offset[2];
offset[0] = mpeg2subt->offset[0];
@@ -284,59 +293,57 @@ gst_mpeg2subt_merge_title (GstMpeg2Subt *mpeg2subt, GstBuffer *buf)
GST_DEBUG ("mpeg2subt: merging subtitle");
- while ((offset[1] < mpeg2subt->data_size + 2) && (y < height))
- {
+ while ((offset[1] < mpeg2subt->data_size + 2) && (y < height)) {
gint code;
gint length, colorid;
- code = get_nibble();
- if (code >= 0x4) /* 4 .. f */
- {
-found_code:
+ code = get_nibble ();
+ if (code >= 0x4) { /* 4 .. f */
+ found_code:
length = code >> 2;
colorid = code & 3;
while (length--)
- if (x++ < width) {
+ if (x++ < width) {
if (mpeg2subt->trans[colorid] != 0x0) {
- *target++ = mpeg2subt->color[colorid];
- }
- else target++;
+ *target++ = mpeg2subt->color[colorid];
+ } else
+ target++;
}
- if (x >= width)
- {
- if (!aligned)
- get_nibble ();
- goto next_line;
+ if (x >= width) {
+ if (!aligned)
+ get_nibble ();
+ goto next_line;
}
continue;
}
- code = (code << 4) + get_nibble();
- if (code >= 0x10) /* 1x .. 3x */
+ code = (code << 4) + get_nibble ();
+ if (code >= 0x10) /* 1x .. 3x */
goto found_code;
- code = (code << 4) + get_nibble();
- if (code >= 0x40) /* 04x .. 0fx */
+ code = (code << 4) + get_nibble ();
+ if (code >= 0x40) /* 04x .. 0fx */
goto found_code;
- code = (code << 4) + get_nibble();
- if (code >= 0x100) /* 01xx .. 03xx */
+ code = (code << 4) + get_nibble ();
+ if (code >= 0x100) /* 01xx .. 03xx */
goto found_code;
/* 00xx - should only happen for 00 00 */
if (!aligned)
- code = (code << 4) + get_nibble(); /* 0 0x xx */
+ code = (code << 4) + get_nibble (); /* 0 0x xx */
- if (code)
- {
- g_print("mpeg2subt: got unknown code 00%x (offset %x side %x, x=%d, y=%d)\n", code, mpeg2subt->offset[id], id, x, y);
+ if (code) {
+ g_print
+ ("mpeg2subt: got unknown code 00%x (offset %x side %x, x=%d, y=%d)\n",
+ code, mpeg2subt->offset[id], id, x, y);
goto next_line;
}
-next_line:
+ next_line:
/* aligned 00 00 */
if (y < height) {
- target+=(width-x);
+ target += (width - x);
x = 0;
y++;
id = 1 - id;
@@ -345,64 +352,67 @@ next_line:
}
static void
-gst_mpeg2subt_chain_subtitle (GstPad *pad, GstData *_data)
+gst_mpeg2subt_chain_subtitle (GstPad * pad, GstData * _data)
{
GstBuffer *buf = GST_BUFFER (_data);
GstMpeg2Subt *mpeg2subt;
guchar *data;
glong size = 0;
- g_return_if_fail(pad != NULL);
- g_return_if_fail(GST_IS_PAD(pad));
- g_return_if_fail(buf != NULL);
+ g_return_if_fail (pad != NULL);
+ g_return_if_fail (GST_IS_PAD (pad));
+ g_return_if_fail (buf != NULL);
/* g_return_if_fail(GST_IS_BUFFER(buf)); */
mpeg2subt = GST_MPEG2SUBT (GST_OBJECT_PARENT (pad));
if (mpeg2subt->have_title) {
- gst_buffer_unref(mpeg2subt->partialbuf);
+ gst_buffer_unref (mpeg2subt->partialbuf);
mpeg2subt->partialbuf = NULL;
mpeg2subt->have_title = FALSE;
}
- GST_DEBUG ("presentation time %" G_GUINT64_FORMAT, GST_BUFFER_TIMESTAMP(buf));
+ GST_DEBUG ("presentation time %" G_GUINT64_FORMAT,
+ GST_BUFFER_TIMESTAMP (buf));
/* deal with partial frame from previous buffer */
if (mpeg2subt->partialbuf) {
GstBuffer *merge;
- merge = gst_buffer_merge(mpeg2subt->partialbuf, buf);
+
+ merge = gst_buffer_merge (mpeg2subt->partialbuf, buf);
gst_buffer_unref (mpeg2subt->partialbuf);
- gst_buffer_unref(buf);
+ gst_buffer_unref (buf);
mpeg2subt->partialbuf = merge;
- }
- else {
+ } else {
mpeg2subt->partialbuf = buf;
}
- data = GST_BUFFER_DATA(mpeg2subt->partialbuf);
- size = GST_BUFFER_SIZE(mpeg2subt->partialbuf);
+ data = GST_BUFFER_DATA (mpeg2subt->partialbuf);
+ size = GST_BUFFER_SIZE (mpeg2subt->partialbuf);
- mpeg2subt->packet_size = GUINT16_FROM_BE(*(guint16 *)data);
+ mpeg2subt->packet_size = GUINT16_FROM_BE (*(guint16 *) data);
if (mpeg2subt->packet_size == size) {
- GST_DEBUG ("mpeg2subt: subtitle packet size %d, current size %ld", mpeg2subt->packet_size, size);
+ GST_DEBUG ("mpeg2subt: subtitle packet size %d, current size %ld",
+ mpeg2subt->packet_size, size);
- mpeg2subt->data_size = GUINT16_FROM_BE(*(guint16 *)(data+2));
+ mpeg2subt->data_size = GUINT16_FROM_BE (*(guint16 *) (data + 2));
- gst_mpeg2subt_parse_header(mpeg2subt);
+ gst_mpeg2subt_parse_header (mpeg2subt);
mpeg2subt->have_title = TRUE;
}
}
static void
-gst_mpeg2subt_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
+gst_mpeg2subt_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec)
{
GstMpeg2Subt *src;
/* it's not null if we got it, but it might not be ours */
- g_return_if_fail(GST_IS_MPEG2SUBT(object));
- src = GST_MPEG2SUBT(object);
+ g_return_if_fail (GST_IS_MPEG2SUBT (object));
+ src = GST_MPEG2SUBT (object);
switch (prop_id) {
default:
@@ -411,13 +421,14 @@ gst_mpeg2subt_set_property (GObject *object, guint prop_id, const GValue *value,
}
static void
-gst_mpeg2subt_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+gst_mpeg2subt_get_property (GObject * object, guint prop_id, GValue * value,
+ GParamSpec * pspec)
{
GstMpeg2Subt *src;
/* it's not null if we got it, but it might not be ours */
- g_return_if_fail(GST_IS_MPEG2SUBT(object));
- src = GST_MPEG2SUBT(object);
+ g_return_if_fail (GST_IS_MPEG2SUBT (object));
+ src = GST_MPEG2SUBT (object);
switch (prop_id) {
default:
@@ -426,20 +437,14 @@ gst_mpeg2subt_get_property (GObject *object, guint prop_id, GValue *value, GPara
}
static gboolean
-plugin_init (GstPlugin *plugin)
+plugin_init (GstPlugin * plugin)
{
- return gst_element_register(plugin, "mpeg2subt",
- GST_RANK_NONE, GST_TYPE_MPEG2SUBT);
+ return gst_element_register (plugin, "mpeg2subt",
+ GST_RANK_NONE, GST_TYPE_MPEG2SUBT);
}
-GST_PLUGIN_DEFINE (
- GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "mpeg2sub",
- "MPEG-2 video subtitle parser",
- plugin_init,
- VERSION,
- "LGPL",
- GST_PACKAGE,
- GST_ORIGIN
-)
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ "mpeg2sub",
+ "MPEG-2 video subtitle parser",
+ plugin_init, VERSION, "LGPL", GST_PACKAGE, GST_ORIGIN)
diff --git a/gst/mpeg2sub/gstmpeg2subt.h b/gst/mpeg2sub/gstmpeg2subt.h
index 29f60b278..5cde7058b 100644
--- a/gst/mpeg2sub/gstmpeg2subt.h
+++ b/gst/mpeg2sub/gstmpeg2subt.h
@@ -26,8 +26,9 @@
#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
+extern "C"
+{
+#endif /* __cplusplus */
#define GST_TYPE_MPEG2SUBT \
@@ -41,41 +42,43 @@ extern "C" {
#define GST_IS_MPEG2SUBT_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_MPEG2SUBT))
-typedef struct _GstMpeg2Subt GstMpeg2Subt;
-typedef struct _GstMpeg2SubtClass GstMpeg2SubtClass;
+ typedef struct _GstMpeg2Subt GstMpeg2Subt;
+ typedef struct _GstMpeg2SubtClass GstMpeg2SubtClass;
-struct _GstMpeg2Subt {
- GstElement element;
+ struct _GstMpeg2Subt
+ {
+ GstElement element;
- GstPad *videopad,*subtitlepad,*srcpad;
+ GstPad *videopad, *subtitlepad, *srcpad;
- GstBuffer *partialbuf; /* previous buffer (if carryover) */
+ GstBuffer *partialbuf; /* previous buffer (if carryover) */
- gboolean have_title;
+ gboolean have_title;
- guint16 packet_size;
- guint16 data_size;
+ guint16 packet_size;
+ guint16 data_size;
- gint offset[2];
- guchar color[5];
- guchar trans[4];
+ gint offset[2];
+ guchar color[5];
+ guchar trans[4];
- guint duration;
+ guint duration;
- gint width, height;
+ gint width, height;
-};
+ };
-struct _GstMpeg2SubtClass {
- GstElementClass parent_class;
-};
+ struct _GstMpeg2SubtClass
+ {
+ GstElementClass parent_class;
+ };
-GType gst_mpeg2subt_get_type(void);
+ GType gst_mpeg2subt_get_type (void);
#ifdef __cplusplus
}
-#endif /* __cplusplus */
+#endif /* __cplusplus */
-#endif /* __GST_MPEG2SUBT_H__ */
+#endif /* __GST_MPEG2SUBT_H__ */
diff --git a/gst/mpegaudioparse/gstmpegaudioparse.c b/gst/mpegaudioparse/gstmpegaudioparse.c
index aeed48f13..1e77bf42f 100644
--- a/gst/mpegaudioparse/gstmpegaudioparse.c
+++ b/gst/mpegaudioparse/gstmpegaudioparse.c
@@ -32,35 +32,30 @@ static GstElementDetails mp3parse_details = {
"Erik Walthinsen <omega@cse.ogi.edu>"
};
-static GstStaticPadTemplate mp3_src_template =
-GST_STATIC_PAD_TEMPLATE (
- "src",
+static GstStaticPadTemplate mp3_src_template = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/mpeg, "
- "mpegversion = (int) 1, "
- "layer = (int) [ 1, 3 ], "
- "rate = (int) [ 8000, 48000], "
- "channels = (int) [ 1, 2 ]")
-);
-
-static GstStaticPadTemplate mp3_sink_template =
-GST_STATIC_PAD_TEMPLATE (
- "sink",
+ "mpegversion = (int) 1, "
+ "layer = (int) [ 1, 3 ], "
+ "rate = (int) [ 8000, 48000], " "channels = (int) [ 1, 2 ]")
+ );
+
+static GstStaticPadTemplate mp3_sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("audio/mpeg, "
- "mpegversion = (int) 1"
- )
-);
+ GST_STATIC_CAPS ("audio/mpeg, " "mpegversion = (int) 1")
+ );
/* GstMPEGAudioParse signals and args */
-enum {
+enum
+{
/* FILL ME */
LAST_SIGNAL
};
-enum {
+enum
+{
ARG_0,
ARG_SKIP,
ARG_BIT_RATE,
@@ -68,63 +63,64 @@ enum {
};
-static void gst_mp3parse_class_init (GstMPEGAudioParseClass *klass);
-static void gst_mp3parse_base_init (GstMPEGAudioParseClass *klass);
-static void gst_mp3parse_init (GstMPEGAudioParse *mp3parse);
+static void gst_mp3parse_class_init (GstMPEGAudioParseClass * klass);
+static void gst_mp3parse_base_init (GstMPEGAudioParseClass * klass);
+static void gst_mp3parse_init (GstMPEGAudioParse * mp3parse);
-static void gst_mp3parse_chain (GstPad *pad,GstData *_data);
-static long bpf_from_header (GstMPEGAudioParse *parse, unsigned long header);
-static int head_check (unsigned long head);
+static void gst_mp3parse_chain (GstPad * pad, GstData * _data);
+static long bpf_from_header (GstMPEGAudioParse * parse, unsigned long header);
+static int head_check (unsigned long head);
-static void gst_mp3parse_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
-static void gst_mp3parse_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
-static GstElementStateReturn
- gst_mp3parse_change_state (GstElement *element);
+static void gst_mp3parse_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec);
+static void gst_mp3parse_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec);
+static GstElementStateReturn gst_mp3parse_change_state (GstElement * element);
static GstElementClass *parent_class = NULL;
+
/*static guint gst_mp3parse_signals[LAST_SIGNAL] = { 0 }; */
GType
-gst_mp3parse_get_type(void) {
+gst_mp3parse_get_type (void)
+{
static GType mp3parse_type = 0;
if (!mp3parse_type) {
static const GTypeInfo mp3parse_info = {
- sizeof(GstMPEGAudioParseClass),
- (GBaseInitFunc)gst_mp3parse_base_init,
+ sizeof (GstMPEGAudioParseClass),
+ (GBaseInitFunc) gst_mp3parse_base_init,
NULL,
- (GClassInitFunc)gst_mp3parse_class_init,
+ (GClassInitFunc) gst_mp3parse_class_init,
NULL,
NULL,
- sizeof(GstMPEGAudioParse),
+ sizeof (GstMPEGAudioParse),
0,
- (GInstanceInitFunc)gst_mp3parse_init,
+ (GInstanceInitFunc) gst_mp3parse_init,
};
mp3parse_type = g_type_register_static (GST_TYPE_ELEMENT,
- "GstMPEGAudioParse",
- &mp3parse_info, 0);
+ "GstMPEGAudioParse", &mp3parse_info, 0);
}
return mp3parse_type;
}
static guint mp3types_bitrates[2][3][16] =
-{ { {0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448, },
- {0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, },
- {0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, } },
- { {0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256, },
- {0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, },
- {0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, } },
+ { {{0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448,},
+ {0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384,},
+ {0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320,}},
+{{0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256,},
+ {0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160,},
+ {0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160,}},
};
-static guint mp3types_freqs[3][3] =
-{ {44100, 48000, 32000},
- {22050, 24000, 16000},
- {11025, 12000, 8000}};
+static guint mp3types_freqs[3][3] = { {44100, 48000, 32000},
+{22050, 24000, 16000},
+{11025, 12000, 8000}
+};
static inline guint
-mp3_type_frame_length_from_header (guint32 header, guint *put_layer,
- guint *put_channels, guint *put_bitrate,
- guint *put_samplerate)
+mp3_type_frame_length_from_header (guint32 header, guint * put_layer,
+ guint * put_channels, guint * put_bitrate, guint * put_samplerate)
{
guint length;
gulong mode, samplerate, bitrate, layer, channels, padding;
@@ -163,7 +159,7 @@ mp3_type_frame_length_from_header (guint32 header, guint *put_layer,
GST_DEBUG ("Calculated mp3 frame length of %u bytes", length);
GST_DEBUG ("samplerate = %lu, bitrate = %lu, layer = %lu, channels = %lu",
- samplerate, bitrate, layer, channels);
+ samplerate, bitrate, layer, channels);
if (put_layer)
*put_layer = layer;
@@ -204,8 +200,7 @@ mp3_type_frame_length_from_header (guint32 header, guint *put_layer,
#define GST_MP3_TYPEFIND_MIN_DATA (1440 * (GST_MP3_TYPEFIND_MIN_HEADERS + 1) - 1 + 3)
static GstCaps *
-mp3_caps_create (guint layer, guint channels,
- guint bitrate, guint samplerate)
+mp3_caps_create (guint layer, guint channels, guint bitrate, guint samplerate)
{
GstCaps *new;
@@ -216,15 +211,14 @@ mp3_caps_create (guint layer, guint channels,
new = gst_caps_new_simple ("audio/mpeg",
"mpegversion", G_TYPE_INT, 1,
- "layer", G_TYPE_INT, layer,
- "rate", G_TYPE_INT, samplerate,
- "channels", G_TYPE_INT, channels, NULL);
+ "layer", G_TYPE_INT, layer,
+ "rate", G_TYPE_INT, samplerate, "channels", G_TYPE_INT, channels, NULL);
return new;
}
static void
-gst_mp3parse_base_init (GstMPEGAudioParseClass *klass)
+gst_mp3parse_base_init (GstMPEGAudioParseClass * klass)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
@@ -236,22 +230,18 @@ gst_mp3parse_base_init (GstMPEGAudioParseClass *klass)
}
static void
-gst_mp3parse_class_init (GstMPEGAudioParseClass *klass)
+gst_mp3parse_class_init (GstMPEGAudioParseClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
- gobject_class = (GObjectClass*)klass;
- gstelement_class = (GstElementClass*)klass;
+ gobject_class = (GObjectClass *) klass;
+ gstelement_class = (GstElementClass *) klass;
- g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_SKIP,
- g_param_spec_int("skip","skip","skip",
- G_MININT,G_MAXINT,0,G_PARAM_READWRITE)); /* CHECKME */
- g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_BIT_RATE,
- g_param_spec_int("bitrate","Bitrate","Bit Rate",
- G_MININT,G_MAXINT,0,G_PARAM_READABLE)); /* CHECKME */
+ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SKIP, g_param_spec_int ("skip", "skip", "skip", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */
+ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BIT_RATE, g_param_spec_int ("bitrate", "Bitrate", "Bit Rate", G_MININT, G_MAXINT, 0, G_PARAM_READABLE)); /* CHECKME */
- parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
+ parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
gobject_class->set_property = gst_mp3parse_set_property;
gobject_class->get_property = gst_mp3parse_get_property;
@@ -260,18 +250,20 @@ gst_mp3parse_class_init (GstMPEGAudioParseClass *klass)
}
static void
-gst_mp3parse_init (GstMPEGAudioParse *mp3parse)
+gst_mp3parse_init (GstMPEGAudioParse * mp3parse)
{
- mp3parse->sinkpad = gst_pad_new_from_template(
- gst_static_pad_template_get (&mp3_sink_template), "sink");
- gst_element_add_pad(GST_ELEMENT(mp3parse),mp3parse->sinkpad);
-
- gst_pad_set_chain_function(mp3parse->sinkpad,gst_mp3parse_chain);
- gst_element_set_loop_function (GST_ELEMENT(mp3parse),NULL);
-
- mp3parse->srcpad = gst_pad_new_from_template(
- gst_static_pad_template_get (&mp3_src_template), "src");
- gst_element_add_pad(GST_ELEMENT(mp3parse),mp3parse->srcpad);
+ mp3parse->sinkpad =
+ gst_pad_new_from_template (gst_static_pad_template_get
+ (&mp3_sink_template), "sink");
+ gst_element_add_pad (GST_ELEMENT (mp3parse), mp3parse->sinkpad);
+
+ gst_pad_set_chain_function (mp3parse->sinkpad, gst_mp3parse_chain);
+ gst_element_set_loop_function (GST_ELEMENT (mp3parse), NULL);
+
+ mp3parse->srcpad =
+ gst_pad_new_from_template (gst_static_pad_template_get
+ (&mp3_src_template), "src");
+ gst_element_add_pad (GST_ELEMENT (mp3parse), mp3parse->srcpad);
gst_pad_use_explicit_caps (mp3parse->srcpad);
/*gst_pad_set_type_id(mp3parse->srcpad, mp3frametype); */
@@ -283,71 +275,71 @@ gst_mp3parse_init (GstMPEGAudioParse *mp3parse)
}
static void
-gst_mp3parse_chain (GstPad *pad, GstData *_data)
+gst_mp3parse_chain (GstPad * pad, GstData * _data)
{
GstBuffer *buf = GST_BUFFER (_data);
GstMPEGAudioParse *mp3parse;
guchar *data;
- glong size,offset = 0;
+ glong size, offset = 0;
guint32 header;
int bpf;
GstBuffer *outbuf;
guint64 last_ts;
- g_return_if_fail(pad != NULL);
- g_return_if_fail(GST_IS_PAD(pad));
- g_return_if_fail(buf != NULL);
+ g_return_if_fail (pad != NULL);
+ g_return_if_fail (GST_IS_PAD (pad));
+ g_return_if_fail (buf != NULL);
/* g_return_if_fail(GST_IS_BUFFER(buf)); */
mp3parse = GST_MP3PARSE (gst_pad_get_parent (pad));
- GST_DEBUG ("mp3parse: received buffer of %d bytes",GST_BUFFER_SIZE(buf));
+ GST_DEBUG ("mp3parse: received buffer of %d bytes", GST_BUFFER_SIZE (buf));
- last_ts = GST_BUFFER_TIMESTAMP(buf);
+ last_ts = GST_BUFFER_TIMESTAMP (buf);
/* FIXME, do flush */
/*
- if (mp3parse->partialbuf) {
- gst_buffer_unref(mp3parse->partialbuf);
- mp3parse->partialbuf = NULL;
- }
- mp3parse->in_flush = TRUE;
- */
+ if (mp3parse->partialbuf) {
+ gst_buffer_unref(mp3parse->partialbuf);
+ mp3parse->partialbuf = NULL;
+ }
+ mp3parse->in_flush = TRUE;
+ */
/* if we have something left from the previous frame */
if (mp3parse->partialbuf) {
GstBuffer *newbuf;
- newbuf = gst_buffer_merge(mp3parse->partialbuf, buf);
+ newbuf = gst_buffer_merge (mp3parse->partialbuf, buf);
/* and the one we received.. */
- gst_buffer_unref(buf);
- gst_buffer_unref(mp3parse->partialbuf);
+ gst_buffer_unref (buf);
+ gst_buffer_unref (mp3parse->partialbuf);
mp3parse->partialbuf = newbuf;
- }
- else {
+ } else {
mp3parse->partialbuf = buf;
}
- size = GST_BUFFER_SIZE(mp3parse->partialbuf);
- data = GST_BUFFER_DATA(mp3parse->partialbuf);
+ size = GST_BUFFER_SIZE (mp3parse->partialbuf);
+ data = GST_BUFFER_DATA (mp3parse->partialbuf);
/* while we still have bytes left -4 for the header */
- while (offset < size-4) {
+ while (offset < size - 4) {
int skipped = 0;
- GST_DEBUG ("mp3parse: offset %ld, size %ld ",offset, size);
+ GST_DEBUG ("mp3parse: offset %ld, size %ld ", offset, size);
/* search for a possible start byte */
- for (;((data[offset] != 0xff) && (offset < size));offset++) skipped++;
+ for (; ((data[offset] != 0xff) && (offset < size)); offset++)
+ skipped++;
if (skipped && !mp3parse->in_flush) {
- GST_DEBUG ("mp3parse: **** now at %ld skipped %d bytes",offset,skipped);
+ GST_DEBUG ("mp3parse: **** now at %ld skipped %d bytes", offset, skipped);
}
/* construct the header word */
- header = GUINT32_FROM_BE(*((guint32 *)(data+offset)));
+ header = GUINT32_FROM_BE (*((guint32 *) (data + offset)));
/* if it's a valid header, go ahead and send off the frame */
- if (head_check(header)) {
+ if (head_check (header)) {
/* calculate the bpf of the frame */
- bpf = bpf_from_header(mp3parse, header);
+ bpf = bpf_from_header (mp3parse, header);
/********************************************************************************
* robust seek support
@@ -361,107 +353,116 @@ gst_mp3parse_chain (GstPad *pad, GstData *_data)
* from previous frames. In this case, seeking may be more complicated because
* the frames are not independently coded.
********************************************************************************/
- if ( mp3parse->in_flush ) {
- guint32 header2;
+ if (mp3parse->in_flush) {
+ guint32 header2;
- if ((size-offset)<(bpf+4)) { if (mp3parse->in_flush) break; } /* wait until we have the the entire current frame as well as the next frame header */
-
- header2 = GUINT32_FROM_BE(*((guint32 *)(data+offset+bpf)));
- GST_DEBUG ("mp3parse: header=%08X, header2=%08X, bpf=%d", (unsigned int)header, (unsigned int)header2, bpf );
+ if ((size - offset) < (bpf + 4)) {
+ if (mp3parse->in_flush)
+ break;
+ }
+ /* wait until we have the the entire current frame as well as the next frame header */
+ header2 = GUINT32_FROM_BE (*((guint32 *) (data + offset + bpf)));
+ GST_DEBUG ("mp3parse: header=%08X, header2=%08X, bpf=%d",
+ (unsigned int) header, (unsigned int) header2, bpf);
/* mask the bits which are allowed to differ between frames */
#define HDRMASK ~((0xF << 12) /* bitrate */ | \
(0x1 << 9) /* padding */ | \
- (0x3 << 4)) /*mode extension*/
-
- if ( (header2&HDRMASK) != (header&HDRMASK) ) { /* require 2 matching headers in a row */
- GST_DEBUG ("mp3parse: next header doesn't match (header=%08X, header2=%08X, bpf=%d)", (unsigned int)header, (unsigned int)header2, bpf );
- offset++; /* This frame is invalid. Start looking for a valid frame at the next position in the stream */
- continue;
- }
+ (0x3 << 4)) /*mode extension */
+
+ if ((header2 & HDRMASK) != (header & HDRMASK)) { /* require 2 matching headers in a row */
+ GST_DEBUG
+ ("mp3parse: next header doesn't match (header=%08X, header2=%08X, bpf=%d)",
+ (unsigned int) header, (unsigned int) header2, bpf);
+ offset++; /* This frame is invalid. Start looking for a valid frame at the next position in the stream */
+ continue;
+ }
}
/* if we don't have the whole frame... */
if ((size - offset) < bpf) {
- GST_DEBUG ("mp3parse: partial buffer needed %ld < %d ",(size-offset), bpf);
+ GST_DEBUG ("mp3parse: partial buffer needed %ld < %d ", (size - offset),
+ bpf);
break;
} else {
- guint bitrate, layer, rate, channels;
-
- if (!mp3_type_frame_length_from_header (header, &layer,
- &channels,
- &bitrate, &rate)) {
- g_error("Header failed internal error");
- }
- if (channels != mp3parse->channels ||
- rate != mp3parse->rate ||
- layer != mp3parse->layer ||
- bitrate != mp3parse->bit_rate) {
- GstCaps *caps = mp3_caps_create (layer, channels, bitrate, rate);
-
- gst_pad_set_explicit_caps(mp3parse->srcpad, caps);
-
- mp3parse->channels = channels;
- mp3parse->layer = layer;
- mp3parse->rate = rate;
- mp3parse->bit_rate = bitrate;
- }
-
- outbuf = gst_buffer_create_sub(mp3parse->partialbuf,offset,bpf);
-
- offset += bpf;
+ guint bitrate, layer, rate, channels;
+
+ if (!mp3_type_frame_length_from_header (header, &layer,
+ &channels, &bitrate, &rate)) {
+ g_error ("Header failed internal error");
+ }
+ if (channels != mp3parse->channels ||
+ rate != mp3parse->rate ||
+ layer != mp3parse->layer || bitrate != mp3parse->bit_rate) {
+ GstCaps *caps = mp3_caps_create (layer, channels, bitrate, rate);
+
+ gst_pad_set_explicit_caps (mp3parse->srcpad, caps);
+
+ mp3parse->channels = channels;
+ mp3parse->layer = layer;
+ mp3parse->rate = rate;
+ mp3parse->bit_rate = bitrate;
+ }
+
+ outbuf = gst_buffer_create_sub (mp3parse->partialbuf, offset, bpf);
+
+ offset += bpf;
if (mp3parse->skip == 0) {
- GST_DEBUG ("mp3parse: pushing buffer of %d bytes",GST_BUFFER_SIZE(outbuf));
+ GST_DEBUG ("mp3parse: pushing buffer of %d bytes",
+ GST_BUFFER_SIZE (outbuf));
if (mp3parse->in_flush) {
/* FIXME do some sort of flush event */
mp3parse->in_flush = FALSE;
}
- GST_BUFFER_TIMESTAMP(outbuf) = last_ts;
- GST_BUFFER_DURATION(outbuf) = 8 * (GST_SECOND/1000) * GST_BUFFER_SIZE(outbuf) / mp3parse->bit_rate;
-
- if (GST_PAD_CAPS (mp3parse->srcpad) != NULL) {
- gst_pad_push(mp3parse->srcpad,GST_DATA (outbuf));
- } else {
- GST_DEBUG ("No capsnego yet, delaying buffer push");
- gst_buffer_unref (outbuf);
- }
- }
- else {
- GST_DEBUG ("mp3parse: skipping buffer of %d bytes",GST_BUFFER_SIZE(outbuf));
- gst_buffer_unref(outbuf);
+ GST_BUFFER_TIMESTAMP (outbuf) = last_ts;
+ GST_BUFFER_DURATION (outbuf) =
+ 8 * (GST_SECOND / 1000) * GST_BUFFER_SIZE (outbuf) /
+ mp3parse->bit_rate;
+
+ if (GST_PAD_CAPS (mp3parse->srcpad) != NULL) {
+ gst_pad_push (mp3parse->srcpad, GST_DATA (outbuf));
+ } else {
+ GST_DEBUG ("No capsnego yet, delaying buffer push");
+ gst_buffer_unref (outbuf);
+ }
+ } else {
+ GST_DEBUG ("mp3parse: skipping buffer of %d bytes",
+ GST_BUFFER_SIZE (outbuf));
+ gst_buffer_unref (outbuf);
mp3parse->skip--;
}
}
} else {
offset++;
- if (!mp3parse->in_flush) GST_DEBUG ("mp3parse: *** wrong header, skipping byte (FIXME?)");
+ if (!mp3parse->in_flush)
+ GST_DEBUG ("mp3parse: *** wrong header, skipping byte (FIXME?)");
}
}
/* if we have processed this block and there are still */
/* bytes left not in a partial block, copy them over. */
- if (size-offset > 0) {
+ if (size - offset > 0) {
glong remainder = (size - offset);
- GST_DEBUG ("mp3parse: partial buffer needed %ld for trailing bytes",remainder);
- outbuf = gst_buffer_create_sub(mp3parse->partialbuf,offset,remainder);
- gst_buffer_unref(mp3parse->partialbuf);
+ GST_DEBUG ("mp3parse: partial buffer needed %ld for trailing bytes",
+ remainder);
+
+ outbuf = gst_buffer_create_sub (mp3parse->partialbuf, offset, remainder);
+ gst_buffer_unref (mp3parse->partialbuf);
mp3parse->partialbuf = outbuf;
- }
- else {
- gst_buffer_unref(mp3parse->partialbuf);
+ } else {
+ gst_buffer_unref (mp3parse->partialbuf);
mp3parse->partialbuf = NULL;
}
}
static long
-bpf_from_header (GstMPEGAudioParse *parse, unsigned long header)
+bpf_from_header (GstMPEGAudioParse * parse, unsigned long header)
{
guint bitrate, layer, rate, channels, length;
if (!(length = mp3_type_frame_length_from_header (header, &layer,
- &channels,
- &bitrate, &rate))) {
+ &channels, &bitrate, &rate))) {
return 0;
}
@@ -471,40 +472,57 @@ bpf_from_header (GstMPEGAudioParse *parse, unsigned long header)
static gboolean
head_check (unsigned long head)
{
- GST_DEBUG ("checking mp3 header 0x%08lx",head);
+ GST_DEBUG ("checking mp3 header 0x%08lx", head);
/* if it's not a valid sync */
if ((head & 0xffe00000) != 0xffe00000) {
- GST_DEBUG ("invalid sync");return FALSE; }
+ GST_DEBUG ("invalid sync");
+ return FALSE;
+ }
/* if it's an invalid MPEG version */
if (((head >> 19) & 3) == 0x1) {
- GST_DEBUG ("invalid MPEG version");return FALSE; }
+ GST_DEBUG ("invalid MPEG version");
+ return FALSE;
+ }
/* if it's an invalid layer */
if (!((head >> 17) & 3)) {
- GST_DEBUG ("invalid layer");return FALSE; }
+ GST_DEBUG ("invalid layer");
+ return FALSE;
+ }
/* if it's an invalid bitrate */
if (((head >> 12) & 0xf) == 0x0) {
- GST_DEBUG ("invalid bitrate");return FALSE; }
+ GST_DEBUG ("invalid bitrate");
+ return FALSE;
+ }
if (((head >> 12) & 0xf) == 0xf) {
- GST_DEBUG ("invalid bitrate");return FALSE; }
+ GST_DEBUG ("invalid bitrate");
+ return FALSE;
+ }
/* if it's an invalid samplerate */
if (((head >> 10) & 0x3) == 0x3) {
- GST_DEBUG ("invalid samplerate");return FALSE; }
- if ((head & 0xffff0000) == 0xfffe0000) {
- GST_DEBUG ("invalid sync");return FALSE; }
+ GST_DEBUG ("invalid samplerate");
+ return FALSE;
+ }
+ if ((head & 0xffff0000) == 0xfffe0000) {
+ GST_DEBUG ("invalid sync");
+ return FALSE;
+ }
if (head & 0x00000002) {
- GST_DEBUG ("invalid emphasis");return FALSE; }
+ GST_DEBUG ("invalid emphasis");
+ return FALSE;
+ }
return TRUE;
}
static void
-gst_mp3parse_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
+gst_mp3parse_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec)
{
GstMPEGAudioParse *src;
/* it's not null if we got it, but it might not be ours */
- g_return_if_fail(GST_IS_MP3PARSE(object));
- src = GST_MP3PARSE(object);
+ g_return_if_fail (GST_IS_MP3PARSE (object));
+ src = GST_MP3PARSE (object);
switch (prop_id) {
case ARG_SKIP:
@@ -516,13 +534,14 @@ gst_mp3parse_set_property (GObject *object, guint prop_id, const GValue *value,
}
static void
-gst_mp3parse_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+gst_mp3parse_get_property (GObject * object, guint prop_id, GValue * value,
+ GParamSpec * pspec)
{
GstMPEGAudioParse *src;
/* it's not null if we got it, but it might not be ours */
- g_return_if_fail(GST_IS_MP3PARSE(object));
- src = GST_MP3PARSE(object);
+ g_return_if_fail (GST_IS_MP3PARSE (object));
+ src = GST_MP3PARSE (object);
switch (prop_id) {
case ARG_SKIP:
@@ -537,43 +556,39 @@ gst_mp3parse_get_property (GObject *object, guint prop_id, GValue *value, GParam
}
}
-static GstElementStateReturn
-gst_mp3parse_change_state (GstElement *element)
+static GstElementStateReturn
+gst_mp3parse_change_state (GstElement * element)
{
GstMPEGAudioParse *src;
- g_return_val_if_fail(GST_IS_MP3PARSE(element), GST_STATE_FAILURE);
- src = GST_MP3PARSE(element);
+ g_return_val_if_fail (GST_IS_MP3PARSE (element), GST_STATE_FAILURE);
+ src = GST_MP3PARSE (element);
switch (GST_STATE_TRANSITION (element)) {
case GST_STATE_PAUSED_TO_READY:
- src->channels = -1; src->rate = -1; src->layer = -1;
+ src->channels = -1;
+ src->rate = -1;
+ src->layer = -1;
break;
default:
break;
}
- if (GST_ELEMENT_CLASS(parent_class)->change_state)
- return GST_ELEMENT_CLASS(parent_class)->change_state(element);
+ if (GST_ELEMENT_CLASS (parent_class)->change_state)
+ return GST_ELEMENT_CLASS (parent_class)->change_state (element);
return GST_STATE_SUCCESS;
}
static gboolean
-plugin_init (GstPlugin *plugin)
+plugin_init (GstPlugin * plugin)
{
return gst_element_register (plugin, "mp3parse",
- GST_RANK_NONE, GST_TYPE_MP3PARSE);
+ GST_RANK_NONE, GST_TYPE_MP3PARSE);
}
-GST_PLUGIN_DEFINE (
- GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "mpegaudioparse",
- "MPEG-1 layer 1/2/3 audio parser",
- plugin_init,
- VERSION,
- "LGPL",
- GST_PACKAGE,
- GST_ORIGIN
-)
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ "mpegaudioparse",
+ "MPEG-1 layer 1/2/3 audio parser",
+ plugin_init, VERSION, "LGPL", GST_PACKAGE, GST_ORIGIN)
diff --git a/gst/mpegaudioparse/gstmpegaudioparse.h b/gst/mpegaudioparse/gstmpegaudioparse.h
index ce8121a03..812a6d56a 100644
--- a/gst/mpegaudioparse/gstmpegaudioparse.h
+++ b/gst/mpegaudioparse/gstmpegaudioparse.h
@@ -26,8 +26,9 @@
#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
+extern "C"
+{
+#endif /* __cplusplus */
#define GST_TYPE_MP3PARSE \
@@ -41,31 +42,33 @@ extern "C" {
#define GST_IS_MP3PARSE_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_MP3PARSE))
-typedef struct _GstMPEGAudioParse GstMPEGAudioParse;
-typedef struct _GstMPEGAudioParseClass GstMPEGAudioParseClass;
+ typedef struct _GstMPEGAudioParse GstMPEGAudioParse;
+ typedef struct _GstMPEGAudioParseClass GstMPEGAudioParseClass;
-struct _GstMPEGAudioParse {
- GstElement element;
+ struct _GstMPEGAudioParse
+ {
+ GstElement element;
- GstPad *sinkpad,*srcpad;
+ GstPad *sinkpad, *srcpad;
- GstBuffer *partialbuf; /* previous buffer (if carryover) */
- guint skip; /* number of frames to skip */
- guint bit_rate;
- gint channels, rate, layer;
- gboolean in_flush;
-};
+ GstBuffer *partialbuf; /* previous buffer (if carryover) */
+ guint skip; /* number of frames to skip */
+ guint bit_rate;
+ gint channels, rate, layer;
+ gboolean in_flush;
+ };
-struct _GstMPEGAudioParseClass {
- GstElementClass parent_class;
-};
+ struct _GstMPEGAudioParseClass
+ {
+ GstElementClass parent_class;
+ };
-GType gst_mp3parse_get_type(void);
+ GType gst_mp3parse_get_type (void);
#ifdef __cplusplus
}
-#endif /* __cplusplus */
+#endif /* __cplusplus */
-#endif /* __MP3PARSE_H__ */
+#endif /* __MP3PARSE_H__ */
diff --git a/gst/overlay/gstoverlay.c b/gst/overlay/gstoverlay.c
index fccd88b93..cf787e873 100644
--- a/gst/overlay/gstoverlay.c
+++ b/gst/overlay/gstoverlay.c
@@ -33,60 +33,59 @@ static GstElementDetails overlay_details = {
};
static GstStaticPadTemplate overlay_src_factory =
-GST_STATIC_PAD_TEMPLATE (
- "src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV("I420"))
-);
+GST_STATIC_PAD_TEMPLATE ("src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("I420"))
+ );
static GstStaticPadTemplate overlay_sink1_factory =
-GST_STATIC_PAD_TEMPLATE (
- "sink1",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV("I420"))
-);
+GST_STATIC_PAD_TEMPLATE ("sink1",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("I420"))
+ );
static GstStaticPadTemplate overlay_sink2_factory =
-GST_STATIC_PAD_TEMPLATE (
- "sink2",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV("I420"))
-);
+GST_STATIC_PAD_TEMPLATE ("sink2",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("I420"))
+ );
static GstStaticPadTemplate overlay_sink3_factory =
-GST_STATIC_PAD_TEMPLATE (
- "sink3",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV("I420"))
-);
+GST_STATIC_PAD_TEMPLATE ("sink3",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("I420"))
+ );
/* OVERLAY signals and args */
-enum {
+enum
+{
/* FILL ME */
LAST_SIGNAL
};
-enum {
+enum
+{
ARG_0,
};
-static void gst_overlay_class_init (GstOverlayClass *klass);
-static void gst_overlay_base_init (GstOverlayClass *klass);
-static void gst_overlay_init (GstOverlay *overlay);
+static void gst_overlay_class_init (GstOverlayClass * klass);
+static void gst_overlay_base_init (GstOverlayClass * klass);
+static void gst_overlay_init (GstOverlay * overlay);
-static void gst_overlay_loop (GstElement *element);
+static void gst_overlay_loop (GstElement * element);
-static void gst_overlay_set_property (GObject *object, guint prop_id,
- const GValue *value, GParamSpec *pspec);
-static void gst_overlay_get_property (GObject *object, guint prop_id,
- GValue *value, GParamSpec *pspec);
+static void gst_overlay_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec);
+static void gst_overlay_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec);
static GstElementClass *parent_class = NULL;
+
/*static guint gst_overlay_signals[LAST_SIGNAL] = { 0 }; */
static GType
@@ -96,47 +95,49 @@ gst_overlay_get_type (void)
if (!overlay_type) {
static const GTypeInfo overlay_info = {
- sizeof(GstOverlayClass),
- (GBaseInitFunc)gst_overlay_base_init,
+ sizeof (GstOverlayClass),
+ (GBaseInitFunc) gst_overlay_base_init,
NULL,
- (GClassInitFunc)gst_overlay_class_init,
+ (GClassInitFunc) gst_overlay_class_init,
NULL,
NULL,
- sizeof(GstOverlay),
+ sizeof (GstOverlay),
0,
- (GInstanceInitFunc)gst_overlay_init,
+ (GInstanceInitFunc) gst_overlay_init,
};
- overlay_type = g_type_register_static(GST_TYPE_ELEMENT, "GstOverlay", &overlay_info, 0);
+ overlay_type =
+ g_type_register_static (GST_TYPE_ELEMENT, "GstOverlay", &overlay_info,
+ 0);
}
return overlay_type;
}
static void
-gst_overlay_base_init (GstOverlayClass *klass)
+gst_overlay_base_init (GstOverlayClass * klass)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&overlay_sink1_factory));
+ gst_static_pad_template_get (&overlay_sink1_factory));
gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&overlay_sink2_factory));
+ gst_static_pad_template_get (&overlay_sink2_factory));
gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&overlay_sink3_factory));
+ gst_static_pad_template_get (&overlay_sink3_factory));
gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&overlay_src_factory));
+ gst_static_pad_template_get (&overlay_src_factory));
gst_element_class_set_details (element_class, &overlay_details);
}
static void
-gst_overlay_class_init (GstOverlayClass *klass)
+gst_overlay_class_init (GstOverlayClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
- gobject_class = (GObjectClass*)klass;
- gstelement_class = (GstElementClass*)klass;
+ gobject_class = (GObjectClass *) klass;
+ gstelement_class = (GstElementClass *) klass;
- parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
+ parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
gobject_class->set_property = gst_overlay_set_property;
gobject_class->get_property = gst_overlay_get_property;
@@ -144,29 +145,28 @@ gst_overlay_class_init (GstOverlayClass *klass)
}
#if 0
-static GstCaps *gst_overlay_getcaps(GstPad *pad)
+static GstCaps *
+gst_overlay_getcaps (GstPad * pad)
{
GstCaps *caps;
GstOverlay *overlay;
overlay = GST_OVERLAY (gst_pad_get_parent (pad));
- if(overlay->width && overlay->height){
- caps = GST_STATIC_CAPS (
- "overlay_sink2",
- "video/raw",
- "format", GST_TYPE_FOURCC (GST_MAKE_FOURCC ('I','4','2','0')),
- "width", G_TYPE_INT (overlay->width),
- "height", G_TYPE_INT (overlay->height)
- );
- }else{
- caps = GST_STATIC_CAPS (
- "overlay_sink2",
- "video/raw",
- "format", GST_TYPE_FOURCC (GST_MAKE_FOURCC ('I','4','2','0')),
- "width", G_TYPE_INT_RANGE (0, 4096),
- "height", G_TYPE_INT_RANGE (0, 4096)
- );
+ if (overlay->width && overlay->height) {
+ caps = GST_STATIC_CAPS ("overlay_sink2",
+ "video/raw",
+ "format", GST_TYPE_FOURCC (GST_MAKE_FOURCC ('I', '4', '2', '0')),
+ "width", G_TYPE_INT (overlay->width),
+ "height", G_TYPE_INT (overlay->height)
+ );
+ } else {
+ caps = GST_STATIC_CAPS ("overlay_sink2",
+ "video/raw",
+ "format", GST_TYPE_FOURCC (GST_MAKE_FOURCC ('I', '4', '2', '0')),
+ "width", G_TYPE_INT_RANGE (0, 4096),
+ "height", G_TYPE_INT_RANGE (0, 4096)
+ );
}
return caps;
@@ -174,7 +174,7 @@ static GstCaps *gst_overlay_getcaps(GstPad *pad)
#endif
static gboolean
-gst_overlay_sinkconnect (GstPad *pad, const GstCaps *caps)
+gst_overlay_sinkconnect (GstPad * pad, const GstCaps * caps)
{
GstOverlay *overlay;
GstStructure *structure;
@@ -183,80 +183,91 @@ gst_overlay_sinkconnect (GstPad *pad, const GstCaps *caps)
structure = gst_caps_get_structure (caps, 0);
- gst_structure_get_int (structure, "width", &overlay->width);
- gst_structure_get_int (structure, "height", &overlay->height);
- gst_structure_get_double (structure, "framerate", &overlay->framerate);
+ gst_structure_get_int (structure, "width", &overlay->width);
+ gst_structure_get_int (structure, "height", &overlay->height);
+ gst_structure_get_double (structure, "framerate", &overlay->framerate);
/* forward to the next plugin */
- return gst_pad_try_set_caps(overlay->srcpad, caps);
+ return gst_pad_try_set_caps (overlay->srcpad, caps);
}
-static void
-gst_overlay_init (GstOverlay *overlay)
+static void
+gst_overlay_init (GstOverlay * overlay)
{
- overlay->sinkpad1 = gst_pad_new_from_template (
- gst_static_pad_template_get (&overlay_sink1_factory), "sink1");
+ overlay->sinkpad1 =
+ gst_pad_new_from_template (gst_static_pad_template_get
+ (&overlay_sink1_factory), "sink1");
gst_pad_set_link_function (overlay->sinkpad1, gst_overlay_sinkconnect);
gst_element_add_pad (GST_ELEMENT (overlay), overlay->sinkpad1);
- overlay->sinkpad2 = gst_pad_new_from_template (
- gst_static_pad_template_get (&overlay_sink2_factory), "sink2");
+ overlay->sinkpad2 =
+ gst_pad_new_from_template (gst_static_pad_template_get
+ (&overlay_sink2_factory), "sink2");
gst_pad_set_link_function (overlay->sinkpad2, gst_overlay_sinkconnect);
gst_element_add_pad (GST_ELEMENT (overlay), overlay->sinkpad2);
- overlay->sinkpad3 = gst_pad_new_from_template (
- gst_static_pad_template_get (&overlay_sink3_factory), "sink3");
+ overlay->sinkpad3 =
+ gst_pad_new_from_template (gst_static_pad_template_get
+ (&overlay_sink3_factory), "sink3");
gst_pad_set_link_function (overlay->sinkpad3, gst_overlay_sinkconnect);
gst_element_add_pad (GST_ELEMENT (overlay), overlay->sinkpad3);
- overlay->srcpad = gst_pad_new_from_template (
- gst_static_pad_template_get (&overlay_src_factory), "src");
+ overlay->srcpad =
+ gst_pad_new_from_template (gst_static_pad_template_get
+ (&overlay_src_factory), "src");
gst_element_add_pad (GST_ELEMENT (overlay), overlay->srcpad);
gst_element_set_loop_function (GST_ELEMENT (overlay), gst_overlay_loop);
}
static void
-gst_overlay_blend_i420 (guint8 *out, guint8 *in1, guint8 *in2, guint8 *in3,
- gint width, gint height)
+gst_overlay_blend_i420 (guint8 * out, guint8 * in1, guint8 * in2, guint8 * in3,
+ gint width, gint height)
{
int mask;
int i, j;
- guint8 *in1u, *in1v, *in2u, *in2v, *outu, *outv;
+ guint8 *in1u, *in1v, *in2u, *in2v, *outu, *outv;
int lumsize;
int chromsize;
- int width2 = width/2;
- int height2 = height/2;
+ int width2 = width / 2;
+ int height2 = height / 2;
lumsize = width * height;
chromsize = width2 * height2;
- in1u = in1 + lumsize; in1v = in1u + chromsize;
- in2u = in2 + lumsize; in2v = in2u + chromsize;
- outu = out + lumsize; outv = outu + chromsize;
-
+ in1u = in1 + lumsize;
+ in1v = in1u + chromsize;
+ in2u = in2 + lumsize;
+ in2v = in2u + chromsize;
+ outu = out + lumsize;
+ outv = outu + chromsize;
+
for (i = 0; i < height; i++) {
for (j = 0; j < width; j++) {
- mask = in3[i*width + j];
- out[i*width+j] = ((in1[i*width+j] * mask) +
- (in2[i*width+j] * (255 - mask))) >> 8;
+ mask = in3[i * width + j];
+ out[i * width + j] = ((in1[i * width + j] * mask) +
+ (in2[i * width + j] * (255 - mask))) >> 8;
}
}
- for (i = 0; i < height/2; i++) {
- for (j = 0; j < width/2; j++) {
- mask = (in3[(i*2)*width + (j*2)] + in3[(i*2 + 1)*width + (j*2)] +
- in3[(i*2)*width + (j*2 + 1)] + in3[(i*2 + 1)*width + (j*2 + 1)]) / 4;
- outu[i*width2 + j] = ((in1u[i*width2+j] * mask) +
- (in2u[i*width2 + j] * (255 - mask))) >> 8;
- outv[i*width2 + j] = ((in1v[i*width2+j] * mask) +
- (in2v[i*width2 + j] * (255 - mask))) >> 8;
+ for (i = 0; i < height / 2; i++) {
+ for (j = 0; j < width / 2; j++) {
+ mask =
+ (in3[(i * 2) * width + (j * 2)] + in3[(i * 2 + 1) * width + (j * 2)] +
+ in3[(i * 2) * width + (j * 2 + 1)] + in3[(i * 2 + 1) * width +
+ (j * 2 + 1)]) / 4;
+ outu[i * width2 + j] =
+ ((in1u[i * width2 + j] * mask) + (in2u[i * width2 + j] * (255 -
+ mask))) >> 8;
+ outv[i * width2 + j] =
+ ((in1v[i * width2 + j] * mask) + (in2v[i * width2 + j] * (255 -
+ mask))) >> 8;
}
}
}
static void
-gst_overlay_loop (GstElement *element)
+gst_overlay_loop (GstElement * element)
{
GstOverlay *overlay;
GstBuffer *out;
@@ -284,22 +295,21 @@ gst_overlay_loop (GstElement *element)
return;
}
- g_return_if_fail(in1 != NULL);
- g_return_if_fail(in2 != NULL);
- g_return_if_fail(in3 != NULL);
+ g_return_if_fail (in1 != NULL);
+ g_return_if_fail (in2 != NULL);
+ g_return_if_fail (in3 != NULL);
- size = (overlay->width * overlay->height * 3)/2;
- g_return_if_fail(GST_BUFFER_SIZE(in1) != size);
- g_return_if_fail(GST_BUFFER_SIZE(in2) != size);
- g_return_if_fail(GST_BUFFER_SIZE(in3) != size);
+ size = (overlay->width * overlay->height * 3) / 2;
+ g_return_if_fail (GST_BUFFER_SIZE (in1) != size);
+ g_return_if_fail (GST_BUFFER_SIZE (in2) != size);
+ g_return_if_fail (GST_BUFFER_SIZE (in3) != size);
out = gst_buffer_new_and_alloc (size);
gst_overlay_blend_i420 (GST_BUFFER_DATA (out),
- GST_BUFFER_DATA (in1),
- GST_BUFFER_DATA (in2),
- GST_BUFFER_DATA (in3),
- overlay->width, overlay->height);
+ GST_BUFFER_DATA (in1),
+ GST_BUFFER_DATA (in2),
+ GST_BUFFER_DATA (in3), overlay->width, overlay->height);
GST_BUFFER_TIMESTAMP (out) = GST_BUFFER_TIMESTAMP (in1);
GST_BUFFER_DURATION (out) = GST_BUFFER_DURATION (in1);
@@ -312,12 +322,12 @@ gst_overlay_loop (GstElement *element)
}
static void
-gst_overlay_set_property (GObject *object, guint prop_id,
- const GValue *value, GParamSpec *pspec)
+gst_overlay_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec)
{
GstOverlay *overlay;
- overlay = GST_OVERLAY(object);
+ overlay = GST_OVERLAY (object);
switch (prop_id) {
default:
@@ -327,12 +337,12 @@ gst_overlay_set_property (GObject *object, guint prop_id,
}
static void
-gst_overlay_get_property (GObject *object, guint prop_id,
- GValue *value, GParamSpec *pspec)
+gst_overlay_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec)
{
GstOverlay *overlay;
- overlay = GST_OVERLAY(object);
+ overlay = GST_OVERLAY (object);
switch (prop_id) {
default:
@@ -343,20 +353,14 @@ gst_overlay_get_property (GObject *object, guint prop_id,
static gboolean
-plugin_init (GstPlugin *plugin)
+plugin_init (GstPlugin * plugin)
{
return gst_element_register (plugin, "overlay",
- GST_RANK_NONE, GST_TYPE_OVERLAY);
+ GST_RANK_NONE, GST_TYPE_OVERLAY);
}
-GST_PLUGIN_DEFINE (
- GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "overlay",
- "Overlay multiple video streams",
- plugin_init,
- VERSION,
- "LGPL",
- GST_PACKAGE,
- GST_ORIGIN
-)
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ "overlay",
+ "Overlay multiple video streams",
+ plugin_init, VERSION, "LGPL", GST_PACKAGE, GST_ORIGIN)
diff --git a/gst/overlay/gstoverlay.h b/gst/overlay/gstoverlay.h
index 523656e0a..377a25901 100644
--- a/gst/overlay/gstoverlay.h
+++ b/gst/overlay/gstoverlay.h
@@ -37,30 +37,32 @@
typedef struct _GstOverlay GstOverlay;
typedef struct _GstOverlayClass GstOverlayClass;
-struct _GstOverlay {
- GstElement element;
+struct _GstOverlay
+{
+ GstElement element;
- GstPad *srcpad;
- GstPad *sinkpad1;
- GstPad *sinkpad2;
- GstPad *sinkpad3;
+ GstPad *srcpad;
+ GstPad *sinkpad1;
+ GstPad *sinkpad2;
+ GstPad *sinkpad3;
- gint format;
- gint width;
- gint height;
+ gint format;
+ gint width;
+ gint height;
- gint duration;
- gint position;
+ gint duration;
+ gint position;
- gint type;
- gint fps;
- gint border;
- gint depth;
+ gint type;
+ gint fps;
+ gint border;
+ gint depth;
- gdouble framerate;
+ gdouble framerate;
};
-struct _GstOverlayClass {
+struct _GstOverlayClass
+{
GstElementClass parent_class;
};
diff --git a/gst/passthrough/gstpassthrough.c b/gst/passthrough/gstpassthrough.c
index 5bf97f161..37fecf787 100644
--- a/gst/passthrough/gstpassthrough.c
+++ b/gst/passthrough/gstpassthrough.c
@@ -34,68 +34,68 @@ static GstElementDetails passthrough_details = {
"Passthrough",
"Filter/Effect/Audio",
"Transparent filter for audio/raw (boilerplate for effects)",
- "Thomas <thomas@apestaart.org>, "\
- "Andy Wingo <apwingo@eos.ncsu.edu>"
+ "Thomas <thomas@apestaart.org>, " "Andy Wingo <apwingo@eos.ncsu.edu>"
};
-enum {
+enum
+{
/* FILL ME */
LAST_SIGNAL
};
/* static guint gst_filter_signals[LAST_SIGNAL] = { 0 }; */
-enum {
+enum
+{
ARG_0,
ARG_SILENT
};
static GstStaticPadTemplate passthrough_sink_template =
-GST_STATIC_PAD_TEMPLATE (
- "sink",
+ GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_STATIC_CAPS (
- GST_AUDIO_INT_PAD_TEMPLATE_CAPS "; "
- GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS
- )
-);
+ GST_STATIC_CAPS (GST_AUDIO_INT_PAD_TEMPLATE_CAPS "; "
+ GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS)
+ );
static GstStaticPadTemplate passthrough_src_template =
-GST_STATIC_PAD_TEMPLATE (
- "src",
+ GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_STATIC_CAPS (
- GST_AUDIO_INT_PAD_TEMPLATE_CAPS "; "
- GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS
- )
-);
+ GST_STATIC_CAPS (GST_AUDIO_INT_PAD_TEMPLATE_CAPS "; "
+ GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS)
+ );
-static void passthrough_class_init (GstPassthroughClass *klass);
-static void passthrough_base_init (GstPassthroughClass *klass);
-static void passthrough_init (GstPassthrough *filter);
+static void passthrough_class_init (GstPassthroughClass * klass);
+static void passthrough_base_init (GstPassthroughClass * klass);
+static void passthrough_init (GstPassthrough * filter);
-static void passthrough_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
-static void passthrough_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
+static void passthrough_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec);
+static void passthrough_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec);
-static GstPadLinkReturn passthrough_connect_sink (GstPad *pad, const GstCaps *caps);
+static GstPadLinkReturn passthrough_connect_sink (GstPad * pad,
+ const GstCaps * caps);
-static void passthrough_chain (GstPad *pad, GstData *_data);
-static void inline passthrough_fast_float_chain (gfloat* data, guint numsamples);
-static void inline passthrough_fast_16bit_chain (gint16* data, guint numsamples);
-static void inline passthrough_fast_8bit_chain (gint8* data, guint numsamples);
+static void passthrough_chain (GstPad * pad, GstData * _data);
+static void inline passthrough_fast_float_chain (gfloat * data,
+ guint numsamples);
+static void inline passthrough_fast_16bit_chain (gint16 * data,
+ guint numsamples);
+static void inline passthrough_fast_8bit_chain (gint8 * data, guint numsamples);
static GstElementClass *parent_class = NULL;
static GstPadLinkReturn
-passthrough_connect_sink (GstPad *pad, const GstCaps *caps)
+passthrough_connect_sink (GstPad * pad, const GstCaps * caps)
{
const gchar *mimetype;
GstPassthrough *filter;
GstStructure *structure;
-
- g_return_val_if_fail (pad != NULL, GST_PAD_LINK_DELAYED);
+
+ g_return_val_if_fail (pad != NULL, GST_PAD_LINK_DELAYED);
g_return_val_if_fail (caps != NULL, GST_PAD_LINK_DELAYED);
filter = GST_PASSTHROUGH (gst_pad_get_parent (pad));
@@ -105,27 +105,30 @@ passthrough_connect_sink (GstPad *pad, const GstCaps *caps)
structure = gst_caps_get_structure (caps, 0);
mimetype = gst_structure_get_name (structure);
- gst_structure_get_int (structure, "rate", &filter->rate);
- gst_structure_get_int (structure, "channels", &filter->channels);
- gst_structure_get_int (structure, "width", &filter->width);
- gst_structure_get_int (structure, "endianness", &filter->endianness);
+ gst_structure_get_int (structure, "rate", &filter->rate);
+ gst_structure_get_int (structure, "channels", &filter->channels);
+ gst_structure_get_int (structure, "width", &filter->width);
+ gst_structure_get_int (structure, "endianness", &filter->endianness);
if (strcmp (mimetype, "audio/x-raw-int") == 0) {
filter->format = GST_PASSTHROUGH_FORMAT_INT;
- gst_structure_get_int (structure, "depth", &filter->depth);
- gst_structure_get_boolean (structure, "signed", &filter->is_signed);
+ gst_structure_get_int (structure, "depth", &filter->depth);
+ gst_structure_get_boolean (structure, "signed", &filter->is_signed);
- if (! filter->silent) {
- g_print ("Passthrough : channels %d, rate %d\n", filter->channels, filter->rate);
- g_print ("Passthrough : format int, bit width %d, endianness %d, signed %s\n",
- filter->width, filter->endianness, filter->is_signed ? "yes" : "no");
+ if (!filter->silent) {
+ g_print ("Passthrough : channels %d, rate %d\n", filter->channels,
+ filter->rate);
+ g_print
+ ("Passthrough : format int, bit width %d, endianness %d, signed %s\n",
+ filter->width, filter->endianness, filter->is_signed ? "yes" : "no");
}
} else if (strcmp (mimetype, "audio/x-raw-float") == 0) {
filter->format = GST_PASSTHROUGH_FORMAT_FLOAT;
- if (! filter->silent) {
- g_print ("Passthrough : channels %d, rate %d\n", filter->channels, filter->rate);
+ if (!filter->silent) {
+ g_print ("Passthrough : channels %d, rate %d\n", filter->channels,
+ filter->rate);
g_print ("Passthrough : format float, width %d\n", filter->width);
}
}
@@ -150,13 +153,15 @@ gst_passthrough_get_type (void)
0,
(GInstanceInitFunc) passthrough_init,
};
- passthrough_type = g_type_register_static (GST_TYPE_ELEMENT, "GstPassthrough", &passthrough_info, 0);
+ passthrough_type =
+ g_type_register_static (GST_TYPE_ELEMENT, "GstPassthrough",
+ &passthrough_info, 0);
}
return passthrough_type;
}
static void
-passthrough_base_init (GstPassthroughClass *klass)
+passthrough_base_init (GstPassthroughClass * klass)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
@@ -168,103 +173,102 @@ passthrough_base_init (GstPassthroughClass *klass)
}
static void
-passthrough_class_init (GstPassthroughClass *klass)
+passthrough_class_init (GstPassthroughClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
- gobject_class = (GObjectClass*) klass;
- gstelement_class = (GstElementClass*) klass;
+ gobject_class = (GObjectClass *) klass;
+ gstelement_class = (GstElementClass *) klass;
- parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
+ parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
- g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_SILENT,
- g_param_spec_boolean("silent","silent","silent",
- TRUE, G_PARAM_READWRITE)); /* CHECKME */
+ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SILENT, g_param_spec_boolean ("silent", "silent", "silent", TRUE, G_PARAM_READWRITE)); /* CHECKME */
gobject_class->set_property = passthrough_set_property;
gobject_class->get_property = passthrough_get_property;
}
static void
-passthrough_init (GstPassthrough *filter)
+passthrough_init (GstPassthrough * filter)
{
- filter->srcpad = gst_pad_new_from_template (
- gst_static_pad_template_get (&passthrough_src_template), "src");
+ filter->srcpad =
+ gst_pad_new_from_template (gst_static_pad_template_get
+ (&passthrough_src_template), "src");
gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);
- filter->sinkpad = gst_pad_new_from_template (
- gst_static_pad_template_get (&passthrough_sink_template), "sink");
+ filter->sinkpad =
+ gst_pad_new_from_template (gst_static_pad_template_get
+ (&passthrough_sink_template), "sink");
gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
- gst_pad_set_link_function (filter->sinkpad, passthrough_connect_sink);
- gst_pad_set_chain_function (filter->sinkpad, passthrough_chain);
+ gst_pad_set_link_function (filter->sinkpad, passthrough_connect_sink);
+ gst_pad_set_chain_function (filter->sinkpad, passthrough_chain);
filter->silent = FALSE;
}
static void
-passthrough_chain (GstPad *pad, GstData *_data)
+passthrough_chain (GstPad * pad, GstData * _data)
{
GstBuffer *buf = GST_BUFFER (_data);
GstPassthrough *filter;
gint16 *int_data;
gfloat *float_data;
-
+
g_return_if_fail (pad != NULL);
g_return_if_fail (GST_IS_PAD (pad));
g_return_if_fail (buf != NULL);
-
+
filter = GST_PASSTHROUGH (gst_pad_get_parent (pad));
g_return_if_fail (filter != NULL);
g_return_if_fail (GST_IS_PASSTHROUGH (filter));
switch (filter->format) {
- case GST_PASSTHROUGH_FORMAT_INT:
- int_data = (gint16 *) GST_BUFFER_DATA (buf);
+ case GST_PASSTHROUGH_FORMAT_INT:
+ int_data = (gint16 *) GST_BUFFER_DATA (buf);
+
+ switch (filter->width) {
+ case 16:
+ passthrough_fast_16bit_chain (int_data, GST_BUFFER_SIZE (buf) / 2);
+ break;
+ case 8:
+ passthrough_fast_8bit_chain ((gint8 *) int_data,
+ GST_BUFFER_SIZE (buf));
+ break;
+ }
- switch (filter->width) {
- case 16:
- passthrough_fast_16bit_chain (int_data, GST_BUFFER_SIZE (buf) / 2);
break;
- case 8:
- passthrough_fast_8bit_chain ((gint8*) int_data, GST_BUFFER_SIZE (buf));
- break;
- }
+ case GST_PASSTHROUGH_FORMAT_FLOAT:
+ float_data = (gfloat *) GST_BUFFER_DATA (buf);
- break;
- case GST_PASSTHROUGH_FORMAT_FLOAT:
- float_data = (gfloat *) GST_BUFFER_DATA (buf);
-
- passthrough_fast_float_chain (float_data, GST_BUFFER_SIZE (buf) / sizeof (gfloat));
-
- break;
+ passthrough_fast_float_chain (float_data,
+ GST_BUFFER_SIZE (buf) / sizeof (gfloat));
+
+ break;
}
-
+
gst_pad_push (filter->srcpad, GST_DATA (buf));
}
static void inline
-passthrough_fast_float_chain(gfloat* data, guint num_samples)
+passthrough_fast_float_chain (gfloat * data, guint num_samples)
#include "filter.func"
-
-static void inline
-passthrough_fast_16bit_chain(gint16* data, guint num_samples)
+ static void inline
+ passthrough_fast_16bit_chain (gint16 * data, guint num_samples)
#include "filter.func"
-
-static void inline
-passthrough_fast_8bit_chain(gint8* data, guint num_samples)
+ static void inline
+ passthrough_fast_8bit_chain (gint8 * data, guint num_samples)
#include "filter.func"
-
-static void
-passthrough_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
+ static void
+ passthrough_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec)
{
GstPassthrough *filter;
g_return_if_fail (GST_IS_PASSTHROUGH (object));
filter = GST_PASSTHROUGH (object);
- switch (prop_id)
- {
+ switch (prop_id) {
case ARG_SILENT:
filter->silent = g_value_get_boolean (value);
break;
@@ -274,7 +278,8 @@ passthrough_set_property (GObject *object, guint prop_id, const GValue *value, G
}
static void
-passthrough_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+passthrough_get_property (GObject * object, guint prop_id, GValue * value,
+ GParamSpec * pspec)
{
GstPassthrough *filter;
@@ -292,20 +297,14 @@ passthrough_get_property (GObject *object, guint prop_id, GValue *value, GParamS
}
static gboolean
-plugin_init (GstPlugin *plugin)
+plugin_init (GstPlugin * plugin)
{
return gst_element_register (plugin, "passthrough",
- GST_RANK_NONE, GST_TYPE_PASSTHROUGH);
+ GST_RANK_NONE, GST_TYPE_PASSTHROUGH);
}
-GST_PLUGIN_DEFINE (
- GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "passthrough",
- "Transparent filter for audio/raw (boilerplate for effects)",
- plugin_init,
- VERSION,
- "LGPL",
- GST_PACKAGE,
- GST_ORIGIN
-)
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ "passthrough",
+ "Transparent filter for audio/raw (boilerplate for effects)",
+ plugin_init, VERSION, "LGPL", GST_PACKAGE, GST_ORIGIN)
diff --git a/gst/passthrough/gstpassthrough.h b/gst/passthrough/gstpassthrough.h
index 0b6f9d589..c8da5dea0 100644
--- a/gst/passthrough/gstpassthrough.h
+++ b/gst/passthrough/gstpassthrough.h
@@ -25,7 +25,6 @@
#include <gst/gst.h>
G_BEGIN_DECLS
-
#define GST_TYPE_PASSTHROUGH \
(gst_passthrough_get_type())
#define GST_PASSTHROUGH(obj) \
@@ -36,17 +35,18 @@ G_BEGIN_DECLS
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_PASSTHROUGH))
#define GST_IS_PASSTHROUGH_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_PASSTHROUGH))
-
typedef struct _GstPassthrough GstPassthrough;
typedef struct _GstPassthroughClass GstPassthroughClass;
-typedef enum _GstPassthroughFormat GstPassthroughFormat;
+typedef enum _GstPassthroughFormat GstPassthroughFormat;
-enum _GstPassthroughFormat {
+enum _GstPassthroughFormat
+{
GST_PASSTHROUGH_FORMAT_INT,
GST_PASSTHROUGH_FORMAT_FLOAT
};
-struct _GstPassthrough {
+struct _GstPassthrough
+{
GstElement element;
GstPad *sinkpad, *srcpad;
@@ -66,12 +66,12 @@ struct _GstPassthrough {
gboolean is_signed;
};
-struct _GstPassthroughClass {
+struct _GstPassthroughClass
+{
GstElementClass parent_class;
};
-GType gst_passthrough_get_type(void);
+GType gst_passthrough_get_type (void);
G_END_DECLS
-
#endif /* __GST_PASSTHROUGH_H__ */
diff --git a/gst/playondemand/demo-mp3.c b/gst/playondemand/demo-mp3.c
index 6e404a15c..907f7379b 100644
--- a/gst/playondemand/demo-mp3.c
+++ b/gst/playondemand/demo-mp3.c
@@ -16,81 +16,84 @@ GstClock *element_clock;
guint32 *beats;
void
-played (GstElement *pod, gpointer data)
+played (GstElement * pod, gpointer data)
{
gint i;
- g_print("Played beat at %02u, beats are ",
- (guint) (gst_clock_get_time(element_clock) / GST_SECOND *
- (GTK_ADJUSTMENT(speed_adj))->value) % NUM_BEATS);
+ g_print ("Played beat at %02u, beats are ",
+ (guint) (gst_clock_get_time (element_clock) / GST_SECOND *
+ (GTK_ADJUSTMENT (speed_adj))->value) % NUM_BEATS);
- for (i = 0; i <= NUM_BEATS / 32; i++) g_print ("%08x ", beats[i]);
+ for (i = 0; i <= NUM_BEATS / 32; i++)
+ g_print ("%08x ", beats[i]);
- g_print("\n");
+ g_print ("\n");
}
void
-play (GtkButton *button, gpointer data)
+play (GtkButton * button, gpointer data)
{
- g_signal_emit_by_name(G_OBJECT(pod), "play", NULL, NULL);
+ g_signal_emit_by_name (G_OBJECT (pod), "play", NULL, NULL);
}
void
-clear (GtkButton *button, gpointer data)
+clear (GtkButton * button, gpointer data)
{
- g_signal_emit_by_name(G_OBJECT(pod), "clear", NULL, NULL);
+ g_signal_emit_by_name (G_OBJECT (pod), "clear", NULL, NULL);
}
void
-reset (GtkButton *button, gpointer data)
+reset (GtkButton * button, gpointer data)
{
guint i;
- g_signal_emit_by_name(G_OBJECT(pod), "reset", NULL, NULL);
+
+ g_signal_emit_by_name (G_OBJECT (pod), "reset", NULL, NULL);
for (i = 0; i < NUM_BEATS; i++)
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(beat_button[i]), 0);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (beat_button[i]), 0);
}
void
-beat (GtkToggleButton *button, gpointer data)
+beat (GtkToggleButton * button, gpointer data)
{
- guint b = GPOINTER_TO_UINT(data);
+ guint b = GPOINTER_TO_UINT (data);
- if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)))
beats[b / 32] |= 1 << (b % 32);
else
- beats[b / 32] &= ~ (1 << (b % 32));
+ beats[b / 32] &= ~(1 << (b % 32));
}
void
-speed (GtkAdjustment *adjustment, gpointer data)
+speed (GtkAdjustment * adjustment, gpointer data)
{
- /*g_signal_stop_emission_by_name(G_OBJECT(pod), "deep-notify");*/
- g_object_set(G_OBJECT(pod), "tick-rate", TICK_RATE(adjustment->value), NULL);
- /*gst_clock_set_speed(element_clock, adjustment->value);*/
+ /*g_signal_stop_emission_by_name(G_OBJECT(pod), "deep-notify"); */
+ g_object_set (G_OBJECT (pod), "tick-rate", TICK_RATE (adjustment->value),
+ NULL);
+ /*gst_clock_set_speed(element_clock, adjustment->value); */
}
void
-setup_pipeline (gchar *filename)
+setup_pipeline (gchar * filename)
{
- src = gst_element_factory_make("filesrc", "source");
- dec = gst_element_factory_make("vorbisfile", "decoder");
- pod = gst_element_factory_make("playondemand", "sequencer");
- sink = gst_element_factory_make("alsasink", "sink");
+ src = gst_element_factory_make ("filesrc", "source");
+ dec = gst_element_factory_make ("vorbisfile", "decoder");
+ pod = gst_element_factory_make ("playondemand", "sequencer");
+ sink = gst_element_factory_make ("alsasink", "sink");
- g_object_set(G_OBJECT (src), "location", filename, NULL);
- g_object_set(G_OBJECT (sink), "period-count", 64, "period-size", 512, NULL);
- g_object_set(G_OBJECT (pod), "total-ticks", NUM_BEATS,
- "tick-rate", 1.0e-6, "max-plays", NUM_BEATS * 2, NULL);
+ g_object_set (G_OBJECT (src), "location", filename, NULL);
+ g_object_set (G_OBJECT (sink), "period-count", 64, "period-size", 512, NULL);
+ g_object_set (G_OBJECT (pod), "total-ticks", NUM_BEATS,
+ "tick-rate", 1.0e-6, "max-plays", NUM_BEATS * 2, NULL);
- g_object_get(G_OBJECT (pod), "ticks", &beats, NULL);
+ g_object_get (G_OBJECT (pod), "ticks", &beats, NULL);
- pipeline = gst_pipeline_new("app");
+ pipeline = gst_pipeline_new ("app");
- gst_bin_add_many(GST_BIN (pipeline), src, dec, pod, sink, NULL);
- gst_element_link_many(src, dec, pod, sink, NULL);
+ gst_bin_add_many (GST_BIN (pipeline), src, dec, pod, sink, NULL);
+ gst_element_link_many (src, dec, pod, sink, NULL);
- element_clock = gst_element_get_clock(GST_ELEMENT (sink));
- gst_element_set_clock(GST_ELEMENT (pod), element_clock);
+ element_clock = gst_element_get_clock (GST_ELEMENT (sink));
+ gst_element_set_clock (GST_ELEMENT (pod), element_clock);
}
void
@@ -98,78 +101,84 @@ setup_gui (void)
{
guint i;
- beat_button = g_new(GtkWidget *, NUM_BEATS);
+ beat_button = g_new (GtkWidget *, NUM_BEATS);
/* initialize gui elements ... */
- window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
- gtk_container_set_border_width(GTK_CONTAINER(window), 12);
+ window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+ gtk_container_set_border_width (GTK_CONTAINER (window), 12);
- vbox = gtk_vbox_new(TRUE, 0);
- gtk_box_set_spacing(GTK_BOX(vbox), 12);
+ vbox = gtk_vbox_new (TRUE, 0);
+ gtk_box_set_spacing (GTK_BOX (vbox), 12);
- beat_box = gtk_hbox_new(TRUE, 0);
- button_box = gtk_hbox_new(TRUE, 0);
+ beat_box = gtk_hbox_new (TRUE, 0);
+ button_box = gtk_hbox_new (TRUE, 0);
- play_button = gtk_button_new_with_label("Play");
- clear_button = gtk_button_new_with_label("Reset Sound");
- reset_button = gtk_button_new_with_label("Reset All");
- quit_button = gtk_button_new_with_label("Quit");
+ play_button = gtk_button_new_with_label ("Play");
+ clear_button = gtk_button_new_with_label ("Reset Sound");
+ reset_button = gtk_button_new_with_label ("Reset All");
+ quit_button = gtk_button_new_with_label ("Quit");
for (i = 0; i < NUM_BEATS; i++)
- beat_button[i] = gtk_toggle_button_new_with_label(g_strdup_printf("%2d", i+1));
+ beat_button[i] =
+ gtk_toggle_button_new_with_label (g_strdup_printf ("%2d", i + 1));
- speed_adj = gtk_adjustment_new(1, 0.0, 10.0, 0.1, 1.0, 0.0);
- speed_scale = gtk_hscale_new(GTK_ADJUSTMENT(speed_adj));
- gtk_scale_set_digits(GTK_SCALE(speed_scale), 4);
- gtk_range_set_update_policy(GTK_RANGE(speed_scale), GTK_UPDATE_DISCONTINUOUS);
+ speed_adj = gtk_adjustment_new (1, 0.0, 10.0, 0.1, 1.0, 0.0);
+ speed_scale = gtk_hscale_new (GTK_ADJUSTMENT (speed_adj));
+ gtk_scale_set_digits (GTK_SCALE (speed_scale), 4);
+ gtk_range_set_update_policy (GTK_RANGE (speed_scale),
+ GTK_UPDATE_DISCONTINUOUS);
/* do the packing stuff ... */
- gtk_window_set_default_size(GTK_WINDOW(window), 96, 96);
- gtk_container_add(GTK_CONTAINER(window), vbox);
+ gtk_window_set_default_size (GTK_WINDOW (window), 96, 96);
+ gtk_container_add (GTK_CONTAINER (window), vbox);
- gtk_box_pack_start(GTK_BOX(button_box), play_button, TRUE, TRUE, 2);
- gtk_box_pack_start(GTK_BOX(button_box), clear_button, TRUE, TRUE, 2);
- gtk_box_pack_start(GTK_BOX(button_box), reset_button, TRUE, TRUE, 2);
- gtk_box_pack_start(GTK_BOX(button_box), quit_button, TRUE, TRUE, 2);
+ gtk_box_pack_start (GTK_BOX (button_box), play_button, TRUE, TRUE, 2);
+ gtk_box_pack_start (GTK_BOX (button_box), clear_button, TRUE, TRUE, 2);
+ gtk_box_pack_start (GTK_BOX (button_box), reset_button, TRUE, TRUE, 2);
+ gtk_box_pack_start (GTK_BOX (button_box), quit_button, TRUE, TRUE, 2);
for (i = 0; i < NUM_BEATS; i++)
- gtk_box_pack_start(GTK_BOX(beat_box), beat_button[i], TRUE, TRUE, 2);
+ gtk_box_pack_start (GTK_BOX (beat_box), beat_button[i], TRUE, TRUE, 2);
- gtk_box_pack_start(GTK_BOX(vbox), button_box, TRUE, FALSE, 2);
- gtk_box_pack_start(GTK_BOX(vbox), beat_box, TRUE, FALSE, 2);
- gtk_box_pack_start(GTK_BOX(vbox), speed_scale, TRUE, FALSE, 2);
+ gtk_box_pack_start (GTK_BOX (vbox), button_box, TRUE, FALSE, 2);
+ gtk_box_pack_start (GTK_BOX (vbox), beat_box, TRUE, FALSE, 2);
+ gtk_box_pack_start (GTK_BOX (vbox), speed_scale, TRUE, FALSE, 2);
/* connect things ... */
- g_signal_connect(G_OBJECT(play_button), "clicked", G_CALLBACK(play), NULL);
- g_signal_connect(G_OBJECT(clear_button), "clicked", G_CALLBACK(clear), NULL);
- g_signal_connect(G_OBJECT(reset_button), "clicked", G_CALLBACK(reset), NULL);
- g_signal_connect(G_OBJECT(quit_button), "clicked", gtk_main_quit, NULL);
- g_signal_connect(G_OBJECT(pod), "played", G_CALLBACK(played), NULL);
- g_signal_connect(G_OBJECT(speed_adj), "value_changed", G_CALLBACK(speed), NULL);
+ g_signal_connect (G_OBJECT (play_button), "clicked", G_CALLBACK (play), NULL);
+ g_signal_connect (G_OBJECT (clear_button), "clicked", G_CALLBACK (clear),
+ NULL);
+ g_signal_connect (G_OBJECT (reset_button), "clicked", G_CALLBACK (reset),
+ NULL);
+ g_signal_connect (G_OBJECT (quit_button), "clicked", gtk_main_quit, NULL);
+ g_signal_connect (G_OBJECT (pod), "played", G_CALLBACK (played), NULL);
+ g_signal_connect (G_OBJECT (speed_adj), "value_changed", G_CALLBACK (speed),
+ NULL);
for (i = 0; i < NUM_BEATS; i++)
- g_signal_connect(G_OBJECT(beat_button[i]), "toggled", G_CALLBACK(beat), GUINT_TO_POINTER(i));
+ g_signal_connect (G_OBJECT (beat_button[i]), "toggled", G_CALLBACK (beat),
+ GUINT_TO_POINTER (i));
/* show the gui. */
- gtk_widget_show_all(window);
+ gtk_widget_show_all (window);
- gtk_idle_add((GtkFunction)gst_bin_iterate, pipeline);
+ gtk_idle_add ((GtkFunction) gst_bin_iterate, pipeline);
}
int
-main(int argc, char **argv)
+main (int argc, char **argv)
{
gst_init (&argc, &argv);
gtk_init (&argc, &argv);
- if (argc!=2) {
- g_print("usage: %s <mp3-filename>\n", argv[0]);
- exit(-1);
+ if (argc != 2) {
+ g_print ("usage: %s <mp3-filename>\n", argv[0]);
+ exit (-1);
}
- setup_pipeline(argv[1]);
- gst_element_set_state(pipeline, GST_STATE_PLAYING);
- setup_gui();
- gtk_main();
- g_free(beat_button);
+ setup_pipeline (argv[1]);
+ gst_element_set_state (pipeline, GST_STATE_PLAYING);
+ setup_gui ();
+ gtk_main ();
+ g_free (beat_button);
return 0;
}
diff --git a/gst/playondemand/gstplayondemand.c b/gst/playondemand/gstplayondemand.c
index 3313599ca..b3d8d9093 100644
--- a/gst/playondemand/gstplayondemand.c
+++ b/gst/playondemand/gstplayondemand.c
@@ -32,9 +32,9 @@
* way beyond what a real computer can actually keep track of, but hey ... */
/* some default values */
-#define GST_POD_MAX_PLAYS 100 /* maximum simultaneous plays */
-#define GST_POD_BUFFER_TIME 5.0 /* buffer length in seconds */
-#define GST_POD_TICK_RATE 1e-6 /* ticks per second */
+#define GST_POD_MAX_PLAYS 100 /* maximum simultaneous plays */
+#define GST_POD_BUFFER_TIME 5.0 /* buffer length in seconds */
+#define GST_POD_TICK_RATE 1e-6 /* ticks per second */
/* buffer pool fallback values ... use if no buffer pool is available */
#define GST_POD_BUFPOOL_SIZE 4096
@@ -50,77 +50,75 @@ static GstElementDetails play_on_demand_details = {
static GstStaticPadTemplate play_on_demand_sink_template =
-GST_STATIC_PAD_TEMPLATE (
- "sink",
+ GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_STATIC_CAPS (
- GST_AUDIO_INT_PAD_TEMPLATE_CAPS "; "
- GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS
- )
-);
+ GST_STATIC_CAPS (GST_AUDIO_INT_PAD_TEMPLATE_CAPS "; "
+ GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS)
+ );
static GstStaticPadTemplate play_on_demand_src_template =
-GST_STATIC_PAD_TEMPLATE (
- "src",
+ GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_STATIC_CAPS (
- GST_AUDIO_INT_PAD_TEMPLATE_CAPS "; "
- GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS
- )
-);
+ GST_STATIC_CAPS (GST_AUDIO_INT_PAD_TEMPLATE_CAPS "; "
+ GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS)
+ );
/* GObject functionality */
-static void play_on_demand_class_init (GstPlayOnDemandClass *klass);
-static void play_on_demand_base_init (GstPlayOnDemandClass *klass);
-static void play_on_demand_init (GstPlayOnDemand *filter);
-static void play_on_demand_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
-static void play_on_demand_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
-static void play_on_demand_dispose (GObject *object);
+static void play_on_demand_class_init (GstPlayOnDemandClass * klass);
+static void play_on_demand_base_init (GstPlayOnDemandClass * klass);
+static void play_on_demand_init (GstPlayOnDemand * filter);
+static void play_on_demand_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec);
+static void play_on_demand_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec);
+static void play_on_demand_dispose (GObject * object);
/* GStreamer functionality */
-static GstPadLinkReturn play_on_demand_pad_link (GstPad *pad, const GstCaps *caps);
-static void play_on_demand_loop (GstElement *elem);
-static void play_on_demand_set_clock (GstElement *elem, GstClock *clock);
+static GstPadLinkReturn play_on_demand_pad_link (GstPad * pad,
+ const GstCaps * caps);
+static void play_on_demand_loop (GstElement * elem);
+static void play_on_demand_set_clock (GstElement * elem, GstClock * clock);
/* signal handlers */
-static void play_on_demand_play_handler (GstElement *elem);
-static void play_on_demand_clear_handler (GstElement *elem);
-static void play_on_demand_reset_handler (GstElement *elem);
+static void play_on_demand_play_handler (GstElement * elem);
+static void play_on_demand_clear_handler (GstElement * elem);
+static void play_on_demand_reset_handler (GstElement * elem);
/* utility functions */
-static void play_on_demand_add_play_pointer (GstPlayOnDemand *filter, guint pos);
-static void play_on_demand_resize_buffer (GstPlayOnDemand *filter);
+static void play_on_demand_add_play_pointer (GstPlayOnDemand * filter,
+ guint pos);
+static void play_on_demand_resize_buffer (GstPlayOnDemand * filter);
GType
gst_play_on_demand_get_type (void)
{
static GType play_on_demand_type = 0;
- if (! play_on_demand_type) {
+ if (!play_on_demand_type) {
static const GTypeInfo play_on_demand_info = {
- sizeof(GstPlayOnDemandClass),
+ sizeof (GstPlayOnDemandClass),
(GBaseInitFunc) play_on_demand_base_init,
NULL,
(GClassInitFunc) play_on_demand_class_init,
NULL,
NULL,
- sizeof(GstPlayOnDemand),
+ sizeof (GstPlayOnDemand),
0,
(GInstanceInitFunc) play_on_demand_init,
};
- play_on_demand_type = g_type_register_static(GST_TYPE_ELEMENT,
- "GstPlayOnDemand",
- &play_on_demand_info, 0);
+ play_on_demand_type = g_type_register_static (GST_TYPE_ELEMENT,
+ "GstPlayOnDemand", &play_on_demand_info, 0);
}
return play_on_demand_type;
}
/* signals and properties */
-enum {
+enum
+{
/* add signals here */
PLAYED_SIGNAL,
STOPPED_SIGNAL,
@@ -130,7 +128,8 @@ enum {
LAST_SIGNAL
};
-enum {
+enum
+{
PROP_0,
PROP_MUTE,
PROP_BUFFER_TIME,
@@ -145,215 +144,229 @@ static guint gst_pod_filter_signals[LAST_SIGNAL] = { 0 };
static GstElementClass *parent_class = NULL;
static void
-play_on_demand_base_init (GstPlayOnDemandClass *klass)
+play_on_demand_base_init (GstPlayOnDemandClass * klass)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
- gst_element_class_add_pad_template(element_class,
- gst_static_pad_template_get(&play_on_demand_src_template));
- gst_element_class_add_pad_template(element_class,
- gst_static_pad_template_get(&play_on_demand_sink_template));
- gst_element_class_set_details(element_class, &play_on_demand_details);
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&play_on_demand_src_template));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&play_on_demand_sink_template));
+ gst_element_class_set_details (element_class, &play_on_demand_details);
}
static void
-play_on_demand_class_init (GstPlayOnDemandClass *klass)
+play_on_demand_class_init (GstPlayOnDemandClass * klass)
{
- GObjectClass *gobject_class;
+ GObjectClass *gobject_class;
GstElementClass *gstelement_class;
- gobject_class = (GObjectClass *) klass;
+ gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass;
gst_pod_filter_signals[PLAYED_SIGNAL] =
- g_signal_new("played", G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(GstPlayOnDemandClass, played),
- NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
+ g_signal_new ("played", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GstPlayOnDemandClass, played),
+ NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
gst_pod_filter_signals[STOPPED_SIGNAL] =
- g_signal_new("stopped", G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(GstPlayOnDemandClass, stopped),
- NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
+ g_signal_new ("stopped", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GstPlayOnDemandClass, stopped),
+ NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
gst_pod_filter_signals[PLAY_SIGNAL] =
- g_signal_new("play", G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(GstPlayOnDemandClass, play),
- NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
+ g_signal_new ("play", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GstPlayOnDemandClass, play),
+ NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
gst_pod_filter_signals[CLEAR_SIGNAL] =
- g_signal_new("clear", G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(GstPlayOnDemandClass, clear),
- NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
+ g_signal_new ("clear", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GstPlayOnDemandClass, clear),
+ NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
gst_pod_filter_signals[RESET_SIGNAL] =
- g_signal_new("reset", G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(GstPlayOnDemandClass, reset),
- NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
+ g_signal_new ("reset", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GstPlayOnDemandClass, reset),
+ NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
- klass->play = play_on_demand_play_handler;
+ klass->play = play_on_demand_play_handler;
klass->clear = play_on_demand_clear_handler;
klass->reset = play_on_demand_reset_handler;
- parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
+ parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
gobject_class->set_property = play_on_demand_set_property;
gobject_class->get_property = play_on_demand_get_property;
- gobject_class->dispose = play_on_demand_dispose;
+ gobject_class->dispose = play_on_demand_dispose;
gstelement_class->set_clock = play_on_demand_set_clock;
- g_object_class_install_property(G_OBJECT_CLASS(klass), PROP_MUTE,
- g_param_spec_boolean("mute", "Silence output", "Do not output any sound",
- FALSE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
-
- g_object_class_install_property(G_OBJECT_CLASS(klass), PROP_BUFFER_TIME,
- g_param_spec_float("buffer-time", "Buffer length in seconds", "Number of seconds of audio the buffer holds",
- 0.0, G_MAXFLOAT, GST_POD_BUFFER_TIME, G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
-
- g_object_class_install_property(G_OBJECT_CLASS(klass), PROP_MAX_PLAYS,
- g_param_spec_uint("max-plays", "Maximum simultaneous playbacks", "Maximum allowed number of simultaneous plays from the buffer",
- 1, G_MAXUINT, GST_POD_MAX_PLAYS, G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
-
- g_object_class_install_property(G_OBJECT_CLASS(klass), PROP_TICK_RATE,
- g_param_spec_float("tick-rate", "Tick rate (ticks/second)", "The rate of musical ticks, the smallest time unit in a song",
- 0, G_MAXFLOAT, GST_POD_TICK_RATE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
-
- g_object_class_install_property(G_OBJECT_CLASS(klass), PROP_TOTAL_TICKS,
- g_param_spec_uint("total-ticks", "Total number of ticks", "Total number of ticks in the tick array",
- 1, G_MAXUINT, 1, G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
-
- g_object_class_install_property(G_OBJECT_CLASS(klass), PROP_TICKS,
- g_param_spec_pointer("ticks", "Ticks to play sample on", "An array of ticks (musical times) at which to play the sample",
- G_PARAM_READWRITE));
+ g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_MUTE,
+ g_param_spec_boolean ("mute", "Silence output", "Do not output any sound",
+ FALSE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_BUFFER_TIME,
+ g_param_spec_float ("buffer-time", "Buffer length in seconds",
+ "Number of seconds of audio the buffer holds", 0.0, G_MAXFLOAT,
+ GST_POD_BUFFER_TIME, G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_MAX_PLAYS,
+ g_param_spec_uint ("max-plays", "Maximum simultaneous playbacks",
+ "Maximum allowed number of simultaneous plays from the buffer", 1,
+ G_MAXUINT, GST_POD_MAX_PLAYS, G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_TICK_RATE,
+ g_param_spec_float ("tick-rate", "Tick rate (ticks/second)",
+ "The rate of musical ticks, the smallest time unit in a song", 0,
+ G_MAXFLOAT, GST_POD_TICK_RATE,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_TOTAL_TICKS,
+ g_param_spec_uint ("total-ticks", "Total number of ticks",
+ "Total number of ticks in the tick array", 1, G_MAXUINT, 1,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_TICKS,
+ g_param_spec_pointer ("ticks", "Ticks to play sample on",
+ "An array of ticks (musical times) at which to play the sample",
+ G_PARAM_READWRITE));
}
static void
-play_on_demand_init (GstPlayOnDemand *filter)
+play_on_demand_init (GstPlayOnDemand * filter)
{
- filter->srcpad = gst_pad_new_from_template(
- gst_static_pad_template_get(&play_on_demand_src_template), "src");
- filter->sinkpad = gst_pad_new_from_template(
- gst_static_pad_template_get(&play_on_demand_sink_template), "sink");
+ filter->srcpad =
+ gst_pad_new_from_template (gst_static_pad_template_get
+ (&play_on_demand_src_template), "src");
+ filter->sinkpad =
+ gst_pad_new_from_template (gst_static_pad_template_get
+ (&play_on_demand_sink_template), "sink");
- gst_pad_set_link_function(filter->sinkpad, play_on_demand_pad_link);
+ gst_pad_set_link_function (filter->sinkpad, play_on_demand_pad_link);
- gst_element_add_pad(GST_ELEMENT(filter), filter->sinkpad);
- gst_element_add_pad(GST_ELEMENT(filter), filter->srcpad);
+ gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
+ gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);
- gst_element_set_loop_function(GST_ELEMENT(filter), play_on_demand_loop);
+ gst_element_set_loop_function (GST_ELEMENT (filter), play_on_demand_loop);
filter->clock = NULL;
filter->rate = 0;
- filter->ticks = g_new(guint32, filter->total_ticks / 32 + 1);
- filter->plays = g_new(guint, filter->max_plays);
+ filter->ticks = g_new (guint32, filter->total_ticks / 32 + 1);
+ filter->plays = g_new (guint, filter->max_plays);
- play_on_demand_resize_buffer(filter);
- play_on_demand_reset_handler(GST_ELEMENT(filter));
+ play_on_demand_resize_buffer (filter);
+ play_on_demand_reset_handler (GST_ELEMENT (filter));
}
static void
-play_on_demand_set_property (GObject *object, guint prop_id,
- const GValue *value, GParamSpec *pspec)
+play_on_demand_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec)
{
GstPlayOnDemand *filter;
- register guint i;
- guint new_size, min_size, *new_plays;
- guint *new_ticks;
+ register guint i;
+ guint new_size, min_size, *new_plays;
+ guint *new_ticks;
- g_return_if_fail(GST_IS_PLAYONDEMAND(object));
- filter = GST_PLAYONDEMAND(object);
+ g_return_if_fail (GST_IS_PLAYONDEMAND (object));
+ filter = GST_PLAYONDEMAND (object);
switch (prop_id) {
- case PROP_MUTE:
- filter->mute = g_value_get_boolean(value);
- break;
- case PROP_BUFFER_TIME:
- filter->buffer_time = g_value_get_float(value);
- play_on_demand_resize_buffer(filter);
-
- /* clear out now-invalid play pointers */
- for (i = 0; i < filter->max_plays; i++) filter->plays[i] = G_MAXUINT;
-
- break;
- case PROP_MAX_PLAYS:
- new_size = g_value_get_uint(value);
- min_size = (new_size < filter->max_plays) ? new_size : filter->max_plays;
-
- new_plays = g_new(guint, new_size);
- for (i = 0; i < min_size; i++) new_plays[i] = filter->plays[i];
- for (i = min_size; i < new_size; i++) new_plays[i] = G_MAXUINT;
-
- g_free(filter->plays);
- filter->plays = new_plays;
- filter->max_plays = new_size;
-
- break;
- case PROP_TICK_RATE:
- filter->tick_rate = g_value_get_float(value);
- break;
- case PROP_TOTAL_TICKS:
- new_size = g_value_get_uint(value);
- min_size = (new_size < filter->total_ticks) ? new_size : filter->total_ticks;
-
- new_ticks = g_new(guint32, new_size / 32 + 1);
- for (i = 0; i <= min_size / 32; i++) new_ticks[i] = filter->ticks[i];
- for (i = min_size / 32 + 1; i <= new_size / 32; i++) new_ticks[i] = 0;
-
- g_free(filter->ticks);
- filter->ticks = new_ticks;
- filter->total_ticks = new_size;
-
- break;
- case PROP_TICKS:
- new_ticks = (guint *) g_value_get_pointer(value);
- if (new_ticks) {
- g_free(filter->ticks);
+ case PROP_MUTE:
+ filter->mute = g_value_get_boolean (value);
+ break;
+ case PROP_BUFFER_TIME:
+ filter->buffer_time = g_value_get_float (value);
+ play_on_demand_resize_buffer (filter);
+
+ /* clear out now-invalid play pointers */
+ for (i = 0; i < filter->max_plays; i++)
+ filter->plays[i] = G_MAXUINT;
+
+ break;
+ case PROP_MAX_PLAYS:
+ new_size = g_value_get_uint (value);
+ min_size = (new_size < filter->max_plays) ? new_size : filter->max_plays;
+
+ new_plays = g_new (guint, new_size);
+ for (i = 0; i < min_size; i++)
+ new_plays[i] = filter->plays[i];
+ for (i = min_size; i < new_size; i++)
+ new_plays[i] = G_MAXUINT;
+
+ g_free (filter->plays);
+ filter->plays = new_plays;
+ filter->max_plays = new_size;
+
+ break;
+ case PROP_TICK_RATE:
+ filter->tick_rate = g_value_get_float (value);
+ break;
+ case PROP_TOTAL_TICKS:
+ new_size = g_value_get_uint (value);
+ min_size =
+ (new_size < filter->total_ticks) ? new_size : filter->total_ticks;
+
+ new_ticks = g_new (guint32, new_size / 32 + 1);
+ for (i = 0; i <= min_size / 32; i++)
+ new_ticks[i] = filter->ticks[i];
+ for (i = min_size / 32 + 1; i <= new_size / 32; i++)
+ new_ticks[i] = 0;
+
+ g_free (filter->ticks);
filter->ticks = new_ticks;
- }
- break;
- default:
- break;
+ filter->total_ticks = new_size;
+
+ break;
+ case PROP_TICKS:
+ new_ticks = (guint *) g_value_get_pointer (value);
+ if (new_ticks) {
+ g_free (filter->ticks);
+ filter->ticks = new_ticks;
+ }
+ break;
+ default:
+ break;
}
}
static void
-play_on_demand_get_property (GObject *object, guint prop_id,
- GValue *value, GParamSpec *pspec)
+play_on_demand_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec)
{
GstPlayOnDemand *filter;
- g_return_if_fail(GST_IS_PLAYONDEMAND(object));
- filter = GST_PLAYONDEMAND(object);
+ g_return_if_fail (GST_IS_PLAYONDEMAND (object));
+ filter = GST_PLAYONDEMAND (object);
switch (prop_id) {
- case PROP_MUTE:
- g_value_set_boolean(value, filter->mute);
- break;
- case PROP_BUFFER_TIME:
- g_value_set_float(value, filter->buffer_time);
- break;
- case PROP_MAX_PLAYS:
- g_value_set_uint(value, filter->max_plays);
- break;
- case PROP_TICK_RATE:
- g_value_set_float(value, filter->tick_rate);
- break;
- case PROP_TOTAL_TICKS:
- g_value_set_uint(value, filter->total_ticks);
- break;
- case PROP_TICKS:
- g_value_set_pointer(value, (gpointer) filter->ticks);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
- break;
+ case PROP_MUTE:
+ g_value_set_boolean (value, filter->mute);
+ break;
+ case PROP_BUFFER_TIME:
+ g_value_set_float (value, filter->buffer_time);
+ break;
+ case PROP_MAX_PLAYS:
+ g_value_set_uint (value, filter->max_plays);
+ break;
+ case PROP_TICK_RATE:
+ g_value_set_float (value, filter->tick_rate);
+ break;
+ case PROP_TOTAL_TICKS:
+ g_value_set_uint (value, filter->total_ticks);
+ break;
+ case PROP_TICKS:
+ g_value_set_pointer (value, (gpointer) filter->ticks);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
}
}
static void
-play_on_demand_dispose (GObject *object)
+play_on_demand_dispose (GObject * object)
{
GstPlayOnDemand *filter = GST_PLAYONDEMAND (object);
@@ -365,16 +378,16 @@ play_on_demand_dispose (GObject *object)
}
static GstPadLinkReturn
-play_on_demand_pad_link (GstPad *pad, const GstCaps *caps)
+play_on_demand_pad_link (GstPad * pad, const GstCaps * caps)
{
const gchar *mimetype;
GstPlayOnDemand *filter;
GstStructure *structure;
- g_return_val_if_fail(caps != NULL, GST_PAD_LINK_DELAYED);
- g_return_val_if_fail(pad != NULL, GST_PAD_LINK_DELAYED);
+ g_return_val_if_fail (caps != NULL, GST_PAD_LINK_DELAYED);
+ g_return_val_if_fail (pad != NULL, GST_PAD_LINK_DELAYED);
- filter = GST_PLAYONDEMAND(GST_PAD_PARENT(pad));
+ filter = GST_PLAYONDEMAND (GST_PAD_PARENT (pad));
structure = gst_caps_get_structure (caps, 0);
@@ -382,54 +395,55 @@ play_on_demand_pad_link (GstPad *pad, const GstCaps *caps)
gst_structure_get_int (structure, "rate", &filter->rate);
gst_structure_get_int (structure, "channels", &filter->channels);
- if (strcmp(mimetype, "audio/x-raw-int") == 0) {
+ if (strcmp (mimetype, "audio/x-raw-int") == 0) {
filter->format = GST_PLAYONDEMAND_FORMAT_INT;
- gst_structure_get_int (structure, "width", &filter->width);
- } else if (strcmp(mimetype, "audio/x-raw-float") == 0) {
+ gst_structure_get_int (structure, "width", &filter->width);
+ } else if (strcmp (mimetype, "audio/x-raw-float") == 0) {
filter->format = GST_PLAYONDEMAND_FORMAT_FLOAT;
}
- play_on_demand_resize_buffer(filter);
+ play_on_demand_resize_buffer (filter);
return gst_pad_try_set_caps (filter->srcpad, caps);
}
inline static void
-play_on_demand_add_play_pointer (GstPlayOnDemand *filter, guint pos)
+play_on_demand_add_play_pointer (GstPlayOnDemand * filter, guint pos)
{
register guint i;
if (filter->rate && ((filter->buffer_time * filter->rate) > pos)) {
for (i = 0; i < filter->max_plays; i++) {
if (filter->plays[i] == G_MAXUINT) {
- filter->plays[i] = pos;
- /* emit a signal to indicate a sample being played */
- g_signal_emit(filter, gst_pod_filter_signals[PLAYED_SIGNAL], 0);
- break;
+ filter->plays[i] = pos;
+ /* emit a signal to indicate a sample being played */
+ g_signal_emit (filter, gst_pod_filter_signals[PLAYED_SIGNAL], 0);
+ break;
}
}
}
}
static void
-play_on_demand_loop (GstElement *elem)
+play_on_demand_loop (GstElement * elem)
{
- GstPlayOnDemand *filter = GST_PLAYONDEMAND(elem);
- guint num_in, num_out, num_filter;
- GstData *in = NULL;
- GstBuffer *out = NULL;
- static guint last_tick = 0;
+ GstPlayOnDemand *filter = GST_PLAYONDEMAND (elem);
+ guint num_in, num_out, num_filter;
+ GstData *in = NULL;
+ GstBuffer *out = NULL;
+ static guint last_tick = 0;
- g_return_if_fail(filter != NULL);
- g_return_if_fail(GST_IS_PLAYONDEMAND(filter));
+ g_return_if_fail (filter != NULL);
+ g_return_if_fail (GST_IS_PLAYONDEMAND (filter));
- in = (in == NULL && ! filter->eos) ? gst_pad_pull(filter->sinkpad) : NULL;
+ in = (in == NULL && !filter->eos) ? gst_pad_pull (filter->sinkpad) : NULL;
if (filter->format == GST_PLAYONDEMAND_FORMAT_INT) {
if (filter->width == 16) {
gint16 min = 0xffff;
gint16 max = 0x7fff;
gint16 zero = 0;
+
#define _TYPE_ gint16
#include "filter.func"
#undef _TYPE_
@@ -437,6 +451,7 @@ play_on_demand_loop (GstElement *elem)
gint8 min = 0xff;
gint8 max = 0x7f;
gint8 zero = 0;
+
#define _TYPE_ gint8
#include "filter.func"
#undef _TYPE_
@@ -445,6 +460,7 @@ play_on_demand_loop (GstElement *elem)
gfloat min = -1.0;
gfloat max = 1.0;
gfloat zero = 0.0;
+
#define _TYPE_ gfloat
#include "filter.func"
#undef _TYPE_
@@ -452,106 +468,105 @@ play_on_demand_loop (GstElement *elem)
}
static void
-play_on_demand_set_clock (GstElement *elem, GstClock *clock)
+play_on_demand_set_clock (GstElement * elem, GstClock * clock)
{
GstPlayOnDemand *filter;
- g_return_if_fail(elem != NULL);
- g_return_if_fail(GST_IS_PLAYONDEMAND(elem));
- filter = GST_PLAYONDEMAND(elem);
+ g_return_if_fail (elem != NULL);
+ g_return_if_fail (GST_IS_PLAYONDEMAND (elem));
+ filter = GST_PLAYONDEMAND (elem);
filter->clock = clock;
}
static void
-play_on_demand_play_handler (GstElement *elem)
+play_on_demand_play_handler (GstElement * elem)
{
GstPlayOnDemand *filter;
- g_return_if_fail(elem != NULL);
- g_return_if_fail(GST_IS_PLAYONDEMAND(elem));
- filter = GST_PLAYONDEMAND(elem);
+ g_return_if_fail (elem != NULL);
+ g_return_if_fail (GST_IS_PLAYONDEMAND (elem));
+ filter = GST_PLAYONDEMAND (elem);
- play_on_demand_add_play_pointer(filter, 0);
+ play_on_demand_add_play_pointer (filter, 0);
}
static void
-play_on_demand_clear_handler (GstElement *elem)
+play_on_demand_clear_handler (GstElement * elem)
{
GstPlayOnDemand *filter;
register guint i;
- g_return_if_fail(elem != NULL);
- g_return_if_fail(GST_IS_PLAYONDEMAND(elem));
- filter = GST_PLAYONDEMAND(elem);
+ g_return_if_fail (elem != NULL);
+ g_return_if_fail (GST_IS_PLAYONDEMAND (elem));
+ filter = GST_PLAYONDEMAND (elem);
filter->write = 0;
filter->eos = FALSE;
- for (i = 0; i < filter->max_plays; i++) filter->plays[i] = G_MAXUINT;
- for (i = 0; i < filter->buffer_bytes; i++) filter->buffer[i] = (gchar) 0;
+ for (i = 0; i < filter->max_plays; i++)
+ filter->plays[i] = G_MAXUINT;
+ for (i = 0; i < filter->buffer_bytes; i++)
+ filter->buffer[i] = (gchar) 0;
}
static void
-play_on_demand_reset_handler (GstElement *elem)
+play_on_demand_reset_handler (GstElement * elem)
{
GstPlayOnDemand *filter;
register guint i;
play_on_demand_clear_handler (elem);
- g_return_if_fail(elem != NULL);
- g_return_if_fail(GST_IS_PLAYONDEMAND(elem));
- filter = GST_PLAYONDEMAND(elem);
+ g_return_if_fail (elem != NULL);
+ g_return_if_fail (GST_IS_PLAYONDEMAND (elem));
+ filter = GST_PLAYONDEMAND (elem);
- for (i = 0; i <= filter->total_ticks / 32; i++) filter->ticks[i] = 0;
+ for (i = 0; i <= filter->total_ticks / 32; i++)
+ filter->ticks[i] = 0;
}
static void
-play_on_demand_resize_buffer (GstPlayOnDemand *filter)
+play_on_demand_resize_buffer (GstPlayOnDemand * filter)
{
- register guint i;
- guint new_size, min_size;
- gchar *new_buffer;
+ register guint i;
+ guint new_size, min_size;
+ gchar *new_buffer;
/* use a default sample rate of 44100, 1 channel, 1 byte per sample if caps
haven't been set yet */
- new_size = (guint) filter->buffer_time;
+ new_size = (guint) filter->buffer_time;
new_size *= (filter->rate) ? filter->rate : 44100;
new_size *= (filter->channels) ? filter->channels : 1;
if (filter->format && filter->format == GST_PLAYONDEMAND_FORMAT_FLOAT)
- new_size *= sizeof(gfloat);
+ new_size *= sizeof (gfloat);
else
new_size *= (filter->width) ? filter->width / 8 : 1;
- min_size = (new_size < filter->buffer_bytes) ? new_size : filter->buffer_bytes;
+ min_size =
+ (new_size < filter->buffer_bytes) ? new_size : filter->buffer_bytes;
- new_buffer = g_new(gchar, new_size);
- for (i = 0; i < min_size; i++) new_buffer[i] = filter->buffer[i];
- for (i = min_size; i < new_size; i++) new_buffer[i] = (gchar) 0;
+ new_buffer = g_new (gchar, new_size);
+ for (i = 0; i < min_size; i++)
+ new_buffer[i] = filter->buffer[i];
+ for (i = min_size; i < new_size; i++)
+ new_buffer[i] = (gchar) 0;
- g_free(filter->buffer);
+ g_free (filter->buffer);
filter->buffer = new_buffer;
filter->buffer_bytes = new_size;
}
static gboolean
-plugin_init (GstPlugin *plugin)
+plugin_init (GstPlugin * plugin)
{
- return gst_element_register(plugin, "playondemand",
- GST_RANK_NONE,
- GST_TYPE_PLAYONDEMAND);
+ return gst_element_register (plugin, "playondemand",
+ GST_RANK_NONE, GST_TYPE_PLAYONDEMAND);
}
-GST_PLUGIN_DEFINE (
- GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "playondemand",
- "Plays a stream at specific times, or when it receives a signal",
- plugin_init,
- VERSION,
- "LGPL",
- GST_PACKAGE,
- GST_ORIGIN
-)
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ "playondemand",
+ "Plays a stream at specific times, or when it receives a signal",
+ plugin_init, VERSION, "LGPL", GST_PACKAGE, GST_ORIGIN)
diff --git a/gst/playondemand/gstplayondemand.h b/gst/playondemand/gstplayondemand.h
index c99c81650..a838d7583 100644
--- a/gst/playondemand/gstplayondemand.h
+++ b/gst/playondemand/gstplayondemand.h
@@ -29,7 +29,6 @@
#include <gst/gst.h>
G_BEGIN_DECLS
-
#define GST_TYPE_PLAYONDEMAND \
(gst_play_on_demand_get_type())
#define GST_PLAYONDEMAND(obj) \
@@ -40,58 +39,59 @@ G_BEGIN_DECLS
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_PLAYONDEMAND))
#define GST_IS_PLAYONDEMAND_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_PLAYONDEMAND))
+typedef struct _GstPlayOnDemand GstPlayOnDemand;
+typedef struct _GstPlayOnDemandClass GstPlayOnDemandClass;
+typedef enum _GstPlayOnDemandFormat GstPlayOnDemandFormat;
-typedef struct _GstPlayOnDemand GstPlayOnDemand;
-typedef struct _GstPlayOnDemandClass GstPlayOnDemandClass;
-typedef enum _GstPlayOnDemandFormat GstPlayOnDemandFormat;
-
-enum _GstPlayOnDemandFormat {
+enum _GstPlayOnDemandFormat
+{
GST_PLAYONDEMAND_FORMAT_INT,
GST_PLAYONDEMAND_FORMAT_FLOAT
};
-struct _GstPlayOnDemand {
+struct _GstPlayOnDemand
+{
GstElement element;
- GstPad *sinkpad, *srcpad;
+ GstPad *sinkpad, *srcpad;
GstClock *clock;
/* filter properties */
- gboolean mute;
- gfloat buffer_time;
- guint max_plays;
- gfloat tick_rate;
- guint total_ticks;
- guint32 *ticks;
+ gboolean mute;
+ gfloat buffer_time;
+ guint max_plays;
+ gfloat tick_rate;
+ guint total_ticks;
+ guint32 *ticks;
/* internal buffer info */
- gchar *buffer;
- guint buffer_bytes;
- gboolean eos;
+ gchar *buffer;
+ guint buffer_bytes;
+ gboolean eos;
/* play pointers == internal buffer offsets for producing output sound */
- guint *plays;
- guint write;
+ guint *plays;
+ guint write;
/* audio format info (used to calculate buffer_samples) */
GstPlayOnDemandFormat format;
- guint rate;
- guint channels;
- guint width;
+ guint rate;
+ guint channels;
+ guint width;
};
-struct _GstPlayOnDemandClass {
+struct _GstPlayOnDemandClass
+{
GstElementClass parent_class;
- void (*play) (GstElement *elem);
- void (*clear) (GstElement *elem);
- void (*reset) (GstElement *elem);
- void (*played) (GstElement *elem);
- void (*stopped) (GstElement *elem);
+ void (*play) (GstElement * elem);
+ void (*clear) (GstElement * elem);
+ void (*reset) (GstElement * elem);
+ void (*played) (GstElement * elem);
+ void (*stopped) (GstElement * elem);
};
-GType gst_play_on_demand_get_type(void);
+GType gst_play_on_demand_get_type (void);
G_END_DECLS
-
#endif /* __GST_PLAYONDEMAND_H__ */
diff --git a/gst/qtdemux/qtdemux.c b/gst/qtdemux/qtdemux.c
index 4826821b9..f7914e24e 100644
--- a/gst/qtdemux/qtdemux.c
+++ b/gst/qtdemux/qtdemux.c
@@ -41,22 +41,26 @@ GST_DEBUG_CATEGORY_EXTERN (qtdemux_debug);
typedef struct _QtNode QtNode;
typedef struct _QtNodeType QtNodeType;
typedef struct _QtDemuxSample QtDemuxSample;
+
//typedef struct _QtDemuxStream QtDemuxStream;
-struct _QtNode {
+struct _QtNode
+{
guint32 type;
gpointer data;
int len;
};
-struct _QtNodeType {
+struct _QtNodeType
+{
guint32 fourcc;
char *name;
int flags;
- void (*dump)(GstQTDemux *qtdemux, void *buffer, int depth);
+ void (*dump) (GstQTDemux * qtdemux, void *buffer, int depth);
};
-struct _QtDemuxSample {
+struct _QtDemuxSample
+{
int sample_index;
int chunk;
int size;
@@ -65,7 +69,8 @@ struct _QtDemuxSample {
guint64 duration;
};
-struct _QtDemuxStream {
+struct _QtDemuxStream
+{
guint32 subtype;
GstCaps *caps;
GstPad *pad;
@@ -78,14 +83,15 @@ struct _QtDemuxStream {
int width;
int height;
float fps;
-
+
double rate;
int n_channels;
guint bytes_per_frame;
guint samples_per_packet;
};
-enum QtDemuxState {
+enum QtDemuxState
+{
QTDEMUX_STATE_NULL,
QTDEMUX_STATE_HEADER,
QTDEMUX_STATE_HEADER_SEEKING,
@@ -95,85 +101,87 @@ enum QtDemuxState {
QTDEMUX_STATE_EOS,
};
-static GNode *qtdemux_tree_get_child_by_type(GNode *node, guint32 fourcc);
-static GNode *qtdemux_tree_get_sibling_by_type(GNode *node, guint32 fourcc);
+static GNode *qtdemux_tree_get_child_by_type (GNode * node, guint32 fourcc);
+static GNode *qtdemux_tree_get_sibling_by_type (GNode * node, guint32 fourcc);
-static GstElementDetails
-gst_qtdemux_details =
-{
+static GstElementDetails gst_qtdemux_details = {
"QuickTime Demuxer",
"Codec/Demuxer",
"Demultiplex a QuickTime file into audio and video streams",
"David Schleef <ds@schleef.org>"
};
-enum {
+enum
+{
LAST_SIGNAL
};
-enum {
+enum
+{
ARG_0
};
static GstStaticPadTemplate gst_qtdemux_sink_template =
-GST_STATIC_PAD_TEMPLATE (
- "sink",
- GST_PAD_SINK,
- GST_PAD_SOMETIMES,
- GST_STATIC_CAPS ("video/quicktime")
-);
+GST_STATIC_PAD_TEMPLATE ("sink",
+ GST_PAD_SINK,
+ GST_PAD_SOMETIMES,
+ GST_STATIC_CAPS ("video/quicktime")
+ );
static GstStaticPadTemplate gst_qtdemux_videosrc_template =
-GST_STATIC_PAD_TEMPLATE (
- "audio_%02d",
- GST_PAD_SRC,
- GST_PAD_SOMETIMES,
- GST_STATIC_CAPS_ANY
-);
+GST_STATIC_PAD_TEMPLATE ("audio_%02d",
+ GST_PAD_SRC,
+ GST_PAD_SOMETIMES,
+ GST_STATIC_CAPS_ANY);
static GstStaticPadTemplate gst_qtdemux_audiosrc_template =
-GST_STATIC_PAD_TEMPLATE (
- "video_%02d",
- GST_PAD_SRC,
- GST_PAD_SOMETIMES,
- GST_STATIC_CAPS_ANY
-);
+GST_STATIC_PAD_TEMPLATE ("video_%02d",
+ GST_PAD_SRC,
+ GST_PAD_SOMETIMES,
+ GST_STATIC_CAPS_ANY);
static GstElementClass *parent_class = NULL;
-static void gst_qtdemux_class_init (GstQTDemuxClass *klass);
-static void gst_qtdemux_base_init (GstQTDemuxClass *klass);
-static void gst_qtdemux_init (GstQTDemux *quicktime_demux);
-static GstElementStateReturn gst_qtdemux_change_state(GstElement *element);
-static void gst_qtdemux_loop_header (GstElement *element);
-static gboolean gst_qtdemux_handle_sink_event (GstQTDemux *qtdemux);
-
-static void qtdemux_parse_moov(GstQTDemux *qtdemux, void *buffer, int length);
-static void qtdemux_parse(GstQTDemux *qtdemux, GNode *node, void *buffer, int length);
-static QtNodeType *qtdemux_type_get(guint32 fourcc);
-static void qtdemux_node_dump(GstQTDemux *qtdemux, GNode *node);
-static void qtdemux_parse_tree(GstQTDemux *qtdemux);
-static GstCaps *qtdemux_video_caps(GstQTDemux *qtdemux, guint32 fourcc, const guint8 *stsd_data);
-static GstCaps *qtdemux_audio_caps(GstQTDemux *qtdemux, guint32 fourcc, const guint8 *data);
-
-static GType gst_qtdemux_get_type (void)
+static void gst_qtdemux_class_init (GstQTDemuxClass * klass);
+static void gst_qtdemux_base_init (GstQTDemuxClass * klass);
+static void gst_qtdemux_init (GstQTDemux * quicktime_demux);
+static GstElementStateReturn gst_qtdemux_change_state (GstElement * element);
+static void gst_qtdemux_loop_header (GstElement * element);
+static gboolean gst_qtdemux_handle_sink_event (GstQTDemux * qtdemux);
+
+static void qtdemux_parse_moov (GstQTDemux * qtdemux, void *buffer, int length);
+static void qtdemux_parse (GstQTDemux * qtdemux, GNode * node, void *buffer,
+ int length);
+static QtNodeType *qtdemux_type_get (guint32 fourcc);
+static void qtdemux_node_dump (GstQTDemux * qtdemux, GNode * node);
+static void qtdemux_parse_tree (GstQTDemux * qtdemux);
+static GstCaps *qtdemux_video_caps (GstQTDemux * qtdemux, guint32 fourcc,
+ const guint8 * stsd_data);
+static GstCaps *qtdemux_audio_caps (GstQTDemux * qtdemux, guint32 fourcc,
+ const guint8 * data);
+
+static GType
+gst_qtdemux_get_type (void)
{
static GType qtdemux_type = 0;
if (!qtdemux_type) {
static const GTypeInfo qtdemux_info = {
- sizeof(GstQTDemuxClass),
- (GBaseInitFunc)gst_qtdemux_base_init, NULL,
- (GClassInitFunc)gst_qtdemux_class_init,
- NULL, NULL, sizeof(GstQTDemux), 0,
- (GInstanceInitFunc)gst_qtdemux_init,
+ sizeof (GstQTDemuxClass),
+ (GBaseInitFunc) gst_qtdemux_base_init, NULL,
+ (GClassInitFunc) gst_qtdemux_class_init,
+ NULL, NULL, sizeof (GstQTDemux), 0,
+ (GInstanceInitFunc) gst_qtdemux_init,
};
- qtdemux_type = g_type_register_static (GST_TYPE_ELEMENT, "GstQTDemux", &qtdemux_info, 0);
+ qtdemux_type =
+ g_type_register_static (GST_TYPE_ELEMENT, "GstQTDemux", &qtdemux_info,
+ 0);
}
return qtdemux_type;
}
-static void gst_qtdemux_base_init (GstQTDemuxClass *klass)
+static void
+gst_qtdemux_base_init (GstQTDemuxClass * klass)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
@@ -187,31 +195,33 @@ static void gst_qtdemux_base_init (GstQTDemuxClass *klass)
}
-static void gst_qtdemux_class_init (GstQTDemuxClass *klass)
+static void
+gst_qtdemux_class_init (GstQTDemuxClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
- gobject_class = (GObjectClass*)klass;
- gstelement_class = (GstElementClass*)klass;
+ gobject_class = (GObjectClass *) klass;
+ gstelement_class = (GstElementClass *) klass;
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
gstelement_class->change_state = gst_qtdemux_change_state;
}
-static void
-gst_qtdemux_init (GstQTDemux *qtdemux)
+static void
+gst_qtdemux_init (GstQTDemux * qtdemux)
{
- qtdemux->sinkpad = gst_pad_new_from_template (
- gst_static_pad_template_get (&gst_qtdemux_sink_template), "sink");
+ qtdemux->sinkpad =
+ gst_pad_new_from_template (gst_static_pad_template_get
+ (&gst_qtdemux_sink_template), "sink");
gst_element_set_loop_function (GST_ELEMENT (qtdemux),
gst_qtdemux_loop_header);
gst_element_add_pad (GST_ELEMENT (qtdemux), qtdemux->sinkpad);
}
static const GstFormat *
-gst_qtdemux_get_src_formats (GstPad *pad)
+gst_qtdemux_get_src_formats (GstPad * pad)
{
static const GstFormat src_a_formats[] = {
GST_FORMAT_TIME,
@@ -224,55 +234,55 @@ gst_qtdemux_get_src_formats (GstPad *pad)
GST_FORMAT_DEFAULT,
0
};
- QtDemuxStream *stream = gst_pad_get_element_private(pad);
+ QtDemuxStream *stream = gst_pad_get_element_private (pad);
- return (stream->subtype == GST_MAKE_FOURCC('v','i','d','e')) ?
- src_v_formats : src_a_formats;
+ return (stream->subtype == GST_MAKE_FOURCC ('v', 'i', 'd', 'e')) ?
+ src_v_formats : src_a_formats;
}
static gboolean
-gst_qtdemux_src_convert (GstPad *pad, GstFormat src_format, gint64 src_value,
- GstFormat *dest_format, gint64 *dest_value)
+gst_qtdemux_src_convert (GstPad * pad, GstFormat src_format, gint64 src_value,
+ GstFormat * dest_format, gint64 * dest_value)
{
gboolean res = TRUE;
- QtDemuxStream *stream = gst_pad_get_element_private(pad);
+ QtDemuxStream *stream = gst_pad_get_element_private (pad);
- if (stream->subtype == GST_MAKE_FOURCC('v','i','d','e') &&
+ if (stream->subtype == GST_MAKE_FOURCC ('v', 'i', 'd', 'e') &&
(src_format == GST_FORMAT_BYTES || *dest_format == GST_FORMAT_BYTES))
return FALSE;
switch (src_format) {
case GST_FORMAT_TIME:
switch (*dest_format) {
- case GST_FORMAT_BYTES:
- *dest_value = src_value * 1; /* FIXME */
- break;
- case GST_FORMAT_DEFAULT:
- *dest_value = src_value * 1; /* FIXME */
- break;
- default:
- res = FALSE;
- break;
+ case GST_FORMAT_BYTES:
+ *dest_value = src_value * 1; /* FIXME */
+ break;
+ case GST_FORMAT_DEFAULT:
+ *dest_value = src_value * 1; /* FIXME */
+ break;
+ default:
+ res = FALSE;
+ break;
}
break;
case GST_FORMAT_BYTES:
switch (*dest_format) {
- case GST_FORMAT_TIME:
- *dest_value = src_value * 1; /* FIXME */
- break;
- default:
- res = FALSE;
- break;
+ case GST_FORMAT_TIME:
+ *dest_value = src_value * 1; /* FIXME */
+ break;
+ default:
+ res = FALSE;
+ break;
}
break;
case GST_FORMAT_DEFAULT:
switch (*dest_format) {
- case GST_FORMAT_TIME:
- *dest_value = src_value * 1; /* FIXME */
- break;
- default:
- res = FALSE;
- break;
+ case GST_FORMAT_TIME:
+ *dest_value = src_value * 1; /* FIXME */
+ break;
+ default:
+ res = FALSE;
+ break;
}
break;
default:
@@ -283,7 +293,7 @@ gst_qtdemux_src_convert (GstPad *pad, GstFormat src_format, gint64 src_value,
}
static const GstQueryType *
-gst_qtdemux_get_src_query_types (GstPad *pad)
+gst_qtdemux_get_src_query_types (GstPad * pad)
{
static const GstQueryType src_types[] = {
GST_QUERY_TOTAL,
@@ -295,54 +305,55 @@ gst_qtdemux_get_src_query_types (GstPad *pad)
}
static const GstEventMask *
-gst_qtdemux_get_event_mask (GstPad *pad)
+gst_qtdemux_get_event_mask (GstPad * pad)
{
static const GstEventMask masks[] = {
- { GST_EVENT_SEEK, GST_SEEK_METHOD_SET | GST_SEEK_FLAG_KEY_UNIT },
- { 0, }
+ {GST_EVENT_SEEK, GST_SEEK_METHOD_SET | GST_SEEK_FLAG_KEY_UNIT},
+ {0,}
};
return masks;
}
static gboolean
-gst_qtdemux_handle_src_query (GstPad *pad, GstQueryType type,
- GstFormat *format, gint64 *value)
+gst_qtdemux_handle_src_query (GstPad * pad, GstQueryType type,
+ GstFormat * format, gint64 * value)
{
gboolean res = TRUE;
+
//QtDemuxStream *stream = gst_pad_get_element_private(pad);
switch (type) {
case GST_QUERY_TOTAL:
switch (*format) {
- case GST_FORMAT_TIME:
- *value = 0; /* FIXME */
- break;
- case GST_FORMAT_BYTES:
- *value = 0; /* FIXME */
- break;
- case GST_FORMAT_DEFAULT:
- *value = 0; /* FIXME */
- break;
- default:
- res = FALSE;
- break;
+ case GST_FORMAT_TIME:
+ *value = 0; /* FIXME */
+ break;
+ case GST_FORMAT_BYTES:
+ *value = 0; /* FIXME */
+ break;
+ case GST_FORMAT_DEFAULT:
+ *value = 0; /* FIXME */
+ break;
+ default:
+ res = FALSE;
+ break;
}
break;
case GST_QUERY_POSITION:
switch (*format) {
- case GST_FORMAT_TIME:
- *value = 0; /* FIXME */
- break;
- case GST_FORMAT_BYTES:
- *value = 0; /* FIXME */
- break;
- case GST_FORMAT_DEFAULT:
- *value = 0; /* FIXME */
- break;
- default:
- res = FALSE;
- break;
+ case GST_FORMAT_TIME:
+ *value = 0; /* FIXME */
+ break;
+ case GST_FORMAT_BYTES:
+ *value = 0; /* FIXME */
+ break;
+ case GST_FORMAT_DEFAULT:
+ *value = 0; /* FIXME */
+ break;
+ default:
+ res = FALSE;
+ break;
}
break;
default:
@@ -354,9 +365,10 @@ gst_qtdemux_handle_src_query (GstPad *pad, GstQueryType type,
}
static gboolean
-gst_qtdemux_handle_src_event (GstPad *pad, GstEvent *event)
+gst_qtdemux_handle_src_event (GstPad * pad, GstEvent * event)
{
gboolean res = TRUE;
+
//QtDemuxStream *stream = gst_pad_get_element_private(pad);
switch (GST_EVENT_TYPE (event)) {
@@ -364,19 +376,19 @@ gst_qtdemux_handle_src_event (GstPad *pad, GstEvent *event)
GST_DEBUG ("seek format %d", GST_EVENT_SEEK_FORMAT (event));
switch (GST_EVENT_SEEK_FORMAT (event)) {
- case GST_FORMAT_BYTES:
- case GST_FORMAT_DEFAULT:
- case GST_FORMAT_TIME:
- {
- gint64 desired_offset = GST_EVENT_SEEK_OFFSET (event);
-
- GST_DEBUG ("seeking to %" G_GINT64_FORMAT, desired_offset);
-
- res = FALSE;
- }
- default:
- res = FALSE;
- break;
+ case GST_FORMAT_BYTES:
+ case GST_FORMAT_DEFAULT:
+ case GST_FORMAT_TIME:
+ {
+ gint64 desired_offset = GST_EVENT_SEEK_OFFSET (event);
+
+ GST_DEBUG ("seeking to %" G_GINT64_FORMAT, desired_offset);
+
+ res = FALSE;
+ }
+ default:
+ res = FALSE;
+ break;
}
default:
res = FALSE;
@@ -393,7 +405,7 @@ gst_qtdemux_handle_src_event (GstPad *pad, GstEvent *event)
GST_DEBUG_CATEGORY (qtdemux_debug);
static gboolean
-plugin_init (GstPlugin *plugin)
+plugin_init (GstPlugin * plugin)
{
GST_DEBUG_CATEGORY_INIT (qtdemux_debug, "qtdemux", 0, "qtdemux plugin");
@@ -404,36 +416,30 @@ plugin_init (GstPlugin *plugin)
return FALSE;
return gst_element_register (plugin, "qtdemux",
- GST_RANK_PRIMARY, GST_TYPE_QTDEMUX);
+ GST_RANK_PRIMARY, GST_TYPE_QTDEMUX);
}
-GST_PLUGIN_DEFINE (
- GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "qtdemux",
- "Quicktime stream demuxer",
- plugin_init,
- VERSION,
- "LGPL",
- GST_PACKAGE,
- GST_ORIGIN
-)
-
-static gboolean gst_qtdemux_handle_sink_event (GstQTDemux *qtdemux)
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ "qtdemux",
+ "Quicktime stream demuxer",
+ plugin_init, VERSION, "LGPL", GST_PACKAGE, GST_ORIGIN)
+
+ static gboolean gst_qtdemux_handle_sink_event (GstQTDemux * qtdemux)
{
guint32 remaining;
GstEvent *event;
GstEventType type;
- gst_bytestream_get_status(qtdemux->bs, &remaining, &event);
+ gst_bytestream_get_status (qtdemux->bs, &remaining, &event);
- type = event ? GST_EVENT_TYPE(event) : GST_EVENT_UNKNOWN;
+ type = event ? GST_EVENT_TYPE (event) : GST_EVENT_UNKNOWN;
GST_DEBUG ("qtdemux: event %p %d", event, type);
- switch(type){
+ switch (type) {
case GST_EVENT_EOS:
- gst_bytestream_flush(qtdemux->bs, remaining);
- gst_pad_event_default(qtdemux->sinkpad, event);
+ gst_bytestream_flush (qtdemux->bs, remaining);
+ gst_pad_event_default (qtdemux->sinkpad, event);
return FALSE;
case GST_EVENT_FLUSH:
//g_warning("flush event");
@@ -443,23 +449,24 @@ static gboolean gst_qtdemux_handle_sink_event (GstQTDemux *qtdemux)
//gst_bytestream_flush_fast(qtdemux->bs, remaining);
break;
default:
- g_warning("unhandled event %d",type);
+ g_warning ("unhandled event %d", type);
break;
}
- gst_event_unref(event);
+ gst_event_unref (event);
return TRUE;
}
-static GstElementStateReturn gst_qtdemux_change_state(GstElement *element)
+static GstElementStateReturn
+gst_qtdemux_change_state (GstElement * element)
{
- GstQTDemux *qtdemux = GST_QTDEMUX(element);
+ GstQTDemux *qtdemux = GST_QTDEMUX (element);
- switch(GST_STATE_TRANSITION(element)){
+ switch (GST_STATE_TRANSITION (element)) {
case GST_STATE_NULL_TO_READY:
break;
case GST_STATE_READY_TO_PAUSED:
- qtdemux->bs = gst_bytestream_new(qtdemux->sinkpad);
+ qtdemux->bs = gst_bytestream_new (qtdemux->sinkpad);
qtdemux->state = QTDEMUX_STATE_HEADER;
/* FIXME */
break;
@@ -468,7 +475,7 @@ static GstElementStateReturn gst_qtdemux_change_state(GstElement *element)
case GST_STATE_PLAYING_TO_PAUSED:
break;
case GST_STATE_PAUSED_TO_READY:
- gst_bytestream_destroy(qtdemux->bs);
+ gst_bytestream_destroy (qtdemux->bs);
break;
case GST_STATE_READY_TO_NULL:
break;
@@ -476,12 +483,13 @@ static GstElementStateReturn gst_qtdemux_change_state(GstElement *element)
break;
}
- return GST_ELEMENT_CLASS(parent_class)->change_state(element);
+ return GST_ELEMENT_CLASS (parent_class)->change_state (element);
}
-static void gst_qtdemux_loop_header (GstElement *element)
+static void
+gst_qtdemux_loop_header (GstElement * element)
{
- GstQTDemux *qtdemux = GST_QTDEMUX(element);
+ GstQTDemux *qtdemux = GST_QTDEMUX (element);
guint8 *data;
guint32 length;
guint32 fourcc;
@@ -493,220 +501,230 @@ static void gst_qtdemux_loop_header (GstElement *element)
/* FIXME _tell gets the offset wrong */
//cur_offset = gst_bytestream_tell(qtdemux->bs);
-
+
cur_offset = qtdemux->offset;
- GST_DEBUG ("loop at position %d",cur_offset);
-
- switch(qtdemux->state){
- case QTDEMUX_STATE_HEADER:
- {
- do{
- ret = gst_bytestream_peek_bytes(qtdemux->bs, &data, 16);
- if(ret<16){
- if(!gst_qtdemux_handle_sink_event(qtdemux)){
- return;
+ GST_DEBUG ("loop at position %d", cur_offset);
+
+ switch (qtdemux->state) {
+ case QTDEMUX_STATE_HEADER:
+ {
+ do {
+ ret = gst_bytestream_peek_bytes (qtdemux->bs, &data, 16);
+ if (ret < 16) {
+ if (!gst_qtdemux_handle_sink_event (qtdemux)) {
+ return;
+ }
+ } else {
+ break;
}
- }else{
- break;
+ } while (1);
+
+ length = GUINT32_FROM_BE (*(guint32 *) data);
+ GST_DEBUG ("length %08x", length);
+ fourcc = GUINT32_FROM_LE (*(guint32 *) (data + 4));
+ GST_DEBUG ("fourcc " GST_FOURCC_FORMAT, GST_FOURCC_ARGS (fourcc));
+
+ if (length == 0) {
+ length = gst_bytestream_length (qtdemux->bs) - cur_offset;
}
- }while(1);
+ if (length == 1) {
+ guint32 length1, length2;
- length = GUINT32_FROM_BE(*(guint32 *)data);
- GST_DEBUG ("length %08x",length);
- fourcc = GUINT32_FROM_LE(*(guint32 *)(data+4));
- GST_DEBUG ("fourcc " GST_FOURCC_FORMAT, GST_FOURCC_ARGS(fourcc));
+ length1 = GUINT32_FROM_BE (*(guint32 *) (data + 8));
+ GST_DEBUG ("length1 %08x", length1);
+ length2 = GUINT32_FROM_BE (*(guint32 *) (data + 12));
+ GST_DEBUG ("length2 %08x", length2);
- if(length==0){
- length = gst_bytestream_length(qtdemux->bs) - cur_offset;
- }
- if(length==1){
- guint32 length1, length2;
-
- length1 = GUINT32_FROM_BE(*(guint32 *)(data+8));
- GST_DEBUG ("length1 %08x",length1);
- length2 = GUINT32_FROM_BE(*(guint32 *)(data+12));
- GST_DEBUG ("length2 %08x",length2);
-
- length=length2;
- }
-
- switch(fourcc){
- case GST_MAKE_FOURCC('m','d','a','t'):
- case GST_MAKE_FOURCC('f','r','e','e'):
- case GST_MAKE_FOURCC('w','i','d','e'):
- case GST_MAKE_FOURCC('P','I','C','T'):
- case GST_MAKE_FOURCC('p','n','o','t'):
- break;
- case GST_MAKE_FOURCC('m','o','o','v'):
- {
- GstBuffer *moov;
-
- do{
- ret = gst_bytestream_read(qtdemux->bs, &moov, length);
- if(ret < length){
- GST_DEBUG ("read failed (%d < %d)",ret,length);
- if(!gst_qtdemux_handle_sink_event(qtdemux)){
- return;
+ length = length2;
+ }
+
+ switch (fourcc) {
+ case GST_MAKE_FOURCC ('m', 'd', 'a', 't'):
+ case GST_MAKE_FOURCC ('f', 'r', 'e', 'e'):
+ case GST_MAKE_FOURCC ('w', 'i', 'd', 'e'):
+ case GST_MAKE_FOURCC ('P', 'I', 'C', 'T'):
+ case GST_MAKE_FOURCC ('p', 'n', 'o', 't'):
+ break;
+ case GST_MAKE_FOURCC ('m', 'o', 'o', 'v'):
+ {
+ GstBuffer *moov;
+
+ do {
+ ret = gst_bytestream_read (qtdemux->bs, &moov, length);
+ if (ret < length) {
+ GST_DEBUG ("read failed (%d < %d)", ret, length);
+ if (!gst_qtdemux_handle_sink_event (qtdemux)) {
+ return;
+ }
+ } else {
+ break;
}
- }else{
- break;
+ } while (1);
+
+ qtdemux_parse_moov (qtdemux, GST_BUFFER_DATA (moov), length);
+ if (1)
+ qtdemux_node_dump (qtdemux, qtdemux->moov_node);
+ qtdemux_parse_tree (qtdemux);
+ qtdemux->state = QTDEMUX_STATE_MOVIE;
+ break;
+ }
+ default:
+ {
+ GST_LOG ("unknown %08x '" GST_FOURCC_FORMAT "' at %d\n",
+ fourcc, GST_FOURCC_ARGS (fourcc), cur_offset);
+ break;
+ }
+ }
+ ret = gst_bytestream_seek (qtdemux->bs, cur_offset + length,
+ GST_SEEK_METHOD_SET);
+ qtdemux->offset = cur_offset + length;
+ GST_DEBUG ("seek returned %d\n", ret);
+ break;
+ }
+ case QTDEMUX_STATE_SEEKING_EOS:
+ {
+ guint8 *data;
+
+ do {
+ ret = gst_bytestream_peek_bytes (qtdemux->bs, &data, 1);
+ if (ret < 1) {
+ if (!gst_qtdemux_handle_sink_event (qtdemux)) {
+ return;
}
- }while(1);
+ } else {
+ break;
+ }
+ } while (TRUE);
+ gst_element_set_eos (element);
- qtdemux_parse_moov(qtdemux, GST_BUFFER_DATA(moov), length);
- if(1)qtdemux_node_dump(qtdemux, qtdemux->moov_node);
- qtdemux_parse_tree(qtdemux);
- qtdemux->state = QTDEMUX_STATE_MOVIE;
- break;
- }
- default:
- {
- GST_LOG("unknown %08x '" GST_FOURCC_FORMAT "' at %d\n",
- fourcc, GST_FOURCC_ARGS(fourcc), cur_offset);
- break;
- }
+ qtdemux->state = QTDEMUX_STATE_EOS;
+ return;
}
- ret = gst_bytestream_seek(qtdemux->bs, cur_offset + length,
- GST_SEEK_METHOD_SET);
- qtdemux->offset = cur_offset + length;
- GST_DEBUG ("seek returned %d\n",ret);
- break;
- }
- case QTDEMUX_STATE_SEEKING_EOS:
- {
- guint8 *data;
-
- do{
- ret = gst_bytestream_peek_bytes(qtdemux->bs, &data, 1);
- if(ret<1){
- if(!gst_qtdemux_handle_sink_event(qtdemux)){
- return;
- }
- }else{
- break;
+ case QTDEMUX_STATE_EOS:
+ g_warning ("spinning in EOS\n");
+ return;
+ case QTDEMUX_STATE_MOVIE:
+ {
+ QtDemuxStream *stream;
+ guint64 min_time;
+ int index = -1;
+ int i;
+
+ min_time = G_MAXUINT64;
+ for (i = 0; i < qtdemux->n_streams; i++) {
+ stream = qtdemux->streams[i];
+
+ if (stream->sample_index < stream->n_samples &&
+ stream->samples[stream->sample_index].timestamp < min_time) {
+ min_time = stream->samples[stream->sample_index].timestamp;
+ index = i;
+ }
}
- }while(TRUE);
- gst_element_set_eos(element);
- qtdemux->state = QTDEMUX_STATE_EOS;
- return;
- }
- case QTDEMUX_STATE_EOS:
- g_warning("spinning in EOS\n");
- return;
- case QTDEMUX_STATE_MOVIE:
- {
- QtDemuxStream *stream;
- guint64 min_time;
- int index = -1;
- int i;
-
- min_time = G_MAXUINT64;
- for(i=0;i<qtdemux->n_streams;i++){
- stream = qtdemux->streams[i];
-
- if(stream->sample_index < stream->n_samples &&
- stream->samples[stream->sample_index].timestamp < min_time){
- min_time = stream->samples[stream->sample_index].timestamp;
- index = i;
- }
- }
+ if (index == -1) {
+ for (i = 0; i < qtdemux->n_streams; i++) {
+ gst_pad_push (qtdemux->streams[i]->pad,
+ GST_DATA (gst_event_new (GST_EVENT_EOS)));
+ }
+ ret = gst_bytestream_seek (qtdemux->bs, 0, GST_SEEK_METHOD_END);
+ GST_DEBUG ("seek returned %d", ret);
- if(index==-1){
- for(i=0;i<qtdemux->n_streams;i++){
- gst_pad_push(qtdemux->streams[i]->pad,
- GST_DATA(gst_event_new (GST_EVENT_EOS)));
+ qtdemux->state = QTDEMUX_STATE_SEEKING_EOS;
+ return;
}
- ret = gst_bytestream_seek(qtdemux->bs, 0, GST_SEEK_METHOD_END);
- GST_DEBUG ("seek returned %d",ret);
-
- qtdemux->state = QTDEMUX_STATE_SEEKING_EOS;
- return;
- }
- stream = qtdemux->streams[index];
+ stream = qtdemux->streams[index];
- offset = stream->samples[stream->sample_index].offset;
- size = stream->samples[stream->sample_index].size;
+ offset = stream->samples[stream->sample_index].offset;
+ size = stream->samples[stream->sample_index].size;
- GST_INFO ("pushing from stream %d, sample_index=%d offset=%d size=%d timestamp=%lld",
- index, stream->sample_index, offset, size,
- stream->samples[stream->sample_index].timestamp);
+ GST_INFO
+ ("pushing from stream %d, sample_index=%d offset=%d size=%d timestamp=%lld",
+ index, stream->sample_index, offset, size,
+ stream->samples[stream->sample_index].timestamp);
- cur_offset = gst_bytestream_tell(qtdemux->bs);
- if(offset != cur_offset){
- GST_DEBUG ("seeking to offset %d",offset);
- GST_LOG ("seeking to offset %d\n",offset);
- ret = gst_bytestream_seek(qtdemux->bs, offset, GST_SEEK_METHOD_SET);
- GST_DEBUG ("seek returned %d",ret);
- return;
- }
+ cur_offset = gst_bytestream_tell (qtdemux->bs);
+ if (offset != cur_offset) {
+ GST_DEBUG ("seeking to offset %d", offset);
+ GST_LOG ("seeking to offset %d\n", offset);
+ ret = gst_bytestream_seek (qtdemux->bs, offset, GST_SEEK_METHOD_SET);
+ GST_DEBUG ("seek returned %d", ret);
+ return;
+ }
- GST_DEBUG ("reading %d bytes\n",size);
- buf = NULL;
- do{
- ret = gst_bytestream_read(qtdemux->bs, &buf, size);
- if(ret < size){
- GST_DEBUG ("read failed (%d < %d)",ret,size);
- if(!gst_qtdemux_handle_sink_event(qtdemux)){
- return;
+ GST_DEBUG ("reading %d bytes\n", size);
+ buf = NULL;
+ do {
+ ret = gst_bytestream_read (qtdemux->bs, &buf, size);
+ if (ret < size) {
+ GST_DEBUG ("read failed (%d < %d)", ret, size);
+ if (!gst_qtdemux_handle_sink_event (qtdemux)) {
+ return;
+ }
+ } else {
+ break;
+ }
+ } while (TRUE);
+
+ if (buf) {
+ /* hum... */
+ if (stream->subtype == GST_MAKE_FOURCC ('v', 'i', 'd', 'e')) {
+ float fps =
+ 1. * GST_SECOND / stream->samples[stream->sample_index].duration;
+ if (fps != stream->fps) {
+ gst_caps_set_simple (stream->caps, "framerate", G_TYPE_DOUBLE, fps,
+ NULL);
+ stream->fps = fps;
+ gst_pad_set_explicit_caps (stream->pad, stream->caps);
+ }
}
- }else{
- break;
- }
- }while(TRUE);
-
- if(buf){
- /* hum... */
- if(stream->subtype == GST_MAKE_FOURCC('v','i','d','e')){
- float fps = 1. * GST_SECOND / stream->samples[stream->sample_index].duration;
- if (fps != stream->fps) {
- gst_caps_set_simple (stream->caps, "framerate", G_TYPE_DOUBLE, fps,
- NULL);
- stream->fps = fps;
- gst_pad_set_explicit_caps(stream->pad, stream->caps);
- }
- }
- GST_BUFFER_TIMESTAMP(buf) = stream->samples[stream->sample_index].timestamp;
- GST_BUFFER_DURATION(buf) = stream->samples[stream->sample_index].duration;
- gst_pad_push(stream->pad, GST_DATA (buf));
+ GST_BUFFER_TIMESTAMP (buf) =
+ stream->samples[stream->sample_index].timestamp;
+ GST_BUFFER_DURATION (buf) =
+ stream->samples[stream->sample_index].duration;
+ gst_pad_push (stream->pad, GST_DATA (buf));
- GST_DEBUG ("pushing buffer on %" GST_PTR_FORMAT, stream->pad);
+ GST_DEBUG ("pushing buffer on %" GST_PTR_FORMAT, stream->pad);
+ }
+ stream->sample_index++;
+ break;
}
- stream->sample_index++;
- break;
- }
- default:
- /* unreached */
- g_assert(0);
+ default:
+ /* unreached */
+ g_assert (0);
}
}
-void gst_qtdemux_add_stream(GstQTDemux *qtdemux, QtDemuxStream *stream)
+void
+gst_qtdemux_add_stream (GstQTDemux * qtdemux, QtDemuxStream * stream)
{
- if(stream->subtype == GST_MAKE_FOURCC('v','i','d','e')){
+ if (stream->subtype == GST_MAKE_FOURCC ('v', 'i', 'd', 'e')) {
gchar *name = g_strdup_printf ("video_%02d", qtdemux->n_video_streams);
- stream->pad = gst_pad_new_from_template (
- gst_static_pad_template_get(&gst_qtdemux_videosrc_template), name);
+
+ stream->pad =
+ gst_pad_new_from_template (gst_static_pad_template_get
+ (&gst_qtdemux_videosrc_template), name);
g_free (name);
stream->fps = 1. * GST_SECOND / stream->samples[0].duration;
- if(stream->caps){
- gst_caps_set_simple(stream->caps,
+ if (stream->caps) {
+ gst_caps_set_simple (stream->caps,
"width", G_TYPE_INT, stream->width,
"height", G_TYPE_INT, stream->height,
"framerate", G_TYPE_DOUBLE, stream->fps, NULL);
}
qtdemux->n_video_streams++;
- }else{
+ } else {
gchar *name = g_strdup_printf ("audio_%02d", qtdemux->n_audio_streams);
- stream->pad = gst_pad_new_from_template (
- gst_static_pad_template_get(&gst_qtdemux_audiosrc_template), name);
+
+ stream->pad =
+ gst_pad_new_from_template (gst_static_pad_template_get
+ (&gst_qtdemux_audiosrc_template), name);
g_free (name);
- if(stream->caps){
- gst_caps_set_simple(stream->caps,
- "rate", G_TYPE_INT, (int)stream->rate,
+ if (stream->caps) {
+ gst_caps_set_simple (stream->caps,
+ "rate", G_TYPE_INT, (int) stream->rate,
"channels", G_TYPE_INT, stream->n_channels, NULL);
}
qtdemux->n_audio_streams++;
@@ -714,22 +732,23 @@ void gst_qtdemux_add_stream(GstQTDemux *qtdemux, QtDemuxStream *stream)
gst_pad_use_explicit_caps (stream->pad);
- GST_PAD_ELEMENT_PRIVATE(stream->pad) = stream;
+ GST_PAD_ELEMENT_PRIVATE (stream->pad) = stream;
qtdemux->streams[qtdemux->n_streams] = stream;
qtdemux->n_streams++;
GST_DEBUG ("n_streams is now %d", qtdemux->n_streams);
gst_pad_set_event_mask_function (stream->pad, gst_qtdemux_get_event_mask);
gst_pad_set_event_function (stream->pad, gst_qtdemux_handle_src_event);
- gst_pad_set_query_type_function (stream->pad, gst_qtdemux_get_src_query_types);
+ gst_pad_set_query_type_function (stream->pad,
+ gst_qtdemux_get_src_query_types);
gst_pad_set_query_function (stream->pad, gst_qtdemux_handle_src_query);
gst_pad_set_formats_function (stream->pad, gst_qtdemux_get_src_formats);
gst_pad_set_convert_function (stream->pad, gst_qtdemux_src_convert);
- gst_pad_set_explicit_caps(stream->pad, stream->caps);
+ gst_pad_set_explicit_caps (stream->pad, stream->caps);
GST_DEBUG ("adding pad %p to qtdemux %p", stream->pad, qtdemux);
- gst_element_add_pad(GST_ELEMENT (qtdemux), stream->pad);
+ gst_element_add_pad (GST_ELEMENT (qtdemux), stream->pad);
}
@@ -777,101 +796,104 @@ void gst_qtdemux_add_stream(GstQTDemux *qtdemux, QtDemuxStream *stream)
#define FOURCC_cmvd GST_MAKE_FOURCC('c','m','v','d')
-static void qtdemux_dump_mvhd(GstQTDemux *qtdemux, void *buffer, int depth);
-static void qtdemux_dump_tkhd(GstQTDemux *qtdemux, void *buffer, int depth);
-static void qtdemux_dump_elst(GstQTDemux *qtdemux, void *buffer, int depth);
-static void qtdemux_dump_mdhd(GstQTDemux *qtdemux, void *buffer, int depth);
-static void qtdemux_dump_hdlr(GstQTDemux *qtdemux, void *buffer, int depth);
-static void qtdemux_dump_vmhd(GstQTDemux *qtdemux, void *buffer, int depth);
-static void qtdemux_dump_dref(GstQTDemux *qtdemux, void *buffer, int depth);
-static void qtdemux_dump_stsd(GstQTDemux *qtdemux, void *buffer, int depth);
-static void qtdemux_dump_stts(GstQTDemux *qtdemux, void *buffer, int depth);
-static void qtdemux_dump_stss(GstQTDemux *qtdemux, void *buffer, int depth);
-static void qtdemux_dump_stsc(GstQTDemux *qtdemux, void *buffer, int depth);
-static void qtdemux_dump_stsz(GstQTDemux *qtdemux, void *buffer, int depth);
-static void qtdemux_dump_stco(GstQTDemux *qtdemux, void *buffer, int depth);
-static void qtdemux_dump_co64(GstQTDemux *qtdemux, void *buffer, int depth);
-static void qtdemux_dump_dcom(GstQTDemux *qtdemux, void *buffer, int depth);
-static void qtdemux_dump_cmvd(GstQTDemux *qtdemux, void *buffer, int depth);
+static void qtdemux_dump_mvhd (GstQTDemux * qtdemux, void *buffer, int depth);
+static void qtdemux_dump_tkhd (GstQTDemux * qtdemux, void *buffer, int depth);
+static void qtdemux_dump_elst (GstQTDemux * qtdemux, void *buffer, int depth);
+static void qtdemux_dump_mdhd (GstQTDemux * qtdemux, void *buffer, int depth);
+static void qtdemux_dump_hdlr (GstQTDemux * qtdemux, void *buffer, int depth);
+static void qtdemux_dump_vmhd (GstQTDemux * qtdemux, void *buffer, int depth);
+static void qtdemux_dump_dref (GstQTDemux * qtdemux, void *buffer, int depth);
+static void qtdemux_dump_stsd (GstQTDemux * qtdemux, void *buffer, int depth);
+static void qtdemux_dump_stts (GstQTDemux * qtdemux, void *buffer, int depth);
+static void qtdemux_dump_stss (GstQTDemux * qtdemux, void *buffer, int depth);
+static void qtdemux_dump_stsc (GstQTDemux * qtdemux, void *buffer, int depth);
+static void qtdemux_dump_stsz (GstQTDemux * qtdemux, void *buffer, int depth);
+static void qtdemux_dump_stco (GstQTDemux * qtdemux, void *buffer, int depth);
+static void qtdemux_dump_co64 (GstQTDemux * qtdemux, void *buffer, int depth);
+static void qtdemux_dump_dcom (GstQTDemux * qtdemux, void *buffer, int depth);
+static void qtdemux_dump_cmvd (GstQTDemux * qtdemux, void *buffer, int depth);
QtNodeType qt_node_types[] = {
- { FOURCC_moov, "movie", QT_CONTAINER, },
- { FOURCC_mvhd, "movie header", 0,
- qtdemux_dump_mvhd },
- { FOURCC_clip, "clipping", QT_CONTAINER, },
- { FOURCC_trak, "track", QT_CONTAINER, },
- { FOURCC_udta, "user data", 0, }, /* special container */
- { FOURCC_ctab, "color table", 0, },
- { FOURCC_tkhd, "track header", 0,
- qtdemux_dump_tkhd },
- { FOURCC_crgn, "clipping region", 0, },
- { FOURCC_matt, "track matte", QT_CONTAINER, },
- { FOURCC_kmat, "compressed matte", 0, },
- { FOURCC_edts, "edit", QT_CONTAINER, },
- { FOURCC_elst, "edit list", 0,
- qtdemux_dump_elst },
- { FOURCC_load, "track load settings", 0, },
- { FOURCC_tref, "track reference", QT_CONTAINER, },
- { FOURCC_imap, "track input map", QT_CONTAINER, },
- { FOURCC___in, "track input", 0, }, /* special container */
- { FOURCC___ty, "input type", 0, },
- { FOURCC_mdia, "media", QT_CONTAINER },
- { FOURCC_mdhd, "media header", 0,
- qtdemux_dump_mdhd },
- { FOURCC_hdlr, "handler reference", 0,
- qtdemux_dump_hdlr },
- { FOURCC_minf, "media information", QT_CONTAINER },
- { FOURCC_vmhd, "video media information", 0,
- qtdemux_dump_vmhd },
- { FOURCC_smhd, "sound media information", 0 },
- { FOURCC_gmhd, "base media information header", 0 },
- { FOURCC_gmin, "base media info", 0 },
- { FOURCC_dinf, "data information", QT_CONTAINER },
- { FOURCC_dref, "data reference", 0,
- qtdemux_dump_dref },
- { FOURCC_stbl, "sample table", QT_CONTAINER },
- { FOURCC_stsd, "sample description", 0,
- qtdemux_dump_stsd },
- { FOURCC_stts, "time-to-sample", 0,
- qtdemux_dump_stts },
- { FOURCC_stss, "sync sample", 0,
- qtdemux_dump_stss },
- { FOURCC_stsc, "sample-to-chunk", 0,
- qtdemux_dump_stsc },
- { FOURCC_stsz, "sample size", 0,
- qtdemux_dump_stsz },
- { FOURCC_stco, "chunk offset", 0,
- qtdemux_dump_stco },
- { FOURCC_co64, "64-bit chunk offset", 0,
- qtdemux_dump_co64 },
- { FOURCC_vide, "video media", 0 },
- { FOURCC_cmov, "compressed movie", QT_CONTAINER },
- { FOURCC_dcom, "compressed data", 0,
- qtdemux_dump_dcom },
- { FOURCC_cmvd, "compressed movie data", 0,
- qtdemux_dump_cmvd },
- { 0, "unknown", 0 },
+ {FOURCC_moov, "movie", QT_CONTAINER,},
+ {FOURCC_mvhd, "movie header", 0,
+ qtdemux_dump_mvhd},
+ {FOURCC_clip, "clipping", QT_CONTAINER,},
+ {FOURCC_trak, "track", QT_CONTAINER,},
+ {FOURCC_udta, "user data", 0,}, /* special container */
+ {FOURCC_ctab, "color table", 0,},
+ {FOURCC_tkhd, "track header", 0,
+ qtdemux_dump_tkhd},
+ {FOURCC_crgn, "clipping region", 0,},
+ {FOURCC_matt, "track matte", QT_CONTAINER,},
+ {FOURCC_kmat, "compressed matte", 0,},
+ {FOURCC_edts, "edit", QT_CONTAINER,},
+ {FOURCC_elst, "edit list", 0,
+ qtdemux_dump_elst},
+ {FOURCC_load, "track load settings", 0,},
+ {FOURCC_tref, "track reference", QT_CONTAINER,},
+ {FOURCC_imap, "track input map", QT_CONTAINER,},
+ {FOURCC___in, "track input", 0,}, /* special container */
+ {FOURCC___ty, "input type", 0,},
+ {FOURCC_mdia, "media", QT_CONTAINER},
+ {FOURCC_mdhd, "media header", 0,
+ qtdemux_dump_mdhd},
+ {FOURCC_hdlr, "handler reference", 0,
+ qtdemux_dump_hdlr},
+ {FOURCC_minf, "media information", QT_CONTAINER},
+ {FOURCC_vmhd, "video media information", 0,
+ qtdemux_dump_vmhd},
+ {FOURCC_smhd, "sound media information", 0},
+ {FOURCC_gmhd, "base media information header", 0},
+ {FOURCC_gmin, "base media info", 0},
+ {FOURCC_dinf, "data information", QT_CONTAINER},
+ {FOURCC_dref, "data reference", 0,
+ qtdemux_dump_dref},
+ {FOURCC_stbl, "sample table", QT_CONTAINER},
+ {FOURCC_stsd, "sample description", 0,
+ qtdemux_dump_stsd},
+ {FOURCC_stts, "time-to-sample", 0,
+ qtdemux_dump_stts},
+ {FOURCC_stss, "sync sample", 0,
+ qtdemux_dump_stss},
+ {FOURCC_stsc, "sample-to-chunk", 0,
+ qtdemux_dump_stsc},
+ {FOURCC_stsz, "sample size", 0,
+ qtdemux_dump_stsz},
+ {FOURCC_stco, "chunk offset", 0,
+ qtdemux_dump_stco},
+ {FOURCC_co64, "64-bit chunk offset", 0,
+ qtdemux_dump_co64},
+ {FOURCC_vide, "video media", 0},
+ {FOURCC_cmov, "compressed movie", QT_CONTAINER},
+ {FOURCC_dcom, "compressed data", 0,
+ qtdemux_dump_dcom},
+ {FOURCC_cmvd, "compressed movie data", 0,
+ qtdemux_dump_cmvd},
+ {0, "unknown", 0},
};
-static int n_qt_node_types = sizeof(qt_node_types)/sizeof(qt_node_types[0]);
+static int n_qt_node_types = sizeof (qt_node_types) / sizeof (qt_node_types[0]);
-static void *qtdemux_zalloc(void *opaque, unsigned int items, unsigned int size)
+static void *
+qtdemux_zalloc (void *opaque, unsigned int items, unsigned int size)
{
- return g_malloc(items*size);
+ return g_malloc (items * size);
}
-static void qtdemux_zfree(void *opaque, void *addr)
+static void
+qtdemux_zfree (void *opaque, void *addr)
{
- g_free(addr);
+ g_free (addr);
}
-static void *qtdemux_inflate(void *z_buffer, int z_length, int length)
+static void *
+qtdemux_inflate (void *z_buffer, int z_length, int length)
{
void *buffer;
z_stream *z;
int ret;
- z = g_new0(z_stream, 1);
+ z = g_new0 (z_stream, 1);
z->zalloc = qtdemux_zalloc;
z->zfree = qtdemux_zfree;
z->opaque = NULL;
@@ -879,147 +901,154 @@ static void *qtdemux_inflate(void *z_buffer, int z_length, int length)
z->next_in = z_buffer;
z->avail_in = z_length;
- buffer = g_malloc(length);
- ret = inflateInit(z);
- while(z->avail_in > 0){
- if(z->avail_out == 0){
+ buffer = g_malloc (length);
+ ret = inflateInit (z);
+ while (z->avail_in > 0) {
+ if (z->avail_out == 0) {
length += 1024;
- buffer = realloc(buffer, length);
+ buffer = realloc (buffer, length);
z->next_out = buffer + z->total_out;
z->avail_out = 1024;
}
- ret = inflate(z,Z_SYNC_FLUSH);
- if(ret != Z_OK)break;
+ ret = inflate (z, Z_SYNC_FLUSH);
+ if (ret != Z_OK)
+ break;
}
- if(ret != Z_STREAM_END){
- g_warning("inflate() returned %d\n",ret);
+ if (ret != Z_STREAM_END) {
+ g_warning ("inflate() returned %d\n", ret);
}
- g_free(z);
+ g_free (z);
return buffer;
}
-static void qtdemux_parse_moov(GstQTDemux *qtdemux, void *buffer, int length)
+static void
+qtdemux_parse_moov (GstQTDemux * qtdemux, void *buffer, int length)
{
GNode *cmov;
- qtdemux->moov_node = g_node_new(buffer);
+ qtdemux->moov_node = g_node_new (buffer);
- qtdemux_parse(qtdemux, qtdemux->moov_node, buffer, length);
+ qtdemux_parse (qtdemux, qtdemux->moov_node, buffer, length);
- cmov = qtdemux_tree_get_child_by_type(qtdemux->moov_node, FOURCC_cmov);
- if(cmov){
+ cmov = qtdemux_tree_get_child_by_type (qtdemux->moov_node, FOURCC_cmov);
+ if (cmov) {
GNode *dcom;
GNode *cmvd;
- dcom = qtdemux_tree_get_child_by_type(cmov, FOURCC_dcom);
- cmvd = qtdemux_tree_get_child_by_type(cmov, FOURCC_cmvd);
+ dcom = qtdemux_tree_get_child_by_type (cmov, FOURCC_dcom);
+ cmvd = qtdemux_tree_get_child_by_type (cmov, FOURCC_cmvd);
- if(QTDEMUX_FOURCC_GET(dcom->data+8) == GST_MAKE_FOURCC('z','l','i','b')){
+ if (QTDEMUX_FOURCC_GET (dcom->data + 8) == GST_MAKE_FOURCC ('z', 'l', 'i',
+ 'b')) {
int uncompressed_length;
int compressed_length;
void *buf;
-
- uncompressed_length = QTDEMUX_GUINT32_GET(cmvd->data+8);
- compressed_length = QTDEMUX_GUINT32_GET(cmvd->data+4) - 12;
- GST_LOG("length = %d\n",uncompressed_length);
- buf = qtdemux_inflate(cmvd->data + 12, compressed_length,
+ uncompressed_length = QTDEMUX_GUINT32_GET (cmvd->data + 8);
+ compressed_length = QTDEMUX_GUINT32_GET (cmvd->data + 4) - 12;
+ GST_LOG ("length = %d\n", uncompressed_length);
+
+ buf = qtdemux_inflate (cmvd->data + 12, compressed_length,
uncompressed_length);
qtdemux->moov_node_compressed = qtdemux->moov_node;
- qtdemux->moov_node = g_node_new(buf);
+ qtdemux->moov_node = g_node_new (buf);
- qtdemux_parse(qtdemux, qtdemux->moov_node, buf, uncompressed_length);
- }else{
- GST_LOG("unknown header compression type\n");
+ qtdemux_parse (qtdemux, qtdemux->moov_node, buf, uncompressed_length);
+ } else {
+ GST_LOG ("unknown header compression type\n");
}
}
}
-static void qtdemux_parse(GstQTDemux *qtdemux, GNode *node, void *buffer, int length)
+static void
+qtdemux_parse (GstQTDemux * qtdemux, GNode * node, void *buffer, int length)
{
guint32 fourcc;
guint32 node_length;
QtNodeType *type;
void *end;
- GST_LOG("qtdemux_parse %p %d\n",buffer, length);
+ GST_LOG ("qtdemux_parse %p %d\n", buffer, length);
- node_length = QTDEMUX_GUINT32_GET(buffer);
- fourcc = QTDEMUX_FOURCC_GET(buffer+4);
+ node_length = QTDEMUX_GUINT32_GET (buffer);
+ fourcc = QTDEMUX_FOURCC_GET (buffer + 4);
- type = qtdemux_type_get(fourcc);
-
- GST_LOG("parsing '" GST_FOURCC_FORMAT "', length=%d\n",
- GST_FOURCC_ARGS(fourcc), node_length);
+ type = qtdemux_type_get (fourcc);
- if(type->flags & QT_CONTAINER){
+ GST_LOG ("parsing '" GST_FOURCC_FORMAT "', length=%d\n",
+ GST_FOURCC_ARGS (fourcc), node_length);
+
+ if (type->flags & QT_CONTAINER) {
void *buf;
guint32 len;
buf = buffer + 8;
end = buffer + length;
- while(buf < end){
+ while (buf < end) {
GNode *child;
- if(buf + 8 >= end){
+ if (buf + 8 >= end) {
/* FIXME: get annoyed */
- GST_LOG("buffer overrun\n");
+ GST_LOG ("buffer overrun\n");
}
- len = QTDEMUX_GUINT32_GET(buf);
+ len = QTDEMUX_GUINT32_GET (buf);
- child = g_node_new(buf);
- g_node_append(node, child);
- qtdemux_parse(qtdemux, child, buf, len);
+ child = g_node_new (buf);
+ g_node_append (node, child);
+ qtdemux_parse (qtdemux, child, buf, len);
buf += len;
}
- }else{
+ } else {
#if 0
- if(fourcc == FOURCC_cmvd){
+ if (fourcc == FOURCC_cmvd) {
int uncompressed_length;
void *buf;
-
- uncompressed_length = QTDEMUX_GUINT32_GET(buffer+8);
- GST_LOG("length = %d\n",uncompressed_length);
- buf = qtdemux_inflate(buffer + 12, node_length-12, uncompressed_length);
+ uncompressed_length = QTDEMUX_GUINT32_GET (buffer + 8);
+ GST_LOG ("length = %d\n", uncompressed_length);
+
+ buf =
+ qtdemux_inflate (buffer + 12, node_length - 12, uncompressed_length);
end = buf + uncompressed_length;
- while(buf < end){
- GNode *child;
+ while (buf < end) {
+ GNode *child;
guint32 len;
- if(buf + 8 >= end){
+ if (buf + 8 >= end) {
/* FIXME: get annoyed */
- GST_LOG("buffer overrun\n");
- }
- len = QTDEMUX_GUINT32_GET(buf);
+ GST_LOG ("buffer overrun\n");
+ }
+ len = QTDEMUX_GUINT32_GET (buf);
- child = g_node_new(buf);
- g_node_append(node, child);
- qtdemux_parse(qtdemux, child, buf, len);
+ child = g_node_new (buf);
+ g_node_append (node, child);
+ qtdemux_parse (qtdemux, child, buf, len);
- buf += len;
+ buf += len;
}
}
#endif
}
}
-static QtNodeType *qtdemux_type_get(guint32 fourcc)
+static QtNodeType *
+qtdemux_type_get (guint32 fourcc)
{
int i;
- for(i=0;i<n_qt_node_types;i++){
- if(qt_node_types[i].fourcc == fourcc)
- return qt_node_types+i;
+ for (i = 0; i < n_qt_node_types; i++) {
+ if (qt_node_types[i].fourcc == fourcc)
+ return qt_node_types + i;
}
- return qt_node_types+n_qt_node_types-1;
+ return qt_node_types + n_qt_node_types - 1;
}
-static gboolean qtdemux_node_dump_foreach(GNode *node, gpointer data)
+static gboolean
+qtdemux_node_dump_foreach (GNode * node, gpointer data)
{
void *buffer = node->data;
guint32 node_length;
@@ -1027,353 +1056,456 @@ static gboolean qtdemux_node_dump_foreach(GNode *node, gpointer data)
QtNodeType *type;
int depth;
- node_length = GUINT32_FROM_BE(*(guint32 *)buffer);
- fourcc = GUINT32_FROM_LE(*(guint32 *)(buffer+4));
+ node_length = GUINT32_FROM_BE (*(guint32 *) buffer);
+ fourcc = GUINT32_FROM_LE (*(guint32 *) (buffer + 4));
- type = qtdemux_type_get(fourcc);
+ type = qtdemux_type_get (fourcc);
- depth = (g_node_depth(node)-1)*2;
- GST_LOG("%*s'" GST_FOURCC_FORMAT "', [%d], %s\n",
- depth, "",
- GST_FOURCC_ARGS(fourcc),
- node_length,
- type->name);
+ depth = (g_node_depth (node) - 1) * 2;
+ GST_LOG ("%*s'" GST_FOURCC_FORMAT "', [%d], %s\n",
+ depth, "", GST_FOURCC_ARGS (fourcc), node_length, type->name);
- if(type->dump)type->dump(data, buffer, depth);
+ if (type->dump)
+ type->dump (data, buffer, depth);
return FALSE;
}
-static void qtdemux_node_dump(GstQTDemux *qtdemux, GNode *node)
+static void
+qtdemux_node_dump (GstQTDemux * qtdemux, GNode * node)
{
- g_node_traverse(qtdemux->moov_node, G_PRE_ORDER, G_TRAVERSE_ALL, -1,
+ g_node_traverse (qtdemux->moov_node, G_PRE_ORDER, G_TRAVERSE_ALL, -1,
qtdemux_node_dump_foreach, qtdemux);
}
-static void qtdemux_dump_mvhd(GstQTDemux *qtdemux, void *buffer, int depth)
+static void
+qtdemux_dump_mvhd (GstQTDemux * qtdemux, void *buffer, int depth)
{
- GST_LOG("%*s version/flags: %08x\n", depth, "", QTDEMUX_GUINT32_GET(buffer+8));
- GST_LOG("%*s creation time: %u\n", depth, "", QTDEMUX_GUINT32_GET(buffer+12));
- GST_LOG("%*s modify time: %u\n", depth, "", QTDEMUX_GUINT32_GET(buffer+16));
- GST_LOG("%*s time scale: 1/%u sec\n", depth, "", QTDEMUX_GUINT32_GET(buffer+20));
- GST_LOG("%*s duration: %u\n", depth, "", QTDEMUX_GUINT32_GET(buffer+24));
- GST_LOG("%*s pref. rate: %g\n", depth, "", QTDEMUX_FP32_GET(buffer+28));
- GST_LOG("%*s pref. volume: %g\n", depth, "", QTDEMUX_FP16_GET(buffer+32));
- GST_LOG("%*s preview time: %u\n", depth, "", QTDEMUX_GUINT32_GET(buffer+80));
- GST_LOG("%*s preview dur.: %u\n", depth, "", QTDEMUX_GUINT32_GET(buffer+84));
- GST_LOG("%*s poster time: %u\n", depth, "", QTDEMUX_GUINT32_GET(buffer+88));
- GST_LOG("%*s select time: %u\n", depth, "", QTDEMUX_GUINT32_GET(buffer+92));
- GST_LOG("%*s select dur.: %u\n", depth, "", QTDEMUX_GUINT32_GET(buffer+96));
- GST_LOG("%*s current time: %u\n", depth, "", QTDEMUX_GUINT32_GET(buffer+100));
- GST_LOG("%*s next track ID: %d\n", depth, "", QTDEMUX_GUINT32_GET(buffer+104));
+ GST_LOG ("%*s version/flags: %08x\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + 8));
+ GST_LOG ("%*s creation time: %u\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + 12));
+ GST_LOG ("%*s modify time: %u\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + 16));
+ GST_LOG ("%*s time scale: 1/%u sec\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + 20));
+ GST_LOG ("%*s duration: %u\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + 24));
+ GST_LOG ("%*s pref. rate: %g\n", depth, "",
+ QTDEMUX_FP32_GET (buffer + 28));
+ GST_LOG ("%*s pref. volume: %g\n", depth, "",
+ QTDEMUX_FP16_GET (buffer + 32));
+ GST_LOG ("%*s preview time: %u\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + 80));
+ GST_LOG ("%*s preview dur.: %u\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + 84));
+ GST_LOG ("%*s poster time: %u\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + 88));
+ GST_LOG ("%*s select time: %u\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + 92));
+ GST_LOG ("%*s select dur.: %u\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + 96));
+ GST_LOG ("%*s current time: %u\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + 100));
+ GST_LOG ("%*s next track ID: %d\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + 104));
}
-static void qtdemux_dump_tkhd(GstQTDemux *qtdemux, void *buffer, int depth)
+static void
+qtdemux_dump_tkhd (GstQTDemux * qtdemux, void *buffer, int depth)
{
- GST_LOG("%*s version/flags: %08x\n", depth, "", QTDEMUX_GUINT32_GET(buffer+8));
- GST_LOG("%*s creation time: %u\n", depth, "", QTDEMUX_GUINT32_GET(buffer+12));
- GST_LOG("%*s modify time: %u\n", depth, "", QTDEMUX_GUINT32_GET(buffer+16));
- GST_LOG("%*s track ID: %u\n", depth, "", QTDEMUX_GUINT32_GET(buffer+20));
- GST_LOG("%*s duration: %u\n", depth, "", QTDEMUX_GUINT32_GET(buffer+28));
- GST_LOG("%*s layer: %u\n", depth, "", QTDEMUX_GUINT16_GET(buffer+36));
- GST_LOG("%*s alt group: %u\n", depth, "", QTDEMUX_GUINT16_GET(buffer+38));
- GST_LOG("%*s volume: %g\n", depth, "", QTDEMUX_FP16_GET(buffer+44));
- GST_LOG("%*s track width: %g\n", depth, "", QTDEMUX_FP32_GET(buffer+84));
- GST_LOG("%*s track height: %g\n", depth, "", QTDEMUX_FP32_GET(buffer+88));
+ GST_LOG ("%*s version/flags: %08x\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + 8));
+ GST_LOG ("%*s creation time: %u\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + 12));
+ GST_LOG ("%*s modify time: %u\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + 16));
+ GST_LOG ("%*s track ID: %u\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + 20));
+ GST_LOG ("%*s duration: %u\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + 28));
+ GST_LOG ("%*s layer: %u\n", depth, "",
+ QTDEMUX_GUINT16_GET (buffer + 36));
+ GST_LOG ("%*s alt group: %u\n", depth, "",
+ QTDEMUX_GUINT16_GET (buffer + 38));
+ GST_LOG ("%*s volume: %g\n", depth, "",
+ QTDEMUX_FP16_GET (buffer + 44));
+ GST_LOG ("%*s track width: %g\n", depth, "",
+ QTDEMUX_FP32_GET (buffer + 84));
+ GST_LOG ("%*s track height: %g\n", depth, "",
+ QTDEMUX_FP32_GET (buffer + 88));
}
-static void qtdemux_dump_elst(GstQTDemux *qtdemux, void *buffer, int depth)
+static void
+qtdemux_dump_elst (GstQTDemux * qtdemux, void *buffer, int depth)
{
int i;
int n;
- GST_LOG("%*s version/flags: %08x\n", depth, "", QTDEMUX_GUINT32_GET(buffer+8));
- GST_LOG("%*s n entries: %u\n", depth, "", QTDEMUX_GUINT32_GET(buffer+12));
- n = QTDEMUX_GUINT32_GET(buffer+12);
- for(i=0;i<n;i++){
- GST_LOG("%*s track dur: %u\n", depth, "", QTDEMUX_GUINT32_GET(buffer+16+i*12));
- GST_LOG("%*s media time: %u\n", depth, "", QTDEMUX_GUINT32_GET(buffer+20+i*12));
- GST_LOG("%*s media rate: %g\n", depth, "", QTDEMUX_FP32_GET(buffer+24+i*12));
+ GST_LOG ("%*s version/flags: %08x\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + 8));
+ GST_LOG ("%*s n entries: %u\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + 12));
+ n = QTDEMUX_GUINT32_GET (buffer + 12);
+ for (i = 0; i < n; i++) {
+ GST_LOG ("%*s track dur: %u\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + 16 + i * 12));
+ GST_LOG ("%*s media time: %u\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + 20 + i * 12));
+ GST_LOG ("%*s media rate: %g\n", depth, "",
+ QTDEMUX_FP32_GET (buffer + 24 + i * 12));
}
}
-static void qtdemux_dump_mdhd(GstQTDemux *qtdemux, void *buffer, int depth)
+static void
+qtdemux_dump_mdhd (GstQTDemux * qtdemux, void *buffer, int depth)
{
- GST_LOG("%*s version/flags: %08x\n", depth, "", QTDEMUX_GUINT32_GET(buffer+8));
- GST_LOG("%*s creation time: %u\n", depth, "", QTDEMUX_GUINT32_GET(buffer+12));
- GST_LOG("%*s modify time: %u\n", depth, "", QTDEMUX_GUINT32_GET(buffer+16));
- GST_LOG("%*s time scale: 1/%u sec\n", depth, "", QTDEMUX_GUINT32_GET(buffer+20));
- GST_LOG("%*s duration: %u\n", depth, "", QTDEMUX_GUINT32_GET(buffer+24));
- GST_LOG("%*s language: %u\n", depth, "", QTDEMUX_GUINT16_GET(buffer+28));
- GST_LOG("%*s quality: %u\n", depth, "", QTDEMUX_GUINT16_GET(buffer+30));
+ GST_LOG ("%*s version/flags: %08x\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + 8));
+ GST_LOG ("%*s creation time: %u\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + 12));
+ GST_LOG ("%*s modify time: %u\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + 16));
+ GST_LOG ("%*s time scale: 1/%u sec\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + 20));
+ GST_LOG ("%*s duration: %u\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + 24));
+ GST_LOG ("%*s language: %u\n", depth, "",
+ QTDEMUX_GUINT16_GET (buffer + 28));
+ GST_LOG ("%*s quality: %u\n", depth, "",
+ QTDEMUX_GUINT16_GET (buffer + 30));
}
-static void qtdemux_dump_hdlr(GstQTDemux *qtdemux, void *buffer, int depth)
+static void
+qtdemux_dump_hdlr (GstQTDemux * qtdemux, void *buffer, int depth)
{
- GST_LOG("%*s version/flags: %08x\n", depth, "", QTDEMUX_GUINT32_GET(buffer+8));
- GST_LOG("%*s type: " GST_FOURCC_FORMAT "\n", depth, "",
- GST_FOURCC_ARGS(QTDEMUX_FOURCC_GET(buffer+12)));
- GST_LOG("%*s subtype: " GST_FOURCC_FORMAT "\n", depth, "",
- GST_FOURCC_ARGS(QTDEMUX_FOURCC_GET(buffer+16)));
- GST_LOG("%*s manufacturer: " GST_FOURCC_FORMAT "\n", depth, "",
- GST_FOURCC_ARGS(QTDEMUX_FOURCC_GET(buffer+20)));
- GST_LOG("%*s flags: %08x\n", depth, "", QTDEMUX_GUINT32_GET(buffer+24));
- GST_LOG("%*s flags mask: %08x\n", depth, "", QTDEMUX_GUINT32_GET(buffer+28));
- GST_LOG("%*s name: %*s\n", depth, "",
- QTDEMUX_GUINT8_GET(buffer+32), (char *)(buffer+33));
+ GST_LOG ("%*s version/flags: %08x\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + 8));
+ GST_LOG ("%*s type: " GST_FOURCC_FORMAT "\n", depth, "",
+ GST_FOURCC_ARGS (QTDEMUX_FOURCC_GET (buffer + 12)));
+ GST_LOG ("%*s subtype: " GST_FOURCC_FORMAT "\n", depth, "",
+ GST_FOURCC_ARGS (QTDEMUX_FOURCC_GET (buffer + 16)));
+ GST_LOG ("%*s manufacturer: " GST_FOURCC_FORMAT "\n", depth, "",
+ GST_FOURCC_ARGS (QTDEMUX_FOURCC_GET (buffer + 20)));
+ GST_LOG ("%*s flags: %08x\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + 24));
+ GST_LOG ("%*s flags mask: %08x\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + 28));
+ GST_LOG ("%*s name: %*s\n", depth, "",
+ QTDEMUX_GUINT8_GET (buffer + 32), (char *) (buffer + 33));
}
-static void qtdemux_dump_vmhd(GstQTDemux *qtdemux, void *buffer, int depth)
+static void
+qtdemux_dump_vmhd (GstQTDemux * qtdemux, void *buffer, int depth)
{
- GST_LOG("%*s version/flags: %08x\n", depth, "", QTDEMUX_GUINT32_GET(buffer+8));
- GST_LOG("%*s mode/color: %08x\n", depth, "", QTDEMUX_GUINT32_GET(buffer+16));
+ GST_LOG ("%*s version/flags: %08x\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + 8));
+ GST_LOG ("%*s mode/color: %08x\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + 16));
}
-static void qtdemux_dump_dref(GstQTDemux *qtdemux, void *buffer, int depth)
+static void
+qtdemux_dump_dref (GstQTDemux * qtdemux, void *buffer, int depth)
{
int n;
int i;
int offset;
- GST_LOG("%*s version/flags: %08x\n", depth, "", QTDEMUX_GUINT32_GET(buffer+8));
- GST_LOG("%*s n entries: %u\n", depth, "", QTDEMUX_GUINT32_GET(buffer+12));
- n = QTDEMUX_GUINT32_GET(buffer+12);
+ GST_LOG ("%*s version/flags: %08x\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + 8));
+ GST_LOG ("%*s n entries: %u\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + 12));
+ n = QTDEMUX_GUINT32_GET (buffer + 12);
offset = 16;
- for(i=0;i<n;i++){
- GST_LOG("%*s size: %u\n", depth, "", QTDEMUX_GUINT32_GET(buffer+offset));
- GST_LOG("%*s type: " GST_FOURCC_FORMAT "\n", depth, "",
- GST_FOURCC_ARGS(QTDEMUX_FOURCC_GET(buffer+offset+4)));
- offset += QTDEMUX_GUINT32_GET(buffer+offset);
+ for (i = 0; i < n; i++) {
+ GST_LOG ("%*s size: %u\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + offset));
+ GST_LOG ("%*s type: " GST_FOURCC_FORMAT "\n", depth, "",
+ GST_FOURCC_ARGS (QTDEMUX_FOURCC_GET (buffer + offset + 4)));
+ offset += QTDEMUX_GUINT32_GET (buffer + offset);
}
}
-static void qtdemux_dump_stsd(GstQTDemux *qtdemux, void *buffer, int depth)
+static void
+qtdemux_dump_stsd (GstQTDemux * qtdemux, void *buffer, int depth)
{
int i;
int n;
int offset;
- GST_LOG("%*s version/flags: %08x\n", depth, "", QTDEMUX_GUINT32_GET(buffer+8));
- GST_LOG("%*s n entries: %d\n", depth, "", QTDEMUX_GUINT32_GET(buffer+12));
- n = QTDEMUX_GUINT32_GET(buffer+12);
+ GST_LOG ("%*s version/flags: %08x\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + 8));
+ GST_LOG ("%*s n entries: %d\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + 12));
+ n = QTDEMUX_GUINT32_GET (buffer + 12);
offset = 16;
- for(i=0;i<n;i++){
- GST_LOG("%*s size: %u\n", depth, "", QTDEMUX_GUINT32_GET(buffer+offset));
- GST_LOG("%*s type: " GST_FOURCC_FORMAT "\n", depth, "",
- GST_FOURCC_ARGS(QTDEMUX_FOURCC_GET(buffer+offset+4)));
- GST_LOG("%*s data reference:%d\n", depth, "", QTDEMUX_GUINT16_GET(buffer+offset+14));
-
- GST_LOG("%*s version/rev.: %08x\n", depth, "", QTDEMUX_GUINT32_GET(buffer+offset+16));
- GST_LOG("%*s vendor: " GST_FOURCC_FORMAT "\n", depth, "",
- GST_FOURCC_ARGS(QTDEMUX_FOURCC_GET(buffer+offset+20)));
- GST_LOG("%*s temporal qual: %u\n", depth, "", QTDEMUX_GUINT32_GET(buffer+offset+24));
- GST_LOG("%*s spatial qual: %u\n", depth, "", QTDEMUX_GUINT32_GET(buffer+offset+28));
- GST_LOG("%*s width: %u\n", depth, "", QTDEMUX_GUINT16_GET(buffer+offset+32));
- GST_LOG("%*s height: %u\n", depth, "", QTDEMUX_GUINT16_GET(buffer+offset+34));
- GST_LOG("%*s horiz. resol: %g\n", depth, "", QTDEMUX_FP32_GET(buffer+offset+36));
- GST_LOG("%*s vert. resol.: %g\n", depth, "", QTDEMUX_FP32_GET(buffer+offset+40));
- GST_LOG("%*s data size: %u\n", depth, "", QTDEMUX_GUINT32_GET(buffer+offset+44));
- GST_LOG("%*s frame count: %u\n", depth, "", QTDEMUX_GUINT16_GET(buffer+offset+48));
- GST_LOG("%*s compressor: %*s\n", depth, "",
- QTDEMUX_GUINT8_GET(buffer+offset+49), (char *)(buffer+offset+51));
- GST_LOG("%*s depth: %u\n", depth, "", QTDEMUX_GUINT16_GET(buffer+offset+82));
- GST_LOG("%*s color table ID:%u\n", depth, "", QTDEMUX_GUINT16_GET(buffer+offset+84));
-
- offset += QTDEMUX_GUINT32_GET(buffer+offset);
+ for (i = 0; i < n; i++) {
+ GST_LOG ("%*s size: %u\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + offset));
+ GST_LOG ("%*s type: " GST_FOURCC_FORMAT "\n", depth, "",
+ GST_FOURCC_ARGS (QTDEMUX_FOURCC_GET (buffer + offset + 4)));
+ GST_LOG ("%*s data reference:%d\n", depth, "",
+ QTDEMUX_GUINT16_GET (buffer + offset + 14));
+
+ GST_LOG ("%*s version/rev.: %08x\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + offset + 16));
+ GST_LOG ("%*s vendor: " GST_FOURCC_FORMAT "\n", depth, "",
+ GST_FOURCC_ARGS (QTDEMUX_FOURCC_GET (buffer + offset + 20)));
+ GST_LOG ("%*s temporal qual: %u\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + offset + 24));
+ GST_LOG ("%*s spatial qual: %u\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + offset + 28));
+ GST_LOG ("%*s width: %u\n", depth, "",
+ QTDEMUX_GUINT16_GET (buffer + offset + 32));
+ GST_LOG ("%*s height: %u\n", depth, "",
+ QTDEMUX_GUINT16_GET (buffer + offset + 34));
+ GST_LOG ("%*s horiz. resol: %g\n", depth, "",
+ QTDEMUX_FP32_GET (buffer + offset + 36));
+ GST_LOG ("%*s vert. resol.: %g\n", depth, "",
+ QTDEMUX_FP32_GET (buffer + offset + 40));
+ GST_LOG ("%*s data size: %u\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + offset + 44));
+ GST_LOG ("%*s frame count: %u\n", depth, "",
+ QTDEMUX_GUINT16_GET (buffer + offset + 48));
+ GST_LOG ("%*s compressor: %*s\n", depth, "",
+ QTDEMUX_GUINT8_GET (buffer + offset + 49),
+ (char *) (buffer + offset + 51));
+ GST_LOG ("%*s depth: %u\n", depth, "",
+ QTDEMUX_GUINT16_GET (buffer + offset + 82));
+ GST_LOG ("%*s color table ID:%u\n", depth, "",
+ QTDEMUX_GUINT16_GET (buffer + offset + 84));
+
+ offset += QTDEMUX_GUINT32_GET (buffer + offset);
}
}
-static void qtdemux_dump_stts(GstQTDemux *qtdemux, void *buffer, int depth)
+static void
+qtdemux_dump_stts (GstQTDemux * qtdemux, void *buffer, int depth)
{
int i;
int n;
int offset;
- GST_LOG("%*s version/flags: %08x\n", depth, "", QTDEMUX_GUINT32_GET(buffer+8));
- GST_LOG("%*s n entries: %d\n", depth, "", QTDEMUX_GUINT32_GET(buffer+12));
- n = QTDEMUX_GUINT32_GET(buffer+12);
+ GST_LOG ("%*s version/flags: %08x\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + 8));
+ GST_LOG ("%*s n entries: %d\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + 12));
+ n = QTDEMUX_GUINT32_GET (buffer + 12);
offset = 16;
- for(i=0;i<n;i++){
- GST_LOG("%*s count: %u\n", depth, "", QTDEMUX_GUINT32_GET(buffer+offset));
- GST_LOG("%*s duration: %u\n", depth, "", QTDEMUX_GUINT32_GET(buffer+offset + 4));
+ for (i = 0; i < n; i++) {
+ GST_LOG ("%*s count: %u\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + offset));
+ GST_LOG ("%*s duration: %u\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + offset + 4));
offset += 8;
}
}
-static void qtdemux_dump_stss(GstQTDemux *qtdemux, void *buffer, int depth)
+static void
+qtdemux_dump_stss (GstQTDemux * qtdemux, void *buffer, int depth)
{
int i;
int n;
int offset;
- GST_LOG("%*s version/flags: %08x\n", depth, "", QTDEMUX_GUINT32_GET(buffer+8));
- GST_LOG("%*s n entries: %d\n", depth, "", QTDEMUX_GUINT32_GET(buffer+12));
- n = QTDEMUX_GUINT32_GET(buffer+12);
+ GST_LOG ("%*s version/flags: %08x\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + 8));
+ GST_LOG ("%*s n entries: %d\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + 12));
+ n = QTDEMUX_GUINT32_GET (buffer + 12);
offset = 16;
- for(i=0;i<n;i++){
- GST_LOG("%*s sample: %u\n", depth, "", QTDEMUX_GUINT32_GET(buffer+offset));
+ for (i = 0; i < n; i++) {
+ GST_LOG ("%*s sample: %u\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + offset));
offset += 4;
}
}
-static void qtdemux_dump_stsc(GstQTDemux *qtdemux, void *buffer, int depth)
+static void
+qtdemux_dump_stsc (GstQTDemux * qtdemux, void *buffer, int depth)
{
int i;
int n;
int offset;
- GST_LOG("%*s version/flags: %08x\n", depth, "", QTDEMUX_GUINT32_GET(buffer+8));
- GST_LOG("%*s n entries: %d\n", depth, "", QTDEMUX_GUINT32_GET(buffer+12));
- n = QTDEMUX_GUINT32_GET(buffer+12);
+ GST_LOG ("%*s version/flags: %08x\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + 8));
+ GST_LOG ("%*s n entries: %d\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + 12));
+ n = QTDEMUX_GUINT32_GET (buffer + 12);
offset = 16;
- for(i=0;i<n;i++){
- GST_LOG("%*s first chunk: %u\n", depth, "", QTDEMUX_GUINT32_GET(buffer+offset));
- GST_LOG("%*s sample per ch: %u\n", depth, "", QTDEMUX_GUINT32_GET(buffer+offset+4));
- GST_LOG("%*s sample desc id:%08x\n", depth, "", QTDEMUX_GUINT32_GET(buffer+offset+8));
+ for (i = 0; i < n; i++) {
+ GST_LOG ("%*s first chunk: %u\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + offset));
+ GST_LOG ("%*s sample per ch: %u\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + offset + 4));
+ GST_LOG ("%*s sample desc id:%08x\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + offset + 8));
offset += 12;
}
}
-static void qtdemux_dump_stsz(GstQTDemux *qtdemux, void *buffer, int depth)
+static void
+qtdemux_dump_stsz (GstQTDemux * qtdemux, void *buffer, int depth)
{
int i;
int n;
int offset;
int sample_size;
- GST_LOG("%*s version/flags: %08x\n", depth, "", QTDEMUX_GUINT32_GET(buffer+8));
- GST_LOG("%*s sample size: %d\n", depth, "", QTDEMUX_GUINT32_GET(buffer+12));
- sample_size = QTDEMUX_GUINT32_GET(buffer+12);
- if(sample_size == 0){
- GST_LOG("%*s n entries: %d\n", depth, "", QTDEMUX_GUINT32_GET(buffer+16));
- n = QTDEMUX_GUINT32_GET(buffer+16);
+ GST_LOG ("%*s version/flags: %08x\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + 8));
+ GST_LOG ("%*s sample size: %d\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + 12));
+ sample_size = QTDEMUX_GUINT32_GET (buffer + 12);
+ if (sample_size == 0) {
+ GST_LOG ("%*s n entries: %d\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + 16));
+ n = QTDEMUX_GUINT32_GET (buffer + 16);
offset = 20;
- for(i=0;i<n;i++){
- GST_LOG("%*s sample size: %u\n", depth, "", QTDEMUX_GUINT32_GET(buffer+offset));
+ for (i = 0; i < n; i++) {
+ GST_LOG ("%*s sample size: %u\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + offset));
offset += 4;
}
}
}
-static void qtdemux_dump_stco(GstQTDemux *qtdemux, void *buffer, int depth)
+static void
+qtdemux_dump_stco (GstQTDemux * qtdemux, void *buffer, int depth)
{
int i;
int n;
int offset;
- GST_LOG("%*s version/flags: %08x\n", depth, "", QTDEMUX_GUINT32_GET(buffer+8));
- GST_LOG("%*s n entries: %d\n", depth, "", QTDEMUX_GUINT32_GET(buffer+12));
- n = QTDEMUX_GUINT32_GET(buffer+12);
+ GST_LOG ("%*s version/flags: %08x\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + 8));
+ GST_LOG ("%*s n entries: %d\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + 12));
+ n = QTDEMUX_GUINT32_GET (buffer + 12);
offset = 16;
- for(i=0;i<n;i++){
- GST_LOG("%*s chunk offset: %u\n", depth, "", QTDEMUX_GUINT32_GET(buffer+offset));
+ for (i = 0; i < n; i++) {
+ GST_LOG ("%*s chunk offset: %u\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + offset));
offset += 4;
}
}
-static void qtdemux_dump_co64(GstQTDemux *qtdemux, void *buffer, int depth)
+static void
+qtdemux_dump_co64 (GstQTDemux * qtdemux, void *buffer, int depth)
{
int i;
int n;
int offset;
- GST_LOG("%*s version/flags: %08x\n", depth, "", QTDEMUX_GUINT32_GET(buffer+8));
- GST_LOG("%*s n entries: %d\n", depth, "", QTDEMUX_GUINT32_GET(buffer+12));
- n = QTDEMUX_GUINT32_GET(buffer+12);
+ GST_LOG ("%*s version/flags: %08x\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + 8));
+ GST_LOG ("%*s n entries: %d\n", depth, "",
+ QTDEMUX_GUINT32_GET (buffer + 12));
+ n = QTDEMUX_GUINT32_GET (buffer + 12);
offset = 16;
- for(i=0;i<n;i++){
- GST_LOG("%*s chunk offset: %" G_GUINT64_FORMAT "\n", depth, "", QTDEMUX_GUINT64_GET(buffer+offset));
+ for (i = 0; i < n; i++) {
+ GST_LOG ("%*s chunk offset: %" G_GUINT64_FORMAT "\n", depth, "",
+ QTDEMUX_GUINT64_GET (buffer + offset));
offset += 8;
}
}
-static void qtdemux_dump_dcom(GstQTDemux *qtdemux, void *buffer, int depth)
+static void
+qtdemux_dump_dcom (GstQTDemux * qtdemux, void *buffer, int depth)
{
- GST_LOG("%*s compression type: " GST_FOURCC_FORMAT "\n", depth, "",
- GST_FOURCC_ARGS(QTDEMUX_FOURCC_GET(buffer+8)));
+ GST_LOG ("%*s compression type: " GST_FOURCC_FORMAT "\n", depth, "",
+ GST_FOURCC_ARGS (QTDEMUX_FOURCC_GET (buffer + 8)));
}
-static void qtdemux_dump_cmvd(GstQTDemux *qtdemux, void *buffer, int depth)
+static void
+qtdemux_dump_cmvd (GstQTDemux * qtdemux, void *buffer, int depth)
{
- GST_LOG("%*s length: %d\n", depth, "", QTDEMUX_GUINT32_GET(buffer+8));
+ GST_LOG ("%*s length: %d\n", depth, "", QTDEMUX_GUINT32_GET (buffer + 8));
}
-static GNode *qtdemux_tree_get_child_by_type(GNode *node, guint32 fourcc)
+static GNode *
+qtdemux_tree_get_child_by_type (GNode * node, guint32 fourcc)
{
GNode *child;
void *buffer;
guint32 child_fourcc;
- for(child = g_node_first_child(node); child; child = g_node_next_sibling(child)){
+ for (child = g_node_first_child (node); child;
+ child = g_node_next_sibling (child)) {
buffer = child->data;
- child_fourcc = GUINT32_FROM_LE(*(guint32 *)(buffer+4));
+ child_fourcc = GUINT32_FROM_LE (*(guint32 *) (buffer + 4));
- if(child_fourcc == fourcc){
+ if (child_fourcc == fourcc) {
return child;
}
}
return NULL;
}
-static GNode *qtdemux_tree_get_sibling_by_type(GNode *node, guint32 fourcc)
+static GNode *
+qtdemux_tree_get_sibling_by_type (GNode * node, guint32 fourcc)
{
GNode *child;
void *buffer;
guint32 child_fourcc;
- for(child = g_node_next_sibling(node); child; child = g_node_next_sibling(child)){
+ for (child = g_node_next_sibling (node); child;
+ child = g_node_next_sibling (child)) {
buffer = child->data;
- child_fourcc = GUINT32_FROM_LE(*(guint32 *)(buffer+4));
+ child_fourcc = GUINT32_FROM_LE (*(guint32 *) (buffer + 4));
- if(child_fourcc == fourcc){
+ if (child_fourcc == fourcc) {
return child;
}
}
return NULL;
}
-static void qtdemux_parse_trak(GstQTDemux *qtdemux, GNode *trak);
+static void qtdemux_parse_trak (GstQTDemux * qtdemux, GNode * trak);
-static void qtdemux_parse_tree(GstQTDemux *qtdemux)
+static void
+qtdemux_parse_tree (GstQTDemux * qtdemux)
{
GNode *mvhd;
GNode *trak;
- mvhd = qtdemux_tree_get_child_by_type(qtdemux->moov_node, FOURCC_mvhd);
- if(mvhd==NULL){
- GST_LOG("No mvhd node found.\n");
+ mvhd = qtdemux_tree_get_child_by_type (qtdemux->moov_node, FOURCC_mvhd);
+ if (mvhd == NULL) {
+ GST_LOG ("No mvhd node found.\n");
return;
}
- qtdemux->timescale = QTDEMUX_GUINT32_GET(mvhd->data + 20);
- qtdemux->duration = QTDEMUX_GUINT32_GET(mvhd->data + 24);
+ qtdemux->timescale = QTDEMUX_GUINT32_GET (mvhd->data + 20);
+ qtdemux->duration = QTDEMUX_GUINT32_GET (mvhd->data + 24);
- GST_INFO("timescale: %d\n", qtdemux->timescale);
- GST_INFO("duration: %d\n", qtdemux->duration);
+ GST_INFO ("timescale: %d\n", qtdemux->timescale);
+ GST_INFO ("duration: %d\n", qtdemux->duration);
- trak = qtdemux_tree_get_child_by_type(qtdemux->moov_node, FOURCC_trak);
- qtdemux_parse_trak(qtdemux, trak);
+ trak = qtdemux_tree_get_child_by_type (qtdemux->moov_node, FOURCC_trak);
+ qtdemux_parse_trak (qtdemux, trak);
/* trak = qtdemux_tree_get_sibling_by_type(trak, FOURCC_trak);
if(trak)qtdemux_parse_trak(qtdemux, trak);*/
- while ((trak = qtdemux_tree_get_sibling_by_type(trak, FOURCC_trak)) != NULL)
- qtdemux_parse_trak(qtdemux, trak);
+ while ((trak = qtdemux_tree_get_sibling_by_type (trak, FOURCC_trak)) != NULL)
+ qtdemux_parse_trak (qtdemux, trak);
}
-static void qtdemux_parse_trak(GstQTDemux *qtdemux, GNode *trak)
+static void
+qtdemux_parse_trak (GstQTDemux * qtdemux, GNode * trak)
{
int offset;
GNode *tkhd;
@@ -1392,235 +1524,257 @@ static void qtdemux_parse_trak(GstQTDemux *qtdemux, GNode *trak)
QtDemuxSample *samples;
int n_samples_per_chunk;
int index;
- int i,j,k;
+ int i, j, k;
QtDemuxStream *stream;
int n_sample_times;
guint64 timestamp;
int sample_size;
int sample_index;
- stream = g_new0(QtDemuxStream,1);
+ stream = g_new0 (QtDemuxStream, 1);
- tkhd = qtdemux_tree_get_child_by_type(trak, FOURCC_tkhd);
- g_assert(tkhd);
+ tkhd = qtdemux_tree_get_child_by_type (trak, FOURCC_tkhd);
+ g_assert (tkhd);
/* track duration? */
- mdia = qtdemux_tree_get_child_by_type(trak, FOURCC_mdia);
- g_assert(mdia);
+ mdia = qtdemux_tree_get_child_by_type (trak, FOURCC_mdia);
+ g_assert (mdia);
- mdhd = qtdemux_tree_get_child_by_type(mdia, FOURCC_mdhd);
- g_assert(mdhd);
+ mdhd = qtdemux_tree_get_child_by_type (mdia, FOURCC_mdhd);
+ g_assert (mdhd);
- stream->timescale = QTDEMUX_GUINT32_GET(mdhd->data+20);
- GST_INFO("track timescale: %d", stream->timescale);
-
- hdlr = qtdemux_tree_get_child_by_type(mdia, FOURCC_hdlr);
- g_assert(hdlr);
-
- GST_LOG("track type: " GST_FOURCC_FORMAT "\n",
- GST_FOURCC_ARGS(QTDEMUX_FOURCC_GET(hdlr->data+12)));
- GST_LOG("track subtype: " GST_FOURCC_FORMAT "\n",
- GST_FOURCC_ARGS(QTDEMUX_FOURCC_GET(hdlr->data+16)));
+ stream->timescale = QTDEMUX_GUINT32_GET (mdhd->data + 20);
+ GST_INFO ("track timescale: %d", stream->timescale);
+
+ hdlr = qtdemux_tree_get_child_by_type (mdia, FOURCC_hdlr);
+ g_assert (hdlr);
- stream->subtype = QTDEMUX_FOURCC_GET(hdlr->data+16);
+ GST_LOG ("track type: " GST_FOURCC_FORMAT "\n",
+ GST_FOURCC_ARGS (QTDEMUX_FOURCC_GET (hdlr->data + 12)));
+ GST_LOG ("track subtype: " GST_FOURCC_FORMAT "\n",
+ GST_FOURCC_ARGS (QTDEMUX_FOURCC_GET (hdlr->data + 16)));
- minf = qtdemux_tree_get_child_by_type(mdia, FOURCC_minf);
- g_assert(minf);
+ stream->subtype = QTDEMUX_FOURCC_GET (hdlr->data + 16);
- stbl = qtdemux_tree_get_child_by_type(minf, FOURCC_stbl);
- g_assert(stbl);
+ minf = qtdemux_tree_get_child_by_type (mdia, FOURCC_minf);
+ g_assert (minf);
- stsd = qtdemux_tree_get_child_by_type(stbl, FOURCC_stsd);
- g_assert(stsd);
+ stbl = qtdemux_tree_get_child_by_type (minf, FOURCC_stbl);
+ g_assert (stbl);
- if(stream->subtype == FOURCC_vide){
+ stsd = qtdemux_tree_get_child_by_type (stbl, FOURCC_stsd);
+ g_assert (stsd);
+
+ if (stream->subtype == FOURCC_vide) {
offset = 16;
- GST_LOG("st type: " GST_FOURCC_FORMAT "\n",
- GST_FOURCC_ARGS(QTDEMUX_FOURCC_GET(stsd->data+offset+4)));
-
- stream->width = QTDEMUX_GUINT16_GET(stsd->data+offset+32);
- stream->height = QTDEMUX_GUINT16_GET(stsd->data+offset+34);
- stream->fps = 0.; /* this is filled in later */
-
- GST_LOG("frame count: %u\n", QTDEMUX_GUINT16_GET(stsd->data+offset+48));
-
- stream->caps = qtdemux_video_caps(qtdemux,
- QTDEMUX_FOURCC_GET(stsd->data+offset+4), stsd->data);
- GST_INFO("type " GST_FOURCC_FORMAT " caps %" GST_PTR_FORMAT "\n",
- GST_FOURCC_ARGS (QTDEMUX_FOURCC_GET(stsd->data+offset+4)),
- stream->caps);
- }else if(stream->subtype == FOURCC_soun){
+ GST_LOG ("st type: " GST_FOURCC_FORMAT "\n",
+ GST_FOURCC_ARGS (QTDEMUX_FOURCC_GET (stsd->data + offset + 4)));
+
+ stream->width = QTDEMUX_GUINT16_GET (stsd->data + offset + 32);
+ stream->height = QTDEMUX_GUINT16_GET (stsd->data + offset + 34);
+ stream->fps = 0.; /* this is filled in later */
+
+ GST_LOG ("frame count: %u\n",
+ QTDEMUX_GUINT16_GET (stsd->data + offset + 48));
+
+ stream->caps = qtdemux_video_caps (qtdemux,
+ QTDEMUX_FOURCC_GET (stsd->data + offset + 4), stsd->data);
+ GST_INFO ("type " GST_FOURCC_FORMAT " caps %" GST_PTR_FORMAT "\n",
+ GST_FOURCC_ARGS (QTDEMUX_FOURCC_GET (stsd->data + offset + 4)),
+ stream->caps);
+ } else if (stream->subtype == FOURCC_soun) {
int version, samplesize;
- GST_LOG("st type: " GST_FOURCC_FORMAT "\n",
- GST_FOURCC_ARGS(QTDEMUX_FOURCC_GET(stsd->data+16+4)));
+ GST_LOG ("st type: " GST_FOURCC_FORMAT "\n",
+ GST_FOURCC_ARGS (QTDEMUX_FOURCC_GET (stsd->data + 16 + 4)));
offset = 32;
- GST_LOG("version/rev: %08x\n", QTDEMUX_GUINT32_GET(stsd->data+offset));
- version = QTDEMUX_GUINT32_GET(stsd->data+offset);
- GST_LOG("vendor: %08x\n", QTDEMUX_GUINT32_GET(stsd->data+offset + 4));
- GST_LOG("n_channels: %d\n", QTDEMUX_GUINT16_GET(stsd->data+offset + 8));
- stream->n_channels = QTDEMUX_GUINT16_GET(stsd->data+offset + 8);
- GST_LOG("sample_size: %d\n", QTDEMUX_GUINT16_GET(stsd->data+offset + 10));
- samplesize = QTDEMUX_GUINT16_GET(stsd->data+offset + 10);
- GST_LOG("compression_id: %d\n", QTDEMUX_GUINT16_GET(stsd->data+offset + 12));
- GST_LOG("packet size: %d\n", QTDEMUX_GUINT16_GET(stsd->data+offset + 14));
- GST_LOG("sample rate: %g\n", QTDEMUX_FP32_GET(stsd->data+offset + 16));
- stream->rate = QTDEMUX_FP32_GET(stsd->data+offset + 16);
+ GST_LOG ("version/rev: %08x\n",
+ QTDEMUX_GUINT32_GET (stsd->data + offset));
+ version = QTDEMUX_GUINT32_GET (stsd->data + offset);
+ GST_LOG ("vendor: %08x\n",
+ QTDEMUX_GUINT32_GET (stsd->data + offset + 4));
+ GST_LOG ("n_channels: %d\n",
+ QTDEMUX_GUINT16_GET (stsd->data + offset + 8));
+ stream->n_channels = QTDEMUX_GUINT16_GET (stsd->data + offset + 8);
+ GST_LOG ("sample_size: %d\n",
+ QTDEMUX_GUINT16_GET (stsd->data + offset + 10));
+ samplesize = QTDEMUX_GUINT16_GET (stsd->data + offset + 10);
+ GST_LOG ("compression_id: %d\n",
+ QTDEMUX_GUINT16_GET (stsd->data + offset + 12));
+ GST_LOG ("packet size: %d\n",
+ QTDEMUX_GUINT16_GET (stsd->data + offset + 14));
+ GST_LOG ("sample rate: %g\n",
+ QTDEMUX_FP32_GET (stsd->data + offset + 16));
+ stream->rate = QTDEMUX_FP32_GET (stsd->data + offset + 16);
offset = 52;
- if(version == 0x00010000){
- GST_LOG("samples/packet: %d\n", QTDEMUX_GUINT32_GET(stsd->data+offset));
- stream->samples_per_packet = QTDEMUX_GUINT32_GET(stsd->data+offset);
- GST_LOG("bytes/packet: %d\n", QTDEMUX_GUINT32_GET(stsd->data+offset + 4));
- GST_LOG("bytes/frame: %d\n", QTDEMUX_GUINT32_GET(stsd->data+offset + 8));
- stream->bytes_per_frame = QTDEMUX_GUINT32_GET(stsd->data+offset + 8);
- GST_LOG("bytes/sample: %d\n", QTDEMUX_GUINT32_GET(stsd->data+offset + 12));
+ if (version == 0x00010000) {
+ GST_LOG ("samples/packet: %d\n",
+ QTDEMUX_GUINT32_GET (stsd->data + offset));
+ stream->samples_per_packet = QTDEMUX_GUINT32_GET (stsd->data + offset);
+ GST_LOG ("bytes/packet: %d\n",
+ QTDEMUX_GUINT32_GET (stsd->data + offset + 4));
+ GST_LOG ("bytes/frame: %d\n",
+ QTDEMUX_GUINT32_GET (stsd->data + offset + 8));
+ stream->bytes_per_frame = QTDEMUX_GUINT32_GET (stsd->data + offset + 8);
+ GST_LOG ("bytes/sample: %d\n",
+ QTDEMUX_GUINT32_GET (stsd->data + offset + 12));
offset = 68;
} else {
stream->bytes_per_frame = stream->n_channels * samplesize / 8;
stream->samples_per_packet = 1;
}
- stream->caps = qtdemux_audio_caps(qtdemux,
- QTDEMUX_FOURCC_GET(stsd->data+16+4), (QTDEMUX_GUINT32_GET(stsd->data) > offset) ? stsd->data + offset : NULL);
- GST_INFO("type " GST_FOURCC_FORMAT " caps %" GST_PTR_FORMAT "\n",
- GST_FOURCC_ARGS(QTDEMUX_FOURCC_GET(stsd->data+16+4)), stream->caps);
- }else{
- GST_LOG("unknown subtype\n");
+ stream->caps = qtdemux_audio_caps (qtdemux,
+ QTDEMUX_FOURCC_GET (stsd->data + 16 + 4),
+ (QTDEMUX_GUINT32_GET (stsd->data) >
+ offset) ? stsd->data + offset : NULL);
+ GST_INFO ("type " GST_FOURCC_FORMAT " caps %" GST_PTR_FORMAT "\n",
+ GST_FOURCC_ARGS (QTDEMUX_FOURCC_GET (stsd->data + 16 + 4)),
+ stream->caps);
+ } else {
+ GST_LOG ("unknown subtype\n");
return;
}
/* sample to chunk */
- stsc = qtdemux_tree_get_child_by_type(stbl, FOURCC_stsc);
- g_assert(stsc);
+ stsc = qtdemux_tree_get_child_by_type (stbl, FOURCC_stsc);
+ g_assert (stsc);
/* sample size */
- stsz = qtdemux_tree_get_child_by_type(stbl, FOURCC_stsz);
- g_assert(stsz);
+ stsz = qtdemux_tree_get_child_by_type (stbl, FOURCC_stsz);
+ g_assert (stsz);
/* chunk offsets */
- stco = qtdemux_tree_get_child_by_type(stbl, FOURCC_stco);
- co64 = qtdemux_tree_get_child_by_type(stbl, FOURCC_co64);
- g_assert(stco || co64);
+ stco = qtdemux_tree_get_child_by_type (stbl, FOURCC_stco);
+ co64 = qtdemux_tree_get_child_by_type (stbl, FOURCC_co64);
+ g_assert (stco || co64);
/* sample time */
- stts = qtdemux_tree_get_child_by_type(stbl, FOURCC_stts);
- g_assert(stts);
+ stts = qtdemux_tree_get_child_by_type (stbl, FOURCC_stts);
+ g_assert (stts);
- sample_size = QTDEMUX_GUINT32_GET(stsz->data+12);
- if(sample_size == 0){
- n_samples = QTDEMUX_GUINT32_GET(stsz->data+16);
+ sample_size = QTDEMUX_GUINT32_GET (stsz->data + 12);
+ if (sample_size == 0) {
+ n_samples = QTDEMUX_GUINT32_GET (stsz->data + 16);
stream->n_samples = n_samples;
- samples = g_malloc(sizeof(QtDemuxSample)*n_samples);
+ samples = g_malloc (sizeof (QtDemuxSample) * n_samples);
stream->samples = samples;
- for(i=0;i<n_samples;i++){
- samples[i].size = QTDEMUX_GUINT32_GET(stsz->data + i*4 + 20);
+ for (i = 0; i < n_samples; i++) {
+ samples[i].size = QTDEMUX_GUINT32_GET (stsz->data + i * 4 + 20);
}
- n_samples_per_chunk = QTDEMUX_GUINT32_GET(stsc->data+12);
+ n_samples_per_chunk = QTDEMUX_GUINT32_GET (stsc->data + 12);
index = 0;
offset = 16;
- for(i=0;i<n_samples_per_chunk;i++){
+ for (i = 0; i < n_samples_per_chunk; i++) {
int first_chunk, last_chunk;
int samples_per_chunk;
-
- first_chunk = QTDEMUX_GUINT32_GET(stsc->data + 16 + i*12 + 0) - 1;
- if(i==n_samples_per_chunk-1){
- last_chunk = INT_MAX;
- }else{
- last_chunk = QTDEMUX_GUINT32_GET(stsc->data +16 + i*12 + 12) - 1;
+
+ first_chunk = QTDEMUX_GUINT32_GET (stsc->data + 16 + i * 12 + 0) - 1;
+ if (i == n_samples_per_chunk - 1) {
+ last_chunk = INT_MAX;
+ } else {
+ last_chunk = QTDEMUX_GUINT32_GET (stsc->data + 16 + i * 12 + 12) - 1;
}
- samples_per_chunk = QTDEMUX_GUINT32_GET(stsc->data + 16 + i*12 + 4);
-
- for(j=first_chunk;j<last_chunk;j++){
- int chunk_offset;
- if(stco){
- chunk_offset = QTDEMUX_GUINT32_GET(stco->data + 16 + j*4);
- }else{
- chunk_offset = QTDEMUX_GUINT64_GET(co64->data + 16 + j*8);
- }
- for(k=0;k<samples_per_chunk;k++){
+ samples_per_chunk = QTDEMUX_GUINT32_GET (stsc->data + 16 + i * 12 + 4);
+
+ for (j = first_chunk; j < last_chunk; j++) {
+ int chunk_offset;
+
+ if (stco) {
+ chunk_offset = QTDEMUX_GUINT32_GET (stco->data + 16 + j * 4);
+ } else {
+ chunk_offset = QTDEMUX_GUINT64_GET (co64->data + 16 + j * 8);
+ }
+ for (k = 0; k < samples_per_chunk; k++) {
samples[index].chunk = j;
samples[index].offset = chunk_offset;
chunk_offset += samples[index].size;
index++;
- if(index>=n_samples)goto done;
- }
+ if (index >= n_samples)
+ goto done;
+ }
}
}
-done:
-
- n_sample_times = QTDEMUX_GUINT32_GET(stts->data + 12);
+ done:
+
+ n_sample_times = QTDEMUX_GUINT32_GET (stts->data + 12);
timestamp = 0;
index = 0;
- for(i=0;i<n_sample_times;i++){
+ for (i = 0; i < n_sample_times; i++) {
int n;
int duration;
guint64 time;
-
- n = QTDEMUX_GUINT32_GET(stts->data + 16 + 8*i);
- duration = QTDEMUX_GUINT32_GET(stts->data + 16 + 8*i + 4);
- time = (GST_SECOND * duration)/stream->timescale;
- for(j=0;j<n;j++){
- //GST_INFO("moo %lld", timestamp);
- samples[index].timestamp = timestamp;
- samples[index].duration = time;
- timestamp += time;
- index++;
+
+ n = QTDEMUX_GUINT32_GET (stts->data + 16 + 8 * i);
+ duration = QTDEMUX_GUINT32_GET (stts->data + 16 + 8 * i + 4);
+ time = (GST_SECOND * duration) / stream->timescale;
+ for (j = 0; j < n; j++) {
+ //GST_INFO("moo %lld", timestamp);
+ samples[index].timestamp = timestamp;
+ samples[index].duration = time;
+ timestamp += time;
+ index++;
}
}
- }else{
+ } else {
int sample_width;
guint64 timestamp = 0;
- GST_LOG("treating chunks as samples\n");
+ GST_LOG ("treating chunks as samples\n");
/* treat chunks as samples */
- if(stco){
- n_samples = QTDEMUX_GUINT32_GET(stco->data+12);
- }else{
- n_samples = QTDEMUX_GUINT32_GET(co64->data+12);
+ if (stco) {
+ n_samples = QTDEMUX_GUINT32_GET (stco->data + 12);
+ } else {
+ n_samples = QTDEMUX_GUINT32_GET (co64->data + 12);
}
stream->n_samples = n_samples;
- samples = g_malloc(sizeof(QtDemuxSample)*n_samples);
+ samples = g_malloc (sizeof (QtDemuxSample) * n_samples);
stream->samples = samples;
- sample_width = QTDEMUX_GUINT16_GET(stsd->data+offset + 10) / 8;
+ sample_width = QTDEMUX_GUINT16_GET (stsd->data + offset + 10) / 8;
- n_samples_per_chunk = QTDEMUX_GUINT32_GET(stsc->data+12);
+ n_samples_per_chunk = QTDEMUX_GUINT32_GET (stsc->data + 12);
offset = 16;
sample_index = 0;
- for(i=0;i<n_samples_per_chunk;i++){
+ for (i = 0; i < n_samples_per_chunk; i++) {
int first_chunk, last_chunk;
int samples_per_chunk;
-
- first_chunk = QTDEMUX_GUINT32_GET(stsc->data + 16 + i*12 + 0) - 1;
- if(i==n_samples-1){
- last_chunk = INT_MAX;
- }else{
- last_chunk = QTDEMUX_GUINT32_GET(stsc->data +16 + i*12 + 12) - 1;
+
+ first_chunk = QTDEMUX_GUINT32_GET (stsc->data + 16 + i * 12 + 0) - 1;
+ if (i == n_samples - 1) {
+ last_chunk = INT_MAX;
+ } else {
+ last_chunk = QTDEMUX_GUINT32_GET (stsc->data + 16 + i * 12 + 12) - 1;
}
- samples_per_chunk = QTDEMUX_GUINT32_GET(stsc->data + 16 + i*12 + 4);
-
- for(j=first_chunk;j<last_chunk;j++){
- int chunk_offset;
- if(j>=n_samples)goto done2;
- if(stco){
- chunk_offset = QTDEMUX_GUINT32_GET(stco->data + 16 + j*4);
- }else{
- chunk_offset = QTDEMUX_GUINT64_GET(co64->data + 16 + j*8);
- }
+ samples_per_chunk = QTDEMUX_GUINT32_GET (stsc->data + 16 + i * 12 + 4);
+
+ for (j = first_chunk; j < last_chunk; j++) {
+ int chunk_offset;
+
+ if (j >= n_samples)
+ goto done2;
+ if (stco) {
+ chunk_offset = QTDEMUX_GUINT32_GET (stco->data + 16 + j * 4);
+ } else {
+ chunk_offset = QTDEMUX_GUINT64_GET (co64->data + 16 + j * 8);
+ }
samples[j].chunk = j;
samples[j].offset = chunk_offset;
- samples[j].size = samples_per_chunk * stream->bytes_per_frame / stream->samples_per_packet;
- samples[j].duration = samples_per_chunk * GST_SECOND / (stream->rate/2);
+ samples[j].size =
+ samples_per_chunk * stream->bytes_per_frame /
+ stream->samples_per_packet;
+ samples[j].duration =
+ samples_per_chunk * GST_SECOND / (stream->rate / 2);
samples[j].timestamp = timestamp;
timestamp += (samples_per_chunk * GST_SECOND) / stream->rate;
#if 0
- GST_INFO("moo samples_per_chunk=%d rate=%d dur=%lld %lld",
- (int)samples_per_chunk,
- (int)stream->rate,
- (long long)((samples_per_chunk * GST_SECOND) / stream->rate),
- (long long)timestamp);
+ GST_INFO ("moo samples_per_chunk=%d rate=%d dur=%lld %lld",
+ (int) samples_per_chunk,
+ (int) stream->rate,
+ (long long) ((samples_per_chunk * GST_SECOND) / stream->rate),
+ (long long) timestamp);
#endif
samples[j].sample_index = sample_index;
sample_index += samples_per_chunk;
@@ -1653,183 +1807,175 @@ done2:
}
done2:
#if 0
- for(i=0;i<n_samples;i++){
- GST_LOG("%d: %d %d %d %d %" G_GUINT64_FORMAT "\n",i,
- samples[i].sample_index,samples[i].chunk,
+ for (i = 0; i < n_samples; i++) {
+ GST_LOG ("%d: %d %d %d %d %" G_GUINT64_FORMAT "\n", i,
+ samples[i].sample_index, samples[i].chunk,
samples[i].offset, samples[i].size, samples[i].timestamp);
- if(i>10)break;
+ if (i > 10)
+ break;
}
#endif
- gst_qtdemux_add_stream(qtdemux,stream);
+ gst_qtdemux_add_stream (qtdemux, stream);
}
-static GstCaps *qtdemux_video_caps(GstQTDemux *qtdemux, guint32 fourcc, const guint8 *stsd_data)
+static GstCaps *
+qtdemux_video_caps (GstQTDemux * qtdemux, guint32 fourcc,
+ const guint8 * stsd_data)
{
- switch(fourcc){
- case GST_MAKE_FOURCC('j','p','e','g'):
+ switch (fourcc) {
+ case GST_MAKE_FOURCC ('j', 'p', 'e', 'g'):
/* JPEG */
return gst_caps_from_string ("image/jpeg");
- case GST_MAKE_FOURCC('m','j','p','a'):
+ case GST_MAKE_FOURCC ('m', 'j', 'p', 'a'):
/* Motion-JPEG (format A) */
return gst_caps_from_string ("image/jpeg");
- case GST_MAKE_FOURCC('m','j','p','b'):
+ case GST_MAKE_FOURCC ('m', 'j', 'p', 'b'):
/* Motion-JPEG (format B) */
return gst_caps_from_string ("image/jpeg");
- case GST_MAKE_FOURCC('S','V','Q','3'):
+ case GST_MAKE_FOURCC ('S', 'V', 'Q', '3'):
if (stsd_data != NULL) {
- gst_getbits_t gb;
+ gst_getbits_t gb;
gint halfpel_flag;
gint thirdpel_flag;
gint unknown_svq3_flag;
gint low_delay;
gint size;
- size = QTDEMUX_GUINT32_GET(stsd_data + 16);
+ size = QTDEMUX_GUINT32_GET (stsd_data + 16);
+
+ gst_getbits_init (&gb, NULL, NULL);
+ gst_getbits_newbuf (&gb, (unsigned char *) stsd_data + 98 + 16 + 4,
+ (size - 102 + 16));
+
+ /* Infos ripped from ffmpeg see libavcodec/svq3.c */
- gst_getbits_init (&gb, NULL, NULL);
- gst_getbits_newbuf (&gb, (unsigned char *)stsd_data + 98 + 16 + 4 , (size - 102 + 16));
-
- /* Infos ripped from ffmpeg see libavcodec/svq3.c */
-
/* 'frame size code' and optional 'width, height' */
- if (gst_getbitsn (&gb, 3) == 7) {
- gst_getbitsn (&gb, 12);
- gst_getbitsn (&gb, 12);
+ if (gst_getbitsn (&gb, 3) == 7) {
+ gst_getbitsn (&gb, 12);
+ gst_getbitsn (&gb, 12);
}
halfpel_flag = gst_get1bit (&gb);
- thirdpel_flag = gst_get1bit (&gb);
+ thirdpel_flag = gst_get1bit (&gb);
- /* unknown fields */
- gst_get1bit (&gb);
- gst_get1bit (&gb);
- gst_get1bit (&gb);
- gst_get1bit (&gb);
+ /* unknown fields */
+ gst_get1bit (&gb);
+ gst_get1bit (&gb);
+ gst_get1bit (&gb);
+ gst_get1bit (&gb);
- low_delay = gst_get1bit (&gb);
+ low_delay = gst_get1bit (&gb);
- /* unknown field */
- gst_get1bit (&gb);
+ /* unknown field */
+ gst_get1bit (&gb);
while (gst_get1bit (&gb)) {
- gst_getbitsn (&gb, 8);
- }
-
- unknown_svq3_flag = gst_get1bit (&gb);
-
- return gst_caps_new_simple ("video/x-svq",
- "svqversion", G_TYPE_INT, 3,
- "halfpel_flag", G_TYPE_INT, halfpel_flag,
- "thirdpel_flag", G_TYPE_INT, thirdpel_flag,
- "low_delay", G_TYPE_INT, low_delay,
- "unknown_svq3_flag", G_TYPE_INT, unknown_svq3_flag,
- NULL);
+ gst_getbitsn (&gb, 8);
+ }
+
+ unknown_svq3_flag = gst_get1bit (&gb);
+
+ return gst_caps_new_simple ("video/x-svq",
+ "svqversion", G_TYPE_INT, 3,
+ "halfpel_flag", G_TYPE_INT, halfpel_flag,
+ "thirdpel_flag", G_TYPE_INT, thirdpel_flag,
+ "low_delay", G_TYPE_INT, low_delay,
+ "unknown_svq3_flag", G_TYPE_INT, unknown_svq3_flag, NULL);
}
- return gst_caps_from_string ("video/x-svq, "
- "svqversion = (int) 3");
- case GST_MAKE_FOURCC('s','v','q','i'):
- case GST_MAKE_FOURCC('S','V','Q','1'):
- return gst_caps_from_string ("video/x-svq, "
- "svqversion = (int) 1");
- case GST_MAKE_FOURCC('r','a','w',' '):
+ return gst_caps_from_string ("video/x-svq, " "svqversion = (int) 3");
+ case GST_MAKE_FOURCC ('s', 'v', 'q', 'i'):
+ case GST_MAKE_FOURCC ('S', 'V', 'Q', '1'):
+ return gst_caps_from_string ("video/x-svq, " "svqversion = (int) 1");
+ case GST_MAKE_FOURCC ('r', 'a', 'w', ' '):
/* uncompressed RGB */
return gst_caps_from_string ("video/x-raw-rgb, "
"endianness = (int) BIG_ENDIAN");
- /*"bpp", GST_PROPS_INT(x),
- "depth", GST_PROPS_INT(x),
- "red_mask", GST_PROPS_INT(x),
- "green_mask", GST_PROPS_INT(x),
- "blue_mask", GST_PROPS_INT(x), FIXME! */
- case GST_MAKE_FOURCC('Y','u','v','2'):
+ /*"bpp", GST_PROPS_INT(x),
+ "depth", GST_PROPS_INT(x),
+ "red_mask", GST_PROPS_INT(x),
+ "green_mask", GST_PROPS_INT(x),
+ "blue_mask", GST_PROPS_INT(x), FIXME! */
+ case GST_MAKE_FOURCC ('Y', 'u', 'v', '2'):
/* uncompressed YUV2 */
return gst_caps_from_string ("video/x-raw-yuv, "
"format = (fourcc) YUY2");
- case GST_MAKE_FOURCC('m','p','e','g'):
+ case GST_MAKE_FOURCC ('m', 'p', 'e', 'g'):
/* MPEG */
return gst_caps_from_string ("video/mpeg, "
- "systemstream = (boolean) false, "
- "mpegversion = (int) 1");
- case GST_MAKE_FOURCC('g','i','f',' '):
+ "systemstream = (boolean) false, " "mpegversion = (int) 1");
+ case GST_MAKE_FOURCC ('g', 'i', 'f', ' '):
return gst_caps_from_string ("image/gif");
- case GST_MAKE_FOURCC('h','2','6','3'):
+ case GST_MAKE_FOURCC ('h', '2', '6', '3'):
/* H.263 */
/* ffmpeg uses the height/width props, don't know why */
return gst_caps_from_string ("video/x-h263");
- case GST_MAKE_FOURCC('m','p','4','v'):
+ case GST_MAKE_FOURCC ('m', 'p', '4', 'v'):
/* MPEG-4 */
return gst_caps_from_string ("video/mpeg, "
- "mpegversion = (int) 4, "
- "systemstream = (boolean) false");
- case GST_MAKE_FOURCC('3','I','V','1'):
+ "mpegversion = (int) 4, " "systemstream = (boolean) false");
+ case GST_MAKE_FOURCC ('3', 'I', 'V', '1'):
return gst_caps_from_string ("video/x-3ivx");
- case GST_MAKE_FOURCC('c','v','i','d'):
+ case GST_MAKE_FOURCC ('c', 'v', 'i', 'd'):
/* Cinepak */
return gst_caps_from_string ("video/x-cinepak");
- case GST_MAKE_FOURCC('r','p','z','a'):
- case GST_MAKE_FOURCC('r','l','e',' '):
+ case GST_MAKE_FOURCC ('r', 'p', 'z', 'a'):
+ case GST_MAKE_FOURCC ('r', 'l', 'e', ' '):
/* Run-length encoding */
- case GST_MAKE_FOURCC('s','m','c',' '):
- case GST_MAKE_FOURCC('k','p','c','d'):
+ case GST_MAKE_FOURCC ('s', 'm', 'c', ' '):
+ case GST_MAKE_FOURCC ('k', 'p', 'c', 'd'):
default:
g_critical ("Don't know how to convert fourcc '" GST_FOURCC_FORMAT
- "' to caps\n", GST_FOURCC_ARGS(fourcc));
+ "' to caps\n", GST_FOURCC_ARGS (fourcc));
return NULL;
}
}
-static GstCaps *qtdemux_audio_caps(GstQTDemux *qtdemux, guint32 fourcc, const guint8 *data)
+static GstCaps *
+qtdemux_audio_caps (GstQTDemux * qtdemux, guint32 fourcc, const guint8 * data)
{
- switch(fourcc){
- case GST_MAKE_FOURCC('N','O','N','E'):
- return NULL; /*gst_caps_from_string ("audio/raw");*/
- case GST_MAKE_FOURCC('r','a','w',' '):
+ switch (fourcc) {
+ case GST_MAKE_FOURCC ('N', 'O', 'N', 'E'):
+ return NULL; /*gst_caps_from_string ("audio/raw"); */
+ case GST_MAKE_FOURCC ('r', 'a', 'w', ' '):
/* FIXME */
return gst_caps_from_string ("audio/x-raw-int, "
- "width = (int) 8, "
- "depth = (int) 8, "
- "signed = (boolean) true");
- case GST_MAKE_FOURCC('t','w','o','s'):
+ "width = (int) 8, " "depth = (int) 8, " "signed = (boolean) true");
+ case GST_MAKE_FOURCC ('t', 'w', 'o', 's'):
/* FIXME */
return gst_caps_from_string ("audio/x-raw-int, "
"width = (int) 16, "
"depth = (int) 16, "
- "endianness = (int) G_BIG_ENDIAN, "
- "signed = (boolean) true");
- case GST_MAKE_FOURCC('s','o','w','t'):
+ "endianness = (int) G_BIG_ENDIAN, " "signed = (boolean) true");
+ case GST_MAKE_FOURCC ('s', 'o', 'w', 't'):
/* FIXME */
return gst_caps_from_string ("audio/x-raw-int, "
"width = (int) 16, "
"depth = (int) 16, "
- "endianness = (int) G_LITTLE_ENDIAN, "
- "signed = (boolean) true");
- case GST_MAKE_FOURCC('f','l','6','4'):
+ "endianness = (int) G_LITTLE_ENDIAN, " "signed = (boolean) true");
+ case GST_MAKE_FOURCC ('f', 'l', '6', '4'):
return gst_caps_from_string ("audio/x-raw-float, "
- "width = (int) 64, "
- "endianness = (int) G_BIG_ENDIAN");
- case GST_MAKE_FOURCC('f','l','3','2'):
+ "width = (int) 64, " "endianness = (int) G_BIG_ENDIAN");
+ case GST_MAKE_FOURCC ('f', 'l', '3', '2'):
return gst_caps_from_string ("audio/x-raw-float, "
- "width = (int) 32, "
- "endianness = (int) G_BIG_ENDIAN");
- case GST_MAKE_FOURCC('i','n','2','4'):
+ "width = (int) 32, " "endianness = (int) G_BIG_ENDIAN");
+ case GST_MAKE_FOURCC ('i', 'n', '2', '4'):
/* FIXME */
return gst_caps_from_string ("audio/x-raw-int, "
"width = (int) 24, "
"depth = (int) 32, "
- "endianness = (int) G_BIG_ENDIAN, "
- "signed = (boolean) true");
- case GST_MAKE_FOURCC('i','n','3','2'):
+ "endianness = (int) G_BIG_ENDIAN, " "signed = (boolean) true");
+ case GST_MAKE_FOURCC ('i', 'n', '3', '2'):
/* FIXME */
return gst_caps_from_string ("audio/x-raw-int, "
"width = (int) 32, "
"depth = (int) 32, "
- "endianness = (int) G_BIG_ENDIAN, "
- "signed = (boolean) true");
- case GST_MAKE_FOURCC('u','l','a','w'):
+ "endianness = (int) G_BIG_ENDIAN, " "signed = (boolean) true");
+ case GST_MAKE_FOURCC ('u', 'l', 'a', 'w'):
/* FIXME */
return gst_caps_from_string ("audio/x-mulaw");
- case GST_MAKE_FOURCC('a','l','a','w'):
+ case GST_MAKE_FOURCC ('a', 'l', 'a', 'w'):
/* FIXME */
return gst_caps_from_string ("audio/x-alaw");
case 0x6d730002:
@@ -1843,53 +1989,47 @@ static GstCaps *qtdemux_audio_caps(GstQTDemux *qtdemux, guint32 fourcc, const gu
case 0x6d730055:
/* MPEG layer 3, CBR only (pre QT4.1) */
case 0x5500736d:
- case GST_MAKE_FOURCC('.','m','p','3'):
+ case GST_MAKE_FOURCC ('.', 'm', 'p', '3'):
/* MPEG layer 3, CBR & VBR (QT4.1 and later) */
return gst_caps_from_string ("audio/mpeg, "
- "layer = (int) 3, "
- "mpegversion = (int) 1");
- case GST_MAKE_FOURCC('M','A','C','3'):
+ "layer = (int) 3, " "mpegversion = (int) 1");
+ case GST_MAKE_FOURCC ('M', 'A', 'C', '3'):
/* MACE 3:1 */
- return gst_caps_from_string ("audio/x-mace, "
- "maceversion = (int) 3");
- case GST_MAKE_FOURCC('M','A','C','6'):
+ return gst_caps_from_string ("audio/x-mace, " "maceversion = (int) 3");
+ case GST_MAKE_FOURCC ('M', 'A', 'C', '6'):
/* MACE 6:1 */
- return gst_caps_from_string ("audio/x-mace, "
- "maceversion = (int) 6");
- case GST_MAKE_FOURCC('O','g','g','V'):
+ return gst_caps_from_string ("audio/x-mace, " "maceversion = (int) 6");
+ case GST_MAKE_FOURCC ('O', 'g', 'g', 'V'):
/* Ogg Vorbis */
return gst_caps_from_string ("application/ogg");
- case GST_MAKE_FOURCC('d','v','c','a'):
+ case GST_MAKE_FOURCC ('d', 'v', 'c', 'a'):
/* DV audio */
return gst_caps_from_string ("audio/x-dv");
- case GST_MAKE_FOURCC('m','p','4','a'):
+ case GST_MAKE_FOURCC ('m', 'p', '4', 'a'):
/* MPEG-4 AAC */
- return gst_caps_from_string ("audio/mpeg, "
- "mpegversion = (int) 4");
- case GST_MAKE_FOURCC('Q','D','M','2'):
+ return gst_caps_from_string ("audio/mpeg, " "mpegversion = (int) 4");
+ case GST_MAKE_FOURCC ('Q', 'D', 'M', '2'):
/* FIXME: QDesign music version 2 (no constant) */
if (QTDEMUX_GUINT32_GET (data) <= 100) {
- gst_util_dump_mem ((guint8*)data, 100);
+ gst_util_dump_mem ((guint8 *) data, 100);
return gst_caps_new_simple ("audio/x-qdm2",
- "framesize", G_TYPE_INT, QTDEMUX_GUINT32_GET (data + 52),
- "bitrate", G_TYPE_INT, QTDEMUX_GUINT32_GET (data + 40),
- "blocksize", G_TYPE_INT, QTDEMUX_GUINT32_GET (data + 44),
- NULL);
+ "framesize", G_TYPE_INT, QTDEMUX_GUINT32_GET (data + 52),
+ "bitrate", G_TYPE_INT, QTDEMUX_GUINT32_GET (data + 40),
+ "blocksize", G_TYPE_INT, QTDEMUX_GUINT32_GET (data + 44), NULL);
}
- case GST_MAKE_FOURCC('q','t','v','r'):
+ case GST_MAKE_FOURCC ('q', 't', 'v', 'r'):
/* ? */
- case GST_MAKE_FOURCC('Q','D','M','C'):
+ case GST_MAKE_FOURCC ('Q', 'D', 'M', 'C'):
/* QDesign music */
- case GST_MAKE_FOURCC('i','m','a','4'):
+ case GST_MAKE_FOURCC ('i', 'm', 'a', '4'):
/* IMA 4:1 */
- case GST_MAKE_FOURCC('Q','c','l','p'):
+ case GST_MAKE_FOURCC ('Q', 'c', 'l', 'p'):
/* QUALCOMM PureVoice */
- case GST_MAKE_FOURCC('a','g','s','m'):
+ case GST_MAKE_FOURCC ('a', 'g', 's', 'm'):
/* ? */
default:
g_critical ("Don't know how to convert fourcc '" GST_FOURCC_FORMAT
- "' to caps\n", GST_FOURCC_ARGS(fourcc));
+ "' to caps\n", GST_FOURCC_ARGS (fourcc));
return NULL;
}
}
-
diff --git a/gst/qtdemux/qtdemux.h b/gst/qtdemux/qtdemux.h
index 249ef2161..ed0f3154e 100644
--- a/gst/qtdemux/qtdemux.h
+++ b/gst/qtdemux/qtdemux.h
@@ -26,8 +26,9 @@
#include <gst/getbits/getbits.h>
#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
+extern "C"
+{
+#endif /* __cplusplus */
#define GST_TYPE_QTDEMUX \
@@ -43,43 +44,45 @@ extern "C" {
#define GST_QTDEMUX_MAX_STREAMS 8
-typedef struct _GstQTDemux GstQTDemux;
-typedef struct _GstQTDemuxClass GstQTDemuxClass;
-typedef struct _QtDemuxStream QtDemuxStream;
+ typedef struct _GstQTDemux GstQTDemux;
+ typedef struct _GstQTDemuxClass GstQTDemuxClass;
+ typedef struct _QtDemuxStream QtDemuxStream;
-struct _GstQTDemux {
- GstElement element;
+ struct _GstQTDemux
+ {
+ GstElement element;
- /* pads */
- GstPad *sinkpad;
+ /* pads */
+ GstPad *sinkpad;
- QtDemuxStream *streams[GST_QTDEMUX_MAX_STREAMS];
- int n_streams;
- int n_video_streams;
- int n_audio_streams;
+ QtDemuxStream *streams[GST_QTDEMUX_MAX_STREAMS];
+ int n_streams;
+ int n_video_streams;
+ int n_audio_streams;
- GstByteStream *bs;
+ GstByteStream *bs;
- GNode *moov_node;
- GNode *moov_node_compressed;
+ GNode *moov_node;
+ GNode *moov_node_compressed;
- guint32 timescale;
- guint32 duration;
+ guint32 timescale;
+ guint32 duration;
- int state;
+ int state;
- int offset;
+ int offset;
- /* track stuff */
+ /* track stuff */
-};
+ };
-struct _GstQTDemuxClass {
- GstElementClass parent_class;
-};
+ struct _GstQTDemuxClass
+ {
+ GstElementClass parent_class;
+ };
#ifdef __cplusplus
}
-#endif /* __cplusplus */
+#endif /* __cplusplus */
-#endif /* __GST_QTDEMUX_H__ */
+#endif /* __GST_QTDEMUX_H__ */
diff --git a/gst/rtjpeg/RTjpeg.c b/gst/rtjpeg/RTjpeg.c
index ab87fcc76..d2e7b67da 100644
--- a/gst/rtjpeg/RTjpeg.c
+++ b/gst/rtjpeg/RTjpeg.c
@@ -52,38 +52,47 @@ typedef unsigned long long __u64;
#include "mmx.h"
#endif
-static const unsigned char RTjpeg_ZZ[64]={
-0,
-8, 1,
-2, 9, 16,
-24, 17, 10, 3,
-4, 11, 18, 25, 32,
-40, 33, 26, 19, 12, 5,
-6, 13, 20, 27, 34, 41, 48,
-56, 49, 42, 35, 28, 21, 14, 7,
-15, 22, 29, 36, 43, 50, 57,
-58, 51, 44, 37, 30, 23,
-31, 38, 45, 52, 59,
-60, 53, 46, 39,
-47, 54, 61,
-62, 55,
-63 };
-
-static const __u64 RTjpeg_aan_tab[64]={
-4294967296ULL, 5957222912ULL, 5611718144ULL, 5050464768ULL, 4294967296ULL, 3374581504ULL, 2324432128ULL, 1184891264ULL,
-5957222912ULL, 8263040512ULL, 7783580160ULL, 7005009920ULL, 5957222912ULL, 4680582144ULL, 3224107520ULL, 1643641088ULL,
-5611718144ULL, 7783580160ULL, 7331904512ULL, 6598688768ULL, 5611718144ULL, 4408998912ULL, 3036936960ULL, 1548224000ULL,
-5050464768ULL, 7005009920ULL, 6598688768ULL, 5938608128ULL, 5050464768ULL, 3968072960ULL, 2733115392ULL, 1393296000ULL,
-4294967296ULL, 5957222912ULL, 5611718144ULL, 5050464768ULL, 4294967296ULL, 3374581504ULL, 2324432128ULL, 1184891264ULL,
-3374581504ULL, 4680582144ULL, 4408998912ULL, 3968072960ULL, 3374581504ULL, 2651326208ULL, 1826357504ULL, 931136000ULL,
-2324432128ULL, 3224107520ULL, 3036936960ULL, 2733115392ULL, 2324432128ULL, 1826357504ULL, 1258030336ULL, 641204288ULL,
-1184891264ULL, 1643641088ULL, 1548224000ULL, 1393296000ULL, 1184891264ULL, 931136000ULL, 641204288ULL, 326894240ULL,
+static const unsigned char RTjpeg_ZZ[64] = {
+ 0,
+ 8, 1,
+ 2, 9, 16,
+ 24, 17, 10, 3,
+ 4, 11, 18, 25, 32,
+ 40, 33, 26, 19, 12, 5,
+ 6, 13, 20, 27, 34, 41, 48,
+ 56, 49, 42, 35, 28, 21, 14, 7,
+ 15, 22, 29, 36, 43, 50, 57,
+ 58, 51, 44, 37, 30, 23,
+ 31, 38, 45, 52, 59,
+ 60, 53, 46, 39,
+ 47, 54, 61,
+ 62, 55,
+ 63
+};
+
+static const __u64 RTjpeg_aan_tab[64] = {
+ 4294967296ULL, 5957222912ULL, 5611718144ULL, 5050464768ULL, 4294967296ULL,
+ 3374581504ULL, 2324432128ULL, 1184891264ULL,
+ 5957222912ULL, 8263040512ULL, 7783580160ULL, 7005009920ULL, 5957222912ULL,
+ 4680582144ULL, 3224107520ULL, 1643641088ULL,
+ 5611718144ULL, 7783580160ULL, 7331904512ULL, 6598688768ULL, 5611718144ULL,
+ 4408998912ULL, 3036936960ULL, 1548224000ULL,
+ 5050464768ULL, 7005009920ULL, 6598688768ULL, 5938608128ULL, 5050464768ULL,
+ 3968072960ULL, 2733115392ULL, 1393296000ULL,
+ 4294967296ULL, 5957222912ULL, 5611718144ULL, 5050464768ULL, 4294967296ULL,
+ 3374581504ULL, 2324432128ULL, 1184891264ULL,
+ 3374581504ULL, 4680582144ULL, 4408998912ULL, 3968072960ULL, 3374581504ULL,
+ 2651326208ULL, 1826357504ULL, 931136000ULL,
+ 2324432128ULL, 3224107520ULL, 3036936960ULL, 2733115392ULL, 2324432128ULL,
+ 1826357504ULL, 1258030336ULL, 641204288ULL,
+ 1184891264ULL, 1643641088ULL, 1548224000ULL, 1393296000ULL, 1184891264ULL,
+ 931136000ULL, 641204288ULL, 326894240ULL,
};
#ifndef HAVE_LIBMMX
-static __s32 RTjpeg_ws[64+31];
+static __s32 RTjpeg_ws[64 + 31];
#endif
-__u8 RTjpeg_alldata[2*64+4*64+4*64+4*64+4*64+32];
+__u8 RTjpeg_alldata[2 * 64 + 4 * 64 + 4 * 64 + 4 * 64 + 4 * 64 + 32];
__s16 *RTjpeg_block;
__s32 *RTjpeg_lqt;
@@ -97,7 +106,7 @@ int RTjpeg_width, RTjpeg_height;
int RTjpeg_Ywidth, RTjpeg_Cwidth;
int RTjpeg_Ysize, RTjpeg_Csize;
-__s16 *RTjpeg_old=NULL;
+__s16 *RTjpeg_old = NULL;
#ifdef HAVE_LIBMMX
mmx_t RTjpeg_lmask;
@@ -106,173 +115,169 @@ mmx_t RTjpeg_cmask;
__u16 RTjpeg_lmask;
__u16 RTjpeg_cmask;
#endif
-int RTjpeg_mtest=0;
+int RTjpeg_mtest = 0;
static const unsigned char RTjpeg_lum_quant_tbl[64] = {
- 16, 11, 10, 16, 24, 40, 51, 61,
- 12, 12, 14, 19, 26, 58, 60, 55,
- 14, 13, 16, 24, 40, 57, 69, 56,
- 14, 17, 22, 29, 51, 87, 80, 62,
- 18, 22, 37, 56, 68, 109, 103, 77,
- 24, 35, 55, 64, 81, 104, 113, 92,
- 49, 64, 78, 87, 103, 121, 120, 101,
- 72, 92, 95, 98, 112, 100, 103, 99
- };
+ 16, 11, 10, 16, 24, 40, 51, 61,
+ 12, 12, 14, 19, 26, 58, 60, 55,
+ 14, 13, 16, 24, 40, 57, 69, 56,
+ 14, 17, 22, 29, 51, 87, 80, 62,
+ 18, 22, 37, 56, 68, 109, 103, 77,
+ 24, 35, 55, 64, 81, 104, 113, 92,
+ 49, 64, 78, 87, 103, 121, 120, 101,
+ 72, 92, 95, 98, 112, 100, 103, 99
+};
static const unsigned char RTjpeg_chrom_quant_tbl[64] = {
- 17, 18, 24, 47, 99, 99, 99, 99,
- 18, 21, 26, 66, 99, 99, 99, 99,
- 24, 26, 56, 99, 99, 99, 99, 99,
- 47, 66, 99, 99, 99, 99, 99, 99,
- 99, 99, 99, 99, 99, 99, 99, 99,
- 99, 99, 99, 99, 99, 99, 99, 99,
- 99, 99, 99, 99, 99, 99, 99, 99,
- 99, 99, 99, 99, 99, 99, 99, 99
- };
-
-int RTjpeg_b2s(__s16 *data, __s8 *strm, __u8 bt8)
+ 17, 18, 24, 47, 99, 99, 99, 99,
+ 18, 21, 26, 66, 99, 99, 99, 99,
+ 24, 26, 56, 99, 99, 99, 99, 99,
+ 47, 66, 99, 99, 99, 99, 99, 99,
+ 99, 99, 99, 99, 99, 99, 99, 99,
+ 99, 99, 99, 99, 99, 99, 99, 99,
+ 99, 99, 99, 99, 99, 99, 99, 99,
+ 99, 99, 99, 99, 99, 99, 99, 99
+};
+
+int
+RTjpeg_b2s (__s16 * data, __s8 * strm, __u8 bt8)
{
- register int ci, co=1, tmp;
- register __s16 ZZvalue;
-
- strm[0]=(__u8)(data[RTjpeg_ZZ[0]]>254) ? 254:((data[RTjpeg_ZZ[0]]<0)?0:data[RTjpeg_ZZ[0]]);
-
- for(ci=1; ci<=bt8; ci++)
- {
- ZZvalue = data[RTjpeg_ZZ[ci]];
-
- if(ZZvalue>0)
- {
- strm[co++]=(__s8)(ZZvalue>127)?127:ZZvalue;
- }
- else
- {
- strm[co++]=(__s8)(ZZvalue<-128)?-128:ZZvalue;
- }
- }
-
- for(; ci<64; ci++)
- {
- ZZvalue = data[RTjpeg_ZZ[ci]];
-
- if(ZZvalue>0)
- {
- strm[co++]=(__s8)(ZZvalue>63)?63:ZZvalue;
- }
- else if(ZZvalue<0)
- {
- strm[co++]=(__s8)(ZZvalue<-64)?-64:ZZvalue;
- }
- else /* compress zeros */
- {
- tmp=ci;
- do
- {
- ci++;
- }
- while((ci<64)&&(data[RTjpeg_ZZ[ci]]==0));
+ register int ci, co = 1, tmp;
+ register __s16 ZZvalue;
+
+ strm[0] =
+ (__u8) (data[RTjpeg_ZZ[0]] > 254) ? 254 : ((data[RTjpeg_ZZ[0]] <
+ 0) ? 0 : data[RTjpeg_ZZ[0]]);
+
+ for (ci = 1; ci <= bt8; ci++) {
+ ZZvalue = data[RTjpeg_ZZ[ci]];
+
+ if (ZZvalue > 0) {
+ strm[co++] = (__s8) (ZZvalue > 127) ? 127 : ZZvalue;
+ } else {
+ strm[co++] = (__s8) (ZZvalue < -128) ? -128 : ZZvalue;
+ }
+ }
+
+ for (; ci < 64; ci++) {
+ ZZvalue = data[RTjpeg_ZZ[ci]];
+
+ if (ZZvalue > 0) {
+ strm[co++] = (__s8) (ZZvalue > 63) ? 63 : ZZvalue;
+ } else if (ZZvalue < 0) {
+ strm[co++] = (__s8) (ZZvalue < -64) ? -64 : ZZvalue;
+ } else { /* compress zeros */
- strm[co++]=(__s8)(63+(ci-tmp));
- ci--;
+ tmp = ci;
+ do {
+ ci++;
+ }
+ while ((ci < 64) && (data[RTjpeg_ZZ[ci]] == 0));
+
+ strm[co++] = (__s8) (63 + (ci - tmp));
+ ci--;
+ }
}
- }
- return (int)co;
+ return (int) co;
}
-int RTjpeg_s2b(__s16 *data, __s8 *strm, __u8 bt8, __u32 *qtbl)
+int
+RTjpeg_s2b (__s16 * data, __s8 * strm, __u8 bt8, __u32 * qtbl)
{
- int ci=1, co=1, tmp;
- register int i;
-
- i=RTjpeg_ZZ[0];
- data[i]=((__u8)strm[0])*qtbl[i];
-
- for(co=1; co<=bt8; co++)
- {
- i=RTjpeg_ZZ[co];
- data[i]=strm[ci++]*qtbl[i];
- }
-
- for(; co<64; co++)
- {
- if(strm[ci]>63)
- {
- tmp=co+strm[ci]-63;
- for(; co<tmp; co++)data[RTjpeg_ZZ[co]]=0;
- co--;
- } else
- {
- i=RTjpeg_ZZ[co];
- data[i]=strm[ci]*qtbl[i];
+ int ci = 1, co = 1, tmp;
+ register int i;
+
+ i = RTjpeg_ZZ[0];
+ data[i] = ((__u8) strm[0]) * qtbl[i];
+
+ for (co = 1; co <= bt8; co++) {
+ i = RTjpeg_ZZ[co];
+ data[i] = strm[ci++] * qtbl[i];
+ }
+
+ for (; co < 64; co++) {
+ if (strm[ci] > 63) {
+ tmp = co + strm[ci] - 63;
+ for (; co < tmp; co++)
+ data[RTjpeg_ZZ[co]] = 0;
+ co--;
+ } else {
+ i = RTjpeg_ZZ[co];
+ data[i] = strm[ci] * qtbl[i];
+ }
+ ci++;
}
- ci++;
- }
- return (int)ci;
+ return (int) ci;
}
#if defined(HAVE_LIBMMX)
-void RTjpeg_quant_init(void)
+void
+RTjpeg_quant_init (void)
{
- int i;
- __s16 *qtbl;
-
- qtbl=(__s16 *)RTjpeg_lqt;
- for(i=0; i<64; i++)qtbl[i]=(__s16)RTjpeg_lqt[i];
-
- qtbl=(__s16 *)RTjpeg_cqt;
- for(i=0; i<64; i++)qtbl[i]=(__s16)RTjpeg_cqt[i];
+ int i;
+ __s16 *qtbl;
+
+ qtbl = (__s16 *) RTjpeg_lqt;
+ for (i = 0; i < 64; i++)
+ qtbl[i] = (__s16) RTjpeg_lqt[i];
+
+ qtbl = (__s16 *) RTjpeg_cqt;
+ for (i = 0; i < 64; i++)
+ qtbl[i] = (__s16) RTjpeg_cqt[i];
}
-static mmx_t RTjpeg_ones=(mmx_t)(long long)0x0001000100010001LL;
-static mmx_t RTjpeg_half=(mmx_t)(long long)0x7fff7fff7fff7fffLL;
+static mmx_t RTjpeg_ones = (mmx_t) (long long) 0x0001000100010001LL;
+static mmx_t RTjpeg_half = (mmx_t) (long long) 0x7fff7fff7fff7fffLL;
-void RTjpeg_quant(__s16 *block, __s32 *qtbl)
+void
+RTjpeg_quant (__s16 * block, __s32 * qtbl)
{
- int i;
- mmx_t *bl, *ql;
-
- ql=(mmx_t *)qtbl;
- bl=(mmx_t *)block;
-
- movq_m2r(RTjpeg_ones, mm6);
- movq_m2r(RTjpeg_half, mm7);
-
- for(i=16; i; i--)
- {
- movq_m2r(*(ql++), mm0); /* quant vals (4) */
- movq_m2r(*bl, mm2); /* block vals (4) */
- movq_r2r(mm0, mm1);
- movq_r2r(mm2, mm3);
-
- punpcklwd_r2r(mm6, mm0); /* 1 qb 1 qa */
- punpckhwd_r2r(mm6, mm1); /* 1 qd 1 qc */
-
- punpcklwd_r2r(mm7, mm2); /* 32767 bb 32767 ba */
- punpckhwd_r2r(mm7, mm3); /* 32767 bd 32767 bc */
-
- pmaddwd_r2r(mm2, mm0); /* 32767+bb*qb 32767+ba*qa */
- pmaddwd_r2r(mm3, mm1); /* 32767+bd*qd 32767+bc*qc */
-
- psrad_i2r(16, mm0);
- psrad_i2r(16, mm1);
-
- packssdw_r2r(mm1, mm0);
-
- movq_r2m(mm0, *(bl++));
-
- }
+ int i;
+ mmx_t *bl, *ql;
+
+ ql = (mmx_t *) qtbl;
+ bl = (mmx_t *) block;
+
+ movq_m2r (RTjpeg_ones, mm6);
+ movq_m2r (RTjpeg_half, mm7);
+
+ for (i = 16; i; i--) {
+ movq_m2r (*(ql++), mm0); /* quant vals (4) */
+ movq_m2r (*bl, mm2); /* block vals (4) */
+ movq_r2r (mm0, mm1);
+ movq_r2r (mm2, mm3);
+
+ punpcklwd_r2r (mm6, mm0); /* 1 qb 1 qa */
+ punpckhwd_r2r (mm6, mm1); /* 1 qd 1 qc */
+
+ punpcklwd_r2r (mm7, mm2); /* 32767 bb 32767 ba */
+ punpckhwd_r2r (mm7, mm3); /* 32767 bd 32767 bc */
+
+ pmaddwd_r2r (mm2, mm0); /* 32767+bb*qb 32767+ba*qa */
+ pmaddwd_r2r (mm3, mm1); /* 32767+bd*qd 32767+bc*qc */
+
+ psrad_i2r (16, mm0);
+ psrad_i2r (16, mm1);
+
+ packssdw_r2r (mm1, mm0);
+
+ movq_r2m (mm0, *(bl++));
+
+ }
}
#else
-void RTjpeg_quant_init(void)
+void
+RTjpeg_quant_init (void)
{
}
-void RTjpeg_quant(__s16 *block, __s32 *qtbl)
+void
+RTjpeg_quant (__s16 * block, __s32 * qtbl)
{
- int i;
-
- for(i=0; i<64; i++)
- block[i]=(__s16)((block[i]*qtbl[i]+32767)>>16);
+ int i;
+
+ for (i = 0; i < 64; i++)
+ block[i] = (__s16) ((block[i] * qtbl[i] + 32767) >> 16);
}
#endif
@@ -280,36 +285,37 @@ void RTjpeg_quant(__s16 *block, __s32 *qtbl)
* Perform the forward DCT on one block of samples.
*/
#ifdef HAVE_LIBMMX
-static mmx_t RTjpeg_C4 =(mmx_t)(long long)0x2D412D412D412D41LL;
-static mmx_t RTjpeg_C6 =(mmx_t)(long long)0x187E187E187E187ELL;
-static mmx_t RTjpeg_C2mC6=(mmx_t)(long long)0x22A322A322A322A3LL;
-static mmx_t RTjpeg_C2pC6=(mmx_t)(long long)0x539F539F539F539FLL;
-static mmx_t RTjpeg_zero =(mmx_t)(long long)0x0000000000000000LL;
+static mmx_t RTjpeg_C4 = (mmx_t) (long long) 0x2D412D412D412D41LL;
+static mmx_t RTjpeg_C6 = (mmx_t) (long long) 0x187E187E187E187ELL;
+static mmx_t RTjpeg_C2mC6 = (mmx_t) (long long) 0x22A322A322A322A3LL;
+static mmx_t RTjpeg_C2pC6 = (mmx_t) (long long) 0x539F539F539F539FLL;
+static mmx_t RTjpeg_zero = (mmx_t) (long long) 0x0000000000000000LL;
#else
-#define FIX_0_382683433 ((__s32) 98) /* FIX(0.382683433) */
-#define FIX_0_541196100 ((__s32) 139) /* FIX(0.541196100) */
-#define FIX_0_707106781 ((__s32) 181) /* FIX(0.707106781) */
-#define FIX_1_306562965 ((__s32) 334) /* FIX(1.306562965) */
+#define FIX_0_382683433 ((__s32) 98) /* FIX(0.382683433) */
+#define FIX_0_541196100 ((__s32) 139) /* FIX(0.541196100) */
+#define FIX_0_707106781 ((__s32) 181) /* FIX(0.707106781) */
+#define FIX_1_306562965 ((__s32) 334) /* FIX(1.306562965) */
#define DESCALE10(x) (__s16)( ((x)+128) >> 8)
#define DESCALE20(x) (__s16)(((x)+32768) >> 16)
#define D_MULTIPLY(var,const) ((__s32) ((var) * (const)))
#endif
-void RTjpeg_dct_init(void)
+void
+RTjpeg_dct_init (void)
{
- int i;
-
- for(i=0; i<64; i++)
- {
- RTjpeg_lqt[i]=(((__u64)RTjpeg_lqt[i]<<32)/RTjpeg_aan_tab[i]);
- RTjpeg_cqt[i]=(((__u64)RTjpeg_cqt[i]<<32)/RTjpeg_aan_tab[i]);
- }
+ int i;
+
+ for (i = 0; i < 64; i++) {
+ RTjpeg_lqt[i] = (((__u64) RTjpeg_lqt[i] << 32) / RTjpeg_aan_tab[i]);
+ RTjpeg_cqt[i] = (((__u64) RTjpeg_cqt[i] << 32) / RTjpeg_aan_tab[i]);
+ }
}
-void RTjpeg_dctY(__u8 *idata, __s16 *odata, int rskip)
+void
+RTjpeg_dctY (__u8 * idata, __s16 * odata, int rskip)
{
#ifndef HAVE_LIBMMX
__s32 tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
@@ -331,42 +337,42 @@ void RTjpeg_dctY(__u8 *idata, __s16 *odata, int rskip)
tmp5 = idataptr[2] - idataptr[5];
tmp3 = idataptr[3] + idataptr[4];
tmp4 = idataptr[3] - idataptr[4];
-
+
tmp10 = (tmp0 + tmp3); /* phase 2 */
tmp13 = tmp0 - tmp3;
tmp11 = (tmp1 + tmp2);
tmp12 = tmp1 - tmp2;
-
- wsptr[0] = (tmp10 + tmp11)<<8; /* phase 3 */
- wsptr[4] = (tmp10 - tmp11)<<8;
-
- z1 = D_MULTIPLY(tmp12 + tmp13, FIX_0_707106781); /* c4 */
- wsptr[2] = (tmp13<<8) + z1; /* phase 5 */
- wsptr[6] = (tmp13<<8) - z1;
-
+
+ wsptr[0] = (tmp10 + tmp11) << 8; /* phase 3 */
+ wsptr[4] = (tmp10 - tmp11) << 8;
+
+ z1 = D_MULTIPLY (tmp12 + tmp13, FIX_0_707106781); /* c4 */
+ wsptr[2] = (tmp13 << 8) + z1; /* phase 5 */
+ wsptr[6] = (tmp13 << 8) - z1;
+
tmp10 = tmp4 + tmp5; /* phase 2 */
tmp11 = tmp5 + tmp6;
tmp12 = tmp6 + tmp7;
- z5 = D_MULTIPLY(tmp10 - tmp12, FIX_0_382683433); /* c6 */
- z2 = D_MULTIPLY(tmp10, FIX_0_541196100) + z5; /* c2-c6 */
- z4 = D_MULTIPLY(tmp12, FIX_1_306562965) + z5; /* c2+c6 */
- z3 = D_MULTIPLY(tmp11, FIX_0_707106781); /* c4 */
+ z5 = D_MULTIPLY (tmp10 - tmp12, FIX_0_382683433); /* c6 */
+ z2 = D_MULTIPLY (tmp10, FIX_0_541196100) + z5; /* c2-c6 */
+ z4 = D_MULTIPLY (tmp12, FIX_1_306562965) + z5; /* c2+c6 */
+ z3 = D_MULTIPLY (tmp11, FIX_0_707106781); /* c4 */
- z11 = (tmp7<<8) + z3; /* phase 5 */
- z13 = (tmp7<<8) - z3;
+ z11 = (tmp7 << 8) + z3; /* phase 5 */
+ z13 = (tmp7 << 8) - z3;
wsptr[5] = z13 + z2; /* phase 6 */
wsptr[3] = z13 - z2;
wsptr[1] = z11 + z4;
wsptr[7] = z11 - z4;
- idataptr += rskip<<3; /* advance pointer to next row */
+ idataptr += rskip << 3; /* advance pointer to next row */
wsptr += 8;
}
wsptr = RTjpeg_ws;
- odataptr=odata;
+ odataptr = odata;
for (ctr = 7; ctr >= 0; ctr--) {
tmp0 = wsptr[0] + wsptr[56];
tmp7 = wsptr[0] - wsptr[56];
@@ -376,848 +382,848 @@ void RTjpeg_dctY(__u8 *idata, __s16 *odata, int rskip)
tmp5 = wsptr[16] - wsptr[40];
tmp3 = wsptr[24] + wsptr[32];
tmp4 = wsptr[24] - wsptr[32];
-
+
tmp10 = tmp0 + tmp3; /* phase 2 */
tmp13 = tmp0 - tmp3;
tmp11 = tmp1 + tmp2;
tmp12 = tmp1 - tmp2;
-
- odataptr[0] = DESCALE10(tmp10 + tmp11); /* phase 3 */
- odataptr[32] = DESCALE10(tmp10 - tmp11);
-
- z1 = D_MULTIPLY(tmp12 + tmp13, FIX_0_707106781); /* c4 */
- odataptr[16] = DESCALE20((tmp13<<8) + z1); /* phase 5 */
- odataptr[48] = DESCALE20((tmp13<<8) - z1);
+
+ odataptr[0] = DESCALE10 (tmp10 + tmp11); /* phase 3 */
+ odataptr[32] = DESCALE10 (tmp10 - tmp11);
+
+ z1 = D_MULTIPLY (tmp12 + tmp13, FIX_0_707106781); /* c4 */
+ odataptr[16] = DESCALE20 ((tmp13 << 8) + z1); /* phase 5 */
+ odataptr[48] = DESCALE20 ((tmp13 << 8) - z1);
tmp10 = tmp4 + tmp5; /* phase 2 */
tmp11 = tmp5 + tmp6;
tmp12 = tmp6 + tmp7;
- z5 = D_MULTIPLY(tmp10 - tmp12, FIX_0_382683433); /* c6 */
- z2 = D_MULTIPLY(tmp10, FIX_0_541196100) + z5; /* c2-c6 */
- z4 = D_MULTIPLY(tmp12, FIX_1_306562965) + z5; /* c2+c6 */
- z3 = D_MULTIPLY(tmp11, FIX_0_707106781); /* c4 */
+ z5 = D_MULTIPLY (tmp10 - tmp12, FIX_0_382683433); /* c6 */
+ z2 = D_MULTIPLY (tmp10, FIX_0_541196100) + z5; /* c2-c6 */
+ z4 = D_MULTIPLY (tmp12, FIX_1_306562965) + z5; /* c2+c6 */
+ z3 = D_MULTIPLY (tmp11, FIX_0_707106781); /* c4 */
- z11 = (tmp7<<8) + z3; /* phase 5 */
- z13 = (tmp7<<8) - z3;
+ z11 = (tmp7 << 8) + z3; /* phase 5 */
+ z13 = (tmp7 << 8) - z3;
- odataptr[40] = DESCALE20(z13 + z2); /* phase 6 */
- odataptr[24] = DESCALE20(z13 - z2);
- odataptr[8] = DESCALE20(z11 + z4);
- odataptr[56] = DESCALE20(z11 - z4);
+ odataptr[40] = DESCALE20 (z13 + z2); /* phase 6 */
+ odataptr[24] = DESCALE20 (z13 - z2);
+ odataptr[8] = DESCALE20 (z11 + z4);
+ odataptr[56] = DESCALE20 (z11 - z4);
odataptr++; /* advance pointer to next column */
wsptr++;
}
#else
mmx_t tmp6, tmp7;
- register mmx_t *dataptr = (mmx_t *)odata;
- mmx_t *idata2 = (mmx_t *)idata;
+ register mmx_t *dataptr = (mmx_t *) odata;
+ mmx_t *idata2 = (mmx_t *) idata;
+
+ /* first copy the input 8 bit to the destination 16 bits */
+
+ movq_m2r (RTjpeg_zero, mm2);
+
- /* first copy the input 8 bit to the destination 16 bits */
+ movq_m2r (*idata2, mm0);
+ movq_r2r (mm0, mm1);
- movq_m2r(RTjpeg_zero, mm2);
+ punpcklbw_r2r (mm2, mm0);
+ movq_r2m (mm0, *(dataptr));
+ punpckhbw_r2r (mm2, mm1);
+ movq_r2m (mm1, *(dataptr + 1));
- movq_m2r(*idata2, mm0);
- movq_r2r(mm0, mm1);
+ idata2 += rskip;
- punpcklbw_r2r(mm2, mm0);
- movq_r2m(mm0, *(dataptr));
+ movq_m2r (*idata2, mm0);
+ movq_r2r (mm0, mm1);
- punpckhbw_r2r(mm2, mm1);
- movq_r2m(mm1, *(dataptr+1));
-
- idata2 += rskip;
+ punpcklbw_r2r (mm2, mm0);
+ movq_r2m (mm0, *(dataptr + 2));
- movq_m2r(*idata2, mm0);
- movq_r2r(mm0, mm1);
+ punpckhbw_r2r (mm2, mm1);
+ movq_r2m (mm1, *(dataptr + 3));
- punpcklbw_r2r(mm2, mm0);
- movq_r2m(mm0, *(dataptr+2));
+ idata2 += rskip;
- punpckhbw_r2r(mm2, mm1);
- movq_r2m(mm1, *(dataptr+3));
-
- idata2 += rskip;
+ movq_m2r (*idata2, mm0);
+ movq_r2r (mm0, mm1);
- movq_m2r(*idata2, mm0);
- movq_r2r(mm0, mm1);
+ punpcklbw_r2r (mm2, mm0);
+ movq_r2m (mm0, *(dataptr + 4));
- punpcklbw_r2r(mm2, mm0);
- movq_r2m(mm0, *(dataptr+4));
+ punpckhbw_r2r (mm2, mm1);
+ movq_r2m (mm1, *(dataptr + 5));
- punpckhbw_r2r(mm2, mm1);
- movq_r2m(mm1, *(dataptr+5));
-
- idata2 += rskip;
+ idata2 += rskip;
- movq_m2r(*idata2, mm0);
- movq_r2r(mm0, mm1);
+ movq_m2r (*idata2, mm0);
+ movq_r2r (mm0, mm1);
- punpcklbw_r2r(mm2, mm0);
- movq_r2m(mm0, *(dataptr+6));
+ punpcklbw_r2r (mm2, mm0);
+ movq_r2m (mm0, *(dataptr + 6));
- punpckhbw_r2r(mm2, mm1);
- movq_r2m(mm1, *(dataptr+7));
-
- idata2 += rskip;
+ punpckhbw_r2r (mm2, mm1);
+ movq_r2m (mm1, *(dataptr + 7));
- movq_m2r(*idata2, mm0);
- movq_r2r(mm0, mm1);
+ idata2 += rskip;
- punpcklbw_r2r(mm2, mm0);
- movq_r2m(mm0, *(dataptr+8));
+ movq_m2r (*idata2, mm0);
+ movq_r2r (mm0, mm1);
- punpckhbw_r2r(mm2, mm1);
- movq_r2m(mm1, *(dataptr+9));
-
- idata2 += rskip;
+ punpcklbw_r2r (mm2, mm0);
+ movq_r2m (mm0, *(dataptr + 8));
- movq_m2r(*idata2, mm0);
- movq_r2r(mm0, mm1);
+ punpckhbw_r2r (mm2, mm1);
+ movq_r2m (mm1, *(dataptr + 9));
- punpcklbw_r2r(mm2, mm0);
- movq_r2m(mm0, *(dataptr+10));
+ idata2 += rskip;
- punpckhbw_r2r(mm2, mm1);
- movq_r2m(mm1, *(dataptr+11));
-
- idata2 += rskip;
+ movq_m2r (*idata2, mm0);
+ movq_r2r (mm0, mm1);
- movq_m2r(*idata2, mm0);
- movq_r2r(mm0, mm1);
+ punpcklbw_r2r (mm2, mm0);
+ movq_r2m (mm0, *(dataptr + 10));
- punpcklbw_r2r(mm2, mm0);
- movq_r2m(mm0, *(dataptr+12));
+ punpckhbw_r2r (mm2, mm1);
+ movq_r2m (mm1, *(dataptr + 11));
- punpckhbw_r2r(mm2, mm1);
- movq_r2m(mm1, *(dataptr+13));
-
- idata2 += rskip;
+ idata2 += rskip;
- movq_m2r(*idata2, mm0);
- movq_r2r(mm0, mm1);
+ movq_m2r (*idata2, mm0);
+ movq_r2r (mm0, mm1);
- punpcklbw_r2r(mm2, mm0);
- movq_r2m(mm0, *(dataptr+14));
+ punpcklbw_r2r (mm2, mm0);
+ movq_r2m (mm0, *(dataptr + 12));
- punpckhbw_r2r(mm2, mm1);
- movq_r2m(mm1, *(dataptr+15));
+ punpckhbw_r2r (mm2, mm1);
+ movq_r2m (mm1, *(dataptr + 13));
+
+ idata2 += rskip;
+
+ movq_m2r (*idata2, mm0);
+ movq_r2r (mm0, mm1);
+
+ punpcklbw_r2r (mm2, mm0);
+ movq_r2m (mm0, *(dataptr + 14));
+
+ punpckhbw_r2r (mm2, mm1);
+ movq_r2m (mm1, *(dataptr + 15));
/* Start Transpose to do calculations on rows */
- movq_m2r(*(dataptr+9), mm7); /* m03:m02|m01:m00 - first line (line 4)and copy into m5 */
+ movq_m2r (*(dataptr + 9), mm7); /* m03:m02|m01:m00 - first line (line 4)and copy into m5 */
- movq_m2r(*(dataptr+13), mm6); /* m23:m22|m21:m20 - third line (line 6)and copy into m2 */
- movq_r2r(mm7, mm5);
+ movq_m2r (*(dataptr + 13), mm6); /* m23:m22|m21:m20 - third line (line 6)and copy into m2 */
+ movq_r2r (mm7, mm5);
- punpcklwd_m2r(*(dataptr+11), mm7); /* m11:m01|m10:m00 - interleave first and second lines */
- movq_r2r(mm6, mm2);
+ punpcklwd_m2r (*(dataptr + 11), mm7); /* m11:m01|m10:m00 - interleave first and second lines */
+ movq_r2r (mm6, mm2);
- punpcklwd_m2r(*(dataptr+15), mm6); /* m31:m21|m30:m20 - interleave third and fourth lines */
- movq_r2r(mm7, mm1);
+ punpcklwd_m2r (*(dataptr + 15), mm6); /* m31:m21|m30:m20 - interleave third and fourth lines */
+ movq_r2r (mm7, mm1);
- movq_m2r(*(dataptr+11), mm3); /* m13:m13|m11:m10 - second line */
- punpckldq_r2r(mm6, mm7); /* m30:m20|m10:m00 - interleave to produce result 1 */
+ movq_m2r (*(dataptr + 11), mm3); /* m13:m13|m11:m10 - second line */
+ punpckldq_r2r (mm6, mm7); /* m30:m20|m10:m00 - interleave to produce result 1 */
- movq_m2r(*(dataptr+15), mm0); /* m13:m13|m11:m10 - fourth line */
- punpckhdq_r2r(mm6, mm1); /* m31:m21|m11:m01 - interleave to produce result 2 */
+ movq_m2r (*(dataptr + 15), mm0); /* m13:m13|m11:m10 - fourth line */
+ punpckhdq_r2r (mm6, mm1); /* m31:m21|m11:m01 - interleave to produce result 2 */
- movq_r2m(mm7,*(dataptr+9)); /* write result 1 */
- punpckhwd_r2r(mm3, mm5); /* m13:m03|m12:m02 - interleave first and second lines */
-
- movq_r2m(mm1,*(dataptr+11)); /* write result 2 */
- punpckhwd_r2r(mm0, mm2); /* m33:m23|m32:m22 - interleave third and fourth lines */
+ movq_r2m (mm7, *(dataptr + 9)); /* write result 1 */
+ punpckhwd_r2r (mm3, mm5); /* m13:m03|m12:m02 - interleave first and second lines */
- movq_r2r(mm5, mm1);
- punpckldq_r2r(mm2, mm5); /* m32:m22|m12:m02 - interleave to produce result 3 */
+ movq_r2m (mm1, *(dataptr + 11)); /* write result 2 */
+ punpckhwd_r2r (mm0, mm2); /* m33:m23|m32:m22 - interleave third and fourth lines */
- movq_m2r(*(dataptr+1), mm0); /* m03:m02|m01:m00 - first line, 4x4 */
- punpckhdq_r2r(mm2, mm1); /* m33:m23|m13:m03 - interleave to produce result 4 */
+ movq_r2r (mm5, mm1);
+ punpckldq_r2r (mm2, mm5); /* m32:m22|m12:m02 - interleave to produce result 3 */
- movq_r2m(mm5,*(dataptr+13)); /* write result 3 */
+ movq_m2r (*(dataptr + 1), mm0); /* m03:m02|m01:m00 - first line, 4x4 */
+ punpckhdq_r2r (mm2, mm1); /* m33:m23|m13:m03 - interleave to produce result 4 */
- /* last 4x4 done */
+ movq_r2m (mm5, *(dataptr + 13)); /* write result 3 */
- movq_r2m(mm1, *(dataptr+15)); /* write result 4, last 4x4 */
+ /* last 4x4 done */
- movq_m2r(*(dataptr+5), mm2); /* m23:m22|m21:m20 - third line */
- movq_r2r(mm0, mm6);
+ movq_r2m (mm1, *(dataptr + 15)); /* write result 4, last 4x4 */
- punpcklwd_m2r(*(dataptr+3), mm0); /* m11:m01|m10:m00 - interleave first and second lines */
- movq_r2r(mm2, mm7);
+ movq_m2r (*(dataptr + 5), mm2); /* m23:m22|m21:m20 - third line */
+ movq_r2r (mm0, mm6);
- punpcklwd_m2r(*(dataptr+7), mm2); /* m31:m21|m30:m20 - interleave third and fourth lines */
- movq_r2r(mm0, mm4);
+ punpcklwd_m2r (*(dataptr + 3), mm0); /* m11:m01|m10:m00 - interleave first and second lines */
+ movq_r2r (mm2, mm7);
-
- movq_m2r(*(dataptr+8), mm1); /* n03:n02|n01:n00 - first line */
- punpckldq_r2r(mm2, mm0); /* m30:m20|m10:m00 - interleave to produce first result */
+ punpcklwd_m2r (*(dataptr + 7), mm2); /* m31:m21|m30:m20 - interleave third and fourth lines */
+ movq_r2r (mm0, mm4);
- movq_m2r(*(dataptr+12), mm3); /* n23:n22|n21:n20 - third line */
- punpckhdq_r2r(mm2, mm4); /* m31:m21|m11:m01 - interleave to produce second result */
- punpckhwd_m2r(*(dataptr+3), mm6); /* m13:m03|m12:m02 - interleave first and second lines */
- movq_r2r(mm1, mm2); /* copy first line */
+ movq_m2r (*(dataptr + 8), mm1); /* n03:n02|n01:n00 - first line */
+ punpckldq_r2r (mm2, mm0); /* m30:m20|m10:m00 - interleave to produce first result */
- punpckhwd_m2r(*(dataptr+7), mm7); /* m33:m23|m32:m22 - interleave third and fourth lines */
- movq_r2r(mm6, mm5); /* copy first intermediate result */
+ movq_m2r (*(dataptr + 12), mm3); /* n23:n22|n21:n20 - third line */
+ punpckhdq_r2r (mm2, mm4); /* m31:m21|m11:m01 - interleave to produce second result */
- movq_r2m(mm0, *(dataptr+8)); /* write result 1 */
- punpckhdq_r2r(mm7, mm5); /* m33:m23|m13:m03 - produce third result */
+ punpckhwd_m2r (*(dataptr + 3), mm6); /* m13:m03|m12:m02 - interleave first and second lines */
+ movq_r2r (mm1, mm2); /* copy first line */
- punpcklwd_m2r(*(dataptr+10), mm1); /* n11:n01|n10:n00 - interleave first and second lines */
- movq_r2r(mm3, mm0); /* copy third line */
+ punpckhwd_m2r (*(dataptr + 7), mm7); /* m33:m23|m32:m22 - interleave third and fourth lines */
+ movq_r2r (mm6, mm5); /* copy first intermediate result */
- punpckhwd_m2r(*(dataptr+10), mm2); /* n13:n03|n12:n02 - interleave first and second lines */
+ movq_r2m (mm0, *(dataptr + 8)); /* write result 1 */
+ punpckhdq_r2r (mm7, mm5); /* m33:m23|m13:m03 - produce third result */
- movq_r2m(mm4, *(dataptr+10)); /* write result 2 out */
- punpckldq_r2r(mm7, mm6); /* m32:m22|m12:m02 - produce fourth result */
+ punpcklwd_m2r (*(dataptr + 10), mm1); /* n11:n01|n10:n00 - interleave first and second lines */
+ movq_r2r (mm3, mm0); /* copy third line */
- punpcklwd_m2r(*(dataptr+14), mm3); /* n31:n21|n30:n20 - interleave third and fourth lines */
- movq_r2r(mm1, mm4);
+ punpckhwd_m2r (*(dataptr + 10), mm2); /* n13:n03|n12:n02 - interleave first and second lines */
- movq_r2m(mm6, *(dataptr+12)); /* write result 3 out */
- punpckldq_r2r(mm3, mm1); /* n30:n20|n10:n00 - produce first result */
+ movq_r2m (mm4, *(dataptr + 10)); /* write result 2 out */
+ punpckldq_r2r (mm7, mm6); /* m32:m22|m12:m02 - produce fourth result */
- punpckhwd_m2r(*(dataptr+14), mm0); /* n33:n23|n32:n22 - interleave third and fourth lines */
- movq_r2r(mm2, mm6);
+ punpcklwd_m2r (*(dataptr + 14), mm3); /* n31:n21|n30:n20 - interleave third and fourth lines */
+ movq_r2r (mm1, mm4);
- movq_r2m(mm5, *(dataptr+14)); /* write result 4 out */
- punpckhdq_r2r(mm3, mm4); /* n31:n21|n11:n01- produce second result */
+ movq_r2m (mm6, *(dataptr + 12)); /* write result 3 out */
+ punpckldq_r2r (mm3, mm1); /* n30:n20|n10:n00 - produce first result */
- movq_r2m(mm1, *(dataptr+1)); /* write result 5 out - (first result for other 4 x 4 block) */
- punpckldq_r2r(mm0, mm2); /* n32:n22|n12:n02- produce third result */
+ punpckhwd_m2r (*(dataptr + 14), mm0); /* n33:n23|n32:n22 - interleave third and fourth lines */
+ movq_r2r (mm2, mm6);
- movq_r2m(mm4, *(dataptr+3)); /* write result 6 out */
- punpckhdq_r2r(mm0, mm6); /* n33:n23|n13:n03 - produce fourth result */
+ movq_r2m (mm5, *(dataptr + 14)); /* write result 4 out */
+ punpckhdq_r2r (mm3, mm4); /* n31:n21|n11:n01- produce second result */
- movq_r2m(mm2, *(dataptr+5)); /* write result 7 out*/
+ movq_r2m (mm1, *(dataptr + 1)); /* write result 5 out - (first result for other 4 x 4 block) */
+ punpckldq_r2r (mm0, mm2); /* n32:n22|n12:n02- produce third result */
- movq_m2r(*dataptr, mm0); /* m03:m02|m01:m00 - first line, first 4x4 */
+ movq_r2m (mm4, *(dataptr + 3)); /* write result 6 out */
+ punpckhdq_r2r (mm0, mm6); /* n33:n23|n13:n03 - produce fourth result */
- movq_r2m(mm6, *(dataptr+7)); /* write result 8 out */
+ movq_r2m (mm2, *(dataptr + 5)); /* write result 7 out */
+
+ movq_m2r (*dataptr, mm0); /* m03:m02|m01:m00 - first line, first 4x4 */
+
+ movq_r2m (mm6, *(dataptr + 7)); /* write result 8 out */
/* Do first 4x4 quadrant, which is used in the beginning of the DCT: */
- movq_m2r(*(dataptr+4), mm7); /* m23:m22|m21:m20 - third line */
- movq_r2r(mm0, mm2);
+ movq_m2r (*(dataptr + 4), mm7); /* m23:m22|m21:m20 - third line */
+ movq_r2r (mm0, mm2);
- punpcklwd_m2r(*(dataptr+2), mm0); /* m11:m01|m10:m00 - interleave first and second lines */
- movq_r2r(mm7, mm4);
+ punpcklwd_m2r (*(dataptr + 2), mm0); /* m11:m01|m10:m00 - interleave first and second lines */
+ movq_r2r (mm7, mm4);
- punpcklwd_m2r(*(dataptr+6), mm7); /* m31:m21|m30:m20 - interleave third and fourth lines */
- movq_r2r(mm0, mm1);
+ punpcklwd_m2r (*(dataptr + 6), mm7); /* m31:m21|m30:m20 - interleave third and fourth lines */
+ movq_r2r (mm0, mm1);
- movq_m2r(*(dataptr+2), mm6); /* m13:m12|m11:m10 - second line */
- punpckldq_r2r(mm7, mm0); /* m30:m20|m10:m00 - interleave to produce result 1 */
+ movq_m2r (*(dataptr + 2), mm6); /* m13:m12|m11:m10 - second line */
+ punpckldq_r2r (mm7, mm0); /* m30:m20|m10:m00 - interleave to produce result 1 */
- movq_m2r(*(dataptr+6), mm5); /* m33:m32|m31:m30 - fourth line */
- punpckhdq_r2r(mm7, mm1); /* m31:m21|m11:m01 - interleave to produce result 2 */
+ movq_m2r (*(dataptr + 6), mm5); /* m33:m32|m31:m30 - fourth line */
+ punpckhdq_r2r (mm7, mm1); /* m31:m21|m11:m01 - interleave to produce result 2 */
- movq_r2r(mm0, mm7); /* write result 1 */
- punpckhwd_r2r(mm6, mm2); /* m13:m03|m12:m02 - interleave first and second lines */
+ movq_r2r (mm0, mm7); /* write result 1 */
+ punpckhwd_r2r (mm6, mm2); /* m13:m03|m12:m02 - interleave first and second lines */
- psubw_m2r(*(dataptr+14), mm7); /* tmp07=x0-x7: Stage 1 */
- movq_r2r(mm1, mm6); /* write result 2 */
+ psubw_m2r (*(dataptr + 14), mm7); /* tmp07=x0-x7: Stage 1 */
+ movq_r2r (mm1, mm6); /* write result 2 */
- paddw_m2r(*(dataptr+14), mm0); /* tmp00=x0+x7: Stage 1 */
- punpckhwd_r2r(mm5, mm4); /* m33:m23|m32:m22 - interleave third and fourth lines */
+ paddw_m2r (*(dataptr + 14), mm0); /* tmp00=x0+x7: Stage 1 */
+ punpckhwd_r2r (mm5, mm4); /* m33:m23|m32:m22 - interleave third and fourth lines */
- paddw_m2r(*(dataptr+12), mm1); /* tmp01=x1+x6: Stage 1 */
- movq_r2r(mm2, mm3); /* copy first intermediate result */
+ paddw_m2r (*(dataptr + 12), mm1); /* tmp01=x1+x6: Stage 1 */
+ movq_r2r (mm2, mm3); /* copy first intermediate result */
- psubw_m2r(*(dataptr+12), mm6); /* tmp06=x1-x6: Stage 1 */
- punpckldq_r2r(mm4, mm2); /* m32:m22|m12:m02 - interleave to produce result 3 */
+ psubw_m2r (*(dataptr + 12), mm6); /* tmp06=x1-x6: Stage 1 */
+ punpckldq_r2r (mm4, mm2); /* m32:m22|m12:m02 - interleave to produce result 3 */
- movq_r2m(mm7, tmp7);
- movq_r2r(mm2, mm5); /* write result 3 */
+ movq_r2m (mm7, tmp7);
+ movq_r2r (mm2, mm5); /* write result 3 */
- movq_r2m(mm6, tmp6);
- punpckhdq_r2r(mm4, mm3); /* m33:m23|m13:m03 - interleave to produce result 4 */
+ movq_r2m (mm6, tmp6);
+ punpckhdq_r2r (mm4, mm3); /* m33:m23|m13:m03 - interleave to produce result 4 */
- paddw_m2r(*(dataptr+10), mm2); /* tmp02=x2+5: Stage 1 */
- movq_r2r(mm3, mm4); /* write result 4 */
+ paddw_m2r (*(dataptr + 10), mm2); /* tmp02=x2+5: Stage 1 */
+ movq_r2r (mm3, mm4); /* write result 4 */
/************************************************************************************************
End of Transpose
************************************************************************************************/
- paddw_m2r(*(dataptr+8), mm3); /* tmp03=x3+x4: stage 1 */
- movq_r2r(mm0, mm7);
+ paddw_m2r (*(dataptr + 8), mm3); /* tmp03=x3+x4: stage 1 */
+ movq_r2r (mm0, mm7);
- psubw_m2r(*(dataptr+8), mm4); /* tmp04=x3-x4: stage 1 */
- movq_r2r(mm1, mm6);
+ psubw_m2r (*(dataptr + 8), mm4); /* tmp04=x3-x4: stage 1 */
+ movq_r2r (mm1, mm6);
- paddw_r2r(mm3, mm0); /* tmp10 = tmp00 + tmp03: even 2 */
- psubw_r2r(mm3, mm7); /* tmp13 = tmp00 - tmp03: even 2 */
+ paddw_r2r (mm3, mm0); /* tmp10 = tmp00 + tmp03: even 2 */
+ psubw_r2r (mm3, mm7); /* tmp13 = tmp00 - tmp03: even 2 */
- psubw_r2r(mm2, mm6); /* tmp12 = tmp01 - tmp02: even 2 */
- paddw_r2r(mm2, mm1); /* tmp11 = tmp01 + tmp02: even 2 */
+ psubw_r2r (mm2, mm6); /* tmp12 = tmp01 - tmp02: even 2 */
+ paddw_r2r (mm2, mm1); /* tmp11 = tmp01 + tmp02: even 2 */
- psubw_m2r(*(dataptr+10), mm5); /* tmp05=x2-x5: stage 1 */
- paddw_r2r(mm7, mm6); /* tmp12 + tmp13 */
+ psubw_m2r (*(dataptr + 10), mm5); /* tmp05=x2-x5: stage 1 */
+ paddw_r2r (mm7, mm6); /* tmp12 + tmp13 */
- /* stage 3 */
+ /* stage 3 */
- movq_m2r(tmp6, mm2);
- movq_r2r(mm0, mm3);
+ movq_m2r (tmp6, mm2);
+ movq_r2r (mm0, mm3);
- psllw_i2r(2, mm6); /* m8 * 2^2 */
- paddw_r2r(mm1, mm0);
+ psllw_i2r (2, mm6); /* m8 * 2^2 */
+ paddw_r2r (mm1, mm0);
- pmulhw_m2r(RTjpeg_C4, mm6); /* z1 */
- psubw_r2r(mm1, mm3);
+ pmulhw_m2r (RTjpeg_C4, mm6); /* z1 */
+ psubw_r2r (mm1, mm3);
- movq_r2m(mm0, *dataptr);
- movq_r2r(mm7, mm0);
-
- /* Odd part */
- movq_r2m(mm3, *(dataptr+8));
- paddw_r2r(mm5, mm4); /* tmp10 */
+ movq_r2m (mm0, *dataptr);
+ movq_r2r (mm7, mm0);
- movq_m2r(tmp7, mm3);
- paddw_r2r(mm6, mm0); /* tmp32 */
+ /* Odd part */
+ movq_r2m (mm3, *(dataptr + 8));
+ paddw_r2r (mm5, mm4); /* tmp10 */
- paddw_r2r(mm2, mm5); /* tmp11 */
- psubw_r2r(mm6, mm7); /* tmp33 */
+ movq_m2r (tmp7, mm3);
+ paddw_r2r (mm6, mm0); /* tmp32 */
- movq_r2m(mm0, *(dataptr+4));
- paddw_r2r(mm3, mm2); /* tmp12 */
+ paddw_r2r (mm2, mm5); /* tmp11 */
+ psubw_r2r (mm6, mm7); /* tmp33 */
- /* stage 4 */
+ movq_r2m (mm0, *(dataptr + 4));
+ paddw_r2r (mm3, mm2); /* tmp12 */
- movq_r2m(mm7, *(dataptr+12));
- movq_r2r(mm4, mm1); /* copy of tmp10 */
+ /* stage 4 */
- psubw_r2r(mm2, mm1); /* tmp10 - tmp12 */
- psllw_i2r(2, mm4); /* m8 * 2^2 */
+ movq_r2m (mm7, *(dataptr + 12));
+ movq_r2r (mm4, mm1); /* copy of tmp10 */
- movq_m2r(RTjpeg_C2mC6, mm0);
- psllw_i2r(2, mm1);
+ psubw_r2r (mm2, mm1); /* tmp10 - tmp12 */
+ psllw_i2r (2, mm4); /* m8 * 2^2 */
- pmulhw_m2r(RTjpeg_C6, mm1); /* z5 */
- psllw_i2r(2, mm2);
+ movq_m2r (RTjpeg_C2mC6, mm0);
+ psllw_i2r (2, mm1);
- pmulhw_r2r(mm0, mm4); /* z5 */
+ pmulhw_m2r (RTjpeg_C6, mm1); /* z5 */
+ psllw_i2r (2, mm2);
- /* stage 5 */
+ pmulhw_r2r (mm0, mm4); /* z5 */
- pmulhw_m2r(RTjpeg_C2pC6, mm2);
- psllw_i2r(2, mm5);
+ /* stage 5 */
- pmulhw_m2r(RTjpeg_C4, mm5); /* z3 */
- movq_r2r(mm3, mm0); /* copy tmp7 */
+ pmulhw_m2r (RTjpeg_C2pC6, mm2);
+ psllw_i2r (2, mm5);
- movq_m2r(*(dataptr+1), mm7);
- paddw_r2r(mm1, mm4); /* z2 */
+ pmulhw_m2r (RTjpeg_C4, mm5); /* z3 */
+ movq_r2r (mm3, mm0); /* copy tmp7 */
- paddw_r2r(mm1, mm2); /* z4 */
+ movq_m2r (*(dataptr + 1), mm7);
+ paddw_r2r (mm1, mm4); /* z2 */
- paddw_r2r(mm5, mm0); /* z11 */
- psubw_r2r(mm5, mm3); /* z13 */
+ paddw_r2r (mm1, mm2); /* z4 */
- /* stage 6 */
+ paddw_r2r (mm5, mm0); /* z11 */
+ psubw_r2r (mm5, mm3); /* z13 */
- movq_r2r(mm3, mm5); /* copy z13 */
- psubw_r2r(mm4, mm3); /* y3=z13 - z2 */
+ /* stage 6 */
- paddw_r2r(mm4, mm5); /* y5=z13 + z2 */
- movq_r2r(mm0, mm6); /* copy z11 */
+ movq_r2r (mm3, mm5); /* copy z13 */
+ psubw_r2r (mm4, mm3); /* y3=z13 - z2 */
- movq_r2m(mm3, *(dataptr+6)); /*save y3 */
- psubw_r2r(mm2, mm0); /* y7=z11 - z4 */
+ paddw_r2r (mm4, mm5); /* y5=z13 + z2 */
+ movq_r2r (mm0, mm6); /* copy z11 */
- movq_r2m(mm5, *(dataptr+10)); /*save y5 */
- paddw_r2r(mm2, mm6); /* y1=z11 + z4 */
+ movq_r2m (mm3, *(dataptr + 6)); /*save y3 */
+ psubw_r2r (mm2, mm0); /* y7=z11 - z4 */
- movq_r2m(mm0, *(dataptr+14)); /*save y7 */
+ movq_r2m (mm5, *(dataptr + 10)); /*save y5 */
+ paddw_r2r (mm2, mm6); /* y1=z11 + z4 */
+
+ movq_r2m (mm0, *(dataptr + 14)); /*save y7 */
/************************************************
* End of 1st 4 rows
************************************************/
- movq_m2r(*(dataptr+3), mm1); /* load x1: stage 1 */
- movq_r2r(mm7, mm0); /* copy x0 */
+ movq_m2r (*(dataptr + 3), mm1); /* load x1: stage 1 */
+ movq_r2r (mm7, mm0); /* copy x0 */
+
+ movq_r2m (mm6, *(dataptr + 2)); /*save y1 */
- movq_r2m(mm6, *(dataptr+2)); /*save y1 */
+ movq_m2r (*(dataptr + 5), mm2); /* load x2: stage 1 */
+ movq_r2r (mm1, mm6); /* copy x1 */
- movq_m2r(*(dataptr+5), mm2); /* load x2: stage 1 */
- movq_r2r(mm1, mm6); /* copy x1 */
+ paddw_m2r (*(dataptr + 15), mm0); /* tmp00 = x0 + x7 */
- paddw_m2r(*(dataptr+15), mm0); /* tmp00 = x0 + x7 */
+ movq_m2r (*(dataptr + 7), mm3); /* load x3 : stage 1 */
+ movq_r2r (mm2, mm5); /* copy x2 */
- movq_m2r(*(dataptr+7), mm3); /* load x3 : stage 1 */
- movq_r2r(mm2, mm5); /* copy x2 */
+ psubw_m2r (*(dataptr + 15), mm7); /* tmp07 = x0 - x7 */
+ movq_r2r (mm3, mm4); /* copy x3 */
- psubw_m2r(*(dataptr+15), mm7); /* tmp07 = x0 - x7 */
- movq_r2r(mm3, mm4); /* copy x3 */
+ paddw_m2r (*(dataptr + 13), mm1); /* tmp01 = x1 + x6 */
- paddw_m2r(*(dataptr+13), mm1); /* tmp01 = x1 + x6 */
+ movq_r2m (mm7, tmp7); /* save tmp07 */
+ movq_r2r (mm0, mm7); /* copy tmp00 */
- movq_r2m(mm7, tmp7); /* save tmp07 */
- movq_r2r(mm0, mm7); /* copy tmp00 */
+ psubw_m2r (*(dataptr + 13), mm6); /* tmp06 = x1 - x6 */
- psubw_m2r(*(dataptr+13), mm6); /* tmp06 = x1 - x6 */
+ /* stage 2, Even Part */
- /* stage 2, Even Part */
+ paddw_m2r (*(dataptr + 9), mm3); /* tmp03 = x3 + x4 */
- paddw_m2r(*(dataptr+9), mm3); /* tmp03 = x3 + x4 */
+ movq_r2m (mm6, tmp6); /* save tmp07 */
+ movq_r2r (mm1, mm6); /* copy tmp01 */
- movq_r2m(mm6, tmp6); /* save tmp07 */
- movq_r2r(mm1, mm6); /* copy tmp01 */
+ paddw_m2r (*(dataptr + 11), mm2); /* tmp02 = x2 + x5 */
+ paddw_r2r (mm3, mm0); /* tmp10 = tmp00 + tmp03 */
- paddw_m2r(*(dataptr+11), mm2); /* tmp02 = x2 + x5 */
- paddw_r2r(mm3, mm0); /* tmp10 = tmp00 + tmp03 */
+ psubw_r2r (mm3, mm7); /* tmp13 = tmp00 - tmp03 */
- psubw_r2r(mm3, mm7); /* tmp13 = tmp00 - tmp03 */
+ psubw_m2r (*(dataptr + 9), mm4); /* tmp04 = x3 - x4 */
+ psubw_r2r (mm2, mm6); /* tmp12 = tmp01 - tmp02 */
- psubw_m2r(*(dataptr+9), mm4); /* tmp04 = x3 - x4 */
- psubw_r2r(mm2, mm6); /* tmp12 = tmp01 - tmp02 */
+ paddw_r2r (mm2, mm1); /* tmp11 = tmp01 + tmp02 */
- paddw_r2r(mm2, mm1); /* tmp11 = tmp01 + tmp02 */
+ psubw_m2r (*(dataptr + 11), mm5); /* tmp05 = x2 - x5 */
+ paddw_r2r (mm7, mm6); /* tmp12 + tmp13 */
- psubw_m2r(*(dataptr+11), mm5); /* tmp05 = x2 - x5 */
- paddw_r2r(mm7, mm6); /* tmp12 + tmp13 */
+ /* stage 3, Even and stage 4 & 5 even */
- /* stage 3, Even and stage 4 & 5 even */
+ movq_m2r (tmp6, mm2); /* load tmp6 */
+ movq_r2r (mm0, mm3); /* copy tmp10 */
- movq_m2r(tmp6, mm2); /* load tmp6 */
- movq_r2r(mm0, mm3); /* copy tmp10 */
+ psllw_i2r (2, mm6); /* shift z1 */
+ paddw_r2r (mm1, mm0); /* y0=tmp10 + tmp11 */
- psllw_i2r(2, mm6); /* shift z1 */
- paddw_r2r(mm1, mm0); /* y0=tmp10 + tmp11 */
+ pmulhw_m2r (RTjpeg_C4, mm6); /* z1 */
+ psubw_r2r (mm1, mm3); /* y4=tmp10 - tmp11 */
- pmulhw_m2r(RTjpeg_C4, mm6); /* z1 */
- psubw_r2r(mm1, mm3); /* y4=tmp10 - tmp11 */
+ movq_r2m (mm0, *(dataptr + 1)); /*save y0 */
+ movq_r2r (mm7, mm0); /* copy tmp13 */
- movq_r2m(mm0, *(dataptr+1)); /*save y0 */
- movq_r2r(mm7, mm0); /* copy tmp13 */
-
- /* odd part */
+ /* odd part */
- movq_r2m(mm3, *(dataptr+9)); /*save y4 */
- paddw_r2r(mm5, mm4); /* tmp10 = tmp4 + tmp5 */
+ movq_r2m (mm3, *(dataptr + 9)); /*save y4 */
+ paddw_r2r (mm5, mm4); /* tmp10 = tmp4 + tmp5 */
- movq_m2r(tmp7, mm3); /* load tmp7 */
- paddw_r2r(mm6, mm0); /* tmp32 = tmp13 + z1 */
+ movq_m2r (tmp7, mm3); /* load tmp7 */
+ paddw_r2r (mm6, mm0); /* tmp32 = tmp13 + z1 */
- paddw_r2r(mm2, mm5); /* tmp11 = tmp5 + tmp6 */
- psubw_r2r(mm6, mm7); /* tmp33 = tmp13 - z1 */
+ paddw_r2r (mm2, mm5); /* tmp11 = tmp5 + tmp6 */
+ psubw_r2r (mm6, mm7); /* tmp33 = tmp13 - z1 */
- movq_r2m(mm0, *(dataptr+5)); /*save y2 */
- paddw_r2r(mm3, mm2); /* tmp12 = tmp6 + tmp7 */
+ movq_r2m (mm0, *(dataptr + 5)); /*save y2 */
+ paddw_r2r (mm3, mm2); /* tmp12 = tmp6 + tmp7 */
- /* stage 4 */
+ /* stage 4 */
- movq_r2m(mm7, *(dataptr+13)); /*save y6 */
- movq_r2r(mm4, mm1); /* copy tmp10 */
+ movq_r2m (mm7, *(dataptr + 13)); /*save y6 */
+ movq_r2r (mm4, mm1); /* copy tmp10 */
- psubw_r2r(mm2, mm1); /* tmp10 - tmp12 */
- psllw_i2r(2, mm4); /* shift tmp10 */
+ psubw_r2r (mm2, mm1); /* tmp10 - tmp12 */
+ psllw_i2r (2, mm4); /* shift tmp10 */
- movq_m2r(RTjpeg_C2mC6, mm0); /* load C2mC6 */
- psllw_i2r(2, mm1); /* shift (tmp10-tmp12) */
+ movq_m2r (RTjpeg_C2mC6, mm0); /* load C2mC6 */
+ psllw_i2r (2, mm1); /* shift (tmp10-tmp12) */
- pmulhw_m2r(RTjpeg_C6, mm1); /* z5 */
- psllw_i2r(2, mm5); /* prepare for multiply */
+ pmulhw_m2r (RTjpeg_C6, mm1); /* z5 */
+ psllw_i2r (2, mm5); /* prepare for multiply */
- pmulhw_r2r(mm0, mm4); /* multiply by converted real */
+ pmulhw_r2r (mm0, mm4); /* multiply by converted real */
- /* stage 5 */
+ /* stage 5 */
- pmulhw_m2r(RTjpeg_C4, mm5); /* z3 */
- psllw_i2r(2, mm2); /* prepare for multiply */
+ pmulhw_m2r (RTjpeg_C4, mm5); /* z3 */
+ psllw_i2r (2, mm2); /* prepare for multiply */
- pmulhw_m2r(RTjpeg_C2pC6, mm2); /* multiply */
- movq_r2r(mm3, mm0); /* copy tmp7 */
+ pmulhw_m2r (RTjpeg_C2pC6, mm2); /* multiply */
+ movq_r2r (mm3, mm0); /* copy tmp7 */
- movq_m2r(*(dataptr+9), mm7); /* m03:m02|m01:m00 - first line (line 4)and copy into mm7 */
- paddw_r2r(mm1, mm4); /* z2 */
+ movq_m2r (*(dataptr + 9), mm7); /* m03:m02|m01:m00 - first line (line 4)and copy into mm7 */
+ paddw_r2r (mm1, mm4); /* z2 */
- paddw_r2r(mm5, mm0); /* z11 */
- psubw_r2r(mm5, mm3); /* z13 */
+ paddw_r2r (mm5, mm0); /* z11 */
+ psubw_r2r (mm5, mm3); /* z13 */
- /* stage 6 */
+ /* stage 6 */
- movq_r2r(mm3, mm5); /* copy z13 */
- paddw_r2r(mm1, mm2); /* z4 */
+ movq_r2r (mm3, mm5); /* copy z13 */
+ paddw_r2r (mm1, mm2); /* z4 */
- movq_r2r(mm0, mm6); /* copy z11 */
- psubw_r2r(mm4, mm5); /* y3 */
+ movq_r2r (mm0, mm6); /* copy z11 */
+ psubw_r2r (mm4, mm5); /* y3 */
- paddw_r2r(mm2, mm6); /* y1 */
- paddw_r2r(mm4, mm3); /* y5 */
+ paddw_r2r (mm2, mm6); /* y1 */
+ paddw_r2r (mm4, mm3); /* y5 */
- movq_r2m(mm5, *(dataptr+7)); /*save y3 */
+ movq_r2m (mm5, *(dataptr + 7)); /*save y3 */
+
+ movq_r2m (mm6, *(dataptr + 3)); /*save y1 */
+ psubw_r2r (mm2, mm0); /* y7 */
- movq_r2m(mm6, *(dataptr+3)); /*save y1 */
- psubw_r2r(mm2, mm0); /* y7 */
-
/************************************************************************************************
Start of Transpose
************************************************************************************************/
- movq_m2r(*(dataptr+13), mm6); /* m23:m22|m21:m20 - third line (line 6)and copy into m2 */
- movq_r2r(mm7, mm5); /* copy first line */
+ movq_m2r (*(dataptr + 13), mm6); /* m23:m22|m21:m20 - third line (line 6)and copy into m2 */
+ movq_r2r (mm7, mm5); /* copy first line */
- punpcklwd_r2r(mm3, mm7); /* m11:m01|m10:m00 - interleave first and second lines */
- movq_r2r(mm6, mm2); /* copy third line */
+ punpcklwd_r2r (mm3, mm7); /* m11:m01|m10:m00 - interleave first and second lines */
+ movq_r2r (mm6, mm2); /* copy third line */
- punpcklwd_r2r(mm0, mm6); /* m31:m21|m30:m20 - interleave third and fourth lines */
- movq_r2r(mm7, mm1); /* copy first intermediate result */
+ punpcklwd_r2r (mm0, mm6); /* m31:m21|m30:m20 - interleave third and fourth lines */
+ movq_r2r (mm7, mm1); /* copy first intermediate result */
- punpckldq_r2r(mm6, mm7); /* m30:m20|m10:m00 - interleave to produce result 1 */
+ punpckldq_r2r (mm6, mm7); /* m30:m20|m10:m00 - interleave to produce result 1 */
- punpckhdq_r2r(mm6, mm1); /* m31:m21|m11:m01 - interleave to produce result 2 */
+ punpckhdq_r2r (mm6, mm1); /* m31:m21|m11:m01 - interleave to produce result 2 */
- movq_r2m(mm7, *(dataptr+9)); /* write result 1 */
- punpckhwd_r2r(mm3, mm5); /* m13:m03|m12:m02 - interleave first and second lines */
+ movq_r2m (mm7, *(dataptr + 9)); /* write result 1 */
+ punpckhwd_r2r (mm3, mm5); /* m13:m03|m12:m02 - interleave first and second lines */
- movq_r2m(mm1, *(dataptr+11)); /* write result 2 */
- punpckhwd_r2r(mm0, mm2); /* m33:m23|m32:m22 - interleave third and fourth lines */
+ movq_r2m (mm1, *(dataptr + 11)); /* write result 2 */
+ punpckhwd_r2r (mm0, mm2); /* m33:m23|m32:m22 - interleave third and fourth lines */
- movq_r2r(mm5, mm1); /* copy first intermediate result */
- punpckldq_r2r(mm2, mm5); /* m32:m22|m12:m02 - interleave to produce result 3 */
+ movq_r2r (mm5, mm1); /* copy first intermediate result */
+ punpckldq_r2r (mm2, mm5); /* m32:m22|m12:m02 - interleave to produce result 3 */
- movq_m2r(*(dataptr+1), mm0); /* m03:m02|m01:m00 - first line, 4x4 */
- punpckhdq_r2r(mm2, mm1); /* m33:m23|m13:m03 - interleave to produce result 4 */
+ movq_m2r (*(dataptr + 1), mm0); /* m03:m02|m01:m00 - first line, 4x4 */
+ punpckhdq_r2r (mm2, mm1); /* m33:m23|m13:m03 - interleave to produce result 4 */
- movq_r2m(mm5, *(dataptr+13)); /* write result 3 */
+ movq_r2m (mm5, *(dataptr + 13)); /* write result 3 */
/****** last 4x4 done */
- movq_r2m(mm1, *(dataptr+15)); /* write result 4, last 4x4 */
+ movq_r2m (mm1, *(dataptr + 15)); /* write result 4, last 4x4 */
+
+ movq_m2r (*(dataptr + 5), mm2); /* m23:m22|m21:m20 - third line */
+ movq_r2r (mm0, mm6); /* copy first line */
- movq_m2r(*(dataptr+5), mm2); /* m23:m22|m21:m20 - third line */
- movq_r2r(mm0, mm6); /* copy first line */
+ punpcklwd_m2r (*(dataptr + 3), mm0); /* m11:m01|m10:m00 - interleave first and second lines */
+ movq_r2r (mm2, mm7); /* copy third line */
- punpcklwd_m2r(*(dataptr+3), mm0); /* m11:m01|m10:m00 - interleave first and second lines */
- movq_r2r(mm2, mm7); /* copy third line */
+ punpcklwd_m2r (*(dataptr + 7), mm2); /* m31:m21|m30:m20 - interleave third and fourth lines */
+ movq_r2r (mm0, mm4); /* copy first intermediate result */
- punpcklwd_m2r(*(dataptr+7), mm2); /* m31:m21|m30:m20 - interleave third and fourth lines */
- movq_r2r(mm0, mm4); /* copy first intermediate result */
-
- movq_m2r(*(dataptr+8), mm1); /* n03:n02|n01:n00 - first line */
- punpckldq_r2r(mm2, mm0); /* m30:m20|m10:m00 - interleave to produce first result */
+ movq_m2r (*(dataptr + 8), mm1); /* n03:n02|n01:n00 - first line */
+ punpckldq_r2r (mm2, mm0); /* m30:m20|m10:m00 - interleave to produce first result */
- movq_m2r(*(dataptr+12), mm3); /* n23:n22|n21:n20 - third line */
- punpckhdq_r2r(mm2, mm4); /* m31:m21|m11:m01 - interleave to produce second result */
+ movq_m2r (*(dataptr + 12), mm3); /* n23:n22|n21:n20 - third line */
+ punpckhdq_r2r (mm2, mm4); /* m31:m21|m11:m01 - interleave to produce second result */
- punpckhwd_m2r(*(dataptr+3), mm6); /* m13:m03|m12:m02 - interleave first and second lines */
- movq_r2r(mm1, mm2); /* copy first line */
+ punpckhwd_m2r (*(dataptr + 3), mm6); /* m13:m03|m12:m02 - interleave first and second lines */
+ movq_r2r (mm1, mm2); /* copy first line */
- punpckhwd_m2r(*(dataptr+7), mm7); /* m33:m23|m32:m22 - interleave third and fourth lines */
- movq_r2r(mm6, mm5); /* copy first intermediate result */
+ punpckhwd_m2r (*(dataptr + 7), mm7); /* m33:m23|m32:m22 - interleave third and fourth lines */
+ movq_r2r (mm6, mm5); /* copy first intermediate result */
- movq_r2m(mm0, *(dataptr+8)); /* write result 1 */
- punpckhdq_r2r(mm7, mm5); /* m33:m23|m13:m03 - produce third result */
+ movq_r2m (mm0, *(dataptr + 8)); /* write result 1 */
+ punpckhdq_r2r (mm7, mm5); /* m33:m23|m13:m03 - produce third result */
- punpcklwd_m2r(*(dataptr+10), mm1); /* n11:n01|n10:n00 - interleave first and second lines */
- movq_r2r(mm3, mm0); /* copy third line */
+ punpcklwd_m2r (*(dataptr + 10), mm1); /* n11:n01|n10:n00 - interleave first and second lines */
+ movq_r2r (mm3, mm0); /* copy third line */
- punpckhwd_m2r(*(dataptr+10), mm2); /* n13:n03|n12:n02 - interleave first and second lines */
+ punpckhwd_m2r (*(dataptr + 10), mm2); /* n13:n03|n12:n02 - interleave first and second lines */
- movq_r2m(mm4, *(dataptr+10)); /* write result 2 out */
- punpckldq_r2r(mm7, mm6); /* m32:m22|m12:m02 - produce fourth result */
+ movq_r2m (mm4, *(dataptr + 10)); /* write result 2 out */
+ punpckldq_r2r (mm7, mm6); /* m32:m22|m12:m02 - produce fourth result */
- punpcklwd_m2r(*(dataptr+14), mm3); /* n33:n23|n32:n22 - interleave third and fourth lines */
- movq_r2r(mm1, mm4); /* copy second intermediate result */
+ punpcklwd_m2r (*(dataptr + 14), mm3); /* n33:n23|n32:n22 - interleave third and fourth lines */
+ movq_r2r (mm1, mm4); /* copy second intermediate result */
- movq_r2m(mm6, *(dataptr+12)); /* write result 3 out */
- punpckldq_r2r(mm3, mm1); /* */
+ movq_r2m (mm6, *(dataptr + 12)); /* write result 3 out */
+ punpckldq_r2r (mm3, mm1); /* */
- punpckhwd_m2r(*(dataptr+14), mm0); /* n33:n23|n32:n22 - interleave third and fourth lines */
- movq_r2r(mm2, mm6); /* copy second intermediate result */
+ punpckhwd_m2r (*(dataptr + 14), mm0); /* n33:n23|n32:n22 - interleave third and fourth lines */
+ movq_r2r (mm2, mm6); /* copy second intermediate result */
- movq_r2m(mm5, *(dataptr+14)); /* write result 4 out */
- punpckhdq_r2r(mm3, mm4); /* n31:n21|n11:n01- produce second result */
+ movq_r2m (mm5, *(dataptr + 14)); /* write result 4 out */
+ punpckhdq_r2r (mm3, mm4); /* n31:n21|n11:n01- produce second result */
- movq_r2m(mm1, *(dataptr+1)); /* write result 5 out - (first result for other 4 x 4 block) */
- punpckldq_r2r(mm0, mm2); /* n32:n22|n12:n02- produce third result */
+ movq_r2m (mm1, *(dataptr + 1)); /* write result 5 out - (first result for other 4 x 4 block) */
+ punpckldq_r2r (mm0, mm2); /* n32:n22|n12:n02- produce third result */
- movq_r2m(mm4, *(dataptr+3)); /* write result 6 out */
- punpckhdq_r2r(mm0, mm6); /* n33:n23|n13:n03 - produce fourth result */
+ movq_r2m (mm4, *(dataptr + 3)); /* write result 6 out */
+ punpckhdq_r2r (mm0, mm6); /* n33:n23|n13:n03 - produce fourth result */
- movq_r2m(mm2, *(dataptr+5)); /* write result 7 out */
+ movq_r2m (mm2, *(dataptr + 5)); /* write result 7 out */
- movq_m2r(*dataptr, mm0); /* m03:m02|m01:m00 - first line, first 4x4 */
+ movq_m2r (*dataptr, mm0); /* m03:m02|m01:m00 - first line, first 4x4 */
- movq_r2m(mm6, *(dataptr+7)); /* write result 8 out */
+ movq_r2m (mm6, *(dataptr + 7)); /* write result 8 out */
/* Do first 4x4 quadrant, which is used in the beginning of the DCT: */
- movq_m2r(*(dataptr+4), mm7); /* m23:m22|m21:m20 - third line */
- movq_r2r(mm0, mm2); /* copy first line */
+ movq_m2r (*(dataptr + 4), mm7); /* m23:m22|m21:m20 - third line */
+ movq_r2r (mm0, mm2); /* copy first line */
+
+ punpcklwd_m2r (*(dataptr + 2), mm0); /* m11:m01|m10:m00 - interleave first and second lines */
+ movq_r2r (mm7, mm4); /* copy third line */
- punpcklwd_m2r(*(dataptr+2), mm0); /* m11:m01|m10:m00 - interleave first and second lines */
- movq_r2r(mm7, mm4); /* copy third line */
-
- punpcklwd_m2r(*(dataptr+6), mm7); /* m31:m21|m30:m20 - interleave third and fourth lines */
- movq_r2r(mm0, mm1); /* copy first intermediate result */
+ punpcklwd_m2r (*(dataptr + 6), mm7); /* m31:m21|m30:m20 - interleave third and fourth lines */
+ movq_r2r (mm0, mm1); /* copy first intermediate result */
- movq_m2r(*(dataptr+2), mm6); /* m13:m12|m11:m10 - second line */
- punpckldq_r2r(mm7, mm0); /* m30:m20|m10:m00 - interleave to produce result 1 */
+ movq_m2r (*(dataptr + 2), mm6); /* m13:m12|m11:m10 - second line */
+ punpckldq_r2r (mm7, mm0); /* m30:m20|m10:m00 - interleave to produce result 1 */
- movq_m2r(*(dataptr+6), mm5); /* m33:m32|m31:m30 - fourth line */
- punpckhdq_r2r(mm7, mm1); /* m31:m21|m11:m01 - interleave to produce result 2 */
+ movq_m2r (*(dataptr + 6), mm5); /* m33:m32|m31:m30 - fourth line */
+ punpckhdq_r2r (mm7, mm1); /* m31:m21|m11:m01 - interleave to produce result 2 */
- movq_r2r(mm0, mm7); /* write result 1 */
- punpckhwd_r2r(mm6, mm2); /* m13:m03|m12:m02 - interleave first and second lines */
+ movq_r2r (mm0, mm7); /* write result 1 */
+ punpckhwd_r2r (mm6, mm2); /* m13:m03|m12:m02 - interleave first and second lines */
- psubw_m2r(*(dataptr+14), mm7); /* tmp07=x0-x7: Stage 1 */
- movq_r2r(mm1, mm6); /* write result 2 */
+ psubw_m2r (*(dataptr + 14), mm7); /* tmp07=x0-x7: Stage 1 */
+ movq_r2r (mm1, mm6); /* write result 2 */
- paddw_m2r(*(dataptr+14), mm0); /* tmp00=x0+x7: Stage 1 */
- punpckhwd_r2r(mm5, mm4); /* m33:m23|m32:m22 - interleave third and fourth lines */
+ paddw_m2r (*(dataptr + 14), mm0); /* tmp00=x0+x7: Stage 1 */
+ punpckhwd_r2r (mm5, mm4); /* m33:m23|m32:m22 - interleave third and fourth lines */
- paddw_m2r(*(dataptr+12), mm1); /* tmp01=x1+x6: Stage 1 */
- movq_r2r(mm2, mm3); /* copy first intermediate result */
+ paddw_m2r (*(dataptr + 12), mm1); /* tmp01=x1+x6: Stage 1 */
+ movq_r2r (mm2, mm3); /* copy first intermediate result */
- psubw_m2r(*(dataptr+12), mm6); /* tmp06=x1-x6: Stage 1 */
- punpckldq_r2r(mm4, mm2); /* m32:m22|m12:m02 - interleave to produce result 3 */
+ psubw_m2r (*(dataptr + 12), mm6); /* tmp06=x1-x6: Stage 1 */
+ punpckldq_r2r (mm4, mm2); /* m32:m22|m12:m02 - interleave to produce result 3 */
- movq_r2m(mm7, tmp7); /* save tmp07 */
- movq_r2r(mm2, mm5); /* write result 3 */
+ movq_r2m (mm7, tmp7); /* save tmp07 */
+ movq_r2r (mm2, mm5); /* write result 3 */
- movq_r2m(mm6, tmp6); /* save tmp06 */
+ movq_r2m (mm6, tmp6); /* save tmp06 */
- punpckhdq_r2r(mm4, mm3); /* m33:m23|m13:m03 - interleave to produce result 4 */
+ punpckhdq_r2r (mm4, mm3); /* m33:m23|m13:m03 - interleave to produce result 4 */
- paddw_m2r(*(dataptr+10), mm2); /* tmp02=x2+x5: stage 1 */
- movq_r2r(mm3, mm4); /* write result 4 */
+ paddw_m2r (*(dataptr + 10), mm2); /* tmp02=x2+x5: stage 1 */
+ movq_r2r (mm3, mm4); /* write result 4 */
/************************************************************************************************
End of Transpose 2
************************************************************************************************/
- paddw_m2r(*(dataptr+8), mm3); /* tmp03=x3+x4: stage 1 */
- movq_r2r(mm0, mm7);
+ paddw_m2r (*(dataptr + 8), mm3); /* tmp03=x3+x4: stage 1 */
+ movq_r2r (mm0, mm7);
- psubw_m2r(*(dataptr+8), mm4); /* tmp04=x3-x4: stage 1 */
- movq_r2r(mm1, mm6);
+ psubw_m2r (*(dataptr + 8), mm4); /* tmp04=x3-x4: stage 1 */
+ movq_r2r (mm1, mm6);
- paddw_r2r(mm3, mm0); /* tmp10 = tmp00 + tmp03: even 2 */
- psubw_r2r(mm3, mm7); /* tmp13 = tmp00 - tmp03: even 2 */
+ paddw_r2r (mm3, mm0); /* tmp10 = tmp00 + tmp03: even 2 */
+ psubw_r2r (mm3, mm7); /* tmp13 = tmp00 - tmp03: even 2 */
- psubw_r2r(mm2, mm6); /* tmp12 = tmp01 - tmp02: even 2 */
- paddw_r2r(mm2, mm1); /* tmp11 = tmp01 + tmp02: even 2 */
+ psubw_r2r (mm2, mm6); /* tmp12 = tmp01 - tmp02: even 2 */
+ paddw_r2r (mm2, mm1); /* tmp11 = tmp01 + tmp02: even 2 */
- psubw_m2r(*(dataptr+10), mm5); /* tmp05=x2-x5: stage 1 */
- paddw_r2r(mm7, mm6); /* tmp12 + tmp13 */
+ psubw_m2r (*(dataptr + 10), mm5); /* tmp05=x2-x5: stage 1 */
+ paddw_r2r (mm7, mm6); /* tmp12 + tmp13 */
- /* stage 3 */
+ /* stage 3 */
- movq_m2r(tmp6, mm2);
- movq_r2r(mm0, mm3);
+ movq_m2r (tmp6, mm2);
+ movq_r2r (mm0, mm3);
- psllw_i2r(2, mm6); /* m8 * 2^2 */
- paddw_r2r(mm1, mm0);
+ psllw_i2r (2, mm6); /* m8 * 2^2 */
+ paddw_r2r (mm1, mm0);
- pmulhw_m2r(RTjpeg_C4, mm6); /* z1 */
- psubw_r2r(mm1, mm3);
+ pmulhw_m2r (RTjpeg_C4, mm6); /* z1 */
+ psubw_r2r (mm1, mm3);
- movq_r2m(mm0, *dataptr);
- movq_r2r(mm7, mm0);
-
- /* Odd part */
- movq_r2m(mm3, *(dataptr+8));
- paddw_r2r(mm5, mm4); /* tmp10 */
+ movq_r2m (mm0, *dataptr);
+ movq_r2r (mm7, mm0);
- movq_m2r(tmp7, mm3);
- paddw_r2r(mm6, mm0); /* tmp32 */
+ /* Odd part */
+ movq_r2m (mm3, *(dataptr + 8));
+ paddw_r2r (mm5, mm4); /* tmp10 */
- paddw_r2r(mm2, mm5); /* tmp11 */
- psubw_r2r(mm6, mm7); /* tmp33 */
+ movq_m2r (tmp7, mm3);
+ paddw_r2r (mm6, mm0); /* tmp32 */
- movq_r2m(mm0, *(dataptr+4));
- paddw_r2r(mm3, mm2); /* tmp12 */
+ paddw_r2r (mm2, mm5); /* tmp11 */
+ psubw_r2r (mm6, mm7); /* tmp33 */
- /* stage 4 */
- movq_r2m(mm7, *(dataptr+12));
- movq_r2r(mm4, mm1); /* copy of tmp10 */
+ movq_r2m (mm0, *(dataptr + 4));
+ paddw_r2r (mm3, mm2); /* tmp12 */
- psubw_r2r(mm2, mm1); /* tmp10 - tmp12 */
- psllw_i2r(2, mm4); /* m8 * 2^2 */
+ /* stage 4 */
+ movq_r2m (mm7, *(dataptr + 12));
+ movq_r2r (mm4, mm1); /* copy of tmp10 */
- movq_m2r(RTjpeg_C2mC6, mm0);
- psllw_i2r(2, mm1);
+ psubw_r2r (mm2, mm1); /* tmp10 - tmp12 */
+ psllw_i2r (2, mm4); /* m8 * 2^2 */
- pmulhw_m2r(RTjpeg_C6, mm1); /* z5 */
- psllw_i2r(2, mm2);
+ movq_m2r (RTjpeg_C2mC6, mm0);
+ psllw_i2r (2, mm1);
- pmulhw_r2r(mm0, mm4); /* z5 */
+ pmulhw_m2r (RTjpeg_C6, mm1); /* z5 */
+ psllw_i2r (2, mm2);
- /* stage 5 */
+ pmulhw_r2r (mm0, mm4); /* z5 */
- pmulhw_m2r(RTjpeg_C2pC6, mm2);
- psllw_i2r(2, mm5);
+ /* stage 5 */
- pmulhw_m2r(RTjpeg_C4, mm5); /* z3 */
- movq_r2r(mm3, mm0); /* copy tmp7 */
+ pmulhw_m2r (RTjpeg_C2pC6, mm2);
+ psllw_i2r (2, mm5);
- movq_m2r(*(dataptr+1), mm7);
- paddw_r2r(mm1, mm4); /* z2 */
+ pmulhw_m2r (RTjpeg_C4, mm5); /* z3 */
+ movq_r2r (mm3, mm0); /* copy tmp7 */
- paddw_r2r(mm1, mm2); /* z4 */
+ movq_m2r (*(dataptr + 1), mm7);
+ paddw_r2r (mm1, mm4); /* z2 */
- paddw_r2r(mm5, mm0); /* z11 */
- psubw_r2r(mm5, mm3); /* z13 */
+ paddw_r2r (mm1, mm2); /* z4 */
- /* stage 6 */
+ paddw_r2r (mm5, mm0); /* z11 */
+ psubw_r2r (mm5, mm3); /* z13 */
- movq_r2r(mm3, mm5); /* copy z13 */
- psubw_r2r(mm4, mm3); /* y3=z13 - z2 */
+ /* stage 6 */
- paddw_r2r(mm4, mm5); /* y5=z13 + z2 */
- movq_r2r(mm0, mm6); /* copy z11 */
+ movq_r2r (mm3, mm5); /* copy z13 */
+ psubw_r2r (mm4, mm3); /* y3=z13 - z2 */
- movq_r2m(mm3, *(dataptr+6)); /*save y3 */
- psubw_r2r(mm2, mm0); /* y7=z11 - z4 */
+ paddw_r2r (mm4, mm5); /* y5=z13 + z2 */
+ movq_r2r (mm0, mm6); /* copy z11 */
- movq_r2m(mm5, *(dataptr+10)); /*save y5 */
- paddw_r2r(mm2, mm6); /* y1=z11 + z4 */
+ movq_r2m (mm3, *(dataptr + 6)); /*save y3 */
+ psubw_r2r (mm2, mm0); /* y7=z11 - z4 */
- movq_r2m(mm0, *(dataptr+14)); /*save y7 */
+ movq_r2m (mm5, *(dataptr + 10)); /*save y5 */
+ paddw_r2r (mm2, mm6); /* y1=z11 + z4 */
+
+ movq_r2m (mm0, *(dataptr + 14)); /*save y7 */
/************************************************
* End of 1st 4 rows
************************************************/
- movq_m2r(*(dataptr+3), mm1); /* load x1 : stage 1 */
- movq_r2r(mm7, mm0); /* copy x0 */
+ movq_m2r (*(dataptr + 3), mm1); /* load x1 : stage 1 */
+ movq_r2r (mm7, mm0); /* copy x0 */
+
+ movq_r2m (mm6, *(dataptr + 2)); /*save y1 */
- movq_r2m(mm6, *(dataptr+2)); /*save y1 */
+ movq_m2r (*(dataptr + 5), mm2); /* load x2 : stage 1 */
+ movq_r2r (mm1, mm6); /* copy x1 */
- movq_m2r(*(dataptr+5), mm2); /* load x2 : stage 1 */
- movq_r2r(mm1, mm6); /* copy x1 */
+ paddw_m2r (*(dataptr + 15), mm0); /* tmp00 = x0 + x7 */
- paddw_m2r(*(dataptr+15), mm0); /* tmp00 = x0 + x7 */
+ movq_m2r (*(dataptr + 7), mm3); /* load x3 : stage 1 */
+ movq_r2r (mm2, mm5); /* copy x2 */
- movq_m2r(*(dataptr+7), mm3); /* load x3 : stage 1 */
- movq_r2r(mm2, mm5); /* copy x2 */
+ psubw_m2r (*(dataptr + 15), mm7); /* tmp07 = x0 - x7 */
+ movq_r2r (mm3, mm4); /* copy x3 */
- psubw_m2r(*(dataptr+15), mm7); /* tmp07 = x0 - x7 */
- movq_r2r(mm3, mm4); /* copy x3 */
+ paddw_m2r (*(dataptr + 13), mm1); /* tmp01 = x1 + x6 */
- paddw_m2r(*(dataptr+13), mm1); /* tmp01 = x1 + x6 */
+ movq_r2m (mm7, tmp7); /* save tmp07 */
+ movq_r2r (mm0, mm7); /* copy tmp00 */
- movq_r2m(mm7, tmp7); /* save tmp07 */
- movq_r2r(mm0, mm7); /* copy tmp00 */
+ psubw_m2r (*(dataptr + 13), mm6); /* tmp06 = x1 - x6 */
- psubw_m2r(*(dataptr+13), mm6); /* tmp06 = x1 - x6 */
+ /* stage 2, Even Part */
- /* stage 2, Even Part */
+ paddw_m2r (*(dataptr + 9), mm3); /* tmp03 = x3 + x4 */
- paddw_m2r(*(dataptr+9), mm3); /* tmp03 = x3 + x4 */
+ movq_r2m (mm6, tmp6); /* save tmp07 */
+ movq_r2r (mm1, mm6); /* copy tmp01 */
- movq_r2m(mm6, tmp6); /* save tmp07 */
- movq_r2r(mm1, mm6); /* copy tmp01 */
+ paddw_m2r (*(dataptr + 11), mm2); /* tmp02 = x2 + x5 */
+ paddw_r2r (mm3, mm0); /* tmp10 = tmp00 + tmp03 */
- paddw_m2r(*(dataptr+11), mm2); /* tmp02 = x2 + x5 */
- paddw_r2r(mm3, mm0); /* tmp10 = tmp00 + tmp03 */
+ psubw_r2r (mm3, mm7); /* tmp13 = tmp00 - tmp03 */
- psubw_r2r(mm3, mm7); /* tmp13 = tmp00 - tmp03 */
+ psubw_m2r (*(dataptr + 9), mm4); /* tmp04 = x3 - x4 */
+ psubw_r2r (mm2, mm6); /* tmp12 = tmp01 - tmp02 */
- psubw_m2r(*(dataptr+9), mm4); /* tmp04 = x3 - x4 */
- psubw_r2r(mm2, mm6); /* tmp12 = tmp01 - tmp02 */
+ paddw_r2r (mm2, mm1); /* tmp11 = tmp01 + tmp02 */
- paddw_r2r(mm2, mm1); /* tmp11 = tmp01 + tmp02 */
+ psubw_m2r (*(dataptr + 11), mm5); /* tmp05 = x2 - x5 */
+ paddw_r2r (mm7, mm6); /* tmp12 + tmp13 */
- psubw_m2r(*(dataptr+11), mm5); /* tmp05 = x2 - x5 */
- paddw_r2r(mm7, mm6); /* tmp12 + tmp13 */
+ /* stage 3, Even and stage 4 & 5 even */
- /* stage 3, Even and stage 4 & 5 even */
+ movq_m2r (tmp6, mm2); /* load tmp6 */
+ movq_r2r (mm0, mm3); /* copy tmp10 */
- movq_m2r(tmp6, mm2); /* load tmp6 */
- movq_r2r(mm0, mm3); /* copy tmp10 */
+ psllw_i2r (2, mm6); /* shift z1 */
+ paddw_r2r (mm1, mm0); /* y0=tmp10 + tmp11 */
- psllw_i2r(2, mm6); /* shift z1 */
- paddw_r2r(mm1, mm0); /* y0=tmp10 + tmp11 */
+ pmulhw_m2r (RTjpeg_C4, mm6); /* z1 */
+ psubw_r2r (mm1, mm3); /* y4=tmp10 - tmp11 */
- pmulhw_m2r(RTjpeg_C4, mm6); /* z1 */
- psubw_r2r(mm1, mm3); /* y4=tmp10 - tmp11 */
+ movq_r2m (mm0, *(dataptr + 1)); /*save y0 */
+ movq_r2r (mm7, mm0); /* copy tmp13 */
- movq_r2m(mm0, *(dataptr+1)); /*save y0 */
- movq_r2r(mm7, mm0); /* copy tmp13 */
-
- /* odd part */
+ /* odd part */
- movq_r2m(mm3, *(dataptr+9)); /*save y4 */
- paddw_r2r(mm5, mm4); /* tmp10 = tmp4 + tmp5 */
+ movq_r2m (mm3, *(dataptr + 9)); /*save y4 */
+ paddw_r2r (mm5, mm4); /* tmp10 = tmp4 + tmp5 */
- movq_m2r(tmp7, mm3); /* load tmp7 */
- paddw_r2r(mm6, mm0); /* tmp32 = tmp13 + z1 */
+ movq_m2r (tmp7, mm3); /* load tmp7 */
+ paddw_r2r (mm6, mm0); /* tmp32 = tmp13 + z1 */
- paddw_r2r(mm2, mm5); /* tmp11 = tmp5 + tmp6 */
- psubw_r2r(mm6, mm7); /* tmp33 = tmp13 - z1 */
+ paddw_r2r (mm2, mm5); /* tmp11 = tmp5 + tmp6 */
+ psubw_r2r (mm6, mm7); /* tmp33 = tmp13 - z1 */
- movq_r2m(mm0, *(dataptr+5)); /*save y2 */
- paddw_r2r(mm3, mm2); /* tmp12 = tmp6 + tmp7 */
+ movq_r2m (mm0, *(dataptr + 5)); /*save y2 */
+ paddw_r2r (mm3, mm2); /* tmp12 = tmp6 + tmp7 */
- /* stage 4 */
+ /* stage 4 */
- movq_r2m(mm7, *(dataptr+13)); /*save y6 */
- movq_r2r(mm4, mm1); /* copy tmp10 */
+ movq_r2m (mm7, *(dataptr + 13)); /*save y6 */
+ movq_r2r (mm4, mm1); /* copy tmp10 */
- psubw_r2r(mm2, mm1); /* tmp10 - tmp12 */
- psllw_i2r(2, mm4); /* shift tmp10 */
+ psubw_r2r (mm2, mm1); /* tmp10 - tmp12 */
+ psllw_i2r (2, mm4); /* shift tmp10 */
- movq_m2r(RTjpeg_C2mC6, mm0); /* load C2mC6 */
- psllw_i2r(2, mm1); /* shift (tmp10-tmp12) */
+ movq_m2r (RTjpeg_C2mC6, mm0); /* load C2mC6 */
+ psllw_i2r (2, mm1); /* shift (tmp10-tmp12) */
- pmulhw_m2r(RTjpeg_C6, mm1); /* z5 */
- psllw_i2r(2, mm5); /* prepare for multiply */
+ pmulhw_m2r (RTjpeg_C6, mm1); /* z5 */
+ psllw_i2r (2, mm5); /* prepare for multiply */
- pmulhw_r2r(mm0, mm4); /* multiply by converted real */
+ pmulhw_r2r (mm0, mm4); /* multiply by converted real */
- /* stage 5 */
+ /* stage 5 */
- pmulhw_m2r(RTjpeg_C4, mm5); /* z3 */
- psllw_i2r(2, mm2); /* prepare for multiply */
+ pmulhw_m2r (RTjpeg_C4, mm5); /* z3 */
+ psllw_i2r (2, mm2); /* prepare for multiply */
- pmulhw_m2r(RTjpeg_C2pC6, mm2); /* multiply */
- movq_r2r(mm3, mm0); /* copy tmp7 */
+ pmulhw_m2r (RTjpeg_C2pC6, mm2); /* multiply */
+ movq_r2r (mm3, mm0); /* copy tmp7 */
- movq_m2r(*(dataptr+9), mm7); /* m03:m02|m01:m00 - first line (line 4)and copy into mm7 */
- paddw_r2r(mm1, mm4); /* z2 */
+ movq_m2r (*(dataptr + 9), mm7); /* m03:m02|m01:m00 - first line (line 4)and copy into mm7 */
+ paddw_r2r (mm1, mm4); /* z2 */
- paddw_r2r(mm5, mm0); /* z11 */
- psubw_r2r(mm5, mm3); /* z13 */
+ paddw_r2r (mm5, mm0); /* z11 */
+ psubw_r2r (mm5, mm3); /* z13 */
- /* stage 6 */
+ /* stage 6 */
- movq_r2r(mm3, mm5); /* copy z13 */
- paddw_r2r(mm1, mm2); /* z4 */
+ movq_r2r (mm3, mm5); /* copy z13 */
+ paddw_r2r (mm1, mm2); /* z4 */
- movq_r2r(mm0, mm6); /* copy z11 */
- psubw_r2r(mm4, mm5); /* y3 */
+ movq_r2r (mm0, mm6); /* copy z11 */
+ psubw_r2r (mm4, mm5); /* y3 */
- paddw_r2r(mm2, mm6); /* y1 */
- paddw_r2r(mm4, mm3); /* y5 */
+ paddw_r2r (mm2, mm6); /* y1 */
+ paddw_r2r (mm4, mm3); /* y5 */
- movq_r2m(mm5, *(dataptr+7)); /*save y3 */
- psubw_r2r(mm2, mm0); /* yè=z11 - z4 */
+ movq_r2m (mm5, *(dataptr + 7)); /*save y3 */
+ psubw_r2r (mm2, mm0); /* yè=z11 - z4 */
- movq_r2m(mm3, *(dataptr+11)); /*save y5 */
+ movq_r2m (mm3, *(dataptr + 11)); /*save y5 */
- movq_r2m(mm6, *(dataptr+3)); /*save y1 */
+ movq_r2m (mm6, *(dataptr + 3)); /*save y1 */
+
+ movq_r2m (mm0, *(dataptr + 15)); /*save y7 */
- movq_r2m(mm0, *(dataptr+15)); /*save y7 */
-
#endif
}
-#define FIX_1_082392200 ((__s32) 277) /* FIX(1.082392200) */
-#define FIX_1_414213562 ((__s32) 362) /* FIX(1.414213562) */
-#define FIX_1_847759065 ((__s32) 473) /* FIX(1.847759065) */
-#define FIX_2_613125930 ((__s32) 669) /* FIX(2.613125930) */
+#define FIX_1_082392200 ((__s32) 277) /* FIX(1.082392200) */
+#define FIX_1_414213562 ((__s32) 362) /* FIX(1.414213562) */
+#define FIX_1_847759065 ((__s32) 473) /* FIX(1.847759065) */
+#define FIX_2_613125930 ((__s32) 669) /* FIX(2.613125930) */
#define DESCALE(x) (__s16)( ((x)+4) >> 3)
@@ -1226,284 +1232,283 @@ void RTjpeg_dctY(__u8 *idata, __s16 *odata, int rskip)
#define RL(x) ((x)>235) ? 235 : (((x)<16) ? 16 : (x))
#define MULTIPLY(var,const) (((__s32) ((var) * (const)) + 128)>>8)
-void RTjpeg_idct_init(void)
+void
+RTjpeg_idct_init (void)
{
- int i;
-
- for(i=0; i<64; i++)
- {
- RTjpeg_liqt[i]=((__u64)RTjpeg_liqt[i]*RTjpeg_aan_tab[i])>>32;
- RTjpeg_ciqt[i]=((__u64)RTjpeg_ciqt[i]*RTjpeg_aan_tab[i])>>32;
- }
+ int i;
+
+ for (i = 0; i < 64; i++) {
+ RTjpeg_liqt[i] = ((__u64) RTjpeg_liqt[i] * RTjpeg_aan_tab[i]) >> 32;
+ RTjpeg_ciqt[i] = ((__u64) RTjpeg_ciqt[i] * RTjpeg_aan_tab[i]) >> 32;
+ }
}
-void RTjpeg_idct(__u8 *odata, __s16 *data, int rskip)
+void
+RTjpeg_idct (__u8 * odata, __s16 * data, int rskip)
{
#ifdef HAVE_LIBMMX
-static mmx_t fix_141 = (mmx_t)(long long)0x5a825a825a825a82LL;
-static mmx_t fix_184n261 = (mmx_t)(long long)0xcf04cf04cf04cf04LL;
-static mmx_t fix_184 = (mmx_t)(long long)0x7641764176417641LL;
-static mmx_t fix_n184 = (mmx_t)(long long)0x896f896f896f896fLL;
-static mmx_t fix_108n184 = (mmx_t)(long long)0xcf04cf04cf04cf04LL;
+ static mmx_t fix_141 = (mmx_t) (long long) 0x5a825a825a825a82LL;
+ static mmx_t fix_184n261 = (mmx_t) (long long) 0xcf04cf04cf04cf04LL;
+ static mmx_t fix_184 = (mmx_t) (long long) 0x7641764176417641LL;
+ static mmx_t fix_n184 = (mmx_t) (long long) 0x896f896f896f896fLL;
+ static mmx_t fix_108n184 = (mmx_t) (long long) 0xcf04cf04cf04cf04LL;
mmx_t workspace[64];
mmx_t *wsptr = workspace;
- register mmx_t *dataptr = (mmx_t *)odata;
- mmx_t *idata = (mmx_t *)data;
+ register mmx_t *dataptr = (mmx_t *) odata;
+ mmx_t *idata = (mmx_t *) data;
- rskip = rskip>>3;
+ rskip = rskip >> 3;
/*
* Perform inverse DCT on one block of coefficients.
*/
- /* Odd part */
+ /* Odd part */
+
+ movq_m2r (*(idata + 10), mm1); /* load idata[DCTSIZE*5] */
- movq_m2r(*(idata+10), mm1); /* load idata[DCTSIZE*5] */
+ movq_m2r (*(idata + 6), mm0); /* load idata[DCTSIZE*3] */
- movq_m2r(*(idata+6), mm0); /* load idata[DCTSIZE*3] */
+ movq_m2r (*(idata + 2), mm3); /* load idata[DCTSIZE*1] */
- movq_m2r(*(idata+2), mm3); /* load idata[DCTSIZE*1] */
+ movq_r2r (mm1, mm2); /* copy tmp6 : phase 6 */
+ */movq_m2r (*(idata + 14), mm4); /* load idata[DCTSIZE*7] */
- movq_r2r(mm1, mm2); /* copy tmp6 : phase 6 */ */
+ paddw_r2r (mm0, mm1); /* z13 = tmp6 + tmp5; */
- movq_m2r(*(idata+14), mm4); /* load idata[DCTSIZE*7] */
+ psubw_r2r (mm0, mm2); /* z10 = tmp6 - tmp5 */
- paddw_r2r(mm0, mm1); /* z13 = tmp6 + tmp5; */
+ psllw_i2r (2, mm2); /* shift z10 */
+ movq_r2r (mm2, mm0); /* copy z10 */
- psubw_r2r(mm0, mm2); /* z10 = tmp6 - tmp5 */
+ pmulhw_m2r (fix_184n261, mm2); /* MULTIPLY( z12, FIX_1_847759065); : 2*c2 */
+ movq_r2r (mm3, mm5); /* copy tmp4 */
- psllw_i2r(2, mm2); /* shift z10 */
- movq_r2r(mm2, mm0); /* copy z10 */
+ pmulhw_m2r (fix_n184, mm0); /* MULTIPLY(z10, -FIX_1_847759065); : 2*c2 */
+ paddw_r2r (mm4, mm3); /* z11 = tmp4 + tmp7; */
- pmulhw_m2r(fix_184n261, mm2); /* MULTIPLY( z12, FIX_1_847759065); : 2*c2 */
- movq_r2r(mm3, mm5); /* copy tmp4 */
+ movq_r2r (mm3, mm6); /* copy z11 : phase 5 */
+ psubw_r2r (mm4, mm5); /* z12 = tmp4 - tmp7; */
- pmulhw_m2r(fix_n184, mm0); /* MULTIPLY(z10, -FIX_1_847759065); : 2*c2 */
- paddw_r2r(mm4, mm3); /* z11 = tmp4 + tmp7; */
+ psubw_r2r (mm1, mm6); /* z11-z13 */
+ psllw_i2r (2, mm5); /* shift z12 */
- movq_r2r(mm3, mm6); /* copy z11 : phase 5 */
- psubw_r2r(mm4, mm5); /* z12 = tmp4 - tmp7; */
+ movq_m2r (*(idata + 12), mm4); /* load idata[DCTSIZE*6], even part */
+ movq_r2r (mm5, mm7); /* copy z12 */
- psubw_r2r(mm1, mm6); /* z11-z13 */
- psllw_i2r(2, mm5); /* shift z12 */
+ pmulhw_m2r (fix_108n184, mm5); /* MULT(z12, (FIX_1_08-FIX_1_84)) //- z5; 2*(c2-c6): even part */
+ paddw_r2r (mm1, mm3); /* tmp7 = z11 + z13; */
- movq_m2r(*(idata+12), mm4); /* load idata[DCTSIZE*6], even part */
- movq_r2r(mm5, mm7); /* copy z12 */
+ /*ok */
- pmulhw_m2r(fix_108n184, mm5); /* MULT(z12, (FIX_1_08-FIX_1_84)) //- z5; 2*(c2-c6): even part */
- paddw_r2r(mm1, mm3); /* tmp7 = z11 + z13; */
+ /* Even part */
+ pmulhw_m2r (fix_184, mm7); /* MULTIPLY(z10,(FIX_1_847759065 - FIX_2_613125930)) //+ z5; -2*(c2+c6) */
+ psllw_i2r (2, mm6);
- /*ok */
+ movq_m2r (*(idata + 4), mm1); /* load idata[DCTSIZE*2] */
- /* Even part */
- pmulhw_m2r(fix_184, mm7); /* MULTIPLY(z10,(FIX_1_847759065 - FIX_2_613125930)) //+ z5; -2*(c2+c6) */
- psllw_i2r(2, mm6);
+ paddw_r2r (mm5, mm0); /* tmp10 */
- movq_m2r(*(idata+4), mm1); /* load idata[DCTSIZE*2] */
+ paddw_r2r (mm7, mm2); /* tmp12 */
- paddw_r2r(mm5, mm0); /* tmp10 */
+ pmulhw_m2r (fix_141, mm6); /* tmp11 = MULTIPLY(z11 - z13, FIX_1_414213562); 2*c4 */
+ psubw_r2r (mm3, mm2); /* tmp6 = tmp12 - tmp7 */
- paddw_r2r(mm7, mm2); /* tmp12 */
+ movq_r2r (mm1, mm5); /* copy tmp1 */
+ paddw_r2r (mm4, mm1); /* tmp13= tmp1 + tmp3; phases 5-3 */
- pmulhw_m2r(fix_141, mm6); /* tmp11 = MULTIPLY(z11 - z13, FIX_1_414213562); 2*c4 */
- psubw_r2r(mm3, mm2); /* tmp6 = tmp12 - tmp7 */
+ psubw_r2r (mm4, mm5); /* tmp1-tmp3 */
+ psubw_r2r (mm2, mm6); /* tmp5 = tmp11 - tmp6; */
- movq_r2r(mm1, mm5); /* copy tmp1 */
- paddw_r2r(mm4, mm1); /* tmp13= tmp1 + tmp3; phases 5-3 */
+ movq_r2m (mm1, *(wsptr)); /* save tmp13 in workspace */
+ psllw_i2r (2, mm5); /* shift tmp1-tmp3 */
- psubw_r2r(mm4, mm5); /* tmp1-tmp3 */
- psubw_r2r(mm2, mm6); /* tmp5 = tmp11 - tmp6; */
+ movq_m2r (*(idata), mm7); /* load idata[DCTSIZE*0] */
- movq_r2m(mm1, *(wsptr)); /* save tmp13 in workspace */
- psllw_i2r(2, mm5); /* shift tmp1-tmp3 */
-
- movq_m2r(*(idata), mm7); /* load idata[DCTSIZE*0] */
+ pmulhw_m2r (fix_141, mm5); /* MULTIPLY(tmp1 - tmp3, FIX_1_414213562) */
+ paddw_r2r (mm6, mm0); /* tmp4 = tmp10 + tmp5; */
- pmulhw_m2r(fix_141, mm5); /* MULTIPLY(tmp1 - tmp3, FIX_1_414213562) */
- paddw_r2r(mm6, mm0); /* tmp4 = tmp10 + tmp5; */
+ movq_m2r (*(idata + 8), mm4); /* load idata[DCTSIZE*4] */
- movq_m2r(*(idata+8), mm4); /* load idata[DCTSIZE*4] */
-
- psubw_r2r(mm1, mm5); /* tmp12 = MULTIPLY(tmp1 - tmp3, FIX_1_414213562) - tmp13; 2*c4 */
+ psubw_r2r (mm1, mm5); /* tmp12 = MULTIPLY(tmp1 - tmp3, FIX_1_414213562) - tmp13; 2*c4 */
- movq_r2m(mm0, *(wsptr+4)); /* save tmp4 in workspace */
- movq_r2r(mm7, mm1); /* copy tmp0 : phase 3 */
+ movq_r2m (mm0, *(wsptr + 4)); /* save tmp4 in workspace */
+ movq_r2r (mm7, mm1); /* copy tmp0 : phase 3 */
- movq_r2m(mm5, *(wsptr+2)); /* save tmp12 in workspace */
- psubw_r2r(mm4, mm1); /* tmp11 = tmp0 - tmp2; */
+ movq_r2m (mm5, *(wsptr + 2)); /* save tmp12 in workspace */
+ psubw_r2r (mm4, mm1); /* tmp11 = tmp0 - tmp2; */
- paddw_r2r(mm4, mm7); /* tmp10 = tmp0 + tmp2; */
- movq_r2r(mm1, mm5); /* copy tmp11 */
-
- paddw_m2r(*(wsptr+2), mm1); /* tmp1 = tmp11 + tmp12; */
- movq_r2r(mm7, mm4); /* copy tmp10 : phase 2 */
+ paddw_r2r (mm4, mm7); /* tmp10 = tmp0 + tmp2; */
+ movq_r2r (mm1, mm5); /* copy tmp11 */
- paddw_m2r(*(wsptr), mm7); /* tmp0 = tmp10 + tmp13; */
+ paddw_m2r (*(wsptr + 2), mm1); /* tmp1 = tmp11 + tmp12; */
+ movq_r2r (mm7, mm4); /* copy tmp10 : phase 2 */
- psubw_m2r(*(wsptr), mm4); /* tmp3 = tmp10 - tmp13; */
- movq_r2r(mm7, mm0); /* copy tmp0 */
+ paddw_m2r (*(wsptr), mm7); /* tmp0 = tmp10 + tmp13; */
- psubw_m2r(*(wsptr+2), mm5); /* tmp2 = tmp11 - tmp12; */
- paddw_r2r(mm3, mm7); /* wsptr[DCTSIZE*0] = (int) (tmp0 + tmp7); */
-
- psubw_r2r(mm3, mm0); /* wsptr[DCTSIZE*7] = (int) (tmp0 - tmp7); */
+ psubw_m2r (*(wsptr), mm4); /* tmp3 = tmp10 - tmp13; */
+ movq_r2r (mm7, mm0); /* copy tmp0 */
- movq_r2m(mm7, *(wsptr)); /* wsptr[DCTSIZE*0] */
- movq_r2r(mm1, mm3); /* copy tmp1 */
+ psubw_m2r (*(wsptr + 2), mm5); /* tmp2 = tmp11 - tmp12; */
+ paddw_r2r (mm3, mm7); /* wsptr[DCTSIZE*0] = (int) (tmp0 + tmp7); */
- movq_r2m(mm0, *(wsptr+14)); /* wsptr[DCTSIZE*7] */
- paddw_r2r(mm2, mm1); /* wsptr[DCTSIZE*1] = (int) (tmp1 + tmp6); */
+ psubw_r2r (mm3, mm0); /* wsptr[DCTSIZE*7] = (int) (tmp0 - tmp7); */
- psubw_r2r(mm2, mm3); /* wsptr[DCTSIZE*6] = (int) (tmp1 - tmp6); */
+ movq_r2m (mm7, *(wsptr)); /* wsptr[DCTSIZE*0] */
+ movq_r2r (mm1, mm3); /* copy tmp1 */
- movq_r2m(mm1, *(wsptr+2)); /* wsptr[DCTSIZE*1] */
- movq_r2r(mm4, mm1); /* copy tmp3 */
+ movq_r2m (mm0, *(wsptr + 14)); /* wsptr[DCTSIZE*7] */
+ paddw_r2r (mm2, mm1); /* wsptr[DCTSIZE*1] = (int) (tmp1 + tmp6); */
- movq_r2m(mm3, *(wsptr+12)); /* wsptr[DCTSIZE*6] */
+ psubw_r2r (mm2, mm3); /* wsptr[DCTSIZE*6] = (int) (tmp1 - tmp6); */
- paddw_m2r(*(wsptr+4), mm4); /* wsptr[DCTSIZE*4] = (int) (tmp3 + tmp4); */
+ movq_r2m (mm1, *(wsptr + 2)); /* wsptr[DCTSIZE*1] */
+ movq_r2r (mm4, mm1); /* copy tmp3 */
- psubw_m2r(*(wsptr+4), mm1); /* wsptr[DCTSIZE*3] = (int) (tmp3 - tmp4); */
+ movq_r2m (mm3, *(wsptr + 12)); /* wsptr[DCTSIZE*6] */
- movq_r2m(mm4, *(wsptr+8));
- movq_r2r(mm5, mm7); /* copy tmp2 */
+ paddw_m2r (*(wsptr + 4), mm4); /* wsptr[DCTSIZE*4] = (int) (tmp3 + tmp4); */
- paddw_r2r(mm6, mm5); /* wsptr[DCTSIZE*2] = (int) (tmp2 + tmp5) */
+ psubw_m2r (*(wsptr + 4), mm1); /* wsptr[DCTSIZE*3] = (int) (tmp3 - tmp4); */
- movq_r2m(mm1, *(wsptr+6));
- psubw_r2r(mm6, mm7); /* wsptr[DCTSIZE*5] = (int) (tmp2 - tmp5); */
+ movq_r2m (mm4, *(wsptr + 8));
+ movq_r2r (mm5, mm7); /* copy tmp2 */
- movq_r2m(mm5, *(wsptr+4));
+ paddw_r2r (mm6, mm5); /* wsptr[DCTSIZE*2] = (int) (tmp2 + tmp5) */
- movq_r2m(mm7, *(wsptr+10));
+ movq_r2m (mm1, *(wsptr + 6));
+ psubw_r2r (mm6, mm7); /* wsptr[DCTSIZE*5] = (int) (tmp2 - tmp5); */
- /*ok */
+ movq_r2m (mm5, *(wsptr + 4));
+
+ movq_r2m (mm7, *(wsptr + 10));
+
+ /*ok */
/*****************************************************************/
- idata++;
- wsptr++;
+ idata++;
+ wsptr++;
/*****************************************************************/
- movq_m2r(*(idata+10), mm1); /* load idata[DCTSIZE*5] */
+ movq_m2r (*(idata + 10), mm1); /* load idata[DCTSIZE*5] */
+
+ movq_m2r (*(idata + 6), mm0); /* load idata[DCTSIZE*3] */
+
+ movq_m2r (*(idata + 2), mm3); /* load idata[DCTSIZE*1] */
+ movq_r2r (mm1, mm2); /* copy tmp6 : phase 6 */
+ */movq_m2r (*(idata + 14), mm4); /* load idata[DCTSIZE*7] */
+ paddw_r2r (mm0, mm1); /* z13 = tmp6 + tmp5; */
- movq_m2r(*(idata+6), mm0); /* load idata[DCTSIZE*3] */
+ psubw_r2r (mm0, mm2); /* z10 = tmp6 - tmp5 */
- movq_m2r(*(idata+2), mm3); /* load idata[DCTSIZE*1] */
- movq_r2r(mm1, mm2); /* copy tmp6 : phase 6 */ */
+ psllw_i2r (2, mm2); /* shift z10 */
+ movq_r2r (mm2, mm0); /* copy z10 */
- movq_m2r(*(idata+14), mm4); /* load idata[DCTSIZE*7] */
- paddw_r2r(mm0, mm1); /* z13 = tmp6 + tmp5; */
+ pmulhw_m2r (fix_184n261, mm2); /* MULTIPLY( z12, FIX_1_847759065); : 2*c2 */
+ movq_r2r (mm3, mm5); /* copy tmp4 */
- psubw_r2r(mm0, mm2); /* z10 = tmp6 - tmp5 */
+ pmulhw_m2r (fix_n184, mm0); /* MULTIPLY(z10, -FIX_1_847759065); : 2*c2 */
+ paddw_r2r (mm4, mm3); /* z11 = tmp4 + tmp7; */
- psllw_i2r(2, mm2); /* shift z10 */
- movq_r2r(mm2, mm0); /* copy z10 */
+ movq_r2r (mm3, mm6); /* copy z11 : phase 5 */
+ psubw_r2r (mm4, mm5); /* z12 = tmp4 - tmp7; */
- pmulhw_m2r(fix_184n261, mm2); /* MULTIPLY( z12, FIX_1_847759065); : 2*c2 */
- movq_r2r(mm3, mm5); /* copy tmp4 */
+ psubw_r2r (mm1, mm6); /* z11-z13 */
+ psllw_i2r (2, mm5); /* shift z12 */
- pmulhw_m2r(fix_n184, mm0); /* MULTIPLY(z10, -FIX_1_847759065); : 2*c2 */
- paddw_r2r(mm4, mm3); /* z11 = tmp4 + tmp7; */
+ movq_m2r (*(idata + 12), mm4); /* load idata[DCTSIZE*6], even part */
+ movq_r2r (mm5, mm7); /* copy z12 */
- movq_r2r(mm3, mm6); /* copy z11 : phase 5 */
- psubw_r2r(mm4, mm5); /* z12 = tmp4 - tmp7; */
+ pmulhw_m2r (fix_108n184, mm5); /* MULT(z12, (FIX_1_08-FIX_1_84)) //- z5; 2*(c2-c6) even part */
+ paddw_r2r (mm1, mm3); /* tmp7 = z11 + z13; */
- psubw_r2r(mm1, mm6); /* z11-z13 */
- psllw_i2r(2, mm5); /* shift z12 */
+ /*ok */
- movq_m2r(*(idata+12), mm4); /* load idata[DCTSIZE*6], even part */
- movq_r2r(mm5, mm7); /* copy z12 */
+ /* Even part */
+ pmulhw_m2r (fix_184, mm7); /* MULTIPLY(z10,(FIX_1_847759065 - FIX_2_613125930)) //+ z5; -2*(c2+c6) */
+ psllw_i2r (2, mm6);
- pmulhw_m2r(fix_108n184, mm5); /* MULT(z12, (FIX_1_08-FIX_1_84)) //- z5; 2*(c2-c6) even part */
- paddw_r2r(mm1, mm3); /* tmp7 = z11 + z13; */
+ movq_m2r (*(idata + 4), mm1); /* load idata[DCTSIZE*2] */
- /*ok */
+ paddw_r2r (mm5, mm0); /* tmp10 */
- /* Even part */
- pmulhw_m2r(fix_184, mm7); /* MULTIPLY(z10,(FIX_1_847759065 - FIX_2_613125930)) //+ z5; -2*(c2+c6) */
- psllw_i2r(2, mm6);
+ paddw_r2r (mm7, mm2); /* tmp12 */
- movq_m2r(*(idata+4), mm1); /* load idata[DCTSIZE*2] */
+ pmulhw_m2r (fix_141, mm6); /* tmp11 = MULTIPLY(z11 - z13, FIX_1_414213562); 2*c4 */
+ psubw_r2r (mm3, mm2); /* tmp6 = tmp12 - tmp7 */
- paddw_r2r(mm5, mm0); /* tmp10 */
+ movq_r2r (mm1, mm5); /* copy tmp1 */
+ paddw_r2r (mm4, mm1); /* tmp13= tmp1 + tmp3; phases 5-3 */
- paddw_r2r(mm7, mm2); /* tmp12 */
+ psubw_r2r (mm4, mm5); /* tmp1-tmp3 */
+ psubw_r2r (mm2, mm6); /* tmp5 = tmp11 - tmp6; */
- pmulhw_m2r(fix_141, mm6); /* tmp11 = MULTIPLY(z11 - z13, FIX_1_414213562); 2*c4 */
- psubw_r2r(mm3, mm2); /* tmp6 = tmp12 - tmp7 */
+ movq_r2m (mm1, *(wsptr)); /* save tmp13 in workspace */
+ psllw_i2r (2, mm5); /* shift tmp1-tmp3 */
- movq_r2r(mm1, mm5); /* copy tmp1 */
- paddw_r2r(mm4, mm1); /* tmp13= tmp1 + tmp3; phases 5-3 */
+ movq_m2r (*(idata), mm7); /* load idata[DCTSIZE*0] */
+ paddw_r2r (mm6, mm0); /* tmp4 = tmp10 + tmp5; */
- psubw_r2r(mm4, mm5); /* tmp1-tmp3 */
- psubw_r2r(mm2, mm6); /* tmp5 = tmp11 - tmp6; */
+ pmulhw_m2r (fix_141, mm5); /* MULTIPLY(tmp1 - tmp3, FIX_1_414213562) */
- movq_r2m(mm1, *(wsptr)); /* save tmp13 in workspace */
- psllw_i2r(2, mm5); /* shift tmp1-tmp3 */
-
- movq_m2r(*(idata), mm7); /* load idata[DCTSIZE*0] */
- paddw_r2r(mm6, mm0); /* tmp4 = tmp10 + tmp5; */
+ movq_m2r (*(idata + 8), mm4); /* load idata[DCTSIZE*4] */
- pmulhw_m2r(fix_141, mm5); /* MULTIPLY(tmp1 - tmp3, FIX_1_414213562) */
+ psubw_r2r (mm1, mm5); /* tmp12 = MULTIPLY(tmp1 - tmp3, FIX_1_414213562) - tmp13; 2*c4 */
- movq_m2r(*(idata+8), mm4); /* load idata[DCTSIZE*4] */
-
- psubw_r2r(mm1, mm5); /* tmp12 = MULTIPLY(tmp1 - tmp3, FIX_1_414213562) - tmp13; 2*c4 */
+ movq_r2m (mm0, *(wsptr + 4)); /* save tmp4 in workspace */
+ movq_r2r (mm7, mm1); /* copy tmp0: phase 3 */
- movq_r2m(mm0, *(wsptr+4)); /* save tmp4 in workspace */
- movq_r2r(mm7, mm1); /* copy tmp0: phase 3 */
+ movq_r2m (mm5, *(wsptr + 2)); /* save tmp12 in workspace */
+ psubw_r2r (mm4, mm1); /* tmp11 = tmp0 - tmp2; */
- movq_r2m(mm5, *(wsptr+2)); /* save tmp12 in workspace */
- psubw_r2r(mm4, mm1); /* tmp11 = tmp0 - tmp2; */
+ paddw_r2r (mm4, mm7); /* tmp10 = tmp0 + tmp2; */
+ movq_r2r (mm1, mm5); /* copy tmp11 */
- paddw_r2r(mm4, mm7); /* tmp10 = tmp0 + tmp2; */
- movq_r2r(mm1, mm5); /* copy tmp11 */
-
- paddw_m2r(*(wsptr+2), mm1); /* tmp1 = tmp11 + tmp12; */
- movq_r2r(mm7, mm4); /* copy tmp10: phase 2 */
+ paddw_m2r (*(wsptr + 2), mm1); /* tmp1 = tmp11 + tmp12; */
+ movq_r2r (mm7, mm4); /* copy tmp10: phase 2 */
- paddw_m2r(*(wsptr), mm7); /* tmp0 = tmp10 + tmp13; */
+ paddw_m2r (*(wsptr), mm7); /* tmp0 = tmp10 + tmp13; */
- psubw_m2r(*(wsptr), mm4); /* tmp3 = tmp10 - tmp13; */
- movq_r2r(mm7, mm0); /* copy tmp0 */
+ psubw_m2r (*(wsptr), mm4); /* tmp3 = tmp10 - tmp13; */
+ movq_r2r (mm7, mm0); /* copy tmp0 */
- psubw_m2r(*(wsptr+2), mm5); /* tmp2 = tmp11 - tmp12; */
- paddw_r2r(mm3, mm7); /* wsptr[DCTSIZE*0] = (int) (tmp0 + tmp7); */
-
- psubw_r2r(mm3, mm0); /* wsptr[DCTSIZE*7] = (int) (tmp0 - tmp7); */
+ psubw_m2r (*(wsptr + 2), mm5); /* tmp2 = tmp11 - tmp12; */
+ paddw_r2r (mm3, mm7); /* wsptr[DCTSIZE*0] = (int) (tmp0 + tmp7); */
- movq_r2m(mm7, *(wsptr)); /* wsptr[DCTSIZE*0] */
- movq_r2r(mm1, mm3); /* copy tmp1 */
+ psubw_r2r (mm3, mm0); /* wsptr[DCTSIZE*7] = (int) (tmp0 - tmp7); */
- movq_r2m(mm0, *(wsptr+14)); /* wsptr[DCTSIZE*7] */
- paddw_r2r(mm2, mm1); /* wsptr[DCTSIZE*1] = (int) (tmp1 + tmp6); */
+ movq_r2m (mm7, *(wsptr)); /* wsptr[DCTSIZE*0] */
+ movq_r2r (mm1, mm3); /* copy tmp1 */
- psubw_r2r(mm2, mm3); /* wsptr[DCTSIZE*6] = (int) (tmp1 - tmp6); */
+ movq_r2m (mm0, *(wsptr + 14)); /* wsptr[DCTSIZE*7] */
+ paddw_r2r (mm2, mm1); /* wsptr[DCTSIZE*1] = (int) (tmp1 + tmp6); */
- movq_r2m(mm1, *(wsptr+2)); /* wsptr[DCTSIZE*1] */
- movq_r2r(mm4, mm1); /* copy tmp3 */
+ psubw_r2r (mm2, mm3); /* wsptr[DCTSIZE*6] = (int) (tmp1 - tmp6); */
- movq_r2m(mm3, *(wsptr+12)); /* wsptr[DCTSIZE*6] */
+ movq_r2m (mm1, *(wsptr + 2)); /* wsptr[DCTSIZE*1] */
+ movq_r2r (mm4, mm1); /* copy tmp3 */
- paddw_m2r(*(wsptr+4), mm4); /* wsptr[DCTSIZE*4] = (int) (tmp3 + tmp4); */
+ movq_r2m (mm3, *(wsptr + 12)); /* wsptr[DCTSIZE*6] */
- psubw_m2r(*(wsptr+4), mm1); /* wsptr[DCTSIZE*3] = (int) (tmp3 - tmp4); */
+ paddw_m2r (*(wsptr + 4), mm4); /* wsptr[DCTSIZE*4] = (int) (tmp3 + tmp4); */
- movq_r2m(mm4, *(wsptr+8));
- movq_r2r(mm5, mm7); /* copy tmp2 */
+ psubw_m2r (*(wsptr + 4), mm1); /* wsptr[DCTSIZE*3] = (int) (tmp3 - tmp4); */
- paddw_r2r(mm6, mm5); /* wsptr[DCTSIZE*2] = (int) (tmp2 + tmp5) */
+ movq_r2m (mm4, *(wsptr + 8));
+ movq_r2r (mm5, mm7); /* copy tmp2 */
- movq_r2m(mm1, *(wsptr+6));
- psubw_r2r(mm6, mm7); /* wsptr[DCTSIZE*5] = (int) (tmp2 - tmp5); */
+ paddw_r2r (mm6, mm5); /* wsptr[DCTSIZE*2] = (int) (tmp2 + tmp5) */
- movq_r2m(mm5, *(wsptr+4));
+ movq_r2m (mm1, *(wsptr + 6));
+ psubw_r2r (mm6, mm7); /* wsptr[DCTSIZE*5] = (int) (tmp2 - tmp5); */
- movq_r2m(mm7, *(wsptr+10));
+ movq_r2m (mm5, *(wsptr + 4));
+
+ movq_r2m (mm7, *(wsptr + 10));
/*****************************************************************/
@@ -1512,258 +1517,258 @@ static mmx_t fix_108n184 = (mmx_t)(long long)0xcf04cf04cf04cf04LL;
/* and also undo the PASS1_BITS scaling. */
/*****************************************************************/
- /* Even part */
+ /* Even part */
- wsptr--;
+ wsptr--;
/* tmp10 = ((DCTELEM) wsptr[0] + (DCTELEM) wsptr[4]); */
/* tmp13 = ((DCTELEM) wsptr[2] + (DCTELEM) wsptr[6]); */
/* tmp11 = ((DCTELEM) wsptr[0] - (DCTELEM) wsptr[4]); */
/* tmp14 = ((DCTELEM) wsptr[2] - (DCTELEM) wsptr[6]); */
- movq_m2r(*(wsptr), mm0); /* wsptr[0,0],[0,1],[0,2],[0,3] */
+ movq_m2r (*(wsptr), mm0); /* wsptr[0,0],[0,1],[0,2],[0,3] */
+
+ movq_m2r (*(wsptr + 1), mm1); /* wsptr[0,4],[0,5],[0,6],[0,7] */
+ movq_r2r (mm0, mm2);
+
+ movq_m2r (*(wsptr + 2), mm3); /* wsptr[1,0],[1,1],[1,2],[1,3] */
+ paddw_r2r (mm1, mm0); /* wsptr[0,tmp10],[xxx],[0,tmp13],[xxx] */
+
+ movq_m2r (*(wsptr + 3), mm4); /* wsptr[1,4],[1,5],[1,6],[1,7] */
+ psubw_r2r (mm1, mm2); /* wsptr[0,tmp11],[xxx],[0,tmp14],[xxx] */
- movq_m2r(*(wsptr+1), mm1); /* wsptr[0,4],[0,5],[0,6],[0,7] */
- movq_r2r(mm0, mm2);
-
- movq_m2r(*(wsptr+2), mm3); /* wsptr[1,0],[1,1],[1,2],[1,3] */
- paddw_r2r(mm1, mm0); /* wsptr[0,tmp10],[xxx],[0,tmp13],[xxx] */
+ movq_r2r (mm0, mm6);
+ movq_r2r (mm3, mm5);
- movq_m2r(*(wsptr+3), mm4); /* wsptr[1,4],[1,5],[1,6],[1,7] */
- psubw_r2r(mm1, mm2); /* wsptr[0,tmp11],[xxx],[0,tmp14],[xxx] */
+ paddw_r2r (mm4, mm3); /* wsptr[1,tmp10],[xxx],[1,tmp13],[xxx] */
+ movq_r2r (mm2, mm1);
- movq_r2r(mm0, mm6);
- movq_r2r(mm3, mm5);
-
- paddw_r2r(mm4, mm3); /* wsptr[1,tmp10],[xxx],[1,tmp13],[xxx] */
- movq_r2r(mm2, mm1);
+ psubw_r2r (mm4, mm5); /* wsptr[1,tmp11],[xxx],[1,tmp14],[xxx] */
+ punpcklwd_r2r (mm3, mm0); /* wsptr[0,tmp10],[1,tmp10],[xxx],[xxx] */
- psubw_r2r(mm4, mm5); /* wsptr[1,tmp11],[xxx],[1,tmp14],[xxx] */
- punpcklwd_r2r(mm3, mm0); /* wsptr[0,tmp10],[1,tmp10],[xxx],[xxx] */
+ movq_m2r (*(wsptr + 7), mm7); /* wsptr[3,4],[3,5],[3,6],[3,7] */
+ punpckhwd_r2r (mm3, mm6); /* wsptr[0,tmp13],[1,tmp13],[xxx],[xxx] */
- movq_m2r(*(wsptr+7), mm7); /* wsptr[3,4],[3,5],[3,6],[3,7] */
- punpckhwd_r2r(mm3, mm6); /* wsptr[0,tmp13],[1,tmp13],[xxx],[xxx] */
+ movq_m2r (*(wsptr + 4), mm3); /* wsptr[2,0],[2,1],[2,2],[2,3] */
+ punpckldq_r2r (mm6, mm0); /* wsptr[0,tmp10],[1,tmp10],[0,tmp13],[1,tmp13] */
- movq_m2r(*(wsptr+4), mm3); /* wsptr[2,0],[2,1],[2,2],[2,3] */
- punpckldq_r2r(mm6, mm0); /* wsptr[0,tmp10],[1,tmp10],[0,tmp13],[1,tmp13] */
+ punpcklwd_r2r (mm5, mm1); /* wsptr[0,tmp11],[1,tmp11],[xxx],[xxx] */
+ movq_r2r (mm3, mm4);
- punpcklwd_r2r(mm5, mm1); /* wsptr[0,tmp11],[1,tmp11],[xxx],[xxx] */
- movq_r2r(mm3, mm4);
+ movq_m2r (*(wsptr + 6), mm6); /* wsptr[3,0],[3,1],[3,2],[3,3] */
+ punpckhwd_r2r (mm5, mm2); /* wsptr[0,tmp14],[1,tmp14],[xxx],[xxx] */
- movq_m2r(*(wsptr+6), mm6); /* wsptr[3,0],[3,1],[3,2],[3,3] */
- punpckhwd_r2r(mm5, mm2); /* wsptr[0,tmp14],[1,tmp14],[xxx],[xxx] */
+ movq_m2r (*(wsptr + 5), mm5); /* wsptr[2,4],[2,5],[2,6],[2,7] */
+ punpckldq_r2r (mm2, mm1); /* wsptr[0,tmp11],[1,tmp11],[0,tmp14],[1,tmp14] */
- movq_m2r(*(wsptr+5), mm5); /* wsptr[2,4],[2,5],[2,6],[2,7] */
- punpckldq_r2r(mm2, mm1); /* wsptr[0,tmp11],[1,tmp11],[0,tmp14],[1,tmp14] */
-
- paddw_r2r(mm5, mm3); /* wsptr[2,tmp10],[xxx],[2,tmp13],[xxx] */
- movq_r2r(mm6, mm2);
+ paddw_r2r (mm5, mm3); /* wsptr[2,tmp10],[xxx],[2,tmp13],[xxx] */
+ movq_r2r (mm6, mm2);
- psubw_r2r(mm5, mm4); /* wsptr[2,tmp11],[xxx],[2,tmp14],[xxx] */
- paddw_r2r(mm7, mm6); /* wsptr[3,tmp10],[xxx],[3,tmp13],[xxx] */
+ psubw_r2r (mm5, mm4); /* wsptr[2,tmp11],[xxx],[2,tmp14],[xxx] */
+ paddw_r2r (mm7, mm6); /* wsptr[3,tmp10],[xxx],[3,tmp13],[xxx] */
- movq_r2r(mm3, mm5);
- punpcklwd_r2r(mm6, mm3); /* wsptr[2,tmp10],[3,tmp10],[xxx],[xxx] */
-
- psubw_r2r(mm7, mm2); /* wsptr[3,tmp11],[xxx],[3,tmp14],[xxx] */
- punpckhwd_r2r(mm6, mm5); /* wsptr[2,tmp13],[3,tmp13],[xxx],[xxx] */
+ movq_r2r (mm3, mm5);
+ punpcklwd_r2r (mm6, mm3); /* wsptr[2,tmp10],[3,tmp10],[xxx],[xxx] */
- movq_r2r(mm4, mm7);
- punpckldq_r2r(mm5, mm3); /* wsptr[2,tmp10],[3,tmp10],[2,tmp13],[3,tmp13] */
-
- punpcklwd_r2r(mm2, mm4); /* wsptr[2,tmp11],[3,tmp11],[xxx],[xxx] */
+ psubw_r2r (mm7, mm2); /* wsptr[3,tmp11],[xxx],[3,tmp14],[xxx] */
+ punpckhwd_r2r (mm6, mm5); /* wsptr[2,tmp13],[3,tmp13],[xxx],[xxx] */
- punpckhwd_r2r(mm2, mm7); /* wsptr[2,tmp14],[3,tmp14],[xxx],[xxx] */
+ movq_r2r (mm4, mm7);
+ punpckldq_r2r (mm5, mm3); /* wsptr[2,tmp10],[3,tmp10],[2,tmp13],[3,tmp13] */
- punpckldq_r2r(mm7, mm4); /* wsptr[2,tmp11],[3,tmp11],[2,tmp14],[3,tmp14] */
- movq_r2r(mm1, mm6);
+ punpcklwd_r2r (mm2, mm4); /* wsptr[2,tmp11],[3,tmp11],[xxx],[xxx] */
- /*ok */
+ punpckhwd_r2r (mm2, mm7); /* wsptr[2,tmp14],[3,tmp14],[xxx],[xxx] */
+
+ punpckldq_r2r (mm7, mm4); /* wsptr[2,tmp11],[3,tmp11],[2,tmp14],[3,tmp14] */
+ movq_r2r (mm1, mm6);
+
+ /*ok */
/* mm0 = ;wsptr[0,tmp10],[1,tmp10],[0,tmp13],[1,tmp13] */
/* mm1 = ;wsptr[0,tmp11],[1,tmp11],[0,tmp14],[1,tmp14] */
- movq_r2r(mm0, mm2);
- punpckhdq_r2r(mm4, mm6); /* wsptr[0,tmp14],[1,tmp14],[2,tmp14],[3,tmp14] */
+ movq_r2r (mm0, mm2);
+ punpckhdq_r2r (mm4, mm6); /* wsptr[0,tmp14],[1,tmp14],[2,tmp14],[3,tmp14] */
- punpckldq_r2r(mm4, mm1); /* wsptr[0,tmp11],[1,tmp11],[2,tmp11],[3,tmp11] */
- psllw_i2r(2, mm6);
+ punpckldq_r2r (mm4, mm1); /* wsptr[0,tmp11],[1,tmp11],[2,tmp11],[3,tmp11] */
+ psllw_i2r (2, mm6);
- pmulhw_m2r(fix_141, mm6);
- punpckldq_r2r(mm3, mm0); /* wsptr[0,tmp10],[1,tmp10],[2,tmp10],[3,tmp10] */
+ pmulhw_m2r (fix_141, mm6);
+ punpckldq_r2r (mm3, mm0); /* wsptr[0,tmp10],[1,tmp10],[2,tmp10],[3,tmp10] */
- punpckhdq_r2r(mm3, mm2); /* wsptr[0,tmp13],[1,tmp13],[2,tmp13],[3,tmp13] */
- movq_r2r(mm0, mm7);
+ punpckhdq_r2r (mm3, mm2); /* wsptr[0,tmp13],[1,tmp13],[2,tmp13],[3,tmp13] */
+ movq_r2r (mm0, mm7);
/* tmp0 = tmp10 + tmp13; */
/* tmp3 = tmp10 - tmp13; */
- paddw_r2r(mm2, mm0); /* [0,tmp0],[1,tmp0],[2,tmp0],[3,tmp0] */
- psubw_r2r(mm2, mm7); /* [0,tmp3],[1,tmp3],[2,tmp3],[3,tmp3] */
+ paddw_r2r (mm2, mm0); /* [0,tmp0],[1,tmp0],[2,tmp0],[3,tmp0] */
+ psubw_r2r (mm2, mm7); /* [0,tmp3],[1,tmp3],[2,tmp3],[3,tmp3] */
/* tmp12 = MULTIPLY(tmp14, FIX_1_414213562) - tmp13; */
- psubw_r2r(mm2, mm6); /* wsptr[0,tmp12],[1,tmp12],[2,tmp12],[3,tmp12] */
+ psubw_r2r (mm2, mm6); /* wsptr[0,tmp12],[1,tmp12],[2,tmp12],[3,tmp12] */
/* tmp1 = tmp11 + tmp12; */
/* tmp2 = tmp11 - tmp12; */
- movq_r2r(mm1, mm5);
+ movq_r2r (mm1, mm5);
- /*OK */
+ /*OK */
- /* Odd part */
+ /* Odd part */
/* z13 = (DCTELEM) wsptr[5] + (DCTELEM) wsptr[3]; */
/* z10 = (DCTELEM) wsptr[5] - (DCTELEM) wsptr[3]; */
/* z11 = (DCTELEM) wsptr[1] + (DCTELEM) wsptr[7]; */
/* z12 = (DCTELEM) wsptr[1] - (DCTELEM) wsptr[7]; */
- movq_m2r(*(wsptr), mm3); /* wsptr[0,0],[0,1],[0,2],[0,3] */
- paddw_r2r(mm6, mm1); /* [0,tmp1],[1,tmp1],[2,tmp1],[3,tmp1] */
+ movq_m2r (*(wsptr), mm3); /* wsptr[0,0],[0,1],[0,2],[0,3] */
+ paddw_r2r (mm6, mm1); /* [0,tmp1],[1,tmp1],[2,tmp1],[3,tmp1] */
- movq_m2r(*(wsptr+1), mm4); /* wsptr[0,4],[0,5],[0,6],[0,7] */
- psubw_r2r(mm6, mm5); /* [0,tmp2],[1,tmp2],[2,tmp2],[3,tmp2] */
+ movq_m2r (*(wsptr + 1), mm4); /* wsptr[0,4],[0,5],[0,6],[0,7] */
+ psubw_r2r (mm6, mm5); /* [0,tmp2],[1,tmp2],[2,tmp2],[3,tmp2] */
- movq_r2r(mm3, mm6);
- punpckldq_r2r(mm4, mm3); /* wsptr[0,0],[0,1],[0,4],[0,5] */
+ movq_r2r (mm3, mm6);
+ punpckldq_r2r (mm4, mm3); /* wsptr[0,0],[0,1],[0,4],[0,5] */
- punpckhdq_r2r(mm6, mm4); /* wsptr[0,6],[0,7],[0,2],[0,3] */
- movq_r2r(mm3, mm2);
+ punpckhdq_r2r (mm6, mm4); /* wsptr[0,6],[0,7],[0,2],[0,3] */
+ movq_r2r (mm3, mm2);
/*Save tmp0 and tmp1 in wsptr */
- movq_r2m(mm0, *(wsptr)); /* save tmp0 */
- paddw_r2r(mm4, mm2); /* wsptr[xxx],[0,z11],[xxx],[0,z13] */
+ movq_r2m (mm0, *(wsptr)); /* save tmp0 */
+ paddw_r2r (mm4, mm2); /* wsptr[xxx],[0,z11],[xxx],[0,z13] */
+
-
/*Continue with z10 --- z13 */
- movq_m2r(*(wsptr+2), mm6); /* wsptr[1,0],[1,1],[1,2],[1,3] */
- psubw_r2r(mm4, mm3); /* wsptr[xxx],[0,z12],[xxx],[0,z10] */
+ movq_m2r (*(wsptr + 2), mm6); /* wsptr[1,0],[1,1],[1,2],[1,3] */
+ psubw_r2r (mm4, mm3); /* wsptr[xxx],[0,z12],[xxx],[0,z10] */
- movq_m2r(*(wsptr+3), mm0); /* wsptr[1,4],[1,5],[1,6],[1,7] */
- movq_r2r(mm6, mm4);
+ movq_m2r (*(wsptr + 3), mm0); /* wsptr[1,4],[1,5],[1,6],[1,7] */
+ movq_r2r (mm6, mm4);
- movq_r2m(mm1, *(wsptr+1)); /* save tmp1 */
- punpckldq_r2r(mm0, mm6); /* wsptr[1,0],[1,1],[1,4],[1,5] */
+ movq_r2m (mm1, *(wsptr + 1)); /* save tmp1 */
+ punpckldq_r2r (mm0, mm6); /* wsptr[1,0],[1,1],[1,4],[1,5] */
+
+ punpckhdq_r2r (mm4, mm0); /* wsptr[1,6],[1,7],[1,2],[1,3] */
+ movq_r2r (mm6, mm1);
- punpckhdq_r2r(mm4, mm0); /* wsptr[1,6],[1,7],[1,2],[1,3] */
- movq_r2r(mm6, mm1);
-
/*Save tmp2 and tmp3 in wsptr */
- paddw_r2r(mm0, mm6); /* wsptr[xxx],[1,z11],[xxx],[1,z13] */
- movq_r2r(mm2, mm4);
-
+ paddw_r2r (mm0, mm6); /* wsptr[xxx],[1,z11],[xxx],[1,z13] */
+ movq_r2r (mm2, mm4);
+
/*Continue with z10 --- z13 */
- movq_r2m(mm5, *(wsptr+2)); /* save tmp2 */
- punpcklwd_r2r(mm6, mm2); /* wsptr[xxx],[xxx],[0,z11],[1,z11] */
+ movq_r2m (mm5, *(wsptr + 2)); /* save tmp2 */
+ punpcklwd_r2r (mm6, mm2); /* wsptr[xxx],[xxx],[0,z11],[1,z11] */
- psubw_r2r(mm0, mm1); /* wsptr[xxx],[1,z12],[xxx],[1,z10] */
- punpckhwd_r2r(mm6, mm4); /* wsptr[xxx],[xxx],[0,z13],[1,z13] */
+ psubw_r2r (mm0, mm1); /* wsptr[xxx],[1,z12],[xxx],[1,z10] */
+ punpckhwd_r2r (mm6, mm4); /* wsptr[xxx],[xxx],[0,z13],[1,z13] */
- movq_r2r(mm3, mm0);
- punpcklwd_r2r(mm1, mm3); /* wsptr[xxx],[xxx],[0,z12],[1,z12] */
+ movq_r2r (mm3, mm0);
+ punpcklwd_r2r (mm1, mm3); /* wsptr[xxx],[xxx],[0,z12],[1,z12] */
- movq_r2m(mm7, *(wsptr+3)); /* save tmp3 */
- punpckhwd_r2r(mm1, mm0); /* wsptr[xxx],[xxx],[0,z10],[1,z10] */
+ movq_r2m (mm7, *(wsptr + 3)); /* save tmp3 */
+ punpckhwd_r2r (mm1, mm0); /* wsptr[xxx],[xxx],[0,z10],[1,z10] */
- movq_m2r(*(wsptr+4), mm6); /* wsptr[2,0],[2,1],[2,2],[2,3] */
- punpckhdq_r2r(mm2, mm0); /* wsptr[0,z10],[1,z10],[0,z11],[1,z11] */
+ movq_m2r (*(wsptr + 4), mm6); /* wsptr[2,0],[2,1],[2,2],[2,3] */
+ punpckhdq_r2r (mm2, mm0); /* wsptr[0,z10],[1,z10],[0,z11],[1,z11] */
- movq_m2r(*(wsptr+5), mm7); /* wsptr[2,4],[2,5],[2,6],[2,7] */
- punpckhdq_r2r(mm4, mm3); /* wsptr[0,z12],[1,z12],[0,z13],[1,z13] */
+ movq_m2r (*(wsptr + 5), mm7); /* wsptr[2,4],[2,5],[2,6],[2,7] */
+ punpckhdq_r2r (mm4, mm3); /* wsptr[0,z12],[1,z12],[0,z13],[1,z13] */
- movq_m2r(*(wsptr+6), mm1); /* wsptr[3,0],[3,1],[3,2],[3,3] */
- movq_r2r(mm6, mm4);
+ movq_m2r (*(wsptr + 6), mm1); /* wsptr[3,0],[3,1],[3,2],[3,3] */
+ movq_r2r (mm6, mm4);
- punpckldq_r2r(mm7, mm6); /* wsptr[2,0],[2,1],[2,4],[2,5] */
- movq_r2r(mm1, mm5);
+ punpckldq_r2r (mm7, mm6); /* wsptr[2,0],[2,1],[2,4],[2,5] */
+ movq_r2r (mm1, mm5);
- punpckhdq_r2r(mm4, mm7); /* wsptr[2,6],[2,7],[2,2],[2,3] */
- movq_r2r(mm6, mm2);
-
- movq_m2r(*(wsptr+7), mm4); /* wsptr[3,4],[3,5],[3,6],[3,7] */
- paddw_r2r(mm7, mm6); /* wsptr[xxx],[2,z11],[xxx],[2,z13] */
+ punpckhdq_r2r (mm4, mm7); /* wsptr[2,6],[2,7],[2,2],[2,3] */
+ movq_r2r (mm6, mm2);
- psubw_r2r(mm7, mm2); /* wsptr[xxx],[2,z12],[xxx],[2,z10] */
- punpckldq_r2r(mm4, mm1); /* wsptr[3,0],[3,1],[3,4],[3,5] */
+ movq_m2r (*(wsptr + 7), mm4); /* wsptr[3,4],[3,5],[3,6],[3,7] */
+ paddw_r2r (mm7, mm6); /* wsptr[xxx],[2,z11],[xxx],[2,z13] */
- punpckhdq_r2r(mm5, mm4); /* wsptr[3,6],[3,7],[3,2],[3,3] */
- movq_r2r(mm1, mm7);
+ psubw_r2r (mm7, mm2); /* wsptr[xxx],[2,z12],[xxx],[2,z10] */
+ punpckldq_r2r (mm4, mm1); /* wsptr[3,0],[3,1],[3,4],[3,5] */
- paddw_r2r(mm4, mm1); /* wsptr[xxx],[3,z11],[xxx],[3,z13] */
- psubw_r2r(mm4, mm7); /* wsptr[xxx],[3,z12],[xxx],[3,z10] */
+ punpckhdq_r2r (mm5, mm4); /* wsptr[3,6],[3,7],[3,2],[3,3] */
+ movq_r2r (mm1, mm7);
- movq_r2r(mm6, mm5);
- punpcklwd_r2r(mm1, mm6); /* wsptr[xxx],[xxx],[2,z11],[3,z11] */
+ paddw_r2r (mm4, mm1); /* wsptr[xxx],[3,z11],[xxx],[3,z13] */
+ psubw_r2r (mm4, mm7); /* wsptr[xxx],[3,z12],[xxx],[3,z10] */
- punpckhwd_r2r(mm1, mm5); /* wsptr[xxx],[xxx],[2,z13],[3,z13] */
- movq_r2r(mm2, mm4);
+ movq_r2r (mm6, mm5);
+ punpcklwd_r2r (mm1, mm6); /* wsptr[xxx],[xxx],[2,z11],[3,z11] */
- punpcklwd_r2r(mm7, mm2); /* wsptr[xxx],[xxx],[2,z12],[3,z12] */
+ punpckhwd_r2r (mm1, mm5); /* wsptr[xxx],[xxx],[2,z13],[3,z13] */
+ movq_r2r (mm2, mm4);
- punpckhwd_r2r(mm7, mm4); /* wsptr[xxx],[xxx],[2,z10],[3,z10] */
+ punpcklwd_r2r (mm7, mm2); /* wsptr[xxx],[xxx],[2,z12],[3,z12] */
- punpckhdq_r2r(mm6, mm4); /*/ wsptr[2,z10],[3,z10],[2,z11],[3,z11] */
+ punpckhwd_r2r (mm7, mm4); /* wsptr[xxx],[xxx],[2,z10],[3,z10] */
- punpckhdq_r2r(mm5, mm2); /* wsptr[2,z12],[3,z12],[2,z13],[3,z13] */
- movq_r2r(mm0, mm5);
+ punpckhdq_r2r (mm6, mm4); /*/ wsptr[2,z10],[3,z10],[2,z11],[3,z11] */
- punpckldq_r2r(mm4, mm0); /* wsptr[0,z10],[1,z10],[2,z10],[3,z10] */
+ punpckhdq_r2r (mm5, mm2); /* wsptr[2,z12],[3,z12],[2,z13],[3,z13] */
+ movq_r2r (mm0, mm5);
- punpckhdq_r2r(mm4, mm5); /* wsptr[0,z11],[1,z11],[2,z11],[3,z11] */
- movq_r2r(mm3, mm4);
+ punpckldq_r2r (mm4, mm0); /* wsptr[0,z10],[1,z10],[2,z10],[3,z10] */
- punpckhdq_r2r(mm2, mm4); /* wsptr[0,z13],[1,z13],[2,z13],[3,z13] */
- movq_r2r(mm5, mm1);
+ punpckhdq_r2r (mm4, mm5); /* wsptr[0,z11],[1,z11],[2,z11],[3,z11] */
+ movq_r2r (mm3, mm4);
- punpckldq_r2r(mm2, mm3); /* wsptr[0,z12],[1,z12],[2,z12],[3,z12] */
+ punpckhdq_r2r (mm2, mm4); /* wsptr[0,z13],[1,z13],[2,z13],[3,z13] */
+ movq_r2r (mm5, mm1);
+
+ punpckldq_r2r (mm2, mm3); /* wsptr[0,z12],[1,z12],[2,z12],[3,z12] */
/* tmp7 = z11 + z13; : phase 5 */
/* tmp8 = z11 - z13; : phase 5 */
- psubw_r2r(mm4, mm1); /* tmp8 */
+ psubw_r2r (mm4, mm1); /* tmp8 */
- paddw_r2r(mm4, mm5); /* tmp7 */
+ paddw_r2r (mm4, mm5); /* tmp7 */
/* tmp21 = MULTIPLY(tmp8, FIX_1_414213562); 2*c4 */
- psllw_i2r(2, mm1);
+ psllw_i2r (2, mm1);
- psllw_i2r(2, mm0);
+ psllw_i2r (2, mm0);
- pmulhw_m2r(fix_141, mm1); /* tmp21 */
+ pmulhw_m2r (fix_141, mm1); /* tmp21 */
/* tmp20 = MULTIPLY(z12, (FIX_1_082392200- FIX_1_847759065)) 2*(c2-c6) */
/* + MULTIPLY(z10, - FIX_1_847759065); : 2*c2 */
- psllw_i2r(2, mm3);
- movq_r2r(mm0, mm7);
+ psllw_i2r (2, mm3);
+ movq_r2r (mm0, mm7);
- pmulhw_m2r(fix_n184, mm7);
- movq_r2r(mm3, mm6);
+ pmulhw_m2r (fix_n184, mm7);
+ movq_r2r (mm3, mm6);
- movq_m2r(*(wsptr), mm2); /* tmp0,final1 */
+ movq_m2r (*(wsptr), mm2); /* tmp0,final1 */
- pmulhw_m2r(fix_108n184, mm6);
+ pmulhw_m2r (fix_108n184, mm6);
/* tmp22 = MULTIPLY(z10,(FIX_1_847759065 - FIX_2_613125930)) : -2*(c2+c6) */
/* + MULTIPLY(z12, FIX_1_847759065); 2*c2 */
- movq_r2r(mm2, mm4); /* final1 */
-
- pmulhw_m2r(fix_184n261, mm0);
- paddw_r2r(mm5, mm2); /* tmp0+tmp7,final1 */
+ movq_r2r (mm2, mm4); /* final1 */
+
+ pmulhw_m2r (fix_184n261, mm0);
+ paddw_r2r (mm5, mm2); /* tmp0+tmp7,final1 */
- pmulhw_m2r(fix_184, mm3);
- psubw_r2r(mm5, mm4); /* tmp0-tmp7,final1 */
+ pmulhw_m2r (fix_184, mm3);
+ psubw_r2r (mm5, mm4); /* tmp0-tmp7,final1 */
/* tmp6 = tmp22 - tmp7; phase 2 */
- psraw_i2r(3, mm2); /* outptr[0,0],[1,0],[2,0],[3,0],final1 */
+ psraw_i2r (3, mm2); /* outptr[0,0],[1,0],[2,0],[3,0],final1 */
- paddw_r2r(mm6, mm7); /* tmp20 */
- psraw_i2r(3, mm4); /* outptr[0,7],[1,7],[2,7],[3,7],final1 */
+ paddw_r2r (mm6, mm7); /* tmp20 */
+ psraw_i2r (3, mm4); /* outptr[0,7],[1,7],[2,7],[3,7],final1 */
- paddw_r2r(mm0, mm3); /* tmp22 */
+ paddw_r2r (mm0, mm3); /* tmp22 */
/* tmp5 = tmp21 - tmp6; */
- psubw_r2r(mm5, mm3); /* tmp6 */
+ psubw_r2r (mm5, mm3); /* tmp6 */
/* tmp4 = tmp20 + tmp5; */
- movq_m2r(*(wsptr+1), mm0); /* tmp1,final2 */
- psubw_r2r(mm3, mm1); /* tmp5 */
+ movq_m2r (*(wsptr + 1), mm0); /* tmp1,final2 */
+ psubw_r2r (mm3, mm1); /* tmp5 */
- movq_r2r(mm0, mm6); /* final2 */
- paddw_r2r(mm3, mm0); /* tmp1+tmp6,final2 */
+ movq_r2r (mm0, mm6); /* final2 */
+ paddw_r2r (mm3, mm0); /* tmp1+tmp6,final2 */
- /* Final output stage: scale down by a factor of 8 and range-limit */
+ /* Final output stage: scale down by a factor of 8 and range-limit */
/* outptr[0] = range_limit[IDESCALE(tmp0 + tmp7, PASS1_BITS+3) */
@@ -1776,30 +1781,30 @@ static mmx_t fix_108n184 = (mmx_t)(long long)0xcf04cf04cf04cf04LL;
/* & RANGE_MASK]; */
/* outptr[6] = range_limit[IDESCALE(tmp1 - tmp6, PASS1_BITS+3) */
/* & RANGE_MASK]; final2 */
- psubw_r2r(mm3, mm6); /* tmp1-tmp6,final2 */
- psraw_i2r(3, mm0); /* outptr[0,1],[1,1],[2,1],[3,1] */
+ psubw_r2r (mm3, mm6); /* tmp1-tmp6,final2 */
+ psraw_i2r (3, mm0); /* outptr[0,1],[1,1],[2,1],[3,1] */
+
+ psraw_i2r (3, mm6); /* outptr[0,6],[1,6],[2,6],[3,6] */
+
+ packuswb_r2r (mm4, mm0); /* out[0,1],[1,1],[2,1],[3,1],[0,7],[1,7],[2,7],[3,7] */
- psraw_i2r(3, mm6); /* outptr[0,6],[1,6],[2,6],[3,6] */
-
- packuswb_r2r(mm4, mm0); /* out[0,1],[1,1],[2,1],[3,1],[0,7],[1,7],[2,7],[3,7] */
-
- movq_m2r(*(wsptr+2), mm5); /* tmp2,final3 */
- packuswb_r2r(mm6, mm2); /* out[0,0],[1,0],[2,0],[3,0],[0,6],[1,6],[2,6],[3,6] */
+ movq_m2r (*(wsptr + 2), mm5); /* tmp2,final3 */
+ packuswb_r2r (mm6, mm2); /* out[0,0],[1,0],[2,0],[3,0],[0,6],[1,6],[2,6],[3,6] */
/* outptr[2] = range_limit[IDESCALE(tmp2 + tmp5, PASS1_BITS+3) */
/* & RANGE_MASK]; */
/* outptr[5] = range_limit[IDESCALE(tmp2 - tmp5, PASS1_BITS+3) */
/* & RANGE_MASK]; final3 */
- paddw_r2r(mm1, mm7); /* tmp4 */
- movq_r2r(mm5, mm3);
+ paddw_r2r (mm1, mm7); /* tmp4 */
+ movq_r2r (mm5, mm3);
- paddw_r2r(mm1, mm5); /* tmp2+tmp5 */
- psubw_r2r(mm1, mm3); /* tmp2-tmp5 */
+ paddw_r2r (mm1, mm5); /* tmp2+tmp5 */
+ psubw_r2r (mm1, mm3); /* tmp2-tmp5 */
- psraw_i2r(3, mm5); /* outptr[0,2],[1,2],[2,2],[3,2] */
+ psraw_i2r (3, mm5); /* outptr[0,2],[1,2],[2,2],[3,2] */
- movq_m2r(*(wsptr+3), mm4); /* tmp3,final4 */
- psraw_i2r(3, mm3); /* outptr[0,5],[1,5],[2,5],[3,5] */
+ movq_m2r (*(wsptr + 3), mm4); /* tmp3,final4 */
+ psraw_i2r (3, mm3); /* outptr[0,5],[1,5],[2,5],[3,5] */
@@ -1807,74 +1812,74 @@ static mmx_t fix_108n184 = (mmx_t)(long long)0xcf04cf04cf04cf04LL;
/* & RANGE_MASK]; */
/* outptr[3] = range_limit[IDESCALE(tmp3 - tmp4, PASS1_BITS+3) */
/* & RANGE_MASK]; final4 */
- movq_r2r(mm4, mm6);
- paddw_r2r(mm7, mm4); /* tmp3+tmp4 */
+ movq_r2r (mm4, mm6);
+ paddw_r2r (mm7, mm4); /* tmp3+tmp4 */
- psubw_r2r(mm7, mm6); /* tmp3-tmp4 */
- psraw_i2r(3, mm4); /* outptr[0,4],[1,4],[2,4],[3,4] */
+ psubw_r2r (mm7, mm6); /* tmp3-tmp4 */
+ psraw_i2r (3, mm4); /* outptr[0,4],[1,4],[2,4],[3,4] */
- /* mov ecx, [dataptr] */
+ /* mov ecx, [dataptr] */
- psraw_i2r(3, mm6); /* outptr[0,3],[1,3],[2,3],[3,3] */
+ psraw_i2r (3, mm6); /* outptr[0,3],[1,3],[2,3],[3,3] */
- packuswb_r2r(mm4, mm5); /* out[0,2],[1,2],[2,2],[3,2],[0,4],[1,4],[2,4],[3,4] */
+ packuswb_r2r (mm4, mm5); /* out[0,2],[1,2],[2,2],[3,2],[0,4],[1,4],[2,4],[3,4] */
- packuswb_r2r(mm3, mm6); /* out[0,3],[1,3],[2,3],[3,3],[0,5],[1,5],[2,5],[3,5] */
- movq_r2r(mm2, mm4);
+ packuswb_r2r (mm3, mm6); /* out[0,3],[1,3],[2,3],[3,3],[0,5],[1,5],[2,5],[3,5] */
+ movq_r2r (mm2, mm4);
- movq_r2r(mm5, mm7);
- punpcklbw_r2r(mm0, mm2); /* out[0,0],[0,1],[1,0],[1,1],[2,0],[2,1],[3,0],[3,1] */
+ movq_r2r (mm5, mm7);
+ punpcklbw_r2r (mm0, mm2); /* out[0,0],[0,1],[1,0],[1,1],[2,0],[2,1],[3,0],[3,1] */
- punpckhbw_r2r(mm0, mm4); /* out[0,6],[0,7],[1,6],[1,7],[2,6],[2,7],[3,6],[3,7] */
- movq_r2r(mm2, mm1);
+ punpckhbw_r2r (mm0, mm4); /* out[0,6],[0,7],[1,6],[1,7],[2,6],[2,7],[3,6],[3,7] */
+ movq_r2r (mm2, mm1);
- punpcklbw_r2r(mm6, mm5); /* out[0,2],[0,3],[1,2],[1,3],[2,2],[2,3],[3,2],[3,3] */
+ punpcklbw_r2r (mm6, mm5); /* out[0,2],[0,3],[1,2],[1,3],[2,2],[2,3],[3,2],[3,3] */
- /* add dataptr, 4 */
+ /* add dataptr, 4 */
- punpckhbw_r2r(mm6, mm7); /* out[0,4],[0,5],[1,4],[1,5],[2,4],[2,5],[3,4],[3,5] */
+ punpckhbw_r2r (mm6, mm7); /* out[0,4],[0,5],[1,4],[1,5],[2,4],[2,5],[3,4],[3,5] */
- punpcklwd_r2r(mm5, mm2); /* out[0,0],[0,1],[0,2],[0,3],[1,0],[1,1],[1,2],[1,3] */
-
- /* add ecx, output_col */
+ punpcklwd_r2r (mm5, mm2); /* out[0,0],[0,1],[0,2],[0,3],[1,0],[1,1],[1,2],[1,3] */
- movq_r2r(mm7, mm6);
- punpckhwd_r2r(mm5, mm1); /* out[2,0],[2,1],[2,2],[2,3],[3,0],[3,1],[3,2],[3,3] */
+ /* add ecx, output_col */
- movq_r2r(mm2, mm0);
- punpcklwd_r2r(mm4, mm6); /* out[0,4],[0,5],[0,6],[0,7],[1,4],[1,5],[1,6],[1,7] */
+ movq_r2r (mm7, mm6);
+ punpckhwd_r2r (mm5, mm1); /* out[2,0],[2,1],[2,2],[2,3],[3,0],[3,1],[3,2],[3,3] */
- /* mov idata, [dataptr] */
-
- punpckldq_r2r(mm6, mm2); /* out[0,0],[0,1],[0,2],[0,3],[0,4],[0,5],[0,6],[0,7] */
+ movq_r2r (mm2, mm0);
+ punpcklwd_r2r (mm4, mm6); /* out[0,4],[0,5],[0,6],[0,7],[1,4],[1,5],[1,6],[1,7] */
- /* add dataptr, 4 */
-
- movq_r2r(mm1, mm3);
+ /* mov idata, [dataptr] */
- /* add idata, output_col */
-
- punpckhwd_r2r(mm4, mm7); /* out[2,4],[2,5],[2,6],[2,7],[3,4],[3,5],[3,6],[3,7] */
-
- movq_r2m(mm2, *(dataptr));
-
- punpckhdq_r2r(mm6, mm0); /* out[1,0],[1,1],[1,2],[1,3],[1,4],[1,5],[1,6],[1,7] */
+ punpckldq_r2r (mm6, mm2); /* out[0,0],[0,1],[0,2],[0,3],[0,4],[0,5],[0,6],[0,7] */
- dataptr += rskip;
- movq_r2m(mm0, *(dataptr));
+ /* add dataptr, 4 */
- punpckldq_r2r(mm7, mm1); /* out[2,0],[2,1],[2,2],[2,3],[2,4],[2,5],[2,6],[2,7] */
- punpckhdq_r2r(mm7, mm3); /* out[3,0],[3,1],[3,2],[3,3],[3,4],[3,5],[3,6],[3,7] */
-
- dataptr += rskip;
- movq_r2m(mm1, *(dataptr));
+ movq_r2r (mm1, mm3);
- dataptr += rskip;
- movq_r2m(mm3, *(dataptr));
+ /* add idata, output_col */
+
+ punpckhwd_r2r (mm4, mm7); /* out[2,4],[2,5],[2,6],[2,7],[3,4],[3,5],[3,6],[3,7] */
+
+ movq_r2m (mm2, *(dataptr));
+
+ punpckhdq_r2r (mm6, mm0); /* out[1,0],[1,1],[1,2],[1,3],[1,4],[1,5],[1,6],[1,7] */
+
+ dataptr += rskip;
+ movq_r2m (mm0, *(dataptr));
+
+ punpckldq_r2r (mm7, mm1); /* out[2,0],[2,1],[2,2],[2,3],[2,4],[2,5],[2,6],[2,7] */
+ punpckhdq_r2r (mm7, mm3); /* out[3,0],[3,1],[3,2],[3,3],[3,4],[3,5],[3,6],[3,7] */
+
+ dataptr += rskip;
+ movq_r2m (mm1, *(dataptr));
+
+ dataptr += rskip;
+ movq_r2m (mm3, *(dataptr));
/*******************************************************************/
- wsptr += 8;
+ wsptr += 8;
/*******************************************************************/
@@ -1882,249 +1887,249 @@ static mmx_t fix_108n184 = (mmx_t)(long long)0xcf04cf04cf04cf04LL;
/* tmp13 = ((DCTELEM) wsptr[2] + (DCTELEM) wsptr[6]); */
/* tmp11 = ((DCTELEM) wsptr[0] - (DCTELEM) wsptr[4]); */
/* tmp14 = ((DCTELEM) wsptr[2] - (DCTELEM) wsptr[6]); */
- movq_m2r(*(wsptr), mm0); /* wsptr[0,0],[0,1],[0,2],[0,3] */
+ movq_m2r (*(wsptr), mm0); /* wsptr[0,0],[0,1],[0,2],[0,3] */
+
+ movq_m2r (*(wsptr + 1), mm1); /* wsptr[0,4],[0,5],[0,6],[0,7] */
+ movq_r2r (mm0, mm2);
- movq_m2r(*(wsptr+1), mm1); /* wsptr[0,4],[0,5],[0,6],[0,7] */
- movq_r2r(mm0, mm2);
-
- movq_m2r(*(wsptr+2), mm3); /* wsptr[1,0],[1,1],[1,2],[1,3] */
- paddw_r2r(mm1, mm0); /* wsptr[0,tmp10],[xxx],[0,tmp13],[xxx] */
+ movq_m2r (*(wsptr + 2), mm3); /* wsptr[1,0],[1,1],[1,2],[1,3] */
+ paddw_r2r (mm1, mm0); /* wsptr[0,tmp10],[xxx],[0,tmp13],[xxx] */
- movq_m2r(*(wsptr+3), mm4); /* wsptr[1,4],[1,5],[1,6],[1,7] */
- psubw_r2r(mm1, mm2); /* wsptr[0,tmp11],[xxx],[0,tmp14],[xxx] */
+ movq_m2r (*(wsptr + 3), mm4); /* wsptr[1,4],[1,5],[1,6],[1,7] */
+ psubw_r2r (mm1, mm2); /* wsptr[0,tmp11],[xxx],[0,tmp14],[xxx] */
- movq_r2r(mm0, mm6);
- movq_r2r(mm3, mm5);
-
- paddw_r2r(mm4, mm3); /* wsptr[1,tmp10],[xxx],[1,tmp13],[xxx] */
- movq_r2r(mm2, mm1);
+ movq_r2r (mm0, mm6);
+ movq_r2r (mm3, mm5);
- psubw_r2r(mm4, mm5); /* wsptr[1,tmp11],[xxx],[1,tmp14],[xxx] */
- punpcklwd_r2r(mm3, mm0); /* wsptr[0,tmp10],[1,tmp10],[xxx],[xxx] */
+ paddw_r2r (mm4, mm3); /* wsptr[1,tmp10],[xxx],[1,tmp13],[xxx] */
+ movq_r2r (mm2, mm1);
- movq_m2r(*(wsptr+7), mm7); /* wsptr[3,4],[3,5],[3,6],[3,7] */
- punpckhwd_r2r(mm3, mm6); /* wsptr[0,tmp13],[1,tmp13],[xxx],[xxx] */
+ psubw_r2r (mm4, mm5); /* wsptr[1,tmp11],[xxx],[1,tmp14],[xxx] */
+ punpcklwd_r2r (mm3, mm0); /* wsptr[0,tmp10],[1,tmp10],[xxx],[xxx] */
- movq_m2r(*(wsptr+4), mm3); /* wsptr[2,0],[2,1],[2,2],[2,3] */
- punpckldq_r2r(mm6, mm0); /* wsptr[0,tmp10],[1,tmp10],[0,tmp13],[1,tmp13] */
+ movq_m2r (*(wsptr + 7), mm7); /* wsptr[3,4],[3,5],[3,6],[3,7] */
+ punpckhwd_r2r (mm3, mm6); /* wsptr[0,tmp13],[1,tmp13],[xxx],[xxx] */
- punpcklwd_r2r(mm5, mm1); /* wsptr[0,tmp11],[1,tmp11],[xxx],[xxx] */
- movq_r2r(mm3, mm4);
+ movq_m2r (*(wsptr + 4), mm3); /* wsptr[2,0],[2,1],[2,2],[2,3] */
+ punpckldq_r2r (mm6, mm0); /* wsptr[0,tmp10],[1,tmp10],[0,tmp13],[1,tmp13] */
- movq_m2r(*(wsptr+6), mm6); /* wsptr[3,0],[3,1],[3,2],[3,3] */
- punpckhwd_r2r(mm5, mm2); /* wsptr[0,tmp14],[1,tmp14],[xxx],[xxx] */
+ punpcklwd_r2r (mm5, mm1); /* wsptr[0,tmp11],[1,tmp11],[xxx],[xxx] */
+ movq_r2r (mm3, mm4);
- movq_m2r(*(wsptr+5), mm5); /* wsptr[2,4],[2,5],[2,6],[2,7] */
- punpckldq_r2r(mm2, mm1); /* wsptr[0,tmp11],[1,tmp11],[0,tmp14],[1,tmp14] */
+ movq_m2r (*(wsptr + 6), mm6); /* wsptr[3,0],[3,1],[3,2],[3,3] */
+ punpckhwd_r2r (mm5, mm2); /* wsptr[0,tmp14],[1,tmp14],[xxx],[xxx] */
- paddw_r2r(mm5, mm3); /* wsptr[2,tmp10],[xxx],[2,tmp13],[xxx] */
- movq_r2r(mm6, mm2);
+ movq_m2r (*(wsptr + 5), mm5); /* wsptr[2,4],[2,5],[2,6],[2,7] */
+ punpckldq_r2r (mm2, mm1); /* wsptr[0,tmp11],[1,tmp11],[0,tmp14],[1,tmp14] */
- psubw_r2r(mm5, mm4); /* wsptr[2,tmp11],[xxx],[2,tmp14],[xxx] */
- paddw_r2r(mm7, mm6); /* wsptr[3,tmp10],[xxx],[3,tmp13],[xxx] */
+ paddw_r2r (mm5, mm3); /* wsptr[2,tmp10],[xxx],[2,tmp13],[xxx] */
+ movq_r2r (mm6, mm2);
- movq_r2r(mm3, mm5);
- punpcklwd_r2r(mm6, mm3); /* wsptr[2,tmp10],[3,tmp10],[xxx],[xxx] */
-
- psubw_r2r(mm7, mm2); /* wsptr[3,tmp11],[xxx],[3,tmp14],[xxx] */
- punpckhwd_r2r(mm6, mm5); /* wsptr[2,tmp13],[3,tmp13],[xxx],[xxx] */
+ psubw_r2r (mm5, mm4); /* wsptr[2,tmp11],[xxx],[2,tmp14],[xxx] */
+ paddw_r2r (mm7, mm6); /* wsptr[3,tmp10],[xxx],[3,tmp13],[xxx] */
- movq_r2r(mm4, mm7);
- punpckldq_r2r(mm5, mm3); /* wsptr[2,tmp10],[3,tmp10],[2,tmp13],[3,tmp13] */
+ movq_r2r (mm3, mm5);
+ punpcklwd_r2r (mm6, mm3); /* wsptr[2,tmp10],[3,tmp10],[xxx],[xxx] */
- punpcklwd_r2r(mm2, mm4); /* wsptr[2,tmp11],[3,tmp11],[xxx],[xxx] */
+ psubw_r2r (mm7, mm2); /* wsptr[3,tmp11],[xxx],[3,tmp14],[xxx] */
+ punpckhwd_r2r (mm6, mm5); /* wsptr[2,tmp13],[3,tmp13],[xxx],[xxx] */
- punpckhwd_r2r(mm2, mm7); /* wsptr[2,tmp14],[3,tmp14],[xxx],[xxx] */
+ movq_r2r (mm4, mm7);
+ punpckldq_r2r (mm5, mm3); /* wsptr[2,tmp10],[3,tmp10],[2,tmp13],[3,tmp13] */
- punpckldq_r2r(mm7, mm4); /* wsptr[2,tmp11],[3,tmp11],[2,tmp14],[3,tmp14] */
- movq_r2r(mm1, mm6);
+ punpcklwd_r2r (mm2, mm4); /* wsptr[2,tmp11],[3,tmp11],[xxx],[xxx] */
- /*OK */
+ punpckhwd_r2r (mm2, mm7); /* wsptr[2,tmp14],[3,tmp14],[xxx],[xxx] */
+
+ punpckldq_r2r (mm7, mm4); /* wsptr[2,tmp11],[3,tmp11],[2,tmp14],[3,tmp14] */
+ movq_r2r (mm1, mm6);
+
+ /*OK */
/* mm0 = ;wsptr[0,tmp10],[1,tmp10],[0,tmp13],[1,tmp13] */
/* mm1 = ;wsptr[0,tmp11],[1,tmp11],[0,tmp14],[1,tmp14] */
- movq_r2r(mm0, mm2);
- punpckhdq_r2r(mm4, mm6); /* wsptr[0,tmp14],[1,tmp14],[2,tmp14],[3,tmp14] */
+ movq_r2r (mm0, mm2);
+ punpckhdq_r2r (mm4, mm6); /* wsptr[0,tmp14],[1,tmp14],[2,tmp14],[3,tmp14] */
- punpckldq_r2r(mm4, mm1); /* wsptr[0,tmp11],[1,tmp11],[2,tmp11],[3,tmp11] */
- psllw_i2r(2, mm6);
+ punpckldq_r2r (mm4, mm1); /* wsptr[0,tmp11],[1,tmp11],[2,tmp11],[3,tmp11] */
+ psllw_i2r (2, mm6);
- pmulhw_m2r(fix_141, mm6);
- punpckldq_r2r(mm3, mm0); /* wsptr[0,tmp10],[1,tmp10],[2,tmp10],[3,tmp10] */
+ pmulhw_m2r (fix_141, mm6);
+ punpckldq_r2r (mm3, mm0); /* wsptr[0,tmp10],[1,tmp10],[2,tmp10],[3,tmp10] */
- punpckhdq_r2r(mm3, mm2); /* wsptr[0,tmp13],[1,tmp13],[2,tmp13],[3,tmp13] */
- movq_r2r(mm0, mm7);
+ punpckhdq_r2r (mm3, mm2); /* wsptr[0,tmp13],[1,tmp13],[2,tmp13],[3,tmp13] */
+ movq_r2r (mm0, mm7);
/* tmp0 = tmp10 + tmp13; */
/* tmp3 = tmp10 - tmp13; */
- paddw_r2r(mm2, mm0); /* [0,tmp0],[1,tmp0],[2,tmp0],[3,tmp0] */
- psubw_r2r(mm2, mm7); /* [0,tmp3],[1,tmp3],[2,tmp3],[3,tmp3] */
+ paddw_r2r (mm2, mm0); /* [0,tmp0],[1,tmp0],[2,tmp0],[3,tmp0] */
+ psubw_r2r (mm2, mm7); /* [0,tmp3],[1,tmp3],[2,tmp3],[3,tmp3] */
/* tmp12 = MULTIPLY(tmp14, FIX_1_414213562) - tmp13; */
- psubw_r2r(mm2, mm6); /* wsptr[0,tmp12],[1,tmp12],[2,tmp12],[3,tmp12] */
+ psubw_r2r (mm2, mm6); /* wsptr[0,tmp12],[1,tmp12],[2,tmp12],[3,tmp12] */
/* tmp1 = tmp11 + tmp12; */
/* tmp2 = tmp11 - tmp12; */
- movq_r2r(mm1, mm5);
+ movq_r2r (mm1, mm5);
- /*OK */
+ /*OK */
- /* Odd part */
+ /* Odd part */
/* z13 = (DCTELEM) wsptr[5] + (DCTELEM) wsptr[3]; */
/* z10 = (DCTELEM) wsptr[5] - (DCTELEM) wsptr[3]; */
/* z11 = (DCTELEM) wsptr[1] + (DCTELEM) wsptr[7]; */
/* z12 = (DCTELEM) wsptr[1] - (DCTELEM) wsptr[7]; */
- movq_m2r(*(wsptr), mm3); /* wsptr[0,0],[0,1],[0,2],[0,3] */
- paddw_r2r(mm6, mm1); /* [0,tmp1],[1,tmp1],[2,tmp1],[3,tmp1] */
+ movq_m2r (*(wsptr), mm3); /* wsptr[0,0],[0,1],[0,2],[0,3] */
+ paddw_r2r (mm6, mm1); /* [0,tmp1],[1,tmp1],[2,tmp1],[3,tmp1] */
- movq_m2r(*(wsptr+1), mm4); /* wsptr[0,4],[0,5],[0,6],[0,7] */
- psubw_r2r(mm6, mm5); /* [0,tmp2],[1,tmp2],[2,tmp2],[3,tmp2] */
+ movq_m2r (*(wsptr + 1), mm4); /* wsptr[0,4],[0,5],[0,6],[0,7] */
+ psubw_r2r (mm6, mm5); /* [0,tmp2],[1,tmp2],[2,tmp2],[3,tmp2] */
- movq_r2r(mm3, mm6);
- punpckldq_r2r(mm4, mm3); /* wsptr[0,0],[0,1],[0,4],[0,5] */
+ movq_r2r (mm3, mm6);
+ punpckldq_r2r (mm4, mm3); /* wsptr[0,0],[0,1],[0,4],[0,5] */
- punpckhdq_r2r(mm6, mm4); /* wsptr[0,6],[0,7],[0,2],[0,3] */
- movq_r2r(mm3, mm2);
+ punpckhdq_r2r (mm6, mm4); /* wsptr[0,6],[0,7],[0,2],[0,3] */
+ movq_r2r (mm3, mm2);
/*Save tmp0 and tmp1 in wsptr */
- movq_r2m(mm0, *(wsptr)); /* save tmp0 */
- paddw_r2r(mm4, mm2); /* wsptr[xxx],[0,z11],[xxx],[0,z13] */
+ movq_r2m (mm0, *(wsptr)); /* save tmp0 */
+ paddw_r2r (mm4, mm2); /* wsptr[xxx],[0,z11],[xxx],[0,z13] */
+
-
/*Continue with z10 --- z13 */
- movq_m2r(*(wsptr+2), mm6); /* wsptr[1,0],[1,1],[1,2],[1,3] */
- psubw_r2r(mm4, mm3); /* wsptr[xxx],[0,z12],[xxx],[0,z10] */
+ movq_m2r (*(wsptr + 2), mm6); /* wsptr[1,0],[1,1],[1,2],[1,3] */
+ psubw_r2r (mm4, mm3); /* wsptr[xxx],[0,z12],[xxx],[0,z10] */
- movq_m2r(*(wsptr+3), mm0); /* wsptr[1,4],[1,5],[1,6],[1,7] */
- movq_r2r(mm6, mm4);
+ movq_m2r (*(wsptr + 3), mm0); /* wsptr[1,4],[1,5],[1,6],[1,7] */
+ movq_r2r (mm6, mm4);
- movq_r2m(mm1, *(wsptr+1)); /* save tmp1 */
- punpckldq_r2r(mm0, mm6); /* wsptr[1,0],[1,1],[1,4],[1,5] */
+ movq_r2m (mm1, *(wsptr + 1)); /* save tmp1 */
+ punpckldq_r2r (mm0, mm6); /* wsptr[1,0],[1,1],[1,4],[1,5] */
+
+ punpckhdq_r2r (mm4, mm0); /* wsptr[1,6],[1,7],[1,2],[1,3] */
+ movq_r2r (mm6, mm1);
- punpckhdq_r2r(mm4, mm0); /* wsptr[1,6],[1,7],[1,2],[1,3] */
- movq_r2r(mm6, mm1);
-
/*Save tmp2 and tmp3 in wsptr */
- paddw_r2r(mm0, mm6); /* wsptr[xxx],[1,z11],[xxx],[1,z13] */
- movq_r2r(mm2, mm4);
-
+ paddw_r2r (mm0, mm6); /* wsptr[xxx],[1,z11],[xxx],[1,z13] */
+ movq_r2r (mm2, mm4);
+
/*Continue with z10 --- z13 */
- movq_r2m(mm5, *(wsptr+2)); /* save tmp2 */
- punpcklwd_r2r(mm6, mm2); /* wsptr[xxx],[xxx],[0,z11],[1,z11] */
+ movq_r2m (mm5, *(wsptr + 2)); /* save tmp2 */
+ punpcklwd_r2r (mm6, mm2); /* wsptr[xxx],[xxx],[0,z11],[1,z11] */
- psubw_r2r(mm0, mm1); /* wsptr[xxx],[1,z12],[xxx],[1,z10] */
- punpckhwd_r2r(mm6, mm4); /* wsptr[xxx],[xxx],[0,z13],[1,z13] */
+ psubw_r2r (mm0, mm1); /* wsptr[xxx],[1,z12],[xxx],[1,z10] */
+ punpckhwd_r2r (mm6, mm4); /* wsptr[xxx],[xxx],[0,z13],[1,z13] */
- movq_r2r(mm3, mm0);
- punpcklwd_r2r(mm1, mm3); /* wsptr[xxx],[xxx],[0,z12],[1,z12] */
+ movq_r2r (mm3, mm0);
+ punpcklwd_r2r (mm1, mm3); /* wsptr[xxx],[xxx],[0,z12],[1,z12] */
- movq_r2m(mm7, *(wsptr+3)); /* save tmp3 */
- punpckhwd_r2r(mm1, mm0); /* wsptr[xxx],[xxx],[0,z10],[1,z10] */
+ movq_r2m (mm7, *(wsptr + 3)); /* save tmp3 */
+ punpckhwd_r2r (mm1, mm0); /* wsptr[xxx],[xxx],[0,z10],[1,z10] */
- movq_m2r(*(wsptr+4), mm6); /* wsptr[2,0],[2,1],[2,2],[2,3] */
- punpckhdq_r2r(mm2, mm0); /* wsptr[0,z10],[1,z10],[0,z11],[1,z11] */
+ movq_m2r (*(wsptr + 4), mm6); /* wsptr[2,0],[2,1],[2,2],[2,3] */
+ punpckhdq_r2r (mm2, mm0); /* wsptr[0,z10],[1,z10],[0,z11],[1,z11] */
- movq_m2r(*(wsptr+5), mm7); /* wsptr[2,4],[2,5],[2,6],[2,7] */
- punpckhdq_r2r(mm4, mm3); /* wsptr[0,z12],[1,z12],[0,z13],[1,z13] */
+ movq_m2r (*(wsptr + 5), mm7); /* wsptr[2,4],[2,5],[2,6],[2,7] */
+ punpckhdq_r2r (mm4, mm3); /* wsptr[0,z12],[1,z12],[0,z13],[1,z13] */
- movq_m2r(*(wsptr+6), mm1); /* wsptr[3,0],[3,1],[3,2],[3,3] */
- movq_r2r(mm6, mm4);
+ movq_m2r (*(wsptr + 6), mm1); /* wsptr[3,0],[3,1],[3,2],[3,3] */
+ movq_r2r (mm6, mm4);
- punpckldq_r2r(mm7, mm6); /* wsptr[2,0],[2,1],[2,4],[2,5] */
- movq_r2r(mm1, mm5);
+ punpckldq_r2r (mm7, mm6); /* wsptr[2,0],[2,1],[2,4],[2,5] */
+ movq_r2r (mm1, mm5);
- punpckhdq_r2r(mm4, mm7); /* wsptr[2,6],[2,7],[2,2],[2,3] */
- movq_r2r(mm6, mm2);
-
- movq_m2r(*(wsptr+7), mm4); /* wsptr[3,4],[3,5],[3,6],[3,7] */
- paddw_r2r(mm7, mm6); /* wsptr[xxx],[2,z11],[xxx],[2,z13] */
+ punpckhdq_r2r (mm4, mm7); /* wsptr[2,6],[2,7],[2,2],[2,3] */
+ movq_r2r (mm6, mm2);
- psubw_r2r(mm7, mm2); /* wsptr[xxx],[2,z12],[xxx],[2,z10] */
- punpckldq_r2r(mm4, mm1); /* wsptr[3,0],[3,1],[3,4],[3,5] */
+ movq_m2r (*(wsptr + 7), mm4); /* wsptr[3,4],[3,5],[3,6],[3,7] */
+ paddw_r2r (mm7, mm6); /* wsptr[xxx],[2,z11],[xxx],[2,z13] */
- punpckhdq_r2r(mm5, mm4); /* wsptr[3,6],[3,7],[3,2],[3,3] */
- movq_r2r(mm1, mm7);
+ psubw_r2r (mm7, mm2); /* wsptr[xxx],[2,z12],[xxx],[2,z10] */
+ punpckldq_r2r (mm4, mm1); /* wsptr[3,0],[3,1],[3,4],[3,5] */
- paddw_r2r(mm4, mm1); /* wsptr[xxx],[3,z11],[xxx],[3,z13] */
- psubw_r2r(mm4, mm7); /* wsptr[xxx],[3,z12],[xxx],[3,z10] */
+ punpckhdq_r2r (mm5, mm4); /* wsptr[3,6],[3,7],[3,2],[3,3] */
+ movq_r2r (mm1, mm7);
- movq_r2r(mm6, mm5);
- punpcklwd_r2r(mm1, mm6); /* wsptr[xxx],[xxx],[2,z11],[3,z11] */
+ paddw_r2r (mm4, mm1); /* wsptr[xxx],[3,z11],[xxx],[3,z13] */
+ psubw_r2r (mm4, mm7); /* wsptr[xxx],[3,z12],[xxx],[3,z10] */
- punpckhwd_r2r(mm1, mm5); /* wsptr[xxx],[xxx],[2,z13],[3,z13] */
- movq_r2r(mm2, mm4);
+ movq_r2r (mm6, mm5);
+ punpcklwd_r2r (mm1, mm6); /* wsptr[xxx],[xxx],[2,z11],[3,z11] */
- punpcklwd_r2r(mm7, mm2); /* wsptr[xxx],[xxx],[2,z12],[3,z12] */
+ punpckhwd_r2r (mm1, mm5); /* wsptr[xxx],[xxx],[2,z13],[3,z13] */
+ movq_r2r (mm2, mm4);
- punpckhwd_r2r(mm7, mm4); /* wsptr[xxx],[xxx],[2,z10],[3,z10] */
+ punpcklwd_r2r (mm7, mm2); /* wsptr[xxx],[xxx],[2,z12],[3,z12] */
- punpckhdq_r2r(mm6, mm4); /* wsptr[2,z10],[3,z10],[2,z11],[3,z11] */
+ punpckhwd_r2r (mm7, mm4); /* wsptr[xxx],[xxx],[2,z10],[3,z10] */
- punpckhdq_r2r(mm5, mm2); /* wsptr[2,z12],[3,z12],[2,z13],[3,z13] */
- movq_r2r(mm0, mm5);
+ punpckhdq_r2r (mm6, mm4); /* wsptr[2,z10],[3,z10],[2,z11],[3,z11] */
- punpckldq_r2r(mm4, mm0); /* wsptr[0,z10],[1,z10],[2,z10],[3,z10] */
+ punpckhdq_r2r (mm5, mm2); /* wsptr[2,z12],[3,z12],[2,z13],[3,z13] */
+ movq_r2r (mm0, mm5);
- punpckhdq_r2r(mm4, mm5); /* wsptr[0,z11],[1,z11],[2,z11],[3,z11] */
- movq_r2r(mm3, mm4);
+ punpckldq_r2r (mm4, mm0); /* wsptr[0,z10],[1,z10],[2,z10],[3,z10] */
- punpckhdq_r2r(mm2, mm4); /* wsptr[0,z13],[1,z13],[2,z13],[3,z13] */
- movq_r2r(mm5, mm1);
+ punpckhdq_r2r (mm4, mm5); /* wsptr[0,z11],[1,z11],[2,z11],[3,z11] */
+ movq_r2r (mm3, mm4);
- punpckldq_r2r(mm2, mm3); /* wsptr[0,z12],[1,z12],[2,z12],[3,z12] */
+ punpckhdq_r2r (mm2, mm4); /* wsptr[0,z13],[1,z13],[2,z13],[3,z13] */
+ movq_r2r (mm5, mm1);
+
+ punpckldq_r2r (mm2, mm3); /* wsptr[0,z12],[1,z12],[2,z12],[3,z12] */
/* tmp7 = z11 + z13; : phase 5 */
/* tmp8 = z11 - z13; : phase 5 */
- psubw_r2r(mm4, mm1); /* tmp8 */
+ psubw_r2r (mm4, mm1); /* tmp8 */
- paddw_r2r(mm4, mm5); /* tmp7 */
+ paddw_r2r (mm4, mm5); /* tmp7 */
/* tmp21 = MULTIPLY(tmp8, FIX_1_414213562); 2*c4 */
- psllw_i2r(2, mm1);
+ psllw_i2r (2, mm1);
- psllw_i2r(2, mm0);
+ psllw_i2r (2, mm0);
- pmulhw_m2r(fix_141, mm1); /* tmp21 */
+ pmulhw_m2r (fix_141, mm1); /* tmp21 */
/* tmp20 = MULTIPLY(z12, (FIX_1_082392200- FIX_1_847759065)) : 2*(c2-c6) */
/* + MULTIPLY(z10, - FIX_1_847759065); : 2*c2 */
- psllw_i2r(2, mm3);
- movq_r2r(mm0, mm7);
+ psllw_i2r (2, mm3);
+ movq_r2r (mm0, mm7);
- pmulhw_m2r(fix_n184, mm7);
- movq_r2r(mm3, mm6);
+ pmulhw_m2r (fix_n184, mm7);
+ movq_r2r (mm3, mm6);
- movq_m2r(*(wsptr), mm2); /* tmp0,final1 */
+ movq_m2r (*(wsptr), mm2); /* tmp0,final1 */
- pmulhw_m2r(fix_108n184, mm6);
+ pmulhw_m2r (fix_108n184, mm6);
/* tmp22 = MULTIPLY(z10,(FIX_1_847759065 - FIX_2_613125930)) : -2*(c2+c6) */
/* + MULTIPLY(z12, FIX_1_847759065); : 2*c2 */
- movq_r2r(mm2, mm4); /* final1 */
-
- pmulhw_m2r(fix_184n261, mm0);
- paddw_r2r(mm5, mm2); /* tmp0+tmp7,final1 */
+ movq_r2r (mm2, mm4); /* final1 */
+
+ pmulhw_m2r (fix_184n261, mm0);
+ paddw_r2r (mm5, mm2); /* tmp0+tmp7,final1 */
- pmulhw_m2r(fix_184, mm3);
- psubw_r2r(mm5, mm4); /* tmp0-tmp7,final1 */
+ pmulhw_m2r (fix_184, mm3);
+ psubw_r2r (mm5, mm4); /* tmp0-tmp7,final1 */
/* tmp6 = tmp22 - tmp7; phase 2 */
- psraw_i2r(3, mm2); /* outptr[0,0],[1,0],[2,0],[3,0],final1 */
+ psraw_i2r (3, mm2); /* outptr[0,0],[1,0],[2,0],[3,0],final1 */
- paddw_r2r(mm6, mm7); /* tmp20 */
- psraw_i2r(3, mm4); /* outptr[0,7],[1,7],[2,7],[3,7],final1 */
+ paddw_r2r (mm6, mm7); /* tmp20 */
+ psraw_i2r (3, mm4); /* outptr[0,7],[1,7],[2,7],[3,7],final1 */
- paddw_r2r(mm0, mm3); /* tmp22 */
+ paddw_r2r (mm0, mm3); /* tmp22 */
/* tmp5 = tmp21 - tmp6; */
- psubw_r2r(mm5, mm3); /* tmp6 */
+ psubw_r2r (mm5, mm3); /* tmp6 */
/* tmp4 = tmp20 + tmp5; */
- movq_m2r(*(wsptr+1), mm0); /* tmp1,final2 */
- psubw_r2r(mm3, mm1); /* tmp5 */
+ movq_m2r (*(wsptr + 1), mm0); /* tmp1,final2 */
+ psubw_r2r (mm3, mm1); /* tmp5 */
- movq_r2r(mm0, mm6); /* final2 */
- paddw_r2r(mm3, mm0); /* tmp1+tmp6,final2 */
+ movq_r2r (mm0, mm6); /* final2 */
+ paddw_r2r (mm3, mm0); /* tmp1+tmp6,final2 */
- /* Final output stage: scale down by a factor of 8 and range-limit */
+ /* Final output stage: scale down by a factor of 8 and range-limit */
/* outptr[0] = range_limit[IDESCALE(tmp0 + tmp7, PASS1_BITS+3) */
/* & RANGE_MASK]; */
@@ -2136,30 +2141,30 @@ static mmx_t fix_108n184 = (mmx_t)(long long)0xcf04cf04cf04cf04LL;
/* & RANGE_MASK]; */
/* outptr[6] = range_limit[IDESCALE(tmp1 - tmp6, PASS1_BITS+3) */
/* & RANGE_MASK]; final2 */
- psubw_r2r(mm3, mm6); /* tmp1-tmp6,final2 */
- psraw_i2r(3, mm0); /* outptr[0,1],[1,1],[2,1],[3,1] */
+ psubw_r2r (mm3, mm6); /* tmp1-tmp6,final2 */
+ psraw_i2r (3, mm0); /* outptr[0,1],[1,1],[2,1],[3,1] */
+
+ psraw_i2r (3, mm6); /* outptr[0,6],[1,6],[2,6],[3,6] */
+
+ packuswb_r2r (mm4, mm0); /* out[0,1],[1,1],[2,1],[3,1],[0,7],[1,7],[2,7],[3,7] */
- psraw_i2r(3, mm6); /* outptr[0,6],[1,6],[2,6],[3,6] */
-
- packuswb_r2r(mm4, mm0); /* out[0,1],[1,1],[2,1],[3,1],[0,7],[1,7],[2,7],[3,7] */
-
- movq_m2r(*(wsptr+2), mm5); /* tmp2,final3 */
- packuswb_r2r(mm6, mm2); /* out[0,0],[1,0],[2,0],[3,0],[0,6],[1,6],[2,6],[3,6] */
+ movq_m2r (*(wsptr + 2), mm5); /* tmp2,final3 */
+ packuswb_r2r (mm6, mm2); /* out[0,0],[1,0],[2,0],[3,0],[0,6],[1,6],[2,6],[3,6] */
/* outptr[2] = range_limit[IDESCALE(tmp2 + tmp5, PASS1_BITS+3) */
/* & RANGE_MASK]; */
/* outptr[5] = range_limit[IDESCALE(tmp2 - tmp5, PASS1_BITS+3) */
/* & RANGE_MASK]; final3 */
- paddw_r2r(mm1, mm7); /* tmp4 */
- movq_r2r(mm5, mm3);
+ paddw_r2r (mm1, mm7); /* tmp4 */
+ movq_r2r (mm5, mm3);
- paddw_r2r(mm1, mm5); /* tmp2+tmp5 */
- psubw_r2r(mm1, mm3); /* tmp2-tmp5 */
+ paddw_r2r (mm1, mm5); /* tmp2+tmp5 */
+ psubw_r2r (mm1, mm3); /* tmp2-tmp5 */
- psraw_i2r(3, mm5); /* outptr[0,2],[1,2],[2,2],[3,2] */
+ psraw_i2r (3, mm5); /* outptr[0,2],[1,2],[2,2],[3,2] */
- movq_m2r(*(wsptr+3), mm4); /* tmp3,final4 */
- psraw_i2r(3, mm3); /* outptr[0,5],[1,5],[2,5],[3,5] */
+ movq_m2r (*(wsptr + 3), mm4); /* tmp3,final4 */
+ psraw_i2r (3, mm3); /* outptr[0,5],[1,5],[2,5],[3,5] */
@@ -2167,68 +2172,68 @@ static mmx_t fix_108n184 = (mmx_t)(long long)0xcf04cf04cf04cf04LL;
/* & RANGE_MASK]; */
/* outptr[3] = range_limit[IDESCALE(tmp3 - tmp4, PASS1_BITS+3) */
/* & RANGE_MASK]; final4 */
- movq_r2r(mm4, mm6);
- paddw_r2r(mm7, mm4); /* tmp3+tmp4 */
+ movq_r2r (mm4, mm6);
+ paddw_r2r (mm7, mm4); /* tmp3+tmp4 */
- psubw_r2r(mm7, mm6); /* tmp3-tmp4 */
- psraw_i2r(3, mm4); /* outptr[0,4],[1,4],[2,4],[3,4] */
+ psubw_r2r (mm7, mm6); /* tmp3-tmp4 */
+ psraw_i2r (3, mm4); /* outptr[0,4],[1,4],[2,4],[3,4] */
- psraw_i2r(3, mm6); /* outptr[0,3],[1,3],[2,3],[3,3] */
+ psraw_i2r (3, mm6); /* outptr[0,3],[1,3],[2,3],[3,3] */
- /*
- movq_r2m(mm4, *dummy);
- fprintf(stderr, "3-4 %016llx\n", dummy);
- movq_r2m(mm4, *dummy);
- fprintf(stderr, "3+4 %016llx\n", dummy);
- */
-
+ /*
+ movq_r2m(mm4, *dummy);
+ fprintf(stderr, "3-4 %016llx\n", dummy);
+ movq_r2m(mm4, *dummy);
+ fprintf(stderr, "3+4 %016llx\n", dummy);
+ */
- packuswb_r2r(mm4, mm5); /* out[0,2],[1,2],[2,2],[3,2],[0,4],[1,4],[2,4],[3,4] */
- packuswb_r2r(mm3, mm6); /* out[0,3],[1,3],[2,3],[3,3],[0,5],[1,5],[2,5],[3,5] */
- movq_r2r(mm2, mm4);
+ packuswb_r2r (mm4, mm5); /* out[0,2],[1,2],[2,2],[3,2],[0,4],[1,4],[2,4],[3,4] */
- movq_r2r(mm5, mm7);
- punpcklbw_r2r(mm0, mm2); /* out[0,0],[0,1],[1,0],[1,1],[2,0],[2,1],[3,0],[3,1] */
+ packuswb_r2r (mm3, mm6); /* out[0,3],[1,3],[2,3],[3,3],[0,5],[1,5],[2,5],[3,5] */
+ movq_r2r (mm2, mm4);
- punpckhbw_r2r(mm0, mm4); /* out[0,6],[0,7],[1,6],[1,7],[2,6],[2,7],[3,6],[3,7] */
- movq_r2r(mm2, mm1);
+ movq_r2r (mm5, mm7);
+ punpcklbw_r2r (mm0, mm2); /* out[0,0],[0,1],[1,0],[1,1],[2,0],[2,1],[3,0],[3,1] */
- punpcklbw_r2r(mm6, mm5); /* out[0,2],[0,3],[1,2],[1,3],[2,2],[2,3],[3,2],[3,3] */
-
- punpckhbw_r2r(mm6, mm7); /* out[0,4],[0,5],[1,4],[1,5],[2,4],[2,5],[3,4],[3,5] */
+ punpckhbw_r2r (mm0, mm4); /* out[0,6],[0,7],[1,6],[1,7],[2,6],[2,7],[3,6],[3,7] */
+ movq_r2r (mm2, mm1);
- punpcklwd_r2r(mm5, mm2); /* out[0,0],[0,1],[0,2],[0,3],[1,0],[1,1],[1,2],[1,3] */
-
- movq_r2r(mm7, mm6);
- punpckhwd_r2r(mm5, mm1); /* out[2,0],[2,1],[2,2],[2,3],[3,0],[3,1],[3,2],[3,3] */
+ punpcklbw_r2r (mm6, mm5); /* out[0,2],[0,3],[1,2],[1,3],[2,2],[2,3],[3,2],[3,3] */
- movq_r2r(mm2, mm0);
- punpcklwd_r2r(mm4, mm6); /* out[0,4],[0,5],[0,6],[0,7],[1,4],[1,5],[1,6],[1,7] */
+ punpckhbw_r2r (mm6, mm7); /* out[0,4],[0,5],[1,4],[1,5],[2,4],[2,5],[3,4],[3,5] */
- punpckldq_r2r(mm6, mm2); /* out[0,0],[0,1],[0,2],[0,3],[0,4],[0,5],[0,6],[0,7] */
+ punpcklwd_r2r (mm5, mm2); /* out[0,0],[0,1],[0,2],[0,3],[1,0],[1,1],[1,2],[1,3] */
- movq_r2r(mm1, mm3);
+ movq_r2r (mm7, mm6);
+ punpckhwd_r2r (mm5, mm1); /* out[2,0],[2,1],[2,2],[2,3],[3,0],[3,1],[3,2],[3,3] */
- punpckhwd_r2r(mm4, mm7); /* out[2,4],[2,5],[2,6],[2,7],[3,4],[3,5],[3,6],[3,7] */
-
- dataptr += rskip;
- movq_r2m(mm2, *(dataptr));
+ movq_r2r (mm2, mm0);
+ punpcklwd_r2r (mm4, mm6); /* out[0,4],[0,5],[0,6],[0,7],[1,4],[1,5],[1,6],[1,7] */
- punpckhdq_r2r(mm6, mm0); /* out[1,0],[1,1],[1,2],[1,3],[1,4],[1,5],[1,6],[1,7] */
+ punpckldq_r2r (mm6, mm2); /* out[0,0],[0,1],[0,2],[0,3],[0,4],[0,5],[0,6],[0,7] */
- dataptr += rskip;
- movq_r2m(mm0, *(dataptr));
+ movq_r2r (mm1, mm3);
- punpckldq_r2r(mm7, mm1); /* out[2,0],[2,1],[2,2],[2,3],[2,4],[2,5],[2,6],[2,7] */
-
- punpckhdq_r2r(mm7, mm3); /* out[3,0],[3,1],[3,2],[3,3],[3,4],[3,5],[3,6],[3,7] */
+ punpckhwd_r2r (mm4, mm7); /* out[2,4],[2,5],[2,6],[2,7],[3,4],[3,5],[3,6],[3,7] */
- dataptr += rskip;
- movq_r2m(mm1, *(dataptr));
+ dataptr += rskip;
+ movq_r2m (mm2, *(dataptr));
- dataptr += rskip;
- movq_r2m(mm3, *(dataptr));
+ punpckhdq_r2r (mm6, mm0); /* out[1,0],[1,1],[1,2],[1,3],[1,4],[1,5],[1,6],[1,7] */
+
+ dataptr += rskip;
+ movq_r2m (mm0, *(dataptr));
+
+ punpckldq_r2r (mm7, mm1); /* out[2,0],[2,1],[2,2],[2,3],[2,4],[2,5],[2,6],[2,7] */
+
+ punpckhdq_r2r (mm7, mm3); /* out[3,0],[3,1],[3,2],[3,3],[3,4],[3,5],[3,6],[3,7] */
+
+ dataptr += rskip;
+ movq_r2m (mm1, *(dataptr));
+
+ dataptr += rskip;
+ movq_r2m (mm3, *(dataptr));
#else
__s32 tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
@@ -2244,9 +2249,9 @@ static mmx_t fix_108n184 = (mmx_t)(long long)0xcf04cf04cf04cf04LL;
inptr = data;
wsptr = workspace;
for (ctr = 8; ctr > 0; ctr--) {
-
+
if ((inptr[8] | inptr[16] | inptr[24] |
- inptr[32] | inptr[40] | inptr[48] | inptr[56]) == 0) {
+ inptr[32] | inptr[40] | inptr[48] | inptr[56]) == 0) {
dcval = inptr[0];
wsptr[0] = dcval;
wsptr[8] = dcval;
@@ -2256,12 +2261,12 @@ static mmx_t fix_108n184 = (mmx_t)(long long)0xcf04cf04cf04cf04LL;
wsptr[40] = dcval;
wsptr[48] = dcval;
wsptr[56] = dcval;
-
- inptr++;
+
+ inptr++;
wsptr++;
continue;
- }
-
+ }
+
tmp0 = inptr[0];
tmp1 = inptr[16];
tmp2 = inptr[32];
@@ -2271,13 +2276,13 @@ static mmx_t fix_108n184 = (mmx_t)(long long)0xcf04cf04cf04cf04LL;
tmp11 = tmp0 - tmp2;
tmp13 = tmp1 + tmp3;
- tmp12 = MULTIPLY(tmp1 - tmp3, FIX_1_414213562) - tmp13;
+ tmp12 = MULTIPLY (tmp1 - tmp3, FIX_1_414213562) - tmp13;
tmp0 = tmp10 + tmp13;
tmp3 = tmp10 - tmp13;
tmp1 = tmp11 + tmp12;
tmp2 = tmp11 - tmp12;
-
+
tmp4 = inptr[8];
tmp5 = inptr[24];
tmp6 = inptr[40];
@@ -2289,11 +2294,11 @@ static mmx_t fix_108n184 = (mmx_t)(long long)0xcf04cf04cf04cf04LL;
z12 = tmp4 - tmp7;
tmp7 = z11 + z13;
- tmp11 = MULTIPLY(z11 - z13, FIX_1_414213562);
+ tmp11 = MULTIPLY (z11 - z13, FIX_1_414213562);
- z5 = MULTIPLY(z10 + z12, FIX_1_847759065);
- tmp10 = MULTIPLY(z12, FIX_1_082392200) - z5;
- tmp12 = MULTIPLY(z10, - FIX_2_613125930) + z5;
+ z5 = MULTIPLY (z10 + z12, FIX_1_847759065);
+ tmp10 = MULTIPLY (z12, FIX_1_082392200) - z5;
+ tmp12 = MULTIPLY (z10, -FIX_2_613125930) + z5;
tmp6 = tmp12 - tmp7;
tmp5 = tmp11 - tmp6;
@@ -2314,13 +2319,13 @@ static mmx_t fix_108n184 = (mmx_t)(long long)0xcf04cf04cf04cf04LL;
wsptr = workspace;
for (ctr = 0; ctr < 8; ctr++) {
- outptr = &(odata[ctr*rskip]);
+ outptr = &(odata[ctr * rskip]);
tmp10 = wsptr[0] + wsptr[4];
tmp11 = wsptr[0] - wsptr[4];
tmp13 = wsptr[2] + wsptr[6];
- tmp12 = MULTIPLY(wsptr[2] - wsptr[6], FIX_1_414213562) - tmp13;
+ tmp12 = MULTIPLY (wsptr[2] - wsptr[6], FIX_1_414213562) - tmp13;
tmp0 = tmp10 + tmp13;
tmp3 = tmp10 - tmp13;
@@ -2333,29 +2338,30 @@ static mmx_t fix_108n184 = (mmx_t)(long long)0xcf04cf04cf04cf04LL;
z12 = wsptr[1] - wsptr[7];
tmp7 = z11 + z13;
- tmp11 = MULTIPLY(z11 - z13, FIX_1_414213562);
+ tmp11 = MULTIPLY (z11 - z13, FIX_1_414213562);
- z5 = MULTIPLY(z10 + z12, FIX_1_847759065);
- tmp10 = MULTIPLY(z12, FIX_1_082392200) - z5;
- tmp12 = MULTIPLY(z10, - FIX_2_613125930) + z5;
+ z5 = MULTIPLY (z10 + z12, FIX_1_847759065);
+ tmp10 = MULTIPLY (z12, FIX_1_082392200) - z5;
+ tmp12 = MULTIPLY (z10, -FIX_2_613125930) + z5;
tmp6 = tmp12 - tmp7;
tmp5 = tmp11 - tmp6;
tmp4 = tmp10 + tmp5;
- outptr[0] = RL(DESCALE(tmp0 + tmp7));
- outptr[7] = RL(DESCALE(tmp0 - tmp7));
- outptr[1] = RL(DESCALE(tmp1 + tmp6));
- outptr[6] = RL(DESCALE(tmp1 - tmp6));
- outptr[2] = RL(DESCALE(tmp2 + tmp5));
- outptr[5] = RL(DESCALE(tmp2 - tmp5));
- outptr[4] = RL(DESCALE(tmp3 + tmp4));
- outptr[3] = RL(DESCALE(tmp3 - tmp4));
+ outptr[0] = RL (DESCALE (tmp0 + tmp7));
+ outptr[7] = RL (DESCALE (tmp0 - tmp7));
+ outptr[1] = RL (DESCALE (tmp1 + tmp6));
+ outptr[6] = RL (DESCALE (tmp1 - tmp6));
+ outptr[2] = RL (DESCALE (tmp2 + tmp5));
+ outptr[5] = RL (DESCALE (tmp2 - tmp5));
+ outptr[4] = RL (DESCALE (tmp3 + tmp4));
+ outptr[3] = RL (DESCALE (tmp3 - tmp4));
wsptr += 8;
}
#endif
}
+
/*
Main Routines
@@ -2374,24 +2380,25 @@ Initialise all the cache-aliged data blocks
*/
-void RTjpeg_init_data(void)
+void
+RTjpeg_init_data (void)
{
- unsigned long dptr;
-
- dptr=(unsigned long)&(RTjpeg_alldata[0]);
- dptr+=32;
- dptr=dptr>>5;
- dptr=dptr<<5; /* cache align data */
-
- RTjpeg_block=(__s16 *)dptr;
- dptr+=sizeof(__s16)*64;
- RTjpeg_lqt=(__s32 *)dptr;
- dptr+=sizeof(__s32)*64;
- RTjpeg_cqt=(__s32 *)dptr;
- dptr+=sizeof(__s32)*64;
- RTjpeg_liqt=(__u32 *)dptr;
- dptr+=sizeof(__u32)*64;
- RTjpeg_ciqt=(__u32 *)dptr;
+ unsigned long dptr;
+
+ dptr = (unsigned long) &(RTjpeg_alldata[0]);
+ dptr += 32;
+ dptr = dptr >> 5;
+ dptr = dptr << 5; /* cache align data */
+
+ RTjpeg_block = (__s16 *) dptr;
+ dptr += sizeof (__s16) * 64;
+ RTjpeg_lqt = (__s32 *) dptr;
+ dptr += sizeof (__s32) * 64;
+ RTjpeg_cqt = (__s32 *) dptr;
+ dptr += sizeof (__s32) * 64;
+ RTjpeg_liqt = (__u32 *) dptr;
+ dptr += sizeof (__u32) * 64;
+ RTjpeg_ciqt = (__u32 *) dptr;
}
/*
@@ -2405,35 +2412,39 @@ Input: buf -> pointer to 128 ints for quant values store to pass back to
Q -> quality factor (192=best, 32=worst)
*/
-void RTjpeg_init_Q(__u8 Q)
+void
+RTjpeg_init_Q (__u8 Q)
{
- int i;
- __u64 qual;
-
- qual=(__u64)Q<<(32-7); /* 32 bit FP, 255=2, 0=0 */
-
- for(i=0; i<64; i++)
- {
- RTjpeg_lqt[i]=(__s32)((qual/((__u64)RTjpeg_lum_quant_tbl[i]<<16))>>3);
- if(RTjpeg_lqt[i]==0)RTjpeg_lqt[i]=1;
- RTjpeg_cqt[i]=(__s32)((qual/((__u64)RTjpeg_chrom_quant_tbl[i]<<16))>>3);
- if(RTjpeg_cqt[i]==0)RTjpeg_cqt[i]=1;
- RTjpeg_liqt[i]=(1<<16)/(RTjpeg_lqt[i]<<3);
- RTjpeg_ciqt[i]=(1<<16)/(RTjpeg_cqt[i]<<3);
- RTjpeg_lqt[i]=((1<<16)/RTjpeg_liqt[i])>>3;
- RTjpeg_cqt[i]=((1<<16)/RTjpeg_ciqt[i])>>3;
- }
-
- RTjpeg_lb8=0;
- while(RTjpeg_liqt[RTjpeg_ZZ[++RTjpeg_lb8]]<=8);
- RTjpeg_lb8--;
- RTjpeg_cb8=0;
- while(RTjpeg_ciqt[RTjpeg_ZZ[++RTjpeg_cb8]]<=8);
- RTjpeg_cb8--;
-
- RTjpeg_dct_init();
- RTjpeg_idct_init();
- RTjpeg_quant_init();
+ int i;
+ __u64 qual;
+
+ qual = (__u64) Q << (32 - 7); /* 32 bit FP, 255=2, 0=0 */
+
+ for (i = 0; i < 64; i++) {
+ RTjpeg_lqt[i] =
+ (__s32) ((qual / ((__u64) RTjpeg_lum_quant_tbl[i] << 16)) >> 3);
+ if (RTjpeg_lqt[i] == 0)
+ RTjpeg_lqt[i] = 1;
+ RTjpeg_cqt[i] =
+ (__s32) ((qual / ((__u64) RTjpeg_chrom_quant_tbl[i] << 16)) >> 3);
+ if (RTjpeg_cqt[i] == 0)
+ RTjpeg_cqt[i] = 1;
+ RTjpeg_liqt[i] = (1 << 16) / (RTjpeg_lqt[i] << 3);
+ RTjpeg_ciqt[i] = (1 << 16) / (RTjpeg_cqt[i] << 3);
+ RTjpeg_lqt[i] = ((1 << 16) / RTjpeg_liqt[i]) >> 3;
+ RTjpeg_cqt[i] = ((1 << 16) / RTjpeg_ciqt[i]) >> 3;
+ }
+
+ RTjpeg_lb8 = 0;
+ while (RTjpeg_liqt[RTjpeg_ZZ[++RTjpeg_lb8]] <= 8);
+ RTjpeg_lb8--;
+ RTjpeg_cb8 = 0;
+ while (RTjpeg_ciqt[RTjpeg_ZZ[++RTjpeg_cb8]] <= 8);
+ RTjpeg_cb8--;
+
+ RTjpeg_dct_init ();
+ RTjpeg_idct_init ();
+ RTjpeg_quant_init ();
}
/*
@@ -2450,337 +2461,338 @@ Input: buf -> pointer to 128 ints for quant values store to pass back to
*/
-void RTjpeg_init_compress(__u32 *buf, int width, int height, __u8 Q)
+void
+RTjpeg_init_compress (__u32 * buf, int width, int height, __u8 Q)
{
- int i;
- __u64 qual;
-
- RTjpeg_init_data();
-
- RTjpeg_width=width;
- RTjpeg_height=height;
- RTjpeg_Ywidth = RTjpeg_width>>3;
- RTjpeg_Ysize=width * height;
- RTjpeg_Cwidth = RTjpeg_width>>4;
- RTjpeg_Csize= (width>>1) * height;
-
- qual=(__u64)Q<<(32-7); /* 32 bit FP, 255=2, 0=0 */
-
- for(i=0; i<64; i++)
- {
- RTjpeg_lqt[i]=(__s32)((qual/((__u64)RTjpeg_lum_quant_tbl[i]<<16))>>3);
- if(RTjpeg_lqt[i]==0)RTjpeg_lqt[i]=1;
- RTjpeg_cqt[i]=(__s32)((qual/((__u64)RTjpeg_chrom_quant_tbl[i]<<16))>>3);
- if(RTjpeg_cqt[i]==0)RTjpeg_cqt[i]=1;
- RTjpeg_liqt[i]=(1<<16)/(RTjpeg_lqt[i]<<3);
- RTjpeg_ciqt[i]=(1<<16)/(RTjpeg_cqt[i]<<3);
- RTjpeg_lqt[i]=((1<<16)/RTjpeg_liqt[i])>>3;
- RTjpeg_cqt[i]=((1<<16)/RTjpeg_ciqt[i])>>3;
- }
-
- RTjpeg_lb8=0;
- while(RTjpeg_liqt[RTjpeg_ZZ[++RTjpeg_lb8]]<=8);
- RTjpeg_lb8--;
- RTjpeg_cb8=0;
- while(RTjpeg_ciqt[RTjpeg_ZZ[++RTjpeg_cb8]]<=8);
- RTjpeg_cb8--;
-
- RTjpeg_dct_init();
- RTjpeg_quant_init();
-
- for(i=0; i<64; i++)
- buf[i]=RTjpeg_liqt[i];
- for(i=0; i<64; i++)
- buf[64+i]=RTjpeg_ciqt[i];
+ int i;
+ __u64 qual;
+
+ RTjpeg_init_data ();
+
+ RTjpeg_width = width;
+ RTjpeg_height = height;
+ RTjpeg_Ywidth = RTjpeg_width >> 3;
+ RTjpeg_Ysize = width * height;
+ RTjpeg_Cwidth = RTjpeg_width >> 4;
+ RTjpeg_Csize = (width >> 1) * height;
+
+ qual = (__u64) Q << (32 - 7); /* 32 bit FP, 255=2, 0=0 */
+
+ for (i = 0; i < 64; i++) {
+ RTjpeg_lqt[i] =
+ (__s32) ((qual / ((__u64) RTjpeg_lum_quant_tbl[i] << 16)) >> 3);
+ if (RTjpeg_lqt[i] == 0)
+ RTjpeg_lqt[i] = 1;
+ RTjpeg_cqt[i] =
+ (__s32) ((qual / ((__u64) RTjpeg_chrom_quant_tbl[i] << 16)) >> 3);
+ if (RTjpeg_cqt[i] == 0)
+ RTjpeg_cqt[i] = 1;
+ RTjpeg_liqt[i] = (1 << 16) / (RTjpeg_lqt[i] << 3);
+ RTjpeg_ciqt[i] = (1 << 16) / (RTjpeg_cqt[i] << 3);
+ RTjpeg_lqt[i] = ((1 << 16) / RTjpeg_liqt[i]) >> 3;
+ RTjpeg_cqt[i] = ((1 << 16) / RTjpeg_ciqt[i]) >> 3;
+ }
+
+ RTjpeg_lb8 = 0;
+ while (RTjpeg_liqt[RTjpeg_ZZ[++RTjpeg_lb8]] <= 8);
+ RTjpeg_lb8--;
+ RTjpeg_cb8 = 0;
+ while (RTjpeg_ciqt[RTjpeg_ZZ[++RTjpeg_cb8]] <= 8);
+ RTjpeg_cb8--;
+
+ RTjpeg_dct_init ();
+ RTjpeg_quant_init ();
+
+ for (i = 0; i < 64; i++)
+ buf[i] = RTjpeg_liqt[i];
+ for (i = 0; i < 64; i++)
+ buf[64 + i] = RTjpeg_ciqt[i];
}
-void RTjpeg_init_decompress(__u32 *buf, int width, int height)
+void
+RTjpeg_init_decompress (__u32 * buf, int width, int height)
{
- int i;
-
- RTjpeg_init_data();
-
- RTjpeg_width=width;
- RTjpeg_height=height;
- RTjpeg_Ywidth = RTjpeg_width>>3;
- RTjpeg_Ysize=width * height;
- RTjpeg_Cwidth = RTjpeg_width>>4;
- RTjpeg_Csize= (width>>1) * height;
-
- for(i=0; i<64; i++)
- {
- RTjpeg_liqt[i]=buf[i];
- RTjpeg_ciqt[i]=buf[i+64];
- }
-
- RTjpeg_lb8=0;
- while(RTjpeg_liqt[RTjpeg_ZZ[++RTjpeg_lb8]]<=8);
- RTjpeg_lb8--;
- RTjpeg_cb8=0;
- while(RTjpeg_ciqt[RTjpeg_ZZ[++RTjpeg_cb8]]<=8);
- RTjpeg_cb8--;
-
- RTjpeg_idct_init();
+ int i;
+
+ RTjpeg_init_data ();
+
+ RTjpeg_width = width;
+ RTjpeg_height = height;
+ RTjpeg_Ywidth = RTjpeg_width >> 3;
+ RTjpeg_Ysize = width * height;
+ RTjpeg_Cwidth = RTjpeg_width >> 4;
+ RTjpeg_Csize = (width >> 1) * height;
+
+ for (i = 0; i < 64; i++) {
+ RTjpeg_liqt[i] = buf[i];
+ RTjpeg_ciqt[i] = buf[i + 64];
+ }
+
+ RTjpeg_lb8 = 0;
+ while (RTjpeg_liqt[RTjpeg_ZZ[++RTjpeg_lb8]] <= 8);
+ RTjpeg_lb8--;
+ RTjpeg_cb8 = 0;
+ while (RTjpeg_ciqt[RTjpeg_ZZ[++RTjpeg_cb8]] <= 8);
+ RTjpeg_cb8--;
+
+ RTjpeg_idct_init ();
/* RTjpeg_color_init(); */
}
-int RTjpeg_compressYUV420(__s8 *sp, unsigned char *bp)
+int
+RTjpeg_compressYUV420 (__s8 * sp, unsigned char *bp)
{
- __s8 * sb;
- register __s8 * bp1 = bp + (RTjpeg_width<<3);
- register __s8 * bp2 = bp + RTjpeg_Ysize;
- register __s8 * bp3 = bp2 + (RTjpeg_Csize>>1);
- register int i, j, k;
+ __s8 *sb;
+ register __s8 *bp1 = bp + (RTjpeg_width << 3);
+ register __s8 *bp2 = bp + RTjpeg_Ysize;
+ register __s8 *bp3 = bp2 + (RTjpeg_Csize >> 1);
+ register int i, j, k;
#ifdef HAVE_LIBMMX
- emms();
+ emms ();
#endif
- sb=sp;
+ sb = sp;
/* Y */
- for(i=RTjpeg_height>>1; i; i-=8)
- {
- for(j=0, k=0; j<RTjpeg_width; j+=16, k+=8)
- {
- RTjpeg_dctY(bp+j, RTjpeg_block, RTjpeg_Ywidth);
- RTjpeg_quant(RTjpeg_block, RTjpeg_lqt);
- sp+=RTjpeg_b2s(RTjpeg_block, sp, RTjpeg_lb8);
-
- RTjpeg_dctY(bp+j+8, RTjpeg_block, RTjpeg_Ywidth);
- RTjpeg_quant(RTjpeg_block, RTjpeg_lqt);
- sp+=RTjpeg_b2s(RTjpeg_block, sp, RTjpeg_lb8);
-
- RTjpeg_dctY(bp1+j, RTjpeg_block, RTjpeg_Ywidth);
- RTjpeg_quant(RTjpeg_block, RTjpeg_lqt);
- sp+=RTjpeg_b2s(RTjpeg_block, sp, RTjpeg_lb8);
-
- RTjpeg_dctY(bp1+j+8, RTjpeg_block, RTjpeg_Ywidth);
- RTjpeg_quant(RTjpeg_block, RTjpeg_lqt);
- sp+=RTjpeg_b2s(RTjpeg_block, sp, RTjpeg_lb8);
-
- RTjpeg_dctY(bp2+k, RTjpeg_block, RTjpeg_Cwidth);
- RTjpeg_quant(RTjpeg_block, RTjpeg_cqt);
- sp+=RTjpeg_b2s(RTjpeg_block, sp, RTjpeg_cb8);
-
- RTjpeg_dctY(bp3+k, RTjpeg_block, RTjpeg_Cwidth);
- RTjpeg_quant(RTjpeg_block, RTjpeg_cqt);
- sp+=RTjpeg_b2s(RTjpeg_block, sp, RTjpeg_cb8);
+ for (i = RTjpeg_height >> 1; i; i -= 8) {
+ for (j = 0, k = 0; j < RTjpeg_width; j += 16, k += 8) {
+ RTjpeg_dctY (bp + j, RTjpeg_block, RTjpeg_Ywidth);
+ RTjpeg_quant (RTjpeg_block, RTjpeg_lqt);
+ sp += RTjpeg_b2s (RTjpeg_block, sp, RTjpeg_lb8);
+
+ RTjpeg_dctY (bp + j + 8, RTjpeg_block, RTjpeg_Ywidth);
+ RTjpeg_quant (RTjpeg_block, RTjpeg_lqt);
+ sp += RTjpeg_b2s (RTjpeg_block, sp, RTjpeg_lb8);
+
+ RTjpeg_dctY (bp1 + j, RTjpeg_block, RTjpeg_Ywidth);
+ RTjpeg_quant (RTjpeg_block, RTjpeg_lqt);
+ sp += RTjpeg_b2s (RTjpeg_block, sp, RTjpeg_lb8);
+
+ RTjpeg_dctY (bp1 + j + 8, RTjpeg_block, RTjpeg_Ywidth);
+ RTjpeg_quant (RTjpeg_block, RTjpeg_lqt);
+ sp += RTjpeg_b2s (RTjpeg_block, sp, RTjpeg_lb8);
+
+ RTjpeg_dctY (bp2 + k, RTjpeg_block, RTjpeg_Cwidth);
+ RTjpeg_quant (RTjpeg_block, RTjpeg_cqt);
+ sp += RTjpeg_b2s (RTjpeg_block, sp, RTjpeg_cb8);
+
+ RTjpeg_dctY (bp3 + k, RTjpeg_block, RTjpeg_Cwidth);
+ RTjpeg_quant (RTjpeg_block, RTjpeg_cqt);
+ sp += RTjpeg_b2s (RTjpeg_block, sp, RTjpeg_cb8);
+
+ }
+ bp += RTjpeg_width << 4;
+ bp1 += RTjpeg_width << 4;
+ bp2 += RTjpeg_width << 2;
+ bp3 += RTjpeg_width << 2;
}
- bp+=RTjpeg_width<<4;
- bp1+=RTjpeg_width<<4;
- bp2+=RTjpeg_width<<2;
- bp3+=RTjpeg_width<<2;
-
- }
#ifdef HAVE_LIBMMX
- emms();
+ emms ();
#endif
- return (sp-sb);
+ return (sp - sb);
}
-int RTjpeg_compressYUV422(__s8 *sp, unsigned char *bp)
+int
+RTjpeg_compressYUV422 (__s8 * sp, unsigned char *bp)
{
- __s8 * sb;
- register __s8 * bp2 = bp + RTjpeg_Ysize;
- register __s8 * bp3 = bp2 + RTjpeg_Csize;
- register int i, j, k;
+ __s8 *sb;
+ register __s8 *bp2 = bp + RTjpeg_Ysize;
+ register __s8 *bp3 = bp2 + RTjpeg_Csize;
+ register int i, j, k;
#ifdef HAVE_LIBMMX
- emms();
+ emms ();
#endif
- sb=sp;
+ sb = sp;
/* Y */
- for(i=RTjpeg_height; i; i-=8)
- {
- for(j=0, k=0; j<RTjpeg_width; j+=16, k+=8)
- {
- RTjpeg_dctY(bp+j, RTjpeg_block, RTjpeg_Ywidth);
- RTjpeg_quant(RTjpeg_block, RTjpeg_lqt);
- sp+=RTjpeg_b2s(RTjpeg_block, sp, RTjpeg_lb8);
-
- RTjpeg_dctY(bp+j+8, RTjpeg_block, RTjpeg_Ywidth);
- RTjpeg_quant(RTjpeg_block, RTjpeg_lqt);
- sp+=RTjpeg_b2s(RTjpeg_block, sp, RTjpeg_lb8);
-
- RTjpeg_dctY(bp2+k, RTjpeg_block, RTjpeg_Cwidth);
- RTjpeg_quant(RTjpeg_block, RTjpeg_cqt);
- sp+=RTjpeg_b2s(RTjpeg_block, sp, RTjpeg_cb8);
-
- RTjpeg_dctY(bp3+k, RTjpeg_block, RTjpeg_Cwidth);
- RTjpeg_quant(RTjpeg_block, RTjpeg_cqt);
- sp+=RTjpeg_b2s(RTjpeg_block, sp, RTjpeg_cb8);
+ for (i = RTjpeg_height; i; i -= 8) {
+ for (j = 0, k = 0; j < RTjpeg_width; j += 16, k += 8) {
+ RTjpeg_dctY (bp + j, RTjpeg_block, RTjpeg_Ywidth);
+ RTjpeg_quant (RTjpeg_block, RTjpeg_lqt);
+ sp += RTjpeg_b2s (RTjpeg_block, sp, RTjpeg_lb8);
+
+ RTjpeg_dctY (bp + j + 8, RTjpeg_block, RTjpeg_Ywidth);
+ RTjpeg_quant (RTjpeg_block, RTjpeg_lqt);
+ sp += RTjpeg_b2s (RTjpeg_block, sp, RTjpeg_lb8);
+
+ RTjpeg_dctY (bp2 + k, RTjpeg_block, RTjpeg_Cwidth);
+ RTjpeg_quant (RTjpeg_block, RTjpeg_cqt);
+ sp += RTjpeg_b2s (RTjpeg_block, sp, RTjpeg_cb8);
+
+ RTjpeg_dctY (bp3 + k, RTjpeg_block, RTjpeg_Cwidth);
+ RTjpeg_quant (RTjpeg_block, RTjpeg_cqt);
+ sp += RTjpeg_b2s (RTjpeg_block, sp, RTjpeg_cb8);
+
+ }
+ bp += RTjpeg_width << 3;
+ bp2 += RTjpeg_width << 2;
+ bp3 += RTjpeg_width << 2;
}
- bp+=RTjpeg_width<<3;
- bp2+=RTjpeg_width<<2;
- bp3+=RTjpeg_width<<2;
-
- }
#ifdef HAVE_LIBMMX
- emms();
+ emms ();
#endif
- return (sp-sb);
+ return (sp - sb);
}
-int RTjpeg_compress8(__s8 *sp, unsigned char *bp)
+int
+RTjpeg_compress8 (__s8 * sp, unsigned char *bp)
{
- __s8 * sb;
- int i, j;
+ __s8 *sb;
+ int i, j;
#ifdef HAVE_LIBMMX
- emms();
+ emms ();
#endif
-
- sb=sp;
+
+ sb = sp;
/* Y */
- for(i=0; i<RTjpeg_height; i+=8)
- {
- for(j=0; j<RTjpeg_width; j+=8)
- {
- RTjpeg_dctY(bp+j, RTjpeg_block, RTjpeg_width);
- RTjpeg_quant(RTjpeg_block, RTjpeg_lqt);
- sp+=RTjpeg_b2s(RTjpeg_block, sp, RTjpeg_lb8);
+ for (i = 0; i < RTjpeg_height; i += 8) {
+ for (j = 0; j < RTjpeg_width; j += 8) {
+ RTjpeg_dctY (bp + j, RTjpeg_block, RTjpeg_width);
+ RTjpeg_quant (RTjpeg_block, RTjpeg_lqt);
+ sp += RTjpeg_b2s (RTjpeg_block, sp, RTjpeg_lb8);
+ }
+ bp += RTjpeg_width;
}
- bp+=RTjpeg_width;
- }
#ifdef HAVE_LIBMMX
- emms();
+ emms ();
#endif
- return (sp-sb);
+ return (sp - sb);
}
-void RTjpeg_decompressYUV422(__s8 *sp, __u8 *bp)
+void
+RTjpeg_decompressYUV422 (__s8 * sp, __u8 * bp)
{
- register __s8 * bp2 = bp + RTjpeg_Ysize;
- register __s8 * bp3 = bp2 + (RTjpeg_Csize);
- int i, j,k;
+ register __s8 *bp2 = bp + RTjpeg_Ysize;
+ register __s8 *bp3 = bp2 + (RTjpeg_Csize);
+ int i, j, k;
#ifdef HAVE_LIBMMX
- emms();
+ emms ();
#endif
/* Y */
- for(i=RTjpeg_height; i; i-=8)
- {
- for(k=0, j=0; j<RTjpeg_width; j+=16, k+=8) {
- if(*sp==-1)sp++;
- else
- {
- sp+=RTjpeg_s2b(RTjpeg_block, sp, RTjpeg_lb8, RTjpeg_liqt);
- RTjpeg_idct(bp+j, RTjpeg_block, RTjpeg_width);
- }
- if(*sp==-1)sp++;
- else
- {
- sp+=RTjpeg_s2b(RTjpeg_block, sp, RTjpeg_lb8, RTjpeg_liqt);
- RTjpeg_idct(bp+j+8, RTjpeg_block, RTjpeg_width);
- }
- if(*sp==-1)sp++;
- else
- {
- sp+=RTjpeg_s2b(RTjpeg_block, sp, RTjpeg_cb8, RTjpeg_ciqt);
- RTjpeg_idct(bp2+k, RTjpeg_block, RTjpeg_width>>1);
- }
- if(*sp==-1)sp++;
- else
- {
- sp+=RTjpeg_s2b(RTjpeg_block, sp, RTjpeg_cb8, RTjpeg_ciqt);
- RTjpeg_idct(bp3+k, RTjpeg_block, RTjpeg_width>>1);
- }
+ for (i = RTjpeg_height; i; i -= 8) {
+ for (k = 0, j = 0; j < RTjpeg_width; j += 16, k += 8) {
+ if (*sp == -1)
+ sp++;
+ else {
+ sp += RTjpeg_s2b (RTjpeg_block, sp, RTjpeg_lb8, RTjpeg_liqt);
+ RTjpeg_idct (bp + j, RTjpeg_block, RTjpeg_width);
+ }
+ if (*sp == -1)
+ sp++;
+ else {
+ sp += RTjpeg_s2b (RTjpeg_block, sp, RTjpeg_lb8, RTjpeg_liqt);
+ RTjpeg_idct (bp + j + 8, RTjpeg_block, RTjpeg_width);
+ }
+ if (*sp == -1)
+ sp++;
+ else {
+ sp += RTjpeg_s2b (RTjpeg_block, sp, RTjpeg_cb8, RTjpeg_ciqt);
+ RTjpeg_idct (bp2 + k, RTjpeg_block, RTjpeg_width >> 1);
+ }
+ if (*sp == -1)
+ sp++;
+ else {
+ sp += RTjpeg_s2b (RTjpeg_block, sp, RTjpeg_cb8, RTjpeg_ciqt);
+ RTjpeg_idct (bp3 + k, RTjpeg_block, RTjpeg_width >> 1);
+ }
+ }
+ bp += RTjpeg_width << 3;
+ bp2 += RTjpeg_width << 2;
+ bp3 += RTjpeg_width << 2;
}
- bp+=RTjpeg_width<<3;
- bp2+=RTjpeg_width<<2;
- bp3+=RTjpeg_width<<2;
- }
#ifdef HAVE_LIBMMX
- emms();
+ emms ();
#endif
}
-void RTjpeg_decompressYUV420(__s8 *sp, __u8 *bp)
+void
+RTjpeg_decompressYUV420 (__s8 * sp, __u8 * bp)
{
- register __s8 * bp1 = bp + (RTjpeg_width<<3);
- register __s8 * bp2 = bp + RTjpeg_Ysize;
- register __s8 * bp3 = bp2 + (RTjpeg_Csize>>1);
- int i, j,k;
+ register __s8 *bp1 = bp + (RTjpeg_width << 3);
+ register __s8 *bp2 = bp + RTjpeg_Ysize;
+ register __s8 *bp3 = bp2 + (RTjpeg_Csize >> 1);
+ int i, j, k;
#ifdef HAVE_LIBMMX
- emms();
+ emms ();
#endif
/* Y */
- for(i=RTjpeg_height>>1; i; i-=8)
- {
- for(k=0, j=0; j<RTjpeg_width; j+=16, k+=8) {
- if(*sp==-1)sp++;
- else
- {
- sp+=RTjpeg_s2b(RTjpeg_block, sp, RTjpeg_lb8, RTjpeg_liqt);
- RTjpeg_idct(bp+j, RTjpeg_block, RTjpeg_width);
- }
- if(*sp==-1)sp++;
- else
- {
- sp+=RTjpeg_s2b(RTjpeg_block, sp, RTjpeg_lb8, RTjpeg_liqt);
- RTjpeg_idct(bp+j+8, RTjpeg_block, RTjpeg_width);
- }
- if(*sp==-1)sp++;
- else
- {
- sp+=RTjpeg_s2b(RTjpeg_block, sp, RTjpeg_lb8, RTjpeg_liqt);
- RTjpeg_idct(bp1+j, RTjpeg_block, RTjpeg_width);
- }
- if(*sp==-1)sp++;
- else
- {
- sp+=RTjpeg_s2b(RTjpeg_block, sp, RTjpeg_lb8, RTjpeg_liqt);
- RTjpeg_idct(bp1+j+8, RTjpeg_block, RTjpeg_width);
- }
- if(*sp==-1)sp++;
- else
- {
- sp+=RTjpeg_s2b(RTjpeg_block, sp, RTjpeg_cb8, RTjpeg_ciqt);
- RTjpeg_idct(bp2+k, RTjpeg_block, RTjpeg_width>>1);
- }
- if(*sp==-1)sp++;
- else
- {
- sp+=RTjpeg_s2b(RTjpeg_block, sp, RTjpeg_cb8, RTjpeg_ciqt);
- RTjpeg_idct(bp3+k, RTjpeg_block, RTjpeg_width>>1);
- }
+ for (i = RTjpeg_height >> 1; i; i -= 8) {
+ for (k = 0, j = 0; j < RTjpeg_width; j += 16, k += 8) {
+ if (*sp == -1)
+ sp++;
+ else {
+ sp += RTjpeg_s2b (RTjpeg_block, sp, RTjpeg_lb8, RTjpeg_liqt);
+ RTjpeg_idct (bp + j, RTjpeg_block, RTjpeg_width);
+ }
+ if (*sp == -1)
+ sp++;
+ else {
+ sp += RTjpeg_s2b (RTjpeg_block, sp, RTjpeg_lb8, RTjpeg_liqt);
+ RTjpeg_idct (bp + j + 8, RTjpeg_block, RTjpeg_width);
+ }
+ if (*sp == -1)
+ sp++;
+ else {
+ sp += RTjpeg_s2b (RTjpeg_block, sp, RTjpeg_lb8, RTjpeg_liqt);
+ RTjpeg_idct (bp1 + j, RTjpeg_block, RTjpeg_width);
+ }
+ if (*sp == -1)
+ sp++;
+ else {
+ sp += RTjpeg_s2b (RTjpeg_block, sp, RTjpeg_lb8, RTjpeg_liqt);
+ RTjpeg_idct (bp1 + j + 8, RTjpeg_block, RTjpeg_width);
+ }
+ if (*sp == -1)
+ sp++;
+ else {
+ sp += RTjpeg_s2b (RTjpeg_block, sp, RTjpeg_cb8, RTjpeg_ciqt);
+ RTjpeg_idct (bp2 + k, RTjpeg_block, RTjpeg_width >> 1);
+ }
+ if (*sp == -1)
+ sp++;
+ else {
+ sp += RTjpeg_s2b (RTjpeg_block, sp, RTjpeg_cb8, RTjpeg_ciqt);
+ RTjpeg_idct (bp3 + k, RTjpeg_block, RTjpeg_width >> 1);
+ }
+ }
+ bp += RTjpeg_width << 4;
+ bp1 += RTjpeg_width << 4;
+ bp2 += RTjpeg_width << 2;
+ bp3 += RTjpeg_width << 2;
}
- bp+=RTjpeg_width<<4;
- bp1+=RTjpeg_width<<4;
- bp2+=RTjpeg_width<<2;
- bp3+=RTjpeg_width<<2;
- }
#ifdef HAVE_LIBMMX
- emms();
+ emms ();
#endif
}
-void RTjpeg_decompress8(__s8 *sp, __u8 *bp)
+void
+RTjpeg_decompress8 (__s8 * sp, __u8 * bp)
{
- int i, j;
+ int i, j;
#ifdef HAVE_LIBMMX
- emms();
+ emms ();
#endif
/* Y */
- for(i=0; i<RTjpeg_height; i+=8)
- {
- for(j=0; j<RTjpeg_width; j+=8)
- if(*sp==-1)sp++;
- else
- {
- sp+=RTjpeg_s2b(RTjpeg_block, sp, RTjpeg_lb8, RTjpeg_liqt);
- RTjpeg_idct(bp+j, RTjpeg_block, RTjpeg_width);
- }
- bp+=RTjpeg_width<<3;
- }
+ for (i = 0; i < RTjpeg_height; i += 8) {
+ for (j = 0; j < RTjpeg_width; j += 8)
+ if (*sp == -1)
+ sp++;
+ else {
+ sp += RTjpeg_s2b (RTjpeg_block, sp, RTjpeg_lb8, RTjpeg_liqt);
+ RTjpeg_idct (bp + j, RTjpeg_block, RTjpeg_width);
+ }
+ bp += RTjpeg_width << 3;
+ }
}
/*
@@ -2790,211 +2802,213 @@ Initialise additional data structures for motion compensation
*/
-void RTjpeg_init_mcompress(void)
+void
+RTjpeg_init_mcompress (void)
{
- unsigned long tmp;
-
- if(!RTjpeg_old)
- {
- RTjpeg_old=malloc((4*RTjpeg_width*RTjpeg_height)+32);
- tmp=(unsigned long)RTjpeg_old;
- tmp+=32;
- tmp=tmp>>5;
- RTjpeg_old=(__s16 *)(tmp<<5);
- }
- if (!RTjpeg_old)
- {
- fprintf(stderr, "RTjpeg: Could not allocate memory\n");
- exit(-1);
- }
- memset (RTjpeg_old, 0, ((4*RTjpeg_width*RTjpeg_height)));
+ unsigned long tmp;
+
+ if (!RTjpeg_old) {
+ RTjpeg_old = malloc ((4 * RTjpeg_width * RTjpeg_height) + 32);
+ tmp = (unsigned long) RTjpeg_old;
+ tmp += 32;
+ tmp = tmp >> 5;
+ RTjpeg_old = (__s16 *) (tmp << 5);
+ }
+ if (!RTjpeg_old) {
+ fprintf (stderr, "RTjpeg: Could not allocate memory\n");
+ exit (-1);
+ }
+ memset (RTjpeg_old, 0, ((4 * RTjpeg_width * RTjpeg_height)));
}
#ifdef HAVE_LIBMMX
-int RTjpeg_bcomp(__s16 *old, mmx_t *mask)
+int
+RTjpeg_bcomp (__s16 * old, mmx_t * mask)
{
- int i;
- mmx_t *mold=(mmx_t *)old;
- mmx_t *mblock=(mmx_t *)RTjpeg_block;
- mmx_t result;
- static mmx_t neg=(mmx_t)(unsigned long long)0xffffffffffffffffULL;
-
- movq_m2r(*mask, mm7);
- movq_m2r(neg, mm6);
- pxor_r2r(mm5, mm5);
-
- for(i=0; i<8; i++)
- {
- movq_m2r(*(mblock++), mm0);
- movq_m2r(*(mblock++), mm2);
- movq_m2r(*(mold++), mm1);
- movq_m2r(*(mold++), mm3);
- psubsw_r2r(mm1, mm0);
- psubsw_r2r(mm3, mm2);
- movq_r2r(mm0, mm1);
- movq_r2r(mm2, mm3);
- pcmpgtw_r2r(mm7, mm0);
- pcmpgtw_r2r(mm7, mm2);
- pxor_r2r(mm6, mm1);
- pxor_r2r(mm6, mm3);
- pcmpgtw_r2r(mm7, mm1);
- pcmpgtw_r2r(mm7, mm3);
- por_r2r(mm0, mm5);
- por_r2r(mm2, mm5);
- por_r2r(mm1, mm5);
- por_r2r(mm3, mm5);
- }
- movq_r2m(mm5, result);
-
- if(result.q)
- {
- if(!RTjpeg_mtest)
- for(i=0; i<16; i++)((__u64 *)old)[i]=((__u64 *)RTjpeg_block)[i];
- return 0;
- }
+ int i;
+ mmx_t *mold = (mmx_t *) old;
+ mmx_t *mblock = (mmx_t *) RTjpeg_block;
+ mmx_t result;
+ static mmx_t neg = (mmx_t) (unsigned long long) 0xffffffffffffffffULL;
+
+ movq_m2r (*mask, mm7);
+ movq_m2r (neg, mm6);
+ pxor_r2r (mm5, mm5);
+
+ for (i = 0; i < 8; i++) {
+ movq_m2r (*(mblock++), mm0);
+ movq_m2r (*(mblock++), mm2);
+ movq_m2r (*(mold++), mm1);
+ movq_m2r (*(mold++), mm3);
+ psubsw_r2r (mm1, mm0);
+ psubsw_r2r (mm3, mm2);
+ movq_r2r (mm0, mm1);
+ movq_r2r (mm2, mm3);
+ pcmpgtw_r2r (mm7, mm0);
+ pcmpgtw_r2r (mm7, mm2);
+ pxor_r2r (mm6, mm1);
+ pxor_r2r (mm6, mm3);
+ pcmpgtw_r2r (mm7, mm1);
+ pcmpgtw_r2r (mm7, mm3);
+ por_r2r (mm0, mm5);
+ por_r2r (mm2, mm5);
+ por_r2r (mm1, mm5);
+ por_r2r (mm3, mm5);
+ }
+ movq_r2m (mm5, result);
+
+ if (result.q) {
+ if (!RTjpeg_mtest)
+ for (i = 0; i < 16; i++)
+ ((__u64 *) old)[i] = ((__u64 *) RTjpeg_block)[i];
+ return 0;
+ }
/* printf("."); */
- return 1;
+ return 1;
}
#else
-int RTjpeg_bcomp(__s16 *old, __u16 *mask)
+int
+RTjpeg_bcomp (__s16 * old, __u16 * mask)
{
- int i;
-
- for(i=0; i<64; i++)
- if(abs(old[i]-RTjpeg_block[i])>*mask)
- {
- if(!RTjpeg_mtest)
- for(i=0; i<16; i++)((__u64 *)old)[i]=((__u64 *)RTjpeg_block)[i];
- return 0;
- }
- return 1;
+ int i;
+
+ for (i = 0; i < 64; i++)
+ if (abs (old[i] - RTjpeg_block[i]) > *mask) {
+ if (!RTjpeg_mtest)
+ for (i = 0; i < 16; i++)
+ ((__u64 *) old)[i] = ((__u64 *) RTjpeg_block)[i];
+ return 0;
+ }
+ return 1;
}
#endif
-void RTjpeg_set_test(int i)
+void
+RTjpeg_set_test (int i)
{
- RTjpeg_mtest=i;
+ RTjpeg_mtest = i;
}
-int RTjpeg_mcompress(__s8 *sp, unsigned char *bp, __u16 lmask, __u16 cmask)
+int
+RTjpeg_mcompress (__s8 * sp, unsigned char *bp, __u16 lmask, __u16 cmask)
{
- __s8 * sb;
- __s16 *block;
- register __s8 * bp2;
- register __s8 * bp3;
- register int i, j, k;
+ __s8 *sb;
+ __s16 *block;
+ register __s8 *bp2;
+ register __s8 *bp3;
+ register int i, j, k;
#ifdef HAVE_LIBMMX
- emms();
- RTjpeg_lmask=(mmx_t)(((__u64)lmask<<48)|((__u64)lmask<<32)|((__u64)lmask<<16)|lmask);
- RTjpeg_cmask=(mmx_t)(((__u64)cmask<<48)|((__u64)cmask<<32)|((__u64)cmask<<16)|cmask);
+ emms ();
+ RTjpeg_lmask =
+ (mmx_t) (((__u64) lmask << 48) | ((__u64) lmask << 32) | ((__u64) lmask <<
+ 16) | lmask);
+ RTjpeg_cmask =
+ (mmx_t) (((__u64) cmask << 48) | ((__u64) cmask << 32) | ((__u64) cmask <<
+ 16) | cmask);
#else
- RTjpeg_lmask=lmask;
- RTjpeg_cmask=cmask;
+ RTjpeg_lmask = lmask;
+ RTjpeg_cmask = cmask;
#endif
-
- bp = bp - RTjpeg_width*0;
- bp2 = bp + RTjpeg_Ysize-RTjpeg_width*0;
- bp3 = bp2 + RTjpeg_Csize;
- sb=sp;
- block=RTjpeg_old;
-/* Y */
- for(i=RTjpeg_height; i; i-=8)
- {
- for(j=0, k=0; j<RTjpeg_width; j+=16, k+=8)
- {
- RTjpeg_dctY(bp+j, RTjpeg_block, RTjpeg_Ywidth);
- RTjpeg_quant(RTjpeg_block, RTjpeg_lqt);
- if(RTjpeg_bcomp(block, &RTjpeg_lmask))
- {
- *((__u8 *)sp++)=255;
- }
- else sp+=RTjpeg_b2s(RTjpeg_block, sp, RTjpeg_lb8);
- block+=64;
-
- RTjpeg_dctY(bp+j+8, RTjpeg_block, RTjpeg_Ywidth);
- RTjpeg_quant(RTjpeg_block, RTjpeg_lqt);
- if(RTjpeg_bcomp(block, &RTjpeg_lmask))
- {
- *((__u8 *)sp++)=255;
- }
- else sp+=RTjpeg_b2s(RTjpeg_block, sp, RTjpeg_lb8);
- block+=64;
-
- RTjpeg_dctY(bp2+k, RTjpeg_block, RTjpeg_Cwidth);
- RTjpeg_quant(RTjpeg_block, RTjpeg_cqt);
- if(RTjpeg_bcomp(block, &RTjpeg_cmask))
- {
- *((__u8 *)sp++)=255;
- }
- else sp+=RTjpeg_b2s(RTjpeg_block, sp, RTjpeg_cb8);
- block+=64;
-
- RTjpeg_dctY(bp3+k, RTjpeg_block, RTjpeg_Cwidth);
- RTjpeg_quant(RTjpeg_block, RTjpeg_cqt);
- if(RTjpeg_bcomp(block, &RTjpeg_cmask))
- {
- *((__u8 *)sp++)=255;
- }
- else sp+=RTjpeg_b2s(RTjpeg_block, sp, RTjpeg_cb8);
- block+=64;
+ bp = bp - RTjpeg_width * 0;
+ bp2 = bp + RTjpeg_Ysize - RTjpeg_width * 0;
+ bp3 = bp2 + RTjpeg_Csize;
+ sb = sp;
+ block = RTjpeg_old;
+/* Y */
+ for (i = RTjpeg_height; i; i -= 8) {
+ for (j = 0, k = 0; j < RTjpeg_width; j += 16, k += 8) {
+ RTjpeg_dctY (bp + j, RTjpeg_block, RTjpeg_Ywidth);
+ RTjpeg_quant (RTjpeg_block, RTjpeg_lqt);
+ if (RTjpeg_bcomp (block, &RTjpeg_lmask)) {
+ *((__u8 *) sp++) = 255;
+ } else
+ sp += RTjpeg_b2s (RTjpeg_block, sp, RTjpeg_lb8);
+ block += 64;
+
+ RTjpeg_dctY (bp + j + 8, RTjpeg_block, RTjpeg_Ywidth);
+ RTjpeg_quant (RTjpeg_block, RTjpeg_lqt);
+ if (RTjpeg_bcomp (block, &RTjpeg_lmask)) {
+ *((__u8 *) sp++) = 255;
+ } else
+ sp += RTjpeg_b2s (RTjpeg_block, sp, RTjpeg_lb8);
+ block += 64;
+
+ RTjpeg_dctY (bp2 + k, RTjpeg_block, RTjpeg_Cwidth);
+ RTjpeg_quant (RTjpeg_block, RTjpeg_cqt);
+ if (RTjpeg_bcomp (block, &RTjpeg_cmask)) {
+ *((__u8 *) sp++) = 255;
+ } else
+ sp += RTjpeg_b2s (RTjpeg_block, sp, RTjpeg_cb8);
+ block += 64;
+
+ RTjpeg_dctY (bp3 + k, RTjpeg_block, RTjpeg_Cwidth);
+ RTjpeg_quant (RTjpeg_block, RTjpeg_cqt);
+ if (RTjpeg_bcomp (block, &RTjpeg_cmask)) {
+ *((__u8 *) sp++) = 255;
+ } else
+ sp += RTjpeg_b2s (RTjpeg_block, sp, RTjpeg_cb8);
+ block += 64;
+
+ }
+ bp += RTjpeg_width << 3;
+ bp2 += RTjpeg_width << 2;
+ bp3 += RTjpeg_width << 2;
}
- bp+=RTjpeg_width<<3;
- bp2+=RTjpeg_width<<2;
- bp3+=RTjpeg_width<<2;
- }
- /*printf ("%d\n", block - RTjpeg_old); */
+ /*printf ("%d\n", block - RTjpeg_old); */
#ifdef HAVE_LIBMMX
- emms();
+ emms ();
#endif
- return (sp-sb);
+ return (sp - sb);
}
-int RTjpeg_mcompress8(__s8 *sp, unsigned char *bp, __u16 lmask)
+int
+RTjpeg_mcompress8 (__s8 * sp, unsigned char *bp, __u16 lmask)
{
- __s8 * sb;
- __s16 *block;
- int i, j;
+ __s8 *sb;
+ __s16 *block;
+ int i, j;
#ifdef HAVE_LIBMMX
- emms();
- RTjpeg_lmask=(mmx_t)(((__u64)lmask<<48)|((__u64)lmask<<32)|((__u64)lmask<<16)|lmask);
+ emms ();
+ RTjpeg_lmask =
+ (mmx_t) (((__u64) lmask << 48) | ((__u64) lmask << 32) | ((__u64) lmask <<
+ 16) | lmask);
#else
- RTjpeg_lmask=lmask;
+ RTjpeg_lmask = lmask;
#endif
-
- sb=sp;
- block=RTjpeg_old;
+
+ sb = sp;
+ block = RTjpeg_old;
/* Y */
- for(i=0; i<RTjpeg_height; i+=8)
- {
- for(j=0; j<RTjpeg_width; j+=8)
- {
- RTjpeg_dctY(bp+j, RTjpeg_block, RTjpeg_width);
- RTjpeg_quant(RTjpeg_block, RTjpeg_lqt);
- if(RTjpeg_bcomp(block, &RTjpeg_lmask))
- {
- *((__u8 *)sp++)=255;
+ for (i = 0; i < RTjpeg_height; i += 8) {
+ for (j = 0; j < RTjpeg_width; j += 8) {
+ RTjpeg_dctY (bp + j, RTjpeg_block, RTjpeg_width);
+ RTjpeg_quant (RTjpeg_block, RTjpeg_lqt);
+ if (RTjpeg_bcomp (block, &RTjpeg_lmask)) {
+ *((__u8 *) sp++) = 255;
/* printf("* %d ", sp[-1]); */
- } else sp+=RTjpeg_b2s(RTjpeg_block, sp, RTjpeg_lb8);
- block+=64;
+ } else
+ sp += RTjpeg_b2s (RTjpeg_block, sp, RTjpeg_lb8);
+ block += 64;
+ }
+ bp += RTjpeg_width << 3;
}
- bp+=RTjpeg_width<<3;
- }
#ifdef HAVE_LIBMMX
- emms();
+ emms ();
#endif
- return (sp-sb);
+ return (sp - sb);
}
-void RTjpeg_color_init(void)
+void
+RTjpeg_color_init (void)
{
-}
+}
#define KcrR 76284
#define KcrG 53281
@@ -3002,435 +3016,433 @@ void RTjpeg_color_init(void)
#define KcbB 132252
#define Ky 76284
-void RTjpeg_yuv422rgb(__u8 *buf, __u8 *rgb)
+void
+RTjpeg_yuv422rgb (__u8 * buf, __u8 * rgb)
{
- int tmp;
- int i, j;
- __s32 y, crR, crG, cbG, cbB;
- __u8 *bufcr, *bufcb, *bufy, *bufoute;
- int yskip;
-
- yskip=RTjpeg_width;
-
- bufcb=&buf[RTjpeg_width*RTjpeg_height];
- bufcr=&buf[RTjpeg_width*RTjpeg_height+(RTjpeg_width*RTjpeg_height)/2];
- bufy=&buf[0];
- bufoute=rgb;
-
- for(i=0; i<(RTjpeg_height); i++)
- {
- for(j=0; j<RTjpeg_width; j+=2)
- {
- crR=(*bufcr-128)*KcrR;
- crG=(*(bufcr++)-128)*KcrG;
- cbG=(*bufcb-128)*KcbG;
- cbB=(*(bufcb++)-128)*KcbB;
-
- y=(bufy[j]-16)*Ky;
-
- tmp=(y+crR)>>16;
- *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp);
- tmp=(y-crG-cbG)>>16;
- *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp);
- tmp=(y+cbB)>>16;
- *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp);
-
- y=(bufy[j+1]-16)*Ky;
-
- tmp=(y+crR)>>16;
- *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp);
- tmp=(y-crG-cbG)>>16;
- *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp);
- tmp=(y+cbB)>>16;
- *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp);
-
+ int tmp;
+ int i, j;
+ __s32 y, crR, crG, cbG, cbB;
+ __u8 *bufcr, *bufcb, *bufy, *bufoute;
+ int yskip;
+
+ yskip = RTjpeg_width;
+
+ bufcb = &buf[RTjpeg_width * RTjpeg_height];
+ bufcr =
+ &buf[RTjpeg_width * RTjpeg_height + (RTjpeg_width * RTjpeg_height) / 2];
+ bufy = &buf[0];
+ bufoute = rgb;
+
+ for (i = 0; i < (RTjpeg_height); i++) {
+ for (j = 0; j < RTjpeg_width; j += 2) {
+ crR = (*bufcr - 128) * KcrR;
+ crG = (*(bufcr++) - 128) * KcrG;
+ cbG = (*bufcb - 128) * KcbG;
+ cbB = (*(bufcb++) - 128) * KcbB;
+
+ y = (bufy[j] - 16) * Ky;
+
+ tmp = (y + crR) >> 16;
+ *(bufoute++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
+ tmp = (y - crG - cbG) >> 16;
+ *(bufoute++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
+ tmp = (y + cbB) >> 16;
+ *(bufoute++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
+
+ y = (bufy[j + 1] - 16) * Ky;
+
+ tmp = (y + crR) >> 16;
+ *(bufoute++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
+ tmp = (y - crG - cbG) >> 16;
+ *(bufoute++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
+ tmp = (y + cbB) >> 16;
+ *(bufoute++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
+
+ }
+ bufy += yskip;
}
- bufy+=yskip;
- }
}
-void RTjpeg_yuv420rgb(__u8 *buf, __u8 *rgb)
+void
+RTjpeg_yuv420rgb (__u8 * buf, __u8 * rgb)
{
- int tmp;
- int i, j;
- __s32 y, crR, crG, cbG, cbB;
- __u8 *bufcr, *bufcb, *bufy, *bufoute, *bufouto;
- int oskip, yskip;
-
- oskip=RTjpeg_width*3;
- yskip=RTjpeg_width;
-
- bufcb=&buf[RTjpeg_width*RTjpeg_height];
- bufcr=&buf[RTjpeg_width*RTjpeg_height+(RTjpeg_width*RTjpeg_height)/4];
- bufy=&buf[0];
- bufoute=rgb;
- bufouto=rgb+oskip;
-
- for(i=0; i<(RTjpeg_height>>1); i++)
- {
- for(j=0; j<RTjpeg_width; j+=2)
- {
- crR=(*bufcr-128)*KcrR;
- crG=(*(bufcr++)-128)*KcrG;
- cbG=(*bufcb-128)*KcbG;
- cbB=(*(bufcb++)-128)*KcbB;
-
- y=(bufy[j]-16)*Ky;
-
- tmp=(y+crR)>>16;
- *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp);
- tmp=(y-crG-cbG)>>16;
- *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp);
- tmp=(y+cbB)>>16;
- *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp);
-
- y=(bufy[j+1]-16)*Ky;
-
- tmp=(y+crR)>>16;
- *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp);
- tmp=(y-crG-cbG)>>16;
- *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp);
- tmp=(y+cbB)>>16;
- *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp);
-
- y=(bufy[j+yskip]-16)*Ky;
-
- tmp=(y+crR)>>16;
- *(bufouto++)=(tmp>255)?255:((tmp<0)?0:tmp);
- tmp=(y-crG-cbG)>>16;
- *(bufouto++)=(tmp>255)?255:((tmp<0)?0:tmp);
- tmp=(y+cbB)>>16;
- *(bufouto++)=(tmp>255)?255:((tmp<0)?0:tmp);
-
- y=(bufy[j+1+yskip]-16)*Ky;
-
- tmp=(y+crR)>>16;
- *(bufouto++)=(tmp>255)?255:((tmp<0)?0:tmp);
- tmp=(y-crG-cbG)>>16;
- *(bufouto++)=(tmp>255)?255:((tmp<0)?0:tmp);
- tmp=(y+cbB)>>16;
- *(bufouto++)=(tmp>255)?255:((tmp<0)?0:tmp);
-
+ int tmp;
+ int i, j;
+ __s32 y, crR, crG, cbG, cbB;
+ __u8 *bufcr, *bufcb, *bufy, *bufoute, *bufouto;
+ int oskip, yskip;
+
+ oskip = RTjpeg_width * 3;
+ yskip = RTjpeg_width;
+
+ bufcb = &buf[RTjpeg_width * RTjpeg_height];
+ bufcr =
+ &buf[RTjpeg_width * RTjpeg_height + (RTjpeg_width * RTjpeg_height) / 4];
+ bufy = &buf[0];
+ bufoute = rgb;
+ bufouto = rgb + oskip;
+
+ for (i = 0; i < (RTjpeg_height >> 1); i++) {
+ for (j = 0; j < RTjpeg_width; j += 2) {
+ crR = (*bufcr - 128) * KcrR;
+ crG = (*(bufcr++) - 128) * KcrG;
+ cbG = (*bufcb - 128) * KcbG;
+ cbB = (*(bufcb++) - 128) * KcbB;
+
+ y = (bufy[j] - 16) * Ky;
+
+ tmp = (y + crR) >> 16;
+ *(bufoute++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
+ tmp = (y - crG - cbG) >> 16;
+ *(bufoute++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
+ tmp = (y + cbB) >> 16;
+ *(bufoute++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
+
+ y = (bufy[j + 1] - 16) * Ky;
+
+ tmp = (y + crR) >> 16;
+ *(bufoute++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
+ tmp = (y - crG - cbG) >> 16;
+ *(bufoute++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
+ tmp = (y + cbB) >> 16;
+ *(bufoute++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
+
+ y = (bufy[j + yskip] - 16) * Ky;
+
+ tmp = (y + crR) >> 16;
+ *(bufouto++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
+ tmp = (y - crG - cbG) >> 16;
+ *(bufouto++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
+ tmp = (y + cbB) >> 16;
+ *(bufouto++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
+
+ y = (bufy[j + 1 + yskip] - 16) * Ky;
+
+ tmp = (y + crR) >> 16;
+ *(bufouto++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
+ tmp = (y - crG - cbG) >> 16;
+ *(bufouto++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
+ tmp = (y + cbB) >> 16;
+ *(bufouto++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
+
+ }
+ bufoute += oskip;
+ bufouto += oskip;
+ bufy += yskip << 1;
}
- bufoute+=oskip;
- bufouto+=oskip;
- bufy+=yskip<<1;
- }
}
-void RTjpeg_yuvrgb32(__u8 *buf, __u8 *rgb)
+void
+RTjpeg_yuvrgb32 (__u8 * buf, __u8 * rgb)
{
- int tmp;
- int i, j;
- __s32 y, crR, crG, cbG, cbB;
- __u8 *bufcr, *bufcb, *bufy, *bufoute, *bufouto;
- int oskip, yskip;
-
- oskip=RTjpeg_width*4;
- yskip=RTjpeg_width;
-
- bufcb=&buf[RTjpeg_width*RTjpeg_height];
- bufcr=&buf[RTjpeg_width*RTjpeg_height+(RTjpeg_width*RTjpeg_height)/2];
- bufy=&buf[0];
- bufoute=rgb;
- bufouto=rgb+oskip;
-
- for(i=0; i<(RTjpeg_height>>1); i++)
- {
- for(j=0; j<RTjpeg_width; j+=2)
- {
- crR=(*bufcr-128)*KcrR;
- crG=(*(bufcr++)-128)*KcrG;
- cbG=(*bufcb-128)*KcbG;
- cbB=(*(bufcb++)-128)*KcbB;
-
- y=(bufy[j]-16)*Ky;
-
- tmp=(y+cbB)>>16;
- *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp);
- tmp=(y-crG-cbG)>>16;
- *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp);
- tmp=(y+crR)>>16;
- *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp);
- bufoute++;
-
- y=(bufy[j+1]-16)*Ky;
-
- tmp=(y+cbB)>>16;
- *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp);
- tmp=(y-crG-cbG)>>16;
- *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp);
- tmp=(y+crR)>>16;
- *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp);
- bufoute++;
-
- y=(bufy[j+yskip]-16)*Ky;
-
- tmp=(y+cbB)>>16;
- *(bufouto++)=(tmp>255)?255:((tmp<0)?0:tmp);
- tmp=(y-crG-cbG)>>16;
- *(bufouto++)=(tmp>255)?255:((tmp<0)?0:tmp);
- tmp=(y+crR)>>16;
- *(bufouto++)=(tmp>255)?255:((tmp<0)?0:tmp);
- bufouto++;
-
- y=(bufy[j+1+yskip]-16)*Ky;
-
- tmp=(y+cbB)>>16;
- *(bufouto++)=(tmp>255)?255:((tmp<0)?0:tmp);
- tmp=(y-crG-cbG)>>16;
- *(bufouto++)=(tmp>255)?255:((tmp<0)?0:tmp);
- tmp=(y+crR)>>16;
- *(bufouto++)=(tmp>255)?255:((tmp<0)?0:tmp);
- bufouto++;
-
+ int tmp;
+ int i, j;
+ __s32 y, crR, crG, cbG, cbB;
+ __u8 *bufcr, *bufcb, *bufy, *bufoute, *bufouto;
+ int oskip, yskip;
+
+ oskip = RTjpeg_width * 4;
+ yskip = RTjpeg_width;
+
+ bufcb = &buf[RTjpeg_width * RTjpeg_height];
+ bufcr =
+ &buf[RTjpeg_width * RTjpeg_height + (RTjpeg_width * RTjpeg_height) / 2];
+ bufy = &buf[0];
+ bufoute = rgb;
+ bufouto = rgb + oskip;
+
+ for (i = 0; i < (RTjpeg_height >> 1); i++) {
+ for (j = 0; j < RTjpeg_width; j += 2) {
+ crR = (*bufcr - 128) * KcrR;
+ crG = (*(bufcr++) - 128) * KcrG;
+ cbG = (*bufcb - 128) * KcbG;
+ cbB = (*(bufcb++) - 128) * KcbB;
+
+ y = (bufy[j] - 16) * Ky;
+
+ tmp = (y + cbB) >> 16;
+ *(bufoute++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
+ tmp = (y - crG - cbG) >> 16;
+ *(bufoute++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
+ tmp = (y + crR) >> 16;
+ *(bufoute++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
+ bufoute++;
+
+ y = (bufy[j + 1] - 16) * Ky;
+
+ tmp = (y + cbB) >> 16;
+ *(bufoute++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
+ tmp = (y - crG - cbG) >> 16;
+ *(bufoute++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
+ tmp = (y + crR) >> 16;
+ *(bufoute++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
+ bufoute++;
+
+ y = (bufy[j + yskip] - 16) * Ky;
+
+ tmp = (y + cbB) >> 16;
+ *(bufouto++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
+ tmp = (y - crG - cbG) >> 16;
+ *(bufouto++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
+ tmp = (y + crR) >> 16;
+ *(bufouto++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
+ bufouto++;
+
+ y = (bufy[j + 1 + yskip] - 16) * Ky;
+
+ tmp = (y + cbB) >> 16;
+ *(bufouto++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
+ tmp = (y - crG - cbG) >> 16;
+ *(bufouto++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
+ tmp = (y + crR) >> 16;
+ *(bufouto++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
+ bufouto++;
+
+ }
+ bufoute += oskip;
+ bufouto += oskip;
+ bufy += yskip << 1;
}
- bufoute+=oskip;
- bufouto+=oskip;
- bufy+=yskip<<1;
- }
}
-void RTjpeg_yuvrgb24(__u8 *buf, __u8 *rgb)
+void
+RTjpeg_yuvrgb24 (__u8 * buf, __u8 * rgb)
{
- int tmp;
- int i, j;
- __s32 y, crR, crG, cbG, cbB;
- __u8 *bufcr, *bufcb, *bufy, *bufoute, *bufouto;
- int oskip, yskip;
-
- oskip=RTjpeg_width*3;
- yskip=RTjpeg_width;
-
- bufcb=&buf[RTjpeg_width*RTjpeg_height];
- bufcr=&buf[RTjpeg_width*RTjpeg_height+(RTjpeg_width*RTjpeg_height)/4];
- bufy=&buf[0];
- bufoute=rgb;
- bufouto=rgb+oskip;
-
- for(i=0; i<(RTjpeg_height>>1); i++)
- {
- for(j=0; j<RTjpeg_width; j+=2)
- {
- crR=(*bufcr-128)*KcrR;
- crG=(*(bufcr++)-128)*KcrG;
- cbG=(*bufcb-128)*KcbG;
- cbB=(*(bufcb++)-128)*KcbB;
-
- y=(bufy[j]-16)*Ky;
-
- tmp=(y+cbB)>>16;
- *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp);
- tmp=(y-crG-cbG)>>16;
- *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp);
- tmp=(y+crR)>>16;
- *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp);
-
- y=(bufy[j+1]-16)*Ky;
-
- tmp=(y+cbB)>>16;
- *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp);
- tmp=(y-crG-cbG)>>16;
- *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp);
- tmp=(y+crR)>>16;
- *(bufoute++)=(tmp>255)?255:((tmp<0)?0:tmp);
-
- y=(bufy[j+yskip]-16)*Ky;
-
- tmp=(y+cbB)>>16;
- *(bufouto++)=(tmp>255)?255:((tmp<0)?0:tmp);
- tmp=(y-crG-cbG)>>16;
- *(bufouto++)=(tmp>255)?255:((tmp<0)?0:tmp);
- tmp=(y+crR)>>16;
- *(bufouto++)=(tmp>255)?255:((tmp<0)?0:tmp);
-
- y=(bufy[j+1+yskip]-16)*Ky;
-
- tmp=(y+cbB)>>16;
- *(bufouto++)=(tmp>255)?255:((tmp<0)?0:tmp);
- tmp=(y-crG-cbG)>>16;
- *(bufouto++)=(tmp>255)?255:((tmp<0)?0:tmp);
- tmp=(y+crR)>>16;
- *(bufouto++)=(tmp>255)?255:((tmp<0)?0:tmp);
-
+ int tmp;
+ int i, j;
+ __s32 y, crR, crG, cbG, cbB;
+ __u8 *bufcr, *bufcb, *bufy, *bufoute, *bufouto;
+ int oskip, yskip;
+
+ oskip = RTjpeg_width * 3;
+ yskip = RTjpeg_width;
+
+ bufcb = &buf[RTjpeg_width * RTjpeg_height];
+ bufcr =
+ &buf[RTjpeg_width * RTjpeg_height + (RTjpeg_width * RTjpeg_height) / 4];
+ bufy = &buf[0];
+ bufoute = rgb;
+ bufouto = rgb + oskip;
+
+ for (i = 0; i < (RTjpeg_height >> 1); i++) {
+ for (j = 0; j < RTjpeg_width; j += 2) {
+ crR = (*bufcr - 128) * KcrR;
+ crG = (*(bufcr++) - 128) * KcrG;
+ cbG = (*bufcb - 128) * KcbG;
+ cbB = (*(bufcb++) - 128) * KcbB;
+
+ y = (bufy[j] - 16) * Ky;
+
+ tmp = (y + cbB) >> 16;
+ *(bufoute++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
+ tmp = (y - crG - cbG) >> 16;
+ *(bufoute++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
+ tmp = (y + crR) >> 16;
+ *(bufoute++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
+
+ y = (bufy[j + 1] - 16) * Ky;
+
+ tmp = (y + cbB) >> 16;
+ *(bufoute++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
+ tmp = (y - crG - cbG) >> 16;
+ *(bufoute++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
+ tmp = (y + crR) >> 16;
+ *(bufoute++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
+
+ y = (bufy[j + yskip] - 16) * Ky;
+
+ tmp = (y + cbB) >> 16;
+ *(bufouto++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
+ tmp = (y - crG - cbG) >> 16;
+ *(bufouto++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
+ tmp = (y + crR) >> 16;
+ *(bufouto++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
+
+ y = (bufy[j + 1 + yskip] - 16) * Ky;
+
+ tmp = (y + cbB) >> 16;
+ *(bufouto++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
+ tmp = (y - crG - cbG) >> 16;
+ *(bufouto++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
+ tmp = (y + crR) >> 16;
+ *(bufouto++) = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
+
+ }
+ bufoute += oskip;
+ bufouto += oskip;
+ bufy += yskip << 1;
}
- bufoute+=oskip;
- bufouto+=oskip;
- bufy+=yskip<<1;
- }
}
-void RTjpeg_yuvrgb16(__u8 *buf, __u8 *rgb)
+void
+RTjpeg_yuvrgb16 (__u8 * buf, __u8 * rgb)
{
- int tmp;
- int i, j;
- __s32 y, crR, crG, cbG, cbB;
- __u8 *bufcr, *bufcb, *bufy, *bufoute, *bufouto;
- int oskip, yskip;
- unsigned char r, g, b;
-
- oskip=RTjpeg_width*2;
- yskip=RTjpeg_width;
-
- bufcb=&buf[RTjpeg_width*RTjpeg_height];
- bufcr=&buf[RTjpeg_width*RTjpeg_height+(RTjpeg_width*RTjpeg_height)/4];
- bufy=&buf[0];
- bufoute=rgb;
- bufouto=rgb+oskip;
-
- for(i=0; i<(RTjpeg_height>>1); i++)
- {
- for(j=0; j<RTjpeg_width; j+=2)
- {
- crR=(*bufcr-128)*KcrR;
- crG=(*(bufcr++)-128)*KcrG;
- cbG=(*bufcb-128)*KcbG;
- cbB=(*(bufcb++)-128)*KcbB;
-
- y=(bufy[j]-16)*Ky;
-
- tmp=(y+cbB)>>16;
- b=(tmp>255)?255:((tmp<0)?0:tmp);
- tmp=(y-crG-cbG)>>16;
- g=(tmp>255)?255:((tmp<0)?0:tmp);
- tmp=(y+crR)>>16;
- r=(tmp>255)?255:((tmp<0)?0:tmp);
- tmp=(int)((int)b >> 3);
- tmp|=(int)(((int)g >> 2) << 5);
- tmp|=(int)(((int)r >> 3) << 11);
- *(bufoute++)=tmp&0xff;
- *(bufoute++)=tmp>>8;
-
-
- y=(bufy[j+1]-16)*Ky;
-
- tmp=(y+cbB)>>16;
- b=(tmp>255)?255:((tmp<0)?0:tmp);
- tmp=(y-crG-cbG)>>16;
- g=(tmp>255)?255:((tmp<0)?0:tmp);
- tmp=(y+crR)>>16;
- r=(tmp>255)?255:((tmp<0)?0:tmp);
- tmp=(int)((int)b >> 3);
- tmp|=(int)(((int)g >> 2) << 5);
- tmp|=(int)(((int)r >> 3) << 11);
- *(bufoute++)=tmp&0xff;
- *(bufoute++)=tmp>>8;
-
- y=(bufy[j+yskip]-16)*Ky;
-
- tmp=(y+cbB)>>16;
- b=(tmp>255)?255:((tmp<0)?0:tmp);
- tmp=(y-crG-cbG)>>16;
- g=(tmp>255)?255:((tmp<0)?0:tmp);
- tmp=(y+crR)>>16;
- r=(tmp>255)?255:((tmp<0)?0:tmp);
- tmp=(int)((int)b >> 3);
- tmp|=(int)(((int)g >> 2) << 5);
- tmp|=(int)(((int)r >> 3) << 11);
- *(bufouto++)=tmp&0xff;
- *(bufouto++)=tmp>>8;
-
- y=(bufy[j+1+yskip]-16)*Ky;
-
- tmp=(y+cbB)>>16;
- b=(tmp>255)?255:((tmp<0)?0:tmp);
- tmp=(y-crG-cbG)>>16;
- g=(tmp>255)?255:((tmp<0)?0:tmp);
- tmp=(y+crR)>>16;
- r=(tmp>255)?255:((tmp<0)?0:tmp);
- tmp=(int)((int)b >> 3);
- tmp|=(int)(((int)g >> 2) << 5);
- tmp|=(int)(((int)r >> 3) << 11);
- *(bufouto++)=tmp&0xff;
- *(bufouto++)=tmp>>8;
-
+ int tmp;
+ int i, j;
+ __s32 y, crR, crG, cbG, cbB;
+ __u8 *bufcr, *bufcb, *bufy, *bufoute, *bufouto;
+ int oskip, yskip;
+ unsigned char r, g, b;
+
+ oskip = RTjpeg_width * 2;
+ yskip = RTjpeg_width;
+
+ bufcb = &buf[RTjpeg_width * RTjpeg_height];
+ bufcr =
+ &buf[RTjpeg_width * RTjpeg_height + (RTjpeg_width * RTjpeg_height) / 4];
+ bufy = &buf[0];
+ bufoute = rgb;
+ bufouto = rgb + oskip;
+
+ for (i = 0; i < (RTjpeg_height >> 1); i++) {
+ for (j = 0; j < RTjpeg_width; j += 2) {
+ crR = (*bufcr - 128) * KcrR;
+ crG = (*(bufcr++) - 128) * KcrG;
+ cbG = (*bufcb - 128) * KcbG;
+ cbB = (*(bufcb++) - 128) * KcbB;
+
+ y = (bufy[j] - 16) * Ky;
+
+ tmp = (y + cbB) >> 16;
+ b = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
+ tmp = (y - crG - cbG) >> 16;
+ g = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
+ tmp = (y + crR) >> 16;
+ r = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
+ tmp = (int) ((int) b >> 3);
+ tmp |= (int) (((int) g >> 2) << 5);
+ tmp |= (int) (((int) r >> 3) << 11);
+ *(bufoute++) = tmp & 0xff;
+ *(bufoute++) = tmp >> 8;
+
+
+ y = (bufy[j + 1] - 16) * Ky;
+
+ tmp = (y + cbB) >> 16;
+ b = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
+ tmp = (y - crG - cbG) >> 16;
+ g = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
+ tmp = (y + crR) >> 16;
+ r = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
+ tmp = (int) ((int) b >> 3);
+ tmp |= (int) (((int) g >> 2) << 5);
+ tmp |= (int) (((int) r >> 3) << 11);
+ *(bufoute++) = tmp & 0xff;
+ *(bufoute++) = tmp >> 8;
+
+ y = (bufy[j + yskip] - 16) * Ky;
+
+ tmp = (y + cbB) >> 16;
+ b = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
+ tmp = (y - crG - cbG) >> 16;
+ g = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
+ tmp = (y + crR) >> 16;
+ r = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
+ tmp = (int) ((int) b >> 3);
+ tmp |= (int) (((int) g >> 2) << 5);
+ tmp |= (int) (((int) r >> 3) << 11);
+ *(bufouto++) = tmp & 0xff;
+ *(bufouto++) = tmp >> 8;
+
+ y = (bufy[j + 1 + yskip] - 16) * Ky;
+
+ tmp = (y + cbB) >> 16;
+ b = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
+ tmp = (y - crG - cbG) >> 16;
+ g = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
+ tmp = (y + crR) >> 16;
+ r = (tmp > 255) ? 255 : ((tmp < 0) ? 0 : tmp);
+ tmp = (int) ((int) b >> 3);
+ tmp |= (int) (((int) g >> 2) << 5);
+ tmp |= (int) (((int) r >> 3) << 11);
+ *(bufouto++) = tmp & 0xff;
+ *(bufouto++) = tmp >> 8;
+
+ }
+ bufoute += oskip;
+ bufouto += oskip;
+ bufy += yskip << 1;
}
- bufoute+=oskip;
- bufouto+=oskip;
- bufy+=yskip<<1;
- }
}
-void RTjpeg_yuvrgb8(__u8 *buf, __u8 *rgb)
+void
+RTjpeg_yuvrgb8 (__u8 * buf, __u8 * rgb)
{
- bcopy(buf, rgb, RTjpeg_width*RTjpeg_height);
+ bcopy (buf, rgb, RTjpeg_width * RTjpeg_height);
}
-void RTjpeg_double32(__u32 *buf)
+void
+RTjpeg_double32 (__u32 * buf)
{
- int i, j;
-
- __u32 *iptr, *optr1, *optr2;
-
- iptr=buf+(RTjpeg_width*RTjpeg_height)-1;
- optr1=buf+(RTjpeg_width*RTjpeg_height*4)-1;
- optr2=optr1-(2*RTjpeg_width);
-
- for(i=0; i<RTjpeg_height; i++)
- {
- for(j=0; j<RTjpeg_width; j++)
- {
- *(optr1--)=*iptr;
- *(optr1--)=*iptr;
- *(optr2--)=*iptr;
- *(optr2--)=*(iptr--);
+ int i, j;
+
+ __u32 *iptr, *optr1, *optr2;
+
+ iptr = buf + (RTjpeg_width * RTjpeg_height) - 1;
+ optr1 = buf + (RTjpeg_width * RTjpeg_height * 4) - 1;
+ optr2 = optr1 - (2 * RTjpeg_width);
+
+ for (i = 0; i < RTjpeg_height; i++) {
+ for (j = 0; j < RTjpeg_width; j++) {
+ *(optr1--) = *iptr;
+ *(optr1--) = *iptr;
+ *(optr2--) = *iptr;
+ *(optr2--) = *(iptr--);
+ }
+ optr2 = optr2 - 2 * RTjpeg_width;
+ optr1 = optr1 - 2 * RTjpeg_width;
}
- optr2=optr2-2*RTjpeg_width;
- optr1=optr1-2*RTjpeg_width;
- }
}
-void RTjpeg_double24(__u8 *buf)
+void
+RTjpeg_double24 (__u8 * buf)
{
}
-void RTjpeg_double16(__u16 *buf)
+void
+RTjpeg_double16 (__u16 * buf)
{
- int i, j;
-
- __u16 *iptr, *optr1, *optr2;
-
- iptr=buf+(RTjpeg_width*RTjpeg_height)-1;
- optr1=buf+(RTjpeg_width*RTjpeg_height*4)-1;
- optr2=optr1-(2*RTjpeg_width);
-
- for(i=0; i<RTjpeg_height; i++)
- {
- for(j=0; j<RTjpeg_width; j++)
- {
- *(optr1--)=*iptr;
- *(optr1--)=*iptr;
- *(optr2--)=*iptr;
- *(optr2--)=*(iptr--);
+ int i, j;
+
+ __u16 *iptr, *optr1, *optr2;
+
+ iptr = buf + (RTjpeg_width * RTjpeg_height) - 1;
+ optr1 = buf + (RTjpeg_width * RTjpeg_height * 4) - 1;
+ optr2 = optr1 - (2 * RTjpeg_width);
+
+ for (i = 0; i < RTjpeg_height; i++) {
+ for (j = 0; j < RTjpeg_width; j++) {
+ *(optr1--) = *iptr;
+ *(optr1--) = *iptr;
+ *(optr2--) = *iptr;
+ *(optr2--) = *(iptr--);
+ }
+ optr2 = optr2 - 2 * RTjpeg_width;
+ optr1 = optr1 - 2 * RTjpeg_width;
}
- optr2=optr2-2*RTjpeg_width;
- optr1=optr1-2*RTjpeg_width;
- }
}
-void RTjpeg_double8(__u8 *buf)
+void
+RTjpeg_double8 (__u8 * buf)
{
- int i, j;
-
- __u8 *iptr, *optr1, *optr2;
-
- iptr=buf+(RTjpeg_width*RTjpeg_height)-1;
- optr1=buf+(RTjpeg_width*RTjpeg_height*4)-1;
- optr2=optr1-(2*RTjpeg_width);
-
- for(i=0; i<RTjpeg_height; i++)
- {
- for(j=0; j<RTjpeg_width; j++)
- {
- *(optr1--)=*iptr;
- *(optr1--)=*iptr;
- *(optr2--)=*iptr;
- *(optr2--)=*(iptr--);
+ int i, j;
+
+ __u8 *iptr, *optr1, *optr2;
+
+ iptr = buf + (RTjpeg_width * RTjpeg_height) - 1;
+ optr1 = buf + (RTjpeg_width * RTjpeg_height * 4) - 1;
+ optr2 = optr1 - (2 * RTjpeg_width);
+
+ for (i = 0; i < RTjpeg_height; i++) {
+ for (j = 0; j < RTjpeg_width; j++) {
+ *(optr1--) = *iptr;
+ *(optr1--) = *iptr;
+ *(optr2--) = *iptr;
+ *(optr2--) = *(iptr--);
+ }
+ optr2 = optr2 - 2 * RTjpeg_width;
+ optr1 = optr1 - 2 * RTjpeg_width;
}
- optr2=optr2-2*RTjpeg_width;
- optr1=optr1-2*RTjpeg_width;
- }
}
-
diff --git a/gst/rtjpeg/RTjpeg.h b/gst/rtjpeg/RTjpeg.h
index 92b35242f..3c90408fd 100644
--- a/gst/rtjpeg/RTjpeg.h
+++ b/gst/rtjpeg/RTjpeg.h
@@ -23,30 +23,32 @@
#include <inttypes.h>
-typedef uint8_t __u8;
+typedef uint8_t __u8;
typedef uint32_t __u32;
-typedef int8_t __s8;
+typedef int8_t __s8;
typedef uint16_t __u16;
-extern void RTjpeg_init_Q(__u8 Q);
-extern void RTjpeg_init_compress(long unsigned int *buf, int width, int height, __u8 Q);
-extern void RTjpeg_init_decompress(long unsigned int *buf, int width, int height);
-extern int RTjpeg_compressYUV420(__s8 *sp, unsigned char *bp);
-extern int RTjpeg_compressYUV422(__s8 *sp, unsigned char *bp);
-extern void RTjpeg_decompressYUV420(__s8 *sp, __u8 *bp);
-extern void RTjpeg_decompressYUV422(__s8 *sp, __u8 *bp);
-extern int RTjpeg_compress8(__s8 *sp, unsigned char *bp);
-extern void RTjpeg_decompress8(__s8 *sp, __u8 *bp);
-
-extern void RTjpeg_init_mcompress(void);
-extern int RTjpeg_mcompress(__s8 *sp, unsigned char *bp, __u16 lmask, __u16 cmask);
-extern int RTjpeg_mcompress8(__s8 *sp, unsigned char *bp, __u16 lmask);
-extern void RTjpeg_set_test(int i);
-
-extern void RTjpeg_yuv420rgb(__u8 *buf, __u8 *rgb);
-extern void RTjpeg_yuv422rgb(__u8 *buf, __u8 *rgb);
-extern void RTjpeg_yuvrgb8(__u8 *buf, __u8 *rgb);
-extern void RTjpeg_yuvrgb16(__u8 *buf, __u8 *rgb);
-extern void RTjpeg_yuvrgb24(__u8 *buf, __u8 *rgb);
-extern void RTjpeg_yuvrgb32(__u8 *buf, __u8 *rgb);
-
+extern void RTjpeg_init_Q (__u8 Q);
+extern void RTjpeg_init_compress (long unsigned int *buf, int width, int height,
+ __u8 Q);
+extern void RTjpeg_init_decompress (long unsigned int *buf, int width,
+ int height);
+extern int RTjpeg_compressYUV420 (__s8 * sp, unsigned char *bp);
+extern int RTjpeg_compressYUV422 (__s8 * sp, unsigned char *bp);
+extern void RTjpeg_decompressYUV420 (__s8 * sp, __u8 * bp);
+extern void RTjpeg_decompressYUV422 (__s8 * sp, __u8 * bp);
+extern int RTjpeg_compress8 (__s8 * sp, unsigned char *bp);
+extern void RTjpeg_decompress8 (__s8 * sp, __u8 * bp);
+
+extern void RTjpeg_init_mcompress (void);
+extern int RTjpeg_mcompress (__s8 * sp, unsigned char *bp, __u16 lmask,
+ __u16 cmask);
+extern int RTjpeg_mcompress8 (__s8 * sp, unsigned char *bp, __u16 lmask);
+extern void RTjpeg_set_test (int i);
+
+extern void RTjpeg_yuv420rgb (__u8 * buf, __u8 * rgb);
+extern void RTjpeg_yuv422rgb (__u8 * buf, __u8 * rgb);
+extern void RTjpeg_yuvrgb8 (__u8 * buf, __u8 * rgb);
+extern void RTjpeg_yuvrgb16 (__u8 * buf, __u8 * rgb);
+extern void RTjpeg_yuvrgb24 (__u8 * buf, __u8 * rgb);
+extern void RTjpeg_yuvrgb32 (__u8 * buf, __u8 * rgb);
diff --git a/gst/rtjpeg/gstrtjpeg.c b/gst/rtjpeg/gstrtjpeg.c
index 2b9ff37d3..e61cb7d0f 100644
--- a/gst/rtjpeg/gstrtjpeg.c
+++ b/gst/rtjpeg/gstrtjpeg.c
@@ -25,25 +25,19 @@
#include <gstrtjpegdec.h>
static gboolean
-plugin_init (GstPlugin *plugin)
+plugin_init (GstPlugin * plugin)
{
if (!gst_element_register (plugin, "rtjpegenc",
- GST_RANK_NONE, GST_TYPE_RTJPEGENC) ||
+ GST_RANK_NONE, GST_TYPE_RTJPEGENC) ||
!gst_element_register (plugin, "rtjpegdec",
- GST_RANK_NONE, GST_TYPE_RTJPEGDEC))
+ GST_RANK_NONE, GST_TYPE_RTJPEGDEC))
return FALSE;
return TRUE;
}
-GST_PLUGIN_DEFINE (
- GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "rtjpeg",
- "Justin Schoeman's RTjpeg codec",
- plugin_init,
- VERSION,
- "GPL",
- GST_PACKAGE,
- GST_ORIGIN
-)
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ "rtjpeg",
+ "Justin Schoeman's RTjpeg codec",
+ plugin_init, VERSION, "GPL", GST_PACKAGE, GST_ORIGIN)
diff --git a/gst/rtjpeg/gstrtjpegdec.c b/gst/rtjpeg/gstrtjpegdec.c
index 7173c132f..44dcc3f32 100644
--- a/gst/rtjpeg/gstrtjpegdec.c
+++ b/gst/rtjpeg/gstrtjpegdec.c
@@ -34,24 +34,27 @@ GstElementDetails gst_rtjpegdec_details = {
};
/* GstRTJpegDec signals and args */
-enum {
+enum
+{
/* FILL ME */
LAST_SIGNAL
};
-enum {
+enum
+{
ARG_0,
ARG_QUALITY,
};
-static void gst_rtjpegdec_class_init (GstRTJpegDecClass *klass);
-static void gst_rtjpegdec_base_init (GstRTJpegDecClass *klass);
-static void gst_rtjpegdec_init (GstRTJpegDec *rtjpegdec);
+static void gst_rtjpegdec_class_init (GstRTJpegDecClass * klass);
+static void gst_rtjpegdec_base_init (GstRTJpegDecClass * klass);
+static void gst_rtjpegdec_init (GstRTJpegDec * rtjpegdec);
-static void gst_rtjpegdec_chain (GstPad *pad, GstData *_data);
+static void gst_rtjpegdec_chain (GstPad * pad, GstData * _data);
static GstElementClass *parent_class = NULL;
+
/*static guint gst_rtjpegdec_signals[LAST_SIGNAL] = { 0 }; */
GType
@@ -61,23 +64,25 @@ gst_rtjpegdec_get_type (void)
if (!rtjpegdec_type) {
static const GTypeInfo rtjpegdec_info = {
- sizeof(GstRTJpegDecClass),
- (GBaseInitFunc)gst_rtjpegdec_base_init,
+ sizeof (GstRTJpegDecClass),
+ (GBaseInitFunc) gst_rtjpegdec_base_init,
NULL,
- (GClassInitFunc)gst_rtjpegdec_class_init,
+ (GClassInitFunc) gst_rtjpegdec_class_init,
NULL,
NULL,
- sizeof(GstRTJpegDec),
+ sizeof (GstRTJpegDec),
0,
- (GInstanceInitFunc)gst_rtjpegdec_init,
+ (GInstanceInitFunc) gst_rtjpegdec_init,
};
- rtjpegdec_type = g_type_register_static(GST_TYPE_ELEMENT, "GstRTJpegDec", &rtjpegdec_info, 0);
+ rtjpegdec_type =
+ g_type_register_static (GST_TYPE_ELEMENT, "GstRTJpegDec",
+ &rtjpegdec_info, 0);
}
return rtjpegdec_type;
}
static void
-gst_rtjpegdec_base_init (GstRTJpegDecClass *klass)
+gst_rtjpegdec_base_init (GstRTJpegDecClass * klass)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
@@ -85,27 +90,27 @@ gst_rtjpegdec_base_init (GstRTJpegDecClass *klass)
}
static void
-gst_rtjpegdec_class_init (GstRTJpegDecClass *klass)
+gst_rtjpegdec_class_init (GstRTJpegDecClass * klass)
{
GstElementClass *gstelement_class;
- gstelement_class = (GstElementClass*)klass;
+ gstelement_class = (GstElementClass *) klass;
- parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
+ parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
}
static void
-gst_rtjpegdec_init (GstRTJpegDec *rtjpegdec)
+gst_rtjpegdec_init (GstRTJpegDec * rtjpegdec)
{
- rtjpegdec->sinkpad = gst_pad_new("sink",GST_PAD_SINK);
- gst_element_add_pad(GST_ELEMENT(rtjpegdec),rtjpegdec->sinkpad);
- gst_pad_set_chain_function(rtjpegdec->sinkpad,gst_rtjpegdec_chain);
- rtjpegdec->srcpad = gst_pad_new("src",GST_PAD_SRC);
- gst_element_add_pad(GST_ELEMENT(rtjpegdec),rtjpegdec->srcpad);
+ rtjpegdec->sinkpad = gst_pad_new ("sink", GST_PAD_SINK);
+ gst_element_add_pad (GST_ELEMENT (rtjpegdec), rtjpegdec->sinkpad);
+ gst_pad_set_chain_function (rtjpegdec->sinkpad, gst_rtjpegdec_chain);
+ rtjpegdec->srcpad = gst_pad_new ("src", GST_PAD_SRC);
+ gst_element_add_pad (GST_ELEMENT (rtjpegdec), rtjpegdec->srcpad);
}
static void
-gst_rtjpegdec_chain (GstPad *pad, GstData *_data)
+gst_rtjpegdec_chain (GstPad * pad, GstData * _data)
{
GstBuffer *buf = GST_BUFFER (_data);
GstRTJpegDec *rtjpegdec;
@@ -117,10 +122,10 @@ gst_rtjpegdec_chain (GstPad *pad, GstData *_data)
g_return_if_fail (buf != NULL);
rtjpegdec = GST_RTJPEGDEC (GST_OBJECT_PARENT (pad));
- data = GST_BUFFER_DATA(buf);
- size = GST_BUFFER_SIZE(buf);
+ data = GST_BUFFER_DATA (buf);
+ size = GST_BUFFER_SIZE (buf);
- gst_info("would be encoding frame here\n");
+ gst_info ("would be encoding frame here\n");
- gst_pad_push(rtjpegdec->srcpad,GST_DATA (buf));
+ gst_pad_push (rtjpegdec->srcpad, GST_DATA (buf));
}
diff --git a/gst/rtjpeg/gstrtjpegdec.h b/gst/rtjpeg/gstrtjpegdec.h
index 2214ebd80..23ddce44f 100644
--- a/gst/rtjpeg/gstrtjpegdec.h
+++ b/gst/rtjpeg/gstrtjpegdec.h
@@ -26,8 +26,9 @@
#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
+extern "C"
+{
+#endif /* __cplusplus */
#define GST_TYPE_RTJPEGDEC \
@@ -41,30 +42,32 @@ extern "C" {
#define GST_IS_RTJPEGDEC_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTJPEGDEC)))
-typedef struct _GstRTJpegDec GstRTJpegDec;
-typedef struct _GstRTJpegDecClass GstRTJpegDecClass;
+ typedef struct _GstRTJpegDec GstRTJpegDec;
+ typedef struct _GstRTJpegDecClass GstRTJpegDecClass;
-struct _GstRTJpegDec {
- GstElement element;
+ struct _GstRTJpegDec
+ {
+ GstElement element;
- GstPad *sinkpad,*srcpad;
+ GstPad *sinkpad, *srcpad;
- gint width,height;
- gint quality;
- gint quant[128];
+ gint width, height;
+ gint quality;
+ gint quant[128];
-};
+ };
-struct _GstRTJpegDecClass {
- GstElementClass parent_class;
-};
+ struct _GstRTJpegDecClass
+ {
+ GstElementClass parent_class;
+ };
-GType gst_rtjpegdec_get_type(void);
+ GType gst_rtjpegdec_get_type (void);
#ifdef __cplusplus
}
-#endif /* __cplusplus */
+#endif /* __cplusplus */
-#endif /* __RTJPEGDEC_H__ */
+#endif /* __RTJPEGDEC_H__ */
diff --git a/gst/rtjpeg/gstrtjpegenc.c b/gst/rtjpeg/gstrtjpegenc.c
index d562471a6..14d7df1f2 100644
--- a/gst/rtjpeg/gstrtjpegenc.c
+++ b/gst/rtjpeg/gstrtjpegenc.c
@@ -32,24 +32,27 @@ GstElementDetails gst_rtjpegenc_details = {
};
/* GstRTJpegEnc signals and args */
-enum {
+enum
+{
/* FILL ME */
LAST_SIGNAL
};
-enum {
+enum
+{
ARG_0,
ARG_QUALITY,
};
-static void gst_rtjpegenc_class_init (GstRTJpegEncClass *klass);
-static void gst_rtjpegenc_base_init (GstRTJpegEncClass *klass);
-static void gst_rtjpegenc_init (GstRTJpegEnc *rtjpegenc);
+static void gst_rtjpegenc_class_init (GstRTJpegEncClass * klass);
+static void gst_rtjpegenc_base_init (GstRTJpegEncClass * klass);
+static void gst_rtjpegenc_init (GstRTJpegEnc * rtjpegenc);
-static void gst_rtjpegenc_chain (GstPad *pad, GstData *_data);
+static void gst_rtjpegenc_chain (GstPad * pad, GstData * _data);
static GstElementClass *parent_class = NULL;
+
/*static guint gst_rtjpegenc_signals[LAST_SIGNAL] = { 0 }; */
GType
@@ -59,23 +62,25 @@ gst_rtjpegenc_get_type (void)
if (!rtjpegenc_type) {
static const GTypeInfo rtjpegenc_info = {
- sizeof(GstRTJpegEncClass),
- (GBaseInitFunc)gst_rtjpegenc_base_init,
+ sizeof (GstRTJpegEncClass),
+ (GBaseInitFunc) gst_rtjpegenc_base_init,
NULL,
- (GClassInitFunc)gst_rtjpegenc_class_init,
+ (GClassInitFunc) gst_rtjpegenc_class_init,
NULL,
NULL,
- sizeof(GstRTJpegEnc),
+ sizeof (GstRTJpegEnc),
0,
- (GInstanceInitFunc)gst_rtjpegenc_init,
+ (GInstanceInitFunc) gst_rtjpegenc_init,
};
- rtjpegenc_type = g_type_register_static(GST_TYPE_ELEMENT, "GstRTJpegEnc", &rtjpegenc_info, 0);
+ rtjpegenc_type =
+ g_type_register_static (GST_TYPE_ELEMENT, "GstRTJpegEnc",
+ &rtjpegenc_info, 0);
}
return rtjpegenc_type;
}
static void
-gst_rtjpegenc_base_init (GstRTJpegEncClass *klass)
+gst_rtjpegenc_base_init (GstRTJpegEncClass * klass)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
@@ -83,42 +88,42 @@ gst_rtjpegenc_base_init (GstRTJpegEncClass *klass)
}
static void
-gst_rtjpegenc_class_init (GstRTJpegEncClass *klass)
+gst_rtjpegenc_class_init (GstRTJpegEncClass * klass)
{
GstElementClass *gstelement_class;
- gstelement_class = (GstElementClass*)klass;
+ gstelement_class = (GstElementClass *) klass;
- parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
+ parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
}
static void
-gst_rtjpegenc_init (GstRTJpegEnc *rtjpegenc)
+gst_rtjpegenc_init (GstRTJpegEnc * rtjpegenc)
{
- 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);
+ 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);
}
static void
-gst_rtjpegenc_chain (GstPad *pad, GstData *_data)
+gst_rtjpegenc_chain (GstPad * pad, GstData * _data)
{
GstBuffer *buf = GST_BUFFER (_data);
GstRTJpegEnc *rtjpegenc;
guchar *data;
gulong size;
- g_return_if_fail(pad != NULL);
- g_return_if_fail(GST_IS_PAD(pad));
- g_return_if_fail(buf != NULL);
+ g_return_if_fail (pad != NULL);
+ g_return_if_fail (GST_IS_PAD (pad));
+ g_return_if_fail (buf != NULL);
rtjpegenc = GST_RTJPEGENC (GST_OBJECT_PARENT (pad));
- data = GST_BUFFER_DATA(buf);
- size = GST_BUFFER_SIZE(buf);
+ data = GST_BUFFER_DATA (buf);
+ size = GST_BUFFER_SIZE (buf);
- gst_info("would be encoding frame here\n");
+ gst_info ("would be encoding frame here\n");
- gst_pad_push(rtjpegenc->srcpad,GST_DATA (buf));
+ gst_pad_push (rtjpegenc->srcpad, GST_DATA (buf));
}
diff --git a/gst/rtjpeg/gstrtjpegenc.h b/gst/rtjpeg/gstrtjpegenc.h
index 61303b7bc..34c143b26 100644
--- a/gst/rtjpeg/gstrtjpegenc.h
+++ b/gst/rtjpeg/gstrtjpegenc.h
@@ -28,8 +28,9 @@
#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
+extern "C"
+{
+#endif /* __cplusplus */
#define GST_TYPE_RTJPEGENC \
@@ -43,29 +44,31 @@ extern "C" {
#define GST_IS_RTJPEGENC_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTJPEGENC))
-typedef struct _GstRTJpegEnc GstRTJpegEnc;
-typedef struct _GstRTJpegEncClass GstRTJpegEncClass;
+ typedef struct _GstRTJpegEnc GstRTJpegEnc;
+ typedef struct _GstRTJpegEncClass GstRTJpegEncClass;
-struct _GstRTJpegEnc {
- GstElement element;
+ struct _GstRTJpegEnc
+ {
+ GstElement element;
- GstPad *sinkpad,*srcpad;
+ GstPad *sinkpad, *srcpad;
- gint width,height;
- gint quality;
- gint quant[128];
-};
+ gint width, height;
+ gint quality;
+ gint quant[128];
+ };
-struct _GstRTJpegEncClass {
- GstElementClass parent_class;
-};
+ struct _GstRTJpegEncClass
+ {
+ GstElementClass parent_class;
+ };
-GType gst_rtjpegenc_get_type(void);
+ GType gst_rtjpegenc_get_type (void);
#ifdef __cplusplus
}
-#endif /* __cplusplus */
+#endif /* __cplusplus */
-#endif /* __RTJPEGENC_H__ */
+#endif /* __RTJPEGENC_H__ */
diff --git a/gst/smooth/gstsmooth.c b/gst/smooth/gstsmooth.c
index 286786e83..0302c7e02 100644
--- a/gst/smooth/gstsmooth.c
+++ b/gst/smooth/gstsmooth.c
@@ -34,12 +34,14 @@ static GstElementDetails smooth_details = {
/* Smooth signals and args */
-enum {
+enum
+{
/* FILL ME */
LAST_SIGNAL
};
-enum {
+enum
+{
ARG_0,
ARG_ACTIVE,
ARG_TOLERANCE,
@@ -48,37 +50,36 @@ enum {
};
static GstStaticPadTemplate gst_smooth_src_template =
-GST_STATIC_PAD_TEMPLATE (
- "src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (
- GST_VIDEO_CAPS_YUV("I420")
- )
-);
+GST_STATIC_PAD_TEMPLATE ("src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("I420")
+ )
+ );
static GstStaticPadTemplate gst_smooth_sink_template =
-GST_STATIC_PAD_TEMPLATE (
- "sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (
- GST_VIDEO_CAPS_YUV("I420")
- )
-);
-
-static void gst_smooth_class_init (GstSmoothClass *klass);
-static void gst_smooth_base_init (GstSmoothClass *klass);
-static void gst_smooth_init (GstSmooth *smooth);
-
-static void gst_smooth_chain (GstPad *pad, GstData *_data);
-static void smooth_filter (unsigned char* dest, unsigned char* src,
- int width, int height, int tolerance, int filtersize);
-
-static void gst_smooth_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
-static void gst_smooth_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
+GST_STATIC_PAD_TEMPLATE ("sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("I420")
+ )
+ );
+
+static void gst_smooth_class_init (GstSmoothClass * klass);
+static void gst_smooth_base_init (GstSmoothClass * klass);
+static void gst_smooth_init (GstSmooth * smooth);
+
+static void gst_smooth_chain (GstPad * pad, GstData * _data);
+static void smooth_filter (unsigned char *dest, unsigned char *src,
+ int width, int height, int tolerance, int filtersize);
+
+static void gst_smooth_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec);
+static void gst_smooth_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec);
static GstElementClass *parent_class = NULL;
+
/*static guint gst_smooth_signals[LAST_SIGNAL] = { 0 }; */
GType
@@ -88,23 +89,24 @@ gst_smooth_get_type (void)
if (!smooth_type) {
static const GTypeInfo smooth_info = {
- sizeof(GstSmoothClass),
- (GBaseInitFunc)gst_smooth_base_init,
+ sizeof (GstSmoothClass),
+ (GBaseInitFunc) gst_smooth_base_init,
NULL,
- (GClassInitFunc)gst_smooth_class_init,
+ (GClassInitFunc) gst_smooth_class_init,
NULL,
NULL,
- sizeof(GstSmooth),
+ sizeof (GstSmooth),
0,
- (GInstanceInitFunc)gst_smooth_init,
+ (GInstanceInitFunc) gst_smooth_init,
};
- smooth_type = g_type_register_static(GST_TYPE_ELEMENT, "GstSmooth", &smooth_info, 0);
+ smooth_type =
+ g_type_register_static (GST_TYPE_ELEMENT, "GstSmooth", &smooth_info, 0);
}
return smooth_type;
}
static void
-gst_smooth_base_init (GstSmoothClass *klass)
+gst_smooth_base_init (GstSmoothClass * klass)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
@@ -116,25 +118,19 @@ gst_smooth_base_init (GstSmoothClass *klass)
}
static void
-gst_smooth_class_init (GstSmoothClass *klass)
+gst_smooth_class_init (GstSmoothClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
- gobject_class = (GObjectClass*)klass;
- gstelement_class = (GstElementClass*)klass;
+ gobject_class = (GObjectClass *) klass;
+ gstelement_class = (GstElementClass *) klass;
- parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
+ parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
- g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_ACTIVE,
- g_param_spec_boolean("active","active","active",
- TRUE,G_PARAM_READWRITE)); /* CHECKME */
- g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_TOLERANCE,
- g_param_spec_int("tolerance","tolerance","tolerance",
- G_MININT,G_MAXINT,0,G_PARAM_READWRITE)); /* CHECKME */
- g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_FILTERSIZE,
- g_param_spec_int("filtersize","filtersize","filtersize",
- G_MININT,G_MAXINT,0,G_PARAM_READWRITE)); /* CHECKME */
+ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_ACTIVE, g_param_spec_boolean ("active", "active", "active", TRUE, G_PARAM_READWRITE)); /* CHECKME */
+ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_TOLERANCE, g_param_spec_int ("tolerance", "tolerance", "tolerance", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */
+ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FILTERSIZE, g_param_spec_int ("filtersize", "filtersize", "filtersize", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */
gobject_class->set_property = gst_smooth_set_property;
gobject_class->get_property = gst_smooth_get_property;
@@ -142,7 +138,7 @@ gst_smooth_class_init (GstSmoothClass *klass)
}
static GstPadLinkReturn
-gst_smooth_link (GstPad *pad, const GstCaps *caps)
+gst_smooth_link (GstPad * pad, const GstCaps * caps)
{
GstSmooth *filter;
GstStructure *structure;
@@ -154,22 +150,25 @@ gst_smooth_link (GstPad *pad, const GstCaps *caps)
ret = gst_structure_get_int (structure, "width", &filter->width);
ret &= gst_structure_get_int (structure, "height", &filter->height);
- if (!ret) return GST_PAD_LINK_REFUSED;
+ if (!ret)
+ return GST_PAD_LINK_REFUSED;
return gst_pad_try_set_caps (filter->srcpad, caps);
}
static void
-gst_smooth_init (GstSmooth *smooth)
+gst_smooth_init (GstSmooth * smooth)
{
- smooth->sinkpad = gst_pad_new_from_template (
- gst_static_pad_template_get (&gst_smooth_sink_template), "sink");
+ smooth->sinkpad =
+ gst_pad_new_from_template (gst_static_pad_template_get
+ (&gst_smooth_sink_template), "sink");
gst_pad_set_link_function (smooth->sinkpad, gst_smooth_link);
gst_pad_set_chain_function (smooth->sinkpad, gst_smooth_chain);
gst_element_add_pad (GST_ELEMENT (smooth), smooth->sinkpad);
- smooth->srcpad = gst_pad_new_from_template (
- gst_static_pad_template_get (&gst_smooth_sink_template), "src");
+ smooth->srcpad =
+ gst_pad_new_from_template (gst_static_pad_template_get
+ (&gst_smooth_sink_template), "src");
gst_pad_set_link_function (smooth->srcpad, gst_smooth_link);
gst_element_add_pad (GST_ELEMENT (smooth), smooth->srcpad);
@@ -180,55 +179,53 @@ gst_smooth_init (GstSmooth *smooth)
}
static void
-smooth_filter (unsigned char* dest, unsigned char* src, int width, int height, int tolerance, int filtersize)
+smooth_filter (unsigned char *dest, unsigned char *src, int width, int height,
+ int tolerance, int filtersize)
{
int refval, aktval, upperval, lowerval, numvalues, sum;
int x, y, fx, fy, fy1, fy2, fx1, fx2;
unsigned char *srcp = src;
fy1 = 0;
- fy2 = MIN(filtersize+1, height) * width;
+ fy2 = MIN (filtersize + 1, height) * width;
- for(y = 0; y < height; y++)
- {
- if (y>(filtersize+1)) fy1 += width;
- if (y<height-(filtersize+1)) fy2 += width;
+ for (y = 0; y < height; y++) {
+ if (y > (filtersize + 1))
+ fy1 += width;
+ if (y < height - (filtersize + 1))
+ fy2 += width;
- for(x = 0; x < width; x++)
- {
- refval = *src;
- upperval = refval + tolerance;
- lowerval = refval - tolerance;
+ for (x = 0; x < width; x++) {
+ refval = *src;
+ upperval = refval + tolerance;
+ lowerval = refval - tolerance;
numvalues = 1;
- sum = refval;
-
- fx1 = MAX(x-filtersize, 0) + fy1;
- fx2 = MIN(x+filtersize+1, width) + fy1;
-
- for (fy = fy1; fy<fy2; fy+=width)
- {
- for (fx = fx1; fx<fx2; fx++)
- {
- aktval = srcp[fx];
- if ((lowerval-aktval)*(upperval-aktval)<0)
- {
- numvalues ++;
- sum += aktval;
- }
- } /*for fx */
- fx1 += width;
- fx2 += width;
- } /*for fy */
+ sum = refval;
+
+ fx1 = MAX (x - filtersize, 0) + fy1;
+ fx2 = MIN (x + filtersize + 1, width) + fy1;
+
+ for (fy = fy1; fy < fy2; fy += width) {
+ for (fx = fx1; fx < fx2; fx++) {
+ aktval = srcp[fx];
+ if ((lowerval - aktval) * (upperval - aktval) < 0) {
+ numvalues++;
+ sum += aktval;
+ }
+ } /*for fx */
+ fx1 += width;
+ fx2 += width;
+ } /*for fy */
src++;
- *dest++ = sum/numvalues;
+ *dest++ = sum / numvalues;
}
}
}
static void
-gst_smooth_chain (GstPad *pad, GstData *_data)
+gst_smooth_chain (GstPad * pad, GstData * _data)
{
GstBuffer *buf = GST_BUFFER (_data);
GstSmooth *smooth;
@@ -244,7 +241,7 @@ gst_smooth_chain (GstPad *pad, GstData *_data)
smooth = GST_SMOOTH (GST_OBJECT_PARENT (pad));
if (!smooth->active) {
- gst_pad_push(smooth->srcpad,GST_DATA (buf));
+ gst_pad_push (smooth->srcpad, GST_DATA (buf));
return;
}
@@ -253,23 +250,24 @@ gst_smooth_chain (GstPad *pad, GstData *_data)
GST_DEBUG ("smooth: have buffer of %d", GST_BUFFER_SIZE (buf));
- outbuf = gst_buffer_new();
+ outbuf = gst_buffer_new ();
GST_BUFFER_DATA (outbuf) = g_malloc (GST_BUFFER_SIZE (buf));
GST_BUFFER_SIZE (outbuf) = GST_BUFFER_SIZE (buf);
- lumsize = smooth->width*smooth->height;
- chromsize = lumsize/4;
+ lumsize = smooth->width * smooth->height;
+ chromsize = lumsize / 4;
- smooth_filter (GST_BUFFER_DATA (outbuf), data, smooth->width, smooth->height,
- smooth->tolerance, smooth->filtersize);
+ smooth_filter (GST_BUFFER_DATA (outbuf), data, smooth->width, smooth->height,
+ smooth->tolerance, smooth->filtersize);
if (!smooth->lum_only) {
- smooth_filter (GST_BUFFER_DATA (outbuf)+lumsize, data+lumsize, smooth->width/2, smooth->height/2,
- smooth->tolerance, smooth->filtersize/2);
- smooth_filter (GST_BUFFER_DATA (outbuf)+lumsize+chromsize, data+lumsize+chromsize, smooth->width/2,
- smooth->height/2, smooth->tolerance, smooth->filtersize/2);
- }
- else {
- memcpy (GST_BUFFER_DATA (outbuf)+lumsize, data+lumsize, chromsize*2);
+ smooth_filter (GST_BUFFER_DATA (outbuf) + lumsize, data + lumsize,
+ smooth->width / 2, smooth->height / 2, smooth->tolerance,
+ smooth->filtersize / 2);
+ smooth_filter (GST_BUFFER_DATA (outbuf) + lumsize + chromsize,
+ data + lumsize + chromsize, smooth->width / 2, smooth->height / 2,
+ smooth->tolerance, smooth->filtersize / 2);
+ } else {
+ memcpy (GST_BUFFER_DATA (outbuf) + lumsize, data + lumsize, chromsize * 2);
}
GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (buf);
@@ -280,13 +278,14 @@ gst_smooth_chain (GstPad *pad, GstData *_data)
}
static void
-gst_smooth_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
+gst_smooth_set_property (GObject * object, guint prop_id, const GValue * value,
+ GParamSpec * pspec)
{
GstSmooth *smooth;
/* it's not null if we got it, but it might not be ours */
- g_return_if_fail(GST_IS_SMOOTH(object));
- smooth = GST_SMOOTH(object);
+ g_return_if_fail (GST_IS_SMOOTH (object));
+ smooth = GST_SMOOTH (object);
switch (prop_id) {
case ARG_ACTIVE:
@@ -307,13 +306,14 @@ gst_smooth_set_property (GObject *object, guint prop_id, const GValue *value, GP
}
static void
-gst_smooth_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+gst_smooth_get_property (GObject * object, guint prop_id, GValue * value,
+ GParamSpec * pspec)
{
GstSmooth *smooth;
/* it's not null if we got it, but it might not be ours */
- g_return_if_fail(GST_IS_SMOOTH(object));
- smooth = GST_SMOOTH(object);
+ g_return_if_fail (GST_IS_SMOOTH (object));
+ smooth = GST_SMOOTH (object);
switch (prop_id) {
case ARG_ACTIVE:
@@ -336,20 +336,14 @@ gst_smooth_get_property (GObject *object, guint prop_id, GValue *value, GParamSp
static gboolean
-plugin_init (GstPlugin *plugin)
+plugin_init (GstPlugin * plugin)
{
- return gst_element_register(plugin, "smooth",
- GST_RANK_NONE, GST_TYPE_SMOOTH);
+ return gst_element_register (plugin, "smooth",
+ GST_RANK_NONE, GST_TYPE_SMOOTH);
}
-GST_PLUGIN_DEFINE (
- GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "smooth",
- "Apply a smooth filter to an image",
- plugin_init,
- VERSION,
- "LGPL",
- GST_PACKAGE,
- GST_ORIGIN
-)
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ "smooth",
+ "Apply a smooth filter to an image",
+ plugin_init, VERSION, "LGPL", GST_PACKAGE, GST_ORIGIN)
diff --git a/gst/smooth/gstsmooth.h b/gst/smooth/gstsmooth.h
index eb32de36b..aae3cc21a 100644
--- a/gst/smooth/gstsmooth.h
+++ b/gst/smooth/gstsmooth.h
@@ -25,8 +25,9 @@
#include <gst/gst.h>
#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
+extern "C"
+{
+#endif /* __cplusplus */
#define GST_TYPE_SMOOTH \
@@ -40,34 +41,36 @@ extern "C" {
#define GST_IS_SMOOTH_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SMOOTH))
-typedef struct _GstSmooth GstSmooth;
-typedef struct _GstSmoothClass GstSmoothClass;
+ typedef struct _GstSmooth GstSmooth;
+ typedef struct _GstSmoothClass GstSmoothClass;
-struct _GstSmooth {
- GstElement element;
+ struct _GstSmooth
+ {
+ GstElement element;
- int format;
- int width;
- int height;
+ int format;
+ int width;
+ int height;
- gboolean active;
- int tolerance;
- int filtersize;
- gboolean lum_only;
+ gboolean active;
+ int tolerance;
+ int filtersize;
+ gboolean lum_only;
- GstPad *sinkpad,*srcpad;
-};
+ GstPad *sinkpad, *srcpad;
+ };
-struct _GstSmoothClass {
- GstElementClass parent_class;
-};
+ struct _GstSmoothClass
+ {
+ GstElementClass parent_class;
+ };
-GType gst_smooth_get_type(void);
+ GType gst_smooth_get_type (void);
#ifdef __cplusplus
}
-#endif /* __cplusplus */
+#endif /* __cplusplus */
-#endif /* __GST_SMOOTH_H__ */
+#endif /* __GST_SMOOTH_H__ */
diff --git a/gst/smoothwave/demo-osssrc.c b/gst/smoothwave/demo-osssrc.c
index 457900d7c..c39bc72c7 100644
--- a/gst/smoothwave/demo-osssrc.c
+++ b/gst/smoothwave/demo-osssrc.c
@@ -3,11 +3,13 @@
extern gboolean _gst_plugin_spew;
-gboolean idle_func(gpointer data);
+gboolean idle_func (gpointer data);
GtkWidget *drawingarea;
-int main(int argc,char *argv[]) {
+int
+main (int argc, char *argv[])
+{
GstElement *bin;
GstElementFactory *srcfactory;
GstElement *src;
@@ -16,46 +18,47 @@ int main(int argc,char *argv[]) {
GtkWidget *wave_widget;
GtkWidget *appwindow;
- gst_init(&argc,&argv);
- gst_plugin_load("libsmoothwave.so");
- gtk_init(&argc,&argv);
+ gst_init (&argc, &argv);
+ gst_plugin_load ("libsmoothwave.so");
+ gtk_init (&argc, &argv);
- bin = gst_pipeline_new("bin");
+ bin = gst_pipeline_new ("bin");
- srcfactory = gst_element_factory_find("sinesrc");
- g_return_val_if_fail(srcfactory != NULL, -1);
- wavefactory = gst_element_factory_find("smoothwave");
- g_return_val_if_fail(wavefactory != NULL, -1);
+ srcfactory = gst_element_factory_find ("sinesrc");
+ g_return_val_if_fail (srcfactory != NULL, -1);
+ wavefactory = gst_element_factory_find ("smoothwave");
+ g_return_val_if_fail (wavefactory != NULL, -1);
- src = gst_element_factory_create(srcfactory,"src");
+ src = gst_element_factory_create (srcfactory, "src");
//g_object_set(G_OBJECT(src),"bytes_per_read",(gulong)2048,NULL);
- wave = gst_element_factory_create(wavefactory,"wave");
- g_object_set(G_OBJECT(wave),"width",256,"height",100,NULL);
+ wave = gst_element_factory_create (wavefactory, "wave");
+ g_object_set (G_OBJECT (wave), "width", 256, "height", 100, NULL);
- gst_bin_add(GST_BIN(bin),GST_ELEMENT(src));
- gst_bin_add(GST_BIN(bin),GST_ELEMENT(wave));
+ gst_bin_add (GST_BIN (bin), GST_ELEMENT (src));
+ gst_bin_add (GST_BIN (bin), GST_ELEMENT (wave));
- gst_pad_link(gst_element_get_pad(src,"src"),
- gst_element_get_pad(wave,"sink"));
+ gst_pad_link (gst_element_get_pad (src, "src"),
+ gst_element_get_pad (wave, "sink"));
- appwindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
- g_object_get(G_OBJECT(wave),"widget",&wave_widget,NULL);
- gtk_container_add(GTK_CONTAINER(appwindow), wave_widget);
- gtk_widget_show_all(appwindow);
+ appwindow = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+ g_object_get (G_OBJECT (wave), "widget", &wave_widget, NULL);
+ gtk_container_add (GTK_CONTAINER (appwindow), wave_widget);
+ gtk_widget_show_all (appwindow);
- gst_element_set_state(GST_ELEMENT(bin),GST_STATE_READY);
- gst_element_set_state(GST_ELEMENT(bin),GST_STATE_PLAYING);
+ gst_element_set_state (GST_ELEMENT (bin), GST_STATE_READY);
+ gst_element_set_state (GST_ELEMENT (bin), GST_STATE_PLAYING);
- g_idle_add(idle_func,bin);
+ g_idle_add (idle_func, bin);
- gtk_main();
+ gtk_main ();
return 0;
}
-gboolean idle_func(gpointer data)
+gboolean
+idle_func (gpointer data)
{
- gst_bin_iterate(GST_BIN(data));
+ gst_bin_iterate (GST_BIN (data));
return TRUE;
}
diff --git a/gst/smoothwave/gstsmoothwave.c b/gst/smoothwave/gstsmoothwave.c
index 57c267e51..2abbdec2f 100644
--- a/gst/smoothwave/gstsmoothwave.c
+++ b/gst/smoothwave/gstsmoothwave.c
@@ -25,37 +25,41 @@
#include "gstsmoothwave.h"
-static GstElementDetails gst_smoothwave_details = GST_ELEMENT_DETAILS (
- "Smooth waveform",
- "Visualization",
- "Fading grayscale waveform display",
- "Erik Walthinsen <omega@cse.ogi.edu>"
-);
+static GstElementDetails gst_smoothwave_details =
+GST_ELEMENT_DETAILS ("Smooth waveform",
+ "Visualization",
+ "Fading grayscale waveform display",
+ "Erik Walthinsen <omega@cse.ogi.edu>");
/* SmoothWave signals and args */
-enum {
+enum
+{
/* FILL ME */
LAST_SIGNAL
};
-enum {
+enum
+{
ARG_0,
ARG_WIDTH,
ARG_HEIGHT,
ARG_WIDGET,
};
-static void gst_smoothwave_base_init (gpointer g_class);
-static void gst_smoothwave_class_init (GstSmoothWaveClass *klass);
-static void gst_smoothwave_init (GstSmoothWave *smoothwave);
+static void gst_smoothwave_base_init (gpointer g_class);
+static void gst_smoothwave_class_init (GstSmoothWaveClass * klass);
+static void gst_smoothwave_init (GstSmoothWave * smoothwave);
-static void gst_smoothwave_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
-static void gst_smoothwave_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
+static void gst_smoothwave_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec);
+static void gst_smoothwave_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec);
-static void gst_smoothwave_chain (GstPad *pad, GstData *_data);
+static void gst_smoothwave_chain (GstPad * pad, GstData * _data);
static GstElementClass *parent_class = NULL;
+
/*static guint gst_smoothwave_signals[LAST_SIGNAL] = { 0 }; */
@@ -66,17 +70,19 @@ gst_smoothwave_get_type (void)
if (!smoothwave_type) {
static const GTypeInfo smoothwave_info = {
- sizeof(GstSmoothWaveClass),
+ sizeof (GstSmoothWaveClass),
gst_smoothwave_base_init,
NULL,
- (GClassInitFunc)gst_smoothwave_class_init,
+ (GClassInitFunc) gst_smoothwave_class_init,
NULL,
NULL,
- sizeof(GstSmoothWave),
+ sizeof (GstSmoothWave),
0,
- (GInstanceInitFunc)gst_smoothwave_init,
+ (GInstanceInitFunc) gst_smoothwave_init,
};
- smoothwave_type = g_type_register_static(GST_TYPE_ELEMENT, "GstSmoothWave", &smoothwave_info, 0);
+ smoothwave_type =
+ g_type_register_static (GST_TYPE_ELEMENT, "GstSmoothWave",
+ &smoothwave_info, 0);
}
return smoothwave_type;
}
@@ -90,83 +96,77 @@ gst_smoothwave_base_init (gpointer g_class)
}
static void
-gst_smoothwave_class_init (GstSmoothWaveClass *klass)
+gst_smoothwave_class_init (GstSmoothWaveClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
- gobject_class = (GObjectClass*)klass;
- gstelement_class = (GstElementClass*)klass;
+ gobject_class = (GObjectClass *) klass;
+ gstelement_class = (GstElementClass *) klass;
- parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
+ parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
- g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_WIDTH,
- g_param_spec_int("width","width","width",
- G_MININT,G_MAXINT,0,G_PARAM_READWRITE)); /* CHECKME */
- g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_HEIGHT,
- g_param_spec_int("height","height","height",
- G_MININT,G_MAXINT,0,G_PARAM_READWRITE)); /* CHECKME */
- g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_WIDGET,
- g_param_spec_object("widget","widget","widget",
- GTK_TYPE_WIDGET,G_PARAM_READABLE)); /* CHECKME! */
+ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_WIDTH, g_param_spec_int ("width", "width", "width", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */
+ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_HEIGHT, g_param_spec_int ("height", "height", "height", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */
+ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_WIDGET, g_param_spec_object ("widget", "widget", "widget", GTK_TYPE_WIDGET, G_PARAM_READABLE)); /* CHECKME! */
gobject_class->set_property = gst_smoothwave_set_property;
gobject_class->get_property = gst_smoothwave_get_property;
}
static void
-gst_smoothwave_init (GstSmoothWave *smoothwave)
+gst_smoothwave_init (GstSmoothWave * smoothwave)
{
int i;
guint32 palette[256];
- smoothwave->sinkpad = gst_pad_new("sink",GST_PAD_SINK);
- gst_element_add_pad(GST_ELEMENT(smoothwave),smoothwave->sinkpad);
- gst_pad_set_chain_function(smoothwave->sinkpad,gst_smoothwave_chain);
- smoothwave->srcpad = gst_pad_new("src",GST_PAD_SRC);
- gst_element_add_pad(GST_ELEMENT(smoothwave),smoothwave->srcpad);
+ smoothwave->sinkpad = gst_pad_new ("sink", GST_PAD_SINK);
+ gst_element_add_pad (GST_ELEMENT (smoothwave), smoothwave->sinkpad);
+ gst_pad_set_chain_function (smoothwave->sinkpad, gst_smoothwave_chain);
+ smoothwave->srcpad = gst_pad_new ("src", GST_PAD_SRC);
+ gst_element_add_pad (GST_ELEMENT (smoothwave), smoothwave->srcpad);
/* smoothwave->meta = NULL; */
smoothwave->width = 512;
smoothwave->height = 256;
- gdk_rgb_init();
+ gdk_rgb_init ();
/* gtk_widget_set_default_colormap (gdk_rgb_get_cmap()); */
/* gtk_widget_set_default_visual (gdk_rgb_get_visual()); */
/* GST_DEBUG ("creating palette"); */
- for (i=0;i<256;i++)
+ for (i = 0; i < 256; i++)
palette[i] = (i << 16) || (i << 8);
/* GST_DEBUG ("creating cmap"); */
- smoothwave->cmap = gdk_rgb_cmap_new(palette,256);
+ smoothwave->cmap = gdk_rgb_cmap_new (palette, 256);
/* GST_DEBUG ("created cmap"); */
/* gtk_widget_set_default_colormap (smoothwave->cmap); */
- smoothwave->image = gtk_drawing_area_new();
- gtk_drawing_area_size(GTK_DRAWING_AREA(smoothwave->image),
- smoothwave->width,smoothwave->height);
- gtk_widget_show(smoothwave->image);
+ smoothwave->image = gtk_drawing_area_new ();
+ gtk_drawing_area_size (GTK_DRAWING_AREA (smoothwave->image),
+ smoothwave->width, smoothwave->height);
+ gtk_widget_show (smoothwave->image);
- smoothwave->imagebuffer = g_malloc(smoothwave->width*smoothwave->height);
- memset(smoothwave->imagebuffer,0,smoothwave->width*smoothwave->height);
+ smoothwave->imagebuffer = g_malloc (smoothwave->width * smoothwave->height);
+ memset (smoothwave->imagebuffer, 0, smoothwave->width * smoothwave->height);
}
static void
-gst_smoothwave_chain (GstPad *pad, GstData *_data)
+gst_smoothwave_chain (GstPad * pad, GstData * _data)
{
GstBuffer *buf = GST_BUFFER (_data);
GstSmoothWave *smoothwave;
gint16 *samples;
- gint samplecount,i;
+ gint samplecount, i;
register guint32 *ptr;
gint qheight;
- g_return_if_fail(pad != NULL);
- g_return_if_fail(GST_IS_PAD(pad));
- g_return_if_fail(buf != NULL);
+ g_return_if_fail (pad != NULL);
+ g_return_if_fail (GST_IS_PAD (pad));
+ g_return_if_fail (buf != NULL);
/* g_return_if_fail(GST_IS_BUFFER(buf)); */
- smoothwave = GST_SMOOTHWAVE(GST_OBJECT_PARENT (pad));
+ smoothwave = GST_SMOOTHWAVE (GST_OBJECT_PARENT (pad));
/* first deal with audio metadata */
#if 0
@@ -175,36 +175,35 @@ gst_smoothwave_chain (GstPad *pad, GstData *_data)
/* FIXME: need to unref the old metadata so it goes away */
}
/* we just make a copy of the pointer */
- smoothwave->meta = (MetaAudioRaw *)(buf->meta);
+ smoothwave->meta = (MetaAudioRaw *) (buf->meta);
/* FIXME: now we have to ref the metadata so it doesn't go away */
}
#endif
/* g_return_if_fail(smoothwave->meta != NULL); */
- samples = (gint16 *)GST_BUFFER_DATA(buf);
+ samples = (gint16 *) GST_BUFFER_DATA (buf);
/* samplecount = buf->datasize / (smoothwave->meta->channels * sizeof(gint16)); */
- samplecount = GST_BUFFER_SIZE(buf) / (2 * sizeof(gint16));
+ samplecount = GST_BUFFER_SIZE (buf) / (2 * sizeof (gint16));
- qheight = smoothwave->height/4;
+ qheight = smoothwave->height / 4;
/* GST_DEBUG ("traversing %d",smoothwave->width); */
- for (i=0;i<MAX(smoothwave->width,samplecount);i++) {
- gint16 y1 = (gint32)(samples[i*2] * qheight) / 32768 +
- qheight;
- gint16 y2 = (gint32)(samples[(i*2)+1] * qheight) / 32768 +
- (qheight*3);
- smoothwave->imagebuffer[y1*smoothwave->width + i] = 0xff;
- smoothwave->imagebuffer[y2*smoothwave->width + i] = 0xff;
+ for (i = 0; i < MAX (smoothwave->width, samplecount); i++) {
+ gint16 y1 = (gint32) (samples[i * 2] * qheight) / 32768 + qheight;
+ gint16 y2 = (gint32) (samples[(i * 2) + 1] * qheight) / 32768 +
+ (qheight * 3);
+ smoothwave->imagebuffer[y1 * smoothwave->width + i] = 0xff;
+ smoothwave->imagebuffer[y2 * smoothwave->width + i] = 0xff;
/* smoothwave->imagebuffer[i+(smoothwave->width*5)] = i; */
}
- ptr = (guint32 *)smoothwave->imagebuffer;
- for (i=0;i<(smoothwave->width*smoothwave->height)/4;i++) {
- if (*ptr){
+ ptr = (guint32 *) smoothwave->imagebuffer;
+ for (i = 0; i < (smoothwave->width * smoothwave->height) / 4; i++) {
+ if (*ptr) {
*ptr -= ((*ptr & 0xf0f0f0f0ul) >> 4) + ((*ptr & 0xe0e0e0e0ul) >> 5);
ptr++;
- }else{
+ } else {
ptr++;
}
}
@@ -223,40 +222,40 @@ gst_smoothwave_chain (GstPad *pad, GstData *_data)
GDK_RGB_DITHER_NONE,
smoothwave->imagebuffer,smoothwave->width,
smoothwave->cmap);*/
- gdk_draw_gray_image(smoothwave->image->window,
- smoothwave->image->style->fg_gc[GTK_STATE_NORMAL],
- 0,0,smoothwave->width,smoothwave->height,
- GDK_RGB_DITHER_NORMAL,
- smoothwave->imagebuffer,smoothwave->width);
+ gdk_draw_gray_image (smoothwave->image->window,
+ smoothwave->image->style->fg_gc[GTK_STATE_NORMAL],
+ 0, 0, smoothwave->width, smoothwave->height,
+ GDK_RGB_DITHER_NORMAL, smoothwave->imagebuffer, smoothwave->width);
/* gst_trace_add_entry(NULL,0,buf,"smoothwave: calculated smoothwave"); */
- gst_buffer_unref(buf);
+ gst_buffer_unref (buf);
}
static void
-gst_smoothwave_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
+gst_smoothwave_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec)
{
GstSmoothWave *smoothwave;
/* it's not null if we got it, but it might not be ours */
- g_return_if_fail(GST_IS_SMOOTHWAVE(object));
- smoothwave = GST_SMOOTHWAVE(object);
+ g_return_if_fail (GST_IS_SMOOTHWAVE (object));
+ smoothwave = GST_SMOOTHWAVE (object);
switch (prop_id) {
case ARG_WIDTH:
smoothwave->width = g_value_get_int (value);
- gtk_drawing_area_size(GTK_DRAWING_AREA(smoothwave->image),
- smoothwave->width,smoothwave->height);
- gtk_widget_set_usize(GTK_WIDGET(smoothwave->image),
- smoothwave->width,smoothwave->height);
+ gtk_drawing_area_size (GTK_DRAWING_AREA (smoothwave->image),
+ smoothwave->width, smoothwave->height);
+ gtk_widget_set_usize (GTK_WIDGET (smoothwave->image),
+ smoothwave->width, smoothwave->height);
break;
case ARG_HEIGHT:
smoothwave->height = g_value_get_int (value);
- gtk_drawing_area_size(GTK_DRAWING_AREA(smoothwave->image),
- smoothwave->width,smoothwave->height);
- gtk_widget_set_usize(GTK_WIDGET(smoothwave->image),
- smoothwave->width,smoothwave->height);
+ gtk_drawing_area_size (GTK_DRAWING_AREA (smoothwave->image),
+ smoothwave->width, smoothwave->height);
+ gtk_widget_set_usize (GTK_WIDGET (smoothwave->image),
+ smoothwave->width, smoothwave->height);
break;
default:
break;
@@ -264,27 +263,28 @@ gst_smoothwave_set_property (GObject *object, guint prop_id, const GValue *value
}
static void
-gst_smoothwave_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+gst_smoothwave_get_property (GObject * object, guint prop_id, GValue * value,
+ GParamSpec * pspec)
{
GstSmoothWave *smoothwave;
/* it's not null if we got it, but it might not be ours */
- smoothwave = GST_SMOOTHWAVE(object);
+ smoothwave = GST_SMOOTHWAVE (object);
switch (prop_id) {
- case ARG_WIDTH: {
+ case ARG_WIDTH:{
g_value_set_int (value, smoothwave->width);
break;
}
- case ARG_HEIGHT: {
+ case ARG_HEIGHT:{
g_value_set_int (value, smoothwave->height);
break;
}
- case ARG_WIDGET: {
+ case ARG_WIDGET:{
g_value_set_object (value, smoothwave->image);
break;
}
- default: {
+ default:{
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
@@ -294,21 +294,17 @@ gst_smoothwave_get_property (GObject *object, guint prop_id, GValue *value, GPar
static gboolean
-plugin_init (GstPlugin *plugin)
+plugin_init (GstPlugin * plugin)
{
- if (!gst_element_register (plugin, "smoothwave", GST_RANK_NONE, GST_TYPE_SMOOTHWAVE))
+ if (!gst_element_register (plugin, "smoothwave", GST_RANK_NONE,
+ GST_TYPE_SMOOTHWAVE))
return FALSE;
return TRUE;
}
-GST_PLUGIN_DEFINE (
- GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "smoothwave",
- "Fading greyscale waveform display",
- plugin_init,
- VERSION,
- "LGPL",
- GST_PACKAGE,
- GST_ORIGIN)
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ "smoothwave",
+ "Fading greyscale waveform display",
+ plugin_init, VERSION, "LGPL", GST_PACKAGE, GST_ORIGIN)
diff --git a/gst/smoothwave/gstsmoothwave.h b/gst/smoothwave/gstsmoothwave.h
index 871651310..df4d87634 100644
--- a/gst/smoothwave/gstsmoothwave.h
+++ b/gst/smoothwave/gstsmoothwave.h
@@ -26,8 +26,9 @@
#include <gtk/gtk.h>
#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
+extern "C"
+{
+#endif /* __cplusplus */
#define GST_TYPE_SMOOTHWAVE \
@@ -41,31 +42,33 @@ extern "C" {
#define GST_IS_SMOOTHWAVE_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SMOOTHWAVE))
-typedef struct _GstSmoothWave GstSmoothWave;
-typedef struct _GstSmoothWaveClass GstSmoothWaveClass;
+ typedef struct _GstSmoothWave GstSmoothWave;
+ typedef struct _GstSmoothWaveClass GstSmoothWaveClass;
-struct _GstSmoothWave {
- GstElement element;
+ struct _GstSmoothWave
+ {
+ GstElement element;
- GstPad *sinkpad,*srcpad;
+ GstPad *sinkpad, *srcpad;
- gint width,height;
+ gint width, height;
- GdkRgbCmap *cmap;
- GtkWidget *image;
- guchar *imagebuffer;
-};
+ GdkRgbCmap *cmap;
+ GtkWidget *image;
+ guchar *imagebuffer;
+ };
-struct _GstSmoothWaveClass {
- GstElementClass parent_class;
-};
+ struct _GstSmoothWaveClass
+ {
+ GstElementClass parent_class;
+ };
-GType gst_smoothwave_get_type(void);
+ GType gst_smoothwave_get_type (void);
#ifdef __cplusplus
}
-#endif /* __cplusplus */
+#endif /* __cplusplus */
-#endif /* __GST_SMOOTHWAVE_H__ */
+#endif /* __GST_SMOOTHWAVE_H__ */
diff --git a/gst/smpte/barboxwipes.c b/gst/smpte/barboxwipes.c
index a490f632a..2508adf48 100644
--- a/gst/smpte/barboxwipes.c
+++ b/gst/smpte/barboxwipes.c
@@ -26,544 +26,533 @@
enum
{
- BOX_VERTICAL = 1,
- BOX_HORIZONTAL = 2,
- BOX_CLOCK = 3,
- TRIGANLE_LINEAR = 4,
+ BOX_VERTICAL = 1,
+ BOX_HORIZONTAL = 2,
+ BOX_CLOCK = 3,
+ TRIGANLE_LINEAR = 4,
};
-static gint boxes_1b[][7] =
-{
+static gint boxes_1b[][7] = {
#define WIPE_B1_1 0
- { BOX_VERTICAL, 0, 0, 0, 1, 1, 1 },
+ {BOX_VERTICAL, 0, 0, 0, 1, 1, 1},
#define WIPE_B1_2 1
- { BOX_HORIZONTAL, 0, 0, 0, 1, 1, 1 }
+ {BOX_HORIZONTAL, 0, 0, 0, 1, 1, 1}
};
-static gint boxes_2b[][7*2] =
-{
+static gint boxes_2b[][7 * 2] = {
#define WIPE_B2_21 0
- { BOX_VERTICAL, 0, 0, 1, 1, 2, 0,
- BOX_VERTICAL, 1, 0, 0, 2, 2, 1 },
+ {BOX_VERTICAL, 0, 0, 1, 1, 2, 0,
+ BOX_VERTICAL, 1, 0, 0, 2, 2, 1},
#define WIPE_B2_22 1
- { BOX_HORIZONTAL, 0, 0, 1, 2, 1, 0,
- BOX_HORIZONTAL, 0, 1, 0, 2, 2, 1 },
+ {BOX_HORIZONTAL, 0, 0, 1, 2, 1, 0,
+ BOX_HORIZONTAL, 0, 1, 0, 2, 2, 1},
};
-static gint box_clock_1b[][1*10] =
-{
+static gint box_clock_1b[][1 * 10] = {
#define WIPE_B1_241 0
- { BOX_CLOCK, 0, 0, 0, 1, 0, 0, 0, 1, 1 },
+ {BOX_CLOCK, 0, 0, 0, 1, 0, 0, 0, 1, 1},
#define WIPE_B1_242 1
- { BOX_CLOCK, 0, 1, 0, 1, 1, 0, 0, 0, 1 },
+ {BOX_CLOCK, 0, 1, 0, 1, 1, 0, 0, 0, 1},
#define WIPE_B1_243 2
- { BOX_CLOCK, 1, 1, 0, 0, 1, 0, 1, 0, 1 },
+ {BOX_CLOCK, 1, 1, 0, 0, 1, 0, 1, 0, 1},
#define WIPE_B1_244 3
- { BOX_CLOCK, 1, 0, 0, 0, 0, 0, 1, 1, 1 },
+ {BOX_CLOCK, 1, 0, 0, 0, 0, 0, 1, 1, 1},
};
#define WIPE_B2_221 0
-static gint box_clock_2b[][2*10] =
-{
+static gint box_clock_2b[][2 * 10] = {
#define WIPE_B2_221 0
- { BOX_CLOCK, 1, 0, 0, 2, 0, 0, 1, 2, 1,
- BOX_CLOCK, 1, 0, 0, 1, 2, 1, 0, 0, 2 },
+ {BOX_CLOCK, 1, 0, 0, 2, 0, 0, 1, 2, 1,
+ BOX_CLOCK, 1, 0, 0, 1, 2, 1, 0, 0, 2},
#define WIPE_B2_222 1
- { BOX_CLOCK, 2, 1, 0, 2, 2, 0, 0, 1, 1,
- BOX_CLOCK, 2, 1, 0, 0, 1, 1, 2, 0, 2 },
+ {BOX_CLOCK, 2, 1, 0, 2, 2, 0, 0, 1, 1,
+ BOX_CLOCK, 2, 1, 0, 0, 1, 1, 2, 0, 2},
#define WIPE_B2_223 2
- { BOX_CLOCK, 1, 2, 0, 0, 2, 0, 1, 0, 1,
- BOX_CLOCK, 1, 2, 0, 1, 0, 1, 2, 2, 2 },
+ {BOX_CLOCK, 1, 2, 0, 0, 2, 0, 1, 0, 1,
+ BOX_CLOCK, 1, 2, 0, 1, 0, 1, 2, 2, 2},
#define WIPE_B2_224 3
- { BOX_CLOCK, 0, 1, 0, 0, 0, 0, 2, 1, 1,
- BOX_CLOCK, 0, 1, 0, 2, 1, 1, 0, 2, 2 },
+ {BOX_CLOCK, 0, 1, 0, 0, 0, 0, 2, 1, 1,
+ BOX_CLOCK, 0, 1, 0, 2, 1, 1, 0, 2, 2},
#define WIPE_B2_225 4
- { BOX_CLOCK, 1, 0, 0, 2, 0, 0, 1, 2, 1,
- BOX_CLOCK, 1, 2, 0, 0, 2, 0, 1, 0, 1 },
+ {BOX_CLOCK, 1, 0, 0, 2, 0, 0, 1, 2, 1,
+ BOX_CLOCK, 1, 2, 0, 0, 2, 0, 1, 0, 1},
#define WIPE_B2_226 5
- { BOX_CLOCK, 0, 1, 0, 0, 0, 0, 2, 1, 1,
- BOX_CLOCK, 2, 1, 0, 2, 2, 0, 0, 1, 1 },
+ {BOX_CLOCK, 0, 1, 0, 0, 0, 0, 2, 1, 1,
+ BOX_CLOCK, 2, 1, 0, 2, 2, 0, 0, 1, 1},
#define WIPE_B2_231 6
- { BOX_CLOCK, 1, 0, 0, 1, 2, 0, 2, 0, 1,
- BOX_CLOCK, 1, 0, 0, 1, 2, 0, 0, 0, 1 },
+ {BOX_CLOCK, 1, 0, 0, 1, 2, 0, 2, 0, 1,
+ BOX_CLOCK, 1, 0, 0, 1, 2, 0, 0, 0, 1},
#define WIPE_B2_232 7
- { BOX_CLOCK, 2, 1, 0, 0, 1, 0, 2, 0, 1,
- BOX_CLOCK, 2, 1, 0, 0, 1, 0, 2, 2, 1 },
+ {BOX_CLOCK, 2, 1, 0, 0, 1, 0, 2, 0, 1,
+ BOX_CLOCK, 2, 1, 0, 0, 1, 0, 2, 2, 1},
#define WIPE_B2_233 8
- { BOX_CLOCK, 1, 2, 0, 1, 0, 0, 2, 2, 1,
- BOX_CLOCK, 1, 2, 0, 1, 0, 0, 0, 2, 1 },
+ {BOX_CLOCK, 1, 2, 0, 1, 0, 0, 2, 2, 1,
+ BOX_CLOCK, 1, 2, 0, 1, 0, 0, 0, 2, 1},
#define WIPE_B2_234 9
- { BOX_CLOCK, 0, 1, 0, 2, 1, 0, 0, 0, 1,
- BOX_CLOCK, 0, 1, 0, 2, 1, 0, 0, 2, 1 },
+ {BOX_CLOCK, 0, 1, 0, 2, 1, 0, 0, 0, 1,
+ BOX_CLOCK, 0, 1, 0, 2, 1, 0, 0, 2, 1},
#define WIPE_B2_251 10
- { BOX_CLOCK, 0, 0, 0, 1, 0, 0, 0, 2, 1,
- BOX_CLOCK, 2, 0, 0, 1, 0, 0, 2, 2, 1 },
+ {BOX_CLOCK, 0, 0, 0, 1, 0, 0, 0, 2, 1,
+ BOX_CLOCK, 2, 0, 0, 1, 0, 0, 2, 2, 1},
#define WIPE_B2_252 11
- { BOX_CLOCK, 0, 0, 0, 0, 1, 0, 2, 0, 1,
- BOX_CLOCK, 0, 2, 0, 0, 1, 0, 2, 2, 1 },
+ {BOX_CLOCK, 0, 0, 0, 0, 1, 0, 2, 0, 1,
+ BOX_CLOCK, 0, 2, 0, 0, 1, 0, 2, 2, 1},
#define WIPE_B2_253 12
- { BOX_CLOCK, 0, 2, 0, 1, 2, 0, 0, 0, 1,
- BOX_CLOCK, 2, 2, 0, 1, 2, 0, 2, 0, 1 },
+ {BOX_CLOCK, 0, 2, 0, 1, 2, 0, 0, 0, 1,
+ BOX_CLOCK, 2, 2, 0, 1, 2, 0, 2, 0, 1},
#define WIPE_B2_254 13
- { BOX_CLOCK, 2, 0, 0, 2, 1, 0, 0, 0, 1,
- BOX_CLOCK, 2, 2, 0, 2, 1, 0, 0, 2, 1 },
+ {BOX_CLOCK, 2, 0, 0, 2, 1, 0, 0, 0, 1,
+ BOX_CLOCK, 2, 2, 0, 2, 1, 0, 0, 2, 1},
};
-static gint box_clock_4b[][4*10] =
-{
+static gint box_clock_4b[][4 * 10] = {
#define WIPE_B4_201 0
- { BOX_CLOCK, 1, 1, 0, 1, 0, 0, 2, 1, 1,
- BOX_CLOCK, 1, 1, 0, 2, 1, 1, 1, 2, 2,
- BOX_CLOCK, 1, 1, 0, 1, 2, 2, 0, 1, 3,
- BOX_CLOCK, 1, 1, 0, 0, 1, 3, 1, 0, 4 },
+ {BOX_CLOCK, 1, 1, 0, 1, 0, 0, 2, 1, 1,
+ BOX_CLOCK, 1, 1, 0, 2, 1, 1, 1, 2, 2,
+ BOX_CLOCK, 1, 1, 0, 1, 2, 2, 0, 1, 3,
+ BOX_CLOCK, 1, 1, 0, 0, 1, 3, 1, 0, 4},
#define WIPE_B4_202 1
- { BOX_CLOCK, 1, 1, 0, 1, 0, 3, 2, 1, 4,
- BOX_CLOCK, 1, 1, 0, 2, 1, 0, 1, 2, 1,
- BOX_CLOCK, 1, 1, 0, 1, 2, 1, 0, 1, 2,
- BOX_CLOCK, 1, 1, 0, 0, 1, 2, 1, 0, 3 },
+ {BOX_CLOCK, 1, 1, 0, 1, 0, 3, 2, 1, 4,
+ BOX_CLOCK, 1, 1, 0, 2, 1, 0, 1, 2, 1,
+ BOX_CLOCK, 1, 1, 0, 1, 2, 1, 0, 1, 2,
+ BOX_CLOCK, 1, 1, 0, 0, 1, 2, 1, 0, 3},
#define WIPE_B4_203 2
- { BOX_CLOCK, 1, 1, 0, 1, 0, 2, 2, 1, 3,
- BOX_CLOCK, 1, 1, 0, 2, 1, 3, 1, 2, 4,
- BOX_CLOCK, 1, 1, 0, 1, 2, 0, 0, 1, 1,
- BOX_CLOCK, 1, 1, 0, 0, 1, 1, 1, 0, 2 },
+ {BOX_CLOCK, 1, 1, 0, 1, 0, 2, 2, 1, 3,
+ BOX_CLOCK, 1, 1, 0, 2, 1, 3, 1, 2, 4,
+ BOX_CLOCK, 1, 1, 0, 1, 2, 0, 0, 1, 1,
+ BOX_CLOCK, 1, 1, 0, 0, 1, 1, 1, 0, 2},
#define WIPE_B4_204 3
- { BOX_CLOCK, 1, 1, 0, 1, 0, 1, 2, 1, 2,
- BOX_CLOCK, 1, 1, 0, 2, 1, 2, 1, 2, 3,
- BOX_CLOCK, 1, 1, 0, 1, 2, 3, 0, 1, 4,
- BOX_CLOCK, 1, 1, 0, 0, 1, 0, 1, 0, 1 },
+ {BOX_CLOCK, 1, 1, 0, 1, 0, 1, 2, 1, 2,
+ BOX_CLOCK, 1, 1, 0, 2, 1, 2, 1, 2, 3,
+ BOX_CLOCK, 1, 1, 0, 1, 2, 3, 0, 1, 4,
+ BOX_CLOCK, 1, 1, 0, 0, 1, 0, 1, 0, 1},
#define WIPE_B4_205 4
- { BOX_CLOCK, 1, 1, 0, 1, 0, 0, 2, 1, 1,
- BOX_CLOCK, 1, 1, 0, 2, 1, 1, 1, 2, 2,
- BOX_CLOCK, 1, 1, 0, 1, 2, 0, 0, 1, 1,
- BOX_CLOCK, 1, 1, 0, 0, 1, 1, 1, 0, 2 },
+ {BOX_CLOCK, 1, 1, 0, 1, 0, 0, 2, 1, 1,
+ BOX_CLOCK, 1, 1, 0, 2, 1, 1, 1, 2, 2,
+ BOX_CLOCK, 1, 1, 0, 1, 2, 0, 0, 1, 1,
+ BOX_CLOCK, 1, 1, 0, 0, 1, 1, 1, 0, 2},
#define WIPE_B4_206 5
- { BOX_CLOCK, 1, 1, 0, 1, 0, 1, 2, 1, 2,
- BOX_CLOCK, 1, 1, 0, 2, 1, 0, 1, 2, 1,
- BOX_CLOCK, 1, 1, 0, 1, 2, 1, 0, 1, 2,
- BOX_CLOCK, 1, 1, 0, 0, 1, 0, 1, 0, 1 },
+ {BOX_CLOCK, 1, 1, 0, 1, 0, 1, 2, 1, 2,
+ BOX_CLOCK, 1, 1, 0, 2, 1, 0, 1, 2, 1,
+ BOX_CLOCK, 1, 1, 0, 1, 2, 1, 0, 1, 2,
+ BOX_CLOCK, 1, 1, 0, 0, 1, 0, 1, 0, 1},
#define WIPE_B4_207 6
- { BOX_CLOCK, 1, 1, 0, 1, 0, 0, 2, 1, 1,
- BOX_CLOCK, 1, 1, 0, 2, 1, 0, 1, 2, 1,
- BOX_CLOCK, 1, 1, 0, 1, 2, 0, 0, 1, 1,
- BOX_CLOCK, 1, 1, 0, 0, 1, 0, 1, 0, 1 },
+ {BOX_CLOCK, 1, 1, 0, 1, 0, 0, 2, 1, 1,
+ BOX_CLOCK, 1, 1, 0, 2, 1, 0, 1, 2, 1,
+ BOX_CLOCK, 1, 1, 0, 1, 2, 0, 0, 1, 1,
+ BOX_CLOCK, 1, 1, 0, 0, 1, 0, 1, 0, 1},
#define WIPE_B4_211 7
- { BOX_CLOCK, 1, 1, 0, 1, 0, 0, 2, 1, 1,
- BOX_CLOCK, 1, 1, 0, 2, 1, 1, 1, 2, 2,
- BOX_CLOCK, 1, 1, 0, 1, 0, 0, 0, 1, 1,
- BOX_CLOCK, 1, 1, 0, 0, 1, 1, 1, 2, 2 },
+ {BOX_CLOCK, 1, 1, 0, 1, 0, 0, 2, 1, 1,
+ BOX_CLOCK, 1, 1, 0, 2, 1, 1, 1, 2, 2,
+ BOX_CLOCK, 1, 1, 0, 1, 0, 0, 0, 1, 1,
+ BOX_CLOCK, 1, 1, 0, 0, 1, 1, 1, 2, 2},
#define WIPE_B4_212 8
- { BOX_CLOCK, 1, 1, 0, 2, 1, 0, 1, 0, 1,
- BOX_CLOCK, 1, 1, 0, 1, 0, 1, 0, 1, 2,
- BOX_CLOCK, 1, 1, 0, 2, 1, 0, 1, 2, 1,
- BOX_CLOCK, 1, 1, 0, 1, 2, 1, 0, 1, 2 },
+ {BOX_CLOCK, 1, 1, 0, 2, 1, 0, 1, 0, 1,
+ BOX_CLOCK, 1, 1, 0, 1, 0, 1, 0, 1, 2,
+ BOX_CLOCK, 1, 1, 0, 2, 1, 0, 1, 2, 1,
+ BOX_CLOCK, 1, 1, 0, 1, 2, 1, 0, 1, 2},
#define WIPE_B4_213 9
- { BOX_CLOCK, 1, 1, 0, 1, 0, 0, 2, 1, 1,
- BOX_CLOCK, 1, 1, 0, 1, 0, 0, 0, 1, 1,
- BOX_CLOCK, 1, 1, 0, 1, 2, 0, 2, 1, 1,
- BOX_CLOCK, 1, 1, 0, 1, 2, 0, 0, 1, 1 },
+ {BOX_CLOCK, 1, 1, 0, 1, 0, 0, 2, 1, 1,
+ BOX_CLOCK, 1, 1, 0, 1, 0, 0, 0, 1, 1,
+ BOX_CLOCK, 1, 1, 0, 1, 2, 0, 2, 1, 1,
+ BOX_CLOCK, 1, 1, 0, 1, 2, 0, 0, 1, 1},
#define WIPE_B4_214 10
- { BOX_CLOCK, 1, 1, 0, 2, 1, 0, 1, 0, 1,
- BOX_CLOCK, 1, 1, 0, 2, 1, 0, 1, 2, 1,
- BOX_CLOCK, 1, 1, 0, 0, 1, 0, 1, 0, 1,
- BOX_CLOCK, 1, 1, 0, 0, 1, 0, 1, 2, 1 },
+ {BOX_CLOCK, 1, 1, 0, 2, 1, 0, 1, 0, 1,
+ BOX_CLOCK, 1, 1, 0, 2, 1, 0, 1, 2, 1,
+ BOX_CLOCK, 1, 1, 0, 0, 1, 0, 1, 0, 1,
+ BOX_CLOCK, 1, 1, 0, 0, 1, 0, 1, 2, 1},
#define WIPE_B4_227 11
- { BOX_CLOCK, 1, 0, 0, 2, 0, 0, 1, 1, 1,
- BOX_CLOCK, 1, 0, 0, 1, 1, 1, 0, 0, 2,
- BOX_CLOCK, 1, 2, 0, 2, 2, 0, 1, 1, 1,
- BOX_CLOCK, 1, 2, 0, 1, 1, 1, 0, 2, 2 },
+ {BOX_CLOCK, 1, 0, 0, 2, 0, 0, 1, 1, 1,
+ BOX_CLOCK, 1, 0, 0, 1, 1, 1, 0, 0, 2,
+ BOX_CLOCK, 1, 2, 0, 2, 2, 0, 1, 1, 1,
+ BOX_CLOCK, 1, 2, 0, 1, 1, 1, 0, 2, 2},
#define WIPE_B4_228 12
- { BOX_CLOCK, 0, 1, 0, 0, 0, 0, 1, 1, 1,
- BOX_CLOCK, 0, 1, 0, 1, 1, 1, 0, 2, 2,
- BOX_CLOCK, 2, 1, 0, 2, 0, 0, 1, 1, 1,
- BOX_CLOCK, 2, 1, 0, 1, 1, 1, 2, 2, 2 },
+ {BOX_CLOCK, 0, 1, 0, 0, 0, 0, 1, 1, 1,
+ BOX_CLOCK, 0, 1, 0, 1, 1, 1, 0, 2, 2,
+ BOX_CLOCK, 2, 1, 0, 2, 0, 0, 1, 1, 1,
+ BOX_CLOCK, 2, 1, 0, 1, 1, 1, 2, 2, 2},
#define WIPE_B4_235 13
- { BOX_CLOCK, 1, 0, 0, 1, 1, 0, 0, 0, 1,
- BOX_CLOCK, 1, 0, 0, 1, 1, 0, 2, 0, 1,
- BOX_CLOCK, 1, 2, 0, 1, 1, 0, 2, 2, 1,
- BOX_CLOCK, 1, 2, 0, 1, 1, 0, 0, 2, 1 },
+ {BOX_CLOCK, 1, 0, 0, 1, 1, 0, 0, 0, 1,
+ BOX_CLOCK, 1, 0, 0, 1, 1, 0, 2, 0, 1,
+ BOX_CLOCK, 1, 2, 0, 1, 1, 0, 2, 2, 1,
+ BOX_CLOCK, 1, 2, 0, 1, 1, 0, 0, 2, 1},
#define WIPE_B4_236 14
- { BOX_CLOCK, 0, 1, 0, 1, 1, 0, 0, 0, 1,
- BOX_CLOCK, 0, 1, 0, 1, 1, 0, 0, 2, 1,
- BOX_CLOCK, 2, 1, 0, 1, 1, 0, 2, 0, 1,
- BOX_CLOCK, 2, 1, 0, 1, 1, 0, 2, 2, 1 },
+ {BOX_CLOCK, 0, 1, 0, 1, 1, 0, 0, 0, 1,
+ BOX_CLOCK, 0, 1, 0, 1, 1, 0, 0, 2, 1,
+ BOX_CLOCK, 2, 1, 0, 1, 1, 0, 2, 0, 1,
+ BOX_CLOCK, 2, 1, 0, 1, 1, 0, 2, 2, 1},
};
-static gint box_clock_8b[][8*10] =
-{
+static gint box_clock_8b[][8 * 10] = {
#define WIPE_B8_261 0
- { BOX_CLOCK, 2, 1, 0, 2, 2, 0, 4, 1, 1,
- BOX_CLOCK, 2, 1, 0, 4, 1, 1, 2, 0, 2,
- BOX_CLOCK, 2, 1, 0, 2, 0, 2, 0, 1, 3,
- BOX_CLOCK, 2, 1, 0, 0, 1, 3, 2, 2, 4,
- BOX_CLOCK, 2, 3, 0, 2, 2, 0, 4, 3, 1,
- BOX_CLOCK, 2, 3, 0, 4, 3, 1, 2, 4, 2,
- BOX_CLOCK, 2, 3, 0, 2, 4, 2, 0, 3, 3,
- BOX_CLOCK, 2, 3, 0, 0, 3, 3, 2, 2, 4 },
+ {BOX_CLOCK, 2, 1, 0, 2, 2, 0, 4, 1, 1,
+ BOX_CLOCK, 2, 1, 0, 4, 1, 1, 2, 0, 2,
+ BOX_CLOCK, 2, 1, 0, 2, 0, 2, 0, 1, 3,
+ BOX_CLOCK, 2, 1, 0, 0, 1, 3, 2, 2, 4,
+ BOX_CLOCK, 2, 3, 0, 2, 2, 0, 4, 3, 1,
+ BOX_CLOCK, 2, 3, 0, 4, 3, 1, 2, 4, 2,
+ BOX_CLOCK, 2, 3, 0, 2, 4, 2, 0, 3, 3,
+ BOX_CLOCK, 2, 3, 0, 0, 3, 3, 2, 2, 4},
#define WIPE_B8_262 1
- { BOX_CLOCK, 1, 2, 0, 2, 2, 0, 1, 0, 1,
- BOX_CLOCK, 1, 2, 0, 1, 0, 1, 0, 2, 2,
- BOX_CLOCK, 1, 2, 0, 0, 2, 2, 1, 4, 3,
- BOX_CLOCK, 1, 2, 0, 1, 4, 3, 2, 2, 4,
- BOX_CLOCK, 3, 2, 0, 2, 2, 0, 3, 0, 1,
- BOX_CLOCK, 3, 2, 0, 3, 0, 1, 4, 2, 2,
- BOX_CLOCK, 3, 2, 0, 4, 2, 2, 3, 4, 3,
- BOX_CLOCK, 3, 2, 0, 3, 4, 3, 2, 2, 4 },
+ {BOX_CLOCK, 1, 2, 0, 2, 2, 0, 1, 0, 1,
+ BOX_CLOCK, 1, 2, 0, 1, 0, 1, 0, 2, 2,
+ BOX_CLOCK, 1, 2, 0, 0, 2, 2, 1, 4, 3,
+ BOX_CLOCK, 1, 2, 0, 1, 4, 3, 2, 2, 4,
+ BOX_CLOCK, 3, 2, 0, 2, 2, 0, 3, 0, 1,
+ BOX_CLOCK, 3, 2, 0, 3, 0, 1, 4, 2, 2,
+ BOX_CLOCK, 3, 2, 0, 4, 2, 2, 3, 4, 3,
+ BOX_CLOCK, 3, 2, 0, 3, 4, 3, 2, 2, 4},
#define WIPE_B8_263 2
- { BOX_CLOCK, 2, 1, 0, 2, 0, 0, 4, 1, 1,
- BOX_CLOCK, 2, 1, 0, 4, 1, 1, 2, 2, 2,
- BOX_CLOCK, 2, 1, 0, 2, 0, 0, 0, 1, 1,
- BOX_CLOCK, 2, 1, 0, 0, 1, 1, 2, 2, 2,
- BOX_CLOCK, 2, 3, 0, 2, 4, 0, 4, 3, 1,
- BOX_CLOCK, 2, 3, 0, 4, 3, 1, 2, 2, 2,
- BOX_CLOCK, 2, 3, 0, 2, 4, 0, 0, 3, 1,
- BOX_CLOCK, 2, 3, 0, 0, 3, 1, 2, 2, 2 },
+ {BOX_CLOCK, 2, 1, 0, 2, 0, 0, 4, 1, 1,
+ BOX_CLOCK, 2, 1, 0, 4, 1, 1, 2, 2, 2,
+ BOX_CLOCK, 2, 1, 0, 2, 0, 0, 0, 1, 1,
+ BOX_CLOCK, 2, 1, 0, 0, 1, 1, 2, 2, 2,
+ BOX_CLOCK, 2, 3, 0, 2, 4, 0, 4, 3, 1,
+ BOX_CLOCK, 2, 3, 0, 4, 3, 1, 2, 2, 2,
+ BOX_CLOCK, 2, 3, 0, 2, 4, 0, 0, 3, 1,
+ BOX_CLOCK, 2, 3, 0, 0, 3, 1, 2, 2, 2},
#define WIPE_B8_264 3
- { BOX_CLOCK, 1, 2, 0, 0, 2, 0, 1, 0, 1,
- BOX_CLOCK, 1, 2, 0, 1, 0, 1, 2, 2, 2,
- BOX_CLOCK, 1, 2, 0, 0, 2, 0, 1, 4, 1,
- BOX_CLOCK, 1, 2, 0, 1, 4, 1, 2, 2, 2,
- BOX_CLOCK, 3, 2, 0, 4, 2, 0, 3, 0, 1,
- BOX_CLOCK, 3, 2, 0, 3, 0, 1, 2, 2, 2,
- BOX_CLOCK, 3, 2, 0, 4, 2, 0, 3, 4, 1,
- BOX_CLOCK, 3, 2, 0, 3, 4, 1, 2, 2, 2 },
+ {BOX_CLOCK, 1, 2, 0, 0, 2, 0, 1, 0, 1,
+ BOX_CLOCK, 1, 2, 0, 1, 0, 1, 2, 2, 2,
+ BOX_CLOCK, 1, 2, 0, 0, 2, 0, 1, 4, 1,
+ BOX_CLOCK, 1, 2, 0, 1, 4, 1, 2, 2, 2,
+ BOX_CLOCK, 3, 2, 0, 4, 2, 0, 3, 0, 1,
+ BOX_CLOCK, 3, 2, 0, 3, 0, 1, 2, 2, 2,
+ BOX_CLOCK, 3, 2, 0, 4, 2, 0, 3, 4, 1,
+ BOX_CLOCK, 3, 2, 0, 3, 4, 1, 2, 2, 2},
};
-static gint triangles_2t[][2*9] =
-{
+static gint triangles_2t[][2 * 9] = {
/* 3 -> 6 */
#define WIPE_T2_3 0
- { 0, 0, 0, 0, 1, 1, 1, 1, 1,
- 1, 0, 1, 0, 0, 0, 1, 1, 1 },
+ {0, 0, 0, 0, 1, 1, 1, 1, 1,
+ 1, 0, 1, 0, 0, 0, 1, 1, 1},
#define WIPE_T2_4 WIPE_T2_3+1
- { 0, 0, 1, 1, 0, 0, 0, 1, 1,
- 1, 0, 0, 0, 1, 1, 1, 1, 1 },
+ {0, 0, 1, 1, 0, 0, 0, 1, 1,
+ 1, 0, 0, 0, 1, 1, 1, 1, 1},
#define WIPE_T2_5 WIPE_T2_4+1
- { 0, 0, 1, 0, 1, 1, 1, 1, 0,
- 1, 0, 1, 0, 0, 1, 1, 1, 0 },
+ {0, 0, 1, 0, 1, 1, 1, 1, 0,
+ 1, 0, 1, 0, 0, 1, 1, 1, 0},
#define WIPE_T2_6 WIPE_T2_5+1
- { 0, 0, 1, 1, 0, 1, 0, 1, 0,
- 1, 0, 1, 0, 1, 0, 1, 1, 1 },
+ {0, 0, 1, 1, 0, 1, 0, 1, 0,
+ 1, 0, 1, 0, 1, 0, 1, 1, 1},
#define WIPE_T2_41 WIPE_T2_6+1
- { 0, 0, 0, 1, 0, 1, 0, 1, 1,
- 1, 0, 1, 0, 1, 1, 1, 1, 2 },
+ {0, 0, 0, 1, 0, 1, 0, 1, 1,
+ 1, 0, 1, 0, 1, 1, 1, 1, 2},
#define WIPE_T2_42 WIPE_T2_41+1
- { 0, 0, 1, 1, 0, 0, 1, 1, 1,
- 0, 0, 1, 0, 1, 2, 1, 1, 1 },
+ {0, 0, 1, 1, 0, 0, 1, 1, 1,
+ 0, 0, 1, 0, 1, 2, 1, 1, 1},
#define WIPE_T2_45 WIPE_T2_42+1
- { 0, 0, 1, 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0, 1, 1, 1 },
+ {0, 0, 1, 1, 0, 0, 0, 1, 0,
+ 1, 0, 0, 0, 1, 0, 1, 1, 1},
#define WIPE_T2_46 WIPE_T2_45+1
- { 0, 0, 0, 1, 0, 1, 1, 1, 0,
- 0, 0, 0, 0, 1, 1, 1, 1, 0 },
+ {0, 0, 0, 1, 0, 1, 1, 1, 0,
+ 0, 0, 0, 0, 1, 1, 1, 1, 0},
#define WIPE_T2_245 WIPE_T2_46+1
- { 0, 0, 0, 2, 0, 0, 2, 2, 1,
- 2, 2, 0, 0, 2, 0, 0, 0, 1 },
+ {0, 0, 0, 2, 0, 0, 2, 2, 1,
+ 2, 2, 0, 0, 2, 0, 0, 0, 1},
#define WIPE_T2_246 WIPE_T2_245+1
- { 0, 2, 0, 0, 0, 0, 2, 0, 1,
- 2, 0, 0, 2, 2, 0, 0, 2, 1 },
+ {0, 2, 0, 0, 0, 0, 2, 0, 1,
+ 2, 0, 0, 2, 2, 0, 0, 2, 1},
};
-static gint triangles_3t[][3*9] =
-{
+static gint triangles_3t[][3 * 9] = {
/* 23 -> 26 */
#define WIPE_T3_23 0
- { 0, 0, 1, 1, 0, 0, 0, 2, 1,
- 1, 0, 0, 0, 2, 1, 2, 2, 1,
- 1, 0, 0, 2, 0, 1, 2, 2, 1 },
+ {0, 0, 1, 1, 0, 0, 0, 2, 1,
+ 1, 0, 0, 0, 2, 1, 2, 2, 1,
+ 1, 0, 0, 2, 0, 1, 2, 2, 1},
#define WIPE_T3_24 1
- { 0, 0, 1, 2, 0, 1, 2, 1, 0,
- 0, 0, 1, 2, 1, 0, 0, 2, 1,
- 2, 1, 0, 0, 2, 1, 2, 2, 1 },
+ {0, 0, 1, 2, 0, 1, 2, 1, 0,
+ 0, 0, 1, 2, 1, 0, 0, 2, 1,
+ 2, 1, 0, 0, 2, 1, 2, 2, 1},
#define WIPE_T3_25 2
- { 0, 0, 1, 0, 2, 1, 1, 2, 0,
- 0, 0, 1, 2, 0, 1, 1, 2, 0,
- 2, 0, 1, 1, 2, 0, 2, 2, 1 },
+ {0, 0, 1, 0, 2, 1, 1, 2, 0,
+ 0, 0, 1, 2, 0, 1, 1, 2, 0,
+ 2, 0, 1, 1, 2, 0, 2, 2, 1},
#define WIPE_T3_26 3
- { 0, 0, 1, 2, 0, 1, 0, 1, 0,
- 2, 0, 1, 0, 1, 0, 2, 2, 1,
- 0, 1, 0, 0, 2, 1, 2, 2, 1 },
+ {0, 0, 1, 2, 0, 1, 0, 1, 0,
+ 2, 0, 1, 0, 1, 0, 2, 2, 1,
+ 0, 1, 0, 0, 2, 1, 2, 2, 1},
};
-static gint triangles_4t[][4*9] =
-{
+static gint triangles_4t[][4 * 9] = {
#define WIPE_T4_61 0
- { 0, 0, 1, 1, 0, 0, 1, 2, 1,
- 0, 0, 1, 0, 2, 2, 1, 2, 1,
- 1, 0, 0, 2, 0, 1, 1, 2, 1,
- 2, 0, 1, 1, 2, 1, 2, 2, 2 },
+ {0, 0, 1, 1, 0, 0, 1, 2, 1,
+ 0, 0, 1, 0, 2, 2, 1, 2, 1,
+ 1, 0, 0, 2, 0, 1, 1, 2, 1,
+ 2, 0, 1, 1, 2, 1, 2, 2, 2},
#define WIPE_T4_62 1
- { 0, 0, 2, 2, 0, 1, 0, 1, 1,
- 2, 0, 1, 0, 1, 1, 2, 1, 0,
- 0, 1, 1, 2, 1, 0, 2, 2, 1,
- 0, 1, 1, 0, 2, 2, 2, 2, 1 },
+ {0, 0, 2, 2, 0, 1, 0, 1, 1,
+ 2, 0, 1, 0, 1, 1, 2, 1, 0,
+ 0, 1, 1, 2, 1, 0, 2, 2, 1,
+ 0, 1, 1, 0, 2, 2, 2, 2, 1},
#define WIPE_T4_63 2
- { 0, 0, 2, 1, 0, 1, 0, 2, 1,
- 1, 0, 1, 0, 2, 1, 1, 2, 0,
- 1, 0, 1, 1, 2, 0, 2, 2, 1,
- 1, 0, 1, 2, 0, 2, 2, 2, 1 },
+ {0, 0, 2, 1, 0, 1, 0, 2, 1,
+ 1, 0, 1, 0, 2, 1, 1, 2, 0,
+ 1, 0, 1, 1, 2, 0, 2, 2, 1,
+ 1, 0, 1, 2, 0, 2, 2, 2, 1},
#define WIPE_T4_64 3
- { 0, 0, 1, 2, 0, 2, 2, 1, 1,
- 0, 0, 1, 0, 1, 0, 2, 1, 1,
- 0, 1, 0, 2, 1, 1, 0, 2, 1,
- 2, 1, 1, 0, 2, 1, 2, 2, 2 },
+ {0, 0, 1, 2, 0, 2, 2, 1, 1,
+ 0, 0, 1, 0, 1, 0, 2, 1, 1,
+ 0, 1, 0, 2, 1, 1, 0, 2, 1,
+ 2, 1, 1, 0, 2, 1, 2, 2, 2},
#define WIPE_T4_65 4
- { 0, 0, 0, 1, 0, 1, 1, 2, 0,
- 0, 0, 0, 0, 2, 1, 1, 2, 0,
- 1, 0, 1, 2, 0, 0, 1, 2, 0,
- 2, 0, 0, 1, 2, 0, 2, 2, 1 },
+ {0, 0, 0, 1, 0, 1, 1, 2, 0,
+ 0, 0, 0, 0, 2, 1, 1, 2, 0,
+ 1, 0, 1, 2, 0, 0, 1, 2, 0,
+ 2, 0, 0, 1, 2, 0, 2, 2, 1},
#define WIPE_T4_66 5
- { 0, 0, 1, 2, 0, 0, 0, 1, 0,
- 2, 0, 0, 0, 1, 0, 2, 1, 1,
- 0, 1, 0, 2, 1, 1, 2, 2, 0,
- 0, 1, 0, 0, 2, 1, 2, 2, 0 },
+ {0, 0, 1, 2, 0, 0, 0, 1, 0,
+ 2, 0, 0, 0, 1, 0, 2, 1, 1,
+ 0, 1, 0, 2, 1, 1, 2, 2, 0,
+ 0, 1, 0, 0, 2, 1, 2, 2, 0},
#define WIPE_T4_67 6
- { 0, 0, 1, 1, 0, 0, 0, 2, 0,
- 1, 0, 0, 0, 2, 0, 1, 2, 1,
- 1, 0, 0, 1, 2, 1, 2, 2, 0,
- 1, 0, 0, 2, 0, 1, 2, 2, 0 },
+ {0, 0, 1, 1, 0, 0, 0, 2, 0,
+ 1, 0, 0, 0, 2, 0, 1, 2, 1,
+ 1, 0, 0, 1, 2, 1, 2, 2, 0,
+ 1, 0, 0, 2, 0, 1, 2, 2, 0},
#define WIPE_T4_68 7
- { 0, 0, 0, 2, 0, 1, 2, 1, 0,
- 0, 0, 0, 0, 1, 1, 2, 1, 0,
- 0, 1, 1, 2, 1, 0, 0, 2, 0,
- 2, 1, 0, 0, 2, 0, 2, 2, 1 },
+ {0, 0, 0, 2, 0, 1, 2, 1, 0,
+ 0, 0, 0, 0, 1, 1, 2, 1, 0,
+ 0, 1, 1, 2, 1, 0, 0, 2, 0,
+ 2, 1, 0, 0, 2, 0, 2, 2, 1},
#define WIPE_T4_101 8
- { 0, 0, 1, 2, 0, 1, 1, 1, 0,
- 0, 0, 1, 1, 1, 0, 0, 2, 1,
- 1, 1, 0, 0, 2, 1, 2, 2, 1,
- 2, 0, 1, 1, 1, 0, 2, 2, 1 },
+ {0, 0, 1, 2, 0, 1, 1, 1, 0,
+ 0, 0, 1, 1, 1, 0, 0, 2, 1,
+ 1, 1, 0, 0, 2, 1, 2, 2, 1,
+ 2, 0, 1, 1, 1, 0, 2, 2, 1},
};
-static gint triangles_8t[][8*9] =
-{
+static gint triangles_8t[][8 * 9] = {
/* 7 */
#define WIPE_T8_7 0
- { 0, 0, 0, 1, 0, 1, 1, 1, 1,
- 1, 0, 1, 2, 0, 0, 1, 1, 1,
- 2, 0, 0, 1, 1, 1, 2, 1, 1,
- 1, 1, 1, 2, 1, 1, 2, 2, 0,
- 1, 1, 1, 1, 2, 1, 2, 2, 0,
- 1, 1, 1, 0, 2, 0, 1, 2, 1,
- 0, 1, 1, 1, 1, 1, 0, 2, 0,
- 0, 0, 0, 0, 1, 1, 1, 1, 1 },
+ {0, 0, 0, 1, 0, 1, 1, 1, 1,
+ 1, 0, 1, 2, 0, 0, 1, 1, 1,
+ 2, 0, 0, 1, 1, 1, 2, 1, 1,
+ 1, 1, 1, 2, 1, 1, 2, 2, 0,
+ 1, 1, 1, 1, 2, 1, 2, 2, 0,
+ 1, 1, 1, 0, 2, 0, 1, 2, 1,
+ 0, 1, 1, 1, 1, 1, 0, 2, 0,
+ 0, 0, 0, 0, 1, 1, 1, 1, 1},
#define WIPE_T8_43 1
- { 0, 0, 1, 1, 0, 0, 1, 1, 1,
- 1, 0, 0, 2, 0, 1, 1, 1, 1,
- 2, 0, 1, 1, 1, 1, 2, 1, 2,
- 1, 1, 1, 2, 1, 2, 2, 2, 1,
- 1, 1, 1, 1, 2, 0, 2, 2, 1,
- 1, 1, 1, 0, 2, 1, 1, 2, 0,
- 0, 1, 2, 1, 1, 1, 0, 2, 1,
- 0, 0, 1, 0, 1, 2, 1, 1, 1 },
+ {0, 0, 1, 1, 0, 0, 1, 1, 1,
+ 1, 0, 0, 2, 0, 1, 1, 1, 1,
+ 2, 0, 1, 1, 1, 1, 2, 1, 2,
+ 1, 1, 1, 2, 1, 2, 2, 2, 1,
+ 1, 1, 1, 1, 2, 0, 2, 2, 1,
+ 1, 1, 1, 0, 2, 1, 1, 2, 0,
+ 0, 1, 2, 1, 1, 1, 0, 2, 1,
+ 0, 0, 1, 0, 1, 2, 1, 1, 1},
#define WIPE_T8_44 2
- { 0, 0, 1, 1, 0, 2, 1, 1, 1,
- 1, 0, 2, 2, 0, 1, 1, 1, 1,
- 2, 0, 1, 1, 1, 1, 2, 1, 0,
- 1, 1, 1, 2, 1, 0, 2, 2, 1,
- 1, 1, 1, 1, 2, 2, 2, 2, 1,
- 1, 1, 1, 0, 2, 1, 1, 2, 2,
- 0, 1, 0, 1, 1, 1, 0, 2, 1,
- 0, 0, 1, 0, 1, 0, 1, 1, 1 },
+ {0, 0, 1, 1, 0, 2, 1, 1, 1,
+ 1, 0, 2, 2, 0, 1, 1, 1, 1,
+ 2, 0, 1, 1, 1, 1, 2, 1, 0,
+ 1, 1, 1, 2, 1, 0, 2, 2, 1,
+ 1, 1, 1, 1, 2, 2, 2, 2, 1,
+ 1, 1, 1, 0, 2, 1, 1, 2, 2,
+ 0, 1, 0, 1, 1, 1, 0, 2, 1,
+ 0, 0, 1, 0, 1, 0, 1, 1, 1},
#define WIPE_T8_47 3
- { 0, 0, 0, 1, 0, 1, 1, 1, 0,
- 1, 0, 1, 2, 0, 0, 1, 1, 0,
- 2, 0, 0, 1, 1, 0, 2, 1, 1,
- 1, 1, 0, 2, 1, 1, 2, 2, 0,
- 1, 1, 0, 1, 2, 1, 2, 2, 0,
- 1, 1, 0, 0, 2, 0, 1, 2, 1,
- 0, 1, 1, 1, 1, 0, 0, 2, 0,
- 0, 0, 0, 0, 1, 1, 1, 1, 0 },
+ {0, 0, 0, 1, 0, 1, 1, 1, 0,
+ 1, 0, 1, 2, 0, 0, 1, 1, 0,
+ 2, 0, 0, 1, 1, 0, 2, 1, 1,
+ 1, 1, 0, 2, 1, 1, 2, 2, 0,
+ 1, 1, 0, 1, 2, 1, 2, 2, 0,
+ 1, 1, 0, 0, 2, 0, 1, 2, 1,
+ 0, 1, 1, 1, 1, 0, 0, 2, 0,
+ 0, 0, 0, 0, 1, 1, 1, 1, 0},
#define WIPE_T8_48 4
- { 0, 0, 1, 1, 0, 0, 0, 1, 0,
- 1, 0, 0, 0, 1, 0, 1, 1, 1,
- 1, 0, 0, 2, 0, 1, 2, 1, 0,
- 1, 0, 0, 1, 1, 1, 2, 1, 0,
- 0, 1, 0, 1, 1, 1, 1, 2, 0,
- 0, 1, 0, 0, 2, 1, 1, 2, 0,
- 1, 1, 1, 2, 1, 0, 1, 2, 0,
- 2, 1, 0, 1, 2, 0, 2, 2, 1 },
+ {0, 0, 1, 1, 0, 0, 0, 1, 0,
+ 1, 0, 0, 0, 1, 0, 1, 1, 1,
+ 1, 0, 0, 2, 0, 1, 2, 1, 0,
+ 1, 0, 0, 1, 1, 1, 2, 1, 0,
+ 0, 1, 0, 1, 1, 1, 1, 2, 0,
+ 0, 1, 0, 0, 2, 1, 1, 2, 0,
+ 1, 1, 1, 2, 1, 0, 1, 2, 0,
+ 2, 1, 0, 1, 2, 0, 2, 2, 1},
};
-static gint triangles_16t[][16*9] =
-{
+static gint triangles_16t[][16 * 9] = {
/* 8 */
#define WIPE_T16_8 0
- { 0, 0, 1, 2, 0, 1, 1, 1, 0,
- 2, 0, 1, 1, 1, 0, 2, 2, 1,
- 1, 1, 0, 0, 2, 1, 2, 2, 1,
- 0, 0, 1, 1, 1, 0, 0, 2, 1,
- 2, 0, 1, 4, 0, 1, 3, 1, 0,
- 4, 0, 1, 3, 1, 0, 4, 2, 1,
- 3, 1, 0, 2, 2, 1, 4, 2, 1,
- 2, 0, 1, 3, 1, 0, 2, 2, 1,
- 0, 2, 1, 2, 2, 1, 1, 3, 0,
- 2, 2, 1, 1, 3, 0, 2, 4, 1,
- 1, 3, 0, 0, 4, 1, 2, 4, 1,
- 0, 2, 1, 1, 3, 0, 0, 4, 1,
- 2, 2, 1, 4, 2, 1, 3, 3, 0,
- 4, 2, 1, 3, 3, 0, 4, 4, 1,
- 3, 3, 0, 2, 4, 1, 4, 4, 1,
- 2, 2, 1, 3, 3, 0, 2, 4, 1 }
+ {0, 0, 1, 2, 0, 1, 1, 1, 0,
+ 2, 0, 1, 1, 1, 0, 2, 2, 1,
+ 1, 1, 0, 0, 2, 1, 2, 2, 1,
+ 0, 0, 1, 1, 1, 0, 0, 2, 1,
+ 2, 0, 1, 4, 0, 1, 3, 1, 0,
+ 4, 0, 1, 3, 1, 0, 4, 2, 1,
+ 3, 1, 0, 2, 2, 1, 4, 2, 1,
+ 2, 0, 1, 3, 1, 0, 2, 2, 1,
+ 0, 2, 1, 2, 2, 1, 1, 3, 0,
+ 2, 2, 1, 1, 3, 0, 2, 4, 1,
+ 1, 3, 0, 0, 4, 1, 2, 4, 1,
+ 0, 2, 1, 1, 3, 0, 0, 4, 1,
+ 2, 2, 1, 4, 2, 1, 3, 3, 0,
+ 4, 2, 1, 3, 3, 0, 4, 4, 1,
+ 3, 3, 0, 2, 4, 1, 4, 4, 1,
+ 2, 2, 1, 3, 3, 0, 2, 4, 1}
};
typedef struct _GstWipeConfig GstWipeConfig;
-struct _GstWipeConfig {
- gint *objects;
- gint nobjects;
- gint xscale;
- gint yscale;
- gint cscale;
+struct _GstWipeConfig
+{
+ gint *objects;
+ gint nobjects;
+ gint xscale;
+ gint yscale;
+ gint cscale;
};
-static GstWipeConfig wipe_config[] =
-{
+static GstWipeConfig wipe_config[] = {
#define WIPE_CONFIG_1 0
- { boxes_1b[WIPE_B1_1], 1, 0, 0, 0 }, /* 1 */
+ {boxes_1b[WIPE_B1_1], 1, 0, 0, 0}, /* 1 */
#define WIPE_CONFIG_2 WIPE_CONFIG_1+1
- { boxes_1b[WIPE_B1_2], 1, 0, 0, 0 }, /* 2 */
+ {boxes_1b[WIPE_B1_2], 1, 0, 0, 0}, /* 2 */
#define WIPE_CONFIG_3 WIPE_CONFIG_2+1
- { triangles_2t[WIPE_T2_3], 2, 0, 0, 0 }, /* 3 */
+ {triangles_2t[WIPE_T2_3], 2, 0, 0, 0}, /* 3 */
#define WIPE_CONFIG_4 WIPE_CONFIG_3+1
- { triangles_2t[WIPE_T2_4], 2, 0, 0, 0 }, /* 4 */
+ {triangles_2t[WIPE_T2_4], 2, 0, 0, 0}, /* 4 */
#define WIPE_CONFIG_5 WIPE_CONFIG_4+1
- { triangles_2t[WIPE_T2_5], 2, 0, 0, 0 }, /* 5 */
+ {triangles_2t[WIPE_T2_5], 2, 0, 0, 0}, /* 5 */
#define WIPE_CONFIG_6 WIPE_CONFIG_5+1
- { triangles_2t[WIPE_T2_6], 2, 0, 0, 0 }, /* 6 */
+ {triangles_2t[WIPE_T2_6], 2, 0, 0, 0}, /* 6 */
#define WIPE_CONFIG_7 WIPE_CONFIG_6+1
- { triangles_8t[WIPE_T8_7], 8, 1, 1, 0 }, /* 7 */
+ {triangles_8t[WIPE_T8_7], 8, 1, 1, 0}, /* 7 */
#define WIPE_CONFIG_8 WIPE_CONFIG_7+1
- { triangles_16t[WIPE_T16_8], 16, 2, 2, 0 }, /* 8 */
+ {triangles_16t[WIPE_T16_8], 16, 2, 2, 0}, /* 8 */
#define WIPE_CONFIG_21 WIPE_CONFIG_8+1
- { boxes_2b[WIPE_B2_21], 2, 1, 1, 0 }, /* 21 */
+ {boxes_2b[WIPE_B2_21], 2, 1, 1, 0}, /* 21 */
#define WIPE_CONFIG_22 WIPE_CONFIG_21+1
- { boxes_2b[WIPE_B2_22], 2, 1, 1, 0 }, /* 22 */
+ {boxes_2b[WIPE_B2_22], 2, 1, 1, 0}, /* 22 */
#define WIPE_CONFIG_23 WIPE_CONFIG_22+1
- { triangles_3t[WIPE_T3_23], 3, 1, 1, 0 }, /* 23 */
+ {triangles_3t[WIPE_T3_23], 3, 1, 1, 0}, /* 23 */
#define WIPE_CONFIG_24 WIPE_CONFIG_23+1
- { triangles_3t[WIPE_T3_24], 3, 1, 1, 0 }, /* 24 */
+ {triangles_3t[WIPE_T3_24], 3, 1, 1, 0}, /* 24 */
#define WIPE_CONFIG_25 WIPE_CONFIG_24+1
- { triangles_3t[WIPE_T3_23], 3, 1, 1, 0 }, /* 25 */
+ {triangles_3t[WIPE_T3_23], 3, 1, 1, 0}, /* 25 */
#define WIPE_CONFIG_26 WIPE_CONFIG_25+1
- { triangles_3t[WIPE_T3_26], 3, 1, 1, 0 }, /* 26 */
+ {triangles_3t[WIPE_T3_26], 3, 1, 1, 0}, /* 26 */
#define WIPE_CONFIG_41 WIPE_CONFIG_26+1
- { triangles_2t[WIPE_T2_41], 2, 0, 0, 1 }, /* 41 */
+ {triangles_2t[WIPE_T2_41], 2, 0, 0, 1}, /* 41 */
#define WIPE_CONFIG_42 WIPE_CONFIG_41+1
- { triangles_2t[WIPE_T2_42], 2, 0, 0, 1 }, /* 42 */
+ {triangles_2t[WIPE_T2_42], 2, 0, 0, 1}, /* 42 */
#define WIPE_CONFIG_43 WIPE_CONFIG_42+1
- { triangles_8t[WIPE_T8_43], 8, 1, 1, 1 }, /* 43 */
+ {triangles_8t[WIPE_T8_43], 8, 1, 1, 1}, /* 43 */
#define WIPE_CONFIG_44 WIPE_CONFIG_43+1
- { triangles_8t[WIPE_T8_44], 8, 1, 1, 1 }, /* 44 */
+ {triangles_8t[WIPE_T8_44], 8, 1, 1, 1}, /* 44 */
#define WIPE_CONFIG_45 WIPE_CONFIG_44+1
- { triangles_2t[WIPE_T2_45], 2, 0, 0, 0 }, /* 45 */
+ {triangles_2t[WIPE_T2_45], 2, 0, 0, 0}, /* 45 */
#define WIPE_CONFIG_46 WIPE_CONFIG_45+1
- { triangles_2t[WIPE_T2_46], 2, 0, 0, 0 }, /* 46 */
+ {triangles_2t[WIPE_T2_46], 2, 0, 0, 0}, /* 46 */
#define WIPE_CONFIG_47 WIPE_CONFIG_46+1
- { triangles_8t[WIPE_T8_47], 8, 1, 1, 0 }, /* 47 */
+ {triangles_8t[WIPE_T8_47], 8, 1, 1, 0}, /* 47 */
#define WIPE_CONFIG_48 WIPE_CONFIG_47+1
- { triangles_8t[WIPE_T8_48], 8, 1, 1, 0 }, /* 48 */
+ {triangles_8t[WIPE_T8_48], 8, 1, 1, 0}, /* 48 */
#define WIPE_CONFIG_61 WIPE_CONFIG_48+1
- { triangles_4t[WIPE_T4_61], 4, 1, 1, 1 }, /* 61 */
+ {triangles_4t[WIPE_T4_61], 4, 1, 1, 1}, /* 61 */
#define WIPE_CONFIG_62 WIPE_CONFIG_61+1
- { triangles_4t[WIPE_T4_62], 4, 1, 1, 1 }, /* 62 */
+ {triangles_4t[WIPE_T4_62], 4, 1, 1, 1}, /* 62 */
#define WIPE_CONFIG_63 WIPE_CONFIG_62+1
- { triangles_4t[WIPE_T4_63], 4, 1, 1, 1 }, /* 63 */
+ {triangles_4t[WIPE_T4_63], 4, 1, 1, 1}, /* 63 */
#define WIPE_CONFIG_64 WIPE_CONFIG_63+1
- { triangles_4t[WIPE_T4_64], 4, 1, 1, 1 }, /* 64 */
+ {triangles_4t[WIPE_T4_64], 4, 1, 1, 1}, /* 64 */
#define WIPE_CONFIG_65 WIPE_CONFIG_64+1
- { triangles_4t[WIPE_T4_65], 4, 1, 1, 0 }, /* 65 */
+ {triangles_4t[WIPE_T4_65], 4, 1, 1, 0}, /* 65 */
#define WIPE_CONFIG_66 WIPE_CONFIG_65+1
- { triangles_4t[WIPE_T4_66], 4, 1, 1, 0 }, /* 66 */
+ {triangles_4t[WIPE_T4_66], 4, 1, 1, 0}, /* 66 */
#define WIPE_CONFIG_67 WIPE_CONFIG_66+1
- { triangles_4t[WIPE_T4_67], 4, 1, 1, 0 }, /* 67 */
+ {triangles_4t[WIPE_T4_67], 4, 1, 1, 0}, /* 67 */
#define WIPE_CONFIG_68 WIPE_CONFIG_67+1
- { triangles_4t[WIPE_T4_68], 4, 1, 1, 0 }, /* 68 */
+ {triangles_4t[WIPE_T4_68], 4, 1, 1, 0}, /* 68 */
#define WIPE_CONFIG_101 WIPE_CONFIG_68+1
- { triangles_4t[WIPE_T4_101], 4, 1, 1, 0 }, /* 101 */
+ {triangles_4t[WIPE_T4_101], 4, 1, 1, 0}, /* 101 */
#define WIPE_CONFIG_201 WIPE_CONFIG_101+1
- { box_clock_4b[WIPE_B4_201], 4, 1, 1, 2 }, /* 201 */
+ {box_clock_4b[WIPE_B4_201], 4, 1, 1, 2}, /* 201 */
#define WIPE_CONFIG_202 WIPE_CONFIG_201+1
- { box_clock_4b[WIPE_B4_202], 4, 1, 1, 2 }, /* 202 */
+ {box_clock_4b[WIPE_B4_202], 4, 1, 1, 2}, /* 202 */
#define WIPE_CONFIG_203 WIPE_CONFIG_202+1
- { box_clock_4b[WIPE_B4_203], 4, 1, 1, 2 }, /* 203 */
+ {box_clock_4b[WIPE_B4_203], 4, 1, 1, 2}, /* 203 */
#define WIPE_CONFIG_204 WIPE_CONFIG_203+1
- { box_clock_4b[WIPE_B4_204], 4, 1, 1, 2 }, /* 204 */
+ {box_clock_4b[WIPE_B4_204], 4, 1, 1, 2}, /* 204 */
#define WIPE_CONFIG_205 WIPE_CONFIG_204+1
- { box_clock_4b[WIPE_B4_205], 4, 1, 1, 1 }, /* 205 */
+ {box_clock_4b[WIPE_B4_205], 4, 1, 1, 1}, /* 205 */
#define WIPE_CONFIG_206 WIPE_CONFIG_205+1
- { box_clock_4b[WIPE_B4_206], 4, 1, 1, 1 }, /* 206 */
+ {box_clock_4b[WIPE_B4_206], 4, 1, 1, 1}, /* 206 */
#define WIPE_CONFIG_207 WIPE_CONFIG_206+1
- { box_clock_4b[WIPE_B4_207], 4, 1, 1, 0 }, /* 207 */
+ {box_clock_4b[WIPE_B4_207], 4, 1, 1, 0}, /* 207 */
#define WIPE_CONFIG_211 WIPE_CONFIG_207+1
- { box_clock_4b[WIPE_B4_211], 4, 1, 1, 1 }, /* 211 */
+ {box_clock_4b[WIPE_B4_211], 4, 1, 1, 1}, /* 211 */
#define WIPE_CONFIG_212 WIPE_CONFIG_211+1
- { box_clock_4b[WIPE_B4_212], 4, 1, 1, 1 }, /* 212 */
+ {box_clock_4b[WIPE_B4_212], 4, 1, 1, 1}, /* 212 */
#define WIPE_CONFIG_213 WIPE_CONFIG_212+1
- { box_clock_4b[WIPE_B4_213], 4, 1, 1, 0 }, /* 213 */
+ {box_clock_4b[WIPE_B4_213], 4, 1, 1, 0}, /* 213 */
#define WIPE_CONFIG_214 WIPE_CONFIG_213+1
- { box_clock_4b[WIPE_B4_214], 4, 1, 1, 0 }, /* 214 */
+ {box_clock_4b[WIPE_B4_214], 4, 1, 1, 0}, /* 214 */
#define WIPE_CONFIG_221 WIPE_CONFIG_214+1
- { box_clock_2b[WIPE_B2_221], 2, 1, 1, 1 }, /* 221 */
+ {box_clock_2b[WIPE_B2_221], 2, 1, 1, 1}, /* 221 */
#define WIPE_CONFIG_222 WIPE_CONFIG_221+1
- { box_clock_2b[WIPE_B2_222], 2, 1, 1, 1 }, /* 222 */
+ {box_clock_2b[WIPE_B2_222], 2, 1, 1, 1}, /* 222 */
#define WIPE_CONFIG_223 WIPE_CONFIG_222+1
- { box_clock_2b[WIPE_B2_223], 2, 1, 1, 1 }, /* 223 */
+ {box_clock_2b[WIPE_B2_223], 2, 1, 1, 1}, /* 223 */
#define WIPE_CONFIG_224 WIPE_CONFIG_223+1
- { box_clock_2b[WIPE_B2_224], 2, 1, 1, 1 }, /* 224 */
+ {box_clock_2b[WIPE_B2_224], 2, 1, 1, 1}, /* 224 */
#define WIPE_CONFIG_225 WIPE_CONFIG_224+1
- { box_clock_2b[WIPE_B2_225], 2, 1, 1, 0 }, /* 225 */
+ {box_clock_2b[WIPE_B2_225], 2, 1, 1, 0}, /* 225 */
#define WIPE_CONFIG_226 WIPE_CONFIG_225+1
- { box_clock_2b[WIPE_B2_226], 2, 1, 1, 0 }, /* 226 */
+ {box_clock_2b[WIPE_B2_226], 2, 1, 1, 0}, /* 226 */
#define WIPE_CONFIG_227 WIPE_CONFIG_226+1
- { box_clock_4b[WIPE_B4_227], 4, 1, 1, 1 }, /* 227 */
+ {box_clock_4b[WIPE_B4_227], 4, 1, 1, 1}, /* 227 */
#define WIPE_CONFIG_228 WIPE_CONFIG_227+1
- { box_clock_4b[WIPE_B4_228], 4, 1, 1, 1 }, /* 228 */
+ {box_clock_4b[WIPE_B4_228], 4, 1, 1, 1}, /* 228 */
#define WIPE_CONFIG_231 WIPE_CONFIG_228+1
- { box_clock_2b[WIPE_B2_231], 2, 1, 1, 0 }, /* 231 */
+ {box_clock_2b[WIPE_B2_231], 2, 1, 1, 0}, /* 231 */
#define WIPE_CONFIG_232 WIPE_CONFIG_231+1
- { box_clock_2b[WIPE_B2_232], 2, 1, 1, 0 }, /* 232 */
+ {box_clock_2b[WIPE_B2_232], 2, 1, 1, 0}, /* 232 */
#define WIPE_CONFIG_233 WIPE_CONFIG_232+1
- { box_clock_2b[WIPE_B2_233], 2, 1, 1, 0 }, /* 233 */
+ {box_clock_2b[WIPE_B2_233], 2, 1, 1, 0}, /* 233 */
#define WIPE_CONFIG_234 WIPE_CONFIG_233+1
- { box_clock_2b[WIPE_B2_234], 2, 1, 1, 0 }, /* 234 */
+ {box_clock_2b[WIPE_B2_234], 2, 1, 1, 0}, /* 234 */
#define WIPE_CONFIG_235 WIPE_CONFIG_234+1
- { box_clock_4b[WIPE_B4_235], 4, 1, 1, 0 }, /* 235 */
+ {box_clock_4b[WIPE_B4_235], 4, 1, 1, 0}, /* 235 */
#define WIPE_CONFIG_236 WIPE_CONFIG_235+1
- { box_clock_4b[WIPE_B4_236], 4, 1, 1, 0 }, /* 236 */
+ {box_clock_4b[WIPE_B4_236], 4, 1, 1, 0}, /* 236 */
#define WIPE_CONFIG_241 WIPE_CONFIG_236+1
- { box_clock_1b[WIPE_B1_241], 1, 0, 0, 0 }, /* 241 */
+ {box_clock_1b[WIPE_B1_241], 1, 0, 0, 0}, /* 241 */
#define WIPE_CONFIG_242 WIPE_CONFIG_241+1
- { box_clock_1b[WIPE_B1_242], 1, 0, 0, 0 }, /* 242 */
+ {box_clock_1b[WIPE_B1_242], 1, 0, 0, 0}, /* 242 */
#define WIPE_CONFIG_243 WIPE_CONFIG_242+1
- { box_clock_1b[WIPE_B1_243], 1, 0, 0, 0 }, /* 243 */
+ {box_clock_1b[WIPE_B1_243], 1, 0, 0, 0}, /* 243 */
#define WIPE_CONFIG_244 WIPE_CONFIG_243+1
- { box_clock_1b[WIPE_B1_244], 1, 0, 0, 0 }, /* 244 */
+ {box_clock_1b[WIPE_B1_244], 1, 0, 0, 0}, /* 244 */
#define WIPE_CONFIG_245 WIPE_CONFIG_244+1
- { triangles_2t[WIPE_T2_245], 2, 1, 1, 0 }, /* 245 */
+ {triangles_2t[WIPE_T2_245], 2, 1, 1, 0}, /* 245 */
#define WIPE_CONFIG_246 WIPE_CONFIG_245+1
- { triangles_2t[WIPE_T2_246], 2, 1, 1, 0 }, /* 246 */
+ {triangles_2t[WIPE_T2_246], 2, 1, 1, 0}, /* 246 */
#define WIPE_CONFIG_251 WIPE_CONFIG_246+1
- { box_clock_2b[WIPE_B2_251], 2, 1, 1, 0 }, /* 251 */
+ {box_clock_2b[WIPE_B2_251], 2, 1, 1, 0}, /* 251 */
#define WIPE_CONFIG_252 WIPE_CONFIG_251+1
- { box_clock_2b[WIPE_B2_252], 2, 1, 1, 0 }, /* 252 */
+ {box_clock_2b[WIPE_B2_252], 2, 1, 1, 0}, /* 252 */
#define WIPE_CONFIG_253 WIPE_CONFIG_252+1
- { box_clock_2b[WIPE_B2_253], 2, 1, 1, 0 }, /* 253 */
+ {box_clock_2b[WIPE_B2_253], 2, 1, 1, 0}, /* 253 */
#define WIPE_CONFIG_254 WIPE_CONFIG_253+1
- { box_clock_2b[WIPE_B2_254], 2, 1, 1, 0 }, /* 254 */
+ {box_clock_2b[WIPE_B2_254], 2, 1, 1, 0}, /* 254 */
#define WIPE_CONFIG_261 WIPE_CONFIG_254+1
- { box_clock_8b[WIPE_B8_261], 8, 2, 2, 2 }, /* 261 */
+ {box_clock_8b[WIPE_B8_261], 8, 2, 2, 2}, /* 261 */
#define WIPE_CONFIG_262 WIPE_CONFIG_261+1
- { box_clock_8b[WIPE_B8_262], 8, 2, 2, 2 }, /* 262 */
+ {box_clock_8b[WIPE_B8_262], 8, 2, 2, 2}, /* 262 */
#define WIPE_CONFIG_263 WIPE_CONFIG_262+1
- { box_clock_8b[WIPE_B8_263], 8, 2, 2, 1 }, /* 263 */
+ {box_clock_8b[WIPE_B8_263], 8, 2, 2, 1}, /* 263 */
#define WIPE_CONFIG_264 WIPE_CONFIG_263+1
- { box_clock_8b[WIPE_B8_264], 8, 2, 2, 1 }, /* 264 */
+ {box_clock_8b[WIPE_B8_264], 8, 2, 2, 1}, /* 264 */
};
static void
-gst_wipe_boxes_draw (GstMask *mask)
+gst_wipe_boxes_draw (GstMask * mask)
{
GstWipeConfig *config = mask->user_data;
gint *impacts = config->objects;
@@ -576,30 +565,30 @@ gst_wipe_boxes_draw (GstMask *mask)
for (i = 0; i < config->nobjects; i++) {
switch (impacts[0]) {
case BOX_VERTICAL:
- gst_smpte_paint_vbox (mask->data, mask->width,
- impacts[1] * width, impacts[2] * height, impacts[3] * depth,
- impacts[4] * width, impacts[5] * height, impacts[6] * depth);
+ gst_smpte_paint_vbox (mask->data, mask->width,
+ impacts[1] * width, impacts[2] * height, impacts[3] * depth,
+ impacts[4] * width, impacts[5] * height, impacts[6] * depth);
impacts += 7;
- break;
+ break;
case BOX_HORIZONTAL:
- gst_smpte_paint_hbox (mask->data, mask->width,
- impacts[1] * width, impacts[2] * height, impacts[3] * depth,
- impacts[4] * width, impacts[5] * height, impacts[6] * depth);
+ gst_smpte_paint_hbox (mask->data, mask->width,
+ impacts[1] * width, impacts[2] * height, impacts[3] * depth,
+ impacts[4] * width, impacts[5] * height, impacts[6] * depth);
impacts += 7;
case BOX_CLOCK:
- gst_smpte_paint_box_clock (mask->data, mask->width,
- impacts[1] * width, impacts[2] * height, impacts[3] * depth,
- impacts[4] * width, impacts[5] * height, impacts[6] * depth,
- impacts[7] * width, impacts[8] * height, impacts[9] * depth);
+ gst_smpte_paint_box_clock (mask->data, mask->width,
+ impacts[1] * width, impacts[2] * height, impacts[3] * depth,
+ impacts[4] * width, impacts[5] * height, impacts[6] * depth,
+ impacts[7] * width, impacts[8] * height, impacts[9] * depth);
impacts += 10;
default:
- break;
+ break;
}
}
}
static void
-gst_wipe_triangles_clock_draw (GstMask *mask)
+gst_wipe_triangles_clock_draw (GstMask * mask)
{
GstWipeConfig *config = mask->user_data;
gint *impacts = config->objects;
@@ -610,15 +599,15 @@ gst_wipe_triangles_clock_draw (GstMask *mask)
for (i = 0; i < config->nobjects; i++) {
gst_smpte_paint_triangle_clock (mask->data, mask->width,
- impacts[0] * width, impacts[1] * height, impacts[2] * depth,
- impacts[3] * width, impacts[4] * height, impacts[5] * depth,
- impacts[6] * width, impacts[7] * height, impacts[8] * depth);
+ impacts[0] * width, impacts[1] * height, impacts[2] * depth,
+ impacts[3] * width, impacts[4] * height, impacts[5] * depth,
+ impacts[6] * width, impacts[7] * height, impacts[8] * depth);
impacts += 9;
}
}
static void
-gst_wipe_triangles_draw (GstMask *mask)
+gst_wipe_triangles_draw (GstMask * mask)
{
GstWipeConfig *config = mask->user_data;
gint *impacts = config->objects;
@@ -630,295 +619,295 @@ gst_wipe_triangles_draw (GstMask *mask)
for (i = 0; i < config->nobjects; i++) {
gst_smpte_paint_triangle_linear (mask->data, mask->width,
- impacts[0] * width, impacts[1] * height, impacts[2] * depth,
- impacts[3] * width, impacts[4] * height, impacts[5] * depth,
- impacts[6] * width, impacts[7] * height, impacts[8] * depth);
+ impacts[0] * width, impacts[1] * height, impacts[2] * depth,
+ impacts[3] * width, impacts[4] * height, impacts[5] * depth,
+ impacts[6] * width, impacts[7] * height, impacts[8] * depth);
impacts += 9;
}
}
-static GstMaskDefinition definitions[] = {
- { 1, "bar_wipe_lr",
- "A bar moves from left to right",
- gst_wipe_boxes_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_1] },
- { 2, "bar_wipe_tb",
- "A bar moves from top to bottom",
- gst_wipe_boxes_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_2] },
- { 3, "box_wipe_tl",
- "A box expands from the upper-left corner to the lower-right corner",
- gst_wipe_triangles_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_3] },
- { 4, "box_wipe_tr",
- "A box expands from the upper-right corner to the lower-left corner",
- gst_wipe_triangles_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_4] },
- { 5, "box_wipe_br",
- "A box expands from the lower-right corner to the upper-left corner",
- gst_wipe_triangles_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_5] },
- { 6, "box_wipe_bl",
- "A box expands from the lower-left corner to the upper-right corner",
+static GstMaskDefinition definitions[] = {
+ {1, "bar_wipe_lr",
+ "A bar moves from left to right",
+ gst_wipe_boxes_draw, _gst_mask_default_destroy,
+ &wipe_config[WIPE_CONFIG_1]},
+ {2, "bar_wipe_tb",
+ "A bar moves from top to bottom",
+ gst_wipe_boxes_draw, _gst_mask_default_destroy,
+ &wipe_config[WIPE_CONFIG_2]},
+ {3, "box_wipe_tl",
+ "A box expands from the upper-left corner to the lower-right corner",
+ gst_wipe_triangles_draw, _gst_mask_default_destroy,
+ &wipe_config[WIPE_CONFIG_3]},
+ {4, "box_wipe_tr",
+ "A box expands from the upper-right corner to the lower-left corner",
gst_wipe_triangles_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_6] },
- { 7 , "four_box_wipe_ci",
- "A box shape expands from each of the four corners toward the center",
+ &wipe_config[WIPE_CONFIG_4]},
+ {5, "box_wipe_br",
+ "A box expands from the lower-right corner to the upper-left corner",
gst_wipe_triangles_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_7] },
- { 8 , "four_box_wipe_co",
- "A box shape expands from the center of each quadrant toward the corners of each quadrant",
+ &wipe_config[WIPE_CONFIG_5]},
+ {6, "box_wipe_bl",
+ "A box expands from the lower-left corner to the upper-right corner",
gst_wipe_triangles_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_8] },
- { 21, "barndoor_v",
- "A central, vertical line splits and expands toward the left and right edges",
- gst_wipe_boxes_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_21] },
- { 22, "barndoor_h",
- "A central, horizontal line splits and expands toward the top and bottom edges",
- gst_wipe_boxes_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_22] },
- { 23, "box_wipe_tc",
- "A box expands from the top edge's midpoint to the bottom corners",
+ &wipe_config[WIPE_CONFIG_6]},
+ {7, "four_box_wipe_ci",
+ "A box shape expands from each of the four corners toward the center",
gst_wipe_triangles_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_23] },
- { 24, "box_wipe_rc",
- "A box expands from the right edge's midpoint to the left corners",
+ &wipe_config[WIPE_CONFIG_7]},
+ {8, "four_box_wipe_co",
+ "A box shape expands from the center of each quadrant toward the corners of each quadrant",
gst_wipe_triangles_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_24] },
- { 25, "box_wipe_bc",
- "A box expands from the bottom edge's midpoint to the top corners",
+ &wipe_config[WIPE_CONFIG_8]},
+ {21, "barndoor_v",
+ "A central, vertical line splits and expands toward the left and right edges",
+ gst_wipe_boxes_draw, _gst_mask_default_destroy,
+ &wipe_config[WIPE_CONFIG_21]},
+ {22, "barndoor_h",
+ "A central, horizontal line splits and expands toward the top and bottom edges",
+ gst_wipe_boxes_draw, _gst_mask_default_destroy,
+ &wipe_config[WIPE_CONFIG_22]},
+ {23, "box_wipe_tc",
+ "A box expands from the top edge's midpoint to the bottom corners",
+ gst_wipe_triangles_draw, _gst_mask_default_destroy,
+ &wipe_config[WIPE_CONFIG_23]},
+ {24, "box_wipe_rc",
+ "A box expands from the right edge's midpoint to the left corners",
gst_wipe_triangles_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_25] },
- { 26, "box_wipe_lc",
- "A box expands from the left edge's midpoint to the right corners",
+ &wipe_config[WIPE_CONFIG_24]},
+ {25, "box_wipe_bc",
+ "A box expands from the bottom edge's midpoint to the top corners",
gst_wipe_triangles_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_26] },
- { 41, "diagonal_tl",
- "A diagonal line moves from the upper-left corner to the lower-right corner",
+ &wipe_config[WIPE_CONFIG_25]},
+ {26, "box_wipe_lc",
+ "A box expands from the left edge's midpoint to the right corners",
gst_wipe_triangles_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_41] },
- { 42, "diagonal_tr",
- "A diagonal line moves from the upper right corner to the lower-left corner",
+ &wipe_config[WIPE_CONFIG_26]},
+ {41, "diagonal_tl",
+ "A diagonal line moves from the upper-left corner to the lower-right corner",
gst_wipe_triangles_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_42] },
- { 43, "bowtie_v",
- "Two wedge shapes slide in from the top and bottom edges toward the center",
+ &wipe_config[WIPE_CONFIG_41]},
+ {42, "diagonal_tr",
+ "A diagonal line moves from the upper right corner to the lower-left corner",
gst_wipe_triangles_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_43] },
- { 44, "bowtie_h",
- "Two wedge shapes slide in from the left and right edges toward the center",
+ &wipe_config[WIPE_CONFIG_42]},
+ {43, "bowtie_v",
+ "Two wedge shapes slide in from the top and bottom edges toward the center",
gst_wipe_triangles_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_44] },
- { 45, "barndoor_dbl",
- "A diagonal line from the lower-left to upper-right corners splits and expands toward the opposite corners",
+ &wipe_config[WIPE_CONFIG_43]},
+ {44, "bowtie_h",
+ "Two wedge shapes slide in from the left and right edges toward the center",
gst_wipe_triangles_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_45] },
- { 46, "barndoor_dtl",
- "A diagonal line from upper-left to lower-right corners splits and expands toward the opposite corners",
+ &wipe_config[WIPE_CONFIG_44]},
+ {45, "barndoor_dbl",
+ "A diagonal line from the lower-left to upper-right corners splits and expands toward the opposite corners",
gst_wipe_triangles_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_46] },
- { 47, "misc_diagonal_dbd",
- "Four wedge shapes split from the center and retract toward the four edges",
+ &wipe_config[WIPE_CONFIG_45]},
+ {46, "barndoor_dtl",
+ "A diagonal line from upper-left to lower-right corners splits and expands toward the opposite corners",
gst_wipe_triangles_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_47] },
- { 48, "misc_diagonal_dd",
- "A diamond connecting the four edge midpoints simultaneously contracts toward the center and expands toward the edges",
+ &wipe_config[WIPE_CONFIG_46]},
+ {47, "misc_diagonal_dbd",
+ "Four wedge shapes split from the center and retract toward the four edges",
gst_wipe_triangles_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_48] },
- { 61, "vee_d",
- "A wedge shape moves from top to bottom",
+ &wipe_config[WIPE_CONFIG_47]},
+ {48, "misc_diagonal_dd",
+ "A diamond connecting the four edge midpoints simultaneously contracts toward the center and expands toward the edges",
gst_wipe_triangles_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_61] },
- { 62, "vee_l",
- "A wedge shape moves from right to left",
+ &wipe_config[WIPE_CONFIG_48]},
+ {61, "vee_d",
+ "A wedge shape moves from top to bottom",
gst_wipe_triangles_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_62] },
- { 63, "vee_u",
- "A wedge shape moves from bottom to top",
+ &wipe_config[WIPE_CONFIG_61]},
+ {62, "vee_l",
+ "A wedge shape moves from right to left",
gst_wipe_triangles_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_63] },
- { 64, "vee_r",
- "A wedge shape moves from left to right",
+ &wipe_config[WIPE_CONFIG_62]},
+ {63, "vee_u",
+ "A wedge shape moves from bottom to top",
gst_wipe_triangles_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_64] },
- { 65, "barnvee_d",
- "A 'V' shape extending from the bottom edge's midpoint to the opposite corners contracts toward the center and expands toward the edges",
+ &wipe_config[WIPE_CONFIG_63]},
+ {64, "vee_r",
+ "A wedge shape moves from left to right",
gst_wipe_triangles_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_65] },
- { 66, "barnvee_l",
- "A 'V' shape extending from the left edge's midpoint to the opposite corners contracts toward the center and expands toward the edges",
+ &wipe_config[WIPE_CONFIG_64]},
+ {65, "barnvee_d",
+ "A 'V' shape extending from the bottom edge's midpoint to the opposite corners contracts toward the center and expands toward the edges",
gst_wipe_triangles_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_66] },
- { 67, "barnvee_u",
- "A 'V' shape extending from the top edge's midpoint to the opposite corners contracts toward the center and expands toward the edges",
+ &wipe_config[WIPE_CONFIG_65]},
+ {66, "barnvee_l",
+ "A 'V' shape extending from the left edge's midpoint to the opposite corners contracts toward the center and expands toward the edges",
gst_wipe_triangles_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_67] },
- { 68, "barnvee_r",
- "A 'V' shape extending from the right edge's midpoint to the opposite corners contracts toward the center and expands toward the edges",
+ &wipe_config[WIPE_CONFIG_66]},
+ {67, "barnvee_u",
+ "A 'V' shape extending from the top edge's midpoint to the opposite corners contracts toward the center and expands toward the edges",
gst_wipe_triangles_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_68] },
- { 101, "iris_rect",
- "A rectangle expands from the center.",
+ &wipe_config[WIPE_CONFIG_67]},
+ {68, "barnvee_r",
+ "A 'V' shape extending from the right edge's midpoint to the opposite corners contracts toward the center and expands toward the edges",
gst_wipe_triangles_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_101] },
- { 201, "clock_cw12",
- "A radial hand sweeps clockwise from the twelve o'clock position",
+ &wipe_config[WIPE_CONFIG_68]},
+ {101, "iris_rect",
+ "A rectangle expands from the center.",
+ gst_wipe_triangles_draw, _gst_mask_default_destroy,
+ &wipe_config[WIPE_CONFIG_101]},
+ {201, "clock_cw12",
+ "A radial hand sweeps clockwise from the twelve o'clock position",
gst_wipe_boxes_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_201] },
- { 202, "clock_cw3",
- "A radial hand sweeps clockwise from the three o'clock position",
+ &wipe_config[WIPE_CONFIG_201]},
+ {202, "clock_cw3",
+ "A radial hand sweeps clockwise from the three o'clock position",
gst_wipe_boxes_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_202] },
- { 203, "clock_cw6",
- "A radial hand sweeps clockwise from the six o'clock position",
+ &wipe_config[WIPE_CONFIG_202]},
+ {203, "clock_cw6",
+ "A radial hand sweeps clockwise from the six o'clock position",
gst_wipe_boxes_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_203] },
- { 204, "clock_cw9",
- "A radial hand sweeps clockwise from the nine o'clock position",
+ &wipe_config[WIPE_CONFIG_203]},
+ {204, "clock_cw9",
+ "A radial hand sweeps clockwise from the nine o'clock position",
gst_wipe_boxes_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_204] },
- { 205, "pinwheel_tbv",
- "Two radial hands sweep clockwise from the twelve and six o'clock positions",
+ &wipe_config[WIPE_CONFIG_204]},
+ {205, "pinwheel_tbv",
+ "Two radial hands sweep clockwise from the twelve and six o'clock positions",
gst_wipe_boxes_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_205] },
- { 206, "pinwheel_tbh",
- "Two radial hands sweep clockwise from the nine and three o'clock positions",
+ &wipe_config[WIPE_CONFIG_205]},
+ {206, "pinwheel_tbh",
+ "Two radial hands sweep clockwise from the nine and three o'clock positions",
gst_wipe_boxes_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_206] },
- { 207, "pinwheel_fb",
- "Four radial hands sweep clockwise",
+ &wipe_config[WIPE_CONFIG_206]},
+ {207, "pinwheel_fb",
+ "Four radial hands sweep clockwise",
gst_wipe_boxes_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_207] },
- { 211, "fan_ct",
- "A fan unfolds from the top edge, the fan axis at the center",
+ &wipe_config[WIPE_CONFIG_207]},
+ {211, "fan_ct",
+ "A fan unfolds from the top edge, the fan axis at the center",
gst_wipe_boxes_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_211] },
- { 212, "fan_cr",
- "A fan unfolds from the right edge, the fan axis at the center",
+ &wipe_config[WIPE_CONFIG_211]},
+ {212, "fan_cr",
+ "A fan unfolds from the right edge, the fan axis at the center",
gst_wipe_boxes_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_212] },
- { 213, "doublefan_fov",
- "Two fans, their axes at the center, unfold from the top and bottom",
+ &wipe_config[WIPE_CONFIG_212]},
+ {213, "doublefan_fov",
+ "Two fans, their axes at the center, unfold from the top and bottom",
gst_wipe_boxes_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_213] },
- { 214, "doublefan_foh",
- "Two fans, their axes at the center, unfold from the left and right",
+ &wipe_config[WIPE_CONFIG_213]},
+ {214, "doublefan_foh",
+ "Two fans, their axes at the center, unfold from the left and right",
gst_wipe_boxes_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_214] },
- { 221, "singlesweep_cwt",
- "A radial hand sweeps clockwise from the top edge's midpoint",
+ &wipe_config[WIPE_CONFIG_214]},
+ {221, "singlesweep_cwt",
+ "A radial hand sweeps clockwise from the top edge's midpoint",
gst_wipe_boxes_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_221] },
- { 222, "singlesweep_cwr",
- "A radial hand sweeps clockwise from the right edge's midpoint",
+ &wipe_config[WIPE_CONFIG_221]},
+ {222, "singlesweep_cwr",
+ "A radial hand sweeps clockwise from the right edge's midpoint",
gst_wipe_boxes_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_222] },
- { 223, "singlesweep_cwb",
- "A radial hand sweeps clockwise from the bottom edge's midpoint",
+ &wipe_config[WIPE_CONFIG_222]},
+ {223, "singlesweep_cwb",
+ "A radial hand sweeps clockwise from the bottom edge's midpoint",
gst_wipe_boxes_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_223] },
- { 224, "singlesweep_cwl",
- "A radial hand sweeps clockwise from the left edge's midpoint",
+ &wipe_config[WIPE_CONFIG_223]},
+ {224, "singlesweep_cwl",
+ "A radial hand sweeps clockwise from the left edge's midpoint",
gst_wipe_boxes_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_224] },
- { 225, "doublesweep_pv",
- "Two radial hands sweep clockwise and counter-clockwise from the top and bottom edges' midpoints",
+ &wipe_config[WIPE_CONFIG_224]},
+ {225, "doublesweep_pv",
+ "Two radial hands sweep clockwise and counter-clockwise from the top and bottom edges' midpoints",
gst_wipe_boxes_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_225] },
- { 226, "doublesweep_pd",
- "Two radial hands sweep clockwise and counter-clockwise from the left and right edges' midpoints",
+ &wipe_config[WIPE_CONFIG_225]},
+ {226, "doublesweep_pd",
+ "Two radial hands sweep clockwise and counter-clockwise from the left and right edges' midpoints",
gst_wipe_boxes_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_226] },
- { 227, "doublesweep_ov",
- "Two radial hands attached at the top and bottom edges' midpoints sweep from right to left",
+ &wipe_config[WIPE_CONFIG_226]},
+ {227, "doublesweep_ov",
+ "Two radial hands attached at the top and bottom edges' midpoints sweep from right to left",
gst_wipe_boxes_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_227] },
- { 228, "doublesweep_oh",
- "Two radial hands attached at the left and right edges' midpoints sweep from top to bottom",
+ &wipe_config[WIPE_CONFIG_227]},
+ {228, "doublesweep_oh",
+ "Two radial hands attached at the left and right edges' midpoints sweep from top to bottom",
gst_wipe_boxes_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_228] },
- { 231, "fan_t",
- "A fan unfolds from the bottom, the fan axis at the top edge's midpoint",
+ &wipe_config[WIPE_CONFIG_228]},
+ {231, "fan_t",
+ "A fan unfolds from the bottom, the fan axis at the top edge's midpoint",
gst_wipe_boxes_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_231] },
- { 232, "fan_r",
- "A fan unfolds from the left, the fan axis at the right edge's midpoint",
+ &wipe_config[WIPE_CONFIG_231]},
+ {232, "fan_r",
+ "A fan unfolds from the left, the fan axis at the right edge's midpoint",
gst_wipe_boxes_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_232] },
- { 233, "fan_b",
- "A fan unfolds from the top, the fan axis at the bottom edge's midpoint",
+ &wipe_config[WIPE_CONFIG_232]},
+ {233, "fan_b",
+ "A fan unfolds from the top, the fan axis at the bottom edge's midpoint",
gst_wipe_boxes_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_233] },
- { 234, "fan_l",
- "A fan unfolds from the right, the fan axis at the left edge's midpoint",
+ &wipe_config[WIPE_CONFIG_233]},
+ {234, "fan_l",
+ "A fan unfolds from the right, the fan axis at the left edge's midpoint",
gst_wipe_boxes_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_234] },
- { 235, "doublefan_fiv",
- "Two fans, their axes at the top and bottom, unfold from the center",
+ &wipe_config[WIPE_CONFIG_234]},
+ {235, "doublefan_fiv",
+ "Two fans, their axes at the top and bottom, unfold from the center",
gst_wipe_boxes_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_235] },
- { 236, "doublefan_fih",
- "Two fans, their axes at the left and right, unfold from the center",
+ &wipe_config[WIPE_CONFIG_235]},
+ {236, "doublefan_fih",
+ "Two fans, their axes at the left and right, unfold from the center",
gst_wipe_boxes_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_236] },
- { 241, "singlesweep_cwtl",
- "A radial hand sweeps clockwise from the upper-left corner",
+ &wipe_config[WIPE_CONFIG_236]},
+ {241, "singlesweep_cwtl",
+ "A radial hand sweeps clockwise from the upper-left corner",
gst_wipe_boxes_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_241] },
- { 242, "singlesweep_cwbl",
- "A radial hand sweeps counter-clockwise from the lower-left corner.",
+ &wipe_config[WIPE_CONFIG_241]},
+ {242, "singlesweep_cwbl",
+ "A radial hand sweeps counter-clockwise from the lower-left corner.",
gst_wipe_boxes_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_242] },
- { 243, "singlesweep_cwbr",
- "A radial hand sweeps clockwise from the lower-right corner",
+ &wipe_config[WIPE_CONFIG_242]},
+ {243, "singlesweep_cwbr",
+ "A radial hand sweeps clockwise from the lower-right corner",
gst_wipe_boxes_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_243] },
- { 244, "singlesweep_cwtr",
- "A radial hand sweeps counter-clockwise from the upper-right corner",
+ &wipe_config[WIPE_CONFIG_243]},
+ {244, "singlesweep_cwtr",
+ "A radial hand sweeps counter-clockwise from the upper-right corner",
gst_wipe_boxes_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_244] },
- { 245, "doublesweep_pdtl",
- "Two radial hands attached at the upper-left and lower-right corners sweep down and up",
+ &wipe_config[WIPE_CONFIG_244]},
+ {245, "doublesweep_pdtl",
+ "Two radial hands attached at the upper-left and lower-right corners sweep down and up",
gst_wipe_triangles_clock_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_245] },
- { 246, "doublesweep_pdbl",
- "Two radial hands attached at the lower-left and upper-right corners sweep down and up",
+ &wipe_config[WIPE_CONFIG_245]},
+ {246, "doublesweep_pdbl",
+ "Two radial hands attached at the lower-left and upper-right corners sweep down and up",
gst_wipe_triangles_clock_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_246] },
- { 251, "saloondoor_t",
- "Two radial hands attached at the upper-left and upper-right corners sweep down",
+ &wipe_config[WIPE_CONFIG_246]},
+ {251, "saloondoor_t",
+ "Two radial hands attached at the upper-left and upper-right corners sweep down",
gst_wipe_boxes_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_251] },
- { 252, "saloondoor_l",
- "Two radial hands attached at the upper-left and lower-left corners sweep to the right",
+ &wipe_config[WIPE_CONFIG_251]},
+ {252, "saloondoor_l",
+ "Two radial hands attached at the upper-left and lower-left corners sweep to the right",
gst_wipe_boxes_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_252] },
- { 253, "saloondoor_b",
- "Two radial hands attached at the lower-left and lower-right corners sweep up",
+ &wipe_config[WIPE_CONFIG_252]},
+ {253, "saloondoor_b",
+ "Two radial hands attached at the lower-left and lower-right corners sweep up",
gst_wipe_boxes_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_253] },
- { 254, "saloondoor_r",
- "Two radial hands attached at the upper-right and lower-right corners sweep to the left",
+ &wipe_config[WIPE_CONFIG_253]},
+ {254, "saloondoor_r",
+ "Two radial hands attached at the upper-right and lower-right corners sweep to the left",
gst_wipe_boxes_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_254] },
- { 261, "windshield_r",
- "Two radial hands attached at the midpoints of the top and bottom halves sweep from right to left",
+ &wipe_config[WIPE_CONFIG_254]},
+ {261, "windshield_r",
+ "Two radial hands attached at the midpoints of the top and bottom halves sweep from right to left",
gst_wipe_boxes_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_261] },
- { 262, "windshield_u",
- "Two radial hands attached at the midpoints of the left and right halves sweep from top to bottom",
+ &wipe_config[WIPE_CONFIG_261]},
+ {262, "windshield_u",
+ "Two radial hands attached at the midpoints of the left and right halves sweep from top to bottom",
gst_wipe_boxes_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_262] },
- { 263, "windshield_v",
- "Two sets of radial hands attached at the midpoints of the top and bottom halves sweep from top to bottom and bottom to top",
+ &wipe_config[WIPE_CONFIG_262]},
+ {263, "windshield_v",
+ "Two sets of radial hands attached at the midpoints of the top and bottom halves sweep from top to bottom and bottom to top",
gst_wipe_boxes_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_263] },
- { 264, "windshield_h",
- "Two sets of radial hands attached at the midpoints of the left and right halves sweep from left to right and right to left",
+ &wipe_config[WIPE_CONFIG_263]},
+ {264, "windshield_h",
+ "Two sets of radial hands attached at the midpoints of the left and right halves sweep from left to right and right to left",
gst_wipe_boxes_draw, _gst_mask_default_destroy,
- &wipe_config[WIPE_CONFIG_264] },
- { 0, NULL, NULL, NULL }
+ &wipe_config[WIPE_CONFIG_264]},
+ {0, NULL, NULL, NULL}
};
void
@@ -931,4 +920,3 @@ _gst_barboxwipes_register (void)
i++;
}
}
-
diff --git a/gst/smpte/gstmask.c b/gst/smpte/gstmask.c
index 13c79b344..0e2cf01f2 100644
--- a/gst/smpte/gstmask.c
+++ b/gst/smpte/gstmask.c
@@ -35,25 +35,25 @@ _gst_mask_init (void)
}
static gint
-gst_mask_compare (GstMaskDefinition *def1,
- GstMaskDefinition *def2)
+gst_mask_compare (GstMaskDefinition * def1, GstMaskDefinition * def2)
{
return (def1->type - def2->type);
}
void
-_gst_mask_register (GstMaskDefinition *definition)
+_gst_mask_register (GstMaskDefinition * definition)
{
- masks = g_list_insert_sorted (masks, definition, (GCompareFunc) gst_mask_compare);
+ masks =
+ g_list_insert_sorted (masks, definition, (GCompareFunc) gst_mask_compare);
}
-const GList*
+const GList *
gst_mask_get_definitions (void)
{
return masks;
}
-static GstMaskDefinition*
+static GstMaskDefinition *
gst_mask_find_definition (gint type)
{
GList *walk = masks;
@@ -63,13 +63,13 @@ gst_mask_find_definition (gint type)
if (def->type == type)
return def;
-
+
walk = g_list_next (walk);
}
return NULL;
}
-GstMask*
+GstMask *
gst_mask_factory_new (gint type, gint bpp, gint width, gint height)
{
GstMaskDefinition *definition;
@@ -95,14 +95,14 @@ gst_mask_factory_new (gint type, gint bpp, gint width, gint height)
}
void
-_gst_mask_default_destroy (GstMask *mask)
+_gst_mask_default_destroy (GstMask * mask)
{
g_free (mask->data);
g_free (mask);
}
void
-gst_mask_destroy (GstMask *mask)
+gst_mask_destroy (GstMask * mask)
{
if (mask->destroy_func)
mask->destroy_func (mask);
diff --git a/gst/smpte/gstmask.h b/gst/smpte/gstmask.h
index 6131c6243..6f82078f6 100644
--- a/gst/smpte/gstmask.h
+++ b/gst/smpte/gstmask.h
@@ -27,37 +27,39 @@
typedef struct _GstMask GstMask;
typedef struct _GstMaskDefinition GstMaskDefinition;
-typedef void (*GstMaskDrawFunc) (GstMask *mask);
-typedef void (*GstMaskDestroyFunc) (GstMask *mask);
-
-struct _GstMaskDefinition {
- gint type;
- gchar *short_name;
- gchar *long_name;
- GstMaskDrawFunc draw_func;
- GstMaskDestroyFunc destroy_func;
- gpointer user_data;
+typedef void (*GstMaskDrawFunc) (GstMask * mask);
+typedef void (*GstMaskDestroyFunc) (GstMask * mask);
+
+struct _GstMaskDefinition
+{
+ gint type;
+ gchar *short_name;
+ gchar *long_name;
+ GstMaskDrawFunc draw_func;
+ GstMaskDestroyFunc destroy_func;
+ gpointer user_data;
};
-struct _GstMask {
- gint type;
- guint32 *data;
- gpointer user_data;
+struct _GstMask
+{
+ gint type;
+ guint32 *data;
+ gpointer user_data;
- gint width;
- gint height;
- gint bpp;
+ gint width;
+ gint height;
+ gint bpp;
- GstMaskDestroyFunc destroy_func;
+ GstMaskDestroyFunc destroy_func;
};
-void _gst_mask_init (void);
-void _gst_mask_register (GstMaskDefinition *definition);
+void _gst_mask_init (void);
+void _gst_mask_register (GstMaskDefinition * definition);
-void _gst_mask_default_destroy (GstMask *mask);
+void _gst_mask_default_destroy (GstMask * mask);
-const GList* gst_mask_get_definitions (void);
-GstMask* gst_mask_factory_new (gint type, gint bpp, gint width, gint height);
-void gst_mask_destroy (GstMask *mask);
+const GList *gst_mask_get_definitions (void);
+GstMask *gst_mask_factory_new (gint type, gint bpp, gint width, gint height);
+void gst_mask_destroy (GstMask * mask);
#endif /* __GST_MASK_H__ */
diff --git a/gst/smpte/gstsmpte.c b/gst/smpte/gstsmpte.c
index 5899a9a16..91b91d9da 100644
--- a/gst/smpte/gstsmpte.c
+++ b/gst/smpte/gstsmpte.c
@@ -34,43 +34,39 @@ static GstElementDetails smpte_details = {
};
static GstStaticPadTemplate gst_smpte_src_template =
-GST_STATIC_PAD_TEMPLATE (
- "src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (
- GST_VIDEO_CAPS_YUV("I420")
- )
-);
+GST_STATIC_PAD_TEMPLATE ("src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("I420")
+ )
+ );
static GstStaticPadTemplate gst_smpte_sink1_template =
-GST_STATIC_PAD_TEMPLATE (
- "sink1",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (
- GST_VIDEO_CAPS_YUV("I420")
- )
-);
+GST_STATIC_PAD_TEMPLATE ("sink1",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("I420")
+ )
+ );
static GstStaticPadTemplate gst_smpte_sink2_template =
-GST_STATIC_PAD_TEMPLATE (
- "sink2",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (
- GST_VIDEO_CAPS_YUV("I420")
- )
-);
+GST_STATIC_PAD_TEMPLATE ("sink2",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("I420")
+ )
+ );
/* SMPTE signals and args */
-enum {
+enum
+{
/* FILL ME */
LAST_SIGNAL
};
-enum {
+enum
+{
ARG_0,
ARG_TYPE,
ARG_BORDER,
@@ -80,48 +76,51 @@ enum {
#define GST_TYPE_SMPTE_TRANSITION_TYPE (gst_smpte_transition_type_get_type())
static GType
-gst_smpte_transition_type_get_type (void)
+gst_smpte_transition_type_get_type (void)
{
static GType smpte_transition_type = 0;
GEnumValue *smpte_transitions;
if (!smpte_transition_type) {
const GList *definitions;
- gint i=0;
+ gint i = 0;
definitions = gst_mask_get_definitions ();
- smpte_transitions = g_new0 (GEnumValue, g_list_length ((GList *)definitions)+1);
+ smpte_transitions =
+ g_new0 (GEnumValue, g_list_length ((GList *) definitions) + 1);
while (definitions) {
GstMaskDefinition *definition = (GstMaskDefinition *) definitions->data;
+
definitions = g_list_next (definitions);
smpte_transitions[i].value = definition->type;
smpte_transitions[i].value_name = definition->short_name;
smpte_transitions[i].value_nick = definition->long_name;
-
+
i++;
}
- smpte_transition_type =
- g_enum_register_static ("GstSMPTETransitionType", smpte_transitions);
+ smpte_transition_type =
+ g_enum_register_static ("GstSMPTETransitionType", smpte_transitions);
}
return smpte_transition_type;
-}
+}
-static void gst_smpte_class_init (GstSMPTEClass *klass);
-static void gst_smpte_base_init (GstSMPTEClass *klass);
-static void gst_smpte_init (GstSMPTE *smpte);
+static void gst_smpte_class_init (GstSMPTEClass * klass);
+static void gst_smpte_base_init (GstSMPTEClass * klass);
+static void gst_smpte_init (GstSMPTE * smpte);
-static void gst_smpte_loop (GstElement *element);
+static void gst_smpte_loop (GstElement * element);
-static void gst_smpte_set_property (GObject *object, guint prop_id,
- const GValue *value, GParamSpec *pspec);
-static void gst_smpte_get_property (GObject *object, guint prop_id,
- GValue *value, GParamSpec *pspec);
+static void gst_smpte_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec);
+static void gst_smpte_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec);
static GstElementClass *parent_class = NULL;
+
/*static guint gst_smpte_signals[LAST_SIGNAL] = { 0 }; */
static GType
@@ -131,45 +130,46 @@ gst_smpte_get_type (void)
if (!smpte_type) {
static const GTypeInfo smpte_info = {
- sizeof(GstSMPTEClass),
- (GBaseInitFunc)gst_smpte_base_init,
+ sizeof (GstSMPTEClass),
+ (GBaseInitFunc) gst_smpte_base_init,
NULL,
- (GClassInitFunc)gst_smpte_class_init,
+ (GClassInitFunc) gst_smpte_class_init,
NULL,
NULL,
- sizeof(GstSMPTE),
+ sizeof (GstSMPTE),
0,
- (GInstanceInitFunc)gst_smpte_init,
+ (GInstanceInitFunc) gst_smpte_init,
};
- smpte_type = g_type_register_static(GST_TYPE_ELEMENT, "GstSMPTE", &smpte_info, 0);
+ smpte_type =
+ g_type_register_static (GST_TYPE_ELEMENT, "GstSMPTE", &smpte_info, 0);
}
return smpte_type;
}
static void
-gst_smpte_base_init (GstSMPTEClass *klass)
+gst_smpte_base_init (GstSMPTEClass * klass)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get(&gst_smpte_sink1_template));
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get(&gst_smpte_sink2_template));
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get(&gst_smpte_src_template));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&gst_smpte_sink1_template));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&gst_smpte_sink2_template));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&gst_smpte_src_template));
gst_element_class_set_details (element_class, &smpte_details);
}
static void
-gst_smpte_class_init (GstSMPTEClass *klass)
+gst_smpte_class_init (GstSMPTEClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
- gobject_class = (GObjectClass*)klass;
- gstelement_class = (GstElementClass*)klass;
+ gobject_class = (GObjectClass *) klass;
+ gstelement_class = (GstElementClass *) klass;
- parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
+ parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
gobject_class->set_property = gst_smpte_set_property;
gobject_class->get_property = gst_smpte_get_property;
@@ -177,39 +177,42 @@ gst_smpte_class_init (GstSMPTEClass *klass)
_gst_mask_init ();
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_TYPE,
- g_param_spec_enum ("type", "Type", "The type of transition to use",
- GST_TYPE_SMPTE_TRANSITION_TYPE, 1, G_PARAM_READWRITE));
+ g_param_spec_enum ("type", "Type", "The type of transition to use",
+ GST_TYPE_SMPTE_TRANSITION_TYPE, 1, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FPS,
- g_param_spec_float ("fps", "FPS", "Frames per second if no input files are given",
- 0., G_MAXFLOAT, 25., G_PARAM_READWRITE));
+ g_param_spec_float ("fps", "FPS",
+ "Frames per second if no input files are given", 0., G_MAXFLOAT, 25.,
+ G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BORDER,
- g_param_spec_int ("border", "Border", "The border width of the transition",
- 0, G_MAXINT, 0, G_PARAM_READWRITE));
+ g_param_spec_int ("border", "Border",
+ "The border width of the transition", 0, G_MAXINT, 0,
+ G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DEPTH,
- g_param_spec_int ("depth", "Depth", "Depth of the mask in bits",
- 1, 24, 16, G_PARAM_READWRITE));
+ g_param_spec_int ("depth", "Depth", "Depth of the mask in bits", 1, 24,
+ 16, G_PARAM_READWRITE));
}
/* wht yel cya grn mag red blu blk -I Q */
-static int y_colors[] = { 255, 226, 179, 150, 105, 76, 29, 16, 16, 0 };
-static int u_colors[] = { 128, 0, 170, 46, 212, 85, 255, 128, 0, 128 };
-static int v_colors[] = { 128, 155, 0, 21, 235, 255, 107, 128, 128, 255 };
+static int y_colors[] = { 255, 226, 179, 150, 105, 76, 29, 16, 16, 0 };
+static int u_colors[] = { 128, 0, 170, 46, 212, 85, 255, 128, 0, 128 };
+static int v_colors[] = { 128, 155, 0, 21, 235, 255, 107, 128, 128, 255 };
static void
-fill_i420 (guint8 *data, gint width, gint height, gint color)
+fill_i420 (guint8 * data, gint width, gint height, gint color)
{
gint size = width * height, size4 = size >> 2;
guint8 *yp = data;
guint8 *up = data + size;
guint8 *vp = data + size + size4;
-
+
memset (yp, y_colors[color], size);
memset (up, u_colors[color], size4);
memset (vp, v_colors[color], size4);
}
static gboolean
-gst_smpte_update_mask (GstSMPTE *smpte, gint type, gint depth, gint width, gint height)
+gst_smpte_update_mask (GstSMPTE * smpte, gint type, gint depth, gint width,
+ gint height)
{
GstMask *newmask;
@@ -230,7 +233,7 @@ gst_smpte_update_mask (GstSMPTE *smpte, gint type, gint depth, gint width, gint
}
static gboolean
-gst_smpte_sinkconnect (GstPad *pad, const GstCaps *caps)
+gst_smpte_sinkconnect (GstPad * pad, const GstCaps * caps)
{
GstSMPTE *smpte;
GstStructure *structure;
@@ -243,29 +246,34 @@ gst_smpte_sinkconnect (GstPad *pad, const GstCaps *caps)
ret = gst_structure_get_int (structure, "width", &smpte->width);
ret &= gst_structure_get_int (structure, "height", &smpte->height);
ret &= gst_structure_get_double (structure, "framerate", &smpte->fps);
- if (!ret) return GST_PAD_LINK_REFUSED;
+ if (!ret)
+ return GST_PAD_LINK_REFUSED;
- gst_smpte_update_mask (smpte, smpte->type, smpte->depth, smpte->width, smpte->height);
+ gst_smpte_update_mask (smpte, smpte->type, smpte->depth, smpte->width,
+ smpte->height);
/* forward to the next plugin */
- return gst_pad_try_set_caps(smpte->srcpad, caps);
+ return gst_pad_try_set_caps (smpte->srcpad, caps);
}
-static void
-gst_smpte_init (GstSMPTE *smpte)
+static void
+gst_smpte_init (GstSMPTE * smpte)
{
- smpte->sinkpad1 = gst_pad_new_from_template (
- gst_static_pad_template_get(&gst_smpte_sink1_template), "sink1");
+ smpte->sinkpad1 =
+ gst_pad_new_from_template (gst_static_pad_template_get
+ (&gst_smpte_sink1_template), "sink1");
gst_pad_set_link_function (smpte->sinkpad1, gst_smpte_sinkconnect);
gst_element_add_pad (GST_ELEMENT (smpte), smpte->sinkpad1);
- smpte->sinkpad2 = gst_pad_new_from_template (
- gst_static_pad_template_get(&gst_smpte_sink2_template), "sink2");
+ smpte->sinkpad2 =
+ gst_pad_new_from_template (gst_static_pad_template_get
+ (&gst_smpte_sink2_template), "sink2");
gst_pad_set_link_function (smpte->sinkpad2, gst_smpte_sinkconnect);
gst_element_add_pad (GST_ELEMENT (smpte), smpte->sinkpad2);
- smpte->srcpad = gst_pad_new_from_template (
- gst_static_pad_template_get(&gst_smpte_src_template), "src");
+ smpte->srcpad =
+ gst_pad_new_from_template (gst_static_pad_template_get
+ (&gst_smpte_src_template), "src");
gst_element_add_pad (GST_ELEMENT (smpte), smpte->srcpad);
gst_element_set_loop_function (GST_ELEMENT (smpte), gst_smpte_loop);
@@ -278,48 +286,53 @@ gst_smpte_init (GstSMPTE *smpte)
smpte->type = 1;
smpte->border = 0;
smpte->depth = 16;
- gst_smpte_update_mask (smpte, smpte->type, smpte->depth, smpte->width, smpte->height);
+ gst_smpte_update_mask (smpte, smpte->type, smpte->depth, smpte->width,
+ smpte->height);
}
static void
-gst_smpte_blend_i420 (guint8 *in1, guint8 *in2, guint8 *out, GstMask *mask,
- gint width, gint height, gint border, gint pos)
+gst_smpte_blend_i420 (guint8 * in1, guint8 * in2, guint8 * out, GstMask * mask,
+ gint width, gint height, gint border, gint pos)
{
guint32 *maskp;
gint value;
gint i, j;
gint min, max;
- guint8 *in1u, *in1v, *in2u, *in2v, *outu, *outv;
+ guint8 *in1u, *in1v, *in2u, *in2v, *outu, *outv;
gint lumsize = width * height;
gint chromsize = lumsize >> 2;
- if (border == 0) border++;
+ if (border == 0)
+ border++;
- min = pos - border;
+ min = pos - border;
max = pos;
- in1u = in1 + lumsize; in1v = in1u + chromsize;
- in2u = in2 + lumsize; in2v = in2u + chromsize;
- outu = out + lumsize; outv = outu + chromsize;
-
+ in1u = in1 + lumsize;
+ in1v = in1u + chromsize;
+ in2u = in2 + lumsize;
+ in2v = in2u + chromsize;
+ outu = out + lumsize;
+ outv = outu + chromsize;
+
maskp = mask->data;
for (i = 0; i < height; i++) {
for (j = 0; j < width; j++) {
value = *maskp++;
value = ((CLAMP (value, min, max) - min) << 8) / border;
-
+
*out++ = ((*in1++ * value) + (*in2++ * (256 - value))) >> 8;
if (!(i & 1) && !(j & 1)) {
- *outu++ = ((*in1u++ * value) + (*in2u++ * (256 - value))) >> 8;
- *outv++ = ((*in1v++ * value) + (*in2v++ * (256 - value))) >> 8;
+ *outu++ = ((*in1u++ * value) + (*in2u++ * (256 - value))) >> 8;
+ *outv++ = ((*in1v++ * value) + (*in2v++ * (256 - value))) >> 8;
}
}
}
}
static void
-gst_smpte_loop (GstElement *element)
+gst_smpte_loop (GstElement * element)
{
GstSMPTE *smpte;
GstBuffer *outbuf;
@@ -335,8 +348,7 @@ gst_smpte_loop (GstElement *element)
if (GST_IS_EVENT (in1)) {
gst_pad_push (smpte->srcpad, GST_DATA (in1));
in1 = NULL;
- }
- else
+ } else
ts = GST_BUFFER_TIMESTAMP (in1);
}
if (GST_PAD_IS_USABLE (smpte->sinkpad2) && in2 == NULL) {
@@ -344,8 +356,7 @@ gst_smpte_loop (GstElement *element)
if (GST_IS_EVENT (in2)) {
gst_pad_push (smpte->srcpad, GST_DATA (in2));
in2 = NULL;
- }
- else
+ } else
ts = GST_BUFFER_TIMESTAMP (in2);
}
@@ -358,33 +369,33 @@ gst_smpte_loop (GstElement *element)
fill_i420 (GST_BUFFER_DATA (in2), smpte->width, smpte->height, 0);
}
- if (smpte->position < smpte->duration) {
+ if (smpte->position < smpte->duration) {
outbuf = gst_buffer_new_and_alloc (smpte->width * smpte->height * 3);
if (!GST_PAD_CAPS (smpte->srcpad)) {
GstCaps *caps;
- caps = gst_caps_copy (gst_static_caps_get (
- &gst_smpte_src_template.static_caps));
- gst_caps_set_simple (caps,
- "width", G_TYPE_INT, smpte->width,
- "height", G_TYPE_INT, smpte->height,
- "framerate", G_TYPE_DOUBLE, smpte->fps, NULL);
+
+ caps =
+ gst_caps_copy (gst_static_caps_get (&gst_smpte_src_template.
+ static_caps));
+ gst_caps_set_simple (caps, "width", G_TYPE_INT, smpte->width, "height",
+ G_TYPE_INT, smpte->height, "framerate", G_TYPE_DOUBLE, smpte->fps,
+ NULL);
if (!gst_pad_try_set_caps (smpte->srcpad, caps)) {
- GST_ELEMENT_ERROR (smpte, CORE, NEGOTIATION, (NULL), (NULL));
- return;
+ GST_ELEMENT_ERROR (smpte, CORE, NEGOTIATION, (NULL), (NULL));
+ return;
}
}
- gst_smpte_blend_i420 (GST_BUFFER_DATA (in1),
- GST_BUFFER_DATA (in2),
- GST_BUFFER_DATA (outbuf),
- smpte->mask, smpte->width, smpte->height,
- smpte->border,
- ((1 << smpte->depth) + smpte->border) *
- smpte->position / smpte->duration);
- }
- else {
+ gst_smpte_blend_i420 (GST_BUFFER_DATA (in1),
+ GST_BUFFER_DATA (in2),
+ GST_BUFFER_DATA (outbuf),
+ smpte->mask, smpte->width, smpte->height,
+ smpte->border,
+ ((1 << smpte->depth) + smpte->border) *
+ smpte->position / smpte->duration);
+ } else {
outbuf = in2;
gst_buffer_ref (in2);
}
@@ -401,20 +412,20 @@ gst_smpte_loop (GstElement *element)
}
static void
-gst_smpte_set_property (GObject *object, guint prop_id,
- const GValue *value, GParamSpec *pspec)
+gst_smpte_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec)
{
GstSMPTE *smpte;
- smpte = GST_SMPTE(object);
+ smpte = GST_SMPTE (object);
switch (prop_id) {
case ARG_TYPE:
{
gint type = g_value_get_enum (value);
- gst_smpte_update_mask (smpte, type, smpte->depth,
- smpte->width, smpte->height);
+ gst_smpte_update_mask (smpte, type, smpte->depth,
+ smpte->width, smpte->height);
break;
}
case ARG_BORDER:
@@ -427,8 +438,8 @@ gst_smpte_set_property (GObject *object, guint prop_id,
{
gint depth = g_value_get_int (value);
- gst_smpte_update_mask (smpte, smpte->type, depth,
- smpte->width, smpte->height);
+ gst_smpte_update_mask (smpte, smpte->type, depth,
+ smpte->width, smpte->height);
break;
}
default:
@@ -438,12 +449,12 @@ gst_smpte_set_property (GObject *object, guint prop_id,
}
static void
-gst_smpte_get_property (GObject *object, guint prop_id,
- GValue *value, GParamSpec *pspec)
+gst_smpte_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec)
{
GstSMPTE *smpte;
- smpte = GST_SMPTE(object);
+ smpte = GST_SMPTE (object);
switch (prop_id) {
case ARG_TYPE:
@@ -468,20 +479,13 @@ gst_smpte_get_property (GObject *object, guint prop_id,
static gboolean
-plugin_init (GstPlugin *plugin)
+plugin_init (GstPlugin * plugin)
{
- return gst_element_register(plugin, "smpte",
- GST_RANK_NONE, GST_TYPE_SMPTE);
+ return gst_element_register (plugin, "smpte", GST_RANK_NONE, GST_TYPE_SMPTE);
}
-GST_PLUGIN_DEFINE (
- GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "smpte",
- "Apply the standard SMPTE transitions on video images",
- plugin_init,
- VERSION,
- "LGPL",
- GST_PACKAGE,
- GST_ORIGIN
-)
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ "smpte",
+ "Apply the standard SMPTE transitions on video images",
+ plugin_init, VERSION, "LGPL", GST_PACKAGE, GST_ORIGIN)
diff --git a/gst/smpte/gstsmpte.h b/gst/smpte/gstsmpte.h
index 40844209f..762eebf89 100644
--- a/gst/smpte/gstsmpte.h
+++ b/gst/smpte/gstsmpte.h
@@ -38,28 +38,28 @@
typedef struct _GstSMPTE GstSMPTE;
typedef struct _GstSMPTEClass GstSMPTEClass;
-struct _GstSMPTE {
- GstElement element;
+struct _GstSMPTE
+{
+ GstElement element;
- gint format;
- gint width;
- gint height;
- gdouble fps;
+ gint format;
+ gint width;
+ gint height;
+ gdouble fps;
- gint duration;
- gint position;
+ gint duration;
+ gint position;
- GstPad *srcpad,
- *sinkpad1,
- *sinkpad2;
+ GstPad *srcpad, *sinkpad1, *sinkpad2;
- gint type;
- gint border;
- gint depth;
- GstMask *mask;
+ gint type;
+ gint border;
+ gint depth;
+ GstMask *mask;
};
-struct _GstSMPTEClass {
+struct _GstSMPTEClass
+{
GstElementClass parent_class;
};
diff --git a/gst/smpte/paint.c b/gst/smpte/paint.c
index dae3c6f19..fdff77e53 100644
--- a/gst/smpte/paint.c
+++ b/gst/smpte/paint.c
@@ -26,21 +26,20 @@
#include "paint.h"
void
-gst_smpte_paint_vbox (guint32 *dest, gint stride,
- gint x0, gint y0, gint c0,
- gint x1, gint y1, gint c1)
+gst_smpte_paint_vbox (guint32 * dest, gint stride,
+ gint x0, gint y0, gint c0, gint x1, gint y1, gint c1)
{
gint i, j;
gint width, height;
width = x1 - x0;
height = y1 - y0;
-
+
g_assert (width > 0);
g_assert (height > 0);
dest = dest + y0 * stride + x0;
-
+
for (i = 0; i < height; i++) {
for (j = 0; j < width; j++) {
dest[j] = (c1 * j + c0 * (width - j)) / width;
@@ -50,16 +49,15 @@ gst_smpte_paint_vbox (guint32 *dest, gint stride,
}
void
-gst_smpte_paint_hbox (guint32 *dest, gint stride,
- gint x0, gint y0, gint c0,
- gint x1, gint y1, gint c1)
+gst_smpte_paint_hbox (guint32 * dest, gint stride,
+ gint x0, gint y0, gint c0, gint x1, gint y1, gint c1)
{
gint i, j;
gint width, height;
width = x1 - x0;
height = y1 - y0;
-
+
g_assert (width > 0);
g_assert (height > 0);
@@ -68,7 +66,8 @@ gst_smpte_paint_hbox (guint32 *dest, gint stride,
dest = dest + y0 * stride + x0;
for (i = 0; i < height; i++) {
- guint32 value = (c1 * i + c0 * (height - i)) / height;
+ guint32 value = (c1 * i + c0 * (height - i)) / height;
+
for (j = 0; j < width; j++) {
dest[j] = value;
}
@@ -148,29 +147,35 @@ G_STMT_START { \
} G_STMT_END
void
-gst_smpte_paint_triangle_linear (guint32 *dest, gint stride,
- gint x0, gint y0, gint c0,
- gint x1, gint y1, gint c1, gint x2, gint y2, gint c2)
+gst_smpte_paint_triangle_linear (guint32 * dest, gint stride,
+ gint x0, gint y0, gint c0,
+ gint x1, gint y1, gint c1, gint x2, gint y2, gint c2)
{
gint sdxl, sdyl, sdcl, dxlabs, dylabs, dclabs, xrl, yrl, crl, pxl, pyl, pcl;
gint sdxr, sdyr, sdcr, dxrabs, dyrabs, dcrabs, xrr, yrr, crr, pxr, pyr, pcr;
gint i, j, k, seg_start, seg_end;
- if (y0 > y1) { SWAP_INT (x0, x1); SWAP_INT (y0, y1); SWAP_INT (c0, c1); }
- if (y0 > y2) { SWAP_INT (x0, x2); SWAP_INT (y0, y2); SWAP_INT (c0, c2); }
- if (y1 > y2) { SWAP_INT (x1, x2); SWAP_INT (y1, y2); SWAP_INT (c1, c2); }
-
- PREPARE_3D_LINE (x0,y0,c0,x2,y2,c2,
- dxlabs,dylabs,dclabs,
- sdxl, sdyl,sdcl,
- xrl,yrl,crl,
- pxl,pyl,pcl);
-
- PREPARE_3D_LINE (x0,y0,c0,x1,y1,c1,
- dxrabs,dyrabs,dcrabs,
- sdxr, sdyr,sdcr,
- xrr,yrr,crr,
- pxr,pyr,pcr);
+ if (y0 > y1) {
+ SWAP_INT (x0, x1);
+ SWAP_INT (y0, y1);
+ SWAP_INT (c0, c1);
+ }
+ if (y0 > y2) {
+ SWAP_INT (x0, x2);
+ SWAP_INT (y0, y2);
+ SWAP_INT (c0, c2);
+ }
+ if (y1 > y2) {
+ SWAP_INT (x1, x2);
+ SWAP_INT (y1, y2);
+ SWAP_INT (c1, c2);
+ }
+
+ PREPARE_3D_LINE (x0, y0, c0, x2, y2, c2,
+ dxlabs, dylabs, dclabs, sdxl, sdyl, sdcl, xrl, yrl, crl, pxl, pyl, pcl);
+
+ PREPARE_3D_LINE (x0, y0, c0, x1, y1, c1,
+ dxrabs, dyrabs, dcrabs, sdxr, sdyr, sdcr, xrr, yrr, crr, pxr, pyr, pcr);
dest = dest + stride * y0;
seg_start = y0;
@@ -183,37 +188,32 @@ gst_smpte_paint_triangle_linear (guint32 *dest, gint stride,
gint sign = SIGN (e - s);
e += sign;
- for (j = s; j != e; j+=sign) {
- dest[j] = (ec * (j - s) + sc * (e - j)) / (e - s);
+ for (j = s; j != e; j += sign) {
+ dest[j] = (ec * (j - s) + sc * (e - j)) / (e - s);
}
while (pyr == i) {
- STEP_3D_LINE (dxrabs, dyrabs, dcrabs, sdxr, sdyr, sdcr,
- xrr, yrr, crr, pxr, pyr, pcr);
+ STEP_3D_LINE (dxrabs, dyrabs, dcrabs, sdxr, sdyr, sdcr,
+ xrr, yrr, crr, pxr, pyr, pcr);
}
while (pyl == i) {
- STEP_3D_LINE (dxlabs, dylabs, dclabs, sdxl, sdyl, sdcl,
- xrl, yrl, crl, pxl, pyl, pcl);
+ STEP_3D_LINE (dxlabs, dylabs, dclabs, sdxl, sdyl, sdcl,
+ xrl, yrl, crl, pxl, pyl, pcl);
}
dest += stride;
}
- PREPARE_3D_LINE (x1,y1,c1,x2,y2,c2,
- dxrabs,dyrabs,dcrabs,
- sdxr, sdyr,sdcr,
- xrr,yrr,crr,
- pxr,pyr,pcr);
+ PREPARE_3D_LINE (x1, y1, c1, x2, y2, c2,
+ dxrabs, dyrabs, dcrabs, sdxr, sdyr, sdcr, xrr, yrr, crr, pxr, pyr, pcr);
seg_start = y1;
seg_end = y2;
}
}
-static void
-draw_bresenham_line (guint32 *dest, gint stride,
- gint x0, gint y0,
- gint x1, gint y1,
- guint32 col)
+static void
+draw_bresenham_line (guint32 * dest, gint stride,
+ gint x0, gint y0, gint x1, gint y1, guint32 col)
{
gint dx = abs (x1 - x0);
gint dy = abs (y1 - y0);
@@ -224,13 +224,12 @@ draw_bresenham_line (guint32 *dest, gint stride,
x_incr = SIGN (x1 - x0);
y_incr = SIGN (y1 - y0) * stride;
-
- if (dx >= dy) {
+
+ if (dx >= dy) {
dpr = dy << 1;
i = dx;
indep = x_incr;
- }
- else {
+ } else {
dpr = dx << 1;
i = dy;
indep = y_incr;
@@ -242,7 +241,7 @@ draw_bresenham_line (guint32 *dest, gint stride,
for (; i >= 0; i--) {
*dest = col;
- if (P > 0) {
+ if (P > 0) {
dest += x_incr;
dest += y_incr;
P += dpru;
@@ -254,10 +253,9 @@ draw_bresenham_line (guint32 *dest, gint stride,
}
void
-gst_smpte_paint_triangle_clock (guint32 *dest, gint stride,
- gint x0, gint y0, gint c0,
- gint x1, gint y1, gint c1,
- gint x2, gint y2, gint c2)
+gst_smpte_paint_triangle_clock (guint32 * dest, gint stride,
+ gint x0, gint y0, gint c0,
+ gint x1, gint y1, gint c1, gint x2, gint y2, gint c2)
{
gint i;
gint sign;
@@ -265,11 +263,11 @@ gst_smpte_paint_triangle_clock (guint32 *dest, gint stride,
gfloat len1;
angle_s = 0.0;
- angle_e = acos (((x1-x0) * (x2-x0) + (y1-y0) * (y2-y0))/
- (sqrt ((x1-x0) * (x1-x0) + (y1-y0) * (y1-y0)) *
- sqrt ((x2-x0) * (x2-x0) + (y2-y0) * (y2-y0))));
+ angle_e = acos (((x1 - x0) * (x2 - x0) + (y1 - y0) * (y2 - y0)) /
+ (sqrt ((x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0)) *
+ sqrt ((x2 - x0) * (x2 - x0) + (y2 - y0) * (y2 - y0))));
- len1 = sqrt ((x1-x0) * (x1-x0) + (y1-y0) * (y1-y0));
+ len1 = sqrt ((x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0));
if (x1 == x2) {
sign = SIGN (y2 - y1);
@@ -278,65 +276,57 @@ gst_smpte_paint_triangle_clock (guint32 *dest, gint stride,
if (y1 == i)
angle = 0;
else
- angle = acos (((x1-x0) * (x2-x0) + (y1-y0) * (i-y0)) /
- (len1 * sqrt ((x1-x0) * (x1-x0) + (i-y0) * (i-y0)))) / angle_e;
+ angle = acos (((x1 - x0) * (x2 - x0) + (y1 - y0) * (i - y0)) /
+ (len1 * sqrt ((x1 - x0) * (x1 - x0) + (i - y0) * (i -
+ y0)))) / angle_e;
draw_bresenham_line (dest, stride,
- x0, y0, x1, i,
- (c2 * angle + c1 * (1.0-angle)));
+ x0, y0, x1, i, (c2 * angle + c1 * (1.0 - angle)));
}
- }
- else if (y1 == y2) {
+ } else if (y1 == y2) {
sign = SIGN (x2 - x1);
for (i = x1; i != (x2 + sign); i += sign) {
if (x1 == i)
angle = 0;
else
- angle = acos (((x1-x0) * (i-x0) + (y1-y0) * (y2-y0)) /
- (len1 * sqrt ((i-x0) * (i-x0) + (y2-y0) * (y2-y0)))) / angle_e;
+ angle = acos (((x1 - x0) * (i - x0) + (y1 - y0) * (y2 - y0)) /
+ (len1 * sqrt ((i - x0) * (i - x0) + (y2 - y0) * (y2 -
+ y0)))) / angle_e;
draw_bresenham_line (dest, stride,
- x0, y0, i, y1,
- (c2 * angle + c1 * (1.0-angle)));
+ x0, y0, i, y1, (c2 * angle + c1 * (1.0 - angle)));
}
}
}
void
-gst_smpte_paint_box_clock (guint32 *dest, gint stride,
- gint x0, gint y0, gint c0,
- gint x1, gint y1, gint c1,
- gint x2, gint y2, gint c2)
+gst_smpte_paint_box_clock (guint32 * dest, gint stride,
+ gint x0, gint y0, gint c0,
+ gint x1, gint y1, gint c1, gint x2, gint y2, gint c2)
{
gfloat angle_m, col_m;
gint xv, yv;
- if (x1 == x0) {
+ if (x1 == x0) {
xv = x2;
yv = y1;
} else if (y1 == y0) {
xv = x1;
yv = y2;
- }
- else {
+ } else {
g_warning ("paint box clock: not supported");
return;
}
- angle_m = 2 * acos (((x1-x0) * (xv-x0) + (y1-y0) * (yv-y0))/
- (sqrt ((x1-x0) * (x1-x0) + (y1-y0) * (y1-y0)) *
- sqrt ((xv-x0) * (xv-x0) + (yv-y0) * (yv-y0)))) / M_PI;
-
- col_m = c2 * angle_m + c1 * (1.0-angle_m);
+ angle_m = 2 * acos (((x1 - x0) * (xv - x0) + (y1 - y0) * (yv - y0)) /
+ (sqrt ((x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0)) *
+ sqrt ((xv - x0) * (xv - x0) + (yv - y0) * (yv - y0)))) / M_PI;
+
+ col_m = c2 * angle_m + c1 * (1.0 - angle_m);
gst_smpte_paint_triangle_clock (dest, stride,
- x0, y0, c0,
- x1, y1, c1,
- xv, yv, col_m);
+ x0, y0, c0, x1, y1, c1, xv, yv, col_m);
gst_smpte_paint_triangle_clock (dest, stride,
- x0, y0, c0,
- xv, yv, col_m,
- x2, y2, c2);
+ x0, y0, c0, xv, yv, col_m, x2, y2, c2);
}
-
diff --git a/gst/smpte/paint.h b/gst/smpte/paint.h
index 4c34cf92d..aa9fd4251 100644
--- a/gst/smpte/paint.h
+++ b/gst/smpte/paint.h
@@ -22,26 +22,21 @@
#include <glib.h>
-void gst_smpte_paint_vbox (guint32 *dest, gint stride,
- gint x0, gint y0, gint c0,
- gint x1, gint y1, gint c1);
-void gst_smpte_paint_hbox (guint32 *dest, gint stride,
- gint x0, gint y0, gint c0,
- gint x1, gint y1, gint c1);
+void gst_smpte_paint_vbox (guint32 * dest, gint stride,
+ gint x0, gint y0, gint c0, gint x1, gint y1, gint c1);
+void gst_smpte_paint_hbox (guint32 * dest, gint stride,
+ gint x0, gint y0, gint c0, gint x1, gint y1, gint c1);
-void gst_smpte_paint_triangle_linear (guint32 *dest, gint stride,
- gint x0, gint y0, gint c0,
- gint x1, gint y1, gint c1,
- gint x2, gint y2, gint c2);
+void gst_smpte_paint_triangle_linear (guint32 * dest, gint stride,
+ gint x0, gint y0, gint c0,
+ gint x1, gint y1, gint c1, gint x2, gint y2, gint c2);
-void gst_smpte_paint_triangle_clock (guint32 *dest, gint stride,
- gint x0, gint y0, gint c0,
- gint x1, gint y1, gint c1,
- gint x2, gint y2, gint c2);
+void gst_smpte_paint_triangle_clock (guint32 * dest, gint stride,
+ gint x0, gint y0, gint c0,
+ gint x1, gint y1, gint c1, gint x2, gint y2, gint c2);
-void gst_smpte_paint_box_clock (guint32 *dest, gint stride,
- gint x0, gint y0, gint c0,
- gint x1, gint y1, gint c1,
- gint x2, gint y2, gint c2);
+void gst_smpte_paint_box_clock (guint32 * dest, gint stride,
+ gint x0, gint y0, gint c0,
+ gint x1, gint y1, gint c1, gint x2, gint y2, gint c2);
#endif /* __GST_SMPTE_PAINT_H__ */
diff --git a/gst/spectrum/demo-osssrc.c b/gst/spectrum/demo-osssrc.c
index 3431ec91f..462fcf906 100644
--- a/gst/spectrum/demo-osssrc.c
+++ b/gst/spectrum/demo-osssrc.c
@@ -3,12 +3,14 @@
extern gboolean _gst_plugin_spew;
-void spectrum_chain(GstPad *pad,GstData *_data);
-gboolean idle_func(gpointer data);
+void spectrum_chain (GstPad * pad, GstData * _data);
+gboolean idle_func (gpointer data);
GtkWidget *drawingarea;
-int main(int argc,char *argv[]) {
+int
+main (int argc, char *argv[])
+{
GstElement *bin;
GstElementFactory *srcfactory;
GstElement *src;
@@ -20,63 +22,67 @@ int main(int argc,char *argv[]) {
_gst_plugin_spew = TRUE;
- gst_init(&argc,&argv);
- gnome_init("Spectrum","0.0.1",argc,argv);
+ gst_init (&argc, &argv);
+ gnome_init ("Spectrum", "0.0.1", argc, argv);
- bin = gst_bin_new("bin");
+ bin = gst_bin_new ("bin");
- srcfactory = gst_element_factory_find("osssrc");
- spectrumfactory = gst_element_factory_find("gstspectrum");
+ srcfactory = gst_element_factory_find ("osssrc");
+ spectrumfactory = gst_element_factory_find ("gstspectrum");
- src = gst_element_factory_create(srcfactory,"src");
- gtk_object_set(GTK_OBJECT(src),"bytes_per_read",(gulong)1024,NULL);
- spectrum = gst_element_factory_create(spectrumfactory,"spectrum");
- gtk_object_set(GTK_OBJECT(spectrum),"width",256,NULL);
+ src = gst_element_factory_create (srcfactory, "src");
+ gtk_object_set (GTK_OBJECT (src), "bytes_per_read", (gulong) 1024, NULL);
+ spectrum = gst_element_factory_create (spectrumfactory, "spectrum");
+ gtk_object_set (GTK_OBJECT (spectrum), "width", 256, NULL);
- gst_bin_add(GST_BIN(bin),GST_ELEMENT(src));
- gst_bin_add(GST_BIN(bin),GST_ELEMENT(spectrum));
+ gst_bin_add (GST_BIN (bin), GST_ELEMENT (src));
+ gst_bin_add (GST_BIN (bin), GST_ELEMENT (spectrum));
- gst_pad_link(gst_element_get_pad(src,"src"),
- gst_element_get_pad(spectrum,"sink"));
+ gst_pad_link (gst_element_get_pad (src, "src"),
+ gst_element_get_pad (spectrum, "sink"));
- spectrumpad = gst_pad_new("sink",GST_PAD_SINK);
- gst_pad_set_chain_function(spectrumpad,spectrum_chain);
+ spectrumpad = gst_pad_new ("sink", GST_PAD_SINK);
+ gst_pad_set_chain_function (spectrumpad, spectrum_chain);
- gst_pad_link(gst_element_get_pad(spectrum,"src"),spectrumpad);
+ gst_pad_link (gst_element_get_pad (spectrum, "src"), spectrumpad);
- appwindow = gnome_app_new("spectrum","Spectrum");
- drawingarea = gtk_drawing_area_new();
- gtk_drawing_area_size(GTK_DRAWING_AREA(drawingarea),256,32);
- gnome_app_set_contents(GNOME_APP(appwindow),drawingarea);
- gtk_widget_show_all(appwindow);
+ appwindow = gnome_app_new ("spectrum", "Spectrum");
+ drawingarea = gtk_drawing_area_new ();
+ gtk_drawing_area_size (GTK_DRAWING_AREA (drawingarea), 256, 32);
+ gnome_app_set_contents (GNOME_APP (appwindow), drawingarea);
+ gtk_widget_show_all (appwindow);
- gst_element_set_state(GST_ELEMENT(bin),GST_STATE_READY);
- gst_element_set_state(GST_ELEMENT(bin),GST_STATE_PLAYING);
+ gst_element_set_state (GST_ELEMENT (bin), GST_STATE_READY);
+ gst_element_set_state (GST_ELEMENT (bin), GST_STATE_PLAYING);
- g_idle_add(idle_func,src);
+ g_idle_add (idle_func, src);
- gtk_main();
+ gtk_main ();
return 0;
}
-void spectrum_chain(GstPad *pad,GstData *_data) {
+void
+spectrum_chain (GstPad * pad, GstData * _data)
+{
GstBuffer *buf = GST_BUFFER (_data);
gint i;
guchar *data = buf->data;
- gdk_draw_rectangle(drawingarea->window,drawingarea->style->black_gc,
- TRUE,0,0,GST_BUFFER_SIZE(buf),25);
- for (i=0;i<GST_BUFFER_SIZE(buf);i++) {
- gdk_draw_rectangle(drawingarea->window,drawingarea->style->white_gc,
- TRUE,i,32-data[i],1,data[i]);
+ gdk_draw_rectangle (drawingarea->window, drawingarea->style->black_gc,
+ TRUE, 0, 0, GST_BUFFER_SIZE (buf), 25);
+ for (i = 0; i < GST_BUFFER_SIZE (buf); i++) {
+ gdk_draw_rectangle (drawingarea->window, drawingarea->style->white_gc,
+ TRUE, i, 32 - data[i], 1, data[i]);
}
- gst_buffer_unref(buf);
+ gst_buffer_unref (buf);
}
-gboolean idle_func(gpointer data) {
+gboolean
+idle_func (gpointer data)
+{
/*gst_src_push(GST_SRC(data)); */
return TRUE;
}
diff --git a/gst/spectrum/fix_fft.c b/gst/spectrum/fix_fft.c
index a5dd658fb..db6c3a82b 100644
--- a/gst/spectrum/fix_fft.c
+++ b/gst/spectrum/fix_fft.c
@@ -67,8 +67,8 @@
extern fixed gst_spectrum_Sinewave[N_WAVE]; /* placed at end of this file for clarity */
extern fixed gst_spectrum_Loudampl[N_LOUD];
-static int gst_spectrum_db_from_ampl(fixed re, fixed im);
-static fixed gst_spectrum_fix_mpy(fixed a, fixed b);
+static int gst_spectrum_db_from_ampl (fixed re, fixed im);
+static fixed gst_spectrum_fix_mpy (fixed a, fixed b);
/*
fix_fft() - perform fast Fourier transform.
@@ -78,127 +78,119 @@ static fixed gst_spectrum_fix_mpy(fixed a, fixed b);
size of data = 2**m
set inverse to 0=dft, 1=idft
*/
-int gst_spectrum_fix_fft(fixed fr[], fixed fi[], int m, int inverse) {
- int mr, nn, i, j, l, k, istep, n, scale, shift;
- fixed qr, qi, tr, ti, wr, wi;
-
- n = 1 << m;
-
- if (n > N_WAVE)
- return -1;
-
- mr = 0;
- nn = n - 1;
- scale = 0;
-
- /* decimation in time - re-order data */
- for (m = 1; m <= nn; ++m)
- {
- l = n;
- do
- {
- l >>= 1;
- }
- while (mr + l > nn);
- mr = (mr & (l - 1)) + l;
-
- if (mr <= m)
- continue;
- tr = fr[m];
- fr[m] = fr[mr];
- fr[mr] = tr;
- ti = fi[m];
- fi[m] = fi[mr];
- fi[mr] = ti;
+int
+gst_spectrum_fix_fft (fixed fr[], fixed fi[], int m, int inverse)
+{
+ int mr, nn, i, j, l, k, istep, n, scale, shift;
+ fixed qr, qi, tr, ti, wr, wi;
+
+ n = 1 << m;
+
+ if (n > N_WAVE)
+ return -1;
+
+ mr = 0;
+ nn = n - 1;
+ scale = 0;
+
+ /* decimation in time - re-order data */
+ for (m = 1; m <= nn; ++m) {
+ l = n;
+ do {
+ l >>= 1;
+ }
+ while (mr + l > nn);
+ mr = (mr & (l - 1)) + l;
+
+ if (mr <= m)
+ continue;
+ tr = fr[m];
+ fr[m] = fr[mr];
+ fr[mr] = tr;
+ ti = fi[m];
+ fi[m] = fi[mr];
+ fi[mr] = ti;
+ }
+
+ l = 1;
+ k = LOG2_N_WAVE - 1;
+ while (l < n) {
+ if (inverse) {
+ /* variable scaling, depending upon data */
+ shift = 0;
+ for (i = 0; i < n; ++i) {
+ j = fr[i];
+ if (j < 0)
+ j = -j;
+ m = fi[i];
+ if (m < 0)
+ m = -m;
+ if (j > 16383 || m > 16383) {
+ shift = 1;
+ break;
}
-
- l = 1;
- k = LOG2_N_WAVE - 1;
- while (l < n)
- {
- if (inverse)
- {
- /* variable scaling, depending upon data */
- shift = 0;
- for (i = 0; i < n; ++i)
- {
- j = fr[i];
- if (j < 0)
- j = -j;
- m = fi[i];
- if (m < 0)
- m = -m;
- if (j > 16383 || m > 16383)
- {
- shift = 1;
- break;
- }
- }
- if (shift)
- ++scale;
- }
- else
- {
- /* fixed scaling, for proper normalization -
- there will be log2(n) passes, so this
- results in an overall factor of 1/n,
- distributed to maximize arithmetic accuracy. */
- shift = 1;
- }
- /* it may not be obvious, but the shift will be performed
- on each data point exactly once, during this pass. */
- istep = l << 1;
- for (m = 0; m < l; ++m)
- {
- j = m << k;
- /* 0 <= j < N_WAVE/2 */
- wr = gst_spectrum_Sinewave[j + N_WAVE / 4];
- wi = -gst_spectrum_Sinewave[j];
- if (inverse)
- wi = -wi;
- if (shift)
- {
- wr >>= 1;
- wi >>= 1;
- }
- for (i = m; i < n; i += istep)
- {
- j = i + l;
- tr = gst_spectrum_fix_mpy(wr, fr[j]) -
- gst_spectrum_fix_mpy(wi, fi[j]);
- ti = gst_spectrum_fix_mpy(wr, fi[j]) +
- gst_spectrum_fix_mpy(wi, fr[j]);
- qr = fr[i];
- qi = fi[i];
- if (shift)
- {
- qr >>= 1;
- qi >>= 1;
- }
- fr[j] = qr - tr;
- fi[j] = qi - ti;
- fr[i] = qr + tr;
- fi[i] = qi + ti;
- }
- }
- --k;
- l = istep;
+ }
+ if (shift)
+ ++scale;
+ } else {
+ /* fixed scaling, for proper normalization -
+ there will be log2(n) passes, so this
+ results in an overall factor of 1/n,
+ distributed to maximize arithmetic accuracy. */
+ shift = 1;
+ }
+ /* it may not be obvious, but the shift will be performed
+ on each data point exactly once, during this pass. */
+ istep = l << 1;
+ for (m = 0; m < l; ++m) {
+ j = m << k;
+ /* 0 <= j < N_WAVE/2 */
+ wr = gst_spectrum_Sinewave[j + N_WAVE / 4];
+ wi = -gst_spectrum_Sinewave[j];
+ if (inverse)
+ wi = -wi;
+ if (shift) {
+ wr >>= 1;
+ wi >>= 1;
+ }
+ for (i = m; i < n; i += istep) {
+ j = i + l;
+ tr = gst_spectrum_fix_mpy (wr, fr[j]) -
+ gst_spectrum_fix_mpy (wi, fi[j]);
+ ti = gst_spectrum_fix_mpy (wr, fi[j]) +
+ gst_spectrum_fix_mpy (wi, fr[j]);
+ qr = fr[i];
+ qi = fi[i];
+ if (shift) {
+ qr >>= 1;
+ qi >>= 1;
}
-
- return scale;
+ fr[j] = qr - tr;
+ fi[j] = qi - ti;
+ fr[i] = qr + tr;
+ fi[i] = qi + ti;
+ }
+ }
+ --k;
+ l = istep;
+ }
+
+ return scale;
}
/* window() - apply a Hanning window */
-void gst_spectrum_window(fixed fr[], int n) {
- int i, j, k;
-
- j = N_WAVE / n;
- n >>= 1;
- for (i = 0, k = N_WAVE / 4; i < n; ++i, k += j)
- FIX_MPY(fr[i], fr[i], 16384 - (gst_spectrum_Sinewave[k] >> 1));
- n <<= 1;
- for (k -= j; i < n; ++i, k -= j)
- FIX_MPY(fr[i], fr[i], 16384 - (gst_spectrum_Sinewave[k] >> 1));
+void
+gst_spectrum_window (fixed fr[], int n)
+{
+ int i, j, k;
+
+ j = N_WAVE / n;
+ n >>= 1;
+ for (i = 0, k = N_WAVE / 4; i < n; ++i, k += j)
+ FIX_MPY (fr[i], fr[i], 16384 - (gst_spectrum_Sinewave[k] >> 1));
+ n <<= 1;
+ for (k -= j; i < n; ++i, k -= j)
+ FIX_MPY (fr[i], fr[i], 16384 - (gst_spectrum_Sinewave[k] >> 1));
}
/* fix_loud() - compute loudness of freq-vis components.
@@ -208,73 +200,81 @@ void gst_spectrum_window(fixed fr[], int n) {
was obtained from an inverse FFT, 0 otherwise.
loud[] is the loudness, in dB wrt 32767; will be +10 to -N_LOUD.
*/
-void gst_spectrum_fix_loud(fixed loud[], fixed fr[], fixed fi[], int n, int scale_shift) {
- int i, max;
-
- max = 0;
- if (scale_shift > 0)
- max = 10;
- scale_shift = (scale_shift + 1) * 6;
-
- for (i = 0; i < n; ++i)
- {
- loud[i] = gst_spectrum_db_from_ampl(fr[i], fi[i]) + scale_shift;
- if (loud[i] > max)
- loud[i] = max;
- }
+void
+gst_spectrum_fix_loud (fixed loud[], fixed fr[], fixed fi[], int n,
+ int scale_shift)
+{
+ int i, max;
+
+ max = 0;
+ if (scale_shift > 0)
+ max = 10;
+ scale_shift = (scale_shift + 1) * 6;
+
+ for (i = 0; i < n; ++i) {
+ loud[i] = gst_spectrum_db_from_ampl (fr[i], fi[i]) + scale_shift;
+ if (loud[i] > max)
+ loud[i] = max;
+ }
}
/* db_from_ampl() - find loudness (in dB) from
the complex amplitude.
*/
-int gst_spectrum_db_from_ampl(fixed re, fixed im) {
- static long loud2[N_LOUD] =
- {0};
- long v;
- int i;
-
- if (loud2[0] == 0)
- {
- loud2[0] = (long) gst_spectrum_Loudampl[0] * (long) gst_spectrum_Loudampl[0];
- for (i = 1; i < N_LOUD; ++i)
- {
- v = (long) gst_spectrum_Loudampl[i] * (long) gst_spectrum_Loudampl[i];
- loud2[i] = v;
- loud2[i - 1] = (loud2[i - 1] + v) / 2;
- }
- }
-
- v = (long) re *(long) re + (long) im *(long) im;
-
- for (i = 0; i < N_LOUD; ++i)
- if (loud2[i] <= v)
- break;
-
- return (-i);
+int
+gst_spectrum_db_from_ampl (fixed re, fixed im)
+{
+ static long loud2[N_LOUD] = { 0 };
+ long v;
+ int i;
+
+ if (loud2[0] == 0) {
+ loud2[0] =
+ (long) gst_spectrum_Loudampl[0] * (long) gst_spectrum_Loudampl[0];
+ for (i = 1; i < N_LOUD; ++i) {
+ v = (long) gst_spectrum_Loudampl[i] * (long) gst_spectrum_Loudampl[i];
+ loud2[i] = v;
+ loud2[i - 1] = (loud2[i - 1] + v) / 2;
+ }
+ }
+
+ v = (long) re *(long) re + (long) im *(long) im;
+
+ for (i = 0; i < N_LOUD; ++i)
+ if (loud2[i] <= v)
+ break;
+
+ return (-i);
}
/*
fix_mpy() - fixed-point multiplication
*/
-fixed gst_spectrum_fix_mpy(fixed a, fixed b) {
- FIX_MPY(a, a, b);
- return a;
+fixed
+gst_spectrum_fix_mpy (fixed a, fixed b)
+{
+ FIX_MPY (a, a, b);
+ return a;
}
/*
iscale() - scale an integer value by (numer/denom)
*/
-int gst_spectrum_iscale(int value, int numer, int denom) {
- return (long) value *(long) numer / (long) denom;
+int
+gst_spectrum_iscale (int value, int numer, int denom)
+{
+ return (long) value *(long) numer / (long) denom;
}
/*
fix_dot() - dot product of two fixed arrays
*/
-fixed gst_spectrum_fix_dot(fixed * hpa, fixed * pb, int n) {
- fixed *pa = hpa; /* FIXME */
- long sum;
- register fixed a, b;
+fixed
+gst_spectrum_fix_dot (fixed * hpa, fixed * pb, int n)
+{
+ fixed *pa = hpa; /* FIXME */
+ long sum;
+ register fixed a, b;
/* seg = FP_SEG(hpa);
off = FP_OFF(hpa);
@@ -282,174 +282,169 @@ fixed gst_spectrum_fix_dot(fixed * hpa, fixed * pb, int n) {
off &= 0x000F;
pa = MK_FP(seg,off);
*/
- sum = 0L;
- while (n--)
- {
- a = *pa++;
- b = *pb++;
- FIX_MPY(a, a, b);
- sum += a;
- }
+ sum = 0L;
+ while (n--) {
+ a = *pa++;
+ b = *pb++;
+ FIX_MPY (a, a, b);
+ sum += a;
+ }
- if (sum > 0x7FFF)
- sum = 0x7FFF;
- else if (sum < -0x7FFF)
- sum = -0x7FFF;
+ if (sum > 0x7FFF)
+ sum = 0x7FFF;
+ else if (sum < -0x7FFF)
+ sum = -0x7FFF;
- return (fixed) sum;
+ return (fixed) sum;
}
#if N_WAVE != 1024
ERROR:N_WAVE != 1024
#endif
-fixed gst_spectrum_Sinewave[1024] = {
- 0, 201, 402, 603, 804, 1005, 1206, 1406,
- 1607, 1808, 2009, 2209, 2410, 2610, 2811, 3011,
- 3211, 3411, 3611, 3811, 4011, 4210, 4409, 4608,
- 4807, 5006, 5205, 5403, 5601, 5799, 5997, 6195,
- 6392, 6589, 6786, 6982, 7179, 7375, 7571, 7766,
- 7961, 8156, 8351, 8545, 8739, 8932, 9126, 9319,
- 9511, 9703, 9895, 10087, 10278, 10469, 10659, 10849,
- 11038, 11227, 11416, 11604, 11792, 11980, 12166, 12353,
- 12539, 12724, 12909, 13094, 13278, 13462, 13645, 13827,
- 14009, 14191, 14372, 14552, 14732, 14911, 15090, 15268,
- 15446, 15623, 15799, 15975, 16150, 16325, 16499, 16672,
- 16845, 17017, 17189, 17360, 17530, 17699, 17868, 18036,
- 18204, 18371, 18537, 18702, 18867, 19031, 19194, 19357,
- 19519, 19680, 19840, 20000, 20159, 20317, 20474, 20631,
- 20787, 20942, 21096, 21249, 21402, 21554, 21705, 21855,
- 22004, 22153, 22301, 22448, 22594, 22739, 22883, 23027,
- 23169, 23311, 23452, 23592, 23731, 23869, 24006, 24143,
- 24278, 24413, 24546, 24679, 24811, 24942, 25072, 25201,
- 25329, 25456, 25582, 25707, 25831, 25954, 26077, 26198,
- 26318, 26437, 26556, 26673, 26789, 26905, 27019, 27132,
- 27244, 27355, 27466, 27575, 27683, 27790, 27896, 28001,
- 28105, 28208, 28309, 28410, 28510, 28608, 28706, 28802,
- 28897, 28992, 29085, 29177, 29268, 29358, 29446, 29534,
- 29621, 29706, 29790, 29873, 29955, 30036, 30116, 30195,
- 30272, 30349, 30424, 30498, 30571, 30643, 30713, 30783,
- 30851, 30918, 30984, 31049,
- 31113, 31175, 31236, 31297,
- 31356, 31413, 31470, 31525, 31580, 31633, 31684, 31735,
- 31785, 31833, 31880, 31926, 31970, 32014, 32056, 32097,
- 32137, 32176, 32213, 32249, 32284, 32318, 32350, 32382,
- 32412, 32441, 32468, 32495, 32520, 32544, 32567, 32588,
- 32609, 32628, 32646, 32662, 32678, 32692, 32705, 32717,
- 32727, 32736, 32744, 32751, 32757, 32761, 32764, 32766,
- 32767, 32766, 32764, 32761, 32757, 32751, 32744, 32736,
- 32727, 32717, 32705, 32692, 32678, 32662, 32646, 32628,
- 32609, 32588, 32567, 32544, 32520, 32495, 32468, 32441,
- 32412, 32382, 32350, 32318, 32284, 32249, 32213, 32176,
- 32137, 32097, 32056, 32014, 31970, 31926, 31880, 31833,
- 31785, 31735, 31684, 31633, 31580, 31525, 31470, 31413,
- 31356, 31297, 31236, 31175, 31113, 31049, 30984, 30918,
- 30851, 30783, 30713, 30643, 30571, 30498, 30424, 30349,
- 30272, 30195, 30116, 30036, 29955, 29873, 29790, 29706,
- 29621, 29534, 29446, 29358, 29268, 29177, 29085, 28992,
- 28897, 28802, 28706, 28608, 28510, 28410, 28309, 28208,
- 28105, 28001, 27896, 27790, 27683, 27575, 27466, 27355,
- 27244, 27132, 27019, 26905, 26789, 26673, 26556, 26437,
- 26318, 26198, 26077, 25954, 25831, 25707, 25582, 25456,
- 25329, 25201, 25072, 24942, 24811, 24679, 24546, 24413,
- 24278, 24143, 24006, 23869, 23731, 23592, 23452, 23311,
- 23169, 23027, 22883, 22739, 22594, 22448, 22301, 22153,
- 22004, 21855, 21705, 21554, 21402, 21249, 21096, 20942,
- 20787, 20631, 20474, 20317, 20159, 20000, 19840, 19680,
- 19519, 19357, 19194, 19031, 18867, 18702, 18537, 18371,
- 18204, 18036, 17868, 17699, 17530, 17360, 17189, 17017,
- 16845, 16672, 16499, 16325, 16150, 15975, 15799, 15623,
- 15446, 15268, 15090, 14911, 14732, 14552, 14372, 14191,
- 14009, 13827, 13645, 13462, 13278, 13094, 12909, 12724,
- 12539, 12353, 12166, 11980, 11792, 11604, 11416, 11227,
- 11038, 10849, 10659, 10469, 10278, 10087, 9895, 9703,
- 9511, 9319, 9126, 8932, 8739, 8545, 8351, 8156,
- 7961, 7766, 7571, 7375, 7179, 6982, 6786, 6589,
- 6392, 6195, 5997, 5799, 5601, 5403, 5205, 5006,
- 4807, 4608, 4409, 4210, 4011, 3811, 3611, 3411,
- 3211, 3011, 2811, 2610, 2410, 2209, 2009, 1808,
- 1607, 1406, 1206, 1005, 804, 603, 402, 201,
- 0, -201, -402, -603, -804, -1005, -1206, -1406,
- -1607, -1808, -2009, -2209, -2410, -2610, -2811, -3011,
- -3211, -3411, -3611, -3811, -4011, -4210, -4409, -4608,
- -4807, -5006, -5205, -5403, -5601, -5799, -5997, -6195,
- -6392, -6589, -6786, -6982, -7179, -7375, -7571, -7766,
- -7961, -8156, -8351, -8545, -8739, -8932, -9126, -9319,
- -9511, -9703, -9895, -10087, -10278, -10469, -10659, -10849,
- -11038, -11227, -11416, -11604, -11792, -11980, -12166, -12353,
- -12539, -12724, -12909, -13094, -13278, -13462, -13645, -13827,
- -14009, -14191, -14372, -14552, -14732, -14911, -15090, -15268,
- -15446, -15623, -15799, -15975, -16150, -16325, -16499, -16672,
- -16845, -17017, -17189, -17360, -17530, -17699, -17868, -18036,
- -18204, -18371, -18537, -18702, -18867, -19031, -19194, -19357,
- -19519, -19680, -19840, -20000, -20159, -20317, -20474, -20631,
- -20787, -20942, -21096, -21249, -21402, -21554, -21705, -21855,
- -22004, -22153, -22301, -22448, -22594, -22739, -22883, -23027,
- -23169, -23311, -23452, -23592, -23731, -23869, -24006, -24143,
- -24278, -24413, -24546, -24679, -24811, -24942, -25072, -25201,
- -25329, -25456, -25582, -25707, -25831, -25954, -26077, -26198,
- -26318, -26437, -26556, -26673, -26789, -26905, -27019, -27132,
- -27244, -27355, -27466, -27575, -27683, -27790, -27896, -28001,
- -28105, -28208, -28309, -28410, -28510, -28608, -28706, -28802,
- -28897, -28992, -29085, -29177, -29268, -29358, -29446, -29534,
- -29621, -29706, -29790, -29873, -29955, -30036, -30116, -30195,
- -30272, -30349, -30424, -30498, -30571, -30643, -30713, -30783,
- -30851, -30918, -30984, -31049, -31113, -31175, -31236, -31297,
- -31356, -31413, -31470, -31525, -31580, -31633, -31684, -31735,
- -31785, -31833, -31880, -31926, -31970, -32014, -32056, -32097,
- -32137, -32176, -32213, -32249, -32284, -32318, -32350, -32382,
- -32412, -32441, -32468, -32495, -32520, -32544, -32567, -32588,
- -32609, -32628, -32646, -32662, -32678, -32692, -32705, -32717,
- -32727, -32736, -32744, -32751, -32757, -32761, -32764, -32766,
- -32767, -32766, -32764, -32761, -32757, -32751, -32744, -32736,
- -32727, -32717, -32705, -32692, -32678, -32662, -32646, -32628,
- -32609, -32588, -32567, -32544, -32520, -32495, -32468, -32441,
- -32412, -32382, -32350, -32318, -32284, -32249, -32213, -32176,
- -32137, -32097, -32056, -32014, -31970, -31926, -31880, -31833,
- -31785, -31735, -31684, -31633, -31580, -31525, -31470, -31413,
- -31356, -31297, -31236, -31175, -31113, -31049, -30984, -30918,
- -30851, -30783, -30713, -30643, -30571, -30498, -30424, -30349,
- -30272, -30195, -30116, -30036, -29955, -29873, -29790, -29706,
- -29621, -29534, -29446, -29358, -29268, -29177, -29085, -28992,
- -28897, -28802, -28706, -28608, -28510, -28410, -28309, -28208,
- -28105, -28001, -27896, -27790, -27683, -27575, -27466, -27355,
- -27244, -27132, -27019, -26905, -26789, -26673, -26556, -26437,
- -26318, -26198, -26077, -25954, -25831, -25707, -25582, -25456,
- -25329, -25201, -25072, -24942, -24811, -24679, -24546, -24413,
- -24278, -24143, -24006, -23869, -23731, -23592, -23452, -23311,
- -23169, -23027, -22883, -22739, -22594, -22448, -22301, -22153,
- -22004, -21855, -21705, -21554, -21402, -21249, -21096, -20942,
- -20787, -20631, -20474, -20317, -20159, -20000, -19840, -19680,
- -19519, -19357, -19194, -19031, -18867, -18702, -18537, -18371,
- -18204, -18036, -17868, -17699, -17530, -17360, -17189, -17017,
- -16845, -16672, -16499, -16325, -16150, -15975, -15799, -15623,
- -15446, -15268, -15090, -14911, -14732, -14552, -14372, -14191,
- -14009, -13827, -13645, -13462, -13278, -13094, -12909, -12724,
- -12539, -12353, -12166, -11980, -11792, -11604, -11416, -11227,
- -11038, -10849, -10659, -10469, -10278, -10087, -9895, -9703,
- -9511, -9319, -9126, -8932, -8739, -8545, -8351, -8156,
- -7961, -7766, -7571, -7375, -7179, -6982, -6786, -6589,
- -6392, -6195, -5997, -5799, -5601, -5403, -5205, -5006,
- -4807, -4608, -4409, -4210, -4011, -3811, -3611, -3411,
- -3211, -3011, -2811, -2610, -2410, -2209, -2009, -1808,
- -1607, -1406, -1206, -1005, -804, -603, -402, -201,
-};
+ fixed gst_spectrum_Sinewave[1024] = {
+0, 201, 402, 603, 804, 1005, 1206, 1406,
+ 1607, 1808, 2009, 2209, 2410, 2610, 2811, 3011,
+ 3211, 3411, 3611, 3811, 4011, 4210, 4409, 4608,
+ 4807, 5006, 5205, 5403, 5601, 5799, 5997, 6195,
+ 6392, 6589, 6786, 6982, 7179, 7375, 7571, 7766,
+ 7961, 8156, 8351, 8545, 8739, 8932, 9126, 9319,
+ 9511, 9703, 9895, 10087, 10278, 10469, 10659, 10849,
+ 11038, 11227, 11416, 11604, 11792, 11980, 12166, 12353,
+ 12539, 12724, 12909, 13094, 13278, 13462, 13645, 13827,
+ 14009, 14191, 14372, 14552, 14732, 14911, 15090, 15268,
+ 15446, 15623, 15799, 15975, 16150, 16325, 16499, 16672,
+ 16845, 17017, 17189, 17360, 17530, 17699, 17868, 18036,
+ 18204, 18371, 18537, 18702, 18867, 19031, 19194, 19357,
+ 19519, 19680, 19840, 20000, 20159, 20317, 20474, 20631,
+ 20787, 20942, 21096, 21249, 21402, 21554, 21705, 21855,
+ 22004, 22153, 22301, 22448, 22594, 22739, 22883, 23027,
+ 23169, 23311, 23452, 23592, 23731, 23869, 24006, 24143,
+ 24278, 24413, 24546, 24679, 24811, 24942, 25072, 25201,
+ 25329, 25456, 25582, 25707, 25831, 25954, 26077, 26198,
+ 26318, 26437, 26556, 26673, 26789, 26905, 27019, 27132,
+ 27244, 27355, 27466, 27575, 27683, 27790, 27896, 28001,
+ 28105, 28208, 28309, 28410, 28510, 28608, 28706, 28802,
+ 28897, 28992, 29085, 29177, 29268, 29358, 29446, 29534,
+ 29621, 29706, 29790, 29873, 29955, 30036, 30116, 30195,
+ 30272, 30349, 30424, 30498, 30571, 30643, 30713, 30783,
+ 30851, 30918, 30984, 31049,
+ 31113, 31175, 31236, 31297,
+ 31356, 31413, 31470, 31525, 31580, 31633, 31684, 31735,
+ 31785, 31833, 31880, 31926, 31970, 32014, 32056, 32097,
+ 32137, 32176, 32213, 32249, 32284, 32318, 32350, 32382,
+ 32412, 32441, 32468, 32495, 32520, 32544, 32567, 32588,
+ 32609, 32628, 32646, 32662, 32678, 32692, 32705, 32717,
+ 32727, 32736, 32744, 32751, 32757, 32761, 32764, 32766,
+ 32767, 32766, 32764, 32761, 32757, 32751, 32744, 32736,
+ 32727, 32717, 32705, 32692, 32678, 32662, 32646, 32628,
+ 32609, 32588, 32567, 32544, 32520, 32495, 32468, 32441,
+ 32412, 32382, 32350, 32318, 32284, 32249, 32213, 32176,
+ 32137, 32097, 32056, 32014, 31970, 31926, 31880, 31833,
+ 31785, 31735, 31684, 31633, 31580, 31525, 31470, 31413,
+ 31356, 31297, 31236, 31175, 31113, 31049, 30984, 30918,
+ 30851, 30783, 30713, 30643, 30571, 30498, 30424, 30349,
+ 30272, 30195, 30116, 30036, 29955, 29873, 29790, 29706,
+ 29621, 29534, 29446, 29358, 29268, 29177, 29085, 28992,
+ 28897, 28802, 28706, 28608, 28510, 28410, 28309, 28208,
+ 28105, 28001, 27896, 27790, 27683, 27575, 27466, 27355,
+ 27244, 27132, 27019, 26905, 26789, 26673, 26556, 26437,
+ 26318, 26198, 26077, 25954, 25831, 25707, 25582, 25456,
+ 25329, 25201, 25072, 24942, 24811, 24679, 24546, 24413,
+ 24278, 24143, 24006, 23869, 23731, 23592, 23452, 23311,
+ 23169, 23027, 22883, 22739, 22594, 22448, 22301, 22153,
+ 22004, 21855, 21705, 21554, 21402, 21249, 21096, 20942,
+ 20787, 20631, 20474, 20317, 20159, 20000, 19840, 19680,
+ 19519, 19357, 19194, 19031, 18867, 18702, 18537, 18371,
+ 18204, 18036, 17868, 17699, 17530, 17360, 17189, 17017,
+ 16845, 16672, 16499, 16325, 16150, 15975, 15799, 15623,
+ 15446, 15268, 15090, 14911, 14732, 14552, 14372, 14191,
+ 14009, 13827, 13645, 13462, 13278, 13094, 12909, 12724,
+ 12539, 12353, 12166, 11980, 11792, 11604, 11416, 11227,
+ 11038, 10849, 10659, 10469, 10278, 10087, 9895, 9703,
+ 9511, 9319, 9126, 8932, 8739, 8545, 8351, 8156,
+ 7961, 7766, 7571, 7375, 7179, 6982, 6786, 6589,
+ 6392, 6195, 5997, 5799, 5601, 5403, 5205, 5006,
+ 4807, 4608, 4409, 4210, 4011, 3811, 3611, 3411,
+ 3211, 3011, 2811, 2610, 2410, 2209, 2009, 1808,
+ 1607, 1406, 1206, 1005, 804, 603, 402, 201,
+ 0, -201, -402, -603, -804, -1005, -1206, -1406,
+ -1607, -1808, -2009, -2209, -2410, -2610, -2811, -3011,
+ -3211, -3411, -3611, -3811, -4011, -4210, -4409, -4608,
+ -4807, -5006, -5205, -5403, -5601, -5799, -5997, -6195,
+ -6392, -6589, -6786, -6982, -7179, -7375, -7571, -7766,
+ -7961, -8156, -8351, -8545, -8739, -8932, -9126, -9319,
+ -9511, -9703, -9895, -10087, -10278, -10469, -10659, -10849,
+ -11038, -11227, -11416, -11604, -11792, -11980, -12166, -12353,
+ -12539, -12724, -12909, -13094, -13278, -13462, -13645, -13827,
+ -14009, -14191, -14372, -14552, -14732, -14911, -15090, -15268,
+ -15446, -15623, -15799, -15975, -16150, -16325, -16499, -16672,
+ -16845, -17017, -17189, -17360, -17530, -17699, -17868, -18036,
+ -18204, -18371, -18537, -18702, -18867, -19031, -19194, -19357,
+ -19519, -19680, -19840, -20000, -20159, -20317, -20474, -20631,
+ -20787, -20942, -21096, -21249, -21402, -21554, -21705, -21855,
+ -22004, -22153, -22301, -22448, -22594, -22739, -22883, -23027,
+ -23169, -23311, -23452, -23592, -23731, -23869, -24006, -24143,
+ -24278, -24413, -24546, -24679, -24811, -24942, -25072, -25201,
+ -25329, -25456, -25582, -25707, -25831, -25954, -26077, -26198,
+ -26318, -26437, -26556, -26673, -26789, -26905, -27019, -27132,
+ -27244, -27355, -27466, -27575, -27683, -27790, -27896, -28001,
+ -28105, -28208, -28309, -28410, -28510, -28608, -28706, -28802,
+ -28897, -28992, -29085, -29177, -29268, -29358, -29446, -29534,
+ -29621, -29706, -29790, -29873, -29955, -30036, -30116, -30195,
+ -30272, -30349, -30424, -30498, -30571, -30643, -30713, -30783,
+ -30851, -30918, -30984, -31049, -31113, -31175, -31236, -31297,
+ -31356, -31413, -31470, -31525, -31580, -31633, -31684, -31735,
+ -31785, -31833, -31880, -31926, -31970, -32014, -32056, -32097,
+ -32137, -32176, -32213, -32249, -32284, -32318, -32350, -32382,
+ -32412, -32441, -32468, -32495, -32520, -32544, -32567, -32588,
+ -32609, -32628, -32646, -32662, -32678, -32692, -32705, -32717,
+ -32727, -32736, -32744, -32751, -32757, -32761, -32764, -32766,
+ -32767, -32766, -32764, -32761, -32757, -32751, -32744, -32736,
+ -32727, -32717, -32705, -32692, -32678, -32662, -32646, -32628,
+ -32609, -32588, -32567, -32544, -32520, -32495, -32468, -32441,
+ -32412, -32382, -32350, -32318, -32284, -32249, -32213, -32176,
+ -32137, -32097, -32056, -32014, -31970, -31926, -31880, -31833,
+ -31785, -31735, -31684, -31633, -31580, -31525, -31470, -31413,
+ -31356, -31297, -31236, -31175, -31113, -31049, -30984, -30918,
+ -30851, -30783, -30713, -30643, -30571, -30498, -30424, -30349,
+ -30272, -30195, -30116, -30036, -29955, -29873, -29790, -29706,
+ -29621, -29534, -29446, -29358, -29268, -29177, -29085, -28992,
+ -28897, -28802, -28706, -28608, -28510, -28410, -28309, -28208,
+ -28105, -28001, -27896, -27790, -27683, -27575, -27466, -27355,
+ -27244, -27132, -27019, -26905, -26789, -26673, -26556, -26437,
+ -26318, -26198, -26077, -25954, -25831, -25707, -25582, -25456,
+ -25329, -25201, -25072, -24942, -24811, -24679, -24546, -24413,
+ -24278, -24143, -24006, -23869, -23731, -23592, -23452, -23311,
+ -23169, -23027, -22883, -22739, -22594, -22448, -22301, -22153,
+ -22004, -21855, -21705, -21554, -21402, -21249, -21096, -20942,
+ -20787, -20631, -20474, -20317, -20159, -20000, -19840, -19680,
+ -19519, -19357, -19194, -19031, -18867, -18702, -18537, -18371,
+ -18204, -18036, -17868, -17699, -17530, -17360, -17189, -17017,
+ -16845, -16672, -16499, -16325, -16150, -15975, -15799, -15623,
+ -15446, -15268, -15090, -14911, -14732, -14552, -14372, -14191,
+ -14009, -13827, -13645, -13462, -13278, -13094, -12909, -12724,
+ -12539, -12353, -12166, -11980, -11792, -11604, -11416, -11227,
+ -11038, -10849, -10659, -10469, -10278, -10087, -9895, -9703,
+ -9511, -9319, -9126, -8932, -8739, -8545, -8351, -8156,
+ -7961, -7766, -7571, -7375, -7179, -6982, -6786, -6589,
+ -6392, -6195, -5997, -5799, -5601, -5403, -5205, -5006,
+ -4807, -4608, -4409, -4210, -4011, -3811, -3611, -3411,
+ -3211, -3011, -2811, -2610, -2410, -2209, -2009, -1808,
+ -1607, -1406, -1206, -1005, -804, -603, -402, -201,};
#if N_LOUD != 100
ERROR:N_LOUD != 100
#endif
-fixed gst_spectrum_Loudampl[100] = {
- 32767, 29203, 26027, 23197, 20674, 18426, 16422, 14636,
- 13044, 11626, 10361, 9234, 8230, 7335, 6537, 5826,
- 5193, 4628, 4125, 3676, 3276, 2920, 2602, 2319,
- 2067, 1842, 1642, 1463, 1304, 1162, 1036, 923,
- 823, 733, 653, 582, 519, 462, 412, 367,
- 327, 292, 260, 231, 206, 184, 164, 146,
- 130, 116, 103, 92, 82, 73, 65, 58,
- 51, 46, 41, 36, 32, 29, 26, 23,
- 20, 18, 16, 14, 13, 11, 10, 9,
- 8, 7, 6, 5, 5, 4, 4, 3,
- 3, 2, 2, 2, 2, 1, 1, 1,
- 1, 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,
-};
+ fixed gst_spectrum_Loudampl[100] = {
+32767, 29203, 26027, 23197, 20674, 18426, 16422, 14636,
+ 13044, 11626, 10361, 9234, 8230, 7335, 6537, 5826,
+ 5193, 4628, 4125, 3676, 3276, 2920, 2602, 2319,
+ 2067, 1842, 1642, 1463, 1304, 1162, 1036, 923,
+ 823, 733, 653, 582, 519, 462, 412, 367,
+ 327, 292, 260, 231, 206, 184, 164, 146,
+ 130, 116, 103, 92, 82, 73, 65, 58,
+ 51, 46, 41, 36, 32, 29, 26, 23,
+ 20, 18, 16, 14, 13, 11, 10, 9,
+ 8, 7, 6, 5, 5, 4, 4, 3,
+ 3, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,};
diff --git a/gst/spectrum/gstspectrum.c b/gst/spectrum/gstspectrum.c
index 920d69ee2..aa309f1cf 100644
--- a/gst/spectrum/gstspectrum.c
+++ b/gst/spectrum/gstspectrum.c
@@ -25,40 +25,44 @@
#include "gstspectrum.h"
/* elementfactory information */
-static GstElementDetails gst_spectrum_details = GST_ELEMENT_DETAILS (
- "Spectrum analyzer",
- "Filter/Analyzer/Audio",
- "Run an FFT on the audio signal, output spectrum data",
- "Erik Walthinsen <omega@cse.ogi.edu>"
-);
+static GstElementDetails gst_spectrum_details =
+GST_ELEMENT_DETAILS ("Spectrum analyzer",
+ "Filter/Analyzer/Audio",
+ "Run an FFT on the audio signal, output spectrum data",
+ "Erik Walthinsen <omega@cse.ogi.edu>");
/* Spectrum signals and args */
-enum {
+enum
+{
/* FILL ME */
LAST_SIGNAL
};
-enum {
+enum
+{
ARG_0,
ARG_WIDTH,
};
-static void gst_spectrum_base_init (gpointer g_class);
-static void gst_spectrum_class_init (GstSpectrumClass *klass);
-static void gst_spectrum_init (GstSpectrum *spectrum);
+static void gst_spectrum_base_init (gpointer g_class);
+static void gst_spectrum_class_init (GstSpectrumClass * klass);
+static void gst_spectrum_init (GstSpectrum * spectrum);
-static void gst_spectrum_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
+static void gst_spectrum_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec);
-static void gst_spectrum_chain (GstPad *pad, GstData *_data);
+static void gst_spectrum_chain (GstPad * pad, GstData * _data);
#define fixed short
-int gst_spectrum_fix_fft(fixed fr[], fixed fi[], int m, int inverse);
-void gst_spectrum_fix_loud(fixed loud[], fixed fr[], fixed fi[], int n, int scale_shift);
-void gst_spectrum_window(fixed fr[], int n);
+int gst_spectrum_fix_fft (fixed fr[], fixed fi[], int m, int inverse);
+void gst_spectrum_fix_loud (fixed loud[], fixed fr[], fixed fi[], int n,
+ int scale_shift);
+void gst_spectrum_window (fixed fr[], int n);
static GstElementClass *parent_class = NULL;
+
/*static guint gst_spectrum_signals[LAST_SIGNAL] = { 0 }; */
GType
@@ -68,17 +72,19 @@ gst_spectrum_get_type (void)
if (!spectrum_type) {
static const GTypeInfo spectrum_info = {
- sizeof(GstSpectrumClass),
+ sizeof (GstSpectrumClass),
gst_spectrum_base_init,
NULL,
- (GClassInitFunc)gst_spectrum_class_init,
+ (GClassInitFunc) gst_spectrum_class_init,
NULL,
NULL,
- sizeof(GstSpectrum),
+ sizeof (GstSpectrum),
0,
- (GInstanceInitFunc)gst_spectrum_init,
+ (GInstanceInitFunc) gst_spectrum_init,
};
- spectrum_type = g_type_register_static(GST_TYPE_ELEMENT, "GstSpectrum", &spectrum_info, 0);
+ spectrum_type =
+ g_type_register_static (GST_TYPE_ELEMENT, "GstSpectrum", &spectrum_info,
+ 0);
}
return spectrum_type;
}
@@ -91,41 +97,40 @@ gst_spectrum_base_init (gpointer g_class)
gst_element_class_set_details (element_class, &gst_spectrum_details);
}
static void
-gst_spectrum_class_init (GstSpectrumClass *klass)
+gst_spectrum_class_init (GstSpectrumClass * klass)
{
GObjectClass *gobject_class;
- gobject_class = (GObjectClass*)klass;
+ gobject_class = (GObjectClass *) klass;
- parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
+ parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
- g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_WIDTH,
- g_param_spec_int("width","width","width",
- G_MININT,G_MAXINT,0,G_PARAM_WRITABLE)); /* CHECKME */
+ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_WIDTH, g_param_spec_int ("width", "width", "width", G_MININT, G_MAXINT, 0, G_PARAM_WRITABLE)); /* CHECKME */
gobject_class->set_property = gst_spectrum_set_property;
}
static void
-gst_spectrum_init (GstSpectrum *spectrum)
+gst_spectrum_init (GstSpectrum * spectrum)
{
- spectrum->sinkpad = gst_pad_new("sink",GST_PAD_SINK);
- gst_element_add_pad(GST_ELEMENT(spectrum),spectrum->sinkpad);
- gst_pad_set_chain_function(spectrum->sinkpad,gst_spectrum_chain);
- spectrum->srcpad = gst_pad_new("src",GST_PAD_SRC);
- gst_element_add_pad(GST_ELEMENT(spectrum),spectrum->srcpad);
+ spectrum->sinkpad = gst_pad_new ("sink", GST_PAD_SINK);
+ gst_element_add_pad (GST_ELEMENT (spectrum), spectrum->sinkpad);
+ gst_pad_set_chain_function (spectrum->sinkpad, gst_spectrum_chain);
+ spectrum->srcpad = gst_pad_new ("src", GST_PAD_SRC);
+ gst_element_add_pad (GST_ELEMENT (spectrum), spectrum->srcpad);
spectrum->width = 75;
}
static void
-gst_spectrum_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
+gst_spectrum_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec)
{
GstSpectrum *spectrum;
/* it's not null if we got it, but it might not be ours */
- g_return_if_fail(GST_IS_SPECTRUM(object));
- spectrum = GST_SPECTRUM(object);
+ g_return_if_fail (GST_IS_SPECTRUM (object));
+ spectrum = GST_SPECTRUM (object);
switch (prop_id) {
case ARG_WIDTH:
@@ -137,48 +142,49 @@ gst_spectrum_set_property (GObject *object, guint prop_id, const GValue *value,
}
static void
-gst_spectrum_chain (GstPad *pad, GstData *_data)
+gst_spectrum_chain (GstPad * pad, GstData * _data)
{
GstBuffer *buf = GST_BUFFER (_data);
GstSpectrum *spectrum;
gint spec_base, spec_len;
gint16 *re, *im, *loud;
gint16 *samples;
- gint step,pos,i;
+ gint step, pos, i;
guchar *spect;
GstBuffer *newbuf;
- g_return_if_fail(pad != NULL);
- g_return_if_fail(GST_IS_PAD(pad));
- g_return_if_fail(buf != NULL);
+ g_return_if_fail (pad != NULL);
+ g_return_if_fail (GST_IS_PAD (pad));
+ g_return_if_fail (buf != NULL);
spectrum = GST_SPECTRUM (GST_OBJECT_PARENT (pad));
- samples = (gint16 *)GST_BUFFER_DATA(buf);
+ samples = (gint16 *) GST_BUFFER_DATA (buf);
spec_base = 8;
spec_len = 1024;
- im = g_malloc(spec_len * sizeof(gint16));
- g_return_if_fail(im != NULL);
- loud = g_malloc(spec_len * sizeof(gint16));
- g_return_if_fail(loud != NULL);
+ im = g_malloc (spec_len * sizeof (gint16));
+ g_return_if_fail (im != NULL);
+ loud = g_malloc (spec_len * sizeof (gint16));
+ g_return_if_fail (loud != NULL);
- memset(im,0,spec_len * sizeof(gint16));
+ memset (im, 0, spec_len * sizeof (gint16));
/*if (spectrum->meta->channels == 2) { */
- re = g_malloc(spec_len * sizeof(gint16));
- for (i=0;i<spec_len;i++)
- re[i] = (samples[(i*2)] + samples[(i*2)+1]) >> 1;
+ re = g_malloc (spec_len * sizeof (gint16));
+ for (i = 0; i < spec_len; i++)
+ re[i] = (samples[(i * 2)] + samples[(i * 2) + 1]) >> 1;
/*} else */
/* re = samples; */
- gst_spectrum_window(re,spec_len);
- gst_spectrum_fix_fft(re,im,spec_base,FALSE);
- gst_spectrum_fix_loud(loud,re,im,spec_len,0);
- if (re != samples) g_free(re);
- g_free(im);
- step = spec_len / (spectrum->width*2);
- spect = (guchar *)g_malloc(spectrum->width);
- for (i=0,pos=0;i<spectrum->width;i++,pos += step) {
+ gst_spectrum_window (re, spec_len);
+ gst_spectrum_fix_fft (re, im, spec_base, FALSE);
+ gst_spectrum_fix_loud (loud, re, im, spec_len, 0);
+ if (re != samples)
+ g_free (re);
+ g_free (im);
+ step = spec_len / (spectrum->width * 2);
+ spect = (guchar *) g_malloc (spectrum->width);
+ for (i = 0, pos = 0; i < spectrum->width; i++, pos += step) {
if (loud[pos] > -60)
spect[i] = (loud[pos] + 60) / 2;
else
@@ -186,32 +192,27 @@ gst_spectrum_chain (GstPad *pad, GstData *_data)
/* if (spect[i] > 15); */
/* spect[i] = 15; */
}
- g_free(loud);
- gst_buffer_unref(buf);
+ g_free (loud);
+ gst_buffer_unref (buf);
/* g_free(samples); */
- newbuf = gst_buffer_new();
- g_return_if_fail(newbuf != NULL);
- GST_BUFFER_DATA(newbuf) = spect;
- GST_BUFFER_SIZE(newbuf) = spectrum->width;
+ newbuf = gst_buffer_new ();
+ g_return_if_fail (newbuf != NULL);
+ GST_BUFFER_DATA (newbuf) = spect;
+ GST_BUFFER_SIZE (newbuf) = spectrum->width;
- gst_pad_push(spectrum->srcpad,GST_DATA (newbuf));
+ gst_pad_push (spectrum->srcpad, GST_DATA (newbuf));
}
static gboolean
-plugin_init (GstPlugin *plugin)
+plugin_init (GstPlugin * plugin)
{
- return gst_element_register (plugin, "spectrum", GST_RANK_NONE, GST_TYPE_SPECTRUM);
+ return gst_element_register (plugin, "spectrum", GST_RANK_NONE,
+ GST_TYPE_SPECTRUM);
}
-GST_PLUGIN_DEFINE (
- GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "spectrum",
- "Run an FFT on the audio signal, output spectrum data",
- plugin_init,
- VERSION,
- GST_LICENSE,
- GST_PACKAGE,
- GST_ORIGIN
-)
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ "spectrum",
+ "Run an FFT on the audio signal, output spectrum data",
+ plugin_init, VERSION, GST_LICENSE, GST_PACKAGE, GST_ORIGIN)
diff --git a/gst/spectrum/gstspectrum.h b/gst/spectrum/gstspectrum.h
index 8cc546eca..23c4ef4b7 100644
--- a/gst/spectrum/gstspectrum.h
+++ b/gst/spectrum/gstspectrum.h
@@ -26,8 +26,9 @@
#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
+extern "C"
+{
+#endif /* __cplusplus */
#define GST_TYPE_SPECTRUM \
@@ -41,27 +42,29 @@ extern "C" {
#define GST_IS_SPECTRUM_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SPECTRUM))
-typedef struct _GstSpectrum GstSpectrum;
-typedef struct _GstSpectrumClass GstSpectrumClass;
+ typedef struct _GstSpectrum GstSpectrum;
+ typedef struct _GstSpectrumClass GstSpectrumClass;
-struct _GstSpectrum {
- GstElement element;
+ struct _GstSpectrum
+ {
+ GstElement element;
- GstPad *sinkpad,*srcpad;
+ GstPad *sinkpad, *srcpad;
- gint width;
-};
+ gint width;
+ };
-struct _GstSpectrumClass {
- GstElementClass parent_class;
-};
+ struct _GstSpectrumClass
+ {
+ GstElementClass parent_class;
+ };
-GType gst_spectrum_get_type(void);
+ GType gst_spectrum_get_type (void);
#ifdef __cplusplus
}
-#endif /* __cplusplus */
+#endif /* __cplusplus */
-#endif /* __GST_SPECTRUM_H__ */
+#endif /* __GST_SPECTRUM_H__ */
diff --git a/gst/speed/demo-mp3.c b/gst/speed/demo-mp3.c
index 1f99c7e1a..5b83347a1 100644
--- a/gst/speed/demo-mp3.c
+++ b/gst/speed/demo-mp3.c
@@ -22,62 +22,66 @@
#include <gtk/gtk.h>
#include <gst/gst.h>
-void set_speed (GtkAdjustment *adj, gpointer data)
+void
+set_speed (GtkAdjustment * adj, gpointer data)
{
- GstElement *speed = GST_ELEMENT(data);
- g_object_set (speed, "speed", adj->value, NULL);
+ GstElement *speed = GST_ELEMENT (data);
+
+ g_object_set (speed, "speed", adj->value, NULL);
}
-int main(int argc, char **argv)
+int
+main (int argc, char **argv)
{
- GtkWidget *window, *vbox, *hscale, *button;
- GstElement *filesrc, *mad, *stereo2mono, *speed, *osssink, *pipeline;
-
- gst_init (&argc, &argv);
- gtk_init (&argc, &argv);
-
- if (argc!=2) {
- g_print("usage: %s <your.mp3>\n", argv[0]);
- exit(-1);
- }
-
- window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
- gtk_window_set_default_size(GTK_WINDOW(window), 400, 80);
- vbox = gtk_vbox_new(FALSE, 0);
- gtk_widget_show(vbox);
- hscale = gtk_hscale_new(GTK_ADJUSTMENT(gtk_adjustment_new(1.0, 0.01, 4.0,
- 0.1, 0.0, 0.0)));
- gtk_scale_set_digits(GTK_SCALE(hscale), 2);
- gtk_range_set_update_policy(GTK_RANGE(hscale), GTK_UPDATE_CONTINUOUS);
- button = gtk_button_new_with_label("quit");
- gtk_container_add(GTK_CONTAINER(window), vbox);
- gtk_box_pack_start(GTK_BOX(vbox), hscale, TRUE, TRUE, 2);
- gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 2);
- gtk_widget_show(hscale);
- gtk_signal_connect(GTK_OBJECT(button), "clicked", gtk_main_quit, NULL);
- gtk_widget_show(button);
-
- filesrc = gst_element_factory_make("filesrc", "filesrc");
- mad = gst_element_factory_make("mad", "mad");
- stereo2mono = gst_element_factory_make("stereo2mono", "stereo2mono");
- speed = gst_element_factory_make("speed", "speed");
- osssink = gst_element_factory_make("osssink", "osssink");
- g_object_set(osssink, "fragment", 0x00180008, NULL);
-
- gtk_signal_connect(GTK_OBJECT(gtk_range_get_adjustment(GTK_RANGE(hscale))),
- "value_changed", G_CALLBACK (set_speed), speed);
-
- pipeline = gst_pipeline_new("app");
- gst_bin_add_many (GST_BIN(pipeline), filesrc, mad, stereo2mono, speed, osssink, NULL);
- gst_element_link_many (filesrc, mad, stereo2mono, speed, osssink, NULL);
- g_object_set(G_OBJECT(filesrc), "location", argv[1], NULL);
-
- gst_element_set_state(pipeline, GST_STATE_PLAYING);
-
- gtk_widget_show(window);
- gtk_idle_add((GtkFunction)gst_bin_iterate, pipeline);
-
- gtk_main();
-
- return 0;
+ GtkWidget *window, *vbox, *hscale, *button;
+ GstElement *filesrc, *mad, *stereo2mono, *speed, *osssink, *pipeline;
+
+ gst_init (&argc, &argv);
+ gtk_init (&argc, &argv);
+
+ if (argc != 2) {
+ g_print ("usage: %s <your.mp3>\n", argv[0]);
+ exit (-1);
+ }
+
+ window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+ gtk_window_set_default_size (GTK_WINDOW (window), 400, 80);
+ vbox = gtk_vbox_new (FALSE, 0);
+ gtk_widget_show (vbox);
+ hscale = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (1.0, 0.01, 4.0,
+ 0.1, 0.0, 0.0)));
+ gtk_scale_set_digits (GTK_SCALE (hscale), 2);
+ gtk_range_set_update_policy (GTK_RANGE (hscale), GTK_UPDATE_CONTINUOUS);
+ button = gtk_button_new_with_label ("quit");
+ gtk_container_add (GTK_CONTAINER (window), vbox);
+ gtk_box_pack_start (GTK_BOX (vbox), hscale, TRUE, TRUE, 2);
+ gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 2);
+ gtk_widget_show (hscale);
+ gtk_signal_connect (GTK_OBJECT (button), "clicked", gtk_main_quit, NULL);
+ gtk_widget_show (button);
+
+ filesrc = gst_element_factory_make ("filesrc", "filesrc");
+ mad = gst_element_factory_make ("mad", "mad");
+ stereo2mono = gst_element_factory_make ("stereo2mono", "stereo2mono");
+ speed = gst_element_factory_make ("speed", "speed");
+ osssink = gst_element_factory_make ("osssink", "osssink");
+ g_object_set (osssink, "fragment", 0x00180008, NULL);
+
+ gtk_signal_connect (GTK_OBJECT (gtk_range_get_adjustment (GTK_RANGE
+ (hscale))), "value_changed", G_CALLBACK (set_speed), speed);
+
+ pipeline = gst_pipeline_new ("app");
+ gst_bin_add_many (GST_BIN (pipeline), filesrc, mad, stereo2mono, speed,
+ osssink, NULL);
+ gst_element_link_many (filesrc, mad, stereo2mono, speed, osssink, NULL);
+ g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL);
+
+ gst_element_set_state (pipeline, GST_STATE_PLAYING);
+
+ gtk_widget_show (window);
+ gtk_idle_add ((GtkFunction) gst_bin_iterate, pipeline);
+
+ gtk_main ();
+
+ return 0;
}
diff --git a/gst/speed/gstspeed.c b/gst/speed/gstspeed.c
index 89b4edfb6..12752f12c 100644
--- a/gst/speed/gstspeed.c
+++ b/gst/speed/gstspeed.c
@@ -36,63 +36,60 @@
#define SPEED_NUMBUF 6
/* elementfactory information */
-static GstElementDetails speed_details = GST_ELEMENT_DETAILS (
- "Speed",
- "Filter/Effect/Audio",
- "Set speed/pitch on audio/raw streams (resampler)",
- "Andy Wingo <apwingo@eos.ncsu.edu>"
-);
+static GstElementDetails speed_details = GST_ELEMENT_DETAILS ("Speed",
+ "Filter/Effect/Audio",
+ "Set speed/pitch on audio/raw streams (resampler)",
+ "Andy Wingo <apwingo@eos.ncsu.edu>");
/* Filter signals and args */
-enum {
+enum
+{
/* FILL ME */
LAST_SIGNAL
};
-enum {
+enum
+{
ARG_0,
ARG_SPEED
};
static GstStaticPadTemplate gst_speed_sink_template =
-GST_STATIC_PAD_TEMPLATE (
- "sink",
+ GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_STATIC_CAPS (
- GST_AUDIO_INT_PAD_TEMPLATE_CAPS "; "
- GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS
- )
-);
+ GST_STATIC_CAPS (GST_AUDIO_INT_PAD_TEMPLATE_CAPS "; "
+ GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS)
+ );
static GstStaticPadTemplate gst_speed_src_template =
-GST_STATIC_PAD_TEMPLATE (
- "src",
+ GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_STATIC_CAPS (
- GST_AUDIO_INT_PAD_TEMPLATE_CAPS "; "
- GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS
- )
-);
+ GST_STATIC_CAPS (GST_AUDIO_INT_PAD_TEMPLATE_CAPS "; "
+ GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS)
+ );
-static void speed_base_init (gpointer g_class);
-static void speed_class_init (GstSpeedClass *klass);
-static void speed_init (GstSpeed *filter);
+static void speed_base_init (gpointer g_class);
+static void speed_class_init (GstSpeedClass * klass);
+static void speed_init (GstSpeed * filter);
-static void speed_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
-static void speed_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
+static void speed_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec);
+static void speed_get_property (GObject * object, guint prop_id, GValue * value,
+ GParamSpec * pspec);
-static gboolean speed_parse_caps (GstSpeed *filter, const GstCaps *caps);
+static gboolean speed_parse_caps (GstSpeed * filter, const GstCaps * caps);
-static void speed_loop (GstElement *element);
+static void speed_loop (GstElement * element);
static GstElementClass *parent_class = NULL;
+
/*static guint gst_filter_signals[LAST_SIGNAL] = { 0 }; */
static GstPadLinkReturn
-speed_link (GstPad *pad, const GstCaps *caps)
+speed_link (GstPad * pad, const GstCaps * caps)
{
GstSpeed *filter;
GstPad *otherpad;
@@ -102,20 +99,21 @@ speed_link (GstPad *pad, const GstCaps *caps)
g_return_val_if_fail (GST_IS_SPEED (filter), GST_PAD_LINK_REFUSED);
otherpad = (pad == filter->srcpad ? filter->sinkpad : filter->srcpad);
- if (! speed_parse_caps (filter, caps)) return GST_PAD_LINK_REFUSED;
+ if (!speed_parse_caps (filter, caps))
+ return GST_PAD_LINK_REFUSED;
- return gst_pad_try_set_caps(otherpad, caps);
+ return gst_pad_try_set_caps (otherpad, caps);
}
static gboolean
-speed_parse_caps (GstSpeed *filter, const GstCaps *caps)
+speed_parse_caps (GstSpeed * filter, const GstCaps * caps)
{
const gchar *mimetype;
GstStructure *structure;
gboolean ret;
- g_return_val_if_fail(filter != NULL, FALSE);
- g_return_val_if_fail(caps != NULL, FALSE);
+ g_return_val_if_fail (filter != NULL, FALSE);
+ g_return_val_if_fail (caps != NULL, FALSE);
structure = gst_caps_get_structure (caps, 0);
@@ -123,17 +121,19 @@ speed_parse_caps (GstSpeed *filter, const GstCaps *caps)
ret &= gst_structure_get_int (structure, "channels", &filter->channels);
ret &= gst_structure_get_int (structure, "width", &filter->width);
ret &= gst_structure_get_int (structure, "endianness", &filter->endianness);
- ret &= gst_structure_get_int (structure, "buffer-frames", &filter->buffer_frames);
+ ret &=
+ gst_structure_get_int (structure, "buffer-frames",
+ &filter->buffer_frames);
mimetype = gst_structure_get_name (structure);
- if (strcmp(mimetype, "audio/x-raw-int") == 0) {
+ if (strcmp (mimetype, "audio/x-raw-int") == 0) {
filter->format = GST_SPEED_FORMAT_INT;
ret &= gst_structure_get_int (structure, "depth", &filter->depth);
ret &= gst_structure_get_boolean (structure, "signed", &filter->is_signed);
- } else if (strcmp(mimetype, "audio/x-raw-float") == 0) {
+ } else if (strcmp (mimetype, "audio/x-raw-float") == 0) {
filter->format = GST_SPEED_FORMAT_FLOAT;
- } else {
+ } else {
return FALSE;
}
return ret;
@@ -141,22 +141,24 @@ speed_parse_caps (GstSpeed *filter, const GstCaps *caps)
GType
-gst_speed_get_type(void) {
+gst_speed_get_type (void)
+{
static GType speed_type = 0;
if (!speed_type) {
static const GTypeInfo speed_info = {
- sizeof(GstSpeedClass),
+ sizeof (GstSpeedClass),
speed_base_init,
NULL,
- (GClassInitFunc)speed_class_init,
+ (GClassInitFunc) speed_class_init,
NULL,
NULL,
- sizeof(GstSpeed),
+ sizeof (GstSpeed),
0,
- (GInstanceInitFunc)speed_init,
+ (GInstanceInitFunc) speed_init,
};
- speed_type = g_type_register_static(GST_TYPE_ELEMENT, "GstSpeed", &speed_info, 0);
+ speed_type =
+ g_type_register_static (GST_TYPE_ELEMENT, "GstSpeed", &speed_info, 0);
}
return speed_type;
}
@@ -174,51 +176,53 @@ speed_base_init (gpointer g_class)
gst_static_pad_template_get (&gst_speed_sink_template));
}
static void
-speed_class_init (GstSpeedClass *klass)
+speed_class_init (GstSpeedClass * klass)
{
- GObjectClass *gobject_class = (GObjectClass*)klass;
+ GObjectClass *gobject_class = (GObjectClass *) klass;
gobject_class->set_property = speed_set_property;
gobject_class->get_property = speed_get_property;
- parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
+ parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
- g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_SPEED,
- g_param_spec_float("speed","speed","speed",
- 0.1,40.0,1.0,G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SPEED,
+ g_param_spec_float ("speed", "speed", "speed",
+ 0.1, 40.0, 1.0, G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
}
static void
-speed_init (GstSpeed *filter)
+speed_init (GstSpeed * filter)
{
- filter->sinkpad = gst_pad_new_from_template(
- gst_static_pad_template_get (&gst_speed_sink_template), "sink");
- gst_pad_set_link_function(filter->sinkpad, speed_link);
- gst_element_add_pad(GST_ELEMENT(filter),filter->sinkpad);
-
- filter->srcpad = gst_pad_new_from_template(
- gst_static_pad_template_get (&gst_speed_src_template), "src");
- gst_pad_set_link_function(filter->srcpad, speed_link);
- gst_element_add_pad(GST_ELEMENT(filter),filter->srcpad);
-
- gst_element_set_loop_function(GST_ELEMENT(filter),speed_loop);
+ filter->sinkpad =
+ gst_pad_new_from_template (gst_static_pad_template_get
+ (&gst_speed_sink_template), "sink");
+ gst_pad_set_link_function (filter->sinkpad, speed_link);
+ gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
+
+ filter->srcpad =
+ gst_pad_new_from_template (gst_static_pad_template_get
+ (&gst_speed_src_template), "src");
+ gst_pad_set_link_function (filter->srcpad, speed_link);
+ gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);
+
+ gst_element_set_loop_function (GST_ELEMENT (filter), speed_loop);
}
static void
-speed_loop (GstElement *element)
+speed_loop (GstElement * element)
{
- GstSpeed *filter = GST_SPEED(element);
+ GstSpeed *filter = GST_SPEED (element);
GstBuffer *in, *out;
guint i, j, nin, nout;
gfloat interp, speed, lower, i_float;
- g_return_if_fail(filter != NULL);
- g_return_if_fail(GST_IS_SPEED(filter));
+ g_return_if_fail (filter != NULL);
+ g_return_if_fail (GST_IS_SPEED (filter));
i = j = 0;
speed = filter->speed;
-
- in = GST_BUFFER (gst_pad_pull(filter->sinkpad));
+
+ in = GST_BUFFER (gst_pad_pull (filter->sinkpad));
if (GST_IS_EVENT (in)) {
gst_pad_event_default (filter->sinkpad, GST_EVENT (in));
@@ -232,36 +236,36 @@ speed_loop (GstElement *element)
/* this is a bit nasty, but hey, it's what you've got to do to keep the same
* algorithm and multiple data types in c. */
- if (filter->format==GST_SPEED_FORMAT_FLOAT) {
+ if (filter->format == GST_SPEED_FORMAT_FLOAT) {
#define _FORMAT gfloat
#include "filter.func"
#undef _FORMAT
- } else if (filter->format==GST_SPEED_FORMAT_INT && filter->width==16) {
+ } else if (filter->format == GST_SPEED_FORMAT_INT && filter->width == 16) {
#define _FORMAT gint16
#include "filter.func"
#undef _FORMAT
- } else if (filter->format==GST_SPEED_FORMAT_INT && filter->width==8) {
+ } else if (filter->format == GST_SPEED_FORMAT_INT && filter->width == 8) {
#define _FORMAT gint8
#include "filter.func"
#undef _FORMAT
} else {
- GST_ELEMENT_ERROR (filter, CORE, NEGOTIATION, (NULL),
- ("format wasn't negotiated before chain function"));
+ GST_ELEMENT_ERROR (filter, CORE, NEGOTIATION, (NULL),
+ ("format wasn't negotiated before chain function"));
gst_element_yield (element);
}
}
static void
-speed_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
+speed_set_property (GObject * object, guint prop_id, const GValue * value,
+ GParamSpec * pspec)
{
GstSpeed *filter;
/* it's not null if we got it, but it might not be ours */
- g_return_if_fail(GST_IS_SPEED(object));
- filter = GST_SPEED(object);
+ g_return_if_fail (GST_IS_SPEED (object));
+ filter = GST_SPEED (object);
- switch (prop_id)
- {
+ switch (prop_id) {
case ARG_SPEED:
filter->speed = g_value_get_float (value);
break;
@@ -271,13 +275,14 @@ speed_set_property (GObject *object, guint prop_id, const GValue *value, GParamS
}
static void
-speed_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+speed_get_property (GObject * object, guint prop_id, GValue * value,
+ GParamSpec * pspec)
{
GstSpeed *filter;
/* it's not null if we got it, but it might not be ours */
- g_return_if_fail(GST_IS_SPEED(object));
- filter = GST_SPEED(object);
+ g_return_if_fail (GST_IS_SPEED (object));
+ filter = GST_SPEED (object);
switch (prop_id) {
case ARG_SPEED:
@@ -290,19 +295,13 @@ speed_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *p
}
static gboolean
-plugin_init (GstPlugin *plugin)
+plugin_init (GstPlugin * plugin)
{
- return gst_element_register(plugin, "speed", GST_RANK_NONE, GST_TYPE_SPEED);
+ return gst_element_register (plugin, "speed", GST_RANK_NONE, GST_TYPE_SPEED);
}
-GST_PLUGIN_DEFINE (
- GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "speed",
- "Set speed/pitch on audio/raw streams (resampler)",
- plugin_init,
- VERSION,
- GST_LICENSE,
- GST_PACKAGE,
- GST_ORIGIN
-)
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ "speed",
+ "Set speed/pitch on audio/raw streams (resampler)",
+ plugin_init, VERSION, GST_LICENSE, GST_PACKAGE, GST_ORIGIN)
diff --git a/gst/speed/gstspeed.h b/gst/speed/gstspeed.h
index 2bbb0e6c7..d86d1fcec 100644
--- a/gst/speed/gstspeed.h
+++ b/gst/speed/gstspeed.h
@@ -25,7 +25,6 @@
#include <gst/gst.h>
G_BEGIN_DECLS
-
#define GST_TYPE_SPEED \
(gst_speed_get_type())
#define GST_SPEED(obj) \
@@ -36,17 +35,18 @@ G_BEGIN_DECLS
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_SPEED))
#define GST_IS_SPEED_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SPEED))
-
typedef struct _GstSpeed GstSpeed;
typedef struct _GstSpeedClass GstSpeedClass;
typedef enum _GstSpeedFormat GstSpeedFormat;
-enum _GstSpeedFormat {
+enum _GstSpeedFormat
+{
GST_SPEED_FORMAT_INT,
GST_SPEED_FORMAT_FLOAT
};
-struct _GstSpeed {
+struct _GstSpeed
+{
GstElement element;
GstPad *sinkpad, *srcpad;
@@ -66,12 +66,12 @@ struct _GstSpeed {
gboolean is_signed;
};
-struct _GstSpeedClass {
+struct _GstSpeedClass
+{
GstElementClass parent_class;
};
-GType gst_speed_get_type(void);
+GType gst_speed_get_type (void);
G_END_DECLS
-
#endif /* __GST_SPEED_H__ */
diff --git a/gst/stereo/gststereo.c b/gst/stereo/gststereo.c
index f2e9a79d4..947c3885c 100644
--- a/gst/stereo/gststereo.c
+++ b/gst/stereo/gststereo.c
@@ -28,56 +28,61 @@
#include <gststereo.h>
/* elementfactory information */
-static GstElementDetails stereo_details = GST_ELEMENT_DETAILS (
- "Stereo effect",
- "Filter/Effect/Audio",
- "Muck with the stereo signal to enhance its 'stereo-ness'",
- "Erik Walthinsen <omega@cse.ogi.edu>"
-);
+static GstElementDetails stereo_details = GST_ELEMENT_DETAILS ("Stereo effect",
+ "Filter/Effect/Audio",
+ "Muck with the stereo signal to enhance its 'stereo-ness'",
+ "Erik Walthinsen <omega@cse.ogi.edu>");
/* Stereo signals and args */
-enum {
+enum
+{
/* FILL ME */
LAST_SIGNAL
};
-enum {
+enum
+{
ARG_0,
ARG_ACTIVE,
ARG_STEREO
};
-static void gst_stereo_base_init (gpointer g_class);
-static void gst_stereo_class_init (GstStereoClass *klass);
-static void gst_stereo_init (GstStereo *stereo);
+static void gst_stereo_base_init (gpointer g_class);
+static void gst_stereo_class_init (GstStereoClass * klass);
+static void gst_stereo_init (GstStereo * stereo);
-static void gst_stereo_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
-static void gst_stereo_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
+static void gst_stereo_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec);
+static void gst_stereo_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec);
-static void gst_stereo_chain (GstPad *pad, GstData *_data);
+static void gst_stereo_chain (GstPad * pad, GstData * _data);
static GstElementClass *parent_class = NULL;
+
/*static guint gst_stereo_signals[LAST_SIGNAL] = { 0 }; */
GType
-gst_stereo_get_type(void) {
+gst_stereo_get_type (void)
+{
static GType stereo_type = 0;
if (!stereo_type) {
static const GTypeInfo stereo_info = {
- sizeof(GstStereoClass),
+ sizeof (GstStereoClass),
gst_stereo_base_init,
NULL,
- (GClassInitFunc)gst_stereo_class_init,
+ (GClassInitFunc) gst_stereo_class_init,
NULL,
NULL,
- sizeof(GstStereo),
+ sizeof (GstStereo),
0,
- (GInstanceInitFunc)gst_stereo_init,
+ (GInstanceInitFunc) gst_stereo_init,
};
- stereo_type = g_type_register_static(GST_TYPE_ELEMENT, "GstStereo", &stereo_info, 0);
+ stereo_type =
+ g_type_register_static (GST_TYPE_ELEMENT, "GstStereo", &stereo_info, 0);
}
return stereo_type;
}
@@ -86,60 +91,57 @@ static void
gst_stereo_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
+
gst_element_class_set_details (element_class, &stereo_details);
}
static void
-gst_stereo_class_init (GstStereoClass *klass)
+gst_stereo_class_init (GstStereoClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
- gobject_class = (GObjectClass*)klass;
- gstelement_class = (GstElementClass*)klass;
+ gobject_class = (GObjectClass *) klass;
+ gstelement_class = (GstElementClass *) klass;
- parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
+ parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
- g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_ACTIVE,
- g_param_spec_int("active","active","active",
- G_MININT,G_MAXINT,0,G_PARAM_READWRITE)); /* CHECKME */
- g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_STEREO,
- g_param_spec_float("stereo","stereo","stereo",
- 0.0,1.0,0.0,G_PARAM_READWRITE)); /* CHECKME */
+ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_ACTIVE, g_param_spec_int ("active", "active", "active", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */
+ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_STEREO, g_param_spec_float ("stereo", "stereo", "stereo", 0.0, 1.0, 0.0, G_PARAM_READWRITE)); /* CHECKME */
gobject_class->set_property = gst_stereo_set_property;
gobject_class->get_property = gst_stereo_get_property;
}
static void
-gst_stereo_init (GstStereo *stereo)
+gst_stereo_init (GstStereo * stereo)
{
- stereo->sinkpad = gst_pad_new("sink",GST_PAD_SINK);
- gst_element_add_pad(GST_ELEMENT(stereo),stereo->sinkpad);
- gst_pad_set_chain_function(stereo->sinkpad,gst_stereo_chain);
- stereo->srcpad = gst_pad_new("src",GST_PAD_SRC);
- gst_element_add_pad(GST_ELEMENT(stereo),stereo->srcpad);
+ stereo->sinkpad = gst_pad_new ("sink", GST_PAD_SINK);
+ gst_element_add_pad (GST_ELEMENT (stereo), stereo->sinkpad);
+ gst_pad_set_chain_function (stereo->sinkpad, gst_stereo_chain);
+ stereo->srcpad = gst_pad_new ("src", GST_PAD_SRC);
+ gst_element_add_pad (GST_ELEMENT (stereo), stereo->srcpad);
stereo->active = FALSE;
stereo->stereo = 2.5;
}
static void
-gst_stereo_chain (GstPad *pad,GstData *_data)
+gst_stereo_chain (GstPad * pad, GstData * _data)
{
GstBuffer *buf = GST_BUFFER (_data);
GstStereo *stereo;
gint16 *data;
gint samples;
gint i;
- gdouble avg,ldiff,rdiff,tmp,mul;
+ gdouble avg, ldiff, rdiff, tmp, mul;
- g_return_if_fail(pad != NULL);
- g_return_if_fail(GST_IS_PAD(pad));
- g_return_if_fail(buf != NULL);
+ g_return_if_fail (pad != NULL);
+ g_return_if_fail (GST_IS_PAD (pad));
+ g_return_if_fail (buf != NULL);
- stereo = GST_STEREO(GST_OBJECT_PARENT (pad));
- g_return_if_fail(stereo != NULL);
- g_return_if_fail(GST_IS_STEREO(stereo));
+ stereo = GST_STEREO (GST_OBJECT_PARENT (pad));
+ g_return_if_fail (stereo != NULL);
+ g_return_if_fail (GST_IS_STEREO (stereo));
/* FIXME */
/* if (buf->meta) */
@@ -148,42 +150,43 @@ gst_stereo_chain (GstPad *pad,GstData *_data)
if (stereo->active) {
/*if (stereo->meta.channels == 2 && stereo->meta.format == AFMT_S16_LE) { */
- data = (gint16 *)GST_BUFFER_DATA(buf);
- samples = GST_BUFFER_SIZE(buf) / 2;
- mul = stereo->stereo;
- for (i = 0; i < samples / 2; i += 2) {
- avg = (data[i] + data[i + 1]) / 2;
- ldiff = data[i] - avg;
- rdiff = data[i + 1] - avg;
-
- tmp = avg + ldiff * mul;
- if (tmp < -32768)
- tmp = -32768;
- if (tmp > 32767)
- tmp = 32767;
- data[i] = tmp;
-
- tmp = avg + rdiff * mul;
- if (tmp < -32768)
- tmp = -32768;
- if (tmp > 32767)
- tmp = 32767;
- data[i + 1] = tmp;
- }
+ data = (gint16 *) GST_BUFFER_DATA (buf);
+ samples = GST_BUFFER_SIZE (buf) / 2;
+ mul = stereo->stereo;
+ for (i = 0; i < samples / 2; i += 2) {
+ avg = (data[i] + data[i + 1]) / 2;
+ ldiff = data[i] - avg;
+ rdiff = data[i + 1] - avg;
+
+ tmp = avg + ldiff * mul;
+ if (tmp < -32768)
+ tmp = -32768;
+ if (tmp > 32767)
+ tmp = 32767;
+ data[i] = tmp;
+
+ tmp = avg + rdiff * mul;
+ if (tmp < -32768)
+ tmp = -32768;
+ if (tmp > 32767)
+ tmp = 32767;
+ data[i + 1] = tmp;
+ }
/*} */
}
- gst_pad_push(stereo->srcpad,GST_DATA (buf));
+ gst_pad_push (stereo->srcpad, GST_DATA (buf));
}
static void
-gst_stereo_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
+gst_stereo_set_property (GObject * object, guint prop_id, const GValue * value,
+ GParamSpec * pspec)
{
GstStereo *stereo;
/* it's not null if we got it, but it might not be ours */
- g_return_if_fail(GST_IS_STEREO(object));
- stereo = GST_STEREO(object);
+ g_return_if_fail (GST_IS_STEREO (object));
+ stereo = GST_STEREO (object);
switch (prop_id) {
case ARG_ACTIVE:
@@ -198,13 +201,14 @@ gst_stereo_set_property (GObject *object, guint prop_id, const GValue *value, GP
}
static void
-gst_stereo_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+gst_stereo_get_property (GObject * object, guint prop_id, GValue * value,
+ GParamSpec * pspec)
{
GstStereo *stereo;
/* it's not null if we got it, but it might not be ours */
- g_return_if_fail(GST_IS_STEREO(object));
- stereo = GST_STEREO(object);
+ g_return_if_fail (GST_IS_STEREO (object));
+ stereo = GST_STEREO (object);
switch (prop_id) {
case ARG_ACTIVE:
@@ -220,20 +224,14 @@ gst_stereo_get_property (GObject *object, guint prop_id, GValue *value, GParamSp
}
static gboolean
-plugin_init (GstPlugin *plugin)
+plugin_init (GstPlugin * plugin)
{
- return gst_element_register (plugin, "stereo", GST_RANK_NONE, GST_TYPE_STEREO);
+ return gst_element_register (plugin, "stereo", GST_RANK_NONE,
+ GST_TYPE_STEREO);
}
-GST_PLUGIN_DEFINE (
- GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "stereo",
- "Muck with the stereo signal, enhance it's 'stereo-ness'",
- plugin_init,
- VERSION,
- GST_LICENSE,
- GST_PACKAGE,
- GST_ORIGIN
-)
-
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ "stereo",
+ "Muck with the stereo signal, enhance it's 'stereo-ness'",
+ plugin_init, VERSION, GST_LICENSE, GST_PACKAGE, GST_ORIGIN)
diff --git a/gst/stereo/gststereo.h b/gst/stereo/gststereo.h
index 8b78f25eb..b665432b2 100644
--- a/gst/stereo/gststereo.h
+++ b/gst/stereo/gststereo.h
@@ -26,8 +26,9 @@
#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
+extern "C"
+{
+#endif /* __cplusplus */
#define GST_TYPE_STEREO \
@@ -41,27 +42,29 @@ extern "C" {
#define GST_IS_STEREO_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_STEREO))
-typedef struct _GstStereo GstStereo;
-typedef struct _GstStereoClass GstStereoClass;
+ typedef struct _GstStereo GstStereo;
+ typedef struct _GstStereoClass GstStereoClass;
-struct _GstStereo {
- GstElement element;
+ struct _GstStereo
+ {
+ GstElement element;
- GstPad *sinkpad,*srcpad;
+ GstPad *sinkpad, *srcpad;
- gint8 active;
- gfloat stereo;
-};
+ gint8 active;
+ gfloat stereo;
+ };
-struct _GstStereoClass {
- GstElementClass parent_class;
-};
+ struct _GstStereoClass
+ {
+ GstElementClass parent_class;
+ };
-GType gst_stereo_get_type(void);
+ GType gst_stereo_get_type (void);
#ifdef __cplusplus
}
-#endif /* __cplusplus */
+#endif /* __cplusplus */
-#endif /* __GST_STEREO_H__ */
+#endif /* __GST_STEREO_H__ */
diff --git a/gst/switch/gstswitch.c b/gst/switch/gstswitch.c
index e57508bcb..995bbdbe0 100644
--- a/gst/switch/gstswitch.c
+++ b/gst/switch/gstswitch.c
@@ -16,7 +16,7 @@
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
-
+
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
@@ -24,7 +24,8 @@
/* Object header */
#include "gstswitch.h"
-enum {
+enum
+{
ARG_0,
ARG_NB_SOURCES,
ARG_ACTIVE_SOURCE
@@ -34,20 +35,16 @@ GST_DEBUG_CATEGORY_EXTERN (GST_CAT_ELEMENT_PADS);
GST_DEBUG_CATEGORY_EXTERN (GST_CAT_DATAFLOW);
/* ElementFactory information */
-static GstElementDetails gst_switch_details = GST_ELEMENT_DETAILS (
- "Switch",
- "Generic",
- "N-to-1 input switching",
- "Julien Moutte <julien@moutte.net>"
-);
+static GstElementDetails gst_switch_details = GST_ELEMENT_DETAILS ("Switch",
+ "Generic",
+ "N-to-1 input switching",
+ "Julien Moutte <julien@moutte.net>");
static GstStaticPadTemplate gst_switch_sink_factory =
-GST_STATIC_PAD_TEMPLATE (
- "sink%d",
- GST_PAD_SINK,
- GST_PAD_REQUEST,
- GST_STATIC_CAPS_ANY
-);
+GST_STATIC_PAD_TEMPLATE ("sink%d",
+ GST_PAD_SINK,
+ GST_PAD_REQUEST,
+ GST_STATIC_CAPS_ANY);
static GstElementClass *parent_class = NULL;
@@ -58,33 +55,33 @@ static GstElementClass *parent_class = NULL;
/* ============================================================= */
static void
-gst_switch_release_pad (GstElement *element, GstPad *pad)
+gst_switch_release_pad (GstElement * element, GstPad * pad)
{
GList *sinkpads = NULL;
GstSwitch *gstswitch = NULL;
GstSwitchPad *switchpad = NULL;
-
+
g_return_if_fail (GST_IS_SWITCH (element));
-
+
gstswitch = GST_SWITCH (element);
-
+
GST_CAT_LOG_OBJECT (GST_CAT_ELEMENT_PADS, gstswitch,
- "releasing requested pad %p", pad);
-
+ "releasing requested pad %p", pad);
+
sinkpads = gstswitch->sinkpads;
-
+
/* Walking through our pad list searching for the pad we want to release */
while (sinkpads) {
switchpad = sinkpads->data;
-
+
if (switchpad && switchpad->sinkpad == pad)
break;
- else
+ else
switchpad = NULL;
-
+
sinkpads = g_list_next (sinkpads);
}
-
+
/* Releasing the found pad */
if (switchpad) {
/* We unref the data of that pad to loose our reference */
@@ -102,178 +99,169 @@ gst_switch_release_pad (GstElement *element, GstPad *pad)
}
}
-static GstPad*
-gst_switch_request_new_pad (GstElement *element,
- GstPadTemplate *templ,
- const gchar *unused)
+static GstPad *
+gst_switch_request_new_pad (GstElement * element,
+ GstPadTemplate * templ, const gchar * unused)
{
char *name = NULL;
GstPad *sinkpad = NULL;
GstSwitch *gstswitch = NULL;
GstSwitchPad *switchpad = NULL;
-
+
g_return_val_if_fail (GST_IS_SWITCH (element), NULL);
-
+
gstswitch = GST_SWITCH (element);
-
+
/* We only provide requested sink pads */
if (templ->direction != GST_PAD_SINK) {
GST_CAT_LOG_OBJECT (GST_CAT_ELEMENT_PADS, gstswitch,
- "requested a non sink pad");
+ "requested a non sink pad");
return NULL;
}
-
+
name = g_strdup_printf ("sink%d", gstswitch->nb_sinkpads);
-
+
sinkpad = gst_pad_new_from_template (templ, name);
-
+
if (name)
g_free (name);
-
+
/* That pad will proxy caps and link */
gst_pad_set_link_function (sinkpad,
- GST_DEBUG_FUNCPTR (gst_pad_proxy_pad_link));
+ GST_DEBUG_FUNCPTR (gst_pad_proxy_pad_link));
gst_pad_set_getcaps_function (sinkpad,
- GST_DEBUG_FUNCPTR (gst_pad_proxy_getcaps));
-
+ GST_DEBUG_FUNCPTR (gst_pad_proxy_getcaps));
+
gst_element_add_pad (GST_ELEMENT (gstswitch), sinkpad);
-
+
switchpad = g_new0 (GstSwitchPad, 1);
if (!switchpad)
return NULL;
-
+
switchpad->sinkpad = sinkpad;
switchpad->data = NULL;
switchpad->forwarded = FALSE;
switchpad->eos = FALSE;
-
+
gstswitch->sinkpads = g_list_insert (gstswitch->sinkpads, switchpad,
- gstswitch->nb_sinkpads);
+ gstswitch->nb_sinkpads);
gstswitch->nb_sinkpads++;
-
+
if (GST_PAD_CAPS (gstswitch->srcpad)) {
gst_pad_try_set_caps (sinkpad, GST_PAD_CAPS (gstswitch->srcpad));
}
-
+
return sinkpad;
}
static gboolean
-gst_switch_poll_sinkpads (GstSwitch *gstswitch)
+gst_switch_poll_sinkpads (GstSwitch * gstswitch)
{
GList *pads;
-
+
g_return_val_if_fail (gstswitch != NULL, FALSE);
g_return_val_if_fail (GST_IS_SWITCH (gstswitch), FALSE);
-
+
pads = gstswitch->sinkpads;
-
+
while (pads) {
GstSwitchPad *switchpad = pads->data;
-
+
/* We only pull from usable pads and non EOS pads */
if (GST_PAD_IS_USABLE (switchpad->sinkpad) && !switchpad->eos) {
-
+
GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, gstswitch,
- "polling pad %p",
- switchpad->sinkpad);
-
+ "polling pad %p", switchpad->sinkpad);
+
/* We loose the reference to the data we stored */
if (switchpad->data) {
- gst_data_unref (switchpad->data);
+ gst_data_unref (switchpad->data);
}
-
+
/* If that data was not forwarded we unref it another time to destroy it */
if (!switchpad->forwarded && switchpad->data) {
- gst_data_unref (switchpad->data);
+ gst_data_unref (switchpad->data);
}
-
+
switchpad->data = NULL;
switchpad->data = gst_pad_pull (switchpad->sinkpad);
-
+
if (!switchpad->data) {
- GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, gstswitch,
- "received NULL data from pad %p",
- switchpad->sinkpad);
+ GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, gstswitch,
+ "received NULL data from pad %p", switchpad->sinkpad);
+ } else {
+ gst_data_ref (switchpad->data);
+ switchpad->forwarded = FALSE;
+
+ /* If the buffer is an EOS event we tag the pad as being in EOS. That
+ means we won't try to pull more data from that pad */
+ if (GST_IS_EVENT (switchpad->data) &&
+ (GST_EVENT_TYPE (GST_EVENT (switchpad->data)) == GST_EVENT_EOS)) {
+ GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, gstswitch,
+ "received EOS event on pad %p", switchpad->sinkpad);
+ switchpad->eos = TRUE;
+ }
}
- else {
- gst_data_ref (switchpad->data);
- switchpad->forwarded = FALSE;
-
- /* If the buffer is an EOS event we tag the pad as being in EOS. That
- means we won't try to pull more data from that pad */
- if (GST_IS_EVENT (switchpad->data) &&
- (GST_EVENT_TYPE (GST_EVENT (switchpad->data)) == GST_EVENT_EOS)) {
- GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, gstswitch,
- "received EOS event on pad %p",
- switchpad->sinkpad);
- switchpad->eos = TRUE;
- }
- }
- }
- else {
+ } else {
GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, gstswitch,
- "not pulling from pad %s (eos is %d)",
- gst_pad_get_name (switchpad->sinkpad),
- switchpad->eos);
+ "not pulling from pad %s (eos is %d)",
+ gst_pad_get_name (switchpad->sinkpad), switchpad->eos);
}
pads = g_list_next (pads);
}
-
+
return TRUE;
}
-static void
-gst_switch_loop (GstElement *element)
+static void
+gst_switch_loop (GstElement * element)
{
GstSwitch *gstswitch = NULL;
GstSwitchPad *switchpad = NULL;
-
+
g_return_if_fail (element != NULL);
g_return_if_fail (GST_IS_SWITCH (element));
-
+
gstswitch = GST_SWITCH (element);
-
+
/* We poll all our sinkpads */
gst_switch_poll_sinkpads (gstswitch);
-
+
/* We get the active sinkpad */
switchpad = g_list_nth_data (gstswitch->sinkpads, gstswitch->active_sinkpad);
-
+
if (switchpad && switchpad->data) {
GstData *data = switchpad->data;
-
+
/* Loose our reference to that data */
gst_data_unref (switchpad->data);
switchpad->data = NULL;
-
+
GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, gstswitch,
- "using data from active pad %p",
- switchpad->sinkpad);
-
+ "using data from active pad %p", switchpad->sinkpad);
+
if (GST_IS_EVENT (data)) {
GstEvent *event = GST_EVENT (data);
+
GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, gstswitch,
- "handling event from active pad %p",
- switchpad->sinkpad);
+ "handling event from active pad %p", switchpad->sinkpad);
/* Handling event */
gst_pad_event_default (switchpad->sinkpad, event);
- }
- else {
+ } else {
/* Pushing active sinkpad data to srcpad */
GST_CAT_LOG_OBJECT (GST_CAT_DATAFLOW, gstswitch,
- "pushing data from active pad %p to %p",
- switchpad->sinkpad, gstswitch->srcpad);
+ "pushing data from active pad %p to %p",
+ switchpad->sinkpad, gstswitch->srcpad);
gst_pad_push (gstswitch->srcpad, data);
}
-
+
/* Mark this data as forwarded so that it won't get unrefed on next poll */
switchpad->forwarded = TRUE;
}
}
static GstElementStateReturn
-gst_switch_change_state (GstElement *element)
+gst_switch_change_state (GstElement * element)
{
GstSwitch *gstswitch;
@@ -287,26 +275,26 @@ gst_switch_change_state (GstElement *element)
case GST_STATE_PAUSED_TO_PLAYING:
break;
case GST_STATE_PLAYING_TO_PAUSED:
- {
- GList *sinkpads = NULL;
-
- sinkpads = gstswitch->sinkpads;
-
- while (sinkpads) {
- GstSwitchPad *switchpad = sinkpads->data;
-
- /* If a data is still stored in our structure we unref it */
- if (switchpad->data) {
- gst_data_unref (switchpad->data);
- switchpad->data = NULL;
- }
-
- switchpad->forwarded = FALSE;
- switchpad->eos = FALSE;
-
- sinkpads = g_list_next (sinkpads);
- }
+ {
+ GList *sinkpads = NULL;
+
+ sinkpads = gstswitch->sinkpads;
+
+ while (sinkpads) {
+ GstSwitchPad *switchpad = sinkpads->data;
+
+ /* If a data is still stored in our structure we unref it */
+ if (switchpad->data) {
+ gst_data_unref (switchpad->data);
+ switchpad->data = NULL;
+ }
+
+ switchpad->forwarded = FALSE;
+ switchpad->eos = FALSE;
+
+ sinkpads = g_list_next (sinkpads);
}
+ }
break;
case GST_STATE_PAUSED_TO_READY:
break;
@@ -316,7 +304,7 @@ gst_switch_change_state (GstElement *element)
if (GST_ELEMENT_CLASS (parent_class)->change_state)
return GST_ELEMENT_CLASS (parent_class)->change_state (element);
- else
+ else
return GST_STATE_SUCCESS;
}
@@ -327,15 +315,15 @@ gst_switch_change_state (GstElement *element)
/* =========================================== */
static void
-gst_switch_set_property (GObject *object, guint prop_id,
- const GValue *value, GParamSpec *pspec)
+gst_switch_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec)
{
GstSwitch *gstswitch = NULL;
-
+
g_return_if_fail (GST_IS_SWITCH (object));
-
+
gstswitch = GST_SWITCH (object);
-
+
switch (prop_id) {
case ARG_ACTIVE_SOURCE:
gstswitch->active_sinkpad = g_value_get_int (value);
@@ -347,15 +335,15 @@ gst_switch_set_property (GObject *object, guint prop_id,
}
static void
-gst_switch_get_property (GObject *object, guint prop_id,
- GValue *value, GParamSpec *pspec)
+gst_switch_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec)
{
GstSwitch *gstswitch = NULL;
-
+
g_return_if_fail (GST_IS_SWITCH (object));
-
+
gstswitch = GST_SWITCH (object);
-
+
switch (prop_id) {
case ARG_ACTIVE_SOURCE:
g_value_set_int (value, gstswitch->active_sinkpad);
@@ -376,50 +364,50 @@ gst_switch_get_property (GObject *object, guint prop_id,
/* =========================================== */
static void
-gst_switch_dispose (GObject *object)
+gst_switch_dispose (GObject * object)
{
GstSwitch *gstswitch = NULL;
GList *sinkpads = NULL;
-
+
gstswitch = GST_SWITCH (object);
sinkpads = gstswitch->sinkpads;
-
+
while (sinkpads) {
GstSwitchPad *switchpad = sinkpads->data;
-
+
/* If a data is still stored in our structure we unref it */
if (switchpad->data) {
gst_data_unref (switchpad->data);
switchpad->data = NULL;
}
-
+
/* Freeing our structure */
g_free (switchpad);
-
+
sinkpads = g_list_next (sinkpads);
}
-
+
/* Freeing the list correctly */
- if (gstswitch->sinkpads) {
+ if (gstswitch->sinkpads) {
g_list_free (gstswitch->sinkpads);
gstswitch->sinkpads = NULL;
}
-
+
G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
-gst_switch_init (GstSwitch *gstswitch)
+gst_switch_init (GstSwitch * gstswitch)
{
gstswitch->srcpad = gst_pad_new ("src", GST_PAD_SRC);
gst_element_add_pad (GST_ELEMENT (gstswitch), gstswitch->srcpad);
gst_pad_set_link_function (gstswitch->srcpad,
- GST_DEBUG_FUNCPTR (gst_pad_proxy_pad_link));
+ GST_DEBUG_FUNCPTR (gst_pad_proxy_pad_link));
gst_pad_set_getcaps_function (gstswitch->srcpad,
- GST_DEBUG_FUNCPTR (gst_pad_proxy_getcaps));
+ GST_DEBUG_FUNCPTR (gst_pad_proxy_getcaps));
gst_element_set_loop_function (GST_ELEMENT (gstswitch), gst_switch_loop);
-
+
gstswitch->sinkpads = NULL;
gstswitch->active_sinkpad = 0;
gstswitch->nb_sinkpads = 0;
@@ -429,15 +417,15 @@ static void
gst_switch_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
+
gst_element_class_set_details (element_class, &gst_switch_details);
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gst_switch_sink_factory));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&gst_switch_sink_factory));
}
static void
-gst_switch_class_init (GstSwitchClass *klass)
+gst_switch_class_init (GstSwitchClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
@@ -446,26 +434,22 @@ gst_switch_class_init (GstSwitchClass *klass)
gstelement_class = (GstElementClass *) klass;
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
-
+
g_object_class_install_property (gobject_class,
- ARG_NB_SOURCES,
- g_param_spec_int ("nb_sources",
- "number of sources",
- "number of sources",
- G_MININT, G_MAXINT, 0,
- G_PARAM_READABLE));
+ ARG_NB_SOURCES,
+ g_param_spec_int ("nb_sources",
+ "number of sources",
+ "number of sources", G_MININT, G_MAXINT, 0, G_PARAM_READABLE));
g_object_class_install_property (gobject_class,
- ARG_ACTIVE_SOURCE,
- g_param_spec_int ("active_source",
- "active source",
- "active source",
- G_MININT, G_MAXINT, 0,
- G_PARAM_READWRITE));
-
+ ARG_ACTIVE_SOURCE,
+ g_param_spec_int ("active_source",
+ "active source",
+ "active source", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE));
+
gobject_class->dispose = gst_switch_dispose;
gobject_class->set_property = gst_switch_set_property;
gobject_class->get_property = gst_switch_get_property;
-
+
gstelement_class->change_state = gst_switch_change_state;
gstelement_class->request_new_pad = gst_switch_request_new_pad;
gstelement_class->release_pad = gst_switch_release_pad;
@@ -483,40 +467,34 @@ gst_switch_get_type (void)
static GType switch_type = 0;
if (!switch_type) {
- static const GTypeInfo switch_info = {
- sizeof(GstSwitchClass),
- gst_switch_base_init,
- NULL,
- (GClassInitFunc) gst_switch_class_init,
- NULL,
- NULL,
- sizeof(GstSwitch),
- 0,
- (GInstanceInitFunc) gst_switch_init,
- };
-
- switch_type = g_type_register_static (GST_TYPE_ELEMENT,
- "GstSwitch", &switch_info, 0);
+ static const GTypeInfo switch_info = {
+ sizeof (GstSwitchClass),
+ gst_switch_base_init,
+ NULL,
+ (GClassInitFunc) gst_switch_class_init,
+ NULL,
+ NULL,
+ sizeof (GstSwitch),
+ 0,
+ (GInstanceInitFunc) gst_switch_init,
+ };
+
+ switch_type = g_type_register_static (GST_TYPE_ELEMENT,
+ "GstSwitch", &switch_info, 0);
}
-
+
return switch_type;
}
static gboolean
-plugin_init (GstPlugin *plugin)
+plugin_init (GstPlugin * plugin)
{
return gst_element_register (plugin, "switch", GST_RANK_NONE,
- GST_TYPE_SWITCH);
+ GST_TYPE_SWITCH);
}
-GST_PLUGIN_DEFINE (
- GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "switch",
- "N-to-1 input switching",
- plugin_init,
- VERSION,
- GST_LICENSE,
- GST_PACKAGE,
- GST_ORIGIN
-)
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ "switch",
+ "N-to-1 input switching",
+ plugin_init, VERSION, GST_LICENSE, GST_PACKAGE, GST_ORIGIN)
diff --git a/gst/switch/gstswitch.h b/gst/switch/gstswitch.h
index 59d66aebb..bd8e3739b 100644
--- a/gst/switch/gstswitch.h
+++ b/gst/switch/gstswitch.h
@@ -16,14 +16,13 @@
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
-
+
#ifndef __GST_SWITCH_H__
#define __GST_SWITCH_H__
#include <gst/gst.h>
G_BEGIN_DECLS
-
#define GST_TYPE_SWITCH \
(gst_switch_get_type())
#define GST_SWITCH(obj) \
@@ -34,35 +33,36 @@ G_BEGIN_DECLS
(G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_SWITCH))
#define GST_IS_SWITCH_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_SWITCH))
-
typedef struct _GstSwitchPad GstSwitchPad;
typedef struct _GstSwitch GstSwitch;
typedef struct _GstSwitchClass GstSwitchClass;
-struct _GstSwitchPad {
+struct _GstSwitchPad
+{
GstPad *sinkpad;
GstData *data;
gboolean forwarded;
gboolean eos;
};
-struct _GstSwitch {
+struct _GstSwitch
+{
GstElement element;
-
+
GList *sinkpads;
GstPad *srcpad;
-
+
guint nb_sinkpads;
guint active_sinkpad;
};
-struct _GstSwitchClass {
+struct _GstSwitchClass
+{
GstElementClass parent_class;
};
GType gst_switch_get_type (void);
G_END_DECLS
-
#endif /* __GST_SWITCH_H__ */
diff --git a/gst/vbidec/gstvbidec.c b/gst/vbidec/gstvbidec.c
index 1670142f6..2a92b2978 100644
--- a/gst/vbidec/gstvbidec.c
+++ b/gst/vbidec/gstvbidec.c
@@ -43,39 +43,41 @@
//typedef struct _GstVBIDec GstVBIDec;
typedef struct _GstVBIDecClass GstVBIDecClass;
-struct _GstVBIDec {
- GstElement element;
+struct _GstVBIDec
+{
+ GstElement element;
/* pads */
- GstPad *sinkpad,
- *srcpad;
- char caption[128];
- vbiscreen_t *vbiscreen;
- vbidata_t *vbidata;
- int caption_type;
- gboolean dvd_input;
+ GstPad *sinkpad, *srcpad;
+ char caption[128];
+ vbiscreen_t *vbiscreen;
+ vbidata_t *vbidata;
+ int caption_type;
+ gboolean dvd_input;
};
-struct _GstVBIDecClass {
+struct _GstVBIDecClass
+{
GstElementClass parent_class;
};
-GType gst_vbidec_get_type(void);
+GType gst_vbidec_get_type (void);
/* elementfactory information */
-static GstElementDetails gst_vbidec_details = GST_ELEMENT_DETAILS (
- "VBI decoder",
- "Codec/Decoder/Video",
- "Decodes closed captions and XDS data from VBI data",
- "David I. Lehn <dlehn@users.sourceforge.net>"
-);
+static GstElementDetails gst_vbidec_details =
+GST_ELEMENT_DETAILS ("VBI decoder",
+ "Codec/Decoder/Video",
+ "Decodes closed captions and XDS data from VBI data",
+ "David I. Lehn <dlehn@users.sourceforge.net>");
/* VBIDec signals and args */
-enum {
+enum
+{
LAST_SIGNAL
};
-enum {
+enum
+{
ARG_0,
ARG_VERBOSE,
ARG_CAPTION_TYPE,
@@ -83,20 +85,17 @@ enum {
};
static GstStaticPadTemplate gst_vbidec_sink_template =
-GST_STATIC_PAD_TEMPLATE (
- "sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS_ANY
-);
+GST_STATIC_PAD_TEMPLATE ("sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS_ANY);
static GstStaticPadTemplate gst_vbidec_src_template =
-GST_STATIC_PAD_TEMPLATE (
- "src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ( "text/plain" )
-);
+GST_STATIC_PAD_TEMPLATE ("src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("text/plain")
+ );
#define GST_TYPE_VBIDEC_CAPTION_TYPE_TYPE (gst_vbidec_caption_type_get_type())
@@ -105,35 +104,38 @@ gst_vbidec_caption_type_get_type (void)
{
static GType vbidec_caption_type_type = 0;
static GEnumValue vbidec_caption_type[] = {
- { CAPTURE_OFF, "0", "Closed Captions off"},
- { CAPTURE_CC1, "1", "Closed Caption CC1"},
- { CAPTURE_CC2, "2", "Closed Caption CC2"},
- { CAPTURE_CC3, "4", "Closed Caption CC3"},
- { CAPTURE_CC4, "5", "Closed Caption CC4"},
- { CAPTURE_T1, "6", "Closed Caption T1"},
- { CAPTURE_T2, "7", "Closed Caption T2"},
- { CAPTURE_T3, "8", "Closed Caption T3"},
- { CAPTURE_T4, "9", "Closed Caption T4"},
+ {CAPTURE_OFF, "0", "Closed Captions off"},
+ {CAPTURE_CC1, "1", "Closed Caption CC1"},
+ {CAPTURE_CC2, "2", "Closed Caption CC2"},
+ {CAPTURE_CC3, "4", "Closed Caption CC3"},
+ {CAPTURE_CC4, "5", "Closed Caption CC4"},
+ {CAPTURE_T1, "6", "Closed Caption T1"},
+ {CAPTURE_T2, "7", "Closed Caption T2"},
+ {CAPTURE_T3, "8", "Closed Caption T3"},
+ {CAPTURE_T4, "9", "Closed Caption T4"},
{0, NULL, NULL},
};
if (!vbidec_caption_type_type) {
- vbidec_caption_type_type = g_enum_register_static ("GstVBIDecCaptionTypeType", vbidec_caption_type);
+ vbidec_caption_type_type =
+ g_enum_register_static ("GstVBIDecCaptionTypeType",
+ vbidec_caption_type);
}
return vbidec_caption_type_type;
}
-static void gst_vbidec_base_init (gpointer g_class);
-static void gst_vbidec_class_init (GstVBIDecClass *klass);
-static void gst_vbidec_init (GstVBIDec *vbidec);
+static void gst_vbidec_base_init (gpointer g_class);
+static void gst_vbidec_class_init (GstVBIDecClass * klass);
+static void gst_vbidec_init (GstVBIDec * vbidec);
-static void gst_vbidec_set_property (GObject *object, guint prop_id,
- const GValue *value, GParamSpec *pspec);
-static void gst_vbidec_get_property (GObject *object, guint prop_id,
- GValue *value, GParamSpec *pspec);
+static void gst_vbidec_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec);
+static void gst_vbidec_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec);
-static void gst_vbidec_chain (GstPad *pad, GstData *_data);
+static void gst_vbidec_chain (GstPad * pad, GstData * _data);
static GstElementClass *parent_class = NULL;
+
/*static guint gst_vbidec_signals[LAST_SIGNAL] = { 0 };*/
GType
@@ -143,17 +145,18 @@ gst_vbidec_get_type (void)
if (!vbidec_type) {
static const GTypeInfo vbidec_info = {
- sizeof(GstVBIDecClass),
+ sizeof (GstVBIDecClass),
gst_vbidec_base_init,
NULL,
- (GClassInitFunc)gst_vbidec_class_init,
+ (GClassInitFunc) gst_vbidec_class_init,
NULL,
NULL,
- sizeof(GstVBIDec),
+ sizeof (GstVBIDec),
0,
- (GInstanceInitFunc)gst_vbidec_init,
+ (GInstanceInitFunc) gst_vbidec_init,
};
- vbidec_type = g_type_register_static(GST_TYPE_ELEMENT, "GstVBIDec", &vbidec_info, 0);
+ vbidec_type =
+ g_type_register_static (GST_TYPE_ELEMENT, "GstVBIDec", &vbidec_info, 0);
}
return vbidec_type;
}
@@ -171,62 +174,66 @@ gst_vbidec_base_init (gpointer g_class)
gst_static_pad_template_get (&gst_vbidec_sink_template));
}
static void
-gst_vbidec_class_init(GstVBIDecClass *klass)
+gst_vbidec_class_init (GstVBIDecClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
- gobject_class = (GObjectClass*)klass;
- gstelement_class = (GstElementClass*)klass;
+ gobject_class = (GObjectClass *) klass;
+ gstelement_class = (GstElementClass *) klass;
- parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
+ parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
- gobject_class->set_property = gst_vbidec_set_property;
- gobject_class->get_property = gst_vbidec_get_property;
+ gobject_class->set_property = gst_vbidec_set_property;
+ gobject_class->get_property = gst_vbidec_get_property;
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_VERBOSE,
g_param_spec_boolean ("verbose", "verbose", "verbose",
- FALSE, G_PARAM_WRITABLE));
+ FALSE, G_PARAM_WRITABLE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_CAPTION_TYPE,
g_param_spec_enum ("caption type", "caption type", "Closed Caption Type",
- GST_TYPE_VBIDEC_CAPTION_TYPE_TYPE, CAPTURE_OFF, G_PARAM_READWRITE));
+ GST_TYPE_VBIDEC_CAPTION_TYPE_TYPE, CAPTURE_OFF, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DVD_INPUT,
- g_param_spec_boolean ("dvd input", "dvd input", "VBI is encapsulated in MPEG2 GOP user_data field (as on DVDs)",
- FALSE, G_PARAM_READWRITE));
+ g_param_spec_boolean ("dvd input", "dvd input",
+ "VBI is encapsulated in MPEG2 GOP user_data field (as on DVDs)",
+ FALSE, G_PARAM_READWRITE));
}
static void
-gst_vbidec_init (GstVBIDec *vbidec)
+gst_vbidec_init (GstVBIDec * vbidec)
{
/* create the sink and src pads */
- vbidec->sinkpad = gst_pad_new_from_template (
- gst_static_pad_template_get (&gst_vbidec_sink_template), "sink");
+ vbidec->sinkpad =
+ gst_pad_new_from_template (gst_static_pad_template_get
+ (&gst_vbidec_sink_template), "sink");
gst_element_add_pad (GST_ELEMENT (vbidec), vbidec->sinkpad);
- gst_pad_set_chain_function (vbidec->sinkpad, GST_DEBUG_FUNCPTR (gst_vbidec_chain));
+ gst_pad_set_chain_function (vbidec->sinkpad,
+ GST_DEBUG_FUNCPTR (gst_vbidec_chain));
- vbidec->srcpad = gst_pad_new_from_template (
- gst_static_pad_template_get (&gst_vbidec_src_template), "src");
+ vbidec->srcpad =
+ gst_pad_new_from_template (gst_static_pad_template_get
+ (&gst_vbidec_src_template), "src");
gst_element_add_pad (GST_ELEMENT (vbidec), vbidec->srcpad);
- vbidec->vbiscreen = vbiscreen_new(0, 0, 1.0, 0, (void *)vbidec);
- vbidec->vbidata = vbidata_new_line(vbidec->vbiscreen, 0);
+ vbidec->vbiscreen = vbiscreen_new (0, 0, 1.0, 0, (void *) vbidec);
+ vbidec->vbidata = vbidata_new_line (vbidec->vbiscreen, 0);
vbidec->caption_type = CAPTURE_OFF;
- vbidata_capture_mode(vbidec->vbidata, vbidec->caption_type);
+ vbidata_capture_mode (vbidec->vbidata, vbidec->caption_type);
vbidec->dvd_input = FALSE;
}
static void
-line21_decode(GstVBIDec *vbidec, guint8 *data, guint32 size)
+line21_decode (GstVBIDec * vbidec, guint8 * data, guint32 size)
{
- vbidata_process_line(vbidec->vbidata, data, 0);
+ vbidata_process_line (vbidec->vbidata, data, 0);
}
static void
-dvd_user_data_decode(GstVBIDec *vbidec, guint8 *data, guint32 size)
+dvd_user_data_decode (GstVBIDec * vbidec, guint8 * data, guint32 size)
{
//char caption[128];
//int ci; /* caption index */
- int i; /* buf index */
+ int i; /* buf index */
int num_disp_field;
guint8 b1, b2;
int w;
@@ -235,29 +242,29 @@ dvd_user_data_decode(GstVBIDec *vbidec, guint8 *data, guint32 size)
//g_print("== %p %d\n", data, size);
i = 0;
/* Check for Closed Captioning data */
- if (data[i] != 0x43 || data[i+1] != 0x43 ||
- data[i+2] != 0x01 || data[i+3] != 0xf8) {
+ if (data[i] != 0x43 || data[i + 1] != 0x43 ||
+ data[i + 2] != 0x01 || data[i + 3] != 0xf8) {
g_print ("non-CC data\n");
return;
}
//g_print ("CC data\n");
- i += 4; /* above */
- i += 4; /* ? */
+ i += 4; /* above */
+ i += 4; /* ? */
num_disp_field = data[i] & 0x3f;
//g_print ("ndf %d\n", num_disp_field);
while ((data[i] & 0xfe) == 0xfe) {
if (data[i] & 0x1) {
- b1 = data[i+1] & 0x7f;
- b2 = data[i+2] & 0x7f;
+ b1 = data[i + 1] & 0x7f;
+ b2 = data[i + 2] & 0x7f;
w = (b2 << 8) | b1;
- vbidata_process_16b(vbidec->vbidata, 0, w);
+ vbidata_process_16b (vbidec->vbidata, 0, w);
}
i += 3;
}
}
static void
-gst_vbidec_chain (GstPad *pad, GstData *_data)
+gst_vbidec_chain (GstPad * pad, GstData * _data)
{
GstBuffer *buf = GST_BUFFER (_data);
GstVBIDec *vbidec = GST_VBIDEC (gst_pad_get_parent (pad));
@@ -270,39 +277,40 @@ gst_vbidec_chain (GstPad *pad, GstData *_data)
pts = GST_BUFFER_TIMESTAMP (buf);
/*
- g_print("** user_data: addr:%p len:%d state:%d\n", data, size, 0);
- {
- int i;
- guint8 ud;
- g_print("** \"");
- for (i=0; i<size; i++) {
- ud = data[i];
- if (isprint((char)ud)) {
- g_print("%c", (char)ud);
- } else {
- g_print("[0x%02x]", ud);
- }
- }
- g_print("\"\n");
- }
- */
+ g_print("** user_data: addr:%p len:%d state:%d\n", data, size, 0);
+ {
+ int i;
+ guint8 ud;
+ g_print("** \"");
+ for (i=0; i<size; i++) {
+ ud = data[i];
+ if (isprint((char)ud)) {
+ g_print("%c", (char)ud);
+ } else {
+ g_print("[0x%02x]", ud);
+ }
+ }
+ g_print("\"\n");
+ }
+ */
if (vbidec->dvd_input) {
- dvd_user_data_decode(vbidec, data, size);
+ dvd_user_data_decode (vbidec, data, size);
} else {
- line21_decode(vbidec, data, size);
+ line21_decode (vbidec, data, size);
}
- gst_buffer_unref(buf);
+ gst_buffer_unref (buf);
}
void
-gst_vbidec_show_text (GstVBIDec *vbidec, char *text, int len)
+gst_vbidec_show_text (GstVBIDec * vbidec, char *text, int len)
{
//fprintf(stderr, "%*s\n", len, text);
if (len > 0) {
if (GST_PAD_IS_USABLE (vbidec->srcpad)) {
GstBuffer *buf = gst_buffer_new_and_alloc (len);
+
memcpy (GST_BUFFER_DATA (buf), text, len);
GST_BUFFER_SIZE (buf) = len;
// FIXME
@@ -315,7 +323,8 @@ gst_vbidec_show_text (GstVBIDec *vbidec, char *text, int len)
}
static void
-gst_vbidec_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
+gst_vbidec_set_property (GObject * object, guint prop_id, const GValue * value,
+ GParamSpec * pspec)
{
GstVBIDec *vbidec;
@@ -325,15 +334,15 @@ gst_vbidec_set_property (GObject *object, guint prop_id, const GValue *value, GP
switch (prop_id) {
case ARG_VERBOSE:
- vbidata_set_verbose(vbidec->vbidata, g_value_get_boolean (value));
- vbiscreen_set_verbose(vbidec->vbiscreen, g_value_get_boolean (value));
+ vbidata_set_verbose (vbidec->vbidata, g_value_get_boolean (value));
+ vbiscreen_set_verbose (vbidec->vbiscreen, g_value_get_boolean (value));
break;
case ARG_DVD_INPUT:
- vbidec->dvd_input = g_value_get_boolean(value);
+ vbidec->dvd_input = g_value_get_boolean (value);
break;
case ARG_CAPTION_TYPE:
- vbidec->caption_type = g_value_get_enum(value);
- vbidata_capture_mode(vbidec->vbidata, vbidec->caption_type);
+ vbidec->caption_type = g_value_get_enum (value);
+ vbidata_capture_mode (vbidec->vbidata, vbidec->caption_type);
break;
default:
break;
@@ -341,7 +350,8 @@ gst_vbidec_set_property (GObject *object, guint prop_id, const GValue *value, GP
}
static void
-gst_vbidec_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+gst_vbidec_get_property (GObject * object, guint prop_id, GValue * value,
+ GParamSpec * pspec)
{
GstVBIDec *vbidec;
@@ -351,10 +361,10 @@ gst_vbidec_get_property (GObject *object, guint prop_id, GValue *value, GParamSp
switch (prop_id) {
case ARG_DVD_INPUT:
- g_value_set_boolean(value, vbidec->dvd_input);
+ g_value_set_boolean (value, vbidec->dvd_input);
break;
case ARG_CAPTION_TYPE:
- g_value_set_enum(value, vbidec->caption_type);
+ g_value_set_enum (value, vbidec->caption_type);
break;
default:
break;
@@ -362,19 +372,14 @@ gst_vbidec_get_property (GObject *object, guint prop_id, GValue *value, GParamSp
}
static gboolean
-plugin_init (GstPlugin *plugin)
+plugin_init (GstPlugin * plugin)
{
- return gst_element_register (plugin, "vbidec", GST_RANK_NONE, GST_TYPE_VBIDEC);
+ return gst_element_register (plugin, "vbidec", GST_RANK_NONE,
+ GST_TYPE_VBIDEC);
}
-GST_PLUGIN_DEFINE (
- GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "vbidec",
- "Decodes closed captions and XDS data from VBI data",
- plugin_init,
- VERSION,
- "GPL",
- GST_PACKAGE,
- GST_ORIGIN
-)
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ "vbidec",
+ "Decodes closed captions and XDS data from VBI data",
+ plugin_init, VERSION, "GPL", GST_PACKAGE, GST_ORIGIN)
diff --git a/gst/vbidec/gstvbidec.h b/gst/vbidec/gstvbidec.h
index 8a5ea7e5d..e495f25c4 100644
--- a/gst/vbidec/gstvbidec.h
+++ b/gst/vbidec/gstvbidec.h
@@ -19,4 +19,4 @@
typedef struct _GstVBIDec GstVBIDec;
-void gst_vbidec_show_text (GstVBIDec *vbidec, char *text, int len);
+void gst_vbidec_show_text (GstVBIDec * vbidec, char *text, int len);
diff --git a/gst/vbidec/vbidata.c b/gst/vbidec/vbidata.c
index fc0af5faf..75a85e482 100644
--- a/gst/vbidec/vbidata.c
+++ b/gst/vbidec/vbidata.c
@@ -48,159 +48,166 @@ static int pll = 0;
struct vbidata_s
{
- int fd;
- vbiscreen_t *vs;
- /*tvtime_osd_t *osd;*/
- char buf[ 65536 ];
- int wanttop;
- int wanttext;
-
- unsigned int colour;
- int row, ital;
- int indent, ul;
- int chan;
-
- unsigned int current_colour;
- int current_row, current_ital;
- int current_indent, current_ul;
- int current_chan;
- int current_istext;
-
- int initialised;
- int enabled;
- int lastcode;
- int lastcount;
- int verbose;
-
- /* XDS data */
- char xds_packet[ 2048 ];
- int xds_cursor;
-
- char *program_name;
- char *network_name;
- char *call_letters;
- const char *rating;
- const char *program_type;
- int start_day;
- int start_month;
- int start_min;
- int start_hour;
- int length_hour;
- int length_min;
- int length_elapsed_hour;
- int length_elapsed_min;
- int length_elapsed_sec;
- char *program_desc[8];
+ int fd;
+ vbiscreen_t *vs;
+ /*tvtime_osd_t *osd; */
+ char buf[65536];
+ int wanttop;
+ int wanttext;
+
+ unsigned int colour;
+ int row, ital;
+ int indent, ul;
+ int chan;
+
+ unsigned int current_colour;
+ int current_row, current_ital;
+ int current_indent, current_ul;
+ int current_chan;
+ int current_istext;
+
+ int initialised;
+ int enabled;
+ int lastcode;
+ int lastcount;
+ int verbose;
+
+ /* XDS data */
+ char xds_packet[2048];
+ int xds_cursor;
+
+ char *program_name;
+ char *network_name;
+ char *call_letters;
+ const char *rating;
+ const char *program_type;
+ int start_day;
+ int start_month;
+ int start_min;
+ int start_hour;
+ int length_hour;
+ int length_min;
+ int length_elapsed_hour;
+ int length_elapsed_min;
+ int length_elapsed_sec;
+ char *program_desc[8];
};
/* this is NOT exactly right */
//static char *ccode = " !\"#$%&'()\0341+,-./0123456789:;<=>?@"
static char *ccode = " !\"#$%&'()a+,-./0123456789:;<=>?@"
- "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
// "abcdefghijklmnopqrstuvwxyz"
// "[\0351]\0355\0363\0372abcdefghijklmnopqr"
- "[e]iouabcdefghijklmnopqr"
+ "[e]iouabcdefghijklmnopqr"
// "stuvwxyz\0347\0367\0245\0244\0240";
- "stuvwxyzcoNn ";
+ "stuvwxyzcoNn ";
static char *wccode = "\0256\0260\0275\0277T\0242\0243#\0340 "
- "\0350\0354\0362\0371";
+ "\0350\0354\0362\0371";
static char *extcode1 = "\0301\0311\0323\0332\0334\0374"
- "`\0241*'-\0251S*\"\"\0300\0302"
- "\0307\0310\0312\0313\0353\0316\0317\0357"
- "\0324\0331\0371\0333\0253\0273";
+ "`\0241*'-\0251S*\"\"\0300\0302"
+ "\0307\0310\0312\0313\0353\0316\0317\0357" "\0324\0331\0371\0333\0253\0273";
static char *extcode2 = "\0303\0343\0315\0314\0354\0322\0362\0325"
- "{}\\^_|~\0304\0344\0326\0366\0337\0245\0244|"
- "\0305\0345\0330\0370++++";
+ "{}\\^_|~\0304\0344\0326\0366\0337\0245\0244|" "\0305\0345\0330\0370++++";
-int parityok(int n)
+int
+parityok (int n)
{ /* check parity for 2 bytes packed in n */
- int j, k;
- for (k = 0, j = 0; j < 7; j++)
- if (n & (1 << j))
- k++;
- if ((k & 1) && (n & 0x80))
- return 0;
- for (k = 0, j = 8; j < 15; j++)
- if (n & (1 << j))
- k++;
- if ((k & 1) && (n & 0x8000))
- return 0;
- return 1;
+ int j, k;
+
+ for (k = 0, j = 0; j < 7; j++)
+ if (n & (1 << j))
+ k++;
+ if ((k & 1) && (n & 0x80))
+ return 0;
+ for (k = 0, j = 8; j < 15; j++)
+ if (n & (1 << j))
+ k++;
+ if ((k & 1) && (n & 0x8000))
+ return 0;
+ return 1;
}
-int decodebit(unsigned char *data, int threshold)
+int
+decodebit (unsigned char *data, int threshold)
{
- return ((data[0] + data[1] + data[2] + data[3] + data[4] + data[5] +
- data[6] + data[7] + data[8] + data[9] + data[10] + data[11] +
- data[12] + data[13] + data[14] + data[15] + data[16] + data[17] +
- data[18] + data[19] + data[20] + data[21] + data[22] + data[23] +
- data[24] + data[25] + data[26] + data[27] + data[28] + data[29] +
- data[30] + data[31])>>5 > threshold);
+ return ((data[0] + data[1] + data[2] + data[3] + data[4] + data[5] +
+ data[6] + data[7] + data[8] + data[9] + data[10] + data[11] +
+ data[12] + data[13] + data[14] + data[15] + data[16] + data[17] +
+ data[18] + data[19] + data[20] + data[21] + data[22] + data[23] +
+ data[24] + data[25] + data[26] + data[27] + data[28] + data[29] +
+ data[30] + data[31]) >> 5 > threshold);
}
-int ccdecode(unsigned char *vbiline)
+int
+ccdecode (unsigned char *vbiline)
{
- int max = 0, maxval = 0, minval = 255, i = 0, clk = 0, tmp = 0;
- int sample, packedbits = 0;
-
- for (i=0; i<250; i++) {
- sample = vbiline[i];
- if (sample - maxval > 10)
- (maxval = sample, max = i);
- if (sample < minval)
- minval = sample;
- if (maxval - sample > 40)
- break;
- }
- sample = ((maxval + minval) >> 1);
- pll = max;
-
- /* found clock lead-in, double-check start */
+ int max = 0, maxval = 0, minval = 255, i = 0, clk = 0, tmp = 0;
+ int sample, packedbits = 0;
+
+ for (i = 0; i < 250; i++) {
+ sample = vbiline[i];
+ if (sample - maxval > 10)
+ (maxval = sample, max = i);
+ if (sample < minval)
+ minval = sample;
+ if (maxval - sample > 40)
+ break;
+ }
+ sample = ((maxval + minval) >> 1);
+ pll = max;
+
+ /* found clock lead-in, double-check start */
#ifndef PAL_DECODE
- i = max + 478;
+ i = max + 478;
#else
- i = max + 538;
+ i = max + 538;
#endif
- if (!decodebit(&vbiline[i], sample))
- return 0;
+ if (!decodebit (&vbiline[i], sample))
+ return 0;
#ifndef PAL_DECODE
- tmp = i + 57; /* tmp = data bit zero */
+ tmp = i + 57; /* tmp = data bit zero */
#else
- tmp = i + 71;
+ tmp = i + 71;
#endif
- for (i = 0; i < 16; i++) {
+ for (i = 0; i < 16; i++) {
#ifndef PAL_DECODE
- clk = tmp + i * 57;
+ clk = tmp + i * 57;
#else
- clk = tmp + i * 71;
+ clk = tmp + i * 71;
#endif
- if (decodebit(&vbiline[clk], sample)) {
- packedbits |= 1 << i;
- }
+ if (decodebit (&vbiline[clk], sample)) {
+ packedbits |= 1 << i;
}
- if (parityok(packedbits))
- return packedbits;
- return 0;
+ }
+ if (parityok (packedbits))
+ return packedbits;
+ return 0;
} /* ccdecode */
-const char *movies[] = { "N/A", "G", "PG", "PG-13", "R",
- "NC-17", "X", "Not Rated" };
-const char *usa_tv[] = { "Not Rated", "TV-Y", "TV-Y7", "TV-G",
- "TV-PG", "TV-14", "TV-MA", "Not Rated" };
-const char *cane_tv[] = { "Exempt", "C", "C8+", "G", "PG",
- "14+", "18+", "Reserved" };
-const char *canf_tv[] = { "Exempt", "G", "8 ans +", "13 ans +",
- "16 ans +", "18 ans +", "Reserved",
- "Reserved" };
+const char *movies[] = { "N/A", "G", "PG", "PG-13", "R",
+ "NC-17", "X", "Not Rated"
+};
+const char *usa_tv[] = { "Not Rated", "TV-Y", "TV-Y7", "TV-G",
+ "TV-PG", "TV-14", "TV-MA", "Not Rated"
+};
+const char *cane_tv[] = { "Exempt", "C", "C8+", "G", "PG",
+ "14+", "18+", "Reserved"
+};
+const char *canf_tv[] = { "Exempt", "G", "8 ans +", "13 ans +",
+ "16 ans +", "18 ans +", "Reserved",
+ "Reserved"
+};
const char *months[] = { 0, "Jan", "Feb", "Mar", "Apr", "May",
- "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
+ "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
+};
-static const char *eia608_program_type[ 96 ] = {
+static const char *eia608_program_type[96] = {
"education", "entertainment", "movie", "news", "religious", "sports",
"other", "action", "advertisement", "animated", "anthology",
"automobile", "awards", "baseball", "basketball", "bulletin", "business",
@@ -220,245 +227,318 @@ static const char *eia608_program_type[ 96 ] = {
};
-static void parse_xds_packet( vbidata_t *vbi, char *packet, int length )
+static void
+parse_xds_packet (vbidata_t * vbi, char *packet, int length)
{
- int sum = 0;
- int i;
-
- if( !vbi ) return;
-
- /* Check the checksum for validity of the packet. */
- for( i = 0; i < length - 1; i++ ) {
- sum += packet[ i ];
+ int sum = 0;
+ int i;
+
+ if (!vbi)
+ return;
+
+ /* Check the checksum for validity of the packet. */
+ for (i = 0; i < length - 1; i++) {
+ sum += packet[i];
+ }
+ if ((((~sum) & 0x7f) + 1) != packet[length - 1]) {
+ return;
+ }
+
+ /* Stick a null at the end, and cut off the last two characters. */
+ packet[length - 2] = '\0';
+ length -= 2;
+
+ if (packet[0] == 0x01 && packet[1] == 0x03) {
+ if (vbi->program_name && !strcmp (vbi->program_name, packet + 2)) {
+ return;
}
- if( (((~sum) & 0x7f) + 1) != packet[ length - 1 ] ) {
- return;
+ if (vbi->verbose)
+ fprintf (stderr, "Current program name: '%s'\n", packet + 2);
+ if (vbi->program_name)
+ free (vbi->program_name);
+ vbi->program_name = strdup (packet + 2);
+ /*tvtime_osd_set_show_name( vbi->osd, vbi->program_name ); */
+ } else if (packet[0] == 0x03 && packet[1] == 0x03) {
+ if (vbi->verbose)
+ fprintf (stderr, "Future program name: '%s'\n", packet + 2);
+ } else if (packet[0] == 0x05 && packet[1] == 0x01) {
+ if (vbi->network_name && !strcmp (vbi->network_name, packet + 2)) {
+ return;
}
- /* Stick a null at the end, and cut off the last two characters. */
- packet[ length - 2 ] = '\0';
- length -= 2;
-
- if( packet[ 0 ] == 0x01 && packet[ 1 ] == 0x03 ) {
- if( vbi->program_name && !strcmp(vbi->program_name, packet + 2 ) ) {
- return;
- }
- if( vbi->verbose ) fprintf( stderr, "Current program name: '%s'\n", packet + 2 );
- if( vbi->program_name ) free( vbi->program_name );
- vbi->program_name = strdup(packet + 2);
- /*tvtime_osd_set_show_name( vbi->osd, vbi->program_name );*/
- } else if( packet[ 0 ] == 0x03 && packet[ 1 ] == 0x03 ) {
- if( vbi->verbose ) fprintf( stderr, "Future program name: '%s'\n", packet + 2 );
- } else if( packet[ 0 ] == 0x05 && packet[ 1 ] == 0x01 ) {
- if( vbi->network_name && !strcmp(vbi->network_name, packet + 2 ) ) {
- return;
- }
-
- if( vbi->verbose ) fprintf( stderr, "Network name: '%s'\n", packet + 2 );
- if( vbi->network_name ) free( vbi->network_name );
- vbi->network_name = strdup( packet + 2 );
- /*tvtime_osd_set_network_name( vbi->osd, vbi->network_name );*/
- } else if( packet[ 0 ] == 0x01 && packet[ 1 ] == 0x05 ) {
- int movie_rating = packet[ 2 ] & 7;
- int scheme = (packet[ 2 ] & 56) >> 3;
- int tv_rating = packet[ 3 ] & 7;
- int VSL = packet[ 3 ] & 56;
- const char * str;
-
- switch( VSL | scheme ) {
- case 3: /* Canadian English TV */
- str = cane_tv[ tv_rating ];
- break;
- case 7: /* Canadian French TV */
- str = canf_tv[ tv_rating ];
- break;
- case 19: /* Reserved */
- case 31:
- str = "";
- break;
- default:
- if( ((VSL | scheme) & 3) == 1 ) {
- /* USA TV */
- str = usa_tv[ tv_rating ];
- } else {
- /* MPAA Movie Rating */
- str = movies[ movie_rating ];
- }
- break;
- }
-
- if( vbi->rating && !strcmp(vbi->rating, str ) ) {
- return;
- }
-
- if( vbi->verbose ) fprintf( stderr, "Show rating: %s", str );
- if( ((VSL | scheme) & 3) == 1 || ((VSL | scheme) & 3) == 0 ) {
- /* show VSLD for the americans */
- if( (VSL | scheme) & 32 ) {
- if( vbi->verbose ) fprintf( stderr, " V" );
- }
- if( (VSL | scheme) & 16 ) {
- if( vbi->verbose ) fprintf( stderr, " S" );
- }
- if( (VSL | scheme) & 8 ) {
- if( vbi->verbose ) fprintf( stderr, " L" );
- }
- if( (VSL | scheme) & 4 ) {
- if( vbi->verbose ) fprintf( stderr, " D" );
- }
- }
- if( vbi->verbose ) fprintf( stderr, "\n" );
- vbi->rating = str;
- /*tvtime_osd_set_show_rating( vbi->osd, vbi->rating );*/
- } else if( packet[ 0 ] == 0x05 && packet[ 1 ] == 0x02 ) {
- if( vbi->call_letters && !strcmp(vbi->call_letters, packet + 2 ) ) {
- return;
- }
-
- if( vbi->verbose ) fprintf( stderr, "Network call letters: '%s'\n", packet + 2 );
- if( vbi->call_letters ) free( vbi->call_letters );
- vbi->call_letters = strdup( packet + 2 );
- /*tvtime_osd_set_network_call( vbi->osd, vbi->call_letters );*/
- } else if( packet[ 0 ] == 0x01 && packet[ 1 ] == 0x01 ) {
- int month = packet[5];// & 15;
- int day = packet[4];// & 31;
- int hour = packet[3];// & 31;
- int min = packet[2];// & 63;
- char str[33];
- if( vbi->verbose ) fprintf( stderr, "Program Start: %02d %s, %02d:%02d\n",
- day & 31, months[month & 15], hour & 31, min & 63 );
- // packet[ 3 ], packet[ 4 ], packet[ 5 ], packet[ 6 ] );
- //packet[ 5 ] & 31, packet[ 6 ], packet[ 4 ] & 31, packet[ 3 ] & 63 );
- vbi->start_month = month & 15;
- vbi->start_day = day & 31;
- vbi->start_hour = hour & 31;
- vbi->start_min = hour & 63;
- snprintf( str, 32, "%02d %s, %02d:%02d",
- day & 31, months[month & 15], hour & 31, min & 63 );
- /*tvtime_osd_set_show_start( vbi->osd, str );*/
- } else if( packet[ 0 ] == 0x01 && packet[ 1 ] == 0x04 ) {
- if( vbi->verbose ) fprintf( stderr, "Program type: " );
- for( i = 0; i < length - 2; i++ ) {
- int cur = packet[ 2 + i ] - 0x20;
- if( cur >= 0 && cur < 96 ) {
- if( vbi->verbose ) fprintf( stderr, "%s%s", i ? ", " : "", eia608_program_type[ cur ] );
- /* this will cause us to keep only the last type we check */
- vbi->program_type = eia608_program_type[ cur ];
- }
- }
- if( vbi->verbose ) fprintf( stderr, "\n" );
- } else if( packet[ 0 ] < 0x03 && packet[ 1 ] >= 0x10 && packet[ 1 ] <= 0x17 ) {
-
- if( vbi->program_desc[ packet[1] & 0xf ] &&
- !strcmp(vbi->program_desc[ packet[1] & 0xf ], packet + 2 ) ) {
- return;
- }
-
- if( vbi->verbose ) fprintf( stderr, "Program Description: Line %d", packet[1] & 0xf );
- if( vbi->verbose ) fprintf( stderr, "%s\n", packet + 2 );
- if( vbi->program_desc[ packet[1] & 0xf ] )
- free( vbi->program_desc[ packet[1] & 0xf ] );
- vbi->program_desc[ packet[1] & 0xf ] = strdup( packet + 2 );
- } else if( packet[ 0 ] == 0x01 && packet[ 1 ] == 0x02 ) {
- char str[ 33 ];
- str[0] = 0;
- if( vbi->verbose ) fprintf( stderr, "Program Length: %02d:%02d",
- packet[ 3 ] & 63, packet[ 2 ] & 63 );
- vbi->length_hour = packet[ 3 ] & 63;
- vbi->length_min = packet[ 2 ] & 63;
- snprintf( str, 32, "%02d:%02d",
- packet[ 3 ] & 63, packet[ 2 ] & 63 );
- if( length > 4 ) {
- if( vbi->verbose ) fprintf( stderr, " Elapsed: %02d:%02d", packet[ 5 ] & 63,
- packet[ 4 ] & 63 );
- vbi->length_elapsed_hour = packet[ 5 ] & 63;
- vbi->length_elapsed_min = packet[ 4 ] & 63;
- snprintf( str, 32, "%02d:%02d/%02d:%02d",
- packet[ 5 ] & 63, packet[ 4 ] & 63,
- packet[ 3 ] & 63, packet[ 2 ] & 63 );
- } else {
- vbi->length_elapsed_hour = 0;
- vbi->length_elapsed_min = 0;
- }
-
- if( length > 6 ) {
- if( vbi->verbose ) fprintf( stderr, ".%02d", packet[ 6 ] & 63 );
- vbi->length_elapsed_hour = packet[ 6 ] & 63;
- snprintf( str, 32, "%02d:%02d.%02d/%02d:%02d",
- packet[ 5 ] & 63, packet[ 4 ] & 63, packet[ 6 ] & 63,
- packet[ 3 ] & 63, packet[ 2 ] & 63 );
- } else {
- vbi->length_elapsed_hour = 0;
- }
- /*tvtime_osd_set_show_length( vbi->osd, str );*/
- if( vbi->verbose ) fprintf( stderr, "\n" );
- } else if( packet[ 0 ] == 0x05 && packet[ 1 ] == 0x04 ) {
- if( vbi->verbose ) fprintf( stderr, "Transmission Signal Identifier (TSID): 0x%04x\n",
- packet[ 2 ] << 24 | packet[ 3 ] << 16 | packet[ 4 ] << 8 | packet[ 5 ] );
- } else {
- /* unknown */
-
- if( vbi->verbose ) fprintf( stderr, "Unknown XDS packet, class " );
- switch( packet[ 0 ] ) {
- case 0x1: if( vbi->verbose ) fprintf( stderr, "CURRENT start\n" ); break;
- case 0x2: if( vbi->verbose ) fprintf( stderr, "CURRENT continue\n" ); break;
+ if (vbi->verbose)
+ fprintf (stderr, "Network name: '%s'\n", packet + 2);
+ if (vbi->network_name)
+ free (vbi->network_name);
+ vbi->network_name = strdup (packet + 2);
+ /*tvtime_osd_set_network_name( vbi->osd, vbi->network_name ); */
+ } else if (packet[0] == 0x01 && packet[1] == 0x05) {
+ int movie_rating = packet[2] & 7;
+ int scheme = (packet[2] & 56) >> 3;
+ int tv_rating = packet[3] & 7;
+ int VSL = packet[3] & 56;
+ const char *str;
+
+ switch (VSL | scheme) {
+ case 3: /* Canadian English TV */
+ str = cane_tv[tv_rating];
+ break;
+ case 7: /* Canadian French TV */
+ str = canf_tv[tv_rating];
+ break;
+ case 19: /* Reserved */
+ case 31:
+ str = "";
+ break;
+ default:
+ if (((VSL | scheme) & 3) == 1) {
+ /* USA TV */
+ str = usa_tv[tv_rating];
+ } else {
+ /* MPAA Movie Rating */
+ str = movies[movie_rating];
+ }
+ break;
+ }
- case 0x3: if( vbi->verbose ) fprintf( stderr, "FUTURE start\n" ); break;
- case 0x4: if( vbi->verbose ) fprintf( stderr, "FUTURE continue\n" ); break;
+ if (vbi->rating && !strcmp (vbi->rating, str)) {
+ return;
+ }
- case 0x5: if( vbi->verbose ) fprintf( stderr, "CHANNEL start\n" ); break;
- case 0x6: if( vbi->verbose ) fprintf( stderr, "CHANNEL continue\n" ); break;
+ if (vbi->verbose)
+ fprintf (stderr, "Show rating: %s", str);
+ if (((VSL | scheme) & 3) == 1 || ((VSL | scheme) & 3) == 0) {
+ /* show VSLD for the americans */
+ if ((VSL | scheme) & 32) {
+ if (vbi->verbose)
+ fprintf (stderr, " V");
+ }
+ if ((VSL | scheme) & 16) {
+ if (vbi->verbose)
+ fprintf (stderr, " S");
+ }
+ if ((VSL | scheme) & 8) {
+ if (vbi->verbose)
+ fprintf (stderr, " L");
+ }
+ if ((VSL | scheme) & 4) {
+ if (vbi->verbose)
+ fprintf (stderr, " D");
+ }
+ }
+ if (vbi->verbose)
+ fprintf (stderr, "\n");
+ vbi->rating = str;
+ /*tvtime_osd_set_show_rating( vbi->osd, vbi->rating ); */
+ } else if (packet[0] == 0x05 && packet[1] == 0x02) {
+ if (vbi->call_letters && !strcmp (vbi->call_letters, packet + 2)) {
+ return;
+ }
- case 0x7: if( vbi->verbose ) fprintf( stderr, "MISC start\n" ); break;
- case 0x8: if( vbi->verbose ) fprintf( stderr, "MISC continue\n" ); break;
+ if (vbi->verbose)
+ fprintf (stderr, "Network call letters: '%s'\n", packet + 2);
+ if (vbi->call_letters)
+ free (vbi->call_letters);
+ vbi->call_letters = strdup (packet + 2);
+ /*tvtime_osd_set_network_call( vbi->osd, vbi->call_letters ); */
+ } else if (packet[0] == 0x01 && packet[1] == 0x01) {
+ int month = packet[5]; // & 15;
+ int day = packet[4]; // & 31;
+ int hour = packet[3]; // & 31;
+ int min = packet[2]; // & 63;
+ char str[33];
+
+ if (vbi->verbose)
+ fprintf (stderr, "Program Start: %02d %s, %02d:%02d\n",
+ day & 31, months[month & 15], hour & 31, min & 63);
+ // packet[ 3 ], packet[ 4 ], packet[ 5 ], packet[ 6 ] );
+ //packet[ 5 ] & 31, packet[ 6 ], packet[ 4 ] & 31, packet[ 3 ] & 63 );
+ vbi->start_month = month & 15;
+ vbi->start_day = day & 31;
+ vbi->start_hour = hour & 31;
+ vbi->start_min = hour & 63;
+ snprintf (str, 32, "%02d %s, %02d:%02d",
+ day & 31, months[month & 15], hour & 31, min & 63);
+ /*tvtime_osd_set_show_start( vbi->osd, str ); */
+ } else if (packet[0] == 0x01 && packet[1] == 0x04) {
+ if (vbi->verbose)
+ fprintf (stderr, "Program type: ");
+ for (i = 0; i < length - 2; i++) {
+ int cur = packet[2 + i] - 0x20;
+
+ if (cur >= 0 && cur < 96) {
+ if (vbi->verbose)
+ fprintf (stderr, "%s%s", i ? ", " : "", eia608_program_type[cur]);
+ /* this will cause us to keep only the last type we check */
+ vbi->program_type = eia608_program_type[cur];
+ }
+ }
+ if (vbi->verbose)
+ fprintf (stderr, "\n");
+ } else if (packet[0] < 0x03 && packet[1] >= 0x10 && packet[1] <= 0x17) {
- case 0x9: if( vbi->verbose ) fprintf( stderr, "PUB start\n" ); break;
- case 0xa: if( vbi->verbose ) fprintf( stderr, "PUB continue\n" ); break;
+ if (vbi->program_desc[packet[1] & 0xf] &&
+ !strcmp (vbi->program_desc[packet[1] & 0xf], packet + 2)) {
+ return;
+ }
- case 0xb: if( vbi->verbose ) fprintf( stderr, "RES start\n" ); break;
- case 0xc: if( vbi->verbose ) fprintf( stderr, "RES continue\n" ); break;
+ if (vbi->verbose)
+ fprintf (stderr, "Program Description: Line %d", packet[1] & 0xf);
+ if (vbi->verbose)
+ fprintf (stderr, "%s\n", packet + 2);
+ if (vbi->program_desc[packet[1] & 0xf])
+ free (vbi->program_desc[packet[1] & 0xf]);
+ vbi->program_desc[packet[1] & 0xf] = strdup (packet + 2);
+ } else if (packet[0] == 0x01 && packet[1] == 0x02) {
+ char str[33];
+
+ str[0] = 0;
+ if (vbi->verbose)
+ fprintf (stderr, "Program Length: %02d:%02d",
+ packet[3] & 63, packet[2] & 63);
+ vbi->length_hour = packet[3] & 63;
+ vbi->length_min = packet[2] & 63;
+ snprintf (str, 32, "%02d:%02d", packet[3] & 63, packet[2] & 63);
+ if (length > 4) {
+ if (vbi->verbose)
+ fprintf (stderr, " Elapsed: %02d:%02d", packet[5] & 63, packet[4] & 63);
+ vbi->length_elapsed_hour = packet[5] & 63;
+ vbi->length_elapsed_min = packet[4] & 63;
+ snprintf (str, 32, "%02d:%02d/%02d:%02d",
+ packet[5] & 63, packet[4] & 63, packet[3] & 63, packet[2] & 63);
+ } else {
+ vbi->length_elapsed_hour = 0;
+ vbi->length_elapsed_min = 0;
+ }
- case 0xd: if( vbi->verbose ) fprintf( stderr, "UNDEF start\n" ); break;
- case 0xe: if( vbi->verbose ) fprintf( stderr, "UNDEF continue\n" ); break;
- }
- for( i = 0; i < length; i++ ) {
- if( vbi->verbose ) fprintf( stderr, "0x%02x ", packet[ i ] );
- }
- if( vbi->verbose ) fprintf( stderr, "\n" );
+ if (length > 6) {
+ if (vbi->verbose)
+ fprintf (stderr, ".%02d", packet[6] & 63);
+ vbi->length_elapsed_hour = packet[6] & 63;
+ snprintf (str, 32, "%02d:%02d.%02d/%02d:%02d",
+ packet[5] & 63, packet[4] & 63, packet[6] & 63,
+ packet[3] & 63, packet[2] & 63);
+ } else {
+ vbi->length_elapsed_hour = 0;
}
+ /*tvtime_osd_set_show_length( vbi->osd, str ); */
+ if (vbi->verbose)
+ fprintf (stderr, "\n");
+ } else if (packet[0] == 0x05 && packet[1] == 0x04) {
+ if (vbi->verbose)
+ fprintf (stderr, "Transmission Signal Identifier (TSID): 0x%04x\n",
+ packet[2] << 24 | packet[3] << 16 | packet[4] << 8 | packet[5]);
+ } else {
+ /* unknown */
+
+ if (vbi->verbose)
+ fprintf (stderr, "Unknown XDS packet, class ");
+ switch (packet[0]) {
+ case 0x1:
+ if (vbi->verbose)
+ fprintf (stderr, "CURRENT start\n");
+ break;
+ case 0x2:
+ if (vbi->verbose)
+ fprintf (stderr, "CURRENT continue\n");
+ break;
+
+ case 0x3:
+ if (vbi->verbose)
+ fprintf (stderr, "FUTURE start\n");
+ break;
+ case 0x4:
+ if (vbi->verbose)
+ fprintf (stderr, "FUTURE continue\n");
+ break;
+
+ case 0x5:
+ if (vbi->verbose)
+ fprintf (stderr, "CHANNEL start\n");
+ break;
+ case 0x6:
+ if (vbi->verbose)
+ fprintf (stderr, "CHANNEL continue\n");
+ break;
+
+ case 0x7:
+ if (vbi->verbose)
+ fprintf (stderr, "MISC start\n");
+ break;
+ case 0x8:
+ if (vbi->verbose)
+ fprintf (stderr, "MISC continue\n");
+ break;
+
+ case 0x9:
+ if (vbi->verbose)
+ fprintf (stderr, "PUB start\n");
+ break;
+ case 0xa:
+ if (vbi->verbose)
+ fprintf (stderr, "PUB continue\n");
+ break;
+
+ case 0xb:
+ if (vbi->verbose)
+ fprintf (stderr, "RES start\n");
+ break;
+ case 0xc:
+ if (vbi->verbose)
+ fprintf (stderr, "RES continue\n");
+ break;
+
+ case 0xd:
+ if (vbi->verbose)
+ fprintf (stderr, "UNDEF start\n");
+ break;
+ case 0xe:
+ if (vbi->verbose)
+ fprintf (stderr, "UNDEF continue\n");
+ break;
+ }
+ for (i = 0; i < length; i++) {
+ if (vbi->verbose)
+ fprintf (stderr, "0x%02x ", packet[i]);
+ }
+ if (vbi->verbose)
+ fprintf (stderr, "\n");
+ }
}
-static int xds_decode( vbidata_t *vbi, int b1, int b2 )
+static int
+xds_decode (vbidata_t * vbi, int b1, int b2)
{
- if( !vbi ) return 0;
- if( vbi->xds_cursor > 2046 ) {
- vbi->xds_cursor = 0;
- }
+ if (!vbi)
+ return 0;
+ if (vbi->xds_cursor > 2046) {
+ vbi->xds_cursor = 0;
+ }
- if( !vbi->xds_cursor && b1 > 0xf ) {
- return 0;
- }
+ if (!vbi->xds_cursor && b1 > 0xf) {
+ return 0;
+ }
- if( b1 < 0xf && (b1 & 0x2) ) {
- /* ignore the continue and thus 'support' continuation of
- a single packet */
- return 1;
- } else if( b1 < 0xf ) {
- /* kill old packet cause we got a new one */
- vbi->xds_cursor = 0;
- }
+ if (b1 < 0xf && (b1 & 0x2)) {
+ /* ignore the continue and thus 'support' continuation of
+ a single packet */
+ return 1;
+ } else if (b1 < 0xf) {
+ /* kill old packet cause we got a new one */
+ vbi->xds_cursor = 0;
+ }
- vbi->xds_packet[ vbi->xds_cursor ] = b1;
- vbi->xds_packet[ vbi->xds_cursor + 1 ] = b2;
- vbi->xds_cursor += 2;
+ vbi->xds_packet[vbi->xds_cursor] = b1;
+ vbi->xds_packet[vbi->xds_cursor + 1] = b2;
+ vbi->xds_cursor += 2;
- if( b1 == 0xf ) {
- parse_xds_packet( vbi, vbi->xds_packet, vbi->xds_cursor );
- vbi->xds_cursor = 0;
- }
+ if (b1 == 0xf) {
+ parse_xds_packet (vbi, vbi->xds_packet, vbi->xds_cursor);
+ vbi->xds_cursor = 0;
+ }
- return 1;
+ return 1;
}
#define NOMODE 0
@@ -473,33 +553,33 @@ static int xds_decode( vbidata_t *vbi, int b1, int b2 )
#define T3 3
#define T4 4
-const unsigned int colours[] = {
- 0xFFFFFFFFU, /* white */
- 0xFF00FF00U, /* green */
- 0xFF0000FFU, /* blue */
- 0xFF00C7C7U, /* cyan */
- 0xFFFF0000U, /* red */
- 0xFFFFFF00U, /* yellow */
- 0xFFC700C7U /* magenta */
+const unsigned int colours[] = {
+ 0xFFFFFFFFU, /* white */
+ 0xFF00FF00U, /* green */
+ 0xFF0000FFU, /* blue */
+ 0xFF00C7C7U, /* cyan */
+ 0xFFFF0000U, /* red */
+ 0xFFFFFF00U, /* yellow */
+ 0xFFC700C7U /* magenta */
};
const int rows[] = {
- 11,
- 0, /* unused */
- 1,
- 2,
- 3,
- 4,
- 12,
- 13,
- 14,
- 15,
- 5,
- 6,
- 7,
- 8,
- 9,
- 10
+ 11,
+ 0, /* unused */
+ 1,
+ 2,
+ 3,
+ 4,
+ 12,
+ 13,
+ 14,
+ 15,
+ 5,
+ 6,
+ 7,
+ 8,
+ 9,
+ 10
};
#define ROLL_2 6
@@ -509,580 +589,610 @@ const int rows[] = {
#define PAINT_ON 10
-static int Process16b( vbidata_t *vbi, int bottom, int w1 )
+static int
+Process16b (vbidata_t * vbi, int bottom, int w1)
{
- int b1, b2;
+ int b1, b2;
- b1 = w1 & 0x7f;
- b2 = (w1 >> 8) & 0x7f;
+ b1 = w1 & 0x7f;
+ b2 = (w1 >> 8) & 0x7f;
- if( !b1 && !b2 ) {
- return 0;
+ if (!b1 && !b2) {
+ return 0;
+ }
+
+ if (vbi->enabled && b1 >= 0x10 && b1 <= 0x1F && b2 >= 0x20 && b2 <= 0x7F) {
+ int code;
+
+ if ((b2 & 64)) {
+ /* Preamble Code */
+ /* This sets up colors and indenting */
+
+ if (!bottom && vbi->lastcode == ((b1 << 8) | b2)) {
+ vbi->lastcount = (vbi->lastcount + 1) % 2;
+ return 1;
+ }
+
+ vbi->current_chan = (b1 & 8) >> 3;
+ if (!bottom == vbi->wanttop) {
+ if (vbi->chan != vbi->current_chan)
+ return 0;
+ } else
+ return 0;
+
+ vbi->current_ital = (b2 & 1);
+ if (!(b2 & 16)) {
+ vbi->current_colour = colours[(b2 & 30) >> 1];
+ vbi->current_indent = 0;
+ } else {
+ vbi->current_colour = 0xFFFFFFFFU; /* white */
+ vbi->current_indent = 4 * ((b2 & 14) >> 1);
+ }
+ vbi->current_row = rows[((b1 & 7) << 1) | ((b2 & 32) >> 5)];
+ vbi->current_ul = b2 & 1;
+
+ if (vbi->verbose)
+ fprintf (stderr, "field: %d chan %d, ital %d, ul %d, colour 0x%x, "
+ "indent %d, row %d\n", bottom, vbi->current_chan,
+ vbi->current_ital, vbi->current_ul, vbi->current_colour,
+ vbi->current_indent, vbi->current_row);
+
+ if (!bottom == vbi->wanttop &&
+ vbi->current_chan == vbi->chan &&
+ vbi->current_istext == vbi->wanttext) {
+
+ vbi->indent = vbi->current_indent;
+ vbi->ital = vbi->current_ital;
+ vbi->colour = vbi->current_colour;
+ vbi->row = vbi->current_row;
+ vbi->current_istext = 0;
+
+ vbiscreen_new_caption (vbi->vs, vbi->indent, vbi->ital,
+ vbi->colour, vbi->row);
+
+ }
+
+ vbi->lastcode = (b1 << 8) | b2;
+ vbi->lastcount = 0;
+ return 1;
}
- if( vbi->enabled &&
- b1 >= 0x10 && b1 <= 0x1F && b2 >= 0x20 && b2 <= 0x7F ) {
- int code;
- if( (b2 & 64) ) {
- /* Preamble Code */
- /* This sets up colors and indenting */
-
- if( !bottom && vbi->lastcode == ( (b1 << 8) | b2 ) ) {
- vbi->lastcount = (vbi->lastcount + 1) % 2;
- return 1;
- }
-
- vbi->current_chan = (b1 & 8) >> 3;
- if( !bottom == vbi->wanttop ) {
- if( vbi->chan != vbi->current_chan )
- return 0;
- } else return 0;
-
- vbi->current_ital = (b2 & 1);
- if( !(b2 & 16) ) {
- vbi->current_colour = colours[ (b2 & 30) >> 1 ];
- vbi->current_indent = 0;
- } else {
- vbi->current_colour = 0xFFFFFFFFU; /* white */
- vbi->current_indent = 4*( (b2 & 14) >> 1 );
- }
- vbi->current_row = rows[ ((b1 & 7) << 1) | ((b2 & 32) >> 5) ];
- vbi->current_ul = b2 & 1;
-
- if( vbi->verbose ) fprintf( stderr, "field: %d chan %d, ital %d, ul %d, colour 0x%x, "
- "indent %d, row %d\n", bottom, vbi->current_chan,
- vbi->current_ital, vbi->current_ul, vbi->current_colour,
- vbi->current_indent, vbi->current_row );
-
- if( !bottom == vbi->wanttop &&
- vbi->current_chan == vbi->chan &&
- vbi->current_istext == vbi->wanttext ) {
-
- vbi->indent = vbi->current_indent;
- vbi->ital = vbi->current_ital;
- vbi->colour = vbi->current_colour;
- vbi->row = vbi->current_row;
- vbi->current_istext = 0;
-
- vbiscreen_new_caption( vbi->vs, vbi->indent, vbi->ital,
- vbi->colour, vbi->row );
-
- }
-
- vbi->lastcode = ( b1 << 8) | b2;
- vbi->lastcount = 0;
- return 1;
- }
-
- if( (b1 & 8) == 1 ) {
- /* Midrow code */
- if( !vbi->initialised ) return 0;
-
- if( !bottom && vbi->lastcode == ( (b1 << 8) | b2 ) ) {
- vbi->lastcount = (vbi->lastcount + 1) % 2;
- return 1;
- }
-
- if( vbi->verbose ) fprintf( stderr, "Midrow TODO: Add me.\n" );
-
- vbi->lastcode = ( b1 << 8) | b2;
- return 1;
- }
-
- if( (b1 & 2) && !(b2 & 64) ) {
- if( !vbi->initialised ) return 0;
-
- if( !bottom && vbi->lastcode == ( (b1 << 8) | b2 ) ) {
- vbi->lastcount = (vbi->lastcount + 1) % 2;
- return 1;
- }
-
- if( vbi->verbose ) fprintf( stderr, "Tab Offset: %d columns\n", b2 & 3 );
- if( vbi->wanttext && vbi->current_istext &&
- vbi->current_chan == vbi->chan && !bottom == vbi->wanttop ) {
- vbiscreen_tab( vbi->vs, b2 & 3 );
- }
- vbi->lastcode = ( b1 << 8) | b2;
- return 1;
- }
-
- switch( (code = b2 & 15) ) {
- case 0: /* POP-UP */
- case 5: /* ROLL UP 2 */
- case 6: /* ROLL UP 3 */
- case 7: /* ROLL UP 4 */
- case 9: /* PAINT-ON */
- case 10:/* TEXT */
- case 11:/* TEXT */
- vbi->initialised = 1;
- if( !bottom && vbi->lastcode == ( (b1 << 8) | b2 ) ) {
- /* This is the repeated Control Code */
- vbi->lastcount = (vbi->lastcount + 1) % 2;
- return 1;
- }
- switch( code ) {
- case 0: /* POP-UP */
- if( !vbi->wanttext && vbi->current_chan == vbi->chan &&
- !bottom == vbi->wanttop ) {
- if( vbi->verbose )
- fprintf( stderr, "Pop-Up\n");
- vbi->indent = vbi->current_indent;
- vbi->ital = vbi->current_ital;
- vbi->colour = vbi->current_colour;
- vbi->row = vbi->current_row;
- vbi->current_istext = 0;
- vbiscreen_set_mode( vbi->vs, 1, POP_UP );
- }
- break;
- case 5: /* ROLL UP 2 */
- if( !vbi->wanttext && vbi->current_chan == vbi->chan &&
- !bottom == vbi->wanttop ) {
- if( vbi->verbose )
- fprintf( stderr, "Roll-Up 2 (RU2)\n");
- vbi->indent = vbi->current_indent;
- vbi->ital = vbi->current_ital;
- vbi->colour = vbi->current_colour;
- vbi->row = vbi->current_row;
- vbi->current_istext = 0;
- vbiscreen_set_mode( vbi->vs, 1, ROLL_2 );
- }
- break;
- case 6: /* ROLL UP 3 */
- if( !vbi->wanttext && vbi->current_chan == vbi->chan &&
- !bottom == vbi->wanttop ) {
- if( vbi->verbose )
- fprintf( stderr, "Roll-Up 3 (RU3)\n");
- vbi->indent = vbi->current_indent;
- vbi->ital = vbi->current_ital;
- vbi->colour = vbi->current_colour;
- vbi->row = vbi->current_row;
- vbi->current_istext = 0;
- vbiscreen_set_mode( vbi->vs, 1, ROLL_3 );
- }
- break;
- case 7: /* ROLL UP 4 */
- if( !vbi->wanttext && vbi->current_chan == vbi->chan &&
- !bottom == vbi->wanttop ) {
- if( vbi->verbose )
- fprintf( stderr, "Roll-Up 4 (RU4)\n");
- vbi->indent = vbi->current_indent;
- vbi->ital = vbi->current_ital;
- vbi->colour = vbi->current_colour;
- vbi->row = vbi->current_row;
- vbi->current_istext = 0;
- vbiscreen_set_mode( vbi->vs, 1, ROLL_4 );
- }
- break;
- case 9: /* PAINT-ON */
- if( !vbi->wanttext && vbi->current_chan == vbi->chan &&
- !bottom == vbi->wanttop ) {
- if( vbi->verbose )
- fprintf( stderr, "Paint-On\n");
- vbi->indent = vbi->current_indent;
- vbi->ital = vbi->current_ital;
- vbi->colour = vbi->current_colour;
- vbi->row = vbi->current_row;
- vbi->current_istext = 0;
- vbiscreen_set_mode( vbi->vs, 1, PAINT_ON );
- }
- break;
- case 10:/* TEXT */
- if( vbi->wanttext && vbi->current_chan == vbi->chan &&
- !bottom == vbi->wanttop ) {
- if( vbi->verbose )
- fprintf( stderr, "Text Restart\n");
- vbi->indent = vbi->current_indent;
- vbi->ital = vbi->current_ital;
- vbi->colour = vbi->current_colour;
- vbi->row = vbi->current_row;
- vbi->current_istext = 1;
- vbiscreen_set_mode( vbi->vs, 0, 0 );
- }
- break;
- case 11:/* TEXT */
- if( vbi->wanttext && vbi->current_chan == vbi->chan &&
- !bottom == vbi->wanttop ) {
- if( vbi->verbose )
- fprintf( stderr, "Resume Text Display\n");
- vbi->indent = vbi->current_indent;
- vbi->ital = vbi->current_ital;
- vbi->colour = vbi->current_colour;
- vbi->row = vbi->current_row;
- vbi->current_istext = 1;
- vbiscreen_set_mode( vbi->vs, 0, 0 );
- }
- break;
- default: /* impossible */
- break;
- }
- break;
- case 1:
- if( !vbi->initialised ) return 0;
- if( !bottom && vbi->lastcode == ( (b1 << 8) | b2 ) ) {
- vbi->lastcount = (vbi->lastcount + 1) % 2;
- }
- if( !bottom == vbi->wanttop && vbi->current_chan == vbi->chan &&
- vbi->current_istext == vbi->wanttext ) {
- if( vbi->verbose )
- fprintf( stderr, "Backspace\n");
- vbiscreen_backspace( vbi->vs );
- }
- break;
- case 2:
- case 3:
- if( !vbi->initialised ) return 0;
- fprintf( stderr, "Reserved\n");
- break;
- case 4:
- if( !vbi->initialised ) return 0;
- if( !bottom && vbi->lastcode == ( (b1 << 8) | b2 ) ) {
- vbi->lastcount = (vbi->lastcount + 1) % 2;
- }
- if( !bottom == vbi->wanttop && vbi->current_chan == vbi->chan &&
- vbi->current_istext == vbi->wanttext ) {
- if( vbi->verbose )
- fprintf( stderr, "Delete to End of Row\n");
- vbiscreen_delete_to_end( vbi->vs );
- }
- break;
- case 8:
- if( !vbi->initialised ) return 0;
- if( vbi->verbose )
- fprintf( stderr, "Flash On\n");
- break;
- case 12:
- case 13:
- case 14:
- case 15:
- if( !vbi->initialised ) return 0;
- if( !bottom && vbi->lastcode == ( (b1 << 8) | b2 ) ) {
- vbi->lastcount = (vbi->lastcount + 1) % 2;
- return 1;
- }
-
- switch( code ) {
- case 12:
- /* Show buffer 1, Fill buffer 2 */
- if( !bottom == vbi->wanttop &&
- vbi->current_chan == vbi->chan &&
- vbi->current_istext == vbi->wanttext ) {
- if( vbi->verbose )
- fprintf( stderr, "Erase Displayed Memory\n");
- vbiscreen_erase_displayed( vbi->vs );
- }
- break;
- case 13:
- if( !bottom == vbi->wanttop &&
- vbi->current_chan == vbi->chan &&
- vbi->current_istext == vbi->wanttext ) {
- if( vbi->verbose )
- fprintf( stderr, "Carriage Return\n");
- vbiscreen_carriage_return( vbi->vs );
- }
- break;
- case 14:
- if( !bottom == vbi->wanttop &&
- vbi->current_chan == vbi->chan &&
- vbi->current_istext == vbi->wanttext ) {
- if( vbi->verbose )
- fprintf( stderr, "Erase Non-Displayed\n");
- vbiscreen_erase_non_displayed( vbi->vs );
- }
- break;
- case 15:
- /* Show buffer 2, Fill Buffer 1 */
- if( !bottom == vbi->wanttop &&
- vbi->current_chan == vbi->chan &&
- vbi->current_istext == vbi->wanttext ) {
- if( vbi->verbose )
- fprintf( stderr, "End Of Caption\n");
- vbiscreen_end_of_caption( vbi->vs );
- }
- break;
- default: /* impossible */
- return 0;
- break;
- }
- break;
- default: /* Impossible */
- return 0;
- break;
- }
-
- if( vbi->lastcode != ((b1 << 8) | b2) ) {
- vbi->lastcount = 0;
- }
-
- vbi->lastcode = (b1 << 8) | b2;
- return 1;
- }
+ if ((b1 & 8) == 1) {
+ /* Midrow code */
+ if (!vbi->initialised)
+ return 0;
- if( bottom && xds_decode( vbi, b1, b2 ) ) {
- return 1;
- }
+ if (!bottom && vbi->lastcode == ((b1 << 8) | b2)) {
+ vbi->lastcount = (vbi->lastcount + 1) % 2;
+ return 1;
+ }
- if( !vbi->enabled ) return 0;
+ if (vbi->verbose)
+ fprintf (stderr, "Midrow TODO: Add me.\n");
- vbi->lastcode = 0;
- vbi->lastcount = 0;
+ vbi->lastcode = (b1 << 8) | b2;
+ return 1;
+ }
- if( !vbi->initialised )
- return 0;
+ if ((b1 & 2) && !(b2 & 64)) {
+ if (!vbi->initialised)
+ return 0;
+
+ if (!bottom && vbi->lastcode == ((b1 << 8) | b2)) {
+ vbi->lastcount = (vbi->lastcount + 1) % 2;
+ return 1;
+ }
+
+ if (vbi->verbose)
+ fprintf (stderr, "Tab Offset: %d columns\n", b2 & 3);
+ if (vbi->wanttext && vbi->current_istext &&
+ vbi->current_chan == vbi->chan && !bottom == vbi->wanttop) {
+ vbiscreen_tab (vbi->vs, b2 & 3);
+ }
+ vbi->lastcode = (b1 << 8) | b2;
+ return 1;
+ }
- if( !bottom != vbi->wanttop || vbi->current_chan != vbi->chan ||
- vbi->current_istext != vbi->wanttext ) {
- return 0;
+ switch ((code = b2 & 15)) {
+ case 0: /* POP-UP */
+ case 5: /* ROLL UP 2 */
+ case 6: /* ROLL UP 3 */
+ case 7: /* ROLL UP 4 */
+ case 9: /* PAINT-ON */
+ case 10: /* TEXT */
+ case 11: /* TEXT */
+ vbi->initialised = 1;
+ if (!bottom && vbi->lastcode == ((b1 << 8) | b2)) {
+ /* This is the repeated Control Code */
+ vbi->lastcount = (vbi->lastcount + 1) % 2;
+ return 1;
+ }
+ switch (code) {
+ case 0: /* POP-UP */
+ if (!vbi->wanttext && vbi->current_chan == vbi->chan &&
+ !bottom == vbi->wanttop) {
+ if (vbi->verbose)
+ fprintf (stderr, "Pop-Up\n");
+ vbi->indent = vbi->current_indent;
+ vbi->ital = vbi->current_ital;
+ vbi->colour = vbi->current_colour;
+ vbi->row = vbi->current_row;
+ vbi->current_istext = 0;
+ vbiscreen_set_mode (vbi->vs, 1, POP_UP);
+ }
+ break;
+ case 5: /* ROLL UP 2 */
+ if (!vbi->wanttext && vbi->current_chan == vbi->chan &&
+ !bottom == vbi->wanttop) {
+ if (vbi->verbose)
+ fprintf (stderr, "Roll-Up 2 (RU2)\n");
+ vbi->indent = vbi->current_indent;
+ vbi->ital = vbi->current_ital;
+ vbi->colour = vbi->current_colour;
+ vbi->row = vbi->current_row;
+ vbi->current_istext = 0;
+ vbiscreen_set_mode (vbi->vs, 1, ROLL_2);
+ }
+ break;
+ case 6: /* ROLL UP 3 */
+ if (!vbi->wanttext && vbi->current_chan == vbi->chan &&
+ !bottom == vbi->wanttop) {
+ if (vbi->verbose)
+ fprintf (stderr, "Roll-Up 3 (RU3)\n");
+ vbi->indent = vbi->current_indent;
+ vbi->ital = vbi->current_ital;
+ vbi->colour = vbi->current_colour;
+ vbi->row = vbi->current_row;
+ vbi->current_istext = 0;
+ vbiscreen_set_mode (vbi->vs, 1, ROLL_3);
+ }
+ break;
+ case 7: /* ROLL UP 4 */
+ if (!vbi->wanttext && vbi->current_chan == vbi->chan &&
+ !bottom == vbi->wanttop) {
+ if (vbi->verbose)
+ fprintf (stderr, "Roll-Up 4 (RU4)\n");
+ vbi->indent = vbi->current_indent;
+ vbi->ital = vbi->current_ital;
+ vbi->colour = vbi->current_colour;
+ vbi->row = vbi->current_row;
+ vbi->current_istext = 0;
+ vbiscreen_set_mode (vbi->vs, 1, ROLL_4);
+ }
+ break;
+ case 9: /* PAINT-ON */
+ if (!vbi->wanttext && vbi->current_chan == vbi->chan &&
+ !bottom == vbi->wanttop) {
+ if (vbi->verbose)
+ fprintf (stderr, "Paint-On\n");
+ vbi->indent = vbi->current_indent;
+ vbi->ital = vbi->current_ital;
+ vbi->colour = vbi->current_colour;
+ vbi->row = vbi->current_row;
+ vbi->current_istext = 0;
+ vbiscreen_set_mode (vbi->vs, 1, PAINT_ON);
+ }
+ break;
+ case 10: /* TEXT */
+ if (vbi->wanttext && vbi->current_chan == vbi->chan &&
+ !bottom == vbi->wanttop) {
+ if (vbi->verbose)
+ fprintf (stderr, "Text Restart\n");
+ vbi->indent = vbi->current_indent;
+ vbi->ital = vbi->current_ital;
+ vbi->colour = vbi->current_colour;
+ vbi->row = vbi->current_row;
+ vbi->current_istext = 1;
+ vbiscreen_set_mode (vbi->vs, 0, 0);
+ }
+ break;
+ case 11: /* TEXT */
+ if (vbi->wanttext && vbi->current_chan == vbi->chan &&
+ !bottom == vbi->wanttop) {
+ if (vbi->verbose)
+ fprintf (stderr, "Resume Text Display\n");
+ vbi->indent = vbi->current_indent;
+ vbi->ital = vbi->current_ital;
+ vbi->colour = vbi->current_colour;
+ vbi->row = vbi->current_row;
+ vbi->current_istext = 1;
+ vbiscreen_set_mode (vbi->vs, 0, 0);
+ }
+ break;
+ default: /* impossible */
+ break;
+ }
+ break;
+ case 1:
+ if (!vbi->initialised)
+ return 0;
+ if (!bottom && vbi->lastcode == ((b1 << 8) | b2)) {
+ vbi->lastcount = (vbi->lastcount + 1) % 2;
+ }
+ if (!bottom == vbi->wanttop && vbi->current_chan == vbi->chan &&
+ vbi->current_istext == vbi->wanttext) {
+ if (vbi->verbose)
+ fprintf (stderr, "Backspace\n");
+ vbiscreen_backspace (vbi->vs);
+ }
+ break;
+ case 2:
+ case 3:
+ if (!vbi->initialised)
+ return 0;
+ fprintf (stderr, "Reserved\n");
+ break;
+ case 4:
+ if (!vbi->initialised)
+ return 0;
+ if (!bottom && vbi->lastcode == ((b1 << 8) | b2)) {
+ vbi->lastcount = (vbi->lastcount + 1) % 2;
+ }
+ if (!bottom == vbi->wanttop && vbi->current_chan == vbi->chan &&
+ vbi->current_istext == vbi->wanttext) {
+ if (vbi->verbose)
+ fprintf (stderr, "Delete to End of Row\n");
+ vbiscreen_delete_to_end (vbi->vs);
+ }
+ break;
+ case 8:
+ if (!vbi->initialised)
+ return 0;
+ if (vbi->verbose)
+ fprintf (stderr, "Flash On\n");
+ break;
+ case 12:
+ case 13:
+ case 14:
+ case 15:
+ if (!vbi->initialised)
+ return 0;
+ if (!bottom && vbi->lastcode == ((b1 << 8) | b2)) {
+ vbi->lastcount = (vbi->lastcount + 1) % 2;
+ return 1;
+ }
+
+ switch (code) {
+ case 12:
+ /* Show buffer 1, Fill buffer 2 */
+ if (!bottom == vbi->wanttop &&
+ vbi->current_chan == vbi->chan &&
+ vbi->current_istext == vbi->wanttext) {
+ if (vbi->verbose)
+ fprintf (stderr, "Erase Displayed Memory\n");
+ vbiscreen_erase_displayed (vbi->vs);
+ }
+ break;
+ case 13:
+ if (!bottom == vbi->wanttop &&
+ vbi->current_chan == vbi->chan &&
+ vbi->current_istext == vbi->wanttext) {
+ if (vbi->verbose)
+ fprintf (stderr, "Carriage Return\n");
+ vbiscreen_carriage_return (vbi->vs);
+ }
+ break;
+ case 14:
+ if (!bottom == vbi->wanttop &&
+ vbi->current_chan == vbi->chan &&
+ vbi->current_istext == vbi->wanttext) {
+ if (vbi->verbose)
+ fprintf (stderr, "Erase Non-Displayed\n");
+ vbiscreen_erase_non_displayed (vbi->vs);
+ }
+ break;
+ case 15:
+ /* Show buffer 2, Fill Buffer 1 */
+ if (!bottom == vbi->wanttop &&
+ vbi->current_chan == vbi->chan &&
+ vbi->current_istext == vbi->wanttext) {
+ if (vbi->verbose)
+ fprintf (stderr, "End Of Caption\n");
+ vbiscreen_end_of_caption (vbi->vs);
+ }
+ break;
+ default: /* impossible */
+ return 0;
+ break;
+ }
+ break;
+ default: /* Impossible */
+ return 0;
+ break;
}
- if( b1 == 0x11 || b1 == 0x19 ||
- b1 == 0x12 || b1 == 0x13 ||
- b1 == 0x1A || b1 == 0x1B ) {
- switch( b1 ) {
- case 0x1A:
- case 0x12:
- /* use extcode1 */
- if( b1 > 31 && b2 > 31 && b1 <= 0x3F && b2 <= 0x3F )
- if( vbi->verbose )
- fprintf( stderr, "char %d (%c), char %d (%c)\n", b1,
- extcode1[b1-32] , b2, extcode1[b2-32] );
-
- break;
- case 0x13:
- case 0x1B:
- /* use extcode2 */
- if( b1 > 31 && b2 > 31 && b1 <= 0x3F && b2 <= 0x3F )
- if( vbi->verbose )
- fprintf( stderr, "char %d (%c), char %d (%c)\n", b1,
- extcode2[b1-32] , b2, extcode2[b2-32] );
-
- break;
- case 0x11:
- case 0x19:
- /* use wcode */
- if( b1 > 31 && b2 > 31 && b1 <= 0x3F && b2 <= 0x3F )
- if( vbi->verbose )
- fprintf( stderr, "char %d (%c), char %d (%c)\n", b1,
- wccode[b1-32] , b2, wccode[b2-32] );
-
- break;
- default:
- break;
- }
- } else if( b1 ) {
- /* use ccode */
- if( b1 < 32 ) b1 = 32;
- if( b2 < 32 ) b2 = 32;
- if( vbi->verbose )
- fprintf( stderr, "vbidata: data: %c %c\n", ccode[b1-32],
- ccode[b2-32] );
- vbiscreen_print( vbi->vs, ccode[b1-32], ccode[b2-32] );
+ if (vbi->lastcode != ((b1 << 8) | b2)) {
+ vbi->lastcount = 0;
}
+ vbi->lastcode = (b1 << 8) | b2;
+ return 1;
+ }
+ if (bottom && xds_decode (vbi, b1, b2)) {
return 1;
+ }
+
+ if (!vbi->enabled)
+ return 0;
+
+ vbi->lastcode = 0;
+ vbi->lastcount = 0;
+
+ if (!vbi->initialised)
+ return 0;
+
+ if (!bottom != vbi->wanttop || vbi->current_chan != vbi->chan ||
+ vbi->current_istext != vbi->wanttext) {
+ return 0;
+ }
+
+ if (b1 == 0x11 || b1 == 0x19 ||
+ b1 == 0x12 || b1 == 0x13 || b1 == 0x1A || b1 == 0x1B) {
+ switch (b1) {
+ case 0x1A:
+ case 0x12:
+ /* use extcode1 */
+ if (b1 > 31 && b2 > 31 && b1 <= 0x3F && b2 <= 0x3F)
+ if (vbi->verbose)
+ fprintf (stderr, "char %d (%c), char %d (%c)\n", b1,
+ extcode1[b1 - 32], b2, extcode1[b2 - 32]);
+
+ break;
+ case 0x13:
+ case 0x1B:
+ /* use extcode2 */
+ if (b1 > 31 && b2 > 31 && b1 <= 0x3F && b2 <= 0x3F)
+ if (vbi->verbose)
+ fprintf (stderr, "char %d (%c), char %d (%c)\n", b1,
+ extcode2[b1 - 32], b2, extcode2[b2 - 32]);
+
+ break;
+ case 0x11:
+ case 0x19:
+ /* use wcode */
+ if (b1 > 31 && b2 > 31 && b1 <= 0x3F && b2 <= 0x3F)
+ if (vbi->verbose)
+ fprintf (stderr, "char %d (%c), char %d (%c)\n", b1,
+ wccode[b1 - 32], b2, wccode[b2 - 32]);
+
+ break;
+ default:
+ break;
+ }
+ } else if (b1) {
+ /* use ccode */
+ if (b1 < 32)
+ b1 = 32;
+ if (b2 < 32)
+ b2 = 32;
+ if (vbi->verbose)
+ fprintf (stderr, "vbidata: data: %c %c\n", ccode[b1 - 32],
+ ccode[b2 - 32]);
+ vbiscreen_print (vbi->vs, ccode[b1 - 32], ccode[b2 - 32]);
+ }
+
+
+ return 1;
} /* Process16b */
-int ProcessLine( vbidata_t *vbi, unsigned char *s, int bottom )
+int
+ProcessLine (vbidata_t * vbi, unsigned char *s, int bottom)
{
- int w1;
- /*char *outbuf = NULL;*/
+ int w1;
- if( !vbi ) return 0;
+ /*char *outbuf = NULL; */
- w1 = ccdecode(s);
+ if (!vbi)
+ return 0;
- return Process16b(vbi, bottom, w1);
+ w1 = ccdecode (s);
+
+ return Process16b (vbi, bottom, w1);
} /* ProcessLine */
-vbidata_t *vbidata_new_file( const char *filename, vbiscreen_t *vs,
- /*tvtime_osd_t* osd,*/ int verbose )
+vbidata_t *
+vbidata_new_file (const char *filename, vbiscreen_t * vs,
+ /*tvtime_osd_t* osd, */ int verbose)
{
- vbidata_t *vbi = (vbidata_t *) malloc( sizeof( vbidata_t ) );
- if( !vbi ) {
- return 0;
- }
+ vbidata_t *vbi = (vbidata_t *) malloc (sizeof (vbidata_t));
- vbi->fd = open( filename, O_RDONLY );
- if( vbi->fd < 0 ) {
- fprintf( stderr, "vbidata: Can't open %s: %s\n",
- filename, strerror( errno ) );
- free( vbi );
- return 0;
- }
+ if (!vbi) {
+ return 0;
+ }
+
+ vbi->fd = open (filename, O_RDONLY);
+ if (vbi->fd < 0) {
+ fprintf (stderr, "vbidata: Can't open %s: %s\n",
+ filename, strerror (errno));
+ free (vbi);
+ return 0;
+ }
- vbi->vs = vs;
- /*vbi->osd = osd;*/
- vbi->verbose = verbose;
+ vbi->vs = vs;
+ /*vbi->osd = osd; */
+ vbi->verbose = verbose;
- vbidata_reset( vbi );
+ vbidata_reset (vbi);
- return vbi;
+ return vbi;
}
-vbidata_t *vbidata_new_line( vbiscreen_t *vs, int verbose )
+vbidata_t *
+vbidata_new_line (vbiscreen_t * vs, int verbose)
{
- vbidata_t *vbi = (vbidata_t *) malloc( sizeof( vbidata_t ) );
- if( !vbi ) {
- return 0;
- }
+ vbidata_t *vbi = (vbidata_t *) malloc (sizeof (vbidata_t));
+
+ if (!vbi) {
+ return 0;
+ }
- vbi->vs = vs;
- /*vbi->osd = osd;*/
- vbi->verbose = verbose;
+ vbi->vs = vs;
+ /*vbi->osd = osd; */
+ vbi->verbose = verbose;
- vbidata_reset( vbi );
+ vbidata_reset (vbi);
- return vbi;
+ return vbi;
}
-void vbidata_delete( vbidata_t *vbi )
+void
+vbidata_delete (vbidata_t * vbi)
{
- if( !vbi ) return;
- if( vbi->fd != 0 ) {
- close( vbi->fd );
- }
- free( vbi );
+ if (!vbi)
+ return;
+ if (vbi->fd != 0) {
+ close (vbi->fd);
+ }
+ free (vbi);
}
-void vbidata_reset( vbidata_t *vbi )
+void
+vbidata_reset (vbidata_t * vbi)
{
- if( !vbi ) return;
-
- vbi->wanttop = 0;
- vbi->wanttext = 0;
- vbi->colour = 0xFFFFFFFFU;
- vbi->row = 0;
-
- vbi->ital = 0;
- vbi->indent = 0;
- vbi->ul=0;
-
- vbi->chan=0;
-
- vbi->initialised = 0;
- vbi->enabled = 0;
-
- memset(vbi->program_desc, 0, 8*sizeof(char*) );
- vbi->program_name = NULL;
- vbi->network_name = NULL;
- vbi->call_letters = NULL;
- vbi->rating = NULL;
- vbi->program_type = NULL;
-
- vbi->start_day = 0;
- vbi->start_month = 0;
- vbi->start_min = 0;
- vbi->start_hour = 0;
- vbi->length_hour = 0;
- vbi->length_min = 0;
- vbi->length_elapsed_hour = 0;
- vbi->length_elapsed_min = 0;
- vbi->length_elapsed_sec = 0;
-
- /*
- tvtime_osd_set_network_call( vbi->osd, "" );
- tvtime_osd_set_network_name( vbi->osd, "" );
- tvtime_osd_set_show_name( vbi->osd, "" );
- tvtime_osd_set_show_rating( vbi->osd, "" );
- tvtime_osd_set_show_start( vbi->osd, "" );
- tvtime_osd_set_show_length( vbi->osd, "" );
- */
-
-
-
- vbi->lastcode = 0;
- vbi->lastcount = 0;
- vbi->xds_packet[ 0 ] = 0;
- vbi->xds_cursor = 0;
- vbiscreen_reset( vbi->vs );
+ if (!vbi)
+ return;
+
+ vbi->wanttop = 0;
+ vbi->wanttext = 0;
+ vbi->colour = 0xFFFFFFFFU;
+ vbi->row = 0;
+
+ vbi->ital = 0;
+ vbi->indent = 0;
+ vbi->ul = 0;
+
+ vbi->chan = 0;
+
+ vbi->initialised = 0;
+ vbi->enabled = 0;
+
+ memset (vbi->program_desc, 0, 8 * sizeof (char *));
+ vbi->program_name = NULL;
+ vbi->network_name = NULL;
+ vbi->call_letters = NULL;
+ vbi->rating = NULL;
+ vbi->program_type = NULL;
+
+ vbi->start_day = 0;
+ vbi->start_month = 0;
+ vbi->start_min = 0;
+ vbi->start_hour = 0;
+ vbi->length_hour = 0;
+ vbi->length_min = 0;
+ vbi->length_elapsed_hour = 0;
+ vbi->length_elapsed_min = 0;
+ vbi->length_elapsed_sec = 0;
+
+ /*
+ tvtime_osd_set_network_call( vbi->osd, "" );
+ tvtime_osd_set_network_name( vbi->osd, "" );
+ tvtime_osd_set_show_name( vbi->osd, "" );
+ tvtime_osd_set_show_rating( vbi->osd, "" );
+ tvtime_osd_set_show_start( vbi->osd, "" );
+ tvtime_osd_set_show_length( vbi->osd, "" );
+ */
+
+
+
+ vbi->lastcode = 0;
+ vbi->lastcount = 0;
+ vbi->xds_packet[0] = 0;
+ vbi->xds_cursor = 0;
+ vbiscreen_reset (vbi->vs);
}
-void vbidata_set_verbose( vbidata_t *vbi, int verbose )
+void
+vbidata_set_verbose (vbidata_t * vbi, int verbose)
{
- vbi->verbose = verbose;
+ vbi->verbose = verbose;
}
-void vbidata_capture_mode( vbidata_t *vbi, int mode )
+void
+vbidata_capture_mode (vbidata_t * vbi, int mode)
{
- if( !vbi ) return;
- switch( mode ) {
+ if (!vbi)
+ return;
+ switch (mode) {
case CAPTURE_OFF:
- vbi->enabled = 0;
- break;
+ vbi->enabled = 0;
+ break;
case CAPTURE_CC1:
- vbi->wanttop = 1;
- vbi->wanttext = 0;
- vbi->chan = 0;
- vbi->enabled = 1;
- break;
+ vbi->wanttop = 1;
+ vbi->wanttext = 0;
+ vbi->chan = 0;
+ vbi->enabled = 1;
+ break;
case CAPTURE_CC2:
- vbi->wanttop = 1;
- vbi->wanttext = 0;
- vbi->chan = 1;
- vbi->enabled = 1;
- break;
+ vbi->wanttop = 1;
+ vbi->wanttext = 0;
+ vbi->chan = 1;
+ vbi->enabled = 1;
+ break;
case CAPTURE_CC3:
- vbi->wanttop = 0;
- vbi->wanttext = 0;
- vbi->chan = 0;
- vbi->enabled = 1;
- break;
+ vbi->wanttop = 0;
+ vbi->wanttext = 0;
+ vbi->chan = 0;
+ vbi->enabled = 1;
+ break;
case CAPTURE_CC4:
- vbi->wanttop = 0;
- vbi->wanttext = 0;
- vbi->chan = 1;
- vbi->enabled = 1;
- break;
+ vbi->wanttop = 0;
+ vbi->wanttext = 0;
+ vbi->chan = 1;
+ vbi->enabled = 1;
+ break;
case CAPTURE_T1:
- vbi->wanttop = 1;
- vbi->wanttext = 1;
- vbi->chan = 0;
- vbi->enabled = 1;
- break;
+ vbi->wanttop = 1;
+ vbi->wanttext = 1;
+ vbi->chan = 0;
+ vbi->enabled = 1;
+ break;
case CAPTURE_T2:
- vbi->wanttop = 1;
- vbi->wanttext = 1;
- vbi->chan = 1;
- vbi->enabled = 1;
- break;
+ vbi->wanttop = 1;
+ vbi->wanttext = 1;
+ vbi->chan = 1;
+ vbi->enabled = 1;
+ break;
case CAPTURE_T3:
- vbi->wanttop = 0;
- vbi->wanttext = 1;
- vbi->chan = 0;
- vbi->enabled = 1;
- break;
+ vbi->wanttop = 0;
+ vbi->wanttext = 1;
+ vbi->chan = 0;
+ vbi->enabled = 1;
+ break;
case CAPTURE_T4:
- vbi->wanttop = 0;
- vbi->wanttext = 1;
- vbi->chan = 1;
- vbi->enabled = 1;
- break;
+ vbi->wanttop = 0;
+ vbi->wanttext = 1;
+ vbi->chan = 1;
+ vbi->enabled = 1;
+ break;
default:
- vbi->enabled = 0;
- break;
- }
+ vbi->enabled = 0;
+ break;
+ }
}
-void vbidata_process_frame( vbidata_t *vbi, int printdebug )
+void
+vbidata_process_frame (vbidata_t * vbi, int printdebug)
{
- if( read( vbi->fd, vbi->buf, 65536 ) < 65536 ) {
- fprintf( stderr, "error, can't read vbi data.\n" );
- return;
- }
+ if (read (vbi->fd, vbi->buf, 65536) < 65536) {
+ fprintf (stderr, "error, can't read vbi data.\n");
+ return;
+ }
- ProcessLine( vbi, &vbi->buf[ DO_LINE*2048 ], 0 );
- ProcessLine( vbi, &vbi->buf[ (16+DO_LINE)*2048 ], 1 );
+ ProcessLine (vbi, &vbi->buf[DO_LINE * 2048], 0);
+ ProcessLine (vbi, &vbi->buf[(16 + DO_LINE) * 2048], 1);
}
-void vbidata_process_line( vbidata_t *vbi, unsigned char *s, int bottom)
+void
+vbidata_process_line (vbidata_t * vbi, unsigned char *s, int bottom)
{
- ProcessLine( vbi, s, bottom );
+ ProcessLine (vbi, s, bottom);
}
-void vbidata_process_16b( vbidata_t *vbi, int bottom, int w)
+void
+vbidata_process_16b (vbidata_t * vbi, int bottom, int w)
{
- Process16b( vbi, bottom, w );
+ Process16b (vbi, bottom, w);
}
-
diff --git a/gst/vbidec/vbidata.h b/gst/vbidec/vbidata.h
index 66b2cc3cc..78d902afc 100644
--- a/gst/vbidec/vbidata.h
+++ b/gst/vbidec/vbidata.h
@@ -44,16 +44,16 @@ typedef struct vbidata_s vbidata_t;
#define CAPTURE_T3 8
#define CAPTURE_T4 9
-vbidata_t *vbidata_new_file( const char *filename, vbiscreen_t *vs,
- /*tvtime_osd_t* osd,*/ int verbose );
-vbidata_t *vbidata_new_line( vbiscreen_t *vs, int verbose );
+vbidata_t *vbidata_new_file (const char *filename, vbiscreen_t * vs,
+ /*tvtime_osd_t* osd, */ int verbose);
+vbidata_t *vbidata_new_line (vbiscreen_t * vs, int verbose);
-void vbidata_delete( vbidata_t *vbi );
-void vbidata_reset( vbidata_t *vbi );
-void vbidata_set_verbose( vbidata_t *vbi, int verbose );
-void vbidata_capture_mode( vbidata_t *vbi, int mode );
-void vbidata_process_frame( vbidata_t *vbi, int printdebug );
-void vbidata_process_line( vbidata_t *vbi, unsigned char *s, int bottom );
-void vbidata_process_16b( vbidata_t *vbi, int bottom, int w );
+void vbidata_delete (vbidata_t * vbi);
+void vbidata_reset (vbidata_t * vbi);
+void vbidata_set_verbose (vbidata_t * vbi, int verbose);
+void vbidata_capture_mode (vbidata_t * vbi, int mode);
+void vbidata_process_frame (vbidata_t * vbi, int printdebug);
+void vbidata_process_line (vbidata_t * vbi, unsigned char *s, int bottom);
+void vbidata_process_16b (vbidata_t * vbi, int bottom, int w);
#endif /* VBIDATA_H_INCLUDED */
diff --git a/gst/vbidec/vbiscreen.c b/gst/vbidec/vbiscreen.c
index bcce79e26..f441ba785 100644
--- a/gst/vbidec/vbiscreen.c
+++ b/gst/vbidec/vbiscreen.c
@@ -50,7 +50,8 @@
#define FONT_SIZE 20
typedef struct osd_string_s osd_string_t;
-struct osd_string_s {
+struct osd_string_s
+{
int width;
int height;
int r, g, b;
@@ -58,684 +59,765 @@ struct osd_string_s {
GstVBIDec *vbidec;
};
-osd_string_t *osd_string_new(char *c, int s, int w, int h, int a, void *user_data) {
+osd_string_t *
+osd_string_new (char *c, int s, int w, int h, int a, void *user_data)
+{
osd_string_t *os;
- os = (osd_string_t *)malloc(sizeof(osd_string_t));
+
+ os = (osd_string_t *) malloc (sizeof (osd_string_t));
if (!os)
return NULL;
os->width = 0;
os->height = 0;
os->r = os->g = os->b = 0;
os->visible = 1;
- os->vbidec = (GstVBIDec *)user_data;
+ os->vbidec = (GstVBIDec *) user_data;
return os;
}
-void osd_string_show_text(osd_string_t *os, char *s, int len ) {
+
+void
+osd_string_show_text (osd_string_t * os, char *s, int len)
+{
/* FIXME: just print data when it gets here */
if (len > 0) {
- gst_vbidec_show_text(os->vbidec, s, len);
+ gst_vbidec_show_text (os->vbidec, s, len);
}
}
-int osd_string_get_height(osd_string_t *os) {
+int
+osd_string_get_height (osd_string_t * os)
+{
return os->height;
}
-int osd_string_get_width(osd_string_t *os) {
+
+int
+osd_string_get_width (osd_string_t * os)
+{
return os->width;
}
-void osd_string_delete(osd_string_t *os) {
- free(os);
+
+void
+osd_string_delete (osd_string_t * os)
+{
+ free (os);
}
-void osd_string_set_colour_rgb(osd_string_t *os, int r, int g, int b) {
+
+void
+osd_string_set_colour_rgb (osd_string_t * os, int r, int g, int b)
+{
os->r = r;
os->g = g;
os->b = b;
}
-void blit_colour_packed422_scanline( unsigned char *d, int w, int luma, int cb, int cr) {
+
+void
+blit_colour_packed422_scanline (unsigned char *d, int w, int luma, int cb,
+ int cr)
+{
}
-int osd_string_visible(osd_string_t *os) {
+int
+osd_string_visible (osd_string_t * os)
+{
return os->visible;
}
-void osd_string_composite_packed422_scanline(osd_string_t *os, unsigned char *a, unsigned char *b, int w, int x, int y) {
+
+void
+osd_string_composite_packed422_scanline (osd_string_t * os, unsigned char *a,
+ unsigned char *b, int w, int x, int y)
+{
}
-struct vbiscreen_s {
+struct vbiscreen_s
+{
+
+ osd_string_t *line[ROWS];
- osd_string_t *line[ ROWS ];
+ char buffers[ROWS * COLS * 2];
+ char text[2 * ROWS * COLS];
+ char hiddenbuf[COLS];
+ char paintbuf[ROWS * COLS];
- char buffers[ ROWS * COLS * 2 ];
- char text[ 2 * ROWS * COLS ];
- char hiddenbuf[ COLS ];
- char paintbuf[ ROWS * COLS ];
+ unsigned int fgcolour;
+ unsigned int bgcolour;
+ int bg_luma, bg_cb, bg_cr;
- unsigned int fgcolour;
- unsigned int bgcolour;
- int bg_luma, bg_cb, bg_cr;
+ int frame_width;
+ int frame_height;
+ int frame_aspect;
- int frame_width;
- int frame_height;
- int frame_aspect;
+ int x, y; /* where to draw console */
+ int width, height; /* the size box we have to draw in */
+ int rowheight, charwidth;
- int x, y; /* where to draw console */
- int width, height; /* the size box we have to draw in */
- int rowheight, charwidth;
-
- int curx, cury; /* cursor position */
- int rows, cols; /* 32 cols 15 rows */
- int captions, style; /* CC (1) or Text (0), RU2 RU3 RU4 POP_UP PAINT_ON */
- int first_line; /* where to start drawing */
- int curbuffer;
- int top_of_screen; /* a pointer into line[] */
- int indent;
- int got_eoc;
- int scroll;
+ int curx, cury; /* cursor position */
+ int rows, cols; /* 32 cols 15 rows */
+ int captions, style; /* CC (1) or Text (0), RU2 RU3 RU4 POP_UP PAINT_ON */
+ int first_line; /* where to start drawing */
+ int curbuffer;
+ int top_of_screen; /* a pointer into line[] */
+ int indent;
+ int got_eoc;
+ int scroll;
- char *fontfile;
- int fontsize;
- int verbose;
+ char *fontfile;
+ int fontsize;
+ int verbose;
- void *user_data;
+ void *user_data;
};
-vbiscreen_t *vbiscreen_new( int video_width, int video_height,
- double video_aspect, int verbose, void *user_data )
+vbiscreen_t *
+vbiscreen_new (int video_width, int video_height,
+ double video_aspect, int verbose, void *user_data)
{
- int i=0, fontsize = FONT_SIZE;
- vbiscreen_t *vs = (vbiscreen_t *)malloc(sizeof(struct vbiscreen_s));
+ int i = 0, fontsize = FONT_SIZE;
+ vbiscreen_t *vs = (vbiscreen_t *) malloc (sizeof (struct vbiscreen_s));
- if( !vs ) {
- return NULL;
- }
+ if (!vs) {
+ return NULL;
+ }
- vs->verbose = verbose;
- vs->x = 0;
- vs->y = 0;
- vs->frame_width = video_width;
- vs->frame_height = video_height;
- vs->frame_aspect = video_aspect;
- vs->curx = 0;
- vs->cury = 0;
- vs->fgcolour = 0xFFFFFFFFU; /* white */
- vs->bgcolour = 0xFF000000U; /* black */
- vs->bg_luma = 16;
- vs->bg_cb = 128;
- vs->bg_cr = 128;
- vs->rows = ROWS;
- vs->cols = COLS;
- /*vs->fontfile = DATADIR "/FreeMonoBold.ttf";*/
- vs->fontfile = NULL;
- vs->fontsize = fontsize;
- vs->width = video_width;
- vs->height = video_height;
- vs->first_line = 0;
- vs->captions = 0;
- vs->style = 0;
- vs->curbuffer = 0;
- vs->top_of_screen = 0;
- vs->indent = 0;
- memset( vs->buffers, 0, 2 * COLS * ROWS );
- memset( vs->hiddenbuf, 0, COLS );
- memset( vs->paintbuf, 0, ROWS * COLS );
- vs->scroll = 0;
-
- vs->user_data = user_data;
-
- vs->line[0] = osd_string_new( vs->fontfile, fontsize, video_width,
- video_height,
- video_aspect,
- user_data);
-
- if( !vs->line[0] ) {
- vs->fontfile = "./FreeMonoBold.ttf";
-
- vs->line[0] = osd_string_new( vs->fontfile, fontsize,
- video_width,
- video_height,
- video_aspect,
- user_data);
- }
+ vs->verbose = verbose;
+ vs->x = 0;
+ vs->y = 0;
+ vs->frame_width = video_width;
+ vs->frame_height = video_height;
+ vs->frame_aspect = video_aspect;
+ vs->curx = 0;
+ vs->cury = 0;
+ vs->fgcolour = 0xFFFFFFFFU; /* white */
+ vs->bgcolour = 0xFF000000U; /* black */
+ vs->bg_luma = 16;
+ vs->bg_cb = 128;
+ vs->bg_cr = 128;
+ vs->rows = ROWS;
+ vs->cols = COLS;
+ /*vs->fontfile = DATADIR "/FreeMonoBold.ttf"; */
+ vs->fontfile = NULL;
+ vs->fontsize = fontsize;
+ vs->width = video_width;
+ vs->height = video_height;
+ vs->first_line = 0;
+ vs->captions = 0;
+ vs->style = 0;
+ vs->curbuffer = 0;
+ vs->top_of_screen = 0;
+ vs->indent = 0;
+ memset (vs->buffers, 0, 2 * COLS * ROWS);
+ memset (vs->hiddenbuf, 0, COLS);
+ memset (vs->paintbuf, 0, ROWS * COLS);
+ vs->scroll = 0;
+
+ vs->user_data = user_data;
+
+ vs->line[0] = osd_string_new (vs->fontfile, fontsize, video_width,
+ video_height, video_aspect, user_data);
+
+ if (!vs->line[0]) {
+ vs->fontfile = "./FreeMonoBold.ttf";
+
+ vs->line[0] = osd_string_new (vs->fontfile, fontsize,
+ video_width, video_height, video_aspect, user_data);
+ }
- if( !vs->line[0] ) {
- fprintf( stderr, "vbiscreen: Could not find my font (%s)!\n",
- vs->fontfile );
- vbiscreen_delete( vs );
- return NULL;
- }
+ if (!vs->line[0]) {
+ fprintf (stderr, "vbiscreen: Could not find my font (%s)!\n", vs->fontfile);
+ vbiscreen_delete (vs);
+ return NULL;
+ }
- osd_string_show_text( vs->line[ 0 ], "W", 0 );
- vs->rowheight = osd_string_get_height( vs->line[ 0 ] );
- vs->charwidth = osd_string_get_width( vs->line[ 0 ] );
- osd_string_delete( vs->line[ 0 ] );
-
- for( i = 0; i < ROWS; i++ ) {
- vs->line[ i ] = osd_string_new( vs->fontfile, fontsize,
- video_width, video_height,
- video_aspect,
- user_data);
- if( !vs->line[ i ] ) {
- fprintf( stderr, "vbiscreen: Could not allocate a line.\n" );
- vbiscreen_delete( vs );
- return NULL;
- }
- osd_string_set_colour_rgb( vs->line[ i ],
- (vs->fgcolour & 0xff0000) >> 16,
- (vs->fgcolour & 0xff00) >> 8,
- (vs->fgcolour & 0xff) );
- osd_string_show_text( vs->line[ i ], " ", 0 );
+ osd_string_show_text (vs->line[0], "W", 0);
+ vs->rowheight = osd_string_get_height (vs->line[0]);
+ vs->charwidth = osd_string_get_width (vs->line[0]);
+ osd_string_delete (vs->line[0]);
+
+ for (i = 0; i < ROWS; i++) {
+ vs->line[i] = osd_string_new (vs->fontfile, fontsize,
+ video_width, video_height, video_aspect, user_data);
+ if (!vs->line[i]) {
+ fprintf (stderr, "vbiscreen: Could not allocate a line.\n");
+ vbiscreen_delete (vs);
+ return NULL;
}
- memset( vs->text, 0, 2 * ROWS * COLS );
- return vs;
+ osd_string_set_colour_rgb (vs->line[i],
+ (vs->fgcolour & 0xff0000) >> 16,
+ (vs->fgcolour & 0xff00) >> 8, (vs->fgcolour & 0xff));
+ osd_string_show_text (vs->line[i], " ", 0);
+ }
+ memset (vs->text, 0, 2 * ROWS * COLS);
+ return vs;
}
-void blank_screen( vbiscreen_t *vs )
+void
+blank_screen (vbiscreen_t * vs)
{
- int i;
+ int i;
- if( vs->verbose ) fprintf( stderr, "in blank\n");
- for( i = 0; i < ROWS; i++ ) {
- osd_string_show_text( vs->line[ i ], " ", 0 );
- }
+ if (vs->verbose)
+ fprintf (stderr, "in blank\n");
+ for (i = 0; i < ROWS; i++) {
+ osd_string_show_text (vs->line[i], " ", 0);
+ }
}
-void clear_screen( vbiscreen_t *vs )
+void
+clear_screen (vbiscreen_t * vs)
{
- int base, i;
- if( !vs ) return;
+ int base, i;
- base = vs->top_of_screen * COLS;
- for( i = 0; i < ROWS * COLS; i++ ) {
- vs->text[ base ] = 0;
- base++;
- base %= 2 * ROWS * COLS;
- }
- blank_screen( vs );
+ if (!vs)
+ return;
+
+ base = vs->top_of_screen * COLS;
+ for (i = 0; i < ROWS * COLS; i++) {
+ vs->text[base] = 0;
+ base++;
+ base %= 2 * ROWS * COLS;
+ }
+ blank_screen (vs);
}
-void clear_hidden_roll( vbiscreen_t *vs )
+void
+clear_hidden_roll (vbiscreen_t * vs)
{
- if( !vs ) return;
- memset( vs->hiddenbuf, 0, COLS );
+ if (!vs)
+ return;
+ memset (vs->hiddenbuf, 0, COLS);
}
-void clear_hidden_pop( vbiscreen_t *vs )
+void
+clear_hidden_pop (vbiscreen_t * vs)
{
- if( !vs ) return;
- memset( vs->buffers + vs->curbuffer * COLS * ROWS , 0, COLS * ROWS );
+ if (!vs)
+ return;
+ memset (vs->buffers + vs->curbuffer * COLS * ROWS, 0, COLS * ROWS);
}
-void clear_hidden_paint( vbiscreen_t *vs )
+void
+clear_hidden_paint (vbiscreen_t * vs)
{
- if( !vs ) return;
- memset( vs->paintbuf , 0, COLS * ROWS );
+ if (!vs)
+ return;
+ memset (vs->paintbuf, 0, COLS * ROWS);
}
-void clear_displayed_pop( vbiscreen_t *vs )
+void
+clear_displayed_pop (vbiscreen_t * vs)
{
- if( !vs ) return;
- memset( vs->buffers + ( vs->curbuffer ^ 1 ) * COLS * ROWS , 0, COLS * ROWS );
+ if (!vs)
+ return;
+ memset (vs->buffers + (vs->curbuffer ^ 1) * COLS * ROWS, 0, COLS * ROWS);
}
-void vbiscreen_dump_screen_text( vbiscreen_t *vs )
+void
+vbiscreen_dump_screen_text (vbiscreen_t * vs)
{
- int i, offset;
-
- if( !vs ) return;
- offset = vs->top_of_screen * COLS;
-
- fprintf( stderr, "\n 0123456789abcdefghij012345678901" );
- for( i = 0; i < ROWS * COLS; i++ ) {
- if( !(i % COLS) )
- fprintf( stderr, "\n%.2d ", i / COLS );
- fprintf( stderr, "%c", vs->text[ offset ] ? vs->text[ offset ] : ' ' );
- offset++;
- offset %= 2 * ROWS * COLS;
- }
- fprintf( stderr, "\n 0123456789abcdefghij012345678901\n " );
- for( i = 0; i < COLS; i++ ) {
- fprintf( stderr, "%c", vs->text[ offset ] ? vs->text[ offset ] : ' ' );
- offset++;
- offset %= 2 * ROWS * COLS;
- }
- fprintf( stderr, "\n 0123456789abcdefghij012345678901\n" );
+ int i, offset;
+
+ if (!vs)
+ return;
+ offset = vs->top_of_screen * COLS;
+
+ fprintf (stderr, "\n 0123456789abcdefghij012345678901");
+ for (i = 0; i < ROWS * COLS; i++) {
+ if (!(i % COLS))
+ fprintf (stderr, "\n%.2d ", i / COLS);
+ fprintf (stderr, "%c", vs->text[offset] ? vs->text[offset] : ' ');
+ offset++;
+ offset %= 2 * ROWS * COLS;
+ }
+ fprintf (stderr, "\n 0123456789abcdefghij012345678901\n ");
+ for (i = 0; i < COLS; i++) {
+ fprintf (stderr, "%c", vs->text[offset] ? vs->text[offset] : ' ');
+ offset++;
+ offset %= 2 * ROWS * COLS;
+ }
+ fprintf (stderr, "\n 0123456789abcdefghij012345678901\n");
}
-int update_row_x( vbiscreen_t *vs, int row )
+int
+update_row_x (vbiscreen_t * vs, int row)
{
- char text[ COLS + 1 ];
- int i, j, haschars = 0, base;
-
- if( !vs ) return 0;
-
- text[ COLS ] = 0;
- base = ( ( vs->top_of_screen + row ) % ( 2 * ROWS ) ) * COLS;
- for( j = 0, i = base; i < base + COLS; i++, j++ ) {
- if( vs->text[ i ] ) {
- text[ j ] = vs->text[ i ];
- haschars = 1;
- } else {
- text[ j ] = ' ';
- }
+ char text[COLS + 1];
+ int i, j, haschars = 0, base;
+
+ if (!vs)
+ return 0;
+
+ text[COLS] = 0;
+ base = ((vs->top_of_screen + row) % (2 * ROWS)) * COLS;
+ for (j = 0, i = base; i < base + COLS; i++, j++) {
+ if (vs->text[i]) {
+ text[j] = vs->text[i];
+ haschars = 1;
+ } else {
+ text[j] = ' ';
}
+ }
- osd_string_set_colour_rgb( vs->line[ row ],
- ( vs->fgcolour & 0xff0000 ) >> 16,
- ( vs->fgcolour & 0xff00 ) >> 8,
- ( vs->fgcolour & 0xff ) );
- if( !haschars )
- osd_string_show_text( vs->line[ row ], " ", 0 );
- else
- osd_string_show_text( vs->line[ row ], text, 51 );
+ osd_string_set_colour_rgb (vs->line[row],
+ (vs->fgcolour & 0xff0000) >> 16,
+ (vs->fgcolour & 0xff00) >> 8, (vs->fgcolour & 0xff));
+ if (!haschars)
+ osd_string_show_text (vs->line[row], " ", 0);
+ else
+ osd_string_show_text (vs->line[row], text, 51);
- return haschars;
+ return haschars;
}
-void update_row( vbiscreen_t *vs )
+void
+update_row (vbiscreen_t * vs)
{
- if( !vs ) return;
+ if (!vs)
+ return;
- update_row_x( vs, vs->cury );
- //vbiscreen_dump_screen_text( vs );
+ update_row_x (vs, vs->cury);
+ //vbiscreen_dump_screen_text( vs );
}
-void update_all_rows( vbiscreen_t *vs )
+void
+update_all_rows (vbiscreen_t * vs)
{
- int row = 0;
+ int row = 0;
- if( !vs ) return;
+ if (!vs)
+ return;
- for( row = 0; row < ROWS; row++ ) {
- update_row_x( vs, row );
- }
- //vbiscreen_dump_screen_text( vs );
+ for (row = 0; row < ROWS; row++) {
+ update_row_x (vs, row);
+ }
+ //vbiscreen_dump_screen_text( vs );
}
-void vbiscreen_delete( vbiscreen_t *vs )
+void
+vbiscreen_delete (vbiscreen_t * vs)
{
- free( vs );
+ free (vs);
}
-void copy_row_to_screen( vbiscreen_t *vs, char *row )
+void
+copy_row_to_screen (vbiscreen_t * vs, char *row)
{
- int base, i, j;
+ int base, i, j;
- base = ( ( vs->top_of_screen + vs->cury ) % ( 2 * ROWS ) ) * COLS;
- for( j = 0, i = base;
- i < base + COLS;
- j++, i++ ) {
- vs->text[ i ] = row[ j ];
- }
- update_row( vs );
+ base = ((vs->top_of_screen + vs->cury) % (2 * ROWS)) * COLS;
+ for (j = 0, i = base; i < base + COLS; j++, i++) {
+ vs->text[i] = row[j];
+ }
+ update_row (vs);
}
-void scroll_screen( vbiscreen_t *vs )
+void
+scroll_screen (vbiscreen_t * vs)
{
- int start_row;
+ int start_row;
- if( !vs || !vs->captions || !vs->style || vs->style > ROLL_4 )
- return;
-
- start_row = ( vs->first_line + vs->top_of_screen ) % ( 2 * ROWS );
- if( vs->verbose )
- fprintf ( stderr, "start row : %d first line %d\n ", start_row,
- vs->first_line );
+ if (!vs || !vs->captions || !vs->style || vs->style > ROLL_4)
+ return;
- /* zero out top row */
- memset( (char *)( vs->text + start_row * COLS ), 0, COLS );
- vs->top_of_screen = ( vs->top_of_screen + 1 ) % ( 2 * ROWS );
- vs->curx = vs->indent;
- update_all_rows( vs );
- copy_row_to_screen( vs, vs->hiddenbuf );
- clear_hidden_roll( vs );
- vs->scroll = 26;
+ start_row = (vs->first_line + vs->top_of_screen) % (2 * ROWS);
+ if (vs->verbose)
+ fprintf (stderr, "start row : %d first line %d\n ", start_row,
+ vs->first_line);
+
+ /* zero out top row */
+ memset ((char *) (vs->text + start_row * COLS), 0, COLS);
+ vs->top_of_screen = (vs->top_of_screen + 1) % (2 * ROWS);
+ vs->curx = vs->indent;
+ update_all_rows (vs);
+ copy_row_to_screen (vs, vs->hiddenbuf);
+ clear_hidden_roll (vs);
+ vs->scroll = 26;
}
-void vbiscreen_set_verbose( vbiscreen_t *vs, int verbose )
+void
+vbiscreen_set_verbose (vbiscreen_t * vs, int verbose)
{
- vs->verbose = verbose;
+ vs->verbose = verbose;
}
-void vbiscreen_new_caption( vbiscreen_t *vs, int indent, int ital,
- unsigned int colour, int row )
+void
+vbiscreen_new_caption (vbiscreen_t * vs, int indent, int ital,
+ unsigned int colour, int row)
{
- if( !vs ) return;
- if( vs->verbose ) fprintf( stderr, "indent: %d, ital: %d, colour: 0x%x, row: %d\n", indent, ital, colour, row );
-
- if( 0 && vs->captions && vs->style <= ROLL_4 && vs->style ) {
- if( row != vs->cury+1 ) {
- vs->cury = row - 1;
- clear_hidden_roll( vs );
- } else {
+ if (!vs)
+ return;
+ if (vs->verbose)
+ fprintf (stderr, "indent: %d, ital: %d, colour: 0x%x, row: %d\n", indent,
+ ital, colour, row);
+
+ if (0 && vs->captions && vs->style <= ROLL_4 && vs->style) {
+ if (row != vs->cury + 1) {
+ vs->cury = row - 1;
+ clear_hidden_roll (vs);
+ } else {
// scroll_screen( vs );
- }
}
+ }
- if( vs->style > ROLL_4 ) {
- vs->cury = ( ( row > 0 ) ? row - 1 : 0 );
- }
+ if (vs->style > ROLL_4) {
+ vs->cury = ((row > 0) ? row - 1 : 0);
+ }
- vs->fgcolour = colour;
- vs->indent = indent;
- vs->curx = indent;
-}
-
-void vbiscreen_set_mode( vbiscreen_t *vs, int caption, int style )
-{
- if( !vs ) return;
- if( vs->verbose )
- fprintf( stderr, "in set mode\n");
-
- if( vs->verbose ) {
- fprintf( stderr, "Caption: %d ", caption );
- switch( style ) {
- case ROLL_2:
- fprintf( stderr, "ROLL 2\n");
- break;
- case ROLL_3:
- fprintf( stderr, "ROLL 3\n" );
- break;
- case ROLL_4:
- fprintf( stderr, "ROLL 4\n" );
- break;
- case POP_UP:
- fprintf( stderr, "POP UP\n" );
- break;
- case PAINT_ON:
- fprintf( stderr, "PAINT ON\n" );
- break;
- default:
- break;
- }
+ vs->fgcolour = colour;
+ vs->indent = indent;
+ vs->curx = indent;
+}
+
+void
+vbiscreen_set_mode (vbiscreen_t * vs, int caption, int style)
+{
+ if (!vs)
+ return;
+ if (vs->verbose)
+ fprintf (stderr, "in set mode\n");
+
+ if (vs->verbose) {
+ fprintf (stderr, "Caption: %d ", caption);
+ switch (style) {
+ case ROLL_2:
+ fprintf (stderr, "ROLL 2\n");
+ break;
+ case ROLL_3:
+ fprintf (stderr, "ROLL 3\n");
+ break;
+ case ROLL_4:
+ fprintf (stderr, "ROLL 4\n");
+ break;
+ case POP_UP:
+ fprintf (stderr, "POP UP\n");
+ break;
+ case PAINT_ON:
+ fprintf (stderr, "PAINT ON\n");
+ break;
+ default:
+ break;
}
- if( !caption ) {
- /* text mode */
- vs->cury = 0;
- } else {
- /* captioning mode */
- /* styles: ru2 ru3 ru4 pop paint
- */
- if( style != POP_UP && vs->style == POP_UP && !vs->got_eoc ) {
- /* stupid that sometimes they dont send a EOC */
- vbiscreen_end_of_caption( vs );
- }
-
- switch( style ) {
- case ROLL_2:
- case ROLL_3:
- case ROLL_4:
- if( vs->style == style ) {
- return;
- }
- vs->first_line = ROWS - (style - 4);
-
- if( vs->verbose )
- fprintf( stderr, "first_line %d\n", vs->first_line );
-
- vs->cury = ROWS - 1;
- break;
- case POP_UP:
- vs->got_eoc = 0;
- break;
- case PAINT_ON:
- break;
- }
+ }
+ if (!caption) {
+ /* text mode */
+ vs->cury = 0;
+ } else {
+ /* captioning mode */
+ /* styles: ru2 ru3 ru4 pop paint
+ */
+ if (style != POP_UP && vs->style == POP_UP && !vs->got_eoc) {
+ /* stupid that sometimes they dont send a EOC */
+ vbiscreen_end_of_caption (vs);
}
- vs->captions = caption;
- vs->style = style;
-}
+ switch (style) {
+ case ROLL_2:
+ case ROLL_3:
+ case ROLL_4:
+ if (vs->style == style) {
+ return;
+ }
+ vs->first_line = ROWS - (style - 4);
+
+ if (vs->verbose)
+ fprintf (stderr, "first_line %d\n", vs->first_line);
+
+ vs->cury = ROWS - 1;
+ break;
+ case POP_UP:
+ vs->got_eoc = 0;
+ break;
+ case PAINT_ON:
+ break;
+ }
+ }
-void vbiscreen_tab( vbiscreen_t *vs, int cols )
-{
- if( !vs ) return;
- if( cols < 0 || cols > 3 ) return;
- vs->curx += cols;
- if( vs->curx > 31 ) vs->curx = 31;
+ vs->captions = caption;
+ vs->style = style;
}
-void vbiscreen_set_colour( vbiscreen_t *vs, unsigned int col )
+void
+vbiscreen_tab (vbiscreen_t * vs, int cols)
{
- if( !vs ) return;
- vs->fgcolour = col;
+ if (!vs)
+ return;
+ if (cols < 0 || cols > 3)
+ return;
+ vs->curx += cols;
+ if (vs->curx > 31)
+ vs->curx = 31;
}
-void vbiscreen_clear_current_cell( vbiscreen_t *vs )
+void
+vbiscreen_set_colour (vbiscreen_t * vs, unsigned int col)
{
- vs->text[ ( ( vs->top_of_screen + vs->cury ) % ( 2 * ROWS ) ) * COLS
- + vs->curx + vs->indent ] = 0;
+ if (!vs)
+ return;
+ vs->fgcolour = col;
}
-void vbiscreen_set_current_cell( vbiscreen_t *vs, char text )
+void
+vbiscreen_clear_current_cell (vbiscreen_t * vs)
{
- int base;
- if( !vs ) return;
- base = ( ( vs->top_of_screen + vs->cury ) % ( 2 * ROWS ) ) * COLS;
- if( g_ascii_isprint( text ) )
- vs->text[ base + vs->curx + vs->indent ] = text;
- else
- vs->text[ base + vs->curx + vs->indent ] = ' ';
+ vs->text[((vs->top_of_screen + vs->cury) % (2 * ROWS)) * COLS
+ + vs->curx + vs->indent] = 0;
}
-void vbiscreen_delete_to_end( vbiscreen_t *vs )
+void
+vbiscreen_set_current_cell (vbiscreen_t * vs, char text)
{
- int i;
- if( !vs ) return;
- if( vs->verbose ) fprintf( stderr, "in del to end\n");
- for( i = vs->curx; i < COLS; i++ ) {
- vbiscreen_clear_current_cell( vs );
- vs->curx++;
- }
- vs->curx = COLS-1; /* is this right ? */
- if( vs->captions && vs->style && vs->style != POP_UP )
- update_row( vs );
+ int base;
+
+ if (!vs)
+ return;
+ base = ((vs->top_of_screen + vs->cury) % (2 * ROWS)) * COLS;
+ if (g_ascii_isprint (text))
+ vs->text[base + vs->curx + vs->indent] = text;
+ else
+ vs->text[base + vs->curx + vs->indent] = ' ';
}
-void vbiscreen_backspace( vbiscreen_t *vs )
+void
+vbiscreen_delete_to_end (vbiscreen_t * vs)
{
- if( !vs ) return;
- if( vs->verbose ) fprintf( stderr, "in backspace\n");
- if( !vs->curx ) return;
- vs->curx--;
- vbiscreen_clear_current_cell( vs );
- update_row( vs );
+ int i;
+
+ if (!vs)
+ return;
+ if (vs->verbose)
+ fprintf (stderr, "in del to end\n");
+ for (i = vs->curx; i < COLS; i++) {
+ vbiscreen_clear_current_cell (vs);
+ vs->curx++;
+ }
+ vs->curx = COLS - 1; /* is this right ? */
+ if (vs->captions && vs->style && vs->style != POP_UP)
+ update_row (vs);
}
-void vbiscreen_erase_displayed( vbiscreen_t *vs )
+void
+vbiscreen_backspace (vbiscreen_t * vs)
+{
+ if (!vs)
+ return;
+ if (vs->verbose)
+ fprintf (stderr, "in backspace\n");
+ if (!vs->curx)
+ return;
+ vs->curx--;
+ vbiscreen_clear_current_cell (vs);
+ update_row (vs);
+}
+
+void
+vbiscreen_erase_displayed (vbiscreen_t * vs)
{
- if( !vs ) return;
- if( vs->verbose ) fprintf( stderr, "in erase disp\n");
+ if (!vs)
+ return;
+ if (vs->verbose)
+ fprintf (stderr, "in erase disp\n");
- if( vs->captions && vs->style && vs->style <= ROLL_4 ) {
- clear_hidden_roll( vs );
- }
+ if (vs->captions && vs->style && vs->style <= ROLL_4) {
+ clear_hidden_roll (vs);
+ }
- clear_displayed_pop( vs );
- clear_screen( vs );
+ clear_displayed_pop (vs);
+ clear_screen (vs);
}
-void vbiscreen_erase_non_displayed( vbiscreen_t *vs )
+void
+vbiscreen_erase_non_displayed (vbiscreen_t * vs)
{
- if( !vs ) return;
- if( vs->verbose ) fprintf( stderr, "in erase non disp\n");
-
- if( vs->captions && vs->style == POP_UP ) {
- memset( vs->buffers + vs->curbuffer * COLS * ROWS + vs->cury * COLS, 0, COLS );
+ if (!vs)
+ return;
+ if (vs->verbose)
+ fprintf (stderr, "in erase non disp\n");
+
+ if (vs->captions && vs->style == POP_UP) {
+ memset (vs->buffers + vs->curbuffer * COLS * ROWS + vs->cury * COLS, 0,
+ COLS);
// clear_hidden_pop( vs );
- } else if( vs->captions && vs->style && vs->style <= ROLL_4 ) {
- clear_hidden_roll( vs );
- }
+ } else if (vs->captions && vs->style && vs->style <= ROLL_4) {
+ clear_hidden_roll (vs);
+ }
}
-void vbiscreen_carriage_return( vbiscreen_t *vs )
+void
+vbiscreen_carriage_return (vbiscreen_t * vs)
{
- if( !vs ) return;
- if( vs->verbose ) fprintf( stderr, "in CR\n");
- if( vs->style != POP_UP) {
- /* not sure if this is right for text mode */
- /* in text mode, perhaps a CR on last row clears screen and goes
- * to (0,0) */
- scroll_screen( vs );
- }
+ if (!vs)
+ return;
+ if (vs->verbose)
+ fprintf (stderr, "in CR\n");
+ if (vs->style != POP_UP) {
+ /* not sure if this is right for text mode */
+ /* in text mode, perhaps a CR on last row clears screen and goes
+ * to (0,0) */
+ scroll_screen (vs);
+ }
- /* keep cursor on bottom for rollup */
- if( vs->captions && vs->style && vs->style <= ROLL_4 )
- vs->cury--;
+ /* keep cursor on bottom for rollup */
+ if (vs->captions && vs->style && vs->style <= ROLL_4)
+ vs->cury--;
- vs->cury++;
- vs->curx = 0;
+ vs->cury++;
+ vs->curx = 0;
}
-void copy_buf_to_screen( vbiscreen_t *vs, char *buf )
+void
+copy_buf_to_screen (vbiscreen_t * vs, char *buf)
{
- int base, i, j;
- if( !vs ) return;
+ int base, i, j;
- base = vs->top_of_screen * COLS;
- for( j = 0, i = 0; i < ROWS * COLS; i++, j++ ) {
- vs->text[ base ] = buf[ j ];
- base++;
- base %= 2 * ROWS * COLS;
- }
- update_all_rows( vs );
+ if (!vs)
+ return;
+
+ base = vs->top_of_screen * COLS;
+ for (j = 0, i = 0; i < ROWS * COLS; i++, j++) {
+ vs->text[base] = buf[j];
+ base++;
+ base %= 2 * ROWS * COLS;
+ }
+ update_all_rows (vs);
}
-void vbiscreen_end_of_caption( vbiscreen_t *vs )
+void
+vbiscreen_end_of_caption (vbiscreen_t * vs)
{
- /*int i;*/
- if( !vs ) return;
- if( vs->verbose ) fprintf( stderr, "in end of caption\n");
+ /*int i; */
+ if (!vs)
+ return;
+ if (vs->verbose)
+ fprintf (stderr, "in end of caption\n");
+
+ if (vs->style == PAINT_ON) {
+ copy_buf_to_screen (vs, vs->paintbuf);
+ clear_hidden_paint (vs);
+ } else if (vs->style == POP_UP) {
+ copy_buf_to_screen (vs, vs->buffers + vs->curbuffer * COLS * ROWS);
+ vs->curbuffer ^= 1;
+ }
+
+ /* to be safe? */
+ vs->curx = 0;
+ vs->cury = ROWS - 1;
+ vs->got_eoc = 1;
+}
- if( vs->style == PAINT_ON ) {
- copy_buf_to_screen( vs, vs->paintbuf );
- clear_hidden_paint( vs );
- } else if( vs->style == POP_UP ) {
- copy_buf_to_screen( vs, vs->buffers + vs->curbuffer * COLS * ROWS );
- vs->curbuffer ^= 1;
+void
+vbiscreen_print (vbiscreen_t * vs, char c1, char c2)
+{
+ if (!vs)
+ return;
+ if (vs->verbose)
+ fprintf (stderr, "in print (%d, %d)[%c %c]\n", vs->curx, vs->cury, c1, c2);
+ if (vs->captions && vs->style == POP_UP) {
+ /* this all gets displayed at another time */
+ if (vs->curx != COLS - 1) {
+ *(vs->buffers + vs->curx + vs->curbuffer * ROWS * COLS +
+ vs->cury * COLS) = c1;
+ vs->curx++;
}
- /* to be safe? */
- vs->curx = 0;
- vs->cury = ROWS - 1;
- vs->got_eoc = 1;
-}
-
-void vbiscreen_print( vbiscreen_t *vs, char c1, char c2 )
-{
- if( !vs ) return;
- if( vs->verbose ) fprintf( stderr, "in print (%d, %d)[%c %c]\n", vs->curx, vs->cury, c1, c2);
- if( vs->captions && vs->style == POP_UP ) {
- /* this all gets displayed at another time */
- if( vs->curx != COLS-1 ) {
- *(vs->buffers + vs->curx + vs->curbuffer * ROWS * COLS + vs->cury * COLS ) = c1;
- vs->curx++;
- }
-
- if( vs->curx != COLS-1 && c2 ) {
- *(vs->buffers + vs->curx + vs->curbuffer * ROWS * COLS + vs->cury * COLS ) = c2;
- vs->curx++;
- } else if( c2 ) {
- *(vs->buffers + vs->curx + vs->curbuffer * ROWS * COLS + vs->cury * COLS ) = c2;
- }
+ if (vs->curx != COLS - 1 && c2) {
+ *(vs->buffers + vs->curx + vs->curbuffer * ROWS * COLS +
+ vs->cury * COLS) = c2;
+ vs->curx++;
+ } else if (c2) {
+ *(vs->buffers + vs->curx + vs->curbuffer * ROWS * COLS +
+ vs->cury * COLS) = c2;
}
+ }
- if( vs->captions && vs->style == PAINT_ON ) {
- if( vs->curx != COLS-1 ) {
- vs->paintbuf[ vs->curx + vs->cury * COLS ] = c1;
- vs->curx++;
- }
-
- if( vs->curx != COLS-1 && c2 ) {
- vs->paintbuf[ vs->curx + vs->cury * COLS ] = c2;
- vs->curx++;
- } else if( c2 ) {
- vs->paintbuf[ vs->curx + vs->cury * COLS ] = c2;
- }
+ if (vs->captions && vs->style == PAINT_ON) {
+ if (vs->curx != COLS - 1) {
+ vs->paintbuf[vs->curx + vs->cury * COLS] = c1;
+ vs->curx++;
}
- if( vs->captions && vs->style && vs->style <= ROLL_4 ) {
- if( vs->curx != COLS-1 ) {
- vs->hiddenbuf[ vs->curx ] = c1;
- vs->curx++;
- } else {
- vs->hiddenbuf[ vs->curx ] = c1;
- }
-
- if( vs->curx != COLS-1 && c2 ) {
- vs->hiddenbuf[ vs->curx ] = c2;
- vs->curx++;
- } else if( c2 ) {
- vs->hiddenbuf[ vs->curx ] = c2;
- }
+ if (vs->curx != COLS - 1 && c2) {
+ vs->paintbuf[vs->curx + vs->cury * COLS] = c2;
+ vs->curx++;
+ } else if (c2) {
+ vs->paintbuf[vs->curx + vs->cury * COLS] = c2;
+ }
+ }
+
+ if (vs->captions && vs->style && vs->style <= ROLL_4) {
+ if (vs->curx != COLS - 1) {
+ vs->hiddenbuf[vs->curx] = c1;
+ vs->curx++;
+ } else {
+ vs->hiddenbuf[vs->curx] = c1;
}
-}
-void vbiscreen_reset( vbiscreen_t *vs )
-{
- if( !vs ) return;
- clear_screen( vs );
- clear_hidden_pop( vs );
- clear_displayed_pop( vs );
- clear_hidden_roll( vs );
- vs->captions = 0;
- vs->style = 0;
-}
-
-void vbiscreen_composite_packed422_scanline( vbiscreen_t *vs,
- unsigned char *output,
- int width, int xpos,
- int scanline )
-{
- int x=0, y=0, row=0, index=0;
-
- if( !vs ) return;
- if( !output ) return;
- if( scanline >= vs->y && scanline < vs->y + vs->height ) {
-
- if( 0 && !vs->captions )
- blit_colour_packed422_scanline( output + (vs->x*2), vs->width,
- vs->bg_luma, vs->bg_cb,
- vs->bg_cr );
-
- index = vs->top_of_screen * COLS;
- x = ( vs->x + vs->charwidth) & ~1;
- for( row = 0; row < ROWS; row++ ) {
- y = vs->y + row * vs->rowheight + vs->rowheight;
- if( osd_string_visible( vs->line[ row ] ) ) {
- if( scanline >= y &&
- scanline < y + vs->rowheight ) {
-
- int startx;
- int strx;
-
- startx = x - xpos;
- strx = 0;
-
- if( startx < 0 ) {
- strx = -startx;
- startx = 0;
- }
-
-
- if( startx < width ) {
-
- if( vs->captions )
- blit_colour_packed422_scanline(
- output + (startx*2),
- osd_string_get_width( vs->line[ row ] ),
- vs->bg_luma,
- vs->bg_cb,
- vs->bg_cr );
-
- osd_string_composite_packed422_scanline(
- vs->line[ row ],
- output + (startx*2),
- output + (startx*2),
- width - startx,
- strx,
- scanline - y );
- }
- }
- index++;
- }
- }
+ if (vs->curx != COLS - 1 && c2) {
+ vs->hiddenbuf[vs->curx] = c2;
+ vs->curx++;
+ } else if (c2) {
+ vs->hiddenbuf[vs->curx] = c2;
}
+ }
}
+void
+vbiscreen_reset (vbiscreen_t * vs)
+{
+ if (!vs)
+ return;
+ clear_screen (vs);
+ clear_hidden_pop (vs);
+ clear_displayed_pop (vs);
+ clear_hidden_roll (vs);
+ vs->captions = 0;
+ vs->style = 0;
+}
+
+void
+vbiscreen_composite_packed422_scanline (vbiscreen_t * vs,
+ unsigned char *output, int width, int xpos, int scanline)
+{
+ int x = 0, y = 0, row = 0, index = 0;
+
+ if (!vs)
+ return;
+ if (!output)
+ return;
+ if (scanline >= vs->y && scanline < vs->y + vs->height) {
+
+ if (0 && !vs->captions)
+ blit_colour_packed422_scanline (output + (vs->x * 2), vs->width,
+ vs->bg_luma, vs->bg_cb, vs->bg_cr);
+
+ index = vs->top_of_screen * COLS;
+ x = (vs->x + vs->charwidth) & ~1;
+ for (row = 0; row < ROWS; row++) {
+ y = vs->y + row * vs->rowheight + vs->rowheight;
+ if (osd_string_visible (vs->line[row])) {
+ if (scanline >= y && scanline < y + vs->rowheight) {
+
+ int startx;
+ int strx;
+
+ startx = x - xpos;
+ strx = 0;
+
+ if (startx < 0) {
+ strx = -startx;
+ startx = 0;
+ }
+
+
+ if (startx < width) {
+
+ if (vs->captions)
+ blit_colour_packed422_scanline (output + (startx * 2),
+ osd_string_get_width (vs->line[row]),
+ vs->bg_luma, vs->bg_cb, vs->bg_cr);
+
+ osd_string_composite_packed422_scanline (vs->line[row],
+ output + (startx * 2),
+ output + (startx * 2), width - startx, strx, scanline - y);
+ }
+ }
+ index++;
+ }
+ }
+ }
+}
diff --git a/gst/vbidec/vbiscreen.h b/gst/vbidec/vbiscreen.h
index 9afe2843e..f3c81fbf3 100644
--- a/gst/vbidec/vbiscreen.h
+++ b/gst/vbidec/vbiscreen.h
@@ -25,26 +25,24 @@
typedef struct vbiscreen_s vbiscreen_t;
-vbiscreen_t *vbiscreen_new( int video_width, int video_height,
- double video_aspect, int verbose, void *user_data );
-void vbiscreen_delete( vbiscreen_t *vs );
-void vbiscreen_set_verbose( vbiscreen_t *vs, int verbose );
-void vbiscreen_set_mode( vbiscreen_t *vs, int caption, int style);
-void vbiscreen_new_caption( vbiscreen_t *vs, int indent, int ital,
- unsigned int colour, int row );
-void vbiscreen_tab( vbiscreen_t *vs, int cols );
-void vbiscreen_delete_to_end( vbiscreen_t *vs );
-void vbiscreen_backspace( vbiscreen_t *vs );
-void vbiscreen_erase_displayed( vbiscreen_t *vs );
-void vbiscreen_erase_non_displayed( vbiscreen_t *vs );
-void vbiscreen_carriage_return( vbiscreen_t *vs );
-void vbiscreen_end_of_caption( vbiscreen_t *vs );
-void vbiscreen_print( vbiscreen_t *vs, char c1, char c2 );
-void vbiscreen_composite_packed422_scanline( vbiscreen_t *vs,
- unsigned char *output,
- int width, int xpos,
- int scanline );
-void vbiscreen_dump_screen_text( vbiscreen_t *vs );
-void vbiscreen_reset( vbiscreen_t *vs );
+vbiscreen_t *vbiscreen_new (int video_width, int video_height,
+ double video_aspect, int verbose, void *user_data);
+void vbiscreen_delete (vbiscreen_t * vs);
+void vbiscreen_set_verbose (vbiscreen_t * vs, int verbose);
+void vbiscreen_set_mode (vbiscreen_t * vs, int caption, int style);
+void vbiscreen_new_caption (vbiscreen_t * vs, int indent, int ital,
+ unsigned int colour, int row);
+void vbiscreen_tab (vbiscreen_t * vs, int cols);
+void vbiscreen_delete_to_end (vbiscreen_t * vs);
+void vbiscreen_backspace (vbiscreen_t * vs);
+void vbiscreen_erase_displayed (vbiscreen_t * vs);
+void vbiscreen_erase_non_displayed (vbiscreen_t * vs);
+void vbiscreen_carriage_return (vbiscreen_t * vs);
+void vbiscreen_end_of_caption (vbiscreen_t * vs);
+void vbiscreen_print (vbiscreen_t * vs, char c1, char c2);
+void vbiscreen_composite_packed422_scanline (vbiscreen_t * vs,
+ unsigned char *output, int width, int xpos, int scanline);
+void vbiscreen_dump_screen_text (vbiscreen_t * vs);
+void vbiscreen_reset (vbiscreen_t * vs);
#endif
diff --git a/gst/videocrop/gstvideocrop.c b/gst/videocrop/gstvideocrop.c
index 6a90b5b36..f13610bcf 100644
--- a/gst/videocrop/gstvideocrop.c
+++ b/gst/videocrop/gstvideocrop.c
@@ -39,39 +39,42 @@
typedef struct _GstVideoCrop GstVideoCrop;
typedef struct _GstVideoCropClass GstVideoCropClass;
-struct _GstVideoCrop {
- GstElement element;
+struct _GstVideoCrop
+{
+ GstElement element;
/* pads */
- GstPad *sinkpad;
- GstPad *srcpad;
+ GstPad *sinkpad;
+ GstPad *srcpad;
/* caps */
- gint width, height;
- gdouble fps;
- gint crop_left, crop_right, crop_top, crop_bottom;
+ gint width, height;
+ gdouble fps;
+ gint crop_left, crop_right, crop_top, crop_bottom;
};
-struct _GstVideoCropClass {
+struct _GstVideoCropClass
+{
GstElementClass parent_class;
};
/* elementfactory information */
-static GstElementDetails gst_video_crop_details = GST_ELEMENT_DETAILS (
- "video crop filter",
- "Filter/Effect/Video",
- "Crops video into a user defined region",
- "Wim Taymans <wim.taymans@chello.be>"
-);
+static GstElementDetails gst_video_crop_details =
+GST_ELEMENT_DETAILS ("video crop filter",
+ "Filter/Effect/Video",
+ "Crops video into a user defined region",
+ "Wim Taymans <wim.taymans@chello.be>");
/* VideoCrop signals and args */
-enum {
+enum
+{
/* FILL ME */
LAST_SIGNAL
};
-enum {
+enum
+{
ARG_0,
ARG_LEFT,
ARG_RIGHT,
@@ -81,40 +84,38 @@ enum {
};
static GstStaticPadTemplate gst_video_crop_src_template =
-GST_STATIC_PAD_TEMPLATE (
- "src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("I420"))
-);
+GST_STATIC_PAD_TEMPLATE ("src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("I420"))
+ );
static GstStaticPadTemplate gst_video_crop_sink_template =
-GST_STATIC_PAD_TEMPLATE (
- "sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("I420"))
-);
+GST_STATIC_PAD_TEMPLATE ("sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("I420"))
+ );
-static void gst_video_crop_base_init (gpointer g_class);
-static void gst_video_crop_class_init (GstVideoCropClass *klass);
-static void gst_video_crop_init (GstVideoCrop *video_crop);
+static void gst_video_crop_base_init (gpointer g_class);
+static void gst_video_crop_class_init (GstVideoCropClass * klass);
+static void gst_video_crop_init (GstVideoCrop * video_crop);
-static void gst_video_crop_set_property (GObject *object, guint prop_id,
- const GValue *value, GParamSpec *pspec);
-static void gst_video_crop_get_property (GObject *object, guint prop_id,
- GValue *value, GParamSpec *pspec);
+static void gst_video_crop_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec);
+static void gst_video_crop_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec);
static GstPadLinkReturn
- gst_video_crop_sink_link (GstPad *pad, const GstCaps *caps);
-static void gst_video_crop_chain (GstPad *pad, GstData *_data);
+gst_video_crop_sink_link (GstPad * pad, const GstCaps * caps);
+static void gst_video_crop_chain (GstPad * pad, GstData * _data);
-static GstElementStateReturn
- gst_video_crop_change_state (GstElement *element);
+static GstElementStateReturn gst_video_crop_change_state (GstElement * element);
static GstElementClass *parent_class = NULL;
+
/* static guint gst_video_crop_signals[LAST_SIGNAL] = { 0 }; */
GType
@@ -124,17 +125,19 @@ gst_video_crop_get_type (void)
if (!video_crop_type) {
static const GTypeInfo video_crop_info = {
- sizeof(GstVideoCropClass),
+ sizeof (GstVideoCropClass),
gst_video_crop_base_init,
NULL,
- (GClassInitFunc)gst_video_crop_class_init,
+ (GClassInitFunc) gst_video_crop_class_init,
NULL,
NULL,
- sizeof(GstVideoCrop),
+ sizeof (GstVideoCrop),
0,
- (GInstanceInitFunc)gst_video_crop_init,
+ (GInstanceInitFunc) gst_video_crop_init,
};
- video_crop_type = g_type_register_static(GST_TYPE_ELEMENT, "GstVideoCrop", &video_crop_info, 0);
+ video_crop_type =
+ g_type_register_static (GST_TYPE_ELEMENT, "GstVideoCrop",
+ &video_crop_info, 0);
}
return video_crop_type;
}
@@ -146,34 +149,34 @@ gst_video_crop_base_init (gpointer g_class)
gst_element_class_set_details (element_class, &gst_video_crop_details);
- gst_element_class_add_pad_template (element_class,
+ gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_video_crop_sink_template));
- gst_element_class_add_pad_template (element_class,
+ gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_video_crop_src_template));
}
static void
-gst_video_crop_class_init (GstVideoCropClass *klass)
+gst_video_crop_class_init (GstVideoCropClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
- gobject_class = (GObjectClass*) klass;
- gstelement_class = (GstElementClass*) klass;
+ gobject_class = (GObjectClass *) klass;
+ gstelement_class = (GstElementClass *) klass;
- parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
+ parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LEFT,
- g_param_spec_int ("left", "Left", "Pixels to crop at left",
- 0, G_MAXINT, 0, G_PARAM_READWRITE));
+ g_param_spec_int ("left", "Left", "Pixels to crop at left",
+ 0, G_MAXINT, 0, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_RIGHT,
- g_param_spec_int ("right", "Right", "Pixels to crop at right",
- 0, G_MAXINT, 0, G_PARAM_READWRITE));
+ g_param_spec_int ("right", "Right", "Pixels to crop at right",
+ 0, G_MAXINT, 0, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_TOP,
- g_param_spec_int ("top", "Top", "Pixels to crop at top",
- 0, G_MAXINT, 0, G_PARAM_READWRITE));
+ g_param_spec_int ("top", "Top", "Pixels to crop at top",
+ 0, G_MAXINT, 0, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BOTTOM,
- g_param_spec_int ("bottom", "Bottom", "Pixels to crop at bottom",
- 0, G_MAXINT, 0, G_PARAM_READWRITE));
+ g_param_spec_int ("bottom", "Bottom", "Pixels to crop at bottom",
+ 0, G_MAXINT, 0, G_PARAM_READWRITE));
gobject_class->set_property = gst_video_crop_set_property;
gobject_class->get_property = gst_video_crop_get_property;
@@ -182,17 +185,19 @@ gst_video_crop_class_init (GstVideoCropClass *klass)
}
static void
-gst_video_crop_init (GstVideoCrop *video_crop)
+gst_video_crop_init (GstVideoCrop * video_crop)
{
/* create the sink and src pads */
- video_crop->sinkpad = gst_pad_new_from_template(
- gst_static_pad_template_get (&gst_video_crop_sink_template), "sink");
+ video_crop->sinkpad =
+ gst_pad_new_from_template (gst_static_pad_template_get
+ (&gst_video_crop_sink_template), "sink");
gst_element_add_pad (GST_ELEMENT (video_crop), video_crop->sinkpad);
gst_pad_set_chain_function (video_crop->sinkpad, gst_video_crop_chain);
gst_pad_set_link_function (video_crop->sinkpad, gst_video_crop_sink_link);
- video_crop->srcpad = gst_pad_new_from_template(
- gst_static_pad_template_get (&gst_video_crop_src_template), "src");
+ video_crop->srcpad =
+ gst_pad_new_from_template (gst_static_pad_template_get
+ (&gst_video_crop_src_template), "src");
gst_element_add_pad (GST_ELEMENT (video_crop), video_crop->srcpad);
video_crop->crop_right = 0;
@@ -205,13 +210,14 @@ gst_video_crop_init (GstVideoCrop *video_crop)
/* do we need this function? */
static void
-gst_video_crop_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
+gst_video_crop_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec)
{
GstVideoCrop *video_crop;
-
+
/* it's not null if we got it, but it might not be ours */
g_return_if_fail (GST_IS_VIDEO_CROP (object));
-
+
video_crop = GST_VIDEO_CROP (object);
switch (prop_id) {
@@ -233,13 +239,14 @@ gst_video_crop_set_property (GObject *object, guint prop_id, const GValue *value
}
}
static void
-gst_video_crop_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+gst_video_crop_get_property (GObject * object, guint prop_id, GValue * value,
+ GParamSpec * pspec)
{
GstVideoCrop *video_crop;
-
+
/* it's not null if we got it, but it might not be ours */
g_return_if_fail (GST_IS_VIDEO_CROP (object));
-
+
video_crop = GST_VIDEO_CROP (object);
switch (prop_id) {
@@ -262,7 +269,7 @@ gst_video_crop_get_property (GObject *object, guint prop_id, GValue *value, GPar
}
static GstPadLinkReturn
-gst_video_crop_sink_link (GstPad *pad, const GstCaps *caps)
+gst_video_crop_sink_link (GstPad * pad, const GstCaps * caps)
{
GstVideoCrop *video_crop;
GstStructure *structure;
@@ -271,7 +278,7 @@ gst_video_crop_sink_link (GstPad *pad, const GstCaps *caps)
video_crop = GST_VIDEO_CROP (gst_pad_get_parent (pad));
structure = gst_caps_get_structure (caps, 0);
- ret = gst_structure_get_int (structure, "width", &video_crop->width);
+ ret = gst_structure_get_int (structure, "width", &video_crop->width);
ret &= gst_structure_get_int (structure, "height", &video_crop->height);
ret &= gst_structure_get_double (structure, "framerate", &video_crop->fps);
@@ -289,28 +296,30 @@ gst_video_crop_sink_link (GstPad *pad, const GstCaps *caps)
#define GST_VIDEO_I420_V_ROWSTRIDE(width) ((width)/2)
static void
-gst_video_crop_i420 (GstVideoCrop *video_crop, GstBuffer *src_buffer, GstBuffer *dest_buffer)
+gst_video_crop_i420 (GstVideoCrop * video_crop, GstBuffer * src_buffer,
+ GstBuffer * dest_buffer)
{
guint8 *src;
guint8 *dest;
guint8 *srcY, *srcU, *srcV;
guint8 *destY, *destU, *destV;
gint out_width = video_crop->width -
- (video_crop->crop_left + video_crop->crop_right);
+ (video_crop->crop_left + video_crop->crop_right);
gint out_height = video_crop->height -
- (video_crop->crop_top + video_crop->crop_bottom);
+ (video_crop->crop_top + video_crop->crop_bottom);
gint src_stride;
gint j;
src = GST_BUFFER_DATA (src_buffer);
dest = GST_BUFFER_DATA (dest_buffer);
- g_return_if_fail(GST_BUFFER_SIZE (dest_buffer) == GST_VIDEO_I420_SIZE(out_width,out_height));
+ g_return_if_fail (GST_BUFFER_SIZE (dest_buffer) ==
+ GST_VIDEO_I420_SIZE (out_width, out_height));
- srcY = src + GST_VIDEO_I420_Y_OFFSET(video_crop->width, video_crop->height);
- destY = dest + GST_VIDEO_I420_Y_OFFSET(out_width, out_height);
+ srcY = src + GST_VIDEO_I420_Y_OFFSET (video_crop->width, video_crop->height);
+ destY = dest + GST_VIDEO_I420_Y_OFFSET (out_width, out_height);
- src_stride = GST_VIDEO_I420_Y_ROWSTRIDE(video_crop->width);
+ src_stride = GST_VIDEO_I420_Y_ROWSTRIDE (video_crop->width);
/* copy Y plane first */
@@ -321,32 +330,32 @@ gst_video_crop_i420 (GstVideoCrop *video_crop, GstBuffer *src_buffer, GstBuffer
destY += out_width;
}
- src_stride = GST_VIDEO_I420_U_ROWSTRIDE(video_crop->width);
+ src_stride = GST_VIDEO_I420_U_ROWSTRIDE (video_crop->width);
- destU = dest + GST_VIDEO_I420_U_OFFSET(out_width, out_height);
- destV = dest + GST_VIDEO_I420_V_OFFSET(out_width, out_height);
+ destU = dest + GST_VIDEO_I420_U_OFFSET (out_width, out_height);
+ destV = dest + GST_VIDEO_I420_V_OFFSET (out_width, out_height);
- srcU = src + GST_VIDEO_I420_U_OFFSET(video_crop->width, video_crop->height);
- srcV = src + GST_VIDEO_I420_V_OFFSET(video_crop->width, video_crop->height);
+ srcU = src + GST_VIDEO_I420_U_OFFSET (video_crop->width, video_crop->height);
+ srcV = src + GST_VIDEO_I420_V_OFFSET (video_crop->width, video_crop->height);
- srcU += src_stride * (video_crop->crop_top/2) + (video_crop->crop_left/2);
- srcV += src_stride * (video_crop->crop_top/2) + (video_crop->crop_left/2);
+ srcU += src_stride * (video_crop->crop_top / 2) + (video_crop->crop_left / 2);
+ srcV += src_stride * (video_crop->crop_top / 2) + (video_crop->crop_left / 2);
- for (j = 0; j < out_height/2; j++) {
+ for (j = 0; j < out_height / 2; j++) {
/* copy U plane */
- memcpy (destU, srcU, out_width/2);
+ memcpy (destU, srcU, out_width / 2);
srcU += src_stride;
- destU += out_width/2;
+ destU += out_width / 2;
/* copy V plane */
- memcpy (destV, srcV, out_width/2);
+ memcpy (destV, srcV, out_width / 2);
srcV += src_stride;
- destV += out_width/2;
+ destV += out_width / 2;
}
}
static void
-gst_video_crop_chain (GstPad *pad, GstData *_data)
+gst_video_crop_chain (GstPad * pad, GstData * _data)
{
GstBuffer *buffer = GST_BUFFER (_data);
GstVideoCrop *video_crop;
@@ -367,9 +376,9 @@ gst_video_crop_chain (GstPad *pad, GstData *_data)
}
new_width = video_crop->width -
- (video_crop->crop_left + video_crop->crop_right);
+ (video_crop->crop_left + video_crop->crop_right);
new_height = video_crop->height -
- (video_crop->crop_top + video_crop->crop_bottom);
+ (video_crop->crop_top + video_crop->crop_bottom);
outbuf = gst_buffer_new_and_alloc ((new_width * new_height * 3) / 2);
GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (buffer);
@@ -381,7 +390,7 @@ gst_video_crop_chain (GstPad *pad, GstData *_data)
}
static GstElementStateReturn
-gst_video_crop_change_state (GstElement *element)
+gst_video_crop_change_state (GstElement * element)
{
GstVideoCrop *video_crop;
@@ -408,19 +417,14 @@ gst_video_crop_change_state (GstElement *element)
}
static gboolean
-plugin_init (GstPlugin *plugin)
+plugin_init (GstPlugin * plugin)
{
- return gst_element_register (plugin, "videocrop", GST_RANK_PRIMARY, GST_TYPE_VIDEO_CROP);
+ return gst_element_register (plugin, "videocrop", GST_RANK_PRIMARY,
+ GST_TYPE_VIDEO_CROP);
}
-GST_PLUGIN_DEFINE (
- GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "videocrop",
- "Crops video into a user defined region",
- plugin_init,
- VERSION,
- GST_LICENSE,
- GST_PACKAGE,
- GST_ORIGIN
-)
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ "videocrop",
+ "Crops video into a user defined region",
+ plugin_init, VERSION, GST_LICENSE, GST_PACKAGE, GST_ORIGIN)
diff --git a/gst/videodrop/gstvideodrop.c b/gst/videodrop/gstvideodrop.c
index 546873f07..6a83fd9de 100644
--- a/gst/videodrop/gstvideodrop.c
+++ b/gst/videodrop/gstvideodrop.c
@@ -25,63 +25,56 @@
#include <gst/video/video.h>
/* elementfactory information */
-static GstElementDetails videodrop_details = GST_ELEMENT_DETAILS (
- "Video frame dropper",
- "Filter/Effect/Video",
- "Re-FPS'es video",
- "Ronald Bultje <rbultje@ronald.bitfreak.net>"
-);
+static GstElementDetails videodrop_details =
+GST_ELEMENT_DETAILS ("Video frame dropper",
+ "Filter/Effect/Video",
+ "Re-FPS'es video",
+ "Ronald Bultje <rbultje@ronald.bitfreak.net>");
/* GstVideodrop signals and args */
-enum {
+enum
+{
/* FILL ME */
LAST_SIGNAL
};
-enum {
+enum
+{
ARG_0,
ARG_SPEED
- /* FILL ME */
+ /* FILL ME */
};
static GstStaticPadTemplate gst_videodrop_src_template =
-GST_STATIC_PAD_TEMPLATE (
- "src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS(
- GST_VIDEO_CAPS_YUV("{ YUY2, I420, YV12, YUYV, UYVY }")
- )
-);
+GST_STATIC_PAD_TEMPLATE ("src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("{ YUY2, I420, YV12, YUYV, UYVY }")
+ )
+ );
static GstStaticPadTemplate gst_videodrop_sink_template =
-GST_STATIC_PAD_TEMPLATE (
- "sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS(
- GST_VIDEO_CAPS_YUV("{ YUY2, I420, YV12, YUYV, UYVY }")
- )
-);
-
-static void gst_videodrop_base_init (gpointer g_class);
-static void gst_videodrop_class_init (GstVideodropClass *klass);
-static void gst_videodrop_init (GstVideodrop *videodrop);
-static void gst_videodrop_chain (GstPad *pad, GstData *_data);
-
-static void gst_videodrop_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec);
-static void gst_videodrop_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec);
+GST_STATIC_PAD_TEMPLATE ("sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("{ YUY2, I420, YV12, YUYV, UYVY }")
+ )
+ );
-static GstElementStateReturn
- gst_videodrop_change_state (GstElement *element);
+static void gst_videodrop_base_init (gpointer g_class);
+static void gst_videodrop_class_init (GstVideodropClass * klass);
+static void gst_videodrop_init (GstVideodrop * videodrop);
+static void gst_videodrop_chain (GstPad * pad, GstData * _data);
+
+static void gst_videodrop_set_property (GObject * object,
+ guint prop_id, const GValue * value, GParamSpec * pspec);
+static void gst_videodrop_get_property (GObject * object,
+ guint prop_id, GValue * value, GParamSpec * pspec);
+
+static GstElementStateReturn gst_videodrop_change_state (GstElement * element);
static GstElementClass *parent_class = NULL;
+
/*static guint gst_videodrop_signals[LAST_SIGNAL] = { 0 }; */
GType
@@ -103,8 +96,7 @@ gst_videodrop_get_type (void)
};
videodrop_type = g_type_register_static (GST_TYPE_ELEMENT,
- "GstVideodrop",
- &videodrop_info, 0);
+ "GstVideodrop", &videodrop_info, 0);
}
return videodrop_type;
@@ -123,7 +115,7 @@ gst_videodrop_base_init (gpointer g_class)
gst_static_pad_template_get (&gst_videodrop_src_template));
}
static void
-gst_videodrop_class_init (GstVideodropClass *klass)
+gst_videodrop_class_init (GstVideodropClass * klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
@@ -131,9 +123,8 @@ gst_videodrop_class_init (GstVideodropClass *klass)
parent_class = g_type_class_peek_parent (klass);
g_object_class_install_property (object_class, ARG_SPEED,
- g_param_spec_float ("speed", "Speed",
- "Output speed (relative to input)",
- 0.01, 100, 1, G_PARAM_READWRITE));
+ g_param_spec_float ("speed", "Speed",
+ "Output speed (relative to input)", 0.01, 100, 1, G_PARAM_READWRITE));
object_class->set_property = gst_videodrop_set_property;
object_class->get_property = gst_videodrop_get_property;
@@ -142,7 +133,7 @@ gst_videodrop_class_init (GstVideodropClass *klass)
}
static GstCaps *
-gst_videodrop_getcaps (GstPad *pad)
+gst_videodrop_getcaps (GstPad * pad)
{
GstVideodrop *videodrop;
GstPad *otherpad;
@@ -153,21 +144,21 @@ gst_videodrop_getcaps (GstPad *pad)
videodrop = GST_VIDEODROP (gst_pad_get_parent (pad));
otherpad = (pad == videodrop->srcpad) ? videodrop->sinkpad :
- videodrop->srcpad;
+ videodrop->srcpad;
caps = gst_pad_get_allowed_caps (otherpad);
- for (i=0;i<gst_caps_get_size(caps);i++) {
+ for (i = 0; i < gst_caps_get_size (caps); i++) {
structure = gst_caps_get_structure (caps, i);
gst_structure_set (structure,
- "framerate", GST_TYPE_DOUBLE_RANGE, 0.0, G_MAXDOUBLE, NULL);
+ "framerate", GST_TYPE_DOUBLE_RANGE, 0.0, G_MAXDOUBLE, NULL);
}
-
+
return caps;
}
static GstPadLinkReturn
-gst_videodrop_link (GstPad *pad, const GstCaps *caps)
+gst_videodrop_link (GstPad * pad, const GstCaps * caps)
{
GstVideodrop *videodrop;
GstStructure *structure;
@@ -181,11 +172,12 @@ gst_videodrop_link (GstPad *pad, const GstCaps *caps)
videodrop = GST_VIDEODROP (gst_pad_get_parent (pad));
otherpad = (pad == videodrop->srcpad) ? videodrop->sinkpad :
- videodrop->srcpad;
+ videodrop->srcpad;
structure = gst_caps_get_structure (caps, 0);
ret = gst_structure_get_double (structure, "framerate", &fps);
- if (!ret) return GST_PAD_LINK_REFUSED;
+ if (!ret)
+ return GST_PAD_LINK_REFUSED;
if (gst_pad_is_negotiated (otherpad)) {
othercaps = gst_caps_copy (caps);
@@ -194,8 +186,7 @@ gst_videodrop_link (GstPad *pad, const GstCaps *caps)
} else {
otherfps = videodrop->to_fps;
}
- gst_caps_set_simple (othercaps,
- "framerate", G_TYPE_DOUBLE, otherfps, NULL);
+ gst_caps_set_simple (othercaps, "framerate", G_TYPE_DOUBLE, otherfps, NULL);
link_ret = gst_pad_try_set_caps (otherpad, othercaps);
if (GST_PAD_LINK_FAILED (link_ret)) {
return link_ret;
@@ -212,21 +203,23 @@ gst_videodrop_link (GstPad *pad, const GstCaps *caps)
}
static void
-gst_videodrop_init (GstVideodrop *videodrop)
+gst_videodrop_init (GstVideodrop * videodrop)
{
GST_FLAG_SET (videodrop, GST_ELEMENT_EVENT_AWARE);
-
+
GST_DEBUG ("gst_videodrop_init");
- videodrop->sinkpad = gst_pad_new_from_template (
- gst_static_pad_template_get (&gst_videodrop_sink_template), "sink");
+ videodrop->sinkpad =
+ gst_pad_new_from_template (gst_static_pad_template_get
+ (&gst_videodrop_sink_template), "sink");
gst_element_add_pad (GST_ELEMENT (videodrop), videodrop->sinkpad);
gst_pad_set_chain_function (videodrop->sinkpad, gst_videodrop_chain);
gst_pad_set_getcaps_function (videodrop->sinkpad, gst_videodrop_getcaps);
gst_pad_set_link_function (videodrop->sinkpad, gst_videodrop_link);
- videodrop->srcpad = gst_pad_new_from_template (
- gst_static_pad_template_get (&gst_videodrop_src_template), "src");
- gst_element_add_pad (GST_ELEMENT(videodrop), videodrop->srcpad);
+ videodrop->srcpad =
+ gst_pad_new_from_template (gst_static_pad_template_get
+ (&gst_videodrop_src_template), "src");
+ gst_element_add_pad (GST_ELEMENT (videodrop), videodrop->srcpad);
gst_pad_set_getcaps_function (videodrop->srcpad, gst_videodrop_getcaps);
gst_pad_set_link_function (videodrop->srcpad, gst_videodrop_link);
@@ -237,7 +230,7 @@ gst_videodrop_init (GstVideodrop *videodrop)
}
static void
-gst_videodrop_chain (GstPad *pad, GstData *data)
+gst_videodrop_chain (GstPad * pad, GstData * data)
{
GstVideodrop *videodrop = GST_VIDEODROP (gst_pad_get_parent (pad));
GstBuffer *buf;
@@ -249,12 +242,13 @@ gst_videodrop_chain (GstPad *pad, GstData *data)
/* since we rely on timestamps of the source, we need to handle
* changes in time carefully. */
gint64 time;
+
if (gst_event_discont_get_value (event, GST_FORMAT_TIME, &time)) {
- videodrop->time_adjust = time;
+ videodrop->time_adjust = time;
videodrop->total = videodrop->pass = 0;
} else {
- GST_ELEMENT_ERROR (videodrop, STREAM, TOO_LAZY, (NULL),
- ("Received discont, but no time information"));
+ GST_ELEMENT_ERROR (videodrop, STREAM, TOO_LAZY, (NULL),
+ ("Received discont, but no time information"));
gst_event_unref (event);
return;
}
@@ -268,7 +262,8 @@ gst_videodrop_chain (GstPad *pad, GstData *data)
videodrop->total++;
while (((GST_BUFFER_TIMESTAMP (buf) - videodrop->time_adjust) *
- videodrop->to_fps * videodrop->speed / GST_SECOND) >= videodrop->pass) {
+ videodrop->to_fps * videodrop->speed / GST_SECOND) >=
+ videodrop->pass) {
/* since we write to the struct (time/duration), we need a new struct,
* but we don't want to copy around data - a subbuffer is the easiest
* way to accomplish that... */
@@ -276,7 +271,7 @@ gst_videodrop_chain (GstPad *pad, GstData *data)
/* adjust timestamp/duration and push forward */
GST_BUFFER_TIMESTAMP (copy) = videodrop->time_adjust / videodrop->speed +
- GST_SECOND * videodrop->pass / videodrop->to_fps;
+ GST_SECOND * videodrop->pass / videodrop->to_fps;
GST_BUFFER_DURATION (copy) = GST_SECOND / videodrop->to_fps;
gst_pad_push (videodrop->srcpad, GST_DATA (copy));
@@ -287,10 +282,8 @@ gst_videodrop_chain (GstPad *pad, GstData *data)
}
static void
-gst_videodrop_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
+gst_videodrop_set_property (GObject * object,
+ guint prop_id, const GValue * value, GParamSpec * pspec)
{
GstVideodrop *videodrop = GST_VIDEODROP (object);
@@ -305,10 +298,8 @@ gst_videodrop_set_property (GObject *object,
}
static void
-gst_videodrop_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
+gst_videodrop_get_property (GObject * object,
+ guint prop_id, GValue * value, GParamSpec * pspec)
{
GstVideodrop *videodrop = GST_VIDEODROP (object);
@@ -323,7 +314,7 @@ gst_videodrop_get_property (GObject *object,
}
static GstElementStateReturn
-gst_videodrop_change_state (GstElement *element)
+gst_videodrop_change_state (GstElement * element)
{
GstVideodrop *videodrop = GST_VIDEODROP (element);
@@ -344,19 +335,14 @@ gst_videodrop_change_state (GstElement *element)
}
static gboolean
-plugin_init (GstPlugin *plugin)
+plugin_init (GstPlugin * plugin)
{
- return gst_element_register (plugin, "videodrop", GST_RANK_NONE, GST_TYPE_VIDEODROP);
+ return gst_element_register (plugin, "videodrop", GST_RANK_NONE,
+ GST_TYPE_VIDEODROP);
}
-GST_PLUGIN_DEFINE (
- GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "videodrop",
- "Re-FPS'es video",
- plugin_init,
- VERSION,
- GST_LICENSE,
- GST_PACKAGE,
- GST_ORIGIN
-)
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ "videodrop",
+ "Re-FPS'es video",
+ plugin_init, VERSION, GST_LICENSE, GST_PACKAGE, GST_ORIGIN)
diff --git a/gst/videodrop/gstvideodrop.h b/gst/videodrop/gstvideodrop.h
index 20f954a4e..913c91b5a 100644
--- a/gst/videodrop/gstvideodrop.h
+++ b/gst/videodrop/gstvideodrop.h
@@ -23,7 +23,6 @@
#include <gst/gst.h>
G_BEGIN_DECLS
-
#define GST_TYPE_VIDEODROP \
(gst_videodrop_get_type())
#define GST_VIDEODROP(obj) \
@@ -34,29 +33,28 @@ G_BEGIN_DECLS
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VIDEODROP))
#define GST_IS_VIDEODROP_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VIDEODROP))
-
typedef struct _GstVideodrop GstVideodrop;
typedef struct _GstVideodropClass GstVideodropClass;
-struct _GstVideodrop {
+struct _GstVideodrop
+{
GstElement element;
GstPad *sinkpad, *srcpad;
/* video state */
gboolean inited;
- gfloat from_fps,
- to_fps;
+ gfloat from_fps, to_fps;
gfloat speed;
guint64 pass, total, time_adjust;
};
-struct _GstVideodropClass {
+struct _GstVideodropClass
+{
GstElementClass parent_class;
};
-GType gst_videodrop_get_type(void);
+GType gst_videodrop_get_type (void);
G_END_DECLS
-
#endif /* __GST_VIDEODROP_H__ */
diff --git a/gst/virtualdub/gstvirtualdub.c b/gst/virtualdub/gstvirtualdub.c
index c6091233d..2495d449e 100644
--- a/gst/virtualdub/gstvirtualdub.c
+++ b/gst/virtualdub/gstvirtualdub.c
@@ -25,69 +25,68 @@
#include "gstvirtualdub.h"
-struct _elements_entry {
+struct _elements_entry
+{
gchar *name;
- GType (*type) (void);
+ GType (*type) (void);
GstElementDetails *details;
- gboolean (*factoryinit) (GstElementFactory *factory);
+ gboolean (*factoryinit) (GstElementFactory * factory);
};
static struct _elements_entry _elements[] = {
- { "xsharpen", gst_xsharpen_get_type, &gst_xsharpen_details, NULL },
- { NULL, 0 },
+ {"xsharpen", gst_xsharpen_get_type, &gst_xsharpen_details, NULL},
+ {NULL, 0},
};
-GstPadTemplate*
+GstPadTemplate *
gst_virtualdub_src_factory (void)
{
static GstPadTemplate *templ = NULL;
+
if (!templ) {
- templ = GST_PAD_TEMPLATE_NEW (
- "src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "virtualdub_src",
- "video/x-raw-rgb",
- "bpp", GST_PROPS_INT (32),
- "depth", GST_PROPS_INT (32),
- "endianness", GST_PROPS_INT (G_BYTE_ORDER),
- "red_mask", GST_PROPS_INT (0xff0000),
- "green_mask", GST_PROPS_INT (0xff00),
- "blue_mask", GST_PROPS_INT (0xff),
- "width", GST_PROPS_INT_RANGE (16, 4096),
- "height", GST_PROPS_INT_RANGE (16, 4096),
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT)
- )
- );
+ templ = GST_PAD_TEMPLATE_NEW ("src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_CAPS_NEW ("virtualdub_src",
+ "video/x-raw-rgb",
+ "bpp", GST_PROPS_INT (32),
+ "depth", GST_PROPS_INT (32),
+ "endianness", GST_PROPS_INT (G_BYTE_ORDER),
+ "red_mask", GST_PROPS_INT (0xff0000),
+ "green_mask", GST_PROPS_INT (0xff00),
+ "blue_mask", GST_PROPS_INT (0xff),
+ "width", GST_PROPS_INT_RANGE (16, 4096),
+ "height", GST_PROPS_INT_RANGE (16, 4096),
+ "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT)
+ )
+ );
}
return templ;
}
-GstPadTemplate*
+GstPadTemplate *
gst_virtualdub_sink_factory (void)
{
static GstPadTemplate *templ = NULL;
+
if (!templ) {
- templ = GST_PAD_TEMPLATE_NEW (
- "sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "virtualdub_sink",
- "video/x-raw-rgb",
- "bpp", GST_PROPS_INT (32),
- "depth", GST_PROPS_INT (32),
- "endianness", GST_PROPS_INT (G_BYTE_ORDER),
- "red_mask", GST_PROPS_INT (0xff0000),
- "green_mask", GST_PROPS_INT (0xff00),
- "blue_mask", GST_PROPS_INT (0xff),
- "width", GST_PROPS_INT_RANGE (16, 4096),
- "height", GST_PROPS_INT_RANGE (16, 4096),
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT)
- )
- );
+ templ = GST_PAD_TEMPLATE_NEW ("sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_CAPS_NEW ("virtualdub_sink",
+ "video/x-raw-rgb",
+ "bpp", GST_PROPS_INT (32),
+ "depth", GST_PROPS_INT (32),
+ "endianness", GST_PROPS_INT (G_BYTE_ORDER),
+ "red_mask", GST_PROPS_INT (0xff0000),
+ "green_mask", GST_PROPS_INT (0xff00),
+ "blue_mask", GST_PROPS_INT (0xff),
+ "width", GST_PROPS_INT_RANGE (16, 4096),
+ "height", GST_PROPS_INT_RANGE (16, 4096),
+ "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT)
+ )
+ );
}
return templ;
}
@@ -100,16 +99,16 @@ plugin_init (GModule * module, GstPlugin * plugin)
while (_elements[i].name) {
factory = gst_element_factory_new (_elements[i].name,
- (_elements[i].type) (),
- _elements[i].details);
+ (_elements[i].type) (), _elements[i].details);
if (!factory) {
- g_warning ("gst_virtualdub_new failed for `%s'",
- _elements[i].name);
+ g_warning ("gst_virtualdub_new failed for `%s'", _elements[i].name);
continue;
}
- gst_element_factory_add_pad_template (factory, gst_virtualdub_src_factory ());
- gst_element_factory_add_pad_template (factory, gst_virtualdub_sink_factory ());
+ gst_element_factory_add_pad_template (factory,
+ gst_virtualdub_src_factory ());
+ gst_element_factory_add_pad_template (factory,
+ gst_virtualdub_sink_factory ());
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
if (_elements[i].factoryinit) {
diff --git a/gst/virtualdub/gstvirtualdub.h b/gst/virtualdub/gstvirtualdub.h
index f55d85e83..286aa39d3 100644
--- a/gst/virtualdub/gstvirtualdub.h
+++ b/gst/virtualdub/gstvirtualdub.h
@@ -18,12 +18,12 @@
#include <gst/gst.h>
-typedef unsigned int Pixel;
-typedef unsigned int Pixel32;
-typedef unsigned char Pixel8;
-typedef int PixCoord;
-typedef int PixDim;
-typedef int PixOffset;
+typedef unsigned int Pixel;
+typedef unsigned int Pixel32;
+typedef unsigned char Pixel8;
+typedef int PixCoord;
+typedef int PixDim;
+typedef int PixOffset;
#define R_MASK (0x00ff0000)
diff --git a/gst/virtualdub/gstxsharpen.c b/gst/virtualdub/gstxsharpen.c
index bc83ed62e..df4d45473 100644
--- a/gst/virtualdub/gstxsharpen.c
+++ b/gst/virtualdub/gstxsharpen.c
@@ -57,8 +57,7 @@ GstElementDetails gst_xsharpen_details = {
"",
"Filter/Video/Effect",
"LGPL",
- "Apply a sharpen effect on video"
- VERSION,
+ "Apply a sharpen effect on video" VERSION,
"Jeremy SIMON <jsimon13@yahoo.fr>",
"(C) 2000 Donald Graft",
};
@@ -78,19 +77,20 @@ enum
ARG_0,
};
-static void gst_xsharpen_class_init (GstXsharpenClass * klass);
-static void gst_xsharpen_init (GstXsharpen * sharpen);
+static void gst_xsharpen_class_init (GstXsharpenClass * klass);
+static void gst_xsharpen_init (GstXsharpen * sharpen);
-static void gst_xsharpen_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void gst_xsharpen_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
+static void gst_xsharpen_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec);
+static void gst_xsharpen_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec);
-static void gst_xsharpen_chain (GstPad * pad, GstData *_data);
+static void gst_xsharpen_chain (GstPad * pad, GstData * _data);
static GstElementClass *parent_class = NULL;
-GType gst_xsharpen_get_type (void)
+GType
+gst_xsharpen_get_type (void)
{
static GType xsharpen_type = 0;
@@ -106,7 +106,9 @@ GType gst_xsharpen_get_type (void)
(GInstanceInitFunc) gst_xsharpen_init,
};
- xsharpen_type = g_type_register_static (GST_TYPE_ELEMENT, "GstXsharpen", &xsharpen_info, 0);
+ xsharpen_type =
+ g_type_register_static (GST_TYPE_ELEMENT, "GstXsharpen", &xsharpen_info,
+ 0);
}
return xsharpen_type;
}
@@ -122,13 +124,13 @@ gst_xsharpen_class_init (GstXsharpenClass * klass)
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
- g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_STRENGTH,
- g_param_spec_int("strength", "strength", "strength",
- 0, 255, 255, (GParamFlags)G_PARAM_READWRITE ));
+ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_STRENGTH,
+ g_param_spec_int ("strength", "strength", "strength",
+ 0, 255, 255, (GParamFlags) G_PARAM_READWRITE));
- g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_THRESHOLD,
- g_param_spec_int("threshold", "threshold", "threshold",
- 0, 255, 255, (GParamFlags)G_PARAM_READWRITE ));
+ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_THRESHOLD,
+ g_param_spec_int ("threshold", "threshold", "threshold",
+ 0, 255, 255, (GParamFlags) G_PARAM_READWRITE));
gobject_class->set_property = gst_xsharpen_set_property;
gobject_class->get_property = gst_xsharpen_get_property;
@@ -147,7 +149,7 @@ gst_xsharpen_sinkconnect (GstPad * pad, GstCaps * caps)
gst_caps_get_int (caps, "width", &sharpen->width);
gst_caps_get_int (caps, "height", &sharpen->height);
- sharpen->strengthinv = 255 - sharpen->strength;
+ sharpen->strengthinv = 255 - sharpen->strength;
sharpen->dstpitch = sharpen->srcpitch = sharpen->width * sizeof (Pixel32);
@@ -157,72 +159,74 @@ gst_xsharpen_sinkconnect (GstPad * pad, GstCaps * caps)
static void
gst_xsharpen_init (GstXsharpen * sharpen)
{
- sharpen->sinkpad = gst_pad_new_from_template (gst_virtualdub_sink_factory (), "sink");
+ sharpen->sinkpad =
+ gst_pad_new_from_template (gst_virtualdub_sink_factory (), "sink");
gst_pad_set_chain_function (sharpen->sinkpad, gst_xsharpen_chain);
gst_pad_set_link_function (sharpen->sinkpad, gst_xsharpen_sinkconnect);
gst_element_add_pad (GST_ELEMENT (sharpen), sharpen->sinkpad);
- sharpen->srcpad = gst_pad_new_from_template (gst_virtualdub_src_factory (), "src");
+ sharpen->srcpad =
+ gst_pad_new_from_template (gst_virtualdub_src_factory (), "src");
gst_element_add_pad (GST_ELEMENT (sharpen), sharpen->srcpad);
}
static void
-gst_xsharpen_chain (GstPad * pad, GstData *_data)
+gst_xsharpen_chain (GstPad * pad, GstData * _data)
{
GstBuffer *buf = GST_BUFFER (_data);
GstXsharpen *xsharpen;
- GstBuffer *outbuf;
- gint x, y;
- gint r, g, b, R, G, B;
- Pixel32 p, min, max;
- gint luma, lumac, lumamax, lumamin, mindiff, maxdiff;
- Pixel32 *src_buf, *dst_buf, *src, *dst;
+ GstBuffer *outbuf;
+ gint x, y;
+ gint r, g, b, R, G, B;
+ Pixel32 p, min, max;
+ gint luma, lumac, lumamax, lumamin, mindiff, maxdiff;
+ Pixel32 *src_buf, *dst_buf, *src, *dst;
xsharpen = GST_XSHARPEN (gst_pad_get_parent (pad));
- outbuf = gst_buffer_new ();
- GST_BUFFER_SIZE (outbuf) = ( xsharpen->width * xsharpen->height * sizeof (Pixel32));
+ outbuf = gst_buffer_new ();
+ GST_BUFFER_SIZE (outbuf) =
+ (xsharpen->width * xsharpen->height * sizeof (Pixel32));
GST_BUFFER_DATA (outbuf) = g_malloc (GST_BUFFER_SIZE (outbuf));
GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (buf);
-
- src_buf = (Pixel32 *)GST_BUFFER_DATA (buf);
- dst_buf = (Pixel32 *)GST_BUFFER_DATA (outbuf);
+
+ src_buf = (Pixel32 *) GST_BUFFER_DATA (buf);
+ dst_buf = (Pixel32 *) GST_BUFFER_DATA (outbuf);
min = max = 0;
/* First copy through the four border lines. */
src = src_buf;
dst = dst_buf;
- for (x = 0; x < xsharpen->width; x++)
- {
+ for (x = 0; x < xsharpen->width; x++) {
dst[x] = src[x];
}
-
- src = (Pixel *)((char *)src_buf + (xsharpen->height - 1) * xsharpen->srcpitch);
- dst = (Pixel *)((char *)dst_buf + (xsharpen->height - 1) * xsharpen->dstpitch);
-
- for (x = 0; x < xsharpen->width; x++)
- {
+
+ src =
+ (Pixel *) ((char *) src_buf + (xsharpen->height -
+ 1) * xsharpen->srcpitch);
+ dst =
+ (Pixel *) ((char *) dst_buf + (xsharpen->height -
+ 1) * xsharpen->dstpitch);
+
+ for (x = 0; x < xsharpen->width; x++) {
dst[x] = src[x];
}
-
+
src = src_buf;
dst = dst_buf;
-
- for (y = 0; y < xsharpen->height; y++)
- {
+
+ for (y = 0; y < xsharpen->height; y++) {
dst[0] = src[0];
- dst[xsharpen->width-1] = src[xsharpen->width-1];
- src = (Pixel *)((char *)src + xsharpen->srcpitch);
- dst = (Pixel *)((char *)dst + xsharpen->dstpitch);
+ dst[xsharpen->width - 1] = src[xsharpen->width - 1];
+ src = (Pixel *) ((char *) src + xsharpen->srcpitch);
+ dst = (Pixel *) ((char *) dst + xsharpen->dstpitch);
}
/* Now calculate and store the pixel luminances for the remaining pixels. */
src = src_buf;
- for (y = 0; y < xsharpen->height; y++)
- {
- for (x = 0; x < xsharpen->width; x++)
- {
+ for (y = 0; y < xsharpen->height; y++) {
+ for (x = 0; x < xsharpen->width; x++) {
r = (src[x] >> 16) & 0xff;
g = (src[x] >> 8) & 0xff;
b = src[x] & 0xff;
@@ -230,138 +234,118 @@ gst_xsharpen_chain (GstPad * pad, GstData *_data)
src[x] &= 0x00ffffff;
src[x] |= (luma << 24);
}
- src = (Pixel *)((char *)src + xsharpen->srcpitch);
+ src = (Pixel *) ((char *) src + xsharpen->srcpitch);
}
/* Finally run the 3x3 rank-order sharpening kernel over the pixels. */
- src = (Pixel *)((char *)src_buf + xsharpen->srcpitch);
- dst = (Pixel *)((char *)dst_buf + xsharpen->dstpitch);
-
- for (y = 1; y < xsharpen->height - 1; y++)
- {
- for (x = 1; x < xsharpen->width - 1; x++)
- {
+ src = (Pixel *) ((char *) src_buf + xsharpen->srcpitch);
+ dst = (Pixel *) ((char *) dst_buf + xsharpen->dstpitch);
+
+ for (y = 1; y < xsharpen->height - 1; y++) {
+ for (x = 1; x < xsharpen->width - 1; x++) {
/* Find the brightest and dimmest pixels in the 3x3 window
surrounding the current pixel. */
-
+
lumamax = -1;
lumamin = 1000;
-
- p = ((Pixel32 *)((char *)src - xsharpen->srcpitch))[x-1];
+
+ p = ((Pixel32 *) ((char *) src - xsharpen->srcpitch))[x - 1];
luma = p >> 24;
- if (luma > lumamax)
- {
- lumamax = luma;
- max = p;
+ if (luma > lumamax) {
+ lumamax = luma;
+ max = p;
}
- if (luma < lumamin)
- {
- lumamin = luma;
- min = p;
+ if (luma < lumamin) {
+ lumamin = luma;
+ min = p;
}
- p = ((Pixel32 *)((char *)src - xsharpen->srcpitch))[x];
+ p = ((Pixel32 *) ((char *) src - xsharpen->srcpitch))[x];
luma = p >> 24;
- if (luma > lumamax)
- {
- lumamax = luma;
- max = p;
+ if (luma > lumamax) {
+ lumamax = luma;
+ max = p;
}
- if (luma < lumamin)
- {
- lumamin = luma;
- min = p;
+ if (luma < lumamin) {
+ lumamin = luma;
+ min = p;
}
-
- p = ((Pixel32 *)((char *)src - xsharpen->srcpitch))[x+1];
+
+ p = ((Pixel32 *) ((char *) src - xsharpen->srcpitch))[x + 1];
luma = p >> 24;
- if (luma > lumamax)
- {
- lumamax = luma;
- max = p;
+ if (luma > lumamax) {
+ lumamax = luma;
+ max = p;
}
- if (luma < lumamin)
- {
- lumamin = luma;
- min = p;
+ if (luma < lumamin) {
+ lumamin = luma;
+ min = p;
}
-
- p = src[x-1];
+
+ p = src[x - 1];
luma = p >> 24;
- if (luma > lumamax)
- {
- lumamax = luma;
- max = p;
+ if (luma > lumamax) {
+ lumamax = luma;
+ max = p;
}
- if (luma < lumamin)
- {
- lumamin = luma;
- min = p;
+ if (luma < lumamin) {
+ lumamin = luma;
+ min = p;
}
p = src[x];
lumac = luma = p >> 24;
- if (luma > lumamax)
- {
- lumamax = luma;
- max = p;
+ if (luma > lumamax) {
+ lumamax = luma;
+ max = p;
}
- if (luma < lumamin)
- {
- lumamin = luma;
- min = p;
+ if (luma < lumamin) {
+ lumamin = luma;
+ min = p;
}
- p = src[x+1];
+ p = src[x + 1];
luma = p >> 24;
- if (luma > lumamax)
- {
- lumamax = luma;
- max = p;
+ if (luma > lumamax) {
+ lumamax = luma;
+ max = p;
}
- if (luma < lumamin)
- {
- lumamin = luma;
- min = p;
+ if (luma < lumamin) {
+ lumamin = luma;
+ min = p;
}
-
- p = ((Pixel32 *)((char *)src + xsharpen->srcpitch))[x-1];
+
+ p = ((Pixel32 *) ((char *) src + xsharpen->srcpitch))[x - 1];
luma = p >> 24;
- if (luma > lumamax)
- {
- lumamax = luma;
- max = p;
+ if (luma > lumamax) {
+ lumamax = luma;
+ max = p;
}
- if (luma < lumamin)
- {
- lumamin = luma;
- min = p;
+ if (luma < lumamin) {
+ lumamin = luma;
+ min = p;
}
- p = ((Pixel32 *)((char *)src + xsharpen->srcpitch))[x];
+ p = ((Pixel32 *) ((char *) src + xsharpen->srcpitch))[x];
luma = p >> 24;
- if (luma > lumamax)
- {
- lumamax = luma;
- max = p;
+ if (luma > lumamax) {
+ lumamax = luma;
+ max = p;
}
- if (luma < lumamin)
- {
- lumamin = luma;
- min = p;
+ if (luma < lumamin) {
+ lumamin = luma;
+ min = p;
}
- p = ((Pixel32 *)((char *)src + xsharpen->srcpitch))[x+1];
+ p = ((Pixel32 *) ((char *) src + xsharpen->srcpitch))[x + 1];
luma = p >> 24;
- if (luma > lumamax)
- {
- lumamax = luma;
- max = p;
+ if (luma > lumamax) {
+ lumamax = luma;
+ max = p;
}
- if (luma < lumamin)
- {
- lumamin = luma;
- min = p;
+ if (luma < lumamin) {
+ lumamin = luma;
+ min = p;
}
/* Determine whether the current pixel is closer to the
@@ -369,48 +353,39 @@ gst_xsharpen_chain (GstPad * pad, GstData *_data)
pixel to that closest pixel. If the difference is within
threshold, map the current pixel to the closest pixel;
otherwise pass it through. */
-
+
p = -1;
- if (xsharpen->strength != 0)
- {
- mindiff = lumac - lumamin;
- maxdiff = lumamax - lumac;
- if (mindiff > maxdiff)
- {
- if (maxdiff < xsharpen->threshold)
- {
- p = max;
- }
- }
- else
- {
- if (mindiff < xsharpen->threshold)
- {
- p = min;
- }
- }
+ if (xsharpen->strength != 0) {
+ mindiff = lumac - lumamin;
+ maxdiff = lumamax - lumac;
+ if (mindiff > maxdiff) {
+ if (maxdiff < xsharpen->threshold) {
+ p = max;
+ }
+ } else {
+ if (mindiff < xsharpen->threshold) {
+ p = min;
+ }
+ }
}
- if (p == -1)
- {
- dst[x] = src[x];
- }
- else
- {
- R = (src[x] >> 16) & 0xff;
- G = (src[x] >> 8) & 0xff;
- B = src[x] & 0xff;
- r = (p >> 16) & 0xff;
- g = (p >> 8) & 0xff;
- b = p & 0xff;
- r = (xsharpen->strength * r + xsharpen->strengthinv * R) / 255;
- g = (xsharpen->strength * g + xsharpen->strengthinv * G) / 255;
- b = (xsharpen->strength * b + xsharpen->strengthinv * B) / 255;
- dst[x] = (r << 16) | (g << 8) | b;
+ if (p == -1) {
+ dst[x] = src[x];
+ } else {
+ R = (src[x] >> 16) & 0xff;
+ G = (src[x] >> 8) & 0xff;
+ B = src[x] & 0xff;
+ r = (p >> 16) & 0xff;
+ g = (p >> 8) & 0xff;
+ b = p & 0xff;
+ r = (xsharpen->strength * r + xsharpen->strengthinv * R) / 255;
+ g = (xsharpen->strength * g + xsharpen->strengthinv * G) / 255;
+ b = (xsharpen->strength * b + xsharpen->strengthinv * B) / 255;
+ dst[x] = (r << 16) | (g << 8) | b;
}
}
- src = (Pixel *)((char *)src + xsharpen->srcpitch);
- dst = (Pixel *)((char *)dst + xsharpen->dstpitch);
+ src = (Pixel *) ((char *) src + xsharpen->srcpitch);
+ dst = (Pixel *) ((char *) dst + xsharpen->dstpitch);
}
gst_buffer_unref (buf);
@@ -419,7 +394,8 @@ gst_xsharpen_chain (GstPad * pad, GstData *_data)
}
static void
-gst_xsharpen_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec)
+gst_xsharpen_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec)
{
GstXsharpen *xsharpen;
@@ -432,7 +408,7 @@ gst_xsharpen_set_property (GObject * object, guint prop_id, const GValue * value
case ARG_STRENGTH:
xsharpen->strength = g_value_get_int (value);
xsharpen->strengthinv = 255 - xsharpen->strength;
- case ARG_THRESHOLD:
+ case ARG_THRESHOLD:
xsharpen->threshold = g_value_get_int (value);
default:
break;
@@ -440,7 +416,8 @@ gst_xsharpen_set_property (GObject * object, guint prop_id, const GValue * value
}
static void
-gst_xsharpen_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec)
+gst_xsharpen_get_property (GObject * object, guint prop_id, GValue * value,
+ GParamSpec * pspec)
{
GstXsharpen *xsharpen;
@@ -451,10 +428,10 @@ gst_xsharpen_get_property (GObject * object, guint prop_id, GValue * value, GPar
switch (prop_id) {
case ARG_STRENGTH:
- g_value_set_int (value, xsharpen->strength );
+ g_value_set_int (value, xsharpen->strength);
break;
case ARG_THRESHOLD:
- g_value_set_int (value, xsharpen->threshold );
+ g_value_set_int (value, xsharpen->threshold);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
diff --git a/gst/y4m/gsty4mencode.c b/gst/y4m/gsty4mencode.c
index d27ff6139..3c9c9fbe9 100644
--- a/gst/y4m/gsty4mencode.c
+++ b/gst/y4m/gsty4mencode.c
@@ -26,83 +26,74 @@
#include <gst/video/video.h>
#include "gsty4mencode.h"
-static GstElementDetails y4mencode_details = GST_ELEMENT_DETAILS (
- "Y4mEncode",
- "Codec/Encoder/Video",
- "Encodes a YUV frame into the yuv4mpeg format (mjpegtools)",
- "Wim Taymans <wim.taymans@chello.be>"
-);
+static GstElementDetails y4mencode_details = GST_ELEMENT_DETAILS ("Y4mEncode",
+ "Codec/Encoder/Video",
+ "Encodes a YUV frame into the yuv4mpeg format (mjpegtools)",
+ "Wim Taymans <wim.taymans@chello.be>");
/* Filter signals and args */
-enum {
+enum
+{
/* FILL ME */
LAST_SIGNAL
};
-enum {
+enum
+{
ARG_0
};
static GstStaticPadTemplate y4mencode_src_factory =
-GST_STATIC_PAD_TEMPLATE (
- "src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("application/x-yuv4mpeg, "
- "y4mversion = (int) 1"
- )
-);
+GST_STATIC_PAD_TEMPLATE ("src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS ("application/x-yuv4mpeg, " "y4mversion = (int) 1")
+ );
static GstStaticPadTemplate y4mencode_sink_factory =
-GST_STATIC_PAD_TEMPLATE (
- "sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("I420"))
-);
-
-static void gst_y4mencode_base_init (gpointer g_class);
-static void gst_y4mencode_class_init (GstY4mEncodeClass *klass);
-static void gst_y4mencode_init (GstY4mEncode *filter);
-
-static void gst_y4mencode_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec);
-static void gst_y4mencode_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec);
-
-static void gst_y4mencode_chain (GstPad *pad,
- GstData *_data);
-static GstElementStateReturn
- gst_y4mencode_change_state (GstElement *element);
+GST_STATIC_PAD_TEMPLATE ("sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("I420"))
+ );
+
+static void gst_y4mencode_base_init (gpointer g_class);
+static void gst_y4mencode_class_init (GstY4mEncodeClass * klass);
+static void gst_y4mencode_init (GstY4mEncode * filter);
+
+static void gst_y4mencode_set_property (GObject * object,
+ guint prop_id, const GValue * value, GParamSpec * pspec);
+static void gst_y4mencode_get_property (GObject * object,
+ guint prop_id, GValue * value, GParamSpec * pspec);
+
+static void gst_y4mencode_chain (GstPad * pad, GstData * _data);
+static GstElementStateReturn gst_y4mencode_change_state (GstElement * element);
static GstElementClass *parent_class = NULL;
+
/*static guint gst_filter_signals[LAST_SIGNAL] = { 0 }; */
GType
-gst_y4mencode_get_type(void) {
+gst_y4mencode_get_type (void)
+{
static GType y4mencode_type = 0;
if (!y4mencode_type) {
static const GTypeInfo y4mencode_info = {
- sizeof(GstY4mEncodeClass),
+ sizeof (GstY4mEncodeClass),
gst_y4mencode_base_init,
NULL,
- (GClassInitFunc)gst_y4mencode_class_init,
+ (GClassInitFunc) gst_y4mencode_class_init,
NULL,
NULL,
- sizeof(GstY4mEncode),
+ sizeof (GstY4mEncode),
0,
- (GInstanceInitFunc)gst_y4mencode_init,
+ (GInstanceInitFunc) gst_y4mencode_init,
};
- y4mencode_type = g_type_register_static(GST_TYPE_ELEMENT,
- "GstY4mEncode",
- &y4mencode_info, 0);
+ y4mencode_type = g_type_register_static (GST_TYPE_ELEMENT,
+ "GstY4mEncode", &y4mencode_info, 0);
}
return y4mencode_type;
}
@@ -112,23 +103,23 @@ static void
gst_y4mencode_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 (&y4mencode_src_factory));
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&y4mencode_sink_factory));
+
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&y4mencode_src_factory));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&y4mencode_sink_factory));
gst_element_class_set_details (element_class, &y4mencode_details);
}
static void
-gst_y4mencode_class_init (GstY4mEncodeClass *klass)
+gst_y4mencode_class_init (GstY4mEncodeClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
- gobject_class = (GObjectClass*)klass;
- gstelement_class = (GstElementClass*)klass;
+ gobject_class = (GObjectClass *) klass;
+ gstelement_class = (GstElementClass *) klass;
- parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
+ parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
gstelement_class->change_state = gst_y4mencode_change_state;
@@ -137,16 +128,16 @@ gst_y4mencode_class_init (GstY4mEncodeClass *klass)
}
static GstPadLinkReturn
-gst_y4mencode_sinkconnect (GstPad *pad, const GstCaps *caps)
+gst_y4mencode_sinkconnect (GstPad * pad, const GstCaps * caps)
{
GstY4mEncode *filter;
gint idx = -1, i;
gdouble fps;
gdouble framerates[] = {
00.000,
- 23.976, 24.000, /* 24fps movie */
- 25.000, /* PAL */
- 29.970, 30.000, /* NTSC */
+ 23.976, 24.000, /* 24fps movie */
+ 25.000, /* PAL */
+ 29.970, 30.000, /* NTSC */
50.000,
59.940, 60.000
};
@@ -156,20 +147,20 @@ gst_y4mencode_sinkconnect (GstPad *pad, const GstCaps *caps)
structure = gst_caps_get_structure (caps, 0);
- gst_structure_get_int (structure, "width", &filter->width);
- gst_structure_get_int (structure, "height", &filter->height);
- gst_structure_get_double (structure, "framerate", &fps);
+ gst_structure_get_int (structure, "width", &filter->width);
+ gst_structure_get_int (structure, "height", &filter->height);
+ gst_structure_get_double (structure, "framerate", &fps);
/* find fps idx */
for (i = 1; i < 9; i++) {
if (idx == -1) {
- idx = i;
+ idx = i;
} else {
- gdouble old_diff = fabs(framerates[idx] - fps),
- new_diff = fabs(framerates[i] - fps);
+ gdouble old_diff = fabs (framerates[idx] - fps),
+ new_diff = fabs (framerates[i] - fps);
if (new_diff < old_diff) {
- idx = i;
+ idx = i;
}
}
}
@@ -179,37 +170,39 @@ gst_y4mencode_sinkconnect (GstPad *pad, const GstCaps *caps)
}
static void
-gst_y4mencode_init (GstY4mEncode *filter)
+gst_y4mencode_init (GstY4mEncode * filter)
{
- filter->sinkpad = gst_pad_new_from_template(
- gst_static_pad_template_get (&y4mencode_sink_factory), "sink");
+ filter->sinkpad =
+ gst_pad_new_from_template (gst_static_pad_template_get
+ (&y4mencode_sink_factory), "sink");
gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
gst_pad_set_chain_function (filter->sinkpad, gst_y4mencode_chain);
gst_pad_set_link_function (filter->sinkpad, gst_y4mencode_sinkconnect);
- filter->srcpad = gst_pad_new_from_template(
- gst_static_pad_template_get (&y4mencode_src_factory), "src");
+ filter->srcpad =
+ gst_pad_new_from_template (gst_static_pad_template_get
+ (&y4mencode_src_factory), "src");
gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);
filter->init = TRUE;
}
static void
-gst_y4mencode_chain (GstPad *pad,GstData *_data)
+gst_y4mencode_chain (GstPad * pad, GstData * _data)
{
GstBuffer *buf = GST_BUFFER (_data);
GstY4mEncode *filter;
- GstBuffer* outbuf;
+ GstBuffer *outbuf;
gchar *header;
gint len;
- g_return_if_fail(pad != NULL);
- g_return_if_fail(GST_IS_PAD(pad));
- g_return_if_fail(buf != NULL);
+ g_return_if_fail (pad != NULL);
+ g_return_if_fail (GST_IS_PAD (pad));
+ g_return_if_fail (buf != NULL);
filter = GST_Y4MENCODE (gst_pad_get_parent (pad));
- g_return_if_fail(filter != NULL);
- g_return_if_fail(GST_IS_Y4MENCODE(filter));
+ g_return_if_fail (filter != NULL);
+ g_return_if_fail (GST_IS_Y4MENCODE (filter));
outbuf = gst_buffer_new ();
GST_BUFFER_DATA (outbuf) = g_malloc (GST_BUFFER_SIZE (buf) + 256);
@@ -217,31 +210,32 @@ gst_y4mencode_chain (GstPad *pad,GstData *_data)
if (filter->init) {
header = "YUV4MPEG %d %d %d\nFRAME\n";
filter->init = FALSE;
- }
- else {
+ } else {
header = "FRAME\n";
}
snprintf (GST_BUFFER_DATA (outbuf), 255, header,
- filter->width, filter->height, filter->fps_idx);
+ filter->width, filter->height, filter->fps_idx);
len = strlen (GST_BUFFER_DATA (outbuf));
- memcpy (GST_BUFFER_DATA (outbuf) + len, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
+ memcpy (GST_BUFFER_DATA (outbuf) + len, GST_BUFFER_DATA (buf),
+ GST_BUFFER_SIZE (buf));
GST_BUFFER_SIZE (outbuf) = GST_BUFFER_SIZE (buf) + len;
- gst_buffer_unref(buf);
+ gst_buffer_unref (buf);
- gst_pad_push(filter->srcpad,GST_DATA (outbuf));
+ gst_pad_push (filter->srcpad, GST_DATA (outbuf));
}
static void
-gst_y4mencode_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
+gst_y4mencode_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec)
{
GstY4mEncode *filter;
/* it's not null if we got it, but it might not be ours */
- g_return_if_fail(GST_IS_Y4MENCODE(object));
- filter = GST_Y4MENCODE(object);
+ g_return_if_fail (GST_IS_Y4MENCODE (object));
+ filter = GST_Y4MENCODE (object);
switch (prop_id) {
default:
@@ -250,13 +244,14 @@ gst_y4mencode_set_property (GObject *object, guint prop_id, const GValue *value,
}
static void
-gst_y4mencode_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+gst_y4mencode_get_property (GObject * object, guint prop_id, GValue * value,
+ GParamSpec * pspec)
{
GstY4mEncode *filter;
/* it's not null if we got it, but it might not be ours */
- g_return_if_fail(GST_IS_Y4MENCODE(object));
- filter = GST_Y4MENCODE(object);
+ g_return_if_fail (GST_IS_Y4MENCODE (object));
+ filter = GST_Y4MENCODE (object);
switch (prop_id) {
default:
@@ -266,13 +261,13 @@ gst_y4mencode_get_property (GObject *object, guint prop_id, GValue *value, GPara
}
static GstElementStateReturn
-gst_y4mencode_change_state (GstElement *element)
+gst_y4mencode_change_state (GstElement * element)
{
GstY4mEncode *filter;
g_return_val_if_fail (GST_IS_Y4MENCODE (element), GST_STATE_FAILURE);
- filter = GST_Y4MENCODE(element);
+ filter = GST_Y4MENCODE (element);
if (GST_STATE_TRANSITION (element) == GST_STATE_NULL_TO_READY) {
filter->init = TRUE;
@@ -285,19 +280,14 @@ gst_y4mencode_change_state (GstElement *element)
}
static gboolean
-plugin_init (GstPlugin *plugin)
+plugin_init (GstPlugin * plugin)
{
- return gst_element_register (plugin, "y4menc", GST_RANK_NONE, GST_TYPE_Y4MENCODE);
+ return gst_element_register (plugin, "y4menc", GST_RANK_NONE,
+ GST_TYPE_Y4MENCODE);
}
-GST_PLUGIN_DEFINE (
- GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "y4menc",
- "Encodes a YUV frame into the yuv4mpeg format (mjpegtools)",
- plugin_init,
- VERSION,
- GST_LICENSE,
- GST_PACKAGE,
- GST_ORIGIN
-)
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ "y4menc",
+ "Encodes a YUV frame into the yuv4mpeg format (mjpegtools)",
+ plugin_init, VERSION, GST_LICENSE, GST_PACKAGE, GST_ORIGIN)
diff --git a/gst/y4m/gsty4mencode.h b/gst/y4m/gsty4mencode.h
index 07d369ccd..607b3e6d4 100644
--- a/gst/y4m/gsty4mencode.h
+++ b/gst/y4m/gsty4mencode.h
@@ -27,8 +27,9 @@
#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
+extern "C"
+{
+#endif /* __cplusplus */
#define GST_TYPE_Y4MENCODE \
@@ -42,30 +43,32 @@ extern "C" {
#define GST_IS_Y4MENCODE_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_Y4MENCODE))
-typedef struct _GstY4mEncode GstY4mEncode;
-typedef struct _GstY4mEncodeClass GstY4mEncodeClass;
+ typedef struct _GstY4mEncode GstY4mEncode;
+ typedef struct _GstY4mEncodeClass GstY4mEncodeClass;
-struct _GstY4mEncode {
- GstElement element;
+ struct _GstY4mEncode
+ {
+ GstElement element;
- GstPad *sinkpad,*srcpad;
+ GstPad *sinkpad, *srcpad;
- gint width, height;
- gfloat fps_idx;
+ gint width, height;
+ gfloat fps_idx;
- gboolean init;
+ gboolean init;
-};
+ };
-struct _GstY4mEncodeClass {
- GstElementClass parent_class;
-};
+ struct _GstY4mEncodeClass
+ {
+ GstElementClass parent_class;
+ };
-GType gst_y4mencode_get_type(void);
+ GType gst_y4mencode_get_type (void);
#ifdef __cplusplus
}
-#endif /* __cplusplus */
+#endif /* __cplusplus */
-#endif /* __GST_Y4MENCODE_H__ */
+#endif /* __GST_Y4MENCODE_H__ */