summaryrefslogtreecommitdiffstats
path: root/gst-libs/gst
diff options
context:
space:
mode:
Diffstat (limited to 'gst-libs/gst')
-rw-r--r--gst-libs/gst/audio/audio.c144
-rw-r--r--gst-libs/gst/audio/audio.h44
-rw-r--r--gst-libs/gst/audio/audioclock.c90
-rw-r--r--gst-libs/gst/audio/audioclock.h22
-rw-r--r--gst-libs/gst/audio/gstaudiofilter.c188
-rw-r--r--gst-libs/gst/audio/gstaudiofilter.h29
-rw-r--r--gst-libs/gst/audio/gstaudiofiltertemplate.c112
-rw-r--r--gst-libs/gst/colorbalance/colorbalance.c50
-rw-r--r--gst-libs/gst/colorbalance/colorbalance.h46
-rw-r--r--gst-libs/gst/colorbalance/colorbalancechannel.c32
-rw-r--r--gst-libs/gst/colorbalance/colorbalancechannel.h19
-rw-r--r--gst-libs/gst/floatcast/floatcast.h57
-rw-r--r--gst-libs/gst/gconf/gconf.c70
-rw-r--r--gst-libs/gst/gconf/gconf.h19
-rw-r--r--gst-libs/gst/gconf/test-gconf.c16
-rw-r--r--gst-libs/gst/gst-i18n-plugin.h4
-rw-r--r--gst-libs/gst/idct/dct.h5
-rw-r--r--gst-libs/gst/idct/fastintidct.c156
-rw-r--r--gst-libs/gst/idct/floatidct.c42
-rw-r--r--gst-libs/gst/idct/idct.c160
-rw-r--r--gst-libs/gst/idct/idct.h23
-rw-r--r--gst-libs/gst/idct/ieeetest.c293
-rw-r--r--gst-libs/gst/idct/intidct.c205
-rw-r--r--gst-libs/gst/idct/mmx32idct.c993
-rw-r--r--gst-libs/gst/media-info/media-info-priv.c378
-rw-r--r--gst-libs/gst/media-info/media-info-priv.h108
-rw-r--r--gst-libs/gst/media-info/media-info-test.c35
-rw-r--r--gst-libs/gst/media-info/media-info.c221
-rw-r--r--gst-libs/gst/media-info/media-info.h61
-rw-r--r--gst-libs/gst/mixer/mixer.c107
-rw-r--r--gst-libs/gst/mixer/mixer.h81
-rw-r--r--gst-libs/gst/mixer/mixertrack.c54
-rw-r--r--gst-libs/gst/mixer/mixertrack.h44
-rw-r--r--gst-libs/gst/navigation/navigation.c36
-rw-r--r--gst-libs/gst/navigation/navigation.h23
-rw-r--r--gst-libs/gst/play/play.c876
-rw-r--r--gst-libs/gst/play/play.h52
-rw-r--r--gst-libs/gst/propertyprobe/propertyprobe.c65
-rw-r--r--gst-libs/gst/propertyprobe/propertyprobe.h68
-rw-r--r--gst-libs/gst/resample/dtof.c56
-rw-r--r--gst-libs/gst/resample/dtos.c257
-rw-r--r--gst-libs/gst/resample/functable.c436
-rw-r--r--gst-libs/gst/resample/private.h97
-rw-r--r--gst-libs/gst/resample/resample.c1371
-rw-r--r--gst-libs/gst/resample/resample.h88
-rw-r--r--gst-libs/gst/resample/test.c523
-rw-r--r--gst-libs/gst/riff/riff-ids.h80
-rw-r--r--gst-libs/gst/riff/riff-media.c342
-rw-r--r--gst-libs/gst/riff/riff-media.h23
-rw-r--r--gst-libs/gst/riff/riff-read.c336
-rw-r--r--gst-libs/gst/riff/riff-read.h59
-rw-r--r--gst-libs/gst/riff/riff.c18
-rw-r--r--gst-libs/gst/tag/tag.h39
-rw-r--r--gst-libs/gst/tuner/tuner.c133
-rw-r--r--gst-libs/gst/tuner/tuner.h107
-rw-r--r--gst-libs/gst/tuner/tunerchannel.c40
-rw-r--r--gst-libs/gst/tuner/tunerchannel.h38
-rw-r--r--gst-libs/gst/tuner/tunernorm.c19
-rw-r--r--gst-libs/gst/tuner/tunernorm.h15
-rw-r--r--gst-libs/gst/video/gstvideosink.c48
-rw-r--r--gst-libs/gst/video/video.c47
-rw-r--r--gst-libs/gst/video/video.h24
-rw-r--r--gst-libs/gst/video/videosink.h63
-rw-r--r--gst-libs/gst/xoverlay/xoverlay.c76
-rw-r--r--gst-libs/gst/xoverlay/xoverlay.h39
-rw-r--r--gst-libs/gst/xwindowlistener/xwindowlistener.c291
-rw-r--r--gst-libs/gst/xwindowlistener/xwindowlistener.h72
67 files changed, 4702 insertions, 5063 deletions
diff --git a/gst-libs/gst/audio/audio.c b/gst-libs/gst/audio/audio.c
index d467af49..10a00142 100644
--- a/gst-libs/gst/audio/audio.c
+++ b/gst-libs/gst/audio/audio.c
@@ -26,7 +26,7 @@
#include <gst/gststructure.h>
int
-gst_audio_frame_byte_size (GstPad* pad)
+gst_audio_frame_byte_size (GstPad * pad)
{
/* calculate byte size of an audio frame
* this should be moved closer to the gstreamer core
@@ -45,20 +45,20 @@ gst_audio_frame_byte_size (GstPad* pad)
if (caps == NULL) {
/* ERROR: could not get caps of pad */
- g_warning ("gstaudio: could not get caps of pad %s:%s\n",
- GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad));
+ g_warning ("gstaudio: could not get caps of pad %s:%s\n",
+ GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad));
return 0;
}
structure = gst_caps_get_structure (caps, 0);
- gst_structure_get_int (structure, "width", &width);
+ gst_structure_get_int (structure, "width", &width);
gst_structure_get_int (structure, "channels", &channels);
- return (width / 8) * channels;
+ return (width / 8) * channels;
}
long
-gst_audio_frame_length (GstPad* pad, GstBuffer* buf)
+gst_audio_frame_length (GstPad * pad, GstBuffer * buf)
/* calculate length of buffer in frames
* this should be moved closer to the gstreamer core
* and be implemented for every mime type IMO
@@ -72,13 +72,13 @@ gst_audio_frame_length (GstPad* pad, GstBuffer* buf)
/* error */
return 0;
/* FIXME: this function assumes the buffer size to be a whole multiple
- * of the frame byte size
+ * of the frame byte size
*/
return GST_BUFFER_SIZE (buf) / frame_byte_size;
}
long
-gst_audio_frame_rate (GstPad *pad)
+gst_audio_frame_rate (GstPad * pad)
/*
* calculate frame rate (based on caps of pad)
* returns 0 if failed, rate if success
@@ -93,19 +93,18 @@ gst_audio_frame_rate (GstPad *pad)
if (caps == NULL) {
/* ERROR: could not get caps of pad */
- g_warning ("gstaudio: could not get caps of pad %s:%s\n",
- GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad));
+ g_warning ("gstaudio: could not get caps of pad %s:%s\n",
+ GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad));
return 0;
- }
- else {
+ } else {
structure = gst_caps_get_structure (caps, 0);
- gst_structure_get_int (structure, "rate", &rate);
+ gst_structure_get_int (structure, "rate", &rate);
return rate;
}
}
-double
-gst_audio_length (GstPad* pad, GstBuffer* buf)
+double
+gst_audio_length (GstPad * pad, GstBuffer * buf)
{
/* calculate length in seconds
* of audio buffer buf
@@ -125,20 +124,17 @@ gst_audio_length (GstPad* pad, GstBuffer* buf)
g_assert (GST_IS_BUFFER (buf));
/* get caps of pad */
caps = GST_PAD_CAPS (pad);
- if (caps == NULL)
- {
+ if (caps == NULL) {
/* ERROR: could not get caps of pad */
- g_warning ("gstaudio: could not get caps of pad %s:%s\n",
- GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad));
+ g_warning ("gstaudio: could not get caps of pad %s:%s\n",
+ GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad));
length = 0.0;
- }
- else
- {
+ } else {
structure = gst_caps_get_structure (caps, 0);
bytes = GST_BUFFER_SIZE (buf);
- gst_structure_get_int (structure, "width", &width);
- gst_structure_get_int (structure, "channels", &channels);
- gst_structure_get_int (structure, "rate", &rate);
+ gst_structure_get_int (structure, "width", &width);
+ gst_structure_get_int (structure, "channels", &channels);
+ gst_structure_get_int (structure, "rate", &rate);
g_assert (bytes != 0);
g_assert (width != 0);
@@ -150,8 +146,8 @@ gst_audio_length (GstPad* pad, GstBuffer* buf)
return length;
}
-long
-gst_audio_highest_sample_value (GstPad* pad)
+long
+gst_audio_highest_sample_value (GstPad * pad)
/* calculate highest possible sample value
* based on capabilities of pad
*/
@@ -160,25 +156,25 @@ gst_audio_highest_sample_value (GstPad* pad)
gint width = 0;
const GstCaps *caps = NULL;
GstStructure *structure;
-
+
caps = GST_PAD_CAPS (pad);
- if (caps == NULL)
- {
- g_warning ("gstaudio: could not get caps of pad %s:%s\n",
- GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad));
+ if (caps == NULL) {
+ g_warning ("gstaudio: could not get caps of pad %s:%s\n",
+ GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad));
}
-
+
structure = gst_caps_get_structure (caps, 0);
- gst_structure_get_int (structure, "width", &width);
- gst_structure_get_boolean (structure, "signed", &is_signed);
-
- if (is_signed) --width;
+ gst_structure_get_int (structure, "width", &width);
+ gst_structure_get_boolean (structure, "signed", &is_signed);
+
+ if (is_signed)
+ --width;
/* example : 16 bit, signed : samples between -32768 and 32767 */
return ((long) (1 << width));
}
-gboolean
-gst_audio_is_buffer_framed (GstPad* pad, GstBuffer* buf)
+gboolean
+gst_audio_is_buffer_framed (GstPad * pad, GstBuffer * buf)
/* check if the buffer size is a whole multiple of the frame size */
{
if (GST_BUFFER_SIZE (buf) % gst_audio_frame_byte_size (pad) == 0)
@@ -199,8 +195,8 @@ gst_audio_is_buffer_framed (GstPad* pad, GstBuffer* buf)
* number of list values, and each of the values, terminating with NULL
*/
static void
-_gst_audio_structure_set_list (GstStructure *structure, const gchar *fieldname,
- GType type, int number, ...)
+_gst_audio_structure_set_list (GstStructure * structure,
+ const gchar * fieldname, GType type, int number, ...)
{
va_list varargs;
GValue value = { 0 };
@@ -214,27 +210,27 @@ _gst_audio_structure_set_list (GstStructure *structure, const gchar *fieldname,
va_start (varargs, number);
- for (j = 0; j < number; ++j)
- {
+ for (j = 0; j < number; ++j) {
int i;
gboolean b;
GValue list_value = { 0 };
- switch (type)
- {
+ switch (type) {
case G_TYPE_INT:
- i = va_arg (varargs, int);
- g_value_init (&list_value, G_TYPE_INT);
- g_value_set_int (&list_value, i);
- break;
+ i = va_arg (varargs, int);
+
+ g_value_init (&list_value, G_TYPE_INT);
+ g_value_set_int (&list_value, i);
+ break;
case G_TYPE_BOOLEAN:
- b = va_arg (varargs, gboolean);
- g_value_init (&list_value, G_TYPE_BOOLEAN);
- g_value_set_boolean (&list_value, b);
- break;
- default:
- g_warning ("_gst_audio_structure_set_list: LIST of given type not implemented.");
+ b = va_arg (varargs, gboolean);
+ g_value_init (&list_value, G_TYPE_BOOLEAN);
+ g_value_set_boolean (&list_value, b);
+ break;
+ default:
+ g_warning
+ ("_gst_audio_structure_set_list: LIST of given type not implemented.");
}
g_array_append_val (array, list_value);
@@ -244,38 +240,38 @@ _gst_audio_structure_set_list (GstStructure *structure, const gchar *fieldname,
}
void
-gst_audio_structure_set_int (GstStructure *structure, GstAudioFieldFlag flag)
+gst_audio_structure_set_int (GstStructure * structure, GstAudioFieldFlag flag)
{
if (flag & GST_AUDIO_FIELD_RATE)
- gst_structure_set (structure, "rate", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL);
+ gst_structure_set (structure, "rate", GST_TYPE_INT_RANGE, 1, G_MAXINT,
+ NULL);
if (flag & GST_AUDIO_FIELD_CHANNELS)
- gst_structure_set (structure, "channels", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL);
+ gst_structure_set (structure, "channels", GST_TYPE_INT_RANGE, 1, G_MAXINT,
+ NULL);
if (flag & GST_AUDIO_FIELD_ENDIANNESS)
- _gst_audio_structure_set_list (structure, "endianness", G_TYPE_INT, 2, G_LITTLE_ENDIAN, G_BIG_ENDIAN, NULL);
+ _gst_audio_structure_set_list (structure, "endianness", G_TYPE_INT, 2,
+ G_LITTLE_ENDIAN, G_BIG_ENDIAN, NULL);
if (flag & GST_AUDIO_FIELD_WIDTH)
- _gst_audio_structure_set_list (structure, "width", G_TYPE_INT, 3, 8, 16, 32, NULL);
+ _gst_audio_structure_set_list (structure, "width", G_TYPE_INT, 3, 8, 16, 32,
+ NULL);
if (flag & GST_AUDIO_FIELD_DEPTH)
gst_structure_set (structure, "depth", GST_TYPE_INT_RANGE, 1, 32, NULL);
if (flag & GST_AUDIO_FIELD_SIGNED)
- _gst_audio_structure_set_list (structure, "signed", G_TYPE_BOOLEAN, 2, TRUE, FALSE, NULL);
+ _gst_audio_structure_set_list (structure, "signed", G_TYPE_BOOLEAN, 2, TRUE,
+ FALSE, NULL);
if (flag & GST_AUDIO_FIELD_BUFFER_FRAMES)
- gst_structure_set (structure, "buffer-frames", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL);
+ gst_structure_set (structure, "buffer-frames", GST_TYPE_INT_RANGE, 1,
+ G_MAXINT, NULL);
}
static gboolean
-plugin_init (GstPlugin *plugin)
+plugin_init (GstPlugin * plugin)
{
return TRUE;
}
-GST_PLUGIN_DEFINE (
- GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "gstaudio",
- "Support services for audio plugins",
- plugin_init,
- VERSION,
- GST_LICENSE,
- GST_PACKAGE,
- GST_ORIGIN
-);
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ "gstaudio",
+ "Support services for audio plugins",
+ plugin_init, VERSION, GST_LICENSE, GST_PACKAGE, GST_ORIGIN);
diff --git a/gst-libs/gst/audio/audio.h b/gst-libs/gst/audio/audio.h
index 4a3428dd..5f21e018 100644
--- a/gst-libs/gst/audio/audio.h
+++ b/gst-libs/gst/audio/audio.h
@@ -26,7 +26,6 @@
#define __GST_AUDIO_AUDIO_H__
G_BEGIN_DECLS
-
/* For people that are looking at this source: the purpose of these defines is
* to make GstCaps a bit easier, in that you don't have to know all of the
* properties that need to be defined. you can just use these macros. currently
@@ -50,9 +49,7 @@ G_BEGIN_DECLS
*
* Andy Wingo, 18 August 2001
* Thomas, 6 September 2002 */
-
#define GST_AUDIO_DEF_RATE 44100
-
#define GST_AUDIO_INT_PAD_TEMPLATE_CAPS \
"audio/x-raw-int, " \
"rate = (int) [ 1, MAX ], " \
@@ -60,9 +57,7 @@ G_BEGIN_DECLS
"endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, " \
"width = (int) { 8, 16, 32 }, " \
"depth = (int) [ 1, 32 ], " \
- "signed = (boolean) { true, false }"
-
-
+ "signed = (boolean) { true, false }"
/* "standard" int audio is native order, 16 bit stereo. */
#define GST_AUDIO_INT_STANDARD_PAD_TEMPLATE_CAPS \
"audio/x-raw-int, " \
@@ -71,8 +66,7 @@ G_BEGIN_DECLS
"endianness = (int) BYTE_ORDER, " \
"width = (int) 16, " \
"depth = (int) 16, " \
- "signed = (boolean) true"
-
+ "signed = (boolean) true"
#define GST_AUDIO_FLOAT_PAD_TEMPLATE_CAPS \
"audio/x-raw-float, " \
"rate = (int) [ 1, MAX ], " \
@@ -80,7 +74,6 @@ G_BEGIN_DECLS
"endianness = (int) { LITTLE_ENDIAN , BIG_ENDIAN }, " \
"width = (int) { 32, 64 }, " \
"buffer-frames = (int) [ 1, MAX]"
-
/* "standard" float audio is native order, 32 bit mono. */
#define GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS \
"audio/x-raw-float, " \
@@ -88,43 +81,42 @@ G_BEGIN_DECLS
"channels = (int) 1, " \
"endianness = (int) BYTE_ORDER, " \
"buffer-frames = (int) [ 1, MAX]"
-
/*
* this library defines and implements some helper functions for audio
* handling
*/
-
/* get byte size of audio frame (based on caps of pad */
-int gst_audio_frame_byte_size (GstPad* pad);
+int gst_audio_frame_byte_size (GstPad * pad);
/* get length in frames of buffer */
-long gst_audio_frame_length (GstPad* pad, GstBuffer* buf);
+long gst_audio_frame_length (GstPad * pad, GstBuffer * buf);
/* get frame rate based on caps */
-long gst_audio_frame_rate (GstPad *pad);
+long gst_audio_frame_rate (GstPad * pad);
/* calculate length in seconds of audio buffer buf based on caps of pad */
-double gst_audio_length (GstPad* pad, GstBuffer* buf);
+double gst_audio_length (GstPad * pad, GstBuffer * buf);
/* calculate highest possible sample value based on capabilities of pad */
-long gst_audio_highest_sample_value (GstPad* pad);
+long gst_audio_highest_sample_value (GstPad * pad);
/* check if the buffer size is a whole multiple of the frame size */
-gboolean gst_audio_is_buffer_framed (GstPad* pad, GstBuffer* buf);
+gboolean gst_audio_is_buffer_framed (GstPad * pad, GstBuffer * buf);
/* functions useful for _getcaps functions */
-typedef enum {
- GST_AUDIO_FIELD_RATE = (1 << 0),
- GST_AUDIO_FIELD_CHANNELS = (1 << 1),
- GST_AUDIO_FIELD_ENDIANNESS = (1 << 2),
- GST_AUDIO_FIELD_WIDTH = (1 << 3),
- GST_AUDIO_FIELD_DEPTH = (1 << 4),
- GST_AUDIO_FIELD_SIGNED = (1 << 5),
+typedef enum
+{
+ GST_AUDIO_FIELD_RATE = (1 << 0),
+ GST_AUDIO_FIELD_CHANNELS = (1 << 1),
+ GST_AUDIO_FIELD_ENDIANNESS = (1 << 2),
+ GST_AUDIO_FIELD_WIDTH = (1 << 3),
+ GST_AUDIO_FIELD_DEPTH = (1 << 4),
+ GST_AUDIO_FIELD_SIGNED = (1 << 5),
GST_AUDIO_FIELD_BUFFER_FRAMES = (1 << 6)
} GstAudioFieldFlag;
-void gst_audio_structure_set_int (GstStructure *structure, GstAudioFieldFlag flag);
+void gst_audio_structure_set_int (GstStructure * structure,
+ GstAudioFieldFlag flag);
G_END_DECLS
-
#endif /* __GST_AUDIO_AUDIO_H__ */
diff --git a/gst-libs/gst/audio/audioclock.c b/gst-libs/gst/audio/audioclock.c
index 77c7e576..d6d1da45 100644
--- a/gst-libs/gst/audio/audioclock.c
+++ b/gst-libs/gst/audio/audioclock.c
@@ -26,23 +26,24 @@
#include "audioclock.h"
-static void gst_audio_clock_class_init (GstAudioClockClass *klass);
-static void gst_audio_clock_init (GstAudioClock *clock);
+static void gst_audio_clock_class_init (GstAudioClockClass * klass);
+static void gst_audio_clock_init (GstAudioClock * clock);
-static GstClockTime gst_audio_clock_get_internal_time (GstClock *clock);
-static GstClockReturn gst_audio_clock_id_wait_async (GstClock *clock,
- GstClockEntry *entry);
-static void gst_audio_clock_id_unschedule (GstClock *clock,
- GstClockEntry *entry);
+static GstClockTime gst_audio_clock_get_internal_time (GstClock * clock);
+static GstClockReturn gst_audio_clock_id_wait_async (GstClock * clock,
+ GstClockEntry * entry);
+static void gst_audio_clock_id_unschedule (GstClock * clock,
+ GstClockEntry * entry);
static GstSystemClockClass *parent_class = NULL;
+
/* static guint gst_audio_clock_signals[LAST_SIGNAL] = { 0 }; */
-
+
GType
gst_audio_clock_get_type (void)
-{
+{
static GType clock_type = 0;
-
+
if (!clock_type) {
static const GTypeInfo clock_info = {
sizeof (GstAudioClockClass),
@@ -57,32 +58,32 @@ gst_audio_clock_get_type (void)
NULL
};
clock_type = g_type_register_static (GST_TYPE_SYSTEM_CLOCK, "GstAudioClock",
- &clock_info, 0);
+ &clock_info, 0);
}
return clock_type;
}
static void
-gst_audio_clock_class_init (GstAudioClockClass *klass)
+gst_audio_clock_class_init (GstAudioClockClass * klass)
{
GObjectClass *gobject_class;
GstObjectClass *gstobject_class;
GstClockClass *gstclock_class;
- gobject_class = (GObjectClass*) klass;
- gstobject_class = (GstObjectClass*) klass;
- gstclock_class = (GstClockClass*) klass;
+ gobject_class = (GObjectClass *) klass;
+ gstobject_class = (GstObjectClass *) klass;
+ gstclock_class = (GstClockClass *) klass;
parent_class = g_type_class_ref (GST_TYPE_SYSTEM_CLOCK);
- gstclock_class->get_internal_time = gst_audio_clock_get_internal_time;
- gstclock_class->wait_async = gst_audio_clock_id_wait_async;
- gstclock_class->unschedule = gst_audio_clock_id_unschedule;
+ gstclock_class->get_internal_time = gst_audio_clock_get_internal_time;
+ gstclock_class->wait_async = gst_audio_clock_id_wait_async;
+ gstclock_class->unschedule = gst_audio_clock_id_unschedule;
}
static void
-gst_audio_clock_init (GstAudioClock *clock)
+gst_audio_clock_init (GstAudioClock * clock)
{
gst_object_set_name (GST_OBJECT (clock), "GstAudioClock");
@@ -90,20 +91,22 @@ gst_audio_clock_init (GstAudioClock *clock)
clock->prev2 = 0;
}
-GstClock*
-gst_audio_clock_new (gchar *name, GstAudioClockGetTimeFunc func, gpointer user_data)
+GstClock *
+gst_audio_clock_new (gchar * name, GstAudioClockGetTimeFunc func,
+ gpointer user_data)
{
- GstAudioClock *aclock = GST_AUDIO_CLOCK (g_object_new (GST_TYPE_AUDIO_CLOCK, NULL));
+ GstAudioClock *aclock =
+ GST_AUDIO_CLOCK (g_object_new (GST_TYPE_AUDIO_CLOCK, NULL));
aclock->func = func;
aclock->user_data = user_data;
aclock->adjust = 0;
- return (GstClock*)aclock;
+ return (GstClock *) aclock;
}
void
-gst_audio_clock_set_active (GstAudioClock *aclock, gboolean active)
+gst_audio_clock_set_active (GstAudioClock * aclock, gboolean active)
{
GstClockTime time;
GstClock *clock;
@@ -117,8 +120,9 @@ gst_audio_clock_set_active (GstAudioClock *aclock, gboolean active)
aclock->adjust = time - aclock->func (clock, aclock->user_data);
} else {
GTimeVal timeval;
+
g_get_current_time (&timeval);
-
+
aclock->adjust = GST_TIMEVAL_TO_TIME (timeval) - time;
}
@@ -126,22 +130,22 @@ gst_audio_clock_set_active (GstAudioClock *aclock, gboolean active)
}
static GstClockTime
-gst_audio_clock_get_internal_time (GstClock *clock)
+gst_audio_clock_get_internal_time (GstClock * clock)
{
GstAudioClock *aclock = GST_AUDIO_CLOCK (clock);
-
+
if (aclock->active) {
return aclock->func (clock, aclock->user_data) + aclock->adjust;
} else {
GTimeVal timeval;
-
+
g_get_current_time (&timeval);
return GST_TIMEVAL_TO_TIME (timeval);
}
}
void
-gst_audio_clock_update_time (GstAudioClock *aclock, GstClockTime time)
+gst_audio_clock_update_time (GstAudioClock * aclock, GstClockTime time)
{
/* I don't know of a purpose in updating these; perhaps they can be removed */
aclock->prev2 = aclock->prev1;
@@ -150,43 +154,41 @@ gst_audio_clock_update_time (GstAudioClock *aclock, GstClockTime time)
/* FIXME: the wait_async subsystem should be made threadsafe, but I don't want
* to lock and unlock a mutex on every iteration... */
while (aclock->async_entries) {
- GstClockEntry *entry = (GstClockEntry*)aclock->async_entries->data;
-
+ GstClockEntry *entry = (GstClockEntry *) aclock->async_entries->data;
+
if (entry->time > time)
break;
- entry->func ((GstClock*)aclock, time, entry, entry->user_data);
+ entry->func ((GstClock *) aclock, time, entry, entry->user_data);
aclock->async_entries = g_slist_delete_link (aclock->async_entries,
- aclock->async_entries);
+ aclock->async_entries);
/* do I need to free the entry? */
}
}
static gint
-compare_clock_entries (GstClockEntry *entry1, GstClockEntry *entry2)
+compare_clock_entries (GstClockEntry * entry1, GstClockEntry * entry2)
{
return entry1->time - entry2->time;
}
static GstClockReturn
-gst_audio_clock_id_wait_async (GstClock *clock, GstClockEntry *entry)
+gst_audio_clock_id_wait_async (GstClock * clock, GstClockEntry * entry)
{
- GstAudioClock *aclock = (GstAudioClock*)clock;
-
+ GstAudioClock *aclock = (GstAudioClock *) clock;
+
aclock->async_entries = g_slist_insert_sorted (aclock->async_entries,
- entry,
- (GCompareFunc)compare_clock_entries);
+ entry, (GCompareFunc) compare_clock_entries);
/* is this the proper return val? */
return GST_CLOCK_EARLY;
}
static void
-gst_audio_clock_id_unschedule (GstClock *clock, GstClockEntry *entry)
+gst_audio_clock_id_unschedule (GstClock * clock, GstClockEntry * entry)
{
- GstAudioClock *aclock = (GstAudioClock*)clock;
-
- aclock->async_entries = g_slist_remove (aclock->async_entries,
- entry);
+ GstAudioClock *aclock = (GstAudioClock *) clock;
+
+ aclock->async_entries = g_slist_remove (aclock->async_entries, entry);
}
diff --git a/gst-libs/gst/audio/audioclock.h b/gst-libs/gst/audio/audioclock.h
index 17439242..abb07541 100644
--- a/gst-libs/gst/audio/audioclock.h
+++ b/gst-libs/gst/audio/audioclock.h
@@ -27,7 +27,6 @@
#include <gst/gstsystemclock.h>
G_BEGIN_DECLS
-
#define GST_TYPE_AUDIO_CLOCK \
(gst_audio_clock_get_type())
#define GST_AUDIO_CLOCK(obj) \
@@ -38,14 +37,15 @@ G_BEGIN_DECLS
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_CLOCK))
#define GST_IS_AUDIO_CLOCK_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_CLOCK))
-
typedef struct _GstAudioClock GstAudioClock;
typedef struct _GstAudioClockClass GstAudioClockClass;
-typedef GstClockTime (*GstAudioClockGetTimeFunc) (GstClock *clock, gpointer user_data);
+typedef GstClockTime (*GstAudioClockGetTimeFunc) (GstClock * clock,
+ gpointer user_data);
-struct _GstAudioClock {
+struct _GstAudioClock
+{
GstSystemClock clock;
GstClockTime prev1, prev2;
@@ -63,19 +63,19 @@ struct _GstAudioClock {
gpointer _gst_reserved[GST_PADDING];
};
-struct _GstAudioClockClass {
+struct _GstAudioClockClass
+{
GstSystemClockClass parent_class;
gpointer _gst_reserved[GST_PADDING];
};
-GType gst_audio_clock_get_type (void);
-GstClock* gst_audio_clock_new (gchar *name, GstAudioClockGetTimeFunc func,
- gpointer user_data);
-void gst_audio_clock_set_active (GstAudioClock *aclock, gboolean active);
+GType gst_audio_clock_get_type (void);
+GstClock *gst_audio_clock_new (gchar * name, GstAudioClockGetTimeFunc func,
+ gpointer user_data);
+void gst_audio_clock_set_active (GstAudioClock * aclock, gboolean active);
-void gst_audio_clock_update_time (GstAudioClock *aclock, GstClockTime time);
+void gst_audio_clock_update_time (GstAudioClock * aclock, GstClockTime time);
G_END_DECLS
-
#endif /* __GST_AUDIO_CLOCK_H__ */
diff --git a/gst-libs/gst/audio/gstaudiofilter.c b/gst-libs/gst/audio/gstaudiofilter.c
index 35ed4875..ad491bb6 100644
--- a/gst-libs/gst/audio/gstaudiofilter.c
+++ b/gst-libs/gst/audio/gstaudiofilter.c
@@ -29,26 +29,30 @@
/* GstAudiofilter signals and args */
-enum {
+enum
+{
/* FILL ME */
LAST_SIGNAL
};
-enum {
+enum
+{
ARG_0,
ARG_METHOD,
/* FILL ME */
};
-static void gst_audiofilter_base_init (gpointer g_class);
-static void gst_audiofilter_class_init (gpointer g_class, gpointer class_data);
-static void gst_audiofilter_init (GTypeInstance *instance, gpointer g_class);
+static void gst_audiofilter_base_init (gpointer g_class);
+static void gst_audiofilter_class_init (gpointer g_class, gpointer class_data);
+static void gst_audiofilter_init (GTypeInstance * instance, gpointer g_class);
-static void gst_audiofilter_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
-static void gst_audiofilter_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
+static void gst_audiofilter_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec);
+static void gst_audiofilter_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec);
-static void gst_audiofilter_chain (GstPad *pad, GstData *_data);
-GstCaps * gst_audiofilter_class_get_capslist(GstAudiofilterClass *klass);
+static void gst_audiofilter_chain (GstPad * pad, GstData * _data);
+GstCaps *gst_audiofilter_class_get_capslist (GstAudiofilterClass * klass);
static GstElementClass *parent_class = NULL;
@@ -59,23 +63,24 @@ gst_audiofilter_get_type (void)
if (!audiofilter_type) {
static const GTypeInfo audiofilter_info = {
- sizeof(GstAudiofilterClass),
+ sizeof (GstAudiofilterClass),
gst_audiofilter_base_init,
NULL,
gst_audiofilter_class_init,
NULL,
NULL,
- sizeof(GstAudiofilter),
+ sizeof (GstAudiofilter),
0,
gst_audiofilter_init,
};
- audiofilter_type = g_type_register_static(GST_TYPE_ELEMENT,
+ audiofilter_type = g_type_register_static (GST_TYPE_ELEMENT,
"GstAudiofilter", &audiofilter_info, G_TYPE_FLAG_ABSTRACT);
}
return audiofilter_type;
}
-static void gst_audiofilter_base_init (gpointer g_class)
+static void
+gst_audiofilter_base_init (gpointer g_class)
{
static GstElementDetails audiofilter_details = {
"Audio filter base class",
@@ -89,24 +94,25 @@ static void gst_audiofilter_base_init (gpointer g_class)
gst_element_class_set_details (element_class, &audiofilter_details);
}
-static void gst_audiofilter_class_init (gpointer g_class, gpointer class_data)
+static void
+gst_audiofilter_class_init (gpointer g_class, gpointer class_data)
{
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
GstAudiofilterClass *klass;
- klass = (GstAudiofilterClass *)g_class;
- gobject_class = (GObjectClass*)klass;
- gstelement_class = (GstElementClass*)klass;
+ klass = (GstAudiofilterClass *) g_class;
+ 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_audiofilter_set_property;
gobject_class->get_property = gst_audiofilter_get_property;
}
static GstPadLinkReturn
-gst_audiofilter_link (GstPad *pad, const GstCaps *caps)
+gst_audiofilter_link (GstPad * pad, const GstCaps * caps)
{
GstAudiofilter *audiofilter;
GstPadLinkReturn ret;
@@ -114,11 +120,10 @@ gst_audiofilter_link (GstPad *pad, const GstCaps *caps)
GstStructure *structure;
GstAudiofilterClass *audiofilter_class;
- GST_DEBUG("gst_audiofilter_link");
+ GST_DEBUG ("gst_audiofilter_link");
audiofilter = GST_AUDIOFILTER (gst_pad_get_parent (pad));
- audiofilter_class = GST_AUDIOFILTER_CLASS (
- G_OBJECT_GET_CLASS (audiofilter));
-
+ audiofilter_class = GST_AUDIOFILTER_CLASS (G_OBJECT_GET_CLASS (audiofilter));
+
if (pad == audiofilter->srcpad) {
link_ret = gst_pad_try_set_caps (audiofilter->sinkpad, caps);
@@ -135,53 +140,55 @@ gst_audiofilter_link (GstPad *pad, const GstCaps *caps)
if (strcmp (gst_structure_get_name (structure), "audio/x-raw-int") == 0) {
ret = gst_structure_get_int (structure, "depth", &audiofilter->depth);
ret &= gst_structure_get_int (structure, "width", &audiofilter->width);
- ret &= gst_structure_get_int (structure, "channels", &audiofilter->channels);
+ ret &=
+ gst_structure_get_int (structure, "channels", &audiofilter->channels);
} else if (strcmp (gst_structure_get_name (structure), "audio/x-raw-float")
== 0) {
} else {
- g_assert_not_reached();
+ g_assert_not_reached ();
}
ret &= gst_structure_get_int (structure, "rate", &audiofilter->rate);
- audiofilter->bytes_per_sample = (audiofilter->width/8) *
- audiofilter->channels;
+ audiofilter->bytes_per_sample = (audiofilter->width / 8) *
+ audiofilter->channels;
- if (audiofilter_class->setup) (audiofilter_class->setup) (audiofilter);
+ if (audiofilter_class->setup)
+ (audiofilter_class->setup) (audiofilter);
return GST_PAD_LINK_OK;
}
static void
-gst_audiofilter_init (GTypeInstance *instance, gpointer g_class)
+gst_audiofilter_init (GTypeInstance * instance, gpointer g_class)
{
GstAudiofilter *audiofilter = GST_AUDIOFILTER (instance);
GstPadTemplate *pad_template;
- GST_DEBUG("gst_audiofilter_init");
-
- pad_template = gst_element_class_get_pad_template(GST_ELEMENT_CLASS(g_class),
- "sink");
- g_return_if_fail(pad_template != NULL);
- audiofilter->sinkpad = gst_pad_new_from_template(pad_template, "sink");
- gst_element_add_pad(GST_ELEMENT(audiofilter),audiofilter->sinkpad);
- gst_pad_set_chain_function(audiofilter->sinkpad,gst_audiofilter_chain);
- gst_pad_set_link_function(audiofilter->sinkpad,gst_audiofilter_link);
- gst_pad_set_getcaps_function(audiofilter->sinkpad,gst_pad_proxy_getcaps);
-
- pad_template = gst_element_class_get_pad_template(GST_ELEMENT_CLASS(g_class),
- "src");
- g_return_if_fail(pad_template != NULL);
- audiofilter->srcpad = gst_pad_new_from_template(pad_template, "src");
- gst_element_add_pad(GST_ELEMENT(audiofilter),audiofilter->srcpad);
- gst_pad_set_link_function(audiofilter->srcpad,gst_audiofilter_link);
- gst_pad_set_getcaps_function(audiofilter->srcpad,gst_pad_proxy_getcaps);
+ GST_DEBUG ("gst_audiofilter_init");
+
+ pad_template =
+ gst_element_class_get_pad_template (GST_ELEMENT_CLASS (g_class), "sink");
+ g_return_if_fail (pad_template != NULL);
+ audiofilter->sinkpad = gst_pad_new_from_template (pad_template, "sink");
+ gst_element_add_pad (GST_ELEMENT (audiofilter), audiofilter->sinkpad);
+ gst_pad_set_chain_function (audiofilter->sinkpad, gst_audiofilter_chain);
+ gst_pad_set_link_function (audiofilter->sinkpad, gst_audiofilter_link);
+ gst_pad_set_getcaps_function (audiofilter->sinkpad, gst_pad_proxy_getcaps);
+
+ pad_template =
+ gst_element_class_get_pad_template (GST_ELEMENT_CLASS (g_class), "src");
+ g_return_if_fail (pad_template != NULL);
+ audiofilter->srcpad = gst_pad_new_from_template (pad_template, "src");
+ gst_element_add_pad (GST_ELEMENT (audiofilter), audiofilter->srcpad);
+ gst_pad_set_link_function (audiofilter->srcpad, gst_audiofilter_link);
+ gst_pad_set_getcaps_function (audiofilter->srcpad, gst_pad_proxy_getcaps);
audiofilter->inited = FALSE;
}
static void
-gst_audiofilter_chain (GstPad *pad, GstData *data)
+gst_audiofilter_chain (GstPad * pad, GstData * data)
{
GstBuffer *inbuf = GST_BUFFER (data);
GstAudiofilter *audiofilter;
@@ -196,60 +203,60 @@ gst_audiofilter_chain (GstPad *pad, GstData *data)
audiofilter = GST_AUDIOFILTER (gst_pad_get_parent (pad));
//g_return_if_fail (audiofilter->inited);
- audiofilter_class = GST_AUDIOFILTER_CLASS (
- G_OBJECT_GET_CLASS (audiofilter));
+ audiofilter_class = GST_AUDIOFILTER_CLASS (G_OBJECT_GET_CLASS (audiofilter));
GST_DEBUG ("gst_audiofilter_chain: got buffer of %d bytes in '%s'",
- GST_BUFFER_SIZE(inbuf), GST_OBJECT_NAME (audiofilter));
-
- if(audiofilter->passthru){
- gst_pad_push(audiofilter->srcpad, data);
+ GST_BUFFER_SIZE (inbuf), GST_OBJECT_NAME (audiofilter));
+
+ if (audiofilter->passthru) {
+ gst_pad_push (audiofilter->srcpad, data);
return;
}
audiofilter->size = GST_BUFFER_SIZE (inbuf);
audiofilter->n_samples = audiofilter->size / audiofilter->bytes_per_sample;
- if (gst_data_is_writable(data)) {
+ if (gst_data_is_writable (data)) {
if (audiofilter_class->filter_inplace) {
(audiofilter_class->filter_inplace) (audiofilter, inbuf);
outbuf = inbuf;
} else {
- outbuf = gst_buffer_new_and_alloc (GST_BUFFER_SIZE(inbuf));
- GST_BUFFER_DURATION(outbuf) = GST_BUFFER_DURATION(inbuf);
- GST_BUFFER_TIMESTAMP(outbuf) = GST_BUFFER_TIMESTAMP(inbuf);
+ outbuf = gst_buffer_new_and_alloc (GST_BUFFER_SIZE (inbuf));
+ GST_BUFFER_DURATION (outbuf) = GST_BUFFER_DURATION (inbuf);
+ GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (inbuf);
(audiofilter_class->filter) (audiofilter, outbuf, inbuf);
- gst_buffer_unref(inbuf);
+ gst_buffer_unref (inbuf);
}
} else {
- outbuf = gst_buffer_new_and_alloc (GST_BUFFER_SIZE(inbuf));
- GST_BUFFER_DURATION(outbuf) = GST_BUFFER_DURATION(inbuf);
- GST_BUFFER_TIMESTAMP(outbuf) = GST_BUFFER_TIMESTAMP(inbuf);
+ outbuf = gst_buffer_new_and_alloc (GST_BUFFER_SIZE (inbuf));
+ GST_BUFFER_DURATION (outbuf) = GST_BUFFER_DURATION (inbuf);
+ GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (inbuf);
if (audiofilter_class->filter) {
(audiofilter_class->filter) (audiofilter, outbuf, inbuf);
} else {
- memcpy(GST_BUFFER_DATA(outbuf), GST_BUFFER_DATA(inbuf),
- GST_BUFFER_SIZE(inbuf));
+ memcpy (GST_BUFFER_DATA (outbuf), GST_BUFFER_DATA (inbuf),
+ GST_BUFFER_SIZE (inbuf));
(audiofilter_class->filter_inplace) (audiofilter, outbuf);
}
- gst_buffer_unref(inbuf);
+ gst_buffer_unref (inbuf);
}
- gst_pad_push(audiofilter->srcpad, GST_DATA (outbuf));
+ gst_pad_push (audiofilter->srcpad, GST_DATA (outbuf));
}
static void
-gst_audiofilter_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
+gst_audiofilter_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec)
{
GstAudiofilter *src;
/* it's not null if we got it, but it might not be ours */
- g_return_if_fail(GST_IS_AUDIOFILTER(object));
- src = GST_AUDIOFILTER(object);
+ g_return_if_fail (GST_IS_AUDIOFILTER (object));
+ src = GST_AUDIOFILTER (object);
- GST_DEBUG("gst_audiofilter_set_property");
+ GST_DEBUG ("gst_audiofilter_set_property");
switch (prop_id) {
default:
break;
@@ -257,13 +264,14 @@ gst_audiofilter_set_property (GObject *object, guint prop_id, const GValue *valu
}
static void
-gst_audiofilter_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+gst_audiofilter_get_property (GObject * object, guint prop_id, GValue * value,
+ GParamSpec * pspec)
{
GstAudiofilter *src;
/* it's not null if we got it, but it might not be ours */
- g_return_if_fail(GST_IS_AUDIOFILTER(object));
- src = GST_AUDIOFILTER(object);
+ g_return_if_fail (GST_IS_AUDIOFILTER (object));
+ src = GST_AUDIOFILTER (object);
switch (prop_id) {
default:
@@ -272,37 +280,31 @@ gst_audiofilter_get_property (GObject *object, guint prop_id, GValue *value, GPa
}
}
-void gst_audiofilter_class_add_pad_templates (
- GstAudiofilterClass *audiofilter_class, const GstCaps *caps)
+void
+gst_audiofilter_class_add_pad_templates (GstAudiofilterClass *
+ audiofilter_class, const GstCaps * caps)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (audiofilter_class);
- audiofilter_class->caps = gst_caps_copy(caps);
+ audiofilter_class->caps = gst_caps_copy (caps);
gst_element_class_add_pad_template (element_class,
- gst_pad_template_new("src", GST_PAD_SRC, GST_PAD_ALWAYS,
- gst_caps_copy(caps)));
+ gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS,
+ gst_caps_copy (caps)));
gst_element_class_add_pad_template (element_class,
- gst_pad_template_new("sink", GST_PAD_SINK, GST_PAD_ALWAYS,
- gst_caps_copy(caps)));
+ gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS,
+ gst_caps_copy (caps)));
}
static gboolean
-plugin_init (GstPlugin *plugin)
+plugin_init (GstPlugin * plugin)
{
return TRUE;
}
-GST_PLUGIN_DEFINE (
- GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "gstaudiofilter",
- "Audio filter parent class",
- plugin_init,
- VERSION,
- "LGPL",
- GST_PACKAGE,
- GST_ORIGIN
-)
-
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ "gstaudiofilter",
+ "Audio filter parent class",
+ plugin_init, VERSION, "LGPL", GST_PACKAGE, GST_ORIGIN)
diff --git a/gst-libs/gst/audio/gstaudiofilter.h b/gst-libs/gst/audio/gstaudiofilter.h
index 9786e16c..534d4c6b 100644
--- a/gst-libs/gst/audio/gstaudiofilter.h
+++ b/gst-libs/gst/audio/gstaudiofilter.h
@@ -25,17 +25,15 @@
#include <gst/gst.h>
-G_BEGIN_DECLS
-
-typedef struct _GstAudiofilter GstAudiofilter;
+G_BEGIN_DECLS typedef struct _GstAudiofilter GstAudiofilter;
typedef struct _GstAudiofilterClass GstAudiofilterClass;
-typedef void (*GstAudiofilterFilterFunc)(GstAudiofilter *filter,
- GstBuffer *outbuf, GstBuffer *inbuf);
-typedef void (*GstAudiofilterInplaceFilterFunc)(GstAudiofilter *filter,
- GstBuffer *buffer);
+typedef void (*GstAudiofilterFilterFunc) (GstAudiofilter * filter,
+ GstBuffer * outbuf, GstBuffer * inbuf);
+typedef void (*GstAudiofilterInplaceFilterFunc) (GstAudiofilter * filter,
+ GstBuffer * buffer);
-typedef void (*GstAudiofilterSetupFunc) (GstAudiofilter *filter);
+typedef void (*GstAudiofilterSetupFunc) (GstAudiofilter * filter);
#define GST_TYPE_AUDIOFILTER \
@@ -49,10 +47,11 @@ typedef void (*GstAudiofilterSetupFunc) (GstAudiofilter *filter);
#define GST_IS_AUDIOFILTER_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIOFILTER))
-struct _GstAudiofilter {
+struct _GstAudiofilter
+{
GstElement element;
- GstPad *sinkpad,*srcpad;
+ GstPad *sinkpad, *srcpad;
/* audio state */
gboolean inited;
@@ -68,7 +67,8 @@ struct _GstAudiofilter {
int bytes_per_sample;
};
-struct _GstAudiofilterClass {
+struct _GstAudiofilterClass
+{
GstElementClass parent_class;
GstCaps *caps;
@@ -77,11 +77,10 @@ struct _GstAudiofilterClass {
GstAudiofilterFilterFunc filter;
};
-GType gst_audiofilter_get_type(void);
+GType gst_audiofilter_get_type (void);
-void gst_audiofilter_class_add_pad_templates (GstAudiofilterClass *audiofilterclass, const GstCaps *caps);
+void gst_audiofilter_class_add_pad_templates (GstAudiofilterClass *
+ audiofilterclass, const GstCaps * caps);
G_END_DECLS
-
#endif /* __GST_AUDIOFILTER_H__ */
-
diff --git a/gst-libs/gst/audio/gstaudiofiltertemplate.c b/gst-libs/gst/audio/gstaudiofiltertemplate.c
index c7c0ce2b..994fdc59 100644
--- a/gst-libs/gst/audio/gstaudiofiltertemplate.c
+++ b/gst-libs/gst/audio/gstaudiofiltertemplate.c
@@ -48,37 +48,47 @@ typedef struct _GstAudiofilterTemplateClass GstAudiofilterTemplateClass;
#define GST_IS_AUDIOFILTER_TEMPLATE_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIOFILTER_TEMPLATE))
-struct _GstAudiofilterTemplate {
+struct _GstAudiofilterTemplate
+{
GstAudiofilter audiofilter;
};
-struct _GstAudiofilterTemplateClass {
+struct _GstAudiofilterTemplateClass
+{
GstAudiofilterClass parent_class;
};
-enum {
+enum
+{
/* FILL ME */
LAST_SIGNAL
};
-enum {
+enum
+{
ARG_0,
/* FILL ME */
};
-static void gst_audiofilter_template_base_init (gpointer g_class);
-static void gst_audiofilter_template_class_init (gpointer g_class, gpointer class_data);
-static void gst_audiofilter_template_init (GTypeInstance *instance, gpointer g_class);
+static void gst_audiofilter_template_base_init (gpointer g_class);
+static void gst_audiofilter_template_class_init (gpointer g_class,
+ gpointer class_data);
+static void gst_audiofilter_template_init (GTypeInstance * instance,
+ gpointer g_class);
-static void gst_audiofilter_template_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
-static void gst_audiofilter_template_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
+static void gst_audiofilter_template_set_property (GObject * object,
+ guint prop_id, const GValue * value, GParamSpec * pspec);
+static void gst_audiofilter_template_get_property (GObject * object,
+ guint prop_id, GValue * value, GParamSpec * pspec);
-static void gst_audiofilter_template_setup (GstAudiofilter *audiofilter);
-static void gst_audiofilter_template_filter (GstAudiofilter *audiofilter, GstBuffer *outbuf, GstBuffer *inbuf);
-static void gst_audiofilter_template_filter_inplace (GstAudiofilter *audiofilter, GstBuffer *buf);
+static void gst_audiofilter_template_setup (GstAudiofilter * audiofilter);
+static void gst_audiofilter_template_filter (GstAudiofilter * audiofilter,
+ GstBuffer * outbuf, GstBuffer * inbuf);
+static void gst_audiofilter_template_filter_inplace (GstAudiofilter *
+ audiofilter, GstBuffer * buf);
GType
gst_audiofilter_template_get_type (void)
@@ -87,23 +97,24 @@ gst_audiofilter_template_get_type (void)
if (!audiofilter_template_type) {
static const GTypeInfo audiofilter_template_info = {
- sizeof(GstAudiofilterTemplateClass),
+ sizeof (GstAudiofilterTemplateClass),
gst_audiofilter_template_base_init,
NULL,
gst_audiofilter_template_class_init,
NULL,
gst_audiofilter_template_init,
- sizeof(GstAudiofilterTemplate),
+ sizeof (GstAudiofilterTemplate),
0,
NULL,
};
- audiofilter_template_type = g_type_register_static(GST_TYPE_AUDIOFILTER,
+ audiofilter_template_type = g_type_register_static (GST_TYPE_AUDIOFILTER,
"GstAudiofilterTemplate", &audiofilter_template_info, 0);
}
return audiofilter_template_type;
}
-static void gst_audiofilter_template_base_init (gpointer g_class)
+static void
+gst_audiofilter_template_base_init (gpointer g_class)
{
static GstElementDetails audiofilter_template_details = {
"Audio filter template",
@@ -128,16 +139,16 @@ gst_audiofilter_template_class_init (gpointer g_class, gpointer class_data)
GstAudiofilterTemplateClass *klass;
GstAudiofilterClass *audiofilter_class;
- klass = (GstAudiofilterTemplateClass *)g_class;
- gobject_class = (GObjectClass*)klass;
- gstelement_class = (GstElementClass*)klass;
- audiofilter_class = (GstAudiofilterClass *)g_class;
+ klass = (GstAudiofilterTemplateClass *) g_class;
+ gobject_class = (GObjectClass *) klass;
+ gstelement_class = (GstElementClass *) klass;
+ audiofilter_class = (GstAudiofilterClass *) g_class;
#if 0
- g_object_class_install_property(gobject_class, ARG_METHOD,
- g_param_spec_enum("method","method","method",
- GST_TYPE_AUDIOTEMPLATE_METHOD, GST_AUDIOTEMPLATE_METHOD_1,
- G_PARAM_READWRITE));
+ g_object_class_install_property (gobject_class, ARG_METHOD,
+ g_param_spec_enum ("method", "method", "method",
+ GST_TYPE_AUDIOTEMPLATE_METHOD, GST_AUDIOTEMPLATE_METHOD_1,
+ G_PARAM_READWRITE));
#endif
gobject_class->set_property = gst_audiofilter_template_set_property;
@@ -146,11 +157,11 @@ gst_audiofilter_template_class_init (gpointer g_class, gpointer class_data)
audiofilter_class->setup = gst_audiofilter_template_setup;
audiofilter_class->filter = gst_audiofilter_template_filter;
audiofilter_class->filter_inplace = gst_audiofilter_template_filter_inplace;
-audiofilter_class->filter = NULL;
+ audiofilter_class->filter = NULL;
}
static void
-gst_audiofilter_template_init (GTypeInstance *instance, gpointer g_class)
+gst_audiofilter_template_init (GTypeInstance * instance, gpointer g_class)
{
//GstAudiofilterTemplate *audiofilter_template = GST_AUDIOFILTER_TEMPLATE (instance);
//GstAudiofilter *audiofilter = GST_AUDIOFILTER (instance);
@@ -162,15 +173,16 @@ gst_audiofilter_template_init (GTypeInstance *instance, gpointer g_class)
}
static void
-gst_audiofilter_template_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
+gst_audiofilter_template_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec)
{
GstAudiofilterTemplate *src;
/* it's not null if we got it, but it might not be ours */
- g_return_if_fail(GST_IS_AUDIOFILTER_TEMPLATE(object));
- src = GST_AUDIOFILTER_TEMPLATE(object);
+ g_return_if_fail (GST_IS_AUDIOFILTER_TEMPLATE (object));
+ src = GST_AUDIOFILTER_TEMPLATE (object);
- GST_DEBUG("gst_audiofilter_template_set_property");
+ GST_DEBUG ("gst_audiofilter_template_set_property");
switch (prop_id) {
default:
break;
@@ -178,13 +190,14 @@ gst_audiofilter_template_set_property (GObject *object, guint prop_id, const GVa
}
static void
-gst_audiofilter_template_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+gst_audiofilter_template_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec)
{
GstAudiofilterTemplate *src;
/* it's not null if we got it, but it might not be ours */
- g_return_if_fail(GST_IS_AUDIOFILTER_TEMPLATE(object));
- src = GST_AUDIOFILTER_TEMPLATE(object);
+ g_return_if_fail (GST_IS_AUDIOFILTER_TEMPLATE (object));
+ src = GST_AUDIOFILTER_TEMPLATE (object);
switch (prop_id) {
default:
@@ -194,7 +207,7 @@ gst_audiofilter_template_get_property (GObject *object, guint prop_id, GValue *v
}
static gboolean
-plugin_init (GstPlugin *plugin)
+plugin_init (GstPlugin * plugin)
{
if (!gst_library_load ("gstaudiofilter"))
return FALSE;
@@ -203,20 +216,13 @@ plugin_init (GstPlugin *plugin)
GST_TYPE_AUDIOFILTER_TEMPLATE);
}
-GST_PLUGIN_DEFINE (
- GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "gstaudiofilter_template",
- "Audio filter template",
- plugin_init,
- VERSION,
- "LGPL",
- GST_PACKAGE,
- GST_ORIGIN
-)
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ "gstaudiofilter_template",
+ "Audio filter template",
+ plugin_init, VERSION, "LGPL", GST_PACKAGE, GST_ORIGIN)
-static void
-gst_audiofilter_template_setup (GstAudiofilter *audiofilter)
+ static void gst_audiofilter_template_setup (GstAudiofilter * audiofilter)
{
GstAudiofilterTemplate *audiofilter_template;
@@ -234,8 +240,8 @@ gst_audiofilter_template_setup (GstAudiofilter *audiofilter)
* with a minimum of memory copies. */
static void
-gst_audiofilter_template_filter (GstAudiofilter *audiofilter,
- GstBuffer *outbuf, GstBuffer *inbuf)
+gst_audiofilter_template_filter (GstAudiofilter * audiofilter,
+ GstBuffer * outbuf, GstBuffer * inbuf)
{
GstAudiofilterTemplate *audiofilter_template;
@@ -245,13 +251,12 @@ gst_audiofilter_template_filter (GstAudiofilter *audiofilter,
/* do something interesting here. This simply copies the source
* to the destination. */
- memcpy (GST_BUFFER_DATA (outbuf), GST_BUFFER_DATA (inbuf),
- audiofilter->size);
+ memcpy (GST_BUFFER_DATA (outbuf), GST_BUFFER_DATA (inbuf), audiofilter->size);
}
static void
-gst_audiofilter_template_filter_inplace (GstAudiofilter *audiofilter,
- GstBuffer *buf)
+gst_audiofilter_template_filter_inplace (GstAudiofilter * audiofilter,
+ GstBuffer * buf)
{
GstAudiofilterTemplate *audiofilter_template;
@@ -262,4 +267,3 @@ gst_audiofilter_template_filter_inplace (GstAudiofilter *audiofilter,
* to the destination. */
}
-
diff --git a/gst-libs/gst/colorbalance/colorbalance.c b/gst-libs/gst/colorbalance/colorbalance.c
index dd32ff8b..fbf18581 100644
--- a/gst-libs/gst/colorbalance/colorbalance.c
+++ b/gst-libs/gst/colorbalance/colorbalance.c
@@ -27,12 +27,13 @@
#include "colorbalance.h"
#include "colorbalance-marshal.h"
-enum {
+enum
+{
VALUE_CHANGED,
LAST_SIGNAL
};
-static void gst_color_balance_class_init (GstColorBalanceClass *klass);
+static void gst_color_balance_class_init (GstColorBalanceClass * klass);
static guint gst_color_balance_signals[LAST_SIGNAL] = { 0 };
@@ -55,35 +56,33 @@ gst_color_balance_get_type (void)
};
gst_color_balance_type = g_type_register_static (G_TYPE_INTERFACE,
- "GstColorBalance",
- &gst_color_balance_info, 0);
+ "GstColorBalance", &gst_color_balance_info, 0);
g_type_interface_add_prerequisite (gst_color_balance_type,
- GST_TYPE_IMPLEMENTS_INTERFACE);
+ GST_TYPE_IMPLEMENTS_INTERFACE);
}
return gst_color_balance_type;
}
static void
-gst_color_balance_class_init (GstColorBalanceClass *klass)
+gst_color_balance_class_init (GstColorBalanceClass * klass)
{
static gboolean initialized = FALSE;
-
+
if (!initialized) {
gst_color_balance_signals[VALUE_CHANGED] =
- g_signal_new ("value-changed",
- GST_TYPE_COLOR_BALANCE, G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstColorBalanceClass, value_changed),
- NULL, NULL,
- gst_color_balance_marshal_VOID__OBJECT_INT,
- G_TYPE_NONE, 2,
- GST_TYPE_COLOR_BALANCE_CHANNEL, G_TYPE_INT);
-
+ g_signal_new ("value-changed",
+ GST_TYPE_COLOR_BALANCE, G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GstColorBalanceClass, value_changed),
+ NULL, NULL,
+ gst_color_balance_marshal_VOID__OBJECT_INT,
+ G_TYPE_NONE, 2, GST_TYPE_COLOR_BALANCE_CHANNEL, G_TYPE_INT);
+
initialized = TRUE;
}
klass->balance_type = GST_COLOR_BALANCE_SOFTWARE;
-
+
/* default virtual functions */
klass->list_channels = NULL;
klass->set_value = NULL;
@@ -91,7 +90,7 @@ gst_color_balance_class_init (GstColorBalanceClass *klass)
}
const GList *
-gst_color_balance_list_channels (GstColorBalance *balance)
+gst_color_balance_list_channels (GstColorBalance * balance)
{
GstColorBalanceClass *klass = GST_COLOR_BALANCE_GET_CLASS (balance);
@@ -103,9 +102,8 @@ gst_color_balance_list_channels (GstColorBalance *balance)
}
void
-gst_color_balance_set_value (GstColorBalance *balance,
- GstColorBalanceChannel *channel,
- gint value)
+gst_color_balance_set_value (GstColorBalance * balance,
+ GstColorBalanceChannel * channel, gint value)
{
GstColorBalanceClass *klass = GST_COLOR_BALANCE_GET_CLASS (balance);
@@ -115,8 +113,8 @@ gst_color_balance_set_value (GstColorBalance *balance,
}
gint
-gst_color_balance_get_value (GstColorBalance *balance,
- GstColorBalanceChannel *channel)
+gst_color_balance_get_value (GstColorBalance * balance,
+ GstColorBalanceChannel * channel)
{
GstColorBalanceClass *klass = GST_COLOR_BALANCE_GET_CLASS (balance);
@@ -128,13 +126,11 @@ gst_color_balance_get_value (GstColorBalance *balance,
}
void
-gst_color_balance_value_changed (GstColorBalance *balance,
- GstColorBalanceChannel *channel,
- gint value)
+gst_color_balance_value_changed (GstColorBalance * balance,
+ GstColorBalanceChannel * channel, gint value)
{
g_signal_emit (G_OBJECT (balance),
- gst_color_balance_signals[VALUE_CHANGED],
- 0, channel, value);
+ gst_color_balance_signals[VALUE_CHANGED], 0, channel, value);
g_signal_emit_by_name (G_OBJECT (channel), "value_changed", value);
}
diff --git a/gst-libs/gst/colorbalance/colorbalance.h b/gst-libs/gst/colorbalance/colorbalance.h
index d7b92171..d0347579 100644
--- a/gst-libs/gst/colorbalance/colorbalance.h
+++ b/gst-libs/gst/colorbalance/colorbalance.h
@@ -27,7 +27,6 @@
#include <gst/colorbalance/colorbalance-enumtypes.h>
G_BEGIN_DECLS
-
#define GST_TYPE_COLOR_BALANCE \
(gst_color_balance_get_type ())
#define GST_COLOR_BALANCE(obj) \
@@ -42,55 +41,48 @@ G_BEGIN_DECLS
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_COLOR_BALANCE))
#define GST_COLOR_BALANCE_GET_CLASS(inst) \
(G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_COLOR_BALANCE, GstColorBalanceClass))
-
#define GST_COLOR_BALANCE_TYPE(klass) (klass->balance_type)
-
typedef struct _GstColorBalance GstColorBalance;
-
+
typedef enum
{
GST_COLOR_BALANCE_HARDWARE,
GST_COLOR_BALANCE_SOFTWARE
} GstColorBalanceType;
-typedef struct _GstColorBalanceClass {
+typedef struct _GstColorBalanceClass
+{
GTypeInterface klass;
GstColorBalanceType balance_type;
-
+
/* virtual functions */
- const GList * (* list_channels) (GstColorBalance *balance);
+ const GList *(*list_channels) (GstColorBalance * balance);
- void (* set_value) (GstColorBalance *balance,
- GstColorBalanceChannel *channel,
- gint value);
- gint (* get_value) (GstColorBalance *balance,
- GstColorBalanceChannel *channel);
+ void (*set_value) (GstColorBalance * balance,
+ GstColorBalanceChannel * channel, gint value);
+ gint (*get_value) (GstColorBalance * balance,
+ GstColorBalanceChannel * channel);
/* signals */
- void (* value_changed) (GstColorBalance *balance,
- GstColorBalanceChannel *channel,
- gint value);
+ void (*value_changed) (GstColorBalance * balance,
+ GstColorBalanceChannel * channel, gint value);
gpointer _gst_reserved[GST_PADDING];
} GstColorBalanceClass;
-GType gst_color_balance_get_type (void);
+GType gst_color_balance_get_type (void);
/* virtual class function wrappers */
-const GList *
- gst_color_balance_list_channels (GstColorBalance *balance);
-void gst_color_balance_set_value (GstColorBalance *balance,
- GstColorBalanceChannel *channel,
- gint value);
-gint gst_color_balance_get_value (GstColorBalance *balance,
- GstColorBalanceChannel *channel);
+const GList *gst_color_balance_list_channels (GstColorBalance * balance);
+void gst_color_balance_set_value (GstColorBalance * balance,
+ GstColorBalanceChannel * channel, gint value);
+gint gst_color_balance_get_value (GstColorBalance * balance,
+ GstColorBalanceChannel * channel);
/* trigger signal */
-void gst_color_balance_value_changed (GstColorBalance *balance,
- GstColorBalanceChannel *channel,
- gint value);
+void gst_color_balance_value_changed (GstColorBalance * balance,
+ GstColorBalanceChannel * channel, gint value);
G_END_DECLS
-
#endif /* __GST_COLOR_BALANCE_H__ */
diff --git a/gst-libs/gst/colorbalance/colorbalancechannel.c b/gst-libs/gst/colorbalance/colorbalancechannel.c
index b8a4eebd..7812ed93 100644
--- a/gst-libs/gst/colorbalance/colorbalancechannel.c
+++ b/gst-libs/gst/colorbalance/colorbalancechannel.c
@@ -25,15 +25,17 @@
#include "colorbalancechannel.h"
-enum {
+enum
+{
/* FILL ME */
SIGNAL_VALUE_CHANGED,
LAST_SIGNAL
};
-static void gst_color_balance_channel_class_init (GstColorBalanceChannelClass *klass);
-static void gst_color_balance_channel_init (GstColorBalanceChannel *balance);
-static void gst_color_balance_channel_dispose (GObject *object);
+static void gst_color_balance_channel_class_init (GstColorBalanceChannelClass *
+ klass);
+static void gst_color_balance_channel_init (GstColorBalanceChannel * balance);
+static void gst_color_balance_channel_dispose (GObject * object);
static GObjectClass *parent_class = NULL;
static guint signals[LAST_SIGNAL] = { 0 };
@@ -59,46 +61,44 @@ gst_color_balance_channel_get_type (void)
gst_color_balance_channel_type =
g_type_register_static (G_TYPE_OBJECT,
- "GstColorBalanceChannel",
- &color_balance_channel_info, 0);
+ "GstColorBalanceChannel", &color_balance_channel_info, 0);
}
return gst_color_balance_channel_type;
}
static void
-gst_color_balance_channel_class_init (GstColorBalanceChannelClass *klass)
+gst_color_balance_channel_class_init (GstColorBalanceChannelClass * klass)
{
GObjectClass *object_klass = (GObjectClass *) klass;
parent_class = g_type_class_ref (G_TYPE_OBJECT);
signals[SIGNAL_VALUE_CHANGED] =
- g_signal_new ("value-changed", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstColorBalanceChannelClass,
- value_changed),
- NULL, NULL, g_cclosure_marshal_VOID__INT,
- G_TYPE_NONE, 1, G_TYPE_INT);
+ g_signal_new ("value-changed", G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GstColorBalanceChannelClass,
+ value_changed),
+ NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
object_klass->dispose = gst_color_balance_channel_dispose;
}
static void
-gst_color_balance_channel_init (GstColorBalanceChannel *channel)
+gst_color_balance_channel_init (GstColorBalanceChannel * channel)
{
channel->label = NULL;
channel->min_value = channel->max_value = 0;
}
static void
-gst_color_balance_channel_dispose (GObject *object)
+gst_color_balance_channel_dispose (GObject * object)
{
GstColorBalanceChannel *channel = GST_COLOR_BALANCE_CHANNEL (object);
if (channel->label)
g_free (channel->label);
-
+
channel->label = NULL;
if (parent_class->dispose)
diff --git a/gst-libs/gst/colorbalance/colorbalancechannel.h b/gst-libs/gst/colorbalance/colorbalancechannel.h
index 23f73f8e..516fb72a 100644
--- a/gst-libs/gst/colorbalance/colorbalancechannel.h
+++ b/gst-libs/gst/colorbalance/colorbalancechannel.h
@@ -25,7 +25,6 @@
#include <gst/gst.h>
G_BEGIN_DECLS
-
#define GST_TYPE_COLOR_BALANCE_CHANNEL \
(gst_color_balance_channel_get_type ())
#define GST_COLOR_BALANCE_CHANNEL(obj) \
@@ -38,27 +37,25 @@ G_BEGIN_DECLS
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_COLOR_BALANCE_CHANNEL))
#define GST_IS_COLOR_BALANCE_CHANNEL_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_COLOR_BALANCE_CHANNEL))
-
-typedef struct _GstColorBalanceChannel {
+ typedef struct _GstColorBalanceChannel
+{
GObject parent;
- gchar *label;
- gint min_value,
- max_value;
+ gchar *label;
+ gint min_value, max_value;
} GstColorBalanceChannel;
-typedef struct _GstColorBalanceChannelClass {
+typedef struct _GstColorBalanceChannelClass
+{
GObjectClass parent;
/* signals */
- void (* value_changed) (GstColorBalanceChannel *channel,
- gint value);
+ void (*value_changed) (GstColorBalanceChannel * channel, gint value);
gpointer _gst_reserved[GST_PADDING];
} GstColorBalanceChannelClass;
-GType gst_color_balance_channel_get_type (void);
+GType gst_color_balance_channel_get_type (void);
G_END_DECLS
-
#endif /* __GST_COLOR_BALANCE_CHANNEL_H__ */
diff --git a/gst-libs/gst/floatcast/floatcast.h b/gst-libs/gst/floatcast/floatcast.h
index ae87a43f..2951a810 100644
--- a/gst-libs/gst/floatcast/floatcast.h
+++ b/gst-libs/gst/floatcast/floatcast.h
@@ -29,53 +29,46 @@
#include <glib/gtypes.h>
G_BEGIN_DECLS
-
#if (HAVE_LRINT && HAVE_LRINTF)
-
- /* These defines enable functionality introduced with the 1999 ISO C
- ** standard. They must be defined before the inclusion of math.h to
- ** engage them. If optimisation is enabled, these functions will be
- ** inlined. With optimisation switched off, you have to link in the
- ** maths library using -lm.
- */
-
- #define _ISOC9X_SOURCE 1
- #define _ISOC99_SOURCE 1
-
- #define __USE_ISOC9X 1
- #define __USE_ISOC99 1
-
- #include <math.h>
-
- #define gst_cast_float(x) ((gint)lrintf(x))
- #define gst_cast_double(x) ((gint)lrint(x))
-
+ /* These defines enable functionality introduced with the 1999 ISO C
+ ** standard. They must be defined before the inclusion of math.h to
+ ** engage them. If optimisation is enabled, these functions will be
+ ** inlined. With optimisation switched off, you have to link in the
+ ** maths library using -lm.
+ */
+#define _ISOC9X_SOURCE 1
+#define _ISOC99_SOURCE 1
+#define __USE_ISOC9X 1
+#define __USE_ISOC99 1
+#include <math.h>
+#define gst_cast_float(x) ((gint)lrintf(x))
+#define gst_cast_double(x) ((gint)lrint(x))
#else
- /* use a standard c cast, but do rounding correctly */
- #define gst_cast_float(x) ((gint)floor((x)+0.5))
- #define gst_cast_double(x) ((gint)floor((x)+0.5))
-
+ /* use a standard c cast, but do rounding correctly */
+#define gst_cast_float(x) ((gint)floor((x)+0.5))
+#define gst_cast_double(x) ((gint)floor((x)+0.5))
#endif
-
inline static gfloat
-GFLOAT_SWAP_LE_BE(gfloat in)
+GFLOAT_SWAP_LE_BE (gfloat in)
{
gint32 swap;
gfloat out;
- memcpy(&swap, &in, 4);
+
+ memcpy (&swap, &in, 4);
swap = GUINT32_SWAP_LE_BE_CONSTANT (swap);
- memcpy(&out, &swap, 4);
+ memcpy (&out, &swap, 4);
return out;
}
inline static gdouble
-GDOUBLE_SWAP_LE_BE(gdouble in)
+GDOUBLE_SWAP_LE_BE (gdouble in)
{
gint64 swap;
gdouble out;
- memcpy(&swap, &in, 8);
+
+ memcpy (&swap, &in, 8);
swap = GUINT64_SWAP_LE_BE_CONSTANT (swap);
- memcpy(&out, &swap, 8);
+ memcpy (&out, &swap, 8);
return out;
}
@@ -101,6 +94,4 @@ GDOUBLE_SWAP_LE_BE(gdouble in)
#define GDOUBLE_FROM_BE(val) (GDOUBLE_TO_BE (val))
G_END_DECLS
-
#endif /* __FLOATCAST_H__ */
-
diff --git a/gst-libs/gst/gconf/gconf.c b/gst-libs/gst/gconf/gconf.c
index a96b786f..1887b718 100644
--- a/gst-libs/gst/gconf/gconf.c
+++ b/gst-libs/gst/gconf/gconf.c
@@ -31,7 +31,7 @@
#error "GST_GCONF_DIR is not defined !"
#endif
-static GConfClient *_gst_gconf_client = NULL; /* GConf connection */
+static GConfClient *_gst_gconf_client = NULL; /* GConf connection */
/* internal functions */
@@ -48,7 +48,7 @@ gst_gconf_get_client (void)
/* go through a bin, finding the one pad that is unconnected in the given
* * direction, and return that pad */
static GstPad *
-gst_bin_find_unconnected_pad (GstBin *bin, GstPadDirection direction)
+gst_bin_find_unconnected_pad (GstBin * bin, GstPadDirection direction)
{
GstPad *pad = NULL;
GList *elements = NULL;
@@ -57,22 +57,19 @@ gst_bin_find_unconnected_pad (GstBin *bin, GstPadDirection direction)
elements = (GList *) gst_bin_get_list (bin);
/* traverse all elements looking for unconnected pads */
- while (elements && pad == NULL)
- {
+ while (elements && pad == NULL) {
element = GST_ELEMENT (elements->data);
pads = gst_element_get_pad_list (element);
- while (pads)
- {
+ while (pads) {
/* check if the direction matches */
- if (GST_PAD_DIRECTION (GST_PAD (pads->data)) == direction)
- {
- if (GST_PAD_PEER (GST_PAD (pads->data)) == NULL)
- {
- /* found it ! */
+ if (GST_PAD_DIRECTION (GST_PAD (pads->data)) == direction) {
+ if (GST_PAD_PEER (GST_PAD (pads->data)) == NULL) {
+ /* found it ! */
pad = GST_PAD (pads->data);
}
}
- if (pad) break; /* found one already */
+ if (pad)
+ break; /* found one already */
pads = g_list_next (pads);
}
elements = g_list_next (elements);
@@ -91,7 +88,7 @@ gst_bin_find_unconnected_pad (GstBin *bin, GstPadDirection direction)
* Returns: a #gchar string containing @key's value.
*/
gchar *
-gst_gconf_get_string (const gchar *key)
+gst_gconf_get_string (const gchar * key)
{
GError *error = NULL;
gchar *value = NULL;
@@ -101,8 +98,7 @@ gst_gconf_get_string (const gchar *key)
value = gconf_client_get_string (gst_gconf_get_client (), full_key, &error);
g_free (full_key);
- if (error)
- {
+ if (error) {
g_print ("gst_gconf_get_string: error: %s\n", error->message);
g_error_free (error);
}
@@ -118,14 +114,13 @@ gst_gconf_get_string (const gchar *key)
* Set GConf key @key to string value @value.
*/
void
-gst_gconf_set_string (const gchar *key, const gchar *value)
+gst_gconf_set_string (const gchar * key, const gchar * value)
{
GError *error = NULL;
gchar *full_key = g_strdup_printf ("%s/%s", GST_GCONF_DIR, key);
gconf_client_set_string (gst_gconf_get_client (), full_key, value, &error);
- if (error)
- {
+ if (error) {
g_print ("gst_gconf_set_string: error: %s\n", error->message);
g_error_free (error);
}
@@ -141,7 +136,7 @@ gst_gconf_set_string (const gchar *key, const gchar *value)
* Returns: a #GstElement containing the rendered bin.
*/
GstElement *
-gst_gconf_render_bin_from_description (const gchar *description)
+gst_gconf_render_bin_from_description (const gchar * description)
{
GstElement *bin = NULL;
GstPad *pad = NULL;
@@ -152,19 +147,18 @@ gst_gconf_render_bin_from_description (const gchar *description)
desc = g_strdup_printf ("bin.( %s )", description);
bin = GST_ELEMENT (gst_parse_launch (desc, &error));
g_free (desc);
- if (error)
- {
+ if (error) {
g_print ("DEBUG: gstgconf: error parsing pipeline %s\n%s\n",
- description, error->message);
+ description, error->message);
g_error_free (error);
return NULL;
}
/* find pads and ghost them if necessary */
- if ((pad = gst_bin_find_unconnected_pad (GST_BIN (bin), GST_PAD_SRC))){
+ if ((pad = gst_bin_find_unconnected_pad (GST_BIN (bin), GST_PAD_SRC))) {
gst_element_add_ghost_pad (bin, pad, "src");
}
- if ((pad = gst_bin_find_unconnected_pad (GST_BIN (bin), GST_PAD_SINK))){
+ if ((pad = gst_bin_find_unconnected_pad (GST_BIN (bin), GST_PAD_SINK))) {
gst_element_add_ghost_pad (bin, pad, "sink");
}
return bin;
@@ -179,11 +173,11 @@ gst_gconf_render_bin_from_description (const gchar *description)
* Returns: a #GstElement containing the rendered bin.
*/
GstElement *
-gst_gconf_render_bin_from_key (const gchar *key)
+gst_gconf_render_bin_from_key (const gchar * key)
{
GstElement *bin = NULL;
gchar *value;
-
+
value = gst_gconf_get_string (key);
if (value)
bin = gst_gconf_render_bin_from_description (value);
@@ -203,10 +197,10 @@ GstElement *
gst_gconf_get_default_audio_sink (void)
{
GstElement *ret = gst_gconf_render_bin_from_key ("default/audiosink");
-
+
if (!ret) {
ret = gst_element_factory_make ("osssink", NULL);
-
+
if (!ret)
g_warning ("No GConf default audio sink key and osssink doesn't work");
else
@@ -229,10 +223,10 @@ GstElement *
gst_gconf_get_default_video_sink (void)
{
GstElement *ret = gst_gconf_render_bin_from_key ("default/videosink");
-
+
if (!ret) {
ret = gst_element_factory_make ("ximagesink", NULL);
-
+
if (!ret)
g_warning ("No GConf default video sink key and ximagesink doesn't work");
else
@@ -255,10 +249,10 @@ GstElement *
gst_gconf_get_default_audio_src (void)
{
GstElement *ret = gst_gconf_render_bin_from_key ("default/audiosrc");
-
+
if (!ret) {
ret = gst_element_factory_make ("osssrc", NULL);
-
+
if (!ret)
g_warning ("No GConf default audio src key and osssrc doesn't work");
else
@@ -282,10 +276,10 @@ GstElement *
gst_gconf_get_default_video_src (void)
{
GstElement *ret = gst_gconf_render_bin_from_key ("default/videosrc");
-
+
if (!ret) {
ret = gst_element_factory_make ("videotestsrc", NULL);
-
+
if (!ret)
g_warning ("No GConf default video src key and videotestrc doesn't work");
else
@@ -308,16 +302,16 @@ GstElement *
gst_gconf_get_default_visualization_element (void)
{
GstElement *ret = gst_gconf_render_bin_from_key ("default/visualization");
-
+
if (!ret) {
ret = gst_element_factory_make ("goom", NULL);
-
+
if (!ret)
- g_warning ("No GConf default visualization plugin key and goom doesn't work");
+ g_warning
+ ("No GConf default visualization plugin key and goom doesn't work");
else
g_print ("GConf visualization plugin not found, using goom\n");
}
return ret;
}
-
diff --git a/gst-libs/gst/gconf/gconf.h b/gst-libs/gst/gconf/gconf.h
index 70007f77..79546a7a 100644
--- a/gst-libs/gst/gconf/gconf.h
+++ b/gst-libs/gst/gconf/gconf.h
@@ -27,17 +27,16 @@
#include <gst/gst.h>
#include <gconf/gconf-client.h>
-gchar * gst_gconf_get_string (const gchar *key);
-void gst_gconf_set_string (const gchar *key,
- const gchar *value);
+gchar *gst_gconf_get_string (const gchar * key);
+void gst_gconf_set_string (const gchar * key, const gchar * value);
-GstElement * gst_gconf_render_bin_from_key (const gchar *key);
-GstElement * gst_gconf_render_bin_from_description (const gchar *description);
+GstElement *gst_gconf_render_bin_from_key (const gchar * key);
+GstElement *gst_gconf_render_bin_from_description (const gchar * description);
-GstElement * gst_gconf_get_default_video_sink (void);
-GstElement * gst_gconf_get_default_audio_sink (void);
-GstElement * gst_gconf_get_default_video_src (void);
-GstElement * gst_gconf_get_default_audio_src (void);
-GstElement * gst_gconf_get_default_visualization_element (void);
+GstElement *gst_gconf_get_default_video_sink (void);
+GstElement *gst_gconf_get_default_audio_sink (void);
+GstElement *gst_gconf_get_default_video_src (void);
+GstElement *gst_gconf_get_default_audio_src (void);
+GstElement *gst_gconf_get_default_visualization_element (void);
#endif /* GST_GCONF_H */
diff --git a/gst-libs/gst/gconf/test-gconf.c b/gst-libs/gst/gconf/test-gconf.c
index 06d5b61d..a3c99646 100644
--- a/gst-libs/gst/gconf/test-gconf.c
+++ b/gst-libs/gst/gconf/test-gconf.c
@@ -22,13 +22,13 @@
int
main (int argc, char *argv[])
{
- printf ("Default video sink : %s\n",
- gst_gconf_get_string ("default/videosink"));
- printf ("Default audio sink : %s\n",
- gst_gconf_get_string ("default/audiosink"));
- printf ("Default video src : %s\n",
- gst_gconf_get_string ("default/videosrc"));
- printf ("Default audio src : %s\n",
- gst_gconf_get_string ("default/audiosrc"));
+ printf ("Default video sink : %s\n",
+ gst_gconf_get_string ("default/videosink"));
+ printf ("Default audio sink : %s\n",
+ gst_gconf_get_string ("default/audiosink"));
+ printf ("Default video src : %s\n",
+ gst_gconf_get_string ("default/videosrc"));
+ printf ("Default audio src : %s\n",
+ gst_gconf_get_string ("default/audiosrc"));
return 0;
}
diff --git a/gst-libs/gst/gst-i18n-plugin.h b/gst-libs/gst/gst-i18n-plugin.h
index 2c37a615..846b1b0a 100644
--- a/gst-libs/gst/gst-i18n-plugin.h
+++ b/gst-libs/gst/gst-i18n-plugin.h
@@ -22,8 +22,8 @@
#ifndef __GST_I18N_PLUGIN_H__
#define __GST_I18N_PLUGIN_H__
-#include <locale.h> /* some people need it and some people don't */
-#include "gettext.h" /* included with gettext distribution and copied */
+#include <locale.h> /* some people need it and some people don't */
+#include "gettext.h" /* included with gettext distribution and copied */
#ifndef GETTEXT_PACKAGE
#error You must define GETTEXT_PACKAGE before including this header.
diff --git a/gst-libs/gst/idct/dct.h b/gst-libs/gst/idct/dct.h
index efb3ddb3..c2e37449 100644
--- a/gst-libs/gst/idct/dct.h
+++ b/gst-libs/gst/idct/dct.h
@@ -16,7 +16,7 @@ typedef DCTELEM DCTBLOCK[DCTSIZE2];
typedef long INT32; /* must be at least 32 bits */
-extern void gst_idct_int_idct();
+extern void gst_idct_int_idct ();
extern void gst_idct_init_fast_int_idct (void);
extern void gst_idct_fast_int_idct (short *block);
@@ -27,6 +27,5 @@ extern void gst_idct_mmx32_idct (short *block);
extern void gst_idct_sse_idct (short *block);
#endif /* HAVE_LIBMMX */
-extern void gst_idct_init_float_idct(void);
+extern void gst_idct_init_float_idct (void);
extern void gst_idct_float_idct (short *block);
-
diff --git a/gst-libs/gst/idct/fastintidct.c b/gst-libs/gst/idct/fastintidct.c
index 27426672..9bb1436d 100644
--- a/gst-libs/gst/idct/fastintidct.c
+++ b/gst-libs/gst/idct/fastintidct.c
@@ -45,17 +45,17 @@
/* this code assumes >> to be a two's-complement arithmetic */
/* right shift: (-2)>>1 == -1 , (-3)>>1 == -2 */
-#define W1 2841 /* 2048*sqrt(2)*cos(1*pi/16) */
-#define W2 2676 /* 2048*sqrt(2)*cos(2*pi/16) */
-#define W3 2408 /* 2048*sqrt(2)*cos(3*pi/16) */
-#define W5 1609 /* 2048*sqrt(2)*cos(5*pi/16) */
-#define W6 1108 /* 2048*sqrt(2)*cos(6*pi/16) */
-#define W7 565 /* 2048*sqrt(2)*cos(7*pi/16) */
+#define W1 2841 /* 2048*sqrt(2)*cos(1*pi/16) */
+#define W2 2676 /* 2048*sqrt(2)*cos(2*pi/16) */
+#define W3 2408 /* 2048*sqrt(2)*cos(3*pi/16) */
+#define W5 1609 /* 2048*sqrt(2)*cos(5*pi/16) */
+#define W6 1108 /* 2048*sqrt(2)*cos(6*pi/16) */
+#define W7 565 /* 2048*sqrt(2)*cos(7*pi/16) */
#include "dct.h"
/* private data */
-static short iclip[1024]; /* clipping table */
+static short iclip[1024]; /* clipping table */
static short *iclp;
/* private prototypes */
@@ -72,57 +72,58 @@ static void idctcol (short *blk);
* c[1..7] = 128*sqrt(2)
*/
-static void idctrow(blk)
-short *blk;
+static void
+idctrow (blk)
+ short *blk;
{
int x0, x1, x2, x3, x4, x5, x6, x7, x8;
/* shortcut */
- if (!((x1 = blk[4]<<11) | (x2 = blk[6]) | (x3 = blk[2]) |
- (x4 = blk[1]) | (x5 = blk[7]) | (x6 = blk[5]) | (x7 = blk[3])))
- {
- blk[0]=blk[1]=blk[2]=blk[3]=blk[4]=blk[5]=blk[6]=blk[7]=blk[0]<<3;
+ if (!((x1 = blk[4] << 11) | (x2 = blk[6]) | (x3 = blk[2]) |
+ (x4 = blk[1]) | (x5 = blk[7]) | (x6 = blk[5]) | (x7 = blk[3]))) {
+ blk[0] = blk[1] = blk[2] = blk[3] = blk[4] = blk[5] = blk[6] = blk[7] =
+ blk[0] << 3;
return;
}
- x0 = (blk[0]<<11) + 128; /* for proper rounding in the fourth stage */
+ x0 = (blk[0] << 11) + 128; /* for proper rounding in the fourth stage */
/* first stage */
- x8 = W7*(x4+x5);
- x4 = x8 + (W1-W7)*x4;
- x5 = x8 - (W1+W7)*x5;
- x8 = W3*(x6+x7);
- x6 = x8 - (W3-W5)*x6;
- x7 = x8 - (W3+W5)*x7;
-
+ x8 = W7 * (x4 + x5);
+ x4 = x8 + (W1 - W7) * x4;
+ x5 = x8 - (W1 + W7) * x5;
+ x8 = W3 * (x6 + x7);
+ x6 = x8 - (W3 - W5) * x6;
+ x7 = x8 - (W3 + W5) * x7;
+
/* second stage */
x8 = x0 + x1;
x0 -= x1;
- x1 = W6*(x3+x2);
- x2 = x1 - (W2+W6)*x2;
- x3 = x1 + (W2-W6)*x3;
+ x1 = W6 * (x3 + x2);
+ x2 = x1 - (W2 + W6) * x2;
+ x3 = x1 + (W2 - W6) * x3;
x1 = x4 + x6;
x4 -= x6;
x6 = x5 + x7;
x5 -= x7;
-
+
/* third stage */
x7 = x8 + x3;
x8 -= x3;
x3 = x0 + x2;
x0 -= x2;
- x2 = (181*(x4+x5)+128)>>8;
- x4 = (181*(x4-x5)+128)>>8;
-
+ x2 = (181 * (x4 + x5) + 128) >> 8;
+ x4 = (181 * (x4 - x5) + 128) >> 8;
+
/* fourth stage */
- blk[0] = (x7+x1)>>8;
- blk[1] = (x3+x2)>>8;
- blk[2] = (x0+x4)>>8;
- blk[3] = (x8+x6)>>8;
- blk[4] = (x8-x6)>>8;
- blk[5] = (x0-x4)>>8;
- blk[6] = (x3-x2)>>8;
- blk[7] = (x7-x1)>>8;
+ blk[0] = (x7 + x1) >> 8;
+ blk[1] = (x3 + x2) >> 8;
+ blk[2] = (x0 + x4) >> 8;
+ blk[3] = (x8 + x6) >> 8;
+ blk[4] = (x8 - x6) >> 8;
+ blk[5] = (x0 - x4) >> 8;
+ blk[6] = (x3 - x2) >> 8;
+ blk[7] = (x7 - x1) >> 8;
}
/* column (vertical) IDCT
@@ -134,78 +135,81 @@ short *blk;
* where: c[0] = 1/1024
* c[1..7] = (1/1024)*sqrt(2)
*/
-static void idctcol(blk)
-short *blk;
+static void
+idctcol (blk)
+ short *blk;
{
int x0, x1, x2, x3, x4, x5, x6, x7, x8;
/* shortcut */
- if (!((x1 = (blk[8*4]<<8)) | (x2 = blk[8*6]) | (x3 = blk[8*2]) |
- (x4 = blk[8*1]) | (x5 = blk[8*7]) | (x6 = blk[8*5]) | (x7 = blk[8*3])))
- {
- blk[8*0]=blk[8*1]=blk[8*2]=blk[8*3]=blk[8*4]=blk[8*5]=blk[8*6]=blk[8*7]=
- iclp[(blk[8*0]+32)>>6];
+ if (!((x1 = (blk[8 * 4] << 8)) | (x2 = blk[8 * 6]) | (x3 = blk[8 * 2]) |
+ (x4 = blk[8 * 1]) | (x5 = blk[8 * 7]) | (x6 = blk[8 * 5]) | (x7 =
+ blk[8 * 3]))) {
+ blk[8 * 0] = blk[8 * 1] = blk[8 * 2] = blk[8 * 3] = blk[8 * 4] =
+ blk[8 * 5] = blk[8 * 6] = blk[8 * 7] = iclp[(blk[8 * 0] + 32) >> 6];
return;
}
- x0 = (blk[8*0]<<8) + 8192;
+ x0 = (blk[8 * 0] << 8) + 8192;
/* first stage */
- x8 = W7*(x4+x5) + 4;
- x4 = (x8+(W1-W7)*x4)>>3;
- x5 = (x8-(W1+W7)*x5)>>3;
- x8 = W3*(x6+x7) + 4;
- x6 = (x8-(W3-W5)*x6)>>3;
- x7 = (x8-(W3+W5)*x7)>>3;
-
+ x8 = W7 * (x4 + x5) + 4;
+ x4 = (x8 + (W1 - W7) * x4) >> 3;
+ x5 = (x8 - (W1 + W7) * x5) >> 3;
+ x8 = W3 * (x6 + x7) + 4;
+ x6 = (x8 - (W3 - W5) * x6) >> 3;
+ x7 = (x8 - (W3 + W5) * x7) >> 3;
+
/* second stage */
x8 = x0 + x1;
x0 -= x1;
- x1 = W6*(x3+x2) + 4;
- x2 = (x1-(W2+W6)*x2)>>3;
- x3 = (x1+(W2-W6)*x3)>>3;
+ x1 = W6 * (x3 + x2) + 4;
+ x2 = (x1 - (W2 + W6) * x2) >> 3;
+ x3 = (x1 + (W2 - W6) * x3) >> 3;
x1 = x4 + x6;
x4 -= x6;
x6 = x5 + x7;
x5 -= x7;
-
+
/* third stage */
x7 = x8 + x3;
x8 -= x3;
x3 = x0 + x2;
x0 -= x2;
- x2 = (181*(x4+x5)+128)>>8;
- x4 = (181*(x4-x5)+128)>>8;
-
+ x2 = (181 * (x4 + x5) + 128) >> 8;
+ x4 = (181 * (x4 - x5) + 128) >> 8;
+
/* fourth stage */
- blk[8*0] = iclp[(x7+x1)>>14];
- blk[8*1] = iclp[(x3+x2)>>14];
- blk[8*2] = iclp[(x0+x4)>>14];
- blk[8*3] = iclp[(x8+x6)>>14];
- blk[8*4] = iclp[(x8-x6)>>14];
- blk[8*5] = iclp[(x0-x4)>>14];
- blk[8*6] = iclp[(x3-x2)>>14];
- blk[8*7] = iclp[(x7-x1)>>14];
+ blk[8 * 0] = iclp[(x7 + x1) >> 14];
+ blk[8 * 1] = iclp[(x3 + x2) >> 14];
+ blk[8 * 2] = iclp[(x0 + x4) >> 14];
+ blk[8 * 3] = iclp[(x8 + x6) >> 14];
+ blk[8 * 4] = iclp[(x8 - x6) >> 14];
+ blk[8 * 5] = iclp[(x0 - x4) >> 14];
+ blk[8 * 6] = iclp[(x3 - x2) >> 14];
+ blk[8 * 7] = iclp[(x7 - x1) >> 14];
}
/* two dimensional inverse discrete cosine transform */
-void gst_idct_fast_int_idct(block)
-short *block;
+void
+gst_idct_fast_int_idct (block)
+ short *block;
{
int i;
- for (i=0; i<8; i++)
- idctrow(block+8*i);
+ for (i = 0; i < 8; i++)
+ idctrow (block + 8 * i);
- for (i=0; i<8; i++)
- idctcol(block+i);
+ for (i = 0; i < 8; i++)
+ idctcol (block + i);
}
-void gst_idct_init_fast_int_idct()
+void
+gst_idct_init_fast_int_idct ()
{
int i;
- iclp = iclip+512;
- for (i= -512; i<512; i++)
- iclp[i] = (i<-256) ? -256 : ((i>255) ? 255 : i);
+ iclp = iclip + 512;
+ for (i = -512; i < 512; i++)
+ iclp[i] = (i < -256) ? -256 : ((i > 255) ? 255 : i);
}
diff --git a/gst-libs/gst/idct/floatidct.c b/gst-libs/gst/idct/floatidct.c
index b215bd78..0fa1e830 100644
--- a/gst-libs/gst/idct/floatidct.c
+++ b/gst-libs/gst/idct/floatidct.c
@@ -56,51 +56,51 @@ static double gst_idct_float_c[8][8];
/* initialize DCT coefficient matrix */
-void gst_idct_init_float_idct()
+void
+gst_idct_init_float_idct ()
{
int freq, time;
double scale;
- for (freq=0; freq < 8; freq++)
- {
- scale = (freq == 0) ? sqrt(0.125) : 0.5;
- for (time=0; time<8; time++)
- gst_idct_float_c[freq][time] = scale*cos((PI/8.0)*freq*(time + 0.5));
+ for (freq = 0; freq < 8; freq++) {
+ scale = (freq == 0) ? sqrt (0.125) : 0.5;
+ for (time = 0; time < 8; time++)
+ gst_idct_float_c[freq][time] =
+ scale * cos ((PI / 8.0) * freq * (time + 0.5));
}
}
/* perform IDCT matrix multiply for 8x8 coefficient block */
-void gst_idct_float_idct(block)
-short *block;
+void
+gst_idct_float_idct (block)
+ short *block;
{
int i, j, k, v;
double partial_product;
double tmp[64];
- for (i=0; i<8; i++)
- for (j=0; j<8; j++)
- {
+ for (i = 0; i < 8; i++)
+ for (j = 0; j < 8; j++) {
partial_product = 0.0;
- for (k=0; k<8; k++)
- partial_product+= gst_idct_float_c[k][j]*block[8*i+k];
+ for (k = 0; k < 8; k++)
+ partial_product += gst_idct_float_c[k][j] * block[8 * i + k];
- tmp[8*i+j] = partial_product;
+ tmp[8 * i + j] = partial_product;
}
/* Transpose operation is integrated into address mapping by switching
loop order of i and j */
- for (j=0; j<8; j++)
- for (i=0; i<8; i++)
- {
+ for (j = 0; j < 8; j++)
+ for (i = 0; i < 8; i++) {
partial_product = 0.0;
- for (k=0; k<8; k++)
- partial_product+= gst_idct_float_c[k][i]*tmp[8*k+j];
+ for (k = 0; k < 8; k++)
+ partial_product += gst_idct_float_c[k][i] * tmp[8 * k + j];
- v = (int) floor(partial_product+0.5);
- block[8*i+j] = (v<-256) ? -256 : ((v>255) ? 255 : v);
+ v = (int) floor (partial_product + 0.5);
+ block[8 * i + j] = (v < -256) ? -256 : ((v > 255) ? 255 : v);
}
}
diff --git a/gst-libs/gst/idct/idct.c b/gst-libs/gst/idct/idct.c
index 59c6a844..4be150f1 100644
--- a/gst-libs/gst/idct/idct.c
+++ b/gst-libs/gst/idct/idct.c
@@ -25,24 +25,25 @@
#include <gst/idct/idct.h>
#include "dct.h"
-static void gst_idct_int_sparse_idct(short *data);
+static void gst_idct_int_sparse_idct (short *data);
-GstIDCT *gst_idct_new(GstIDCTMethod method)
+GstIDCT *
+gst_idct_new (GstIDCTMethod method)
{
- GstIDCT *new = g_malloc(sizeof(GstIDCT));
+ GstIDCT *new = g_malloc (sizeof (GstIDCT));
new->need_transpose = FALSE;
if (method == GST_IDCT_DEFAULT) {
#ifdef HAVE_LIBMMX
- if (gst_cpu_get_flags() & GST_CPU_FLAG_MMX) {
+ if (gst_cpu_get_flags () & GST_CPU_FLAG_MMX) {
method = GST_IDCT_MMX;
}
/* disabled for now
- if (gst_cpu_get_flags() & GST_CPU_FLAG_SSE) {
- method = GST_IDCT_SSE;
- }
- */
+ if (gst_cpu_get_flags() & GST_CPU_FLAG_SSE) {
+ method = GST_IDCT_SSE;
+ }
+ */
else
#endif /* HAVE_LIBMMX */
{
@@ -53,49 +54,50 @@ GstIDCT *gst_idct_new(GstIDCTMethod method)
new->convert_sparse = gst_idct_int_sparse_idct;
switch (method) {
- case GST_IDCT_FAST_INT:
- GST_INFO ( "using fast_int_idct");
- gst_idct_init_fast_int_idct();
- new->convert = gst_idct_fast_int_idct;
- break;
- case GST_IDCT_INT:
- GST_INFO ( "using int_idct");
- new->convert = gst_idct_int_idct;
- break;
- case GST_IDCT_FLOAT:
- GST_INFO ( "using float_idct");
- gst_idct_init_float_idct();
- new->convert = gst_idct_float_idct;
- break;
+ case GST_IDCT_FAST_INT:
+ GST_INFO ("using fast_int_idct");
+ gst_idct_init_fast_int_idct ();
+ new->convert = gst_idct_fast_int_idct;
+ break;
+ case GST_IDCT_INT:
+ GST_INFO ("using int_idct");
+ new->convert = gst_idct_int_idct;
+ break;
+ case GST_IDCT_FLOAT:
+ GST_INFO ("using float_idct");
+ gst_idct_init_float_idct ();
+ new->convert = gst_idct_float_idct;
+ break;
#ifdef HAVE_LIBMMX
- case GST_IDCT_MMX:
- GST_INFO ( "using MMX_idct");
- new->convert = gst_idct_mmx_idct;
- new->need_transpose = TRUE;
- break;
- case GST_IDCT_MMX32:
- GST_INFO ( "using MMX32_idct");
- new->convert = gst_idct_mmx32_idct;
- new->need_transpose = TRUE;
- break;
- case GST_IDCT_SSE:
- GST_INFO ( "using SSE_idct");
- new->convert = gst_idct_sse_idct;
- new->need_transpose = TRUE;
- break;
+ case GST_IDCT_MMX:
+ GST_INFO ("using MMX_idct");
+ new->convert = gst_idct_mmx_idct;
+ new->need_transpose = TRUE;
+ break;
+ case GST_IDCT_MMX32:
+ GST_INFO ("using MMX32_idct");
+ new->convert = gst_idct_mmx32_idct;
+ new->need_transpose = TRUE;
+ break;
+ case GST_IDCT_SSE:
+ GST_INFO ("using SSE_idct");
+ new->convert = gst_idct_sse_idct;
+ new->need_transpose = TRUE;
+ break;
#endif /* HAVE_LIBMMX */
- default:
- GST_INFO ( "method not supported");
- g_free(new);
- return NULL;
+ default:
+ GST_INFO ("method not supported");
+ g_free (new);
+ return NULL;
}
return new;
}
-static void gst_idct_int_sparse_idct(short *data)
+static void
+gst_idct_int_sparse_idct (short *data)
{
short val;
- gint32 v, *dp = (guint32 *)data;
+ gint32 v, *dp = (guint32 *) data;
v = *data;
@@ -104,43 +106,61 @@ static void gst_idct_int_sparse_idct(short *data)
val += (8 >> 1);
val /= 8;
val = -val;
- }
- else {
+ } else {
val = (v + (8 >> 1)) / 8;
}
- v = (( val & 0xffff) | (val << 16));
-
- dp[0] = v; dp[1] = v; dp[2] = v; dp[3] = v;
- dp[4] = v; dp[5] = v; dp[6] = v; dp[7] = v;
- dp[8] = v; dp[9] = v; dp[10] = v; dp[11] = v;
- dp[12] = v; dp[13] = v; dp[14] = v; dp[15] = v;
- dp[16] = v; dp[17] = v; dp[18] = v; dp[19] = v;
- dp[20] = v; dp[21] = v; dp[22] = v; dp[23] = v;
- dp[24] = v; dp[25] = v; dp[26] = v; dp[27] = v;
- dp[28] = v; dp[29] = v; dp[30] = v; dp[31] = v;
+ v = ((val & 0xffff) | (val << 16));
+
+ dp[0] = v;
+ dp[1] = v;
+ dp[2] = v;
+ dp[3] = v;
+ dp[4] = v;
+ dp[5] = v;
+ dp[6] = v;
+ dp[7] = v;
+ dp[8] = v;
+ dp[9] = v;
+ dp[10] = v;
+ dp[11] = v;
+ dp[12] = v;
+ dp[13] = v;
+ dp[14] = v;
+ dp[15] = v;
+ dp[16] = v;
+ dp[17] = v;
+ dp[18] = v;
+ dp[19] = v;
+ dp[20] = v;
+ dp[21] = v;
+ dp[22] = v;
+ dp[23] = v;
+ dp[24] = v;
+ dp[25] = v;
+ dp[26] = v;
+ dp[27] = v;
+ dp[28] = v;
+ dp[29] = v;
+ dp[30] = v;
+ dp[31] = v;
}
-void gst_idct_destroy(GstIDCT *idct)
+void
+gst_idct_destroy (GstIDCT * idct)
{
- g_return_if_fail(idct != NULL);
+ g_return_if_fail (idct != NULL);
- g_free(idct);
+ g_free (idct);
}
static gboolean
-plugin_init (GstPlugin *plugin)
+plugin_init (GstPlugin * plugin)
{
return TRUE;
}
-GST_PLUGIN_DEFINE (
- GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "gstidct",
- "Accelerated IDCT routines",
- plugin_init,
- VERSION,
- GST_LICENSE,
- GST_PACKAGE,
- GST_ORIGIN
-)
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ "gstidct",
+ "Accelerated IDCT routines",
+ plugin_init, VERSION, GST_LICENSE, GST_PACKAGE, GST_ORIGIN)
diff --git a/gst-libs/gst/idct/idct.h b/gst-libs/gst/idct/idct.h
index fa6f62cd..37a2a0b9 100644
--- a/gst-libs/gst/idct/idct.h
+++ b/gst-libs/gst/idct/idct.h
@@ -23,22 +23,24 @@
#include <glib.h>
-typedef enum {
- GST_IDCT_DEFAULT,
- GST_IDCT_INT,
- GST_IDCT_FAST_INT,
- GST_IDCT_FLOAT,
- GST_IDCT_MMX,
+typedef enum
+{
+ GST_IDCT_DEFAULT,
+ GST_IDCT_INT,
+ GST_IDCT_FAST_INT,
+ GST_IDCT_FLOAT,
+ GST_IDCT_MMX,
GST_IDCT_MMX32,
GST_IDCT_SSE,
} GstIDCTMethod;
typedef struct _GstIDCT GstIDCT;
-typedef void (*GstIDCTFunction) (gshort *block);
+typedef void (*GstIDCTFunction) (gshort * block);
#define GST_IDCT_TRANSPOSE(idct) ((idct)->need_transpose)
-struct _GstIDCT {
+struct _GstIDCT
+{
/* private */
GstIDCTFunction convert;
GstIDCTFunction convert_sparse;
@@ -46,9 +48,10 @@ struct _GstIDCT {
};
-GstIDCT *gst_idct_new(GstIDCTMethod method);
+GstIDCT *gst_idct_new (GstIDCTMethod method);
+
#define gst_idct_convert(idct, blocks) (idct)->convert((blocks))
#define gst_idct_convert_sparse(idct, blocks) (idct)->convert_sparse((blocks))
-void gst_idct_destroy(GstIDCT *idct);
+void gst_idct_destroy (GstIDCT * idct);
#endif /* __GST_IDCT_H__ */
diff --git a/gst-libs/gst/idct/ieeetest.c b/gst-libs/gst/idct/ieeetest.c
index f5b270eb..d26181c1 100644
--- a/gst-libs/gst/idct/ieeetest.c
+++ b/gst-libs/gst/idct/ieeetest.c
@@ -27,9 +27,9 @@
void usage (char *msg);
long ieeerand (long L, long H);
-void dct_init(void);
-void ref_fdct(DCTELEM block[8][8]);
-void ref_idct(DCTELEM block[8][8]);
+void dct_init (void);
+void ref_fdct (DCTELEM block[8][8]);
+void ref_idct (DCTELEM block[8][8]);
/* error stat accumulators -- assume initialized to 0 */
@@ -38,47 +38,49 @@ long sumsqerrs[DCTSIZE2];
int maxerr[DCTSIZE2];
-char * meets (double val, double limit)
+char *
+meets (double val, double limit)
{
- return ((fabs(val) <= limit) ? "meets" : "FAILS");
+ return ((fabs (val) <= limit) ? "meets" : "FAILS");
}
int
-main(int argc, char **argv)
+main (int argc, char **argv)
{
long minpix, maxpix, sign;
long curiter, niters;
int i, j;
double max, total;
int method;
- DCTELEM block[DCTSIZE2]; /* random source data */
- DCTELEM refcoefs[DCTSIZE2]; /* coefs from reference FDCT */
- DCTELEM refout[DCTSIZE2]; /* output from reference IDCT */
- DCTELEM testout[DCTSIZE2]; /* output from test IDCT */
- GstIDCT *idct;
- guint64 tscstart, tscmin = ~0, tscmax = 0;
- guint64 tscstop;
+ DCTELEM block[DCTSIZE2]; /* random source data */
+ DCTELEM refcoefs[DCTSIZE2]; /* coefs from reference FDCT */
+ DCTELEM refout[DCTSIZE2]; /* output from reference IDCT */
+ DCTELEM testout[DCTSIZE2]; /* output from test IDCT */
+ GstIDCT *idct;
+ guint64 tscstart, tscmin = ~0, tscmax = 0;
+ guint64 tscstop;
/* Argument parsing --- not very bulletproof at all */
- if (argc != 6) usage(NULL);
+ if (argc != 6)
+ usage (NULL);
- method = atoi(argv[1]);
- minpix = atoi(argv[2]);
- maxpix = atoi(argv[3]);
- sign = atoi(argv[4]);
- niters = atol(argv[5]);
+ method = atoi (argv[1]);
+ minpix = atoi (argv[2]);
+ maxpix = atoi (argv[3]);
+ sign = atoi (argv[4]);
+ niters = atol (argv[5]);
- gst_library_load("gstidct");
+ gst_library_load ("gstidct");
- idct = gst_idct_new(method);
+ idct = gst_idct_new (method);
if (idct == 0) {
- printf("method not available\n\n\n");
+ printf ("method not available\n\n\n");
return 0;
}
- dct_init();
+ dct_init ();
/* Loop once per generated random-data block */
@@ -86,164 +88,186 @@ main(int argc, char **argv)
/* generate a pseudo-random block of data */
for (i = 0; i < DCTSIZE2; i++)
- block[i] = (DCTELEM) (ieeerand(-minpix,maxpix) * sign);
+ block[i] = (DCTELEM) (ieeerand (-minpix, maxpix) * sign);
/* perform reference FDCT */
- memcpy(refcoefs, block, sizeof(DCTELEM)*DCTSIZE2);
- ref_fdct((DCTELEM **) &refcoefs);
+ memcpy (refcoefs, block, sizeof (DCTELEM) * DCTSIZE2);
+ ref_fdct ((DCTELEM **) & refcoefs);
/* clip */
for (i = 0; i < DCTSIZE2; i++) {
- if (refcoefs[i] < -2048) refcoefs[i] = -2048;
- else if (refcoefs[i] > 2047) refcoefs[i] = 2047;
+ if (refcoefs[i] < -2048)
+ refcoefs[i] = -2048;
+ else if (refcoefs[i] > 2047)
+ refcoefs[i] = 2047;
}
/* perform reference IDCT */
- memcpy(refout, refcoefs, sizeof(DCTELEM)*DCTSIZE2);
- ref_idct(refout);
+ memcpy (refout, refcoefs, sizeof (DCTELEM) * DCTSIZE2);
+ ref_idct (refout);
/* clip */
for (i = 0; i < DCTSIZE2; i++) {
- if (refout[i] < -256) refout[i] = -256;
- else if (refout[i] > 255) refout[i] = 255;
+ if (refout[i] < -256)
+ refout[i] = -256;
+ else if (refout[i] > 255)
+ refout[i] = 255;
}
/* perform test IDCT */
- if (GST_IDCT_TRANSPOSE(idct)) {
+ if (GST_IDCT_TRANSPOSE (idct)) {
for (j = 0; j < DCTSIZE; j++) {
- for (i = 0; i < DCTSIZE; i++) {
- testout[i*DCTSIZE+j] = refcoefs[j*DCTSIZE+i];
- }
- }
- }
- else {
- memcpy(testout, refcoefs, sizeof(DCTELEM)*DCTSIZE2);
- }
-
- gst_trace_read_tsc(&tscstart);
- gst_idct_convert(idct, testout);
- gst_trace_read_tsc(&tscstop);
- /*printf("time %llu, %llu %lld\n", tscstart, tscstop, tscstop-tscstart); */
- if (tscstop - tscstart < tscmin) tscmin = tscstop-tscstart;
- if (tscstop - tscstart > tscmax) tscmax = tscstop-tscstart;
+ for (i = 0; i < DCTSIZE; i++) {
+ testout[i * DCTSIZE + j] = refcoefs[j * DCTSIZE + i];
+ }
+ }
+ } else {
+ memcpy (testout, refcoefs, sizeof (DCTELEM) * DCTSIZE2);
+ }
+
+ gst_trace_read_tsc (&tscstart);
+ gst_idct_convert (idct, testout);
+ gst_trace_read_tsc (&tscstop);
+ /*printf("time %llu, %llu %lld\n", tscstart, tscstop, tscstop-tscstart); */
+ if (tscstop - tscstart < tscmin)
+ tscmin = tscstop - tscstart;
+ if (tscstop - tscstart > tscmax)
+ tscmax = tscstop - tscstart;
/* clip */
for (i = 0; i < DCTSIZE2; i++) {
- if (testout[i] < -256) testout[i] = -256;
- else if (testout[i] > 255) testout[i] = 255;
+ if (testout[i] < -256)
+ testout[i] = -256;
+ else if (testout[i] > 255)
+ testout[i] = 255;
}
/* accumulate error stats */
for (i = 0; i < DCTSIZE2; i++) {
register int err = testout[i] - refout[i];
+
sumerrs[i] += err;
sumsqerrs[i] += err * err;
- if (err < 0) err = -err;
- if (maxerr[i] < err) maxerr[i] = err;
+ if (err < 0)
+ err = -err;
+ if (maxerr[i] < err)
+ maxerr[i] = err;
}
if (curiter % 100 == 99) {
- fprintf(stderr, ".");
- fflush(stderr);
+ fprintf (stderr, ".");
+ fflush (stderr);
}
}
- fprintf(stderr, "\n");
+ fprintf (stderr, "\n");
/* print results */
- printf("IEEE test conditions: -L = %ld, +H = %ld, sign = %ld, #iters = %ld\n",
- minpix, maxpix, sign, niters);
+ printf
+ ("IEEE test conditions: -L = %ld, +H = %ld, sign = %ld, #iters = %ld\n",
+ minpix, maxpix, sign, niters);
- printf("Speed, min time %lld, max %lld\n", tscmin, tscmax);
+ printf ("Speed, min time %lld, max %lld\n", tscmin, tscmax);
- printf("Peak absolute values of errors:\n");
+ printf ("Peak absolute values of errors:\n");
for (i = 0, j = 0; i < DCTSIZE2; i++) {
- if (j < maxerr[i]) j = maxerr[i];
- printf("%4d", maxerr[i]);
- if ((i%DCTSIZE) == DCTSIZE-1) printf("\n");
+ if (j < maxerr[i])
+ j = maxerr[i];
+ printf ("%4d", maxerr[i]);
+ if ((i % DCTSIZE) == DCTSIZE - 1)
+ printf ("\n");
}
- printf("Worst peak error = %d (%s spec limit 1)\n\n", j,
- meets((double) j, 1.0));
+ printf ("Worst peak error = %d (%s spec limit 1)\n\n", j,
+ meets ((double) j, 1.0));
- printf("Mean square errors:\n");
+ printf ("Mean square errors:\n");
max = total = 0.0;
for (i = 0; i < DCTSIZE2; i++) {
- double err = (double) sumsqerrs[i] / ((double) niters);
+ double err = (double) sumsqerrs[i] / ((double) niters);
+
total += (double) sumsqerrs[i];
- if (max < err) max = err;
- printf(" %8.4f", err);
- if ((i%DCTSIZE) == DCTSIZE-1) printf("\n");
+ if (max < err)
+ max = err;
+ printf (" %8.4f", err);
+ if ((i % DCTSIZE) == DCTSIZE - 1)
+ printf ("\n");
}
- printf("Worst pmse = %.6f (%s spec limit 0.06)\n", max, meets(max, 0.06));
- total /= (double) (64*niters);
- printf("Overall mse = %.6f (%s spec limit 0.02)\n\n", total,
- meets(total, 0.02));
+ printf ("Worst pmse = %.6f (%s spec limit 0.06)\n", max, meets (max, 0.06));
+ total /= (double) (64 * niters);
+ printf ("Overall mse = %.6f (%s spec limit 0.02)\n\n", total,
+ meets (total, 0.02));
- printf("Mean errors:\n");
+ printf ("Mean errors:\n");
max = total = 0.0;
for (i = 0; i < DCTSIZE2; i++) {
- double err = (double) sumerrs[i] / ((double) niters);
+ double err = (double) sumerrs[i] / ((double) niters);
+
total += (double) sumerrs[i];
- printf(" %8.4f", err);
- if (err < 0.0) err = -err;
- if (max < err) max = err;
- if ((i%DCTSIZE) == DCTSIZE-1) printf("\n");
+ printf (" %8.4f", err);
+ if (err < 0.0)
+ err = -err;
+ if (max < err)
+ max = err;
+ if ((i % DCTSIZE) == DCTSIZE - 1)
+ printf ("\n");
}
- printf("Worst mean error = %.6f (%s spec limit 0.015)\n", max,
- meets(max, 0.015));
- total /= (double) (64*niters);
- printf("Overall mean error = %.6f (%s spec limit 0.0015)\n\n", total,
- meets(total, 0.0015));
+ printf ("Worst mean error = %.6f (%s spec limit 0.015)\n", max,
+ meets (max, 0.015));
+ total /= (double) (64 * niters);
+ printf ("Overall mean error = %.6f (%s spec limit 0.0015)\n\n", total,
+ meets (total, 0.0015));
/* test for 0 input giving 0 output */
- memset(testout, 0, sizeof(DCTELEM)*DCTSIZE2);
- gst_idct_convert(idct, testout);
- for (i = 0, j=0; i < DCTSIZE2; i++) {
+ memset (testout, 0, sizeof (DCTELEM) * DCTSIZE2);
+ gst_idct_convert (idct, testout);
+ for (i = 0, j = 0; i < DCTSIZE2; i++) {
if (testout[i]) {
- printf("Position %d of IDCT(0) = %d (FAILS)\n", i, testout[i]);
+ printf ("Position %d of IDCT(0) = %d (FAILS)\n", i, testout[i]);
j++;
}
}
- printf("%d elements of IDCT(0) were not zero\n\n\n", j);
+ printf ("%d elements of IDCT(0) were not zero\n\n\n", j);
- exit(0);
+ exit (0);
return 0;
}
-void usage (char *msg)
+void
+usage (char *msg)
{
if (msg != NULL)
- fprintf(stderr, "\nerror: %s\n", msg);
-
- fprintf(stderr, "\n");
- fprintf(stderr, "usage: ieeetest minpix maxpix sign niters\n");
- fprintf(stderr, "\n");
- fprintf(stderr, " test = 1 - 5\n");
- fprintf(stderr, " minpix = -L value per IEEE spec\n");
- fprintf(stderr, " maxpix = H value per IEEE spec\n");
- fprintf(stderr, " sign = +1 for normal, -1 to run negated test\n");
- fprintf(stderr, " niters = # iterations (10000 for full test)\n");
- fprintf(stderr, "\n");
-
- exit(1);
+ fprintf (stderr, "\nerror: %s\n", msg);
+
+ fprintf (stderr, "\n");
+ fprintf (stderr, "usage: ieeetest minpix maxpix sign niters\n");
+ fprintf (stderr, "\n");
+ fprintf (stderr, " test = 1 - 5\n");
+ fprintf (stderr, " minpix = -L value per IEEE spec\n");
+ fprintf (stderr, " maxpix = H value per IEEE spec\n");
+ fprintf (stderr, " sign = +1 for normal, -1 to run negated test\n");
+ fprintf (stderr, " niters = # iterations (10000 for full test)\n");
+ fprintf (stderr, "\n");
+
+ exit (1);
}
/* Pseudo-random generator specified by IEEE 1180 */
-long ieeerand (long L, long H)
+long
+ieeerand (long L, long H)
{
static long randx = 1;
static double z = (double) 0x7fffffff;
- long i,j;
+ long i, j;
double x;
randx = (randx * 1103515245) + 12345;
i = randx & 0x7ffffffe;
x = ((double) i) / z;
- x *= (L+H+1);
+ x *= (L + H + 1);
j = x;
- return j-L;
+ return j - L;
}
@@ -256,33 +280,35 @@ double coslu[8][8];
/* Routine to initialise the cosine lookup table */
-void dct_init(void)
+void
+dct_init (void)
{
- int a,b;
+ int a, b;
double tmp;
- for(a=0;a<8;a++)
- for(b=0;b<8;b++) {
- tmp = cos((double)((a+a+1)*b) * (3.14159265358979323846 / 16.0));
- if(b==0)
- tmp /= sqrt(2.0);
+ for (a = 0; a < 8; a++)
+ for (b = 0; b < 8; b++) {
+ tmp = cos ((double) ((a + a + 1) * b) * (3.14159265358979323846 / 16.0));
+ if (b == 0)
+ tmp /= sqrt (2.0);
coslu[a][b] = tmp * 0.5;
}
}
-void ref_fdct (DCTELEM block[8][8])
+void
+ref_fdct (DCTELEM block[8][8])
{
- int x,y,u,v;
+ int x, y, u, v;
double tmp, tmp2;
double res[8][8];
- for (v=0; v<8; v++) {
- for (u=0; u<8; u++) {
+ for (v = 0; v < 8; v++) {
+ for (u = 0; u < 8; u++) {
tmp = 0.0;
- for (y=0; y<8; y++) {
+ for (y = 0; y < 8; y++) {
tmp2 = 0.0;
- for (x=0; x<8; x++) {
+ for (x = 0; x < 8; x++) {
tmp2 += (double) block[y][x] * coslu[x][u];
}
tmp += coslu[y][v] * tmp2;
@@ -291,11 +317,11 @@ void ref_fdct (DCTELEM block[8][8])
}
}
- for (v=0; v<8; v++) {
- for (u=0; u<8; u++) {
+ for (v = 0; v < 8; v++) {
+ for (u = 0; u < 8; u++) {
tmp = res[v][u];
if (tmp < 0.0) {
- x = - ((int) (0.5 - tmp));
+ x = -((int) (0.5 - tmp));
} else {
x = (int) (tmp + 0.5);
}
@@ -305,18 +331,19 @@ void ref_fdct (DCTELEM block[8][8])
}
-void ref_idct (DCTELEM block[8][8])
+void
+ref_idct (DCTELEM block[8][8])
{
- int x,y,u,v;
+ int x, y, u, v;
double tmp, tmp2;
double res[8][8];
- for (y=0; y<8; y++) {
- for (x=0; x<8; x++) {
+ for (y = 0; y < 8; y++) {
+ for (x = 0; x < 8; x++) {
tmp = 0.0;
- for (v=0; v<8; v++) {
+ for (v = 0; v < 8; v++) {
tmp2 = 0.0;
- for (u=0; u<8; u++) {
+ for (u = 0; u < 8; u++) {
tmp2 += (double) block[v][u] * coslu[x][u];
}
tmp += coslu[y][v] * tmp2;
@@ -325,11 +352,11 @@ void ref_idct (DCTELEM block[8][8])
}
}
- for (v=0; v<8; v++) {
- for (u=0; u<8; u++) {
+ for (v = 0; v < 8; v++) {
+ for (u = 0; u < 8; u++) {
tmp = res[v][u];
if (tmp < 0.0) {
- x = - ((int) (0.5 - tmp));
+ x = -((int) (0.5 - tmp));
} else {
x = (int) (tmp + 0.5);
}
diff --git a/gst-libs/gst/idct/intidct.c b/gst-libs/gst/idct/intidct.c
index e08e6adb..42f0ac84 100644
--- a/gst-libs/gst/idct/intidct.c
+++ b/gst-libs/gst/idct/intidct.c
@@ -51,10 +51,8 @@
*/
#if DCTSIZE != 8
- Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */
+Sorry, this code only copes with 8 x8 DCTs. /* deliberate syntax err */
#endif
-
-
/*
* A 2-D IDCT can be done by 1-D IDCT on each row followed by 1-D IDCT
* on each column. Direct algorithms are also available, but they are
@@ -90,7 +88,6 @@
* have BITS_IN_JSAMPLE + CONST_BITS + PASS1_BITS <= 26. Error analysis
* shows that the values given below are the most effective.
*/
-
#ifdef EIGHT_BIT_SAMPLES
#define CONST_BITS 13
#define PASS1_BITS 2
@@ -98,22 +95,16 @@
#define CONST_BITS 13
#define PASS1_BITS 1 /* lose a little precision to avoid overflow */
#endif
-
#define ONE ((INT32) 1)
-
#define CONST_SCALE (ONE << CONST_BITS)
-
/* Convert a positive real constant to an integer scaled by CONST_SCALE. */
-
#define FIX(x) ((INT32) ((x) * CONST_SCALE + 0.5))
-
/* Some C compilers fail to reduce "FIX(constant)" at compile time, thus
* causing a lot of useless floating-point operations at run time.
* To get around this we use the following pre-calculated constants.
* If you change CONST_BITS you may want to add appropriate values.
* (With a reasonable C compiler, you can just rely on the FIX() macro...)
*/
-
#if CONST_BITS == 13
#define FIX_0_298631336 ((INT32) 2446) /* FIX(0.298631336) */
#define FIX_0_390180644 ((INT32) 3196) /* FIX(0.390180644) */
@@ -141,15 +132,11 @@
#define FIX_2_562915447 FIX(2.562915447)
#define FIX_3_072711026 FIX(3.072711026)
#endif
-
-
/* Descale and correctly round an INT32 value that's scaled by N bits.
* We assume RIGHT_SHIFT rounds towards minus infinity, so adding
* the fudge factor is correct for either sign of X.
*/
-
#define DESCALE(x,n) RIGHT_SHIFT((x) + (ONE << ((n)-1)), n)
-
/* Multiply an INT32 variable by an INT32 constant to yield an INT32 result.
* For 8-bit samples with the recommended scaling, all the variable
* and constant values involved are no more than 16 bits wide, so a
@@ -160,7 +147,6 @@
* combination of casts.
* NB: for 12-bit samples, a full 32-bit multiplication will be needed.
*/
-
#ifdef EIGHT_BIT_SAMPLES
#ifdef SHORTxSHORT_32 /* may work if 'int' is 32 bits */
#define MULTIPLY(var,const) (((INT16) (var)) * ((INT16) (const)))
@@ -169,17 +155,13 @@
#define MULTIPLY(var,const) (((INT16) (var)) * ((INT32) (const)))
#endif
#endif
-
#ifndef MULTIPLY /* default definition */
#define MULTIPLY(var,const) ((var) * (const))
#endif
-
-
/*
* Perform the inverse DCT on one block of coefficients.
*/
-
-void
+ void
gst_idct_int_idct (DCTBLOCK data)
{
INT32 tmp0, tmp1, tmp2, tmp3;
@@ -187,14 +169,13 @@ gst_idct_int_idct (DCTBLOCK data)
INT32 z1, z2, z3, z4, z5;
register DCTELEM *dataptr;
int rowctr;
- SHIFT_TEMPS
-
- /* Pass 1: process rows. */
- /* Note results are scaled up by sqrt(8) compared to a true IDCT; */
- /* furthermore, we scale the results by 2**PASS1_BITS. */
- dataptr = data;
- for (rowctr = DCTSIZE-1; rowctr >= 0; rowctr--) {
+ SHIFT_TEMPS
+ /* Pass 1: process rows. */
+ /* Note results are scaled up by sqrt(8) compared to a true IDCT; */
+ /* furthermore, we scale the results by 2**PASS1_BITS. */
+ dataptr = data;
+ for (rowctr = DCTSIZE - 1; rowctr >= 0; rowctr--) {
/* Due to quantization, we will usually find that many of the input
* coefficients are zero, especially the AC terms. We can exploit this
* by short-circuiting the IDCT calculation for any row in which all
@@ -205,10 +186,10 @@ gst_idct_int_idct (DCTBLOCK data)
*/
if ((dataptr[1] | dataptr[2] | dataptr[3] | dataptr[4] |
- dataptr[5] | dataptr[6] | dataptr[7]) == 0) {
+ dataptr[5] | dataptr[6] | dataptr[7]) == 0) {
/* AC terms all zero */
DCTELEM dcval = (DCTELEM) (dataptr[0] << PASS1_BITS);
-
+
dataptr[0] = dcval;
dataptr[1] = dcval;
dataptr[2] = dcval;
@@ -217,7 +198,7 @@ gst_idct_int_idct (DCTBLOCK data)
dataptr[5] = dcval;
dataptr[6] = dcval;
dataptr[7] = dcval;
-
+
dataptr += DCTSIZE; /* advance pointer to next row */
continue;
}
@@ -228,9 +209,9 @@ gst_idct_int_idct (DCTBLOCK data)
z2 = (INT32) dataptr[2];
z3 = (INT32) dataptr[6];
- z1 = MULTIPLY(z2 + z3, FIX_0_541196100);
- tmp2 = z1 + MULTIPLY(z3, - FIX_1_847759065);
- tmp3 = z1 + MULTIPLY(z2, FIX_0_765366865);
+ z1 = MULTIPLY (z2 + z3, FIX_0_541196100);
+ tmp2 = z1 + MULTIPLY (z3, -FIX_1_847759065);
+ tmp3 = z1 + MULTIPLY (z2, FIX_0_765366865);
tmp0 = ((INT32) dataptr[0] + (INT32) dataptr[4]) << CONST_BITS;
tmp1 = ((INT32) dataptr[0] - (INT32) dataptr[4]) << CONST_BITS;
@@ -239,7 +220,7 @@ gst_idct_int_idct (DCTBLOCK data)
tmp13 = tmp0 - tmp3;
tmp11 = tmp1 + tmp2;
tmp12 = tmp1 - tmp2;
-
+
/* Odd part per figure 8; the matrix is unitary and hence its
* transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively.
*/
@@ -253,20 +234,20 @@ gst_idct_int_idct (DCTBLOCK data)
z2 = tmp1 + tmp2;
z3 = tmp0 + tmp2;
z4 = tmp1 + tmp3;
- z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */
-
- tmp0 = MULTIPLY(tmp0, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */
- tmp1 = MULTIPLY(tmp1, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */
- tmp2 = MULTIPLY(tmp2, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */
- tmp3 = MULTIPLY(tmp3, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */
- z1 = MULTIPLY(z1, - FIX_0_899976223); /* sqrt(2) * (c7-c3) */
- z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
- z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
- z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */
-
+ z5 = MULTIPLY (z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */
+
+ tmp0 = MULTIPLY (tmp0, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */
+ tmp1 = MULTIPLY (tmp1, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */
+ tmp2 = MULTIPLY (tmp2, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */
+ tmp3 = MULTIPLY (tmp3, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */
+ z1 = MULTIPLY (z1, -FIX_0_899976223); /* sqrt(2) * (c7-c3) */
+ z2 = MULTIPLY (z2, -FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
+ z3 = MULTIPLY (z3, -FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
+ z4 = MULTIPLY (z4, -FIX_0_390180644); /* sqrt(2) * (c5-c3) */
+
z3 += z5;
z4 += z5;
-
+
tmp0 += z1 + z3;
tmp1 += z2 + z4;
tmp2 += z2 + z3;
@@ -274,14 +255,14 @@ gst_idct_int_idct (DCTBLOCK data)
/* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
- dataptr[0] = (DCTELEM) DESCALE(tmp10 + tmp3, CONST_BITS-PASS1_BITS);
- dataptr[7] = (DCTELEM) DESCALE(tmp10 - tmp3, CONST_BITS-PASS1_BITS);
- dataptr[1] = (DCTELEM) DESCALE(tmp11 + tmp2, CONST_BITS-PASS1_BITS);
- dataptr[6] = (DCTELEM) DESCALE(tmp11 - tmp2, CONST_BITS-PASS1_BITS);
- dataptr[2] = (DCTELEM) DESCALE(tmp12 + tmp1, CONST_BITS-PASS1_BITS);
- dataptr[5] = (DCTELEM) DESCALE(tmp12 - tmp1, CONST_BITS-PASS1_BITS);
- dataptr[3] = (DCTELEM) DESCALE(tmp13 + tmp0, CONST_BITS-PASS1_BITS);
- dataptr[4] = (DCTELEM) DESCALE(tmp13 - tmp0, CONST_BITS-PASS1_BITS);
+ dataptr[0] = (DCTELEM) DESCALE (tmp10 + tmp3, CONST_BITS - PASS1_BITS);
+ dataptr[7] = (DCTELEM) DESCALE (tmp10 - tmp3, CONST_BITS - PASS1_BITS);
+ dataptr[1] = (DCTELEM) DESCALE (tmp11 + tmp2, CONST_BITS - PASS1_BITS);
+ dataptr[6] = (DCTELEM) DESCALE (tmp11 - tmp2, CONST_BITS - PASS1_BITS);
+ dataptr[2] = (DCTELEM) DESCALE (tmp12 + tmp1, CONST_BITS - PASS1_BITS);
+ dataptr[5] = (DCTELEM) DESCALE (tmp12 - tmp1, CONST_BITS - PASS1_BITS);
+ dataptr[3] = (DCTELEM) DESCALE (tmp13 + tmp0, CONST_BITS - PASS1_BITS);
+ dataptr[4] = (DCTELEM) DESCALE (tmp13 - tmp0, CONST_BITS - PASS1_BITS);
dataptr += DCTSIZE; /* advance pointer to next row */
}
@@ -291,7 +272,7 @@ gst_idct_int_idct (DCTBLOCK data)
/* and also undo the PASS1_BITS scaling. */
dataptr = data;
- for (rowctr = DCTSIZE-1; rowctr >= 0; rowctr--) {
+ for (rowctr = DCTSIZE - 1; rowctr >= 0; rowctr--) {
/* Columns of zeroes can be exploited in the same way as we did with rows.
* However, the row calculation has created many nonzero AC terms, so the
* simplification applies less often (typically 5% to 10% of the time).
@@ -301,21 +282,21 @@ gst_idct_int_idct (DCTBLOCK data)
*/
#ifndef NO_ZERO_COLUMN_TEST
- if ((dataptr[DCTSIZE*1] | dataptr[DCTSIZE*2] | dataptr[DCTSIZE*3] |
- dataptr[DCTSIZE*4] | dataptr[DCTSIZE*5] | dataptr[DCTSIZE*6] |
- dataptr[DCTSIZE*7]) == 0) {
+ if ((dataptr[DCTSIZE * 1] | dataptr[DCTSIZE * 2] | dataptr[DCTSIZE * 3] |
+ dataptr[DCTSIZE * 4] | dataptr[DCTSIZE * 5] | dataptr[DCTSIZE * 6] |
+ dataptr[DCTSIZE * 7]) == 0) {
/* AC terms all zero */
- DCTELEM dcval = (DCTELEM) DESCALE((INT32) dataptr[0], PASS1_BITS+3);
-
- dataptr[DCTSIZE*0] = dcval;
- dataptr[DCTSIZE*1] = dcval;
- dataptr[DCTSIZE*2] = dcval;
- dataptr[DCTSIZE*3] = dcval;
- dataptr[DCTSIZE*4] = dcval;
- dataptr[DCTSIZE*5] = dcval;
- dataptr[DCTSIZE*6] = dcval;
- dataptr[DCTSIZE*7] = dcval;
-
+ DCTELEM dcval = (DCTELEM) DESCALE ((INT32) dataptr[0], PASS1_BITS + 3);
+
+ dataptr[DCTSIZE * 0] = dcval;
+ dataptr[DCTSIZE * 1] = dcval;
+ dataptr[DCTSIZE * 2] = dcval;
+ dataptr[DCTSIZE * 3] = dcval;
+ dataptr[DCTSIZE * 4] = dcval;
+ dataptr[DCTSIZE * 5] = dcval;
+ dataptr[DCTSIZE * 6] = dcval;
+ dataptr[DCTSIZE * 7] = dcval;
+
dataptr++; /* advance pointer to next column */
continue;
}
@@ -324,48 +305,52 @@ gst_idct_int_idct (DCTBLOCK data)
/* Even part: reverse the even part of the forward DCT. */
/* The rotator is sqrt(2)*c(-6). */
- z2 = (INT32) dataptr[DCTSIZE*2];
- z3 = (INT32) dataptr[DCTSIZE*6];
+ z2 = (INT32) dataptr[DCTSIZE * 2];
+ z3 = (INT32) dataptr[DCTSIZE * 6];
- z1 = MULTIPLY(z2 + z3, FIX_0_541196100);
- tmp2 = z1 + MULTIPLY(z3, - FIX_1_847759065);
- tmp3 = z1 + MULTIPLY(z2, FIX_0_765366865);
+ z1 = MULTIPLY (z2 + z3, FIX_0_541196100);
+ tmp2 = z1 + MULTIPLY (z3, -FIX_1_847759065);
+ tmp3 = z1 + MULTIPLY (z2, FIX_0_765366865);
- tmp0 = ((INT32) dataptr[DCTSIZE*0] + (INT32) dataptr[DCTSIZE*4]) << CONST_BITS;
- tmp1 = ((INT32) dataptr[DCTSIZE*0] - (INT32) dataptr[DCTSIZE*4]) << CONST_BITS;
+ tmp0 =
+ ((INT32) dataptr[DCTSIZE * 0] +
+ (INT32) dataptr[DCTSIZE * 4]) << CONST_BITS;
+ tmp1 =
+ ((INT32) dataptr[DCTSIZE * 0] -
+ (INT32) dataptr[DCTSIZE * 4]) << CONST_BITS;
tmp10 = tmp0 + tmp3;
tmp13 = tmp0 - tmp3;
tmp11 = tmp1 + tmp2;
tmp12 = tmp1 - tmp2;
-
+
/* Odd part per figure 8; the matrix is unitary and hence its
* transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively.
*/
- tmp0 = (INT32) dataptr[DCTSIZE*7];
- tmp1 = (INT32) dataptr[DCTSIZE*5];
- tmp2 = (INT32) dataptr[DCTSIZE*3];
- tmp3 = (INT32) dataptr[DCTSIZE*1];
+ tmp0 = (INT32) dataptr[DCTSIZE * 7];
+ tmp1 = (INT32) dataptr[DCTSIZE * 5];
+ tmp2 = (INT32) dataptr[DCTSIZE * 3];
+ tmp3 = (INT32) dataptr[DCTSIZE * 1];
z1 = tmp0 + tmp3;
z2 = tmp1 + tmp2;
z3 = tmp0 + tmp2;
z4 = tmp1 + tmp3;
- z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */
-
- tmp0 = MULTIPLY(tmp0, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */
- tmp1 = MULTIPLY(tmp1, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */
- tmp2 = MULTIPLY(tmp2, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */
- tmp3 = MULTIPLY(tmp3, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */
- z1 = MULTIPLY(z1, - FIX_0_899976223); /* sqrt(2) * (c7-c3) */
- z2 = MULTIPLY(z2, - FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
- z3 = MULTIPLY(z3, - FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
- z4 = MULTIPLY(z4, - FIX_0_390180644); /* sqrt(2) * (c5-c3) */
-
+ z5 = MULTIPLY (z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */
+
+ tmp0 = MULTIPLY (tmp0, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */
+ tmp1 = MULTIPLY (tmp1, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */
+ tmp2 = MULTIPLY (tmp2, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */
+ tmp3 = MULTIPLY (tmp3, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */
+ z1 = MULTIPLY (z1, -FIX_0_899976223); /* sqrt(2) * (c7-c3) */
+ z2 = MULTIPLY (z2, -FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
+ z3 = MULTIPLY (z3, -FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
+ z4 = MULTIPLY (z4, -FIX_0_390180644); /* sqrt(2) * (c5-c3) */
+
z3 += z5;
z4 += z5;
-
+
tmp0 += z1 + z3;
tmp1 += z2 + z4;
tmp2 += z2 + z3;
@@ -373,23 +358,23 @@ gst_idct_int_idct (DCTBLOCK data)
/* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
- dataptr[DCTSIZE*0] = (DCTELEM) DESCALE(tmp10 + tmp3,
- CONST_BITS+PASS1_BITS+3);
- dataptr[DCTSIZE*7] = (DCTELEM) DESCALE(tmp10 - tmp3,
- CONST_BITS+PASS1_BITS+3);
- dataptr[DCTSIZE*1] = (DCTELEM) DESCALE(tmp11 + tmp2,
- CONST_BITS+PASS1_BITS+3);
- dataptr[DCTSIZE*6] = (DCTELEM) DESCALE(tmp11 - tmp2,
- CONST_BITS+PASS1_BITS+3);
- dataptr[DCTSIZE*2] = (DCTELEM) DESCALE(tmp12 + tmp1,
- CONST_BITS+PASS1_BITS+3);
- dataptr[DCTSIZE*5] = (DCTELEM) DESCALE(tmp12 - tmp1,
- CONST_BITS+PASS1_BITS+3);
- dataptr[DCTSIZE*3] = (DCTELEM) DESCALE(tmp13 + tmp0,
- CONST_BITS+PASS1_BITS+3);
- dataptr[DCTSIZE*4] = (DCTELEM) DESCALE(tmp13 - tmp0,
- CONST_BITS+PASS1_BITS+3);
-
+ dataptr[DCTSIZE * 0] = (DCTELEM) DESCALE (tmp10 + tmp3,
+ CONST_BITS + PASS1_BITS + 3);
+ dataptr[DCTSIZE * 7] = (DCTELEM) DESCALE (tmp10 - tmp3,
+ CONST_BITS + PASS1_BITS + 3);
+ dataptr[DCTSIZE * 1] = (DCTELEM) DESCALE (tmp11 + tmp2,
+ CONST_BITS + PASS1_BITS + 3);
+ dataptr[DCTSIZE * 6] = (DCTELEM) DESCALE (tmp11 - tmp2,
+ CONST_BITS + PASS1_BITS + 3);
+ dataptr[DCTSIZE * 2] = (DCTELEM) DESCALE (tmp12 + tmp1,
+ CONST_BITS + PASS1_BITS + 3);
+ dataptr[DCTSIZE * 5] = (DCTELEM) DESCALE (tmp12 - tmp1,
+ CONST_BITS + PASS1_BITS + 3);
+ dataptr[DCTSIZE * 3] = (DCTELEM) DESCALE (tmp13 + tmp0,
+ CONST_BITS + PASS1_BITS + 3);
+ dataptr[DCTSIZE * 4] = (DCTELEM) DESCALE (tmp13 - tmp0,
+ CONST_BITS + PASS1_BITS + 3);
+
dataptr++; /* advance pointer to next column */
}
}
diff --git a/gst-libs/gst/idct/mmx32idct.c b/gst-libs/gst/idct/mmx32idct.c
index 3b640976..cd191f0c 100644
--- a/gst-libs/gst/idct/mmx32idct.c
+++ b/gst-libs/gst/idct/mmx32idct.c
@@ -19,9 +19,8 @@
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
- */
-
-
+ */
+
/* MMX32 iDCT algorithm (IEEE-1180 compliant) :: idct_mmx32() */
/* */
/* MPEG2AVI */
@@ -102,8 +101,7 @@
/* */
/* liaor@umcc.ais.org http://members.tripod.com/~liaor */
/* */
-
-
+
/*;============================================================================= */
/*; */
/*; AP-922 http://developer.intel.com/vtune/cbts/strmsimd */
@@ -113,68 +111,67 @@
/*;============================================================================= */
/*
mword typedef qword
-qword ptr equ mword ptr */
-
+qword ptr equ mword ptr */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-
#include <mmx.h>
-
+
#define BITS_INV_ACC 4 /*; 4 or 5 for IEEE */
- /* 5 yields higher accuracy, but lessens dynamic range on the input matrix */
+ /* 5 yields higher accuracy, but lessens dynamic range on the input matrix */
#define SHIFT_INV_ROW (16 - BITS_INV_ACC)
-#define SHIFT_INV_COL (1 + BITS_INV_ACC +14 ) /* changed from Intel's val) */
+#define SHIFT_INV_COL (1 + BITS_INV_ACC +14 ) /* changed from Intel's val) */
/*#define SHIFT_INV_COL (1 + BITS_INV_ACC ) */
-
+
#define RND_INV_ROW (1 << (SHIFT_INV_ROW-1))
#define RND_INV_COL (1 << (SHIFT_INV_COL-1))
-#define RND_INV_CORR (RND_INV_COL - 1) /*; correction -1.0 and round */
+#define RND_INV_CORR (RND_INV_COL - 1) /*; correction -1.0 and round */
/*#define RND_INV_ROW (1024 * (6 - BITS_INV_ACC)) //; 1 << (SHIFT_INV_ROW-1) */
/*#define RND_INV_COL (16 * (BITS_INV_ACC - 3)) //; 1 << (SHIFT_INV_COL-1) */
-
-
+
/*.data */
/*Align 16 */
-const static long r_inv_row[2] = { RND_INV_ROW, RND_INV_ROW};
-const static long r_inv_col[2] = {RND_INV_COL, RND_INV_COL};
-const static long r_inv_corr[2] = {RND_INV_CORR, RND_INV_CORR };
-
+const static long r_inv_row[2] = { RND_INV_ROW, RND_INV_ROW };
+ const static long r_inv_col[2] = { RND_INV_COL, RND_INV_COL };
+ const static long r_inv_corr[2] = { RND_INV_CORR, RND_INV_CORR };
+
+
/*const static short r_inv_col[4] = */
/* {RND_INV_COL, RND_INV_COL, RND_INV_COL, RND_INV_COL}; */
/*const static short r_inv_corr[4] = */
/* {RND_INV_CORR, RND_INV_CORR, RND_INV_CORR, RND_INV_CORR}; */
-
+
/* constants for the forward DCT
/*#define BITS_FRW_ACC 3 //; 2 or 3 for accuracy */
/*#define SHIFT_FRW_COL BITS_FRW_ACC */
/*#define SHIFT_FRW_ROW (BITS_FRW_ACC + 17) */
/*#define RND_FRW_ROW (262144 * (BITS_FRW_ACC - 1)) //; 1 << (SHIFT_FRW_ROW-1) */
-
-const static __int64 one_corr = 0x0001000100010001;
-const static long r_frw_row[2] = {RND_FRW_ROW, RND_FRW_ROW };
-
+ const static __int64 one_corr = 0x0001000100010001;
+ const static long r_frw_row[2] = { RND_FRW_ROW, RND_FRW_ROW };
+
+
/*const static short tg_1_16[4] = {13036, 13036, 13036, 13036 }; //tg * (2<<16) + 0.5 */
/*const static short tg_2_16[4] = {27146, 27146, 27146, 27146 }; //tg * (2<<16) + 0.5 */
/*const static short tg_3_16[4] = {-21746, -21746, -21746, -21746 }; //tg * (2<<16) + 0.5 */
/*const static short cos_4_16[4] = {-19195, -19195, -19195, -19195 }; //cos * (2<<16) + 0.5 */
/*const static short ocos_4_16[4] = {23170, 23170, 23170, 23170 }; //cos * (2<<15) + 0.5 */
-
+
/*concatenated table, for forward DCT transformation */
-const static short tg_all_16[] = {
- 13036, 13036, 13036, 13036, /* tg * (2<<16) + 0.5 */
- 27146, 27146, 27146, 27146, /*tg * (2<<16) + 0.5 */
- -21746, -21746, -21746, -21746, /* tg * (2<<16) + 0.5 */
- -19195, -19195, -19195, -19195, /*cos * (2<<16) + 0.5 */
- 23170, 23170, 23170, 23170 }; /*cos * (2<<15) + 0.5 */
+const static short tg_all_16[] = { 13036, 13036, 13036, 13036, /* tg * (2<<16) + 0.5 */
+ 27146, 27146, 27146, 27146, /*tg * (2<<16) + 0.5 */
+ -21746, -21746, -21746, -21746, /* tg * (2<<16) + 0.5 */
+ -19195, -19195, -19195, -19195, /*cos * (2<<16) + 0.5 */
+ 23170, 23170, 23170, 23170
+}; /*cos * (2<<15) + 0.5 */
+
#define tg_1_16 (tg_all_16 + 0)
#define tg_2_16 (tg_all_16 + 8)
#define tg_3_16 (tg_all_16 + 16)
#define cos_4_16 (tg_all_16 + 24)
#define ocos_4_16 (tg_all_16 + 32)
-*/
+ */
/*
;=============================================================================
;
@@ -236,552 +233,456 @@ IF _MMX ; MMX code
;=============================================================================
/*; Table for rows 0,4 - constants are multiplied by cos_4_16 */
-const short tab_i_04[] = {
- 16384, 16384, 16384, -16384, /* ; movq-> w06 w04 w02 w00 */
- 21407, 8867, 8867, -21407, /* w07 w05 w03 w01 */
- 16384, -16384, 16384, 16384, /*; w14 w12 w10 w08 */
- -8867, 21407, -21407, -8867, /*; w15 w13 w11 w09 */
- 22725, 12873, 19266, -22725, /*; w22 w20 w18 w16 */
- 19266, 4520, -4520, -12873, /*; w23 w21 w19 w17 */
- 12873, 4520, 4520, 19266, /*; w30 w28 w26 w24 */
- -22725, 19266, -12873, -22725 };/*w31 w29 w27 w25 */
+const short tab_i_04[] = { 16384, 16384, 16384, -16384, /* ; movq-> w06 w04 w02 w00 */
+ 21407, 8867, 8867, -21407, /* w07 w05 w03 w01 */
+ 16384, -16384, 16384, 16384, /*; w14 w12 w10 w08 */
+ -8867, 21407, -21407, -8867, /*; w15 w13 w11 w09 */
+ 22725, 12873, 19266, -22725, /*; w22 w20 w18 w16 */
+ 19266, 4520, -4520, -12873, /*; w23 w21 w19 w17 */
+ 12873, 4520, 4520, 19266, /*; w30 w28 w26 w24 */
+ -22725, 19266, -12873, -22725
+}; /*w31 w29 w27 w25 */
+
/*; Table for rows 1,7 - constants are multiplied by cos_1_16 */
-const short tab_i_17[] = {
- 22725, 22725, 22725, -22725, /* ; movq-> w06 w04 w02 w00 */
- 29692, 12299, 12299, -29692, /* ; w07 w05 w03 w01 */
- 22725, -22725, 22725, 22725, /*; w14 w12 w10 w08 */
- -12299, 29692, -29692, -12299, /*; w15 w13 w11 w09 */
- 31521, 17855, 26722, -31521, /*; w22 w20 w18 w16 */
- 26722, 6270, -6270, -17855, /*; w23 w21 w19 w17 */
- 17855, 6270, 6270, 26722, /*; w30 w28 w26 w24 */
- -31521, 26722, -17855, -31521}; /* w31 w29 w27 w25 */
+const short tab_i_17[] = { 22725, 22725, 22725, -22725, /* ; movq-> w06 w04 w02 w00 */
+ 29692, 12299, 12299, -29692, /* ; w07 w05 w03 w01 */
+ 22725, -22725, 22725, 22725, /*; w14 w12 w10 w08 */
+ -12299, 29692, -29692, -12299, /*; w15 w13 w11 w09 */
+ 31521, 17855, 26722, -31521, /*; w22 w20 w18 w16 */
+ 26722, 6270, -6270, -17855, /*; w23 w21 w19 w17 */
+ 17855, 6270, 6270, 26722, /*; w30 w28 w26 w24 */
+ -31521, 26722, -17855, -31521
+}; /* w31 w29 w27 w25 */
+
/*; Table for rows 2,6 - constants are multiplied by cos_2_16 */
-const short tab_i_26[] = {
- 21407, 21407, 21407, -21407, /* ; movq-> w06 w04 w02 w00 */
- 27969, 11585, 11585, -27969, /* ; w07 w05 w03 w01 */
- 21407, -21407, 21407, 21407, /* ; w14 w12 w10 w08 */
- -11585, 27969, -27969, -11585, /* ;w15 w13 w11 w09 */
- 29692, 16819, 25172, -29692, /* ;w22 w20 w18 w16 */
- 25172, 5906, -5906, -16819, /* ;w23 w21 w19 w17 */
- 16819, 5906, 5906, 25172, /* ;w30 w28 w26 w24 */
- -29692, 25172, -16819, -29692}; /* ;w31 w29 w27 w25 */
-
-
+const short tab_i_26[] = { 21407, 21407, 21407, -21407, /* ; movq-> w06 w04 w02 w00 */
+ 27969, 11585, 11585, -27969, /* ; w07 w05 w03 w01 */
+ 21407, -21407, 21407, 21407, /* ; w14 w12 w10 w08 */
+ -11585, 27969, -27969, -11585, /* ;w15 w13 w11 w09 */
+ 29692, 16819, 25172, -29692, /* ;w22 w20 w18 w16 */
+ 25172, 5906, -5906, -16819, /* ;w23 w21 w19 w17 */
+ 16819, 5906, 5906, 25172, /* ;w30 w28 w26 w24 */
+ -29692, 25172, -16819, -29692
+}; /* ;w31 w29 w27 w25 */
+
+
/*; Table for rows 3,5 - constants are multiplied by cos_3_16 */
-const short tab_i_35[] = {
- 19266, 19266, 19266, -19266, /*; movq-> w06 w04 w02 w00 */
- 25172, 10426, 10426, -25172, /*; w07 w05 w03 w01 */
- 19266, -19266, 19266, 19266, /*; w14 w12 w10 w08 */
- -10426, 25172, -25172, -10426, /*; w15 w13 w11 w09 */
- 26722, 15137, 22654, -26722, /*; w22 w20 w18 w16 */
- 22654, 5315, -5315, -15137, /*; w23 w21 w19 w17 */
- 15137, 5315, 5315, 22654, /*; w30 w28 w26 w24 */
- -26722, 22654, -15137, -26722}; /*; w31 w29 w27 w25 */
-*/
-
+const short tab_i_35[] = { 19266, 19266, 19266, -19266, /*; movq-> w06 w04 w02 w00 */
+ 25172, 10426, 10426, -25172, /*; w07 w05 w03 w01 */
+ 19266, -19266, 19266, 19266, /*; w14 w12 w10 w08 */
+ -10426, 25172, -25172, -10426, /*; w15 w13 w11 w09 */
+ 26722, 15137, 22654, -26722, /*; w22 w20 w18 w16 */
+ 22654, 5315, -5315, -15137, /*; w23 w21 w19 w17 */
+ 15137, 5315, 5315, 22654, /*; w30 w28 w26 w24 */
+ -26722, 22654, -15137, -26722
+}; /*; w31 w29 w27 w25 */
+
+*/
/* CONCATENATED TABLE, rows 0,1,2,3,4,5,6,7 (in order ) */
/* */
/* In our implementation, however, we only use row0 ! */
/* */
-static const short tab_i_01234567[] = {
- /*row0, this row is required */
- 16384, 16384, 16384, -16384, /* ; movq-> w06 w04 w02 w00 */
- 21407, 8867, 8867, -21407, /* w07 w05 w03 w01 */
- 16384, -16384, 16384, 16384, /*; w14 w12 w10 w08 */
- -8867, 21407, -21407, -8867, /*; w15 w13 w11 w09 */
- 22725, 12873, 19266, -22725, /*; w22 w20 w18 w16 */
- 19266, 4520, -4520, -12873, /*; w23 w21 w19 w17 */
- 12873, 4520, 4520, 19266, /*; w30 w28 w26 w24 */
- -22725, 19266, -12873, -22725, /*w31 w29 w27 w25 */
-
- /* the rest of these rows (1-7), aren't used ! */
-
- /*row1 */
- 22725, 22725, 22725, -22725, /* ; movq-> w06 w04 w02 w00 */
- 29692, 12299, 12299, -29692, /* ; w07 w05 w03 w01 */
- 22725, -22725, 22725, 22725, /*; w14 w12 w10 w08 */
- -12299, 29692, -29692, -12299, /*; w15 w13 w11 w09 */
- 31521, 17855, 26722, -31521, /*; w22 w20 w18 w16 */
- 26722, 6270, -6270, -17855, /*; w23 w21 w19 w17 */
- 17855, 6270, 6270, 26722, /*; w30 w28 w26 w24 */
- -31521, 26722, -17855, -31521, /* w31 w29 w27 w25 */
-
- /*row2 */
- 21407, 21407, 21407, -21407, /* ; movq-> w06 w04 w02 w00 */
- 27969, 11585, 11585, -27969, /* ; w07 w05 w03 w01 */
- 21407, -21407, 21407, 21407, /* ; w14 w12 w10 w08 */
- -11585, 27969, -27969, -11585, /* ;w15 w13 w11 w09 */
- 29692, 16819, 25172, -29692, /* ;w22 w20 w18 w16 */
- 25172, 5906, -5906, -16819, /* ;w23 w21 w19 w17 */
- 16819, 5906, 5906, 25172, /* ;w30 w28 w26 w24 */
- -29692, 25172, -16819, -29692, /* ;w31 w29 w27 w25 */
-
- /*row3 */
- 19266, 19266, 19266, -19266, /*; movq-> w06 w04 w02 w00 */
- 25172, 10426, 10426, -25172, /*; w07 w05 w03 w01 */
- 19266, -19266, 19266, 19266, /*; w14 w12 w10 w08 */
- -10426, 25172, -25172, -10426, /*; w15 w13 w11 w09 */
- 26722, 15137, 22654, -26722, /*; w22 w20 w18 w16 */
- 22654, 5315, -5315, -15137, /*; w23 w21 w19 w17 */
- 15137, 5315, 5315, 22654, /*; w30 w28 w26 w24 */
- -26722, 22654, -15137, -26722, /*; w31 w29 w27 w25 */
-
- /*row4 */
- 16384, 16384, 16384, -16384, /* ; movq-> w06 w04 w02 w00 */
- 21407, 8867, 8867, -21407, /* w07 w05 w03 w01 */
- 16384, -16384, 16384, 16384, /*; w14 w12 w10 w08 */
- -8867, 21407, -21407, -8867, /*; w15 w13 w11 w09 */
- 22725, 12873, 19266, -22725, /*; w22 w20 w18 w16 */
- 19266, 4520, -4520, -12873, /*; w23 w21 w19 w17 */
- 12873, 4520, 4520, 19266, /*; w30 w28 w26 w24 */
- -22725, 19266, -12873, -22725, /*w31 w29 w27 w25 */
-
- /*row5 */
- 19266, 19266, 19266, -19266, /*; movq-> w06 w04 w02 w00 */
- 25172, 10426, 10426, -25172, /*; w07 w05 w03 w01 */
- 19266, -19266, 19266, 19266, /*; w14 w12 w10 w08 */
- -10426, 25172, -25172, -10426, /*; w15 w13 w11 w09 */
- 26722, 15137, 22654, -26722, /*; w22 w20 w18 w16 */
- 22654, 5315, -5315, -15137, /*; w23 w21 w19 w17 */
- 15137, 5315, 5315, 22654, /*; w30 w28 w26 w24 */
- -26722, 22654, -15137, -26722, /*; w31 w29 w27 w25 */
-
- /*row6 */
- 21407, 21407, 21407, -21407, /* ; movq-> w06 w04 w02 w00 */
- 27969, 11585, 11585, -27969, /* ; w07 w05 w03 w01 */
- 21407, -21407, 21407, 21407, /* ; w14 w12 w10 w08 */
- -11585, 27969, -27969, -11585, /* ;w15 w13 w11 w09 */
- 29692, 16819, 25172, -29692, /* ;w22 w20 w18 w16 */
- 25172, 5906, -5906, -16819, /* ;w23 w21 w19 w17 */
- 16819, 5906, 5906, 25172, /* ;w30 w28 w26 w24 */
- -29692, 25172, -16819, -29692, /* ;w31 w29 w27 w25 */
-
- /*row7 */
- 22725, 22725, 22725, -22725, /* ; movq-> w06 w04 w02 w00 */
- 29692, 12299, 12299, -29692, /* ; w07 w05 w03 w01 */
- 22725, -22725, 22725, 22725, /*; w14 w12 w10 w08 */
- -12299, 29692, -29692, -12299, /*; w15 w13 w11 w09 */
- 31521, 17855, 26722, -31521, /*; w22 w20 w18 w16 */
- 26722, 6270, -6270, -17855, /*; w23 w21 w19 w17 */
- 17855, 6270, 6270, 26722, /*; w30 w28 w26 w24 */
- -31521, 26722, -17855, -31521}; /* w31 w29 w27 w25 */
-
-
-#define INP eax /* pointer to (short *blk) */
-#define OUT ecx /* pointer to output (temporary store space qwTemp[]) */
-#define TABLE ebx /* pointer to tab_i_01234567[] */
+static const short tab_i_01234567[] = {
+ /*row0, this row is required */
+ 16384, 16384, 16384, -16384, /* ; movq-> w06 w04 w02 w00 */
+ 21407, 8867, 8867, -21407, /* w07 w05 w03 w01 */
+ 16384, -16384, 16384, 16384, /*; w14 w12 w10 w08 */
+ -8867, 21407, -21407, -8867, /*; w15 w13 w11 w09 */
+ 22725, 12873, 19266, -22725, /*; w22 w20 w18 w16 */
+ 19266, 4520, -4520, -12873, /*; w23 w21 w19 w17 */
+ 12873, 4520, 4520, 19266, /*; w30 w28 w26 w24 */
+ -22725, 19266, -12873, -22725, /*w31 w29 w27 w25 */
+
+ /* the rest of these rows (1-7), aren't used ! */
+
+ /*row1 */
+ 22725, 22725, 22725, -22725, /* ; movq-> w06 w04 w02 w00 */
+ 29692, 12299, 12299, -29692, /* ; w07 w05 w03 w01 */
+ 22725, -22725, 22725, 22725, /*; w14 w12 w10 w08 */
+ -12299, 29692, -29692, -12299, /*; w15 w13 w11 w09 */
+ 31521, 17855, 26722, -31521, /*; w22 w20 w18 w16 */
+ 26722, 6270, -6270, -17855, /*; w23 w21 w19 w17 */
+ 17855, 6270, 6270, 26722, /*; w30 w28 w26 w24 */
+ -31521, 26722, -17855, -31521, /* w31 w29 w27 w25 */
+
+ /*row2 */
+ 21407, 21407, 21407, -21407, /* ; movq-> w06 w04 w02 w00 */
+ 27969, 11585, 11585, -27969, /* ; w07 w05 w03 w01 */
+ 21407, -21407, 21407, 21407, /* ; w14 w12 w10 w08 */
+ -11585, 27969, -27969, -11585, /* ;w15 w13 w11 w09 */
+ 29692, 16819, 25172, -29692, /* ;w22 w20 w18 w16 */
+ 25172, 5906, -5906, -16819, /* ;w23 w21 w19 w17 */
+ 16819, 5906, 5906, 25172, /* ;w30 w28 w26 w24 */
+ -29692, 25172, -16819, -29692, /* ;w31 w29 w27 w25 */
+
+ /*row3 */
+ 19266, 19266, 19266, -19266, /*; movq-> w06 w04 w02 w00 */
+ 25172, 10426, 10426, -25172, /*; w07 w05 w03 w01 */
+ 19266, -19266, 19266, 19266, /*; w14 w12 w10 w08 */
+ -10426, 25172, -25172, -10426, /*; w15 w13 w11 w09 */
+ 26722, 15137, 22654, -26722, /*; w22 w20 w18 w16 */
+ 22654, 5315, -5315, -15137, /*; w23 w21 w19 w17 */
+ 15137, 5315, 5315, 22654, /*; w30 w28 w26 w24 */
+ -26722, 22654, -15137, -26722, /*; w31 w29 w27 w25 */
+
+ /*row4 */
+ 16384, 16384, 16384, -16384, /* ; movq-> w06 w04 w02 w00 */
+ 21407, 8867, 8867, -21407, /* w07 w05 w03 w01 */
+ 16384, -16384, 16384, 16384, /*; w14 w12 w10 w08 */
+ -8867, 21407, -21407, -8867, /*; w15 w13 w11 w09 */
+ 22725, 12873, 19266, -22725, /*; w22 w20 w18 w16 */
+ 19266, 4520, -4520, -12873, /*; w23 w21 w19 w17 */
+ 12873, 4520, 4520, 19266, /*; w30 w28 w26 w24 */
+ -22725, 19266, -12873, -22725, /*w31 w29 w27 w25 */
+
+ /*row5 */
+ 19266, 19266, 19266, -19266, /*; movq-> w06 w04 w02 w00 */
+ 25172, 10426, 10426, -25172, /*; w07 w05 w03 w01 */
+ 19266, -19266, 19266, 19266, /*; w14 w12 w10 w08 */
+ -10426, 25172, -25172, -10426, /*; w15 w13 w11 w09 */
+ 26722, 15137, 22654, -26722, /*; w22 w20 w18 w16 */
+ 22654, 5315, -5315, -15137, /*; w23 w21 w19 w17 */
+ 15137, 5315, 5315, 22654, /*; w30 w28 w26 w24 */
+ -26722, 22654, -15137, -26722, /*; w31 w29 w27 w25 */
+
+ /*row6 */
+ 21407, 21407, 21407, -21407, /* ; movq-> w06 w04 w02 w00 */
+ 27969, 11585, 11585, -27969, /* ; w07 w05 w03 w01 */
+ 21407, -21407, 21407, 21407, /* ; w14 w12 w10 w08 */
+ -11585, 27969, -27969, -11585, /* ;w15 w13 w11 w09 */
+ 29692, 16819, 25172, -29692, /* ;w22 w20 w18 w16 */
+ 25172, 5906, -5906, -16819, /* ;w23 w21 w19 w17 */
+ 16819, 5906, 5906, 25172, /* ;w30 w28 w26 w24 */
+ -29692, 25172, -16819, -29692, /* ;w31 w29 w27 w25 */
+
+ /*row7 */
+ 22725, 22725, 22725, -22725, /* ; movq-> w06 w04 w02 w00 */
+ 29692, 12299, 12299, -29692, /* ; w07 w05 w03 w01 */
+ 22725, -22725, 22725, 22725, /*; w14 w12 w10 w08 */
+ -12299, 29692, -29692, -12299, /*; w15 w13 w11 w09 */
+ 31521, 17855, 26722, -31521, /*; w22 w20 w18 w16 */
+ 26722, 6270, -6270, -17855, /*; w23 w21 w19 w17 */
+ 17855, 6270, 6270, 26722, /*; w30 w28 w26 w24 */
+ -31521, 26722, -17855, -31521
+}; /* w31 w29 w27 w25 */
+
+
+#define INP eax /* pointer to (short *blk) */
+#define OUT ecx /* pointer to output (temporary store space qwTemp[]) */
+#define TABLE ebx /* pointer to tab_i_01234567[] */
#define round_inv_row edx
#define round_inv_col edx
-
-#define ROW_STRIDE 8 /* for 8x8 matrix transposer */
-
+
+#define ROW_STRIDE 8 /* for 8x8 matrix transposer */
+
/* private variables and functions */
-
+
/*temporary storage space, 8x8 of shorts */
-
-__inline static void idct_mmx32_rows( short *blk ); /* transform rows */
-__inline static void idct_mmx32_cols( short *blk ); /* transform "columns" */
+ __inline static void idct_mmx32_rows (short *blk); /* transform rows */
+__inline static void idct_mmx32_cols (short *blk); /* transform "columns" */
+
/* the "column" transform actually transforms rows, it is */
/* identical to the row-transform except for the ROUNDING */
/* and SHIFTING coefficients. */
-
-
-static void
-idct_mmx32_rows( short *blk ) /* transform all 8 rows of 8x8 iDCT block */
-{
- int x;
- short qwTemp[64];
- short *out = &qwTemp[0];
- short *inptr = blk;
- /* this subroutine performs two operations */
- /* 1) iDCT row transform */
- /* for( i = 0; i < 8; ++ i) */
- /* DCT_8_INV_ROW_1( blk[i*8], qwTemp[i] ); */
- /* */
- /* 2) transpose the matrix (which was stored in qwTemp[]) */
- /* qwTemp[] -> [8x8 matrix transpose] -> blk[] */
-
- for (x=0; x<8; x++) { /* transform one row per iteration */
- movq_m2r(*(inptr), mm0); /* 0 ; x3 x2 x1 x0 */
-
- movq_m2r(*(inptr+4), mm1); /* 1 ; x7 x6 x5 x4 */
- movq_r2r(mm0, mm2); /* 2 ; x3 x2 x1 x0 */
-
- movq_m2r(*(tab_i_01234567), mm3); /* 3 ; w06 w04 w02 w00 */
- punpcklwd_r2r(mm1, mm0); /* x5 x1 x4 x0 */
-
- /* ---------- */
- movq_r2r(mm0, mm5); /* 5 ; x5 x1 x4 x0 */
- punpckldq_r2r(mm0, mm0); /* x4 x0 x4 x0 */
-
- movq_m2r(*(tab_i_01234567+4), mm4); /* 4 ; w07 w05 w03 w01 */
- punpckhwd_r2r(mm1, mm2); /* 1 ; x7 x3 x6 x2 */
-
- pmaddwd_r2r(mm0, mm3); /* x4*w06+x0*w04 x4*w02+x0*w00 */
- movq_r2r(mm2, mm6); /* 6 ; x7 x3 x6 x2 */
-
- movq_m2r(*(tab_i_01234567+16), mm1);/* 1 ; w22 w20 w18 w16 */
- punpckldq_r2r(mm2, mm2); /* x6 x2 x6 x2 */
-
- pmaddwd_r2r(mm2, mm4); /* x6*w07+x2*w05 x6*w03+x2*w01 */
- punpckhdq_r2r(mm5, mm5); /* x5 x1 x5 x1 */
-
- pmaddwd_m2r(*(tab_i_01234567+8), mm0);/* x4*w14+x0*w12 x4*w10+x0*w08 */
- punpckhdq_r2r(mm6, mm6); /* x7 x3 x7 x3 */
-
- movq_m2r(*(tab_i_01234567+20), mm7);/* 7 ; w23 w21 w19 w17 */
- pmaddwd_r2r(mm5, mm1); /* x5*w22+x1*w20 x5*w18+x1*w16 */
-
- paddd_m2r(*(r_inv_row), mm3);/* +rounder */
- pmaddwd_r2r(mm6, mm7); /* x7*w23+x3*w21 x7*w19+x3*w17 */
-
- pmaddwd_m2r(*(tab_i_01234567+12), mm2);/* x6*w15+x2*w13 x6*w11+x2*w09 */
- paddd_r2r(mm4, mm3); /* 4 ; a1=sum(even1) a0=sum(even0) */
-
- pmaddwd_m2r(*(tab_i_01234567+24), mm5);/* x5*w30+x1*w28 x5*w26+x1*w24 */
- movq_r2r(mm3, mm4); /* 4 ; a1 a0 */
-
- pmaddwd_m2r(*(tab_i_01234567+28), mm6);/* x7*w31+x3*w29 x7*w27+x3*w25 */
- paddd_r2r(mm7, mm1); /* 7 ; b1=sum(odd1) b0=sum(odd0) */
-
- paddd_m2r(*(r_inv_row), mm0);/* +rounder */
- psubd_r2r(mm1, mm3); /* a1-b1 a0-b0 */
-
- psrad_i2r(SHIFT_INV_ROW, mm3); /* y6=a1-b1 y7=a0-b0 */
- paddd_r2r(mm4, mm1); /* 4 ; a1+b1 a0+b0 */
-
- paddd_r2r(mm2, mm0); /* 2 ; a3=sum(even3) a2=sum(even2) */
- psrad_i2r(SHIFT_INV_ROW, mm1); /* y1=a1+b1 y0=a0+b0 */
-
- paddd_r2r(mm6, mm5); /* 6 ; b3=sum(odd3) b2=sum(odd2) */
- movq_r2r(mm0, mm4); /* 4 ; a3 a2 */
-
- paddd_r2r(mm5, mm0); /* a3+b3 a2+b2 */
- psubd_r2r(mm5, mm4); /* 5 ; a3-b3 a2-b2 */
-
- psrad_i2r(SHIFT_INV_ROW, mm4); /* y4=a3-b3 y5=a2-b2 */
- psrad_i2r(SHIFT_INV_ROW, mm0); /* y3=a3+b3 y2=a2+b2 */
-
- packssdw_r2r(mm3, mm4); /* 3 ; y6 y7 y4 y5 */
-
- packssdw_r2r(mm0, mm1); /* 0 ; y3 y2 y1 y0 */
- movq_r2r(mm4, mm7); /* 7 ; y6 y7 y4 y5 */
-
- psrld_i2r(16, mm4); /* 0 y6 0 y4 */
-
- movq_r2m(mm1, *(out)); /* 1 ; save y3 y2 y1 y0 */
- pslld_i2r(16, mm7); /* y7 0 y5 0 */
-
- por_r2r(mm4, mm7); /* 4 ; y7 y6 y5 y4 */
-
- /* begin processing row 1 */
- movq_r2m(mm7, *(out+4)); /* 7 ; save y7 y6 y5 y4 */
-
- inptr += 8;
- out += 8;
- }
-
-
- /* done with the iDCT row-transformation */
-
- /* now we have to transpose the output 8x8 matrix */
- /* 8x8 (OUT) -> 8x8't' (IN) */
- /* the transposition is implemented as 4 sub-operations. */
- /* 1) transpose upper-left quad */
- /* 2) transpose lower-right quad */
- /* 3) transpose lower-left quad */
- /* 4) transpose upper-right quad */
-
-
- /* mm0 = 1st row [ A B C D ] row1 */
- /* mm1 = 2nd row [ E F G H ] 2 */
- /* mm2 = 3rd row [ I J K L ] 3 */
- /* mm3 = 4th row [ M N O P ] 4 */
-
- /* 1) transpose upper-left quad */
- out = &qwTemp[0];
-
- movq_m2r(*(out + ROW_STRIDE * 0), mm0);
-
- movq_m2r(*(out + ROW_STRIDE * 1), mm1);
- movq_r2r(mm0, mm4); /* mm4 = copy of row1[A B C D] */
-
- movq_m2r(*(out + ROW_STRIDE * 2), mm2);
- punpcklwd_r2r(mm1, mm0); /* mm0 = [ 0 4 1 5] */
-
- movq_m2r(*(out + ROW_STRIDE * 3), mm3);
- punpckhwd_r2r(mm1, mm4); /* mm4 = [ 2 6 3 7] */
-
- movq_r2r(mm2, mm6);
- punpcklwd_r2r(mm3, mm2); /* mm2 = [ 8 12 9 13] */
-
- punpckhwd_r2r(mm3, mm6); /* mm6 = 10 14 11 15] */
- movq_r2r(mm0, mm1); /* mm1 = [ 0 4 1 5] */
-
- inptr = blk;
-
- punpckldq_r2r(mm2, mm0); /* final result mm0 = row1 [0 4 8 12] */
-
- movq_r2r(mm4, mm3); /* mm3 = [ 2 6 3 7] */
- punpckhdq_r2r(mm2, mm1); /* mm1 = final result mm1 = row2 [1 5 9 13] */
-
- movq_r2m(mm0, *(inptr + ROW_STRIDE * 0)); /* store row 1 */
- punpckldq_r2r(mm6, mm4); /* final result mm4 = row3 [2 6 10 14] */
-
+ static void
+idct_mmx32_rows (short *blk)
+{ /* transform all 8 rows of 8x8 iDCT block */
+ int x;
+ short qwTemp[64];
+ short *out = &qwTemp[0];
+ short *inptr = blk;
+
+
+ /* this subroutine performs two operations */
+ /* 1) iDCT row transform */
+ /* for( i = 0; i < 8; ++ i) */
+ /* DCT_8_INV_ROW_1( blk[i*8], qwTemp[i] ); */
+ /* */
+ /* 2) transpose the matrix (which was stored in qwTemp[]) */
+ /* qwTemp[] -> [8x8 matrix transpose] -> blk[] */
+ for (x = 0; x < 8; x++) { /* transform one row per iteration */
+ movq_m2r (*(inptr), mm0); /* 0 ; x3 x2 x1 x0 */
+ movq_m2r (*(inptr + 4), mm1); /* 1 ; x7 x6 x5 x4 */
+ movq_r2r (mm0, mm2); /* 2 ; x3 x2 x1 x0 */
+ movq_m2r (*(tab_i_01234567), mm3); /* 3 ; w06 w04 w02 w00 */
+ punpcklwd_r2r (mm1, mm0); /* x5 x1 x4 x0 */
+
+ /* ---------- */
+ movq_r2r (mm0, mm5); /* 5 ; x5 x1 x4 x0 */
+ punpckldq_r2r (mm0, mm0); /* x4 x0 x4 x0 */
+ movq_m2r (*(tab_i_01234567 + 4), mm4); /* 4 ; w07 w05 w03 w01 */
+ punpckhwd_r2r (mm1, mm2); /* 1 ; x7 x3 x6 x2 */
+ pmaddwd_r2r (mm0, mm3); /* x4*w06+x0*w04 x4*w02+x0*w00 */
+ movq_r2r (mm2, mm6); /* 6 ; x7 x3 x6 x2 */
+ movq_m2r (*(tab_i_01234567 + 16), mm1); /* 1 ; w22 w20 w18 w16 */
+ punpckldq_r2r (mm2, mm2); /* x6 x2 x6 x2 */
+ pmaddwd_r2r (mm2, mm4); /* x6*w07+x2*w05 x6*w03+x2*w01 */
+ punpckhdq_r2r (mm5, mm5); /* x5 x1 x5 x1 */
+ pmaddwd_m2r (*(tab_i_01234567 + 8), mm0); /* x4*w14+x0*w12 x4*w10+x0*w08 */
+ punpckhdq_r2r (mm6, mm6); /* x7 x3 x7 x3 */
+ movq_m2r (*(tab_i_01234567 + 20), mm7); /* 7 ; w23 w21 w19 w17 */
+ pmaddwd_r2r (mm5, mm1); /* x5*w22+x1*w20 x5*w18+x1*w16 */
+ paddd_m2r (*(r_inv_row), mm3); /* +rounder */
+ pmaddwd_r2r (mm6, mm7); /* x7*w23+x3*w21 x7*w19+x3*w17 */
+ pmaddwd_m2r (*(tab_i_01234567 + 12), mm2); /* x6*w15+x2*w13 x6*w11+x2*w09 */
+ paddd_r2r (mm4, mm3); /* 4 ; a1=sum(even1) a0=sum(even0) */
+ pmaddwd_m2r (*(tab_i_01234567 + 24), mm5); /* x5*w30+x1*w28 x5*w26+x1*w24 */
+ movq_r2r (mm3, mm4); /* 4 ; a1 a0 */
+ pmaddwd_m2r (*(tab_i_01234567 + 28), mm6); /* x7*w31+x3*w29 x7*w27+x3*w25 */
+ paddd_r2r (mm7, mm1); /* 7 ; b1=sum(odd1) b0=sum(odd0) */
+ paddd_m2r (*(r_inv_row), mm0); /* +rounder */
+ psubd_r2r (mm1, mm3); /* a1-b1 a0-b0 */
+ psrad_i2r (SHIFT_INV_ROW, mm3); /* y6=a1-b1 y7=a0-b0 */
+ paddd_r2r (mm4, mm1); /* 4 ; a1+b1 a0+b0 */
+ paddd_r2r (mm2, mm0); /* 2 ; a3=sum(even3) a2=sum(even2) */
+ psrad_i2r (SHIFT_INV_ROW, mm1); /* y1=a1+b1 y0=a0+b0 */
+ paddd_r2r (mm6, mm5); /* 6 ; b3=sum(odd3) b2=sum(odd2) */
+ movq_r2r (mm0, mm4); /* 4 ; a3 a2 */
+ paddd_r2r (mm5, mm0); /* a3+b3 a2+b2 */
+ psubd_r2r (mm5, mm4); /* 5 ; a3-b3 a2-b2 */
+ psrad_i2r (SHIFT_INV_ROW, mm4); /* y4=a3-b3 y5=a2-b2 */
+ psrad_i2r (SHIFT_INV_ROW, mm0); /* y3=a3+b3 y2=a2+b2 */
+ packssdw_r2r (mm3, mm4); /* 3 ; y6 y7 y4 y5 */
+ packssdw_r2r (mm0, mm1); /* 0 ; y3 y2 y1 y0 */
+ movq_r2r (mm4, mm7); /* 7 ; y6 y7 y4 y5 */
+ psrld_i2r (16, mm4); /* 0 y6 0 y4 */
+ movq_r2m (mm1, *(out)); /* 1 ; save y3 y2 y1 y0 */
+ pslld_i2r (16, mm7); /* y7 0 y5 0 */
+ por_r2r (mm4, mm7); /* 4 ; y7 y6 y5 y4 */
+
+ /* begin processing row 1 */
+ movq_r2m (mm7, *(out + 4)); /* 7 ; save y7 y6 y5 y4 */
+ inptr += 8;
+ out += 8;
+ }
+
+ /* done with the iDCT row-transformation */
+
+ /* now we have to transpose the output 8x8 matrix */
+ /* 8x8 (OUT) -> 8x8't' (IN) */
+ /* the transposition is implemented as 4 sub-operations. */
+ /* 1) transpose upper-left quad */
+ /* 2) transpose lower-right quad */
+ /* 3) transpose lower-left quad */
+ /* 4) transpose upper-right quad */
+
+ /* mm0 = 1st row [ A B C D ] row1 */
+ /* mm1 = 2nd row [ E F G H ] 2 */
+ /* mm2 = 3rd row [ I J K L ] 3 */
+ /* mm3 = 4th row [ M N O P ] 4 */
+
+ /* 1) transpose upper-left quad */
+ out = &qwTemp[0];
+ movq_m2r (*(out + ROW_STRIDE * 0), mm0);
+ movq_m2r (*(out + ROW_STRIDE * 1), mm1);
+ movq_r2r (mm0, mm4); /* mm4 = copy of row1[A B C D] */
+ movq_m2r (*(out + ROW_STRIDE * 2), mm2);
+ punpcklwd_r2r (mm1, mm0); /* mm0 = [ 0 4 1 5] */
+ movq_m2r (*(out + ROW_STRIDE * 3), mm3);
+ punpckhwd_r2r (mm1, mm4); /* mm4 = [ 2 6 3 7] */
+ movq_r2r (mm2, mm6);
+ punpcklwd_r2r (mm3, mm2); /* mm2 = [ 8 12 9 13] */
+ punpckhwd_r2r (mm3, mm6); /* mm6 = 10 14 11 15] */
+ movq_r2r (mm0, mm1); /* mm1 = [ 0 4 1 5] */
+ inptr = blk;
+ punpckldq_r2r (mm2, mm0); /* final result mm0 = row1 [0 4 8 12] */
+ movq_r2r (mm4, mm3); /* mm3 = [ 2 6 3 7] */
+ punpckhdq_r2r (mm2, mm1); /* mm1 = final result mm1 = row2 [1 5 9 13] */
+ movq_r2m (mm0, *(inptr + ROW_STRIDE * 0)); /* store row 1 */
+ punpckldq_r2r (mm6, mm4); /* final result mm4 = row3 [2 6 10 14] */
+
/* begin reading next quadrant (lower-right) */
- movq_m2r(*(out + ROW_STRIDE*4 + 4), mm0);
- punpckhdq_r2r(mm6, mm3); /* final result mm3 = row4 [3 7 11 15] */
-
- movq_r2m(mm4, *(inptr + ROW_STRIDE * 2)); /* store row 3 */
- movq_r2r(mm0, mm4); /* mm4 = copy of row1[A B C D] */
-
- movq_r2m(mm1, *(inptr + ROW_STRIDE * 1)); /* store row 2 */
-
- movq_m2r(*(out + ROW_STRIDE*5 + 4), mm1);
-
- movq_r2m(mm3, *(inptr + ROW_STRIDE * 3)); /* store row 4 */
- punpcklwd_r2r(mm1, mm0); /* mm0 = [ 0 4 1 5] */
-
- /* 2) transpose lower-right quadrant */
-
+ movq_m2r (*(out + ROW_STRIDE * 4 + 4), mm0);
+ punpckhdq_r2r (mm6, mm3); /* final result mm3 = row4 [3 7 11 15] */
+ movq_r2m (mm4, *(inptr + ROW_STRIDE * 2)); /* store row 3 */
+ movq_r2r (mm0, mm4); /* mm4 = copy of row1[A B C D] */
+ movq_r2m (mm1, *(inptr + ROW_STRIDE * 1)); /* store row 2 */
+ movq_m2r (*(out + ROW_STRIDE * 5 + 4), mm1);
+ movq_r2m (mm3, *(inptr + ROW_STRIDE * 3)); /* store row 4 */
+ punpcklwd_r2r (mm1, mm0); /* mm0 = [ 0 4 1 5] */
+
+ /* 2) transpose lower-right quadrant */
+
/* movq mm0, qword ptr [OUT + ROW_STRIDE*4 + 8] */
-
+
/* movq mm1, qword ptr [OUT + ROW_STRIDE*5 + 8] */
/* movq mm4, mm0; // mm4 = copy of row1[A B C D] */
-
- movq_m2r(*(out + ROW_STRIDE*6 + 4), mm2);
-/* punpcklwd mm0, mm1; // mm0 = [ 0 4 1 5] */
- punpckhwd_r2r(mm1, mm4); /* mm4 = [ 2 6 3 7] */
-
- movq_m2r(*(out + ROW_STRIDE*7 + 4), mm3);
- movq_r2r(mm2, mm6);
-
- punpcklwd_r2r(mm3, mm2); /* mm2 = [ 8 12 9 13] */
- movq_r2r(mm0, mm1); /* mm1 = [ 0 4 1 5] */
-
- punpckhwd_r2r(mm3, mm6); /* mm6 = 10 14 11 15] */
- movq_r2r(mm4, mm3); /* mm3 = [ 2 6 3 7] */
-
- punpckldq_r2r(mm2, mm0); /* final result mm0 = row1 [0 4 8 12] */
-
- punpckhdq_r2r(mm2, mm1); /* mm1 = final result mm1 = row2 [1 5 9 13] */
- ; /* slot */
-
- movq_r2m(mm0, *(inptr + ROW_STRIDE*4 + 4)); /* store row 1 */
- punpckldq_r2r(mm6, mm4); /* final result mm4 = row3 [2 6 10 14] */
-
- movq_m2r(*(out + ROW_STRIDE * 4 ), mm0);
- punpckhdq_r2r(mm6, mm3); /* final result mm3 = row4 [3 7 11 15] */
+ movq_m2r (*(out + ROW_STRIDE * 6 + 4), mm2);
- movq_r2m(mm4, *(inptr + ROW_STRIDE*6 + 4)); /* store row 3 */
- movq_r2r(mm0, mm4); /* mm4 = copy of row1[A B C D] */
-
- movq_r2m(mm1, *(inptr + ROW_STRIDE*5 + 4)); /* store row 2 */
- ; /* slot */
+/* punpcklwd mm0, mm1; // mm0 = [ 0 4 1 5] */
+ punpckhwd_r2r (mm1, mm4); /* mm4 = [ 2 6 3 7] */
+ movq_m2r (*(out + ROW_STRIDE * 7 + 4), mm3);
+ movq_r2r (mm2, mm6);
+ punpcklwd_r2r (mm3, mm2); /* mm2 = [ 8 12 9 13] */
+ movq_r2r (mm0, mm1); /* mm1 = [ 0 4 1 5] */
+ punpckhwd_r2r (mm3, mm6); /* mm6 = 10 14 11 15] */
+ movq_r2r (mm4, mm3); /* mm3 = [ 2 6 3 7] */
+ punpckldq_r2r (mm2, mm0); /* final result mm0 = row1 [0 4 8 12] */
+ punpckhdq_r2r (mm2, mm1); /* mm1 = final result mm1 = row2 [1 5 9 13] */
+ ; /* slot */
+ movq_r2m (mm0, *(inptr + ROW_STRIDE * 4 + 4)); /* store row 1 */
+ punpckldq_r2r (mm6, mm4); /* final result mm4 = row3 [2 6 10 14] */
+ movq_m2r (*(out + ROW_STRIDE * 4), mm0);
+ punpckhdq_r2r (mm6, mm3); /* final result mm3 = row4 [3 7 11 15] */
+ movq_r2m (mm4, *(inptr + ROW_STRIDE * 6 + 4)); /* store row 3 */
+ movq_r2r (mm0, mm4); /* mm4 = copy of row1[A B C D] */
+ movq_r2m (mm1, *(inptr + ROW_STRIDE * 5 + 4)); /* store row 2 */
+ ; /* slot */
+ movq_m2r (*(out + ROW_STRIDE * 5), mm1);
+ ; /* slot */
+ movq_r2m (mm3, *(inptr + ROW_STRIDE * 7 + 4)); /* store row 4 */
+ punpcklwd_r2r (mm1, mm0); /* mm0 = [ 0 4 1 5] */
- movq_m2r(*(out + ROW_STRIDE * 5 ), mm1);
- ; /* slot */
-
- movq_r2m(mm3, *(inptr + ROW_STRIDE*7 + 4)); /* store row 4 */
- punpcklwd_r2r(mm1, mm0); /* mm0 = [ 0 4 1 5] */
-
- /* 3) transpose lower-left */
+ /* 3) transpose lower-left */
/* movq mm0, qword ptr [OUT + ROW_STRIDE * 4 ] */
-
+
/* movq mm1, qword ptr [OUT + ROW_STRIDE * 5 ] */
/* movq mm4, mm0; // mm4 = copy of row1[A B C D] */
-
- movq_m2r(*(out + ROW_STRIDE * 6 ), mm2);
+ movq_m2r (*(out + ROW_STRIDE * 6), mm2);
+
/* punpcklwd mm0, mm1; // mm0 = [ 0 4 1 5] */
- punpckhwd_r2r(mm1, mm4); /* mm4 = [ 2 6 3 7] */
-
- movq_m2r(*(out + ROW_STRIDE * 7 ), mm3);
- movq_r2r(mm2, mm6);
-
- punpcklwd_r2r(mm3, mm2); /* mm2 = [ 8 12 9 13] */
- movq_r2r(mm0, mm1); /* mm1 = [ 0 4 1 5] */
-
- punpckhwd_r2r(mm3, mm6); /* mm6 = 10 14 11 15] */
- movq_r2r(mm4, mm3); /* mm3 = [ 2 6 3 7] */
-
- punpckldq_r2r(mm2, mm0); /* final result mm0 = row1 [0 4 8 12] */
-
- punpckhdq_r2r(mm2, mm1); /* mm1 = final result mm1 = row2 [1 5 9 13] */
- ;/*slot */
-
- movq_r2m(mm0, *(inptr + ROW_STRIDE * 0 + 4 )); /* store row 1 */
- punpckldq_r2r(mm6, mm4); /* final result mm4 = row3 [2 6 10 14] */
-
+ punpckhwd_r2r (mm1, mm4); /* mm4 = [ 2 6 3 7] */
+ movq_m2r (*(out + ROW_STRIDE * 7), mm3);
+ movq_r2r (mm2, mm6);
+ punpcklwd_r2r (mm3, mm2); /* mm2 = [ 8 12 9 13] */
+ movq_r2r (mm0, mm1); /* mm1 = [ 0 4 1 5] */
+ punpckhwd_r2r (mm3, mm6); /* mm6 = 10 14 11 15] */
+ movq_r2r (mm4, mm3); /* mm3 = [ 2 6 3 7] */
+ punpckldq_r2r (mm2, mm0); /* final result mm0 = row1 [0 4 8 12] */
+ punpckhdq_r2r (mm2, mm1); /* mm1 = final result mm1 = row2 [1 5 9 13] */
+ ; /*slot */
+ movq_r2m (mm0, *(inptr + ROW_STRIDE * 0 + 4)); /* store row 1 */
+ punpckldq_r2r (mm6, mm4); /* final result mm4 = row3 [2 6 10 14] */
+
/* begin reading next quadrant (upper-right) */
- movq_m2r(*(out + ROW_STRIDE*0 + 4), mm0);
- punpckhdq_r2r(mm6, mm3); /* final result mm3 = row4 [3 7 11 15] */
-
- movq_r2m(mm4, *(inptr + ROW_STRIDE * 2 + 4)); /* store row 3 */
- movq_r2r(mm0, mm4); /* mm4 = copy of row1[A B C D] */
-
- movq_r2m(mm1, *(inptr + ROW_STRIDE * 1 + 4)); /* store row 2 */
- movq_m2r(*(out + ROW_STRIDE*1 + 4), mm1);
-
- movq_r2m(mm3, *(inptr + ROW_STRIDE * 3 + 4)); /* store row 4 */
- punpcklwd_r2r(mm1, mm0); /* mm0 = [ 0 4 1 5] */
-
-
- /* 2) transpose lower-right quadrant */
-
+ movq_m2r (*(out + ROW_STRIDE * 0 + 4), mm0);
+ punpckhdq_r2r (mm6, mm3); /* final result mm3 = row4 [3 7 11 15] */
+ movq_r2m (mm4, *(inptr + ROW_STRIDE * 2 + 4)); /* store row 3 */
+ movq_r2r (mm0, mm4); /* mm4 = copy of row1[A B C D] */
+ movq_r2m (mm1, *(inptr + ROW_STRIDE * 1 + 4)); /* store row 2 */
+ movq_m2r (*(out + ROW_STRIDE * 1 + 4), mm1);
+ movq_r2m (mm3, *(inptr + ROW_STRIDE * 3 + 4)); /* store row 4 */
+ punpcklwd_r2r (mm1, mm0); /* mm0 = [ 0 4 1 5] */
+
+ /* 2) transpose lower-right quadrant */
+
/* movq mm0, qword ptr [OUT + ROW_STRIDE*4 + 8] */
-
+
/* movq mm1, qword ptr [OUT + ROW_STRIDE*5 + 8] */
/* movq mm4, mm0; // mm4 = copy of row1[A B C D] */
-
- movq_m2r(*(out + ROW_STRIDE*2 + 4), mm2);
+ movq_m2r (*(out + ROW_STRIDE * 2 + 4), mm2);
+
/* punpcklwd mm0, mm1; // mm0 = [ 0 4 1 5] */
- punpckhwd_r2r(mm1, mm4); /* mm4 = [ 2 6 3 7] */
-
- movq_m2r(*(out + ROW_STRIDE*3 + 4), mm3);
- movq_r2r(mm2, mm6);
-
- punpcklwd_r2r(mm3, mm2); /* mm2 = [ 8 12 9 13] */
- movq_r2r(mm0, mm1); /* mm1 = [ 0 4 1 5] */
-
- punpckhwd_r2r(mm3, mm6); /* mm6 = 10 14 11 15] */
- movq_r2r(mm4, mm3); /* mm3 = [ 2 6 3 7] */
-
- punpckldq_r2r(mm2, mm0); /* final result mm0 = row1 [0 4 8 12] */
-
- punpckhdq_r2r(mm2, mm1); /* mm1 = final result mm1 = row2 [1 5 9 13] */
- ; /* slot */
-
- movq_r2m(mm0, *(inptr + ROW_STRIDE*4)); /* store row 1 */
- punpckldq_r2r(mm6, mm4); /* final result mm4 = row3 [2 6 10 14] */
-
- movq_r2m(mm1, *(inptr + ROW_STRIDE*5)); /* store row 2 */
- punpckhdq_r2r(mm6, mm3); /* final result mm3 = row4 [3 7 11 15] */
-
- movq_r2m(mm4, *(inptr + ROW_STRIDE*6)); /* store row 3 */
- ; /* slot */
-
- movq_r2m(mm3, *(inptr + ROW_STRIDE*7)); /* store row 4 */
- ; /* slot */
-
-}
-
-
-static void
-idct_mmx32_cols( short *blk ) /* transform all 8 cols of 8x8 iDCT block */
-{
- int x;
- short *inptr = blk;
-
- /* Despite the function's name, the matrix is transformed */
- /* row by row. This function is identical to idct_mmx32_rows(), */
- /* except for the SHIFT amount and ROUND_INV amount. */
-
- /* this subroutine performs two operations */
- /* 1) iDCT row transform */
- /* for( i = 0; i < 8; ++ i) */
- /* DCT_8_INV_ROW_1( blk[i*8], qwTemp[i] ); */
- /* */
- /* 2) transpose the matrix (which was stored in qwTemp[]) */
- /* qwTemp[] -> [8x8 matrix transpose] -> blk[] */
-
-
- for (x=0; x<8; x++) { /* transform one row per iteration */
-
- movq_m2r(*(inptr), mm0); /* 0 ; x3 x2 x1 x0 */
-
- movq_m2r(*(inptr+4), mm1); /* 1 ; x7 x6 x5 x4 */
- movq_r2r(mm0, mm2); /* 2 ; x3 x2 x1 x0 */
-
- movq_m2r(*(tab_i_01234567), mm3); /* 3 ; w06 w04 w02 w00 */
- punpcklwd_r2r(mm1, mm0); /* x5 x1 x4 x0 */
-
+ punpckhwd_r2r (mm1, mm4); /* mm4 = [ 2 6 3 7] */
+ movq_m2r (*(out + ROW_STRIDE * 3 + 4), mm3);
+ movq_r2r (mm2, mm6);
+ punpcklwd_r2r (mm3, mm2); /* mm2 = [ 8 12 9 13] */
+ movq_r2r (mm0, mm1); /* mm1 = [ 0 4 1 5] */
+ punpckhwd_r2r (mm3, mm6); /* mm6 = 10 14 11 15] */
+ movq_r2r (mm4, mm3); /* mm3 = [ 2 6 3 7] */
+ punpckldq_r2r (mm2, mm0); /* final result mm0 = row1 [0 4 8 12] */
+ punpckhdq_r2r (mm2, mm1); /* mm1 = final result mm1 = row2 [1 5 9 13] */
+ ; /* slot */
+ movq_r2m (mm0, *(inptr + ROW_STRIDE * 4)); /* store row 1 */
+ punpckldq_r2r (mm6, mm4); /* final result mm4 = row3 [2 6 10 14] */
+ movq_r2m (mm1, *(inptr + ROW_STRIDE * 5)); /* store row 2 */
+ punpckhdq_r2r (mm6, mm3); /* final result mm3 = row4 [3 7 11 15] */
+ movq_r2m (mm4, *(inptr + ROW_STRIDE * 6)); /* store row 3 */
+ ; /* slot */
+ movq_r2m (mm3, *(inptr + ROW_STRIDE * 7)); /* store row 4 */
+ ; /* slot */
+ }
+ static void
+idct_mmx32_cols (short *blk)
+{ /* transform all 8 cols of 8x8 iDCT block */
+ int x;
+ short *inptr = blk;
+
+
+ /* Despite the function's name, the matrix is transformed */
+ /* row by row. This function is identical to idct_mmx32_rows(), */
+ /* except for the SHIFT amount and ROUND_INV amount. */
+
+ /* this subroutine performs two operations */
+ /* 1) iDCT row transform */
+ /* for( i = 0; i < 8; ++ i) */
+ /* DCT_8_INV_ROW_1( blk[i*8], qwTemp[i] ); */
+ /* */
+ /* 2) transpose the matrix (which was stored in qwTemp[]) */
+ /* qwTemp[] -> [8x8 matrix transpose] -> blk[] */
+ for (x = 0; x < 8; x++) { /* transform one row per iteration */
+ movq_m2r (*(inptr), mm0); /* 0 ; x3 x2 x1 x0 */
+ movq_m2r (*(inptr + 4), mm1); /* 1 ; x7 x6 x5 x4 */
+ movq_r2r (mm0, mm2); /* 2 ; x3 x2 x1 x0 */
+ movq_m2r (*(tab_i_01234567), mm3); /* 3 ; w06 w04 w02 w00 */
+ punpcklwd_r2r (mm1, mm0); /* x5 x1 x4 x0 */
+
/* ---------- */
- movq_r2r(mm0, mm5); /* 5 ; x5 x1 x4 x0 */
- punpckldq_r2r(mm0, mm0); /* x4 x0 x4 x0 */
-
- movq_m2r(*(tab_i_01234567+4), mm4); /* 4 ; w07 w05 w03 w01 */
- punpckhwd_r2r(mm1, mm2); /* 1 ; x7 x3 x6 x2 */
-
- pmaddwd_r2r(mm0, mm3); /* x4*w06+x0*w04 x4*w02+x0*w00 */
- movq_r2r(mm2, mm6); /* 6 ; x7 x3 x6 x2 */
-
- movq_m2r(*(tab_i_01234567+16), mm1);/* 1 ; w22 w20 w18 w16 */
- punpckldq_r2r(mm2, mm2); /* x6 x2 x6 x2 */
-
- pmaddwd_r2r(mm2, mm4); /* x6*w07+x2*w05 x6*w03+x2*w01 */
- punpckhdq_r2r(mm5, mm5); /* x5 x1 x5 x1 */
-
- pmaddwd_m2r(*(tab_i_01234567+8), mm0);/* x4*w14+x0*w12 x4*w10+x0*w08 */
- punpckhdq_r2r(mm6, mm6); /* x7 x3 x7 x3 */
-
- movq_m2r(*(tab_i_01234567+20), mm7);/* 7 ; w23 w21 w19 w17 */
- pmaddwd_r2r(mm5, mm1); /* x5*w22+x1*w20 x5*w18+x1*w16 */
-
- paddd_m2r(*(r_inv_col), mm3);/* +rounder */
- pmaddwd_r2r(mm6, mm7); /* x7*w23+x3*w21 x7*w19+x3*w17 */
-
- pmaddwd_m2r(*(tab_i_01234567+12), mm2);/* x6*w15+x2*w13 x6*w11+x2*w09 */
- paddd_r2r(mm4, mm3); /* 4 ; a1=sum(even1) a0=sum(even0) */
-
- pmaddwd_m2r(*(tab_i_01234567+24), mm5);/* x5*w30+x1*w28 x5*w26+x1*w24 */
- movq_r2r(mm3, mm4); /* 4 ; a1 a0 */
-
- pmaddwd_m2r(*(tab_i_01234567+28), mm6);/* x7*w31+x3*w29 x7*w27+x3*w25 */
- paddd_r2r(mm7, mm1); /* 7 ; b1=sum(odd1) b0=sum(odd0) */
-
- paddd_m2r(*(r_inv_col), mm0);/* +rounder */
- psubd_r2r(mm1, mm3); /* a1-b1 a0-b0 */
-
- psrad_i2r(SHIFT_INV_COL, mm3); /* y6=a1-b1 y7=a0-b0 */
- paddd_r2r(mm4, mm1); /* 4 ; a1+b1 a0+b0 */
-
- paddd_r2r(mm2, mm0); /* 2 ; a3=sum(even3) a2=sum(even2) */
- psrad_i2r(SHIFT_INV_COL, mm1); /* y1=a1+b1 y0=a0+b0 */
-
- paddd_r2r(mm6, mm5); /* 6 ; b3=sum(odd3) b2=sum(odd2) */
- movq_r2r(mm0, mm4); /* 4 ; a3 a2 */
-
- paddd_r2r(mm5, mm0); /* a3+b3 a2+b2 */
- psubd_r2r(mm5, mm4); /* 5 ; a3-b3 a2-b2 */
-
-
- psrad_i2r(SHIFT_INV_COL, mm4); /* y4=a3-b3 y5=a2-b2 */
- psrad_i2r(SHIFT_INV_COL, mm0); /* y3=a3+b3 y2=a2+b2 */
-
- packssdw_r2r(mm3, mm4); /* 3 ; y6 y7 y4 y5 */
-
- packssdw_r2r(mm0, mm1); /* 0 ; y3 y2 y1 y0 */
- movq_r2r(mm4, mm7); /* 7 ; y6 y7 y4 y5 */
-
- psrld_i2r(16, mm4); /* 0 y6 0 y4 */
-
- movq_r2m(mm1, *(inptr)); /* 1 ; save y3 y2 y1 y0 */
- pslld_i2r(16, mm7); /* y7 0 y5 0 */
-
- por_r2r(mm4, mm7); /* 4 ; y7 y6 y5 y4 */
-
- /* begin processing row 1 */
- movq_r2m(mm7, *(inptr+4)); /* 7 ; save y7 y6 y5 y4 */
-
- inptr += 8;
- }
- /* done with the iDCT column-transformation */
-}
-
+ movq_r2r (mm0, mm5); /* 5 ; x5 x1 x4 x0 */
+ punpckldq_r2r (mm0, mm0); /* x4 x0 x4 x0 */
+ movq_m2r (*(tab_i_01234567 + 4), mm4); /* 4 ; w07 w05 w03 w01 */
+ punpckhwd_r2r (mm1, mm2); /* 1 ; x7 x3 x6 x2 */
+ pmaddwd_r2r (mm0, mm3); /* x4*w06+x0*w04 x4*w02+x0*w00 */
+ movq_r2r (mm2, mm6); /* 6 ; x7 x3 x6 x2 */
+ movq_m2r (*(tab_i_01234567 + 16), mm1); /* 1 ; w22 w20 w18 w16 */
+ punpckldq_r2r (mm2, mm2); /* x6 x2 x6 x2 */
+ pmaddwd_r2r (mm2, mm4); /* x6*w07+x2*w05 x6*w03+x2*w01 */
+ punpckhdq_r2r (mm5, mm5); /* x5 x1 x5 x1 */
+ pmaddwd_m2r (*(tab_i_01234567 + 8), mm0); /* x4*w14+x0*w12 x4*w10+x0*w08 */
+ punpckhdq_r2r (mm6, mm6); /* x7 x3 x7 x3 */
+ movq_m2r (*(tab_i_01234567 + 20), mm7); /* 7 ; w23 w21 w19 w17 */
+ pmaddwd_r2r (mm5, mm1); /* x5*w22+x1*w20 x5*w18+x1*w16 */
+ paddd_m2r (*(r_inv_col), mm3); /* +rounder */
+ pmaddwd_r2r (mm6, mm7); /* x7*w23+x3*w21 x7*w19+x3*w17 */
+ pmaddwd_m2r (*(tab_i_01234567 + 12), mm2); /* x6*w15+x2*w13 x6*w11+x2*w09 */
+ paddd_r2r (mm4, mm3); /* 4 ; a1=sum(even1) a0=sum(even0) */
+ pmaddwd_m2r (*(tab_i_01234567 + 24), mm5); /* x5*w30+x1*w28 x5*w26+x1*w24 */
+ movq_r2r (mm3, mm4); /* 4 ; a1 a0 */
+ pmaddwd_m2r (*(tab_i_01234567 + 28), mm6); /* x7*w31+x3*w29 x7*w27+x3*w25 */
+ paddd_r2r (mm7, mm1); /* 7 ; b1=sum(odd1) b0=sum(odd0) */
+ paddd_m2r (*(r_inv_col), mm0); /* +rounder */
+ psubd_r2r (mm1, mm3); /* a1-b1 a0-b0 */
+ psrad_i2r (SHIFT_INV_COL, mm3); /* y6=a1-b1 y7=a0-b0 */
+ paddd_r2r (mm4, mm1); /* 4 ; a1+b1 a0+b0 */
+ paddd_r2r (mm2, mm0); /* 2 ; a3=sum(even3) a2=sum(even2) */
+ psrad_i2r (SHIFT_INV_COL, mm1); /* y1=a1+b1 y0=a0+b0 */
+ paddd_r2r (mm6, mm5); /* 6 ; b3=sum(odd3) b2=sum(odd2) */
+ movq_r2r (mm0, mm4); /* 4 ; a3 a2 */
+ paddd_r2r (mm5, mm0); /* a3+b3 a2+b2 */
+ psubd_r2r (mm5, mm4); /* 5 ; a3-b3 a2-b2 */
+ psrad_i2r (SHIFT_INV_COL, mm4); /* y4=a3-b3 y5=a2-b2 */
+ psrad_i2r (SHIFT_INV_COL, mm0); /* y3=a3+b3 y2=a2+b2 */
+ packssdw_r2r (mm3, mm4); /* 3 ; y6 y7 y4 y5 */
+ packssdw_r2r (mm0, mm1); /* 0 ; y3 y2 y1 y0 */
+ movq_r2r (mm4, mm7); /* 7 ; y6 y7 y4 y5 */
+ psrld_i2r (16, mm4); /* 0 y6 0 y4 */
+ movq_r2m (mm1, *(inptr)); /* 1 ; save y3 y2 y1 y0 */
+ pslld_i2r (16, mm7); /* y7 0 y5 0 */
+ por_r2r (mm4, mm7); /* 4 ; y7 y6 y5 y4 */
+
+ /* begin processing row 1 */
+ movq_r2m (mm7, *(inptr + 4)); /* 7 ; save y7 y6 y5 y4 */
+ inptr += 8;
+ }
+
+ /* done with the iDCT column-transformation */
+}
+
+
/* */
/* public interface to MMX32 IDCT 8x8 operation */
/* */
-void
-gst_idct_mmx32_idct( short *blk )
-{
- /* 1) iDCT row transformation */
- idct_mmx32_rows( blk ); /* 1) transform iDCT row, and transpose */
-
- /* 2) iDCT column transformation */
- idct_mmx32_cols( blk ); /* 2) transform iDCT row, and transpose */
-
- emms(); /* restore processor state */
- /* all done */
-}
+void
+gst_idct_mmx32_idct (short *blk)
+{
+
+ /* 1) iDCT row transformation */
+ idct_mmx32_rows (blk); /* 1) transform iDCT row, and transpose */
+
+ /* 2) iDCT column transformation */
+ idct_mmx32_cols (blk); /* 2) transform iDCT row, and transpose */
+ emms (); /* restore processor state */
+ /* all done */
+}
diff --git a/gst-libs/gst/media-info/media-info-priv.c b/gst-libs/gst/media-info/media-info-priv.c
index 8f4a1f56..fb012209 100644
--- a/gst-libs/gst/media-info/media-info-priv.c
+++ b/gst-libs/gst/media-info/media-info-priv.c
@@ -49,9 +49,10 @@ gmi_stream_new (void)
}
void
-gmi_stream_free (GstMediaInfoStream *stream)
+gmi_stream_free (GstMediaInfoStream * stream)
{
- if (stream->mime) g_free (stream->mime);
+ if (stream->mime)
+ g_free (stream->mime);
/* FIXME: free tracks */
g_free (stream);
}
@@ -78,7 +79,8 @@ gmi_track_new (void)
/* callbacks */
static void
-have_type_callback (GstElement *typefind, guint probability, GstCaps *type, GstMediaInfoPriv *priv)
+have_type_callback (GstElement * typefind, guint probability, GstCaps * type,
+ GstMediaInfoPriv * priv)
{
GstStructure *str;
const gchar *mime;
@@ -90,8 +92,7 @@ have_type_callback (GstElement *typefind, guint probability, GstCaps *type, GstM
/* FIXME: this code doesn't yet work, test it later */
#ifdef DONTWORK
- if (strcmp (mime, "application/x-id3") == 0)
- {
+ if (strcmp (mime, "application/x-id3") == 0) {
/* dig a little deeper */
GST_DEBUG ("dealing with id3, digging deeper");
gst_element_set_state (priv->pipeline, GST_STATE_READY);
@@ -102,70 +103,72 @@ have_type_callback (GstElement *typefind, guint probability, GstCaps *type, GstM
if (priv->decontainer == NULL)
/* FIXME: signal error */
g_warning ("Couldn't create id3tag");
- if (!gst_element_link_many (priv->source, priv->decontainer, priv->typefind, NULL));
- g_warning ("Couldn't link in id3tag");
+ if (!gst_element_link_many (priv->source, priv->decontainer, priv->typefind,
+ NULL));
+ g_warning ("Couldn't link in id3tag");
if (gst_element_set_state (priv->pipeline, GST_STATE_PLAYING)
- == GST_STATE_FAILURE)
+ == GST_STATE_FAILURE)
g_warning ("Couldn't set to playing");
}
#endif
}
void
-deep_notify_callback (GObject *object, GstObject *origin,
- GParamSpec *pspec, GstMediaInfoPriv *priv)
+deep_notify_callback (GObject * object, GstObject * origin,
+ GParamSpec * pspec, GstMediaInfoPriv * priv)
{
GValue value = { 0, };
/* we only care about pad notifies */
- if (!GST_IS_PAD (origin)) return;
+ if (!GST_IS_PAD (origin))
+ return;
/*
- GST_DEBUG ("DEBUG: deep_notify: have notify of %s from object %s:%s !",
- pspec->name, gst_element_get_name (gst_pad_get_parent (GST_PAD (origin))),
- gst_object_get_name (origin));
- */
- else if (strcmp (pspec->name, "caps") == 0)
- {
+ GST_DEBUG ("DEBUG: deep_notify: have notify of %s from object %s:%s !",
+ pspec->name, gst_element_get_name (gst_pad_get_parent (GST_PAD (origin))),
+ gst_object_get_name (origin));
+ */
+ else if (strcmp (pspec->name, "caps") == 0) {
/* check if we're getting it from fakesink */
- if (GST_IS_PAD (origin) && GST_PAD_PARENT (origin) == priv->fakesink)
- {
+ if (GST_IS_PAD (origin) && GST_PAD_PARENT (origin) == priv->fakesink) {
GST_DEBUG ("have caps on fakesink pad !");
g_value_init (&value, pspec->value_type);
g_object_get_property (G_OBJECT (origin), pspec->name, &value);
priv->format = g_value_peek_pointer (&value);
GST_DEBUG ("caps: %" GST_PTR_FORMAT, priv->format);
- }
- else GST_DEBUG ("ignoring caps on object %s:%s",
- gst_object_get_name (gst_object_get_parent (origin)),
- gst_object_get_name (origin));
- }
- else if (strcmp (pspec->name, "offset") == 0)
- {
+ } else
+ GST_DEBUG ("ignoring caps on object %s:%s",
+ gst_object_get_name (gst_object_get_parent (origin)),
+ gst_object_get_name (origin));
+ } else if (strcmp (pspec->name, "offset") == 0) {
/* we REALLY ignore offsets, we hate them */
}
- //else GST_DEBUG ("ignoring notify of %s", pspec->name);
+ //else GST_DEBUG ("ignoring notify of %s", pspec->name);
}
-typedef struct {
+typedef struct
+{
guint meta;
guint encoded;
} TagFlagScore;
static void
-tag_flag_score (const GstTagList *list, const gchar *tag, gpointer user_data)
+tag_flag_score (const GstTagList * list, const gchar * tag, gpointer user_data)
{
TagFlagScore *score = (TagFlagScore *) user_data;
GstTagFlag flag;
flag = gst_tag_get_flag (tag);
- if (flag == GST_TAG_FLAG_META) score->meta++;
- if (flag == GST_TAG_FLAG_ENCODED) score->encoded++;
+ if (flag == GST_TAG_FLAG_META)
+ score->meta++;
+ if (flag == GST_TAG_FLAG_ENCODED)
+ score->encoded++;
}
void
-found_tag_callback (GObject *pipeline, GstElement *source, GstTagList *tags, GstMediaInfoPriv *priv)
+found_tag_callback (GObject * pipeline, GstElement * source, GstTagList * tags,
+ GstMediaInfoPriv * priv)
{
TagFlagScore score;
@@ -179,20 +182,18 @@ found_tag_callback (GObject *pipeline, GstElement *source, GstTagList *tags, Gst
gst_tag_list_foreach (tags, tag_flag_score, &score);
- if (score.meta > score.encoded)
- {
+ if (score.meta > score.encoded) {
GST_DEBUG ("found tags from decoder, adding them as metadata");
priv->metadata = gst_tag_list_copy (tags);
- }
- else
- {
+ } else {
GST_DEBUG ("found tags, adding them as streaminfo");
priv->streaminfo = gst_tag_list_copy (tags);
}
}
void
-error_callback (GObject *element, GstElement *source, GError *error, gchar *debug, GstMediaInfoPriv *priv)
+error_callback (GObject * element, GstElement * source, GError * error,
+ gchar * debug, GstMediaInfoPriv * priv)
{
g_print ("ERROR: %s\n", error->message);
g_error_free (error);
@@ -202,7 +203,7 @@ error_callback (GObject *element, GstElement *source, GError *error, gchar *debu
/* General GError creation */
static void
-gst_media_info_error_create (GError **error, const gchar *message)
+gst_media_info_error_create (GError ** error, const gchar * message)
{
/* check if caller wanted an error reported */
if (error == NULL)
@@ -214,15 +215,14 @@ gst_media_info_error_create (GError **error, const gchar *message)
/* GError creation when element is missing */
static void
-gst_media_info_error_element (const gchar *element, GError **error)
+gst_media_info_error_element (const gchar * element, GError ** error)
{
gchar *message;
message = g_strdup_printf ("The %s element could not be found. "
- "This element is essential for reading. "
- "Please install the right plug-in and verify "
- "that it works by running 'gst-inspect %s'",
- element, element);
+ "This element is essential for reading. "
+ "Please install the right plug-in and verify "
+ "that it works by running 'gst-inspect %s'", element, element);
gst_media_info_error_create (error, message);
g_free (message);
return;
@@ -230,7 +230,7 @@ gst_media_info_error_element (const gchar *element, GError **error)
/* initialise priv; done the first time */
gboolean
-gmip_init (GstMediaInfoPriv *priv, GError **error)
+gmip_init (GstMediaInfoPriv * priv, GError ** error)
{
#define GST_MEDIA_INFO_MAKE_OR_ERROR(el, factory, name, error) \
G_STMT_START { \
@@ -257,7 +257,7 @@ G_STMT_START { \
/* called at the beginning of each use cycle */
/* reset info to a state where it can be used to query for media info */
void
-gmip_reset (GstMediaInfoPriv *priv)
+gmip_reset (GstMediaInfoPriv * priv)
{
#define STRING_RESET(string) \
@@ -266,8 +266,8 @@ G_STMT_START { \
string = NULL; \
} G_STMT_END
- STRING_RESET(priv->pipeline_desc);
- STRING_RESET(priv->location);
+ STRING_RESET (priv->pipeline_desc);
+ STRING_RESET (priv->location);
#undef STRING_RESET
#define CAPS_RESET(target) \
@@ -275,8 +275,8 @@ G_STMT_START { \
if (target) gst_caps_free (target); \
target = NULL; \
} G_STMT_END
- CAPS_RESET(priv->type);
- CAPS_RESET(priv->format);
+ CAPS_RESET (priv->type);
+ CAPS_RESET (priv->format);
#undef CAPS_RESET
#define TAGS_RESET(target) \
@@ -285,12 +285,11 @@ G_STMT_START { \
gst_tag_list_free (target); \
target = NULL; \
} G_STMT_END
- TAGS_RESET(priv->metadata);
- TAGS_RESET(priv->streaminfo);
+ TAGS_RESET (priv->metadata);
+ TAGS_RESET (priv->streaminfo);
#undef TAGS_RESET
- if (priv->stream)
- {
+ if (priv->stream) {
gmi_stream_free (priv->stream);
priv->stream = NULL;
}
@@ -302,7 +301,7 @@ G_STMT_START { \
/* seek to a track and reset metadata and streaminfo structs */
gboolean
-gmi_seek_to_track (GstMediaInfo *info, long track)
+gmi_seek_to_track (GstMediaInfo * info, long track)
{
GstEvent *event;
GstFormat track_format = 0;
@@ -311,32 +310,28 @@ gmi_seek_to_track (GstMediaInfo *info, long track)
/* FIXME: consider more nicks as "track" */
track_format = gst_format_get_by_nick ("logical_stream");
- if (track_format == 0) return FALSE;
+ if (track_format == 0)
+ return FALSE;
GST_DEBUG ("Track format: %d", track_format);
if (gst_element_set_state (priv->pipeline, GST_STATE_PLAYING)
- == GST_STATE_FAILURE)
+ == GST_STATE_FAILURE)
g_warning ("Couldn't set to play");
g_assert (GST_IS_PAD (info->priv->decoder_pad));
event = gst_event_new_seek (track_format |
- GST_SEEK_METHOD_SET |
- GST_SEEK_FLAG_FLUSH,
- track);
+ GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH, track);
res = gst_pad_send_event (info->priv->decoder_pad, event);
- if (!res)
- {
+ if (!res) {
g_warning ("seek to logical track on pad %s:%s failed",
- GST_DEBUG_PAD_NAME(info->priv->decoder_pad));
+ GST_DEBUG_PAD_NAME (info->priv->decoder_pad));
return FALSE;
}
/* clear structs because of the seek */
- if (priv->metadata)
- {
+ if (priv->metadata) {
gst_tag_list_free (priv->metadata);
priv->metadata = NULL;
}
- if (priv->streaminfo)
- {
+ if (priv->streaminfo) {
gst_tag_list_free (priv->streaminfo);
priv->streaminfo = NULL;
}
@@ -345,7 +340,7 @@ gmi_seek_to_track (GstMediaInfo *info, long track)
/* set the mime type on the media info getter */
gboolean
-gmi_set_mime (GstMediaInfo *info, const char *mime)
+gmi_set_mime (GstMediaInfo * info, const char *mime)
{
gchar *desc = NULL;
GError *error = NULL;
@@ -354,31 +349,45 @@ gmi_set_mime (GstMediaInfo *info, const char *mime)
/* FIXME: please figure out proper mp3 mimetypes */
if ((strcmp (mime, "application/x-ogg") == 0) ||
(strcmp (mime, "application/ogg") == 0))
- desc = g_strdup_printf ("%s name=source ! oggdemux ! vorbisdec name=decoder ! fakesink name=sink", priv->source_name);
- else if ((strcmp (mime, "audio/mpeg") == 0) ||
- (strcmp (mime, "audio/x-mp3") == 0) ||
- (strcmp (mime, "audio/mp3") == 0) ||
- (strcmp (mime, "application/x-id3") == 0) ||
- (strcmp (mime, "audio/x-id3") == 0))
- desc = g_strdup_printf ("%s name=source ! id3tag ! mad name=decoder ! audio/x-raw-int ! fakesink name=sink", priv->source_name);
- else if ((strcmp (mime, "application/x-flac") == 0) ||
- (strcmp (mime, "audio/x-flac") == 0))
- desc = g_strdup_printf ("%s name=source ! flacdec name=decoder ! audio/x-raw-int ! fakesink name=sink", priv->source_name);
- else if ((strcmp (mime, "audio/wav") == 0) ||
- (strcmp (mime, "audio/x-wav") == 0))
- desc = g_strdup_printf ("%s ! wavparse name=decoder ! audio/x-raw-int ! fakesink name=sink", priv->source_name);
- else if (strcmp (mime, "audio/x-mod") == 0 ||
- strcmp (mime, "audio/x-s3m") == 0 ||
- strcmp (mime, "audio/x-xm") == 0 ||
- strcmp (mime, "audio/x-it") == 0)
- desc = g_strdup_printf ("%s name=source ! modplug name=decoder ! audio/x-raw-int ! fakesink name=sink", priv->source_name);
- else return FALSE;
+ desc =
+ g_strdup_printf
+ ("%s name=source ! oggdemux ! vorbisdec name=decoder ! fakesink name=sink",
+ priv->source_name);
+ else if ((strcmp (mime, "audio/mpeg") == 0)
+ || (strcmp (mime, "audio/x-mp3") == 0)
+ || (strcmp (mime, "audio/mp3") == 0)
+ || (strcmp (mime, "application/x-id3") == 0)
+ || (strcmp (mime, "audio/x-id3") == 0))
+ desc =
+ g_strdup_printf
+ ("%s name=source ! id3tag ! mad name=decoder ! audio/x-raw-int ! fakesink name=sink",
+ priv->source_name);
+ else if ((strcmp (mime, "application/x-flac") == 0)
+ || (strcmp (mime, "audio/x-flac") == 0))
+ desc =
+ g_strdup_printf
+ ("%s name=source ! flacdec name=decoder ! audio/x-raw-int ! fakesink name=sink",
+ priv->source_name);
+ else if ((strcmp (mime, "audio/wav") == 0)
+ || (strcmp (mime, "audio/x-wav") == 0))
+ desc =
+ g_strdup_printf
+ ("%s ! wavparse name=decoder ! audio/x-raw-int ! fakesink name=sink",
+ priv->source_name);
+ else if (strcmp (mime, "audio/x-mod") == 0
+ || strcmp (mime, "audio/x-s3m") == 0 || strcmp (mime, "audio/x-xm") == 0
+ || strcmp (mime, "audio/x-it") == 0)
+ desc =
+ g_strdup_printf
+ ("%s name=source ! modplug name=decoder ! audio/x-raw-int ! fakesink name=sink",
+ priv->source_name);
+ else
+ return FALSE;
GST_DEBUG ("using description %s", desc);
priv->pipeline_desc = desc;
priv->pipeline = gst_parse_launch (desc, &error);
- if (error)
- {
+ if (error) {
g_warning ("Error parsing pipeline description: %s\n", error->message);
g_error_free (error);
return FALSE;
@@ -398,25 +407,27 @@ gmi_set_mime (GstMediaInfo *info, const char *mime)
/* get the "decoder" source pad */
priv->decoder_pad = gst_element_get_pad (priv->decoder, "src");
g_assert (GST_IS_PAD (priv->decoder_pad));
- GST_DEBUG ("decoder pad: %s:%s", gst_object_get_name (gst_object_get_parent (GST_OBJECT (priv->decoder_pad))), gst_pad_get_name (priv->decoder_pad));
+ GST_DEBUG ("decoder pad: %s:%s",
+ gst_object_get_name (gst_object_get_parent (GST_OBJECT (priv->
+ decoder_pad))), gst_pad_get_name (priv->decoder_pad));
/* attach notify handler */
g_signal_connect (G_OBJECT (info->priv->pipeline), "deep_notify",
- G_CALLBACK (deep_notify_callback), info->priv);
- g_signal_connect (G_OBJECT (info->priv->pipeline), "found-tag", G_CALLBACK (found_tag_callback), info->priv);
+ G_CALLBACK (deep_notify_callback), info->priv);
+ g_signal_connect (G_OBJECT (info->priv->pipeline), "found-tag",
+ G_CALLBACK (found_tag_callback), info->priv);
g_signal_connect (G_OBJECT (info->priv->pipeline), "error",
- G_CALLBACK (error_callback), info->priv);
+ G_CALLBACK (error_callback), info->priv);
return TRUE;
}
/* clear the decoding pipeline */
void
-gmi_clear_decoder (GstMediaInfo *info)
+gmi_clear_decoder (GstMediaInfo * info)
{
- if (info->priv->pipeline)
- {
- GST_DEBUG("Unreffing pipeline");
+ if (info->priv->pipeline) {
+ GST_DEBUG ("Unreffing pipeline");
gst_object_unref (GST_OBJECT (info->priv->pipeline));
}
info->priv->pipeline = NULL;
@@ -430,7 +441,7 @@ gmi_clear_decoder (GstMediaInfo *info)
/* prepare for typefind, move from NULL to TYPEFIND */
gboolean
-gmip_find_type_pre (GstMediaInfoPriv *priv, GError **error)
+gmip_find_type_pre (GstMediaInfoPriv * priv, GError ** error)
{
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
@@ -440,23 +451,21 @@ gmip_find_type_pre (GstMediaInfoPriv *priv, GError **error)
* just use it through this function only */
priv->pipeline = gst_pipeline_new ("pipeline-typefind");
- if (!GST_IS_PIPELINE (priv->pipeline))
- {
+ if (!GST_IS_PIPELINE (priv->pipeline)) {
gst_media_info_error_create (error, "Internal GStreamer error.");
return FALSE;
}
gst_bin_add (GST_BIN (priv->pipeline), priv->typefind);
GST_MEDIA_INFO_MAKE_OR_ERROR (priv->source, priv->source_name, "source",
- error);
+ error);
g_object_set (G_OBJECT (priv->source), "location", priv->location, NULL);
gst_bin_add (GST_BIN (priv->pipeline), priv->source);
if (!gst_element_link (priv->source, priv->typefind))
g_warning ("Couldn't connect source and typefind\n");
g_signal_connect (G_OBJECT (priv->typefind), "have-type",
- G_CALLBACK (have_type_callback), priv);
+ G_CALLBACK (have_type_callback), priv);
if (gst_element_set_state (priv->pipeline, GST_STATE_PLAYING)
- == GST_STATE_FAILURE)
- {
+ == GST_STATE_FAILURE) {
g_warning ("Couldn't set to play");
return FALSE;
}
@@ -467,24 +476,20 @@ gmip_find_type_pre (GstMediaInfoPriv *priv, GError **error)
/* finish off typefind */
gboolean
-gmip_find_type_post (GstMediaInfoPriv *priv)
+gmip_find_type_post (GstMediaInfoPriv * priv)
{
/*clear up typefind */
gst_element_set_state (priv->pipeline, GST_STATE_READY);
- if (priv->decontainer)
- {
+ if (priv->decontainer) {
gst_element_unlink (priv->source, priv->decontainer);
gst_element_unlink (priv->decontainer, priv->typefind);
gst_bin_remove (GST_BIN (priv->pipeline), priv->decontainer);
- }
- else
- {
+ } else {
gst_element_unlink (priv->source, priv->typefind);
}
gst_bin_remove (GST_BIN (priv->pipeline), priv->typefind);
- if (priv->type == NULL)
- {
+ if (priv->type == NULL) {
g_warning ("iteration ended, type not found !\n");
return FALSE;
}
@@ -495,25 +500,23 @@ gmip_find_type_post (GstMediaInfoPriv *priv)
/* complete version */
gboolean
-gmip_find_type (GstMediaInfoPriv *priv, GError ** error)
+gmip_find_type (GstMediaInfoPriv * priv, GError ** error)
{
if (!gmip_find_type_pre (priv, error))
return FALSE;
GST_DEBUG ("gmip_find_type: iterating");
- while ((priv->type == NULL) &&
- gst_bin_iterate (GST_BIN (priv->pipeline)))
- GMI_DEBUG("+");
- GMI_DEBUG("\n");
+ while ((priv->type == NULL) && gst_bin_iterate (GST_BIN (priv->pipeline)))
+ GMI_DEBUG ("+");
+ GMI_DEBUG ("\n");
return gmip_find_type_post (priv);
}
/* FIXME: why not have these functions work on priv types ? */
gboolean
-gmip_find_stream_pre (GstMediaInfoPriv *priv)
+gmip_find_stream_pre (GstMediaInfoPriv * priv)
{
if (gst_element_set_state (priv->pipeline, GST_STATE_PLAYING)
- == GST_STATE_FAILURE)
- {
+ == GST_STATE_FAILURE) {
g_warning ("Couldn't set to play");
return FALSE;
}
@@ -522,7 +525,7 @@ gmip_find_stream_pre (GstMediaInfoPriv *priv)
}
gboolean
-gmip_find_stream_post (GstMediaInfoPriv *priv)
+gmip_find_stream_post (GstMediaInfoPriv * priv)
{
GstMediaInfoStream *stream = priv->stream;
const GstFormat *formats;
@@ -541,8 +544,7 @@ gmip_find_stream_post (GstMediaInfoPriv *priv)
/* get supported formats on decoder pad */
formats = gst_pad_get_formats (priv->decoder_pad);
- while (*formats)
- {
+ while (*formats) {
const GstFormatDefinition *definition;
format = *formats;
@@ -551,16 +553,13 @@ gmip_find_stream_post (GstMediaInfoPriv *priv)
definition = gst_format_get_details (*formats);
GST_DEBUG ("trying to figure out length for format %s", definition->nick);
- res = gst_pad_query (priv->decoder_pad, GST_QUERY_TOTAL,
- &format, &value);
+ res = gst_pad_query (priv->decoder_pad, GST_QUERY_TOTAL, &format, &value);
- if (res)
- {
- switch (format)
- {
- case GST_FORMAT_TIME:
- stream->length_time = value;
- GST_DEBUG (" total %s: %lld", definition->nick, value);
+ if (res) {
+ switch (format) {
+ case GST_FORMAT_TIME:
+ stream->length_time = value;
+ GST_DEBUG (" total %s: %lld", definition->nick, value);
break;
case GST_FORMAT_DEFAULT:
case GST_FORMAT_BYTES:
@@ -568,35 +567,33 @@ gmip_find_stream_post (GstMediaInfoPriv *priv)
default:
/* separation is necessary because track_format doesn't resolve to
* int */
- if (format == track_format)
- {
+ if (format == track_format) {
stream->length_tracks = value;
- GST_DEBUG (" total %s: %lld", definition->nick, value);
- }
- else
+ GST_DEBUG (" total %s: %lld", definition->nick, value);
+ } else
GST_DEBUG ("unhandled format %s", definition->nick);
}
- }
- else
+ } else
GST_DEBUG ("query didn't return result for %s", definition->nick);
formats++;
}
- if (stream->length_tracks == 0) stream->length_tracks = 1;
+ if (stream->length_tracks == 0)
+ stream->length_tracks = 1;
/* now get number of bytes from the sink pad to get the bitrate */
format = GST_FORMAT_BYTES;
g_assert (GST_IS_PAD (priv->source_pad));
- res = gst_pad_query (priv->source_pad, GST_QUERY_TOTAL,
- &format, &value);
- if (!res) g_warning ("Failed to query on sink pad !");
+ res = gst_pad_query (priv->source_pad, GST_QUERY_TOTAL, &format, &value);
+ if (!res)
+ g_warning ("Failed to query on sink pad !");
bytes = value;
GST_DEBUG ("bitrate calc: bytes gotten: %ld", bytes);
- if (bytes)
- {
+ if (bytes) {
double seconds = (double) stream->length_time / GST_SECOND;
double bits = bytes * 8;
+
stream->bitrate = (long) (bits / seconds);
}
GST_DEBUG ("moving to STATE_METADATA\n");
@@ -607,7 +604,7 @@ gmip_find_stream_post (GstMediaInfoPriv *priv)
/* get properties of complete physical stream
* and return them in pre-alloced stream struct in priv->stream */
gboolean
-gmip_find_stream (GstMediaInfoPriv *priv)
+gmip_find_stream (GstMediaInfoPriv * priv)
{
GST_DEBUG ("mip_find_stream start");
@@ -615,16 +612,13 @@ gmip_find_stream (GstMediaInfoPriv *priv)
/* iterate until caps are found */
/* FIXME: this should be done through the plugin sending some signal
* that it is ready for queries */
- while (gst_bin_iterate (GST_BIN (priv->pipeline)) &&
- priv->format == NULL)
- ;
+ while (gst_bin_iterate (GST_BIN (priv->pipeline)) && priv->format == NULL);
if (gst_element_set_state (priv->pipeline, GST_STATE_PAUSED)
- == GST_STATE_FAILURE)
+ == GST_STATE_FAILURE)
g_warning ("Couldn't set to paused");
- if (priv->format == NULL)
- {
- GMI_DEBUG("gmip_find_stream: couldn't get caps !");
+ if (priv->format == NULL) {
+ GMI_DEBUG ("gmip_find_stream: couldn't get caps !");
return FALSE;
}
return gmip_find_stream_post (priv);
@@ -632,14 +626,13 @@ gmip_find_stream (GstMediaInfoPriv *priv)
/* find metadata encoded in media and store in priv->metadata */
gboolean
-gmip_find_track_metadata_pre (GstMediaInfoPriv *priv)
+gmip_find_track_metadata_pre (GstMediaInfoPriv * priv)
{
/* FIXME: this is a hack to set max allowed iterations for metadata
* querying - we should make gst smarter by itself instead */
priv->metadata_iters = 0;
if (gst_element_set_state (priv->pipeline, GST_STATE_PLAYING)
- == GST_STATE_FAILURE)
- {
+ == GST_STATE_FAILURE) {
g_warning ("Couldn't set to play");
return FALSE;
}
@@ -647,10 +640,10 @@ gmip_find_track_metadata_pre (GstMediaInfoPriv *priv)
}
gboolean
-gmip_find_track_metadata_post (GstMediaInfoPriv *priv)
+gmip_find_track_metadata_post (GstMediaInfoPriv * priv)
{
if (gst_element_set_state (priv->pipeline, GST_STATE_PAUSED)
- == GST_STATE_FAILURE)
+ == GST_STATE_FAILURE)
return FALSE;
priv->current_track->metadata = priv->metadata;
priv->metadata = NULL;
@@ -658,14 +651,13 @@ gmip_find_track_metadata_post (GstMediaInfoPriv *priv)
}
gboolean
-gmip_find_track_metadata (GstMediaInfoPriv *priv)
+gmip_find_track_metadata (GstMediaInfoPriv * priv)
{
gmip_find_track_metadata_pre (priv);
GST_DEBUG ("gmip_find_metadata: iterating");
- while ((priv->metadata == NULL) &&
- gst_bin_iterate (GST_BIN (priv->pipeline)))
- GMI_DEBUG("+");
- GMI_DEBUG("\n");
+ while ((priv->metadata == NULL) && gst_bin_iterate (GST_BIN (priv->pipeline)))
+ GMI_DEBUG ("+");
+ GMI_DEBUG ("\n");
gmip_find_track_metadata_post (priv);
return TRUE;
@@ -674,11 +666,10 @@ gmip_find_track_metadata (GstMediaInfoPriv *priv)
/* find streaminfo found by decoder and store in priv->streaminfo */
/* FIXME: this is an exact copy, so reuse this function instead */
gboolean
-gmip_find_track_streaminfo_pre (GstMediaInfoPriv *priv)
+gmip_find_track_streaminfo_pre (GstMediaInfoPriv * priv)
{
if (gst_element_set_state (priv->pipeline, GST_STATE_PLAYING)
- == GST_STATE_FAILURE)
- {
+ == GST_STATE_FAILURE) {
g_warning ("Couldn't set to play");
return FALSE;
}
@@ -686,7 +677,7 @@ gmip_find_track_streaminfo_pre (GstMediaInfoPriv *priv)
}
gboolean
-gmip_find_track_streaminfo_post (GstMediaInfoPriv *priv)
+gmip_find_track_streaminfo_post (GstMediaInfoPriv * priv)
{
GstFormat format, track_format;
@@ -694,33 +685,26 @@ gmip_find_track_streaminfo_post (GstMediaInfoPriv *priv)
/* now add total length to this, and maybe even bitrate ? FIXME */
track_format = gst_format_get_by_nick ("logical_stream");
- if (track_format == 0)
- {
+ if (track_format == 0) {
g_print ("FIXME: implement getting length of whole track\n");
- }
- else
- {
+ } else {
/* which one are we at ? */
long track_num;
gint64 value_start, value_end;
gboolean res;
res = gst_pad_query (priv->decoder_pad, GST_QUERY_POSITION,
- &track_format, &value_start);
- if (res)
- {
+ &track_format, &value_start);
+ if (res) {
format = GST_FORMAT_TIME;
track_num = value_start;
GST_DEBUG ("we are currently at %ld", track_num);
- res = gst_pad_convert (priv->decoder_pad,
- track_format, track_num,
- &format, &value_start);
+ res = gst_pad_convert (priv->decoder_pad,
+ track_format, track_num, &format, &value_start);
res &= gst_pad_convert (priv->decoder_pad,
- track_format, track_num + 1,
- &format, &value_end);
- if (res)
- {
- /* substract to get the length */
+ track_format, track_num + 1, &format, &value_end);
+ if (res) {
+ /* substract to get the length */
GST_DEBUG ("start %lld, end %lld", value_start, value_end);
value_end -= value_start;
/* FIXME: check units; this is in seconds */
@@ -737,14 +721,14 @@ gmip_find_track_streaminfo_post (GstMediaInfoPriv *priv)
}
gboolean
-gmip_find_track_streaminfo (GstMediaInfoPriv *priv)
+gmip_find_track_streaminfo (GstMediaInfoPriv * priv)
{
gmip_find_track_streaminfo_pre (priv);
GST_DEBUG ("DEBUG: gmip_find_streaminfo: iterating");
while ((priv->streaminfo == NULL) &&
- gst_bin_iterate (GST_BIN (priv->pipeline)))
- GMI_DEBUG("+");
- GMI_DEBUG("\n");
+ gst_bin_iterate (GST_BIN (priv->pipeline)))
+ GMI_DEBUG ("+");
+ GMI_DEBUG ("\n");
gmip_find_track_streaminfo_post (priv);
return TRUE;
@@ -752,11 +736,10 @@ gmip_find_track_streaminfo (GstMediaInfoPriv *priv)
/* find format found by decoder and store in priv->format */
gboolean
-gmip_find_track_format_pre (GstMediaInfoPriv *priv)
+gmip_find_track_format_pre (GstMediaInfoPriv * priv)
{
if (gst_element_set_state (priv->pipeline, GST_STATE_PLAYING)
- == GST_STATE_FAILURE)
- {
+ == GST_STATE_FAILURE) {
g_warning ("Couldn't set to play");
return FALSE;
}
@@ -764,10 +747,10 @@ gmip_find_track_format_pre (GstMediaInfoPriv *priv)
}
gboolean
-gmip_find_track_format_post (GstMediaInfoPriv *priv)
+gmip_find_track_format_post (GstMediaInfoPriv * priv)
{
if (gst_element_set_state (priv->pipeline, GST_STATE_PAUSED)
- == GST_STATE_FAILURE)
+ == GST_STATE_FAILURE)
return FALSE;
priv->current_track->format = priv->format;
priv->format = NULL;
@@ -775,17 +758,14 @@ gmip_find_track_format_post (GstMediaInfoPriv *priv)
}
gboolean
-gmip_find_track_format (GstMediaInfoPriv *priv)
+gmip_find_track_format (GstMediaInfoPriv * priv)
{
gmip_find_track_format_pre (priv);
GST_DEBUG ("DEBUG: gmip_find_format: iterating");
- while ((priv->format == NULL) &&
- gst_bin_iterate (GST_BIN (priv->pipeline)))
- GMI_DEBUG("+");
- GMI_DEBUG("\n");
+ while ((priv->format == NULL) && gst_bin_iterate (GST_BIN (priv->pipeline)))
+ GMI_DEBUG ("+");
+ GMI_DEBUG ("\n");
gmip_find_track_format_post (priv);
return TRUE;
}
-
-
diff --git a/gst-libs/gst/media-info/media-info-priv.h b/gst-libs/gst/media-info/media-info-priv.h
index 81ee24ab..8f0f453f 100644
--- a/gst-libs/gst/media-info/media-info-priv.h
+++ b/gst-libs/gst/media-info/media-info-priv.h
@@ -72,69 +72,65 @@ struct GstMediaInfoPriv
gint metadata_iters;
GstTagList *streaminfo;
- GstElement *pipeline; /* will be != NULL during collection */
- gchar *pipeline_desc; /* will be != NULL during collection */
- GstElement *fakesink; /* so we can get caps from the
- decoder sink pad */
- gchar *source_name; /* type of element used as source */
+ GstElement *pipeline; /* will be != NULL during collection */
+ gchar *pipeline_desc; /* will be != NULL during collection */
+ GstElement *fakesink; /* so we can get caps from the
+ decoder sink pad */
+ gchar *source_name; /* type of element used as source */
GstElement *source;
- GstPad *source_pad; /* pad for querying encoded caps */
+ GstPad *source_pad; /* pad for querying encoded caps */
GstElement *decoder;
- GstPad *decoder_pad; /* pad for querying decoded caps */
- GstElement *decontainer; /* element to typefind in containers */
+ GstPad *decoder_pad; /* pad for querying decoded caps */
+ GstElement *decontainer; /* element to typefind in containers */
- GstMediaInfoState state; /* current state of state machine */
- gchar *location; /* location set on the info object */
- guint16 flags; /* flags supplied for detection */
- GstMediaInfoTrack *current_track; /* track pointer under inspection */
- glong current_track_num; /* current track under inspection */
+ GstMediaInfoState state; /* current state of state machine */
+ gchar *location; /* location set on the info object */
+ guint16 flags; /* flags supplied for detection */
+ GstMediaInfoTrack *current_track; /* track pointer under inspection */
+ glong current_track_num; /* current track under inspection */
- GstMediaInfoStream *stream; /* total stream properties */
- char *cache; /* location of cache */
+ GstMediaInfoStream *stream; /* total stream properties */
+ char *cache; /* location of cache */
- GError *error; /* error for creation problems */
+ GError *error; /* error for creation problems */
};
/* declarations */
-GstMediaInfoStream *
- gmi_stream_new (void);
-void gmi_stream_free (GstMediaInfoStream *stream);
-
-GstMediaInfoTrack *
- gmi_track_new (void);
-
-void gmip_reset (GstMediaInfoPriv *priv);
-gboolean gmip_init (GstMediaInfoPriv *priv, GError **error);
-
-void gmi_clear_decoder (GstMediaInfo *info);
-
-gboolean gmi_seek_to_track (GstMediaInfo *info,
- long track);
-
-gboolean gmi_set_mime (GstMediaInfo *info,
- const char *mime);
-
-void deep_notify_callback (GObject *object,
- GstObject *origin,
- GParamSpec *pspec,
- GstMediaInfoPriv *priv);
-void found_tag_callback (GObject *pipeline, GstElement *source, GstTagList *tags, GstMediaInfoPriv *priv);
-void error_callback (GObject *element, GstElement *source, GError *error, gchar *debug, GstMediaInfoPriv *priv);
-
-gboolean gmip_find_type_pre (GstMediaInfoPriv *priv, GError **error);
-gboolean gmip_find_type_post (GstMediaInfoPriv *priv);
-gboolean gmip_find_type (GstMediaInfoPriv *priv, GError **error);
-gboolean gmip_find_stream_pre (GstMediaInfoPriv *priv);
-gboolean gmip_find_stream_post (GstMediaInfoPriv *priv);
-gboolean gmip_find_stream (GstMediaInfoPriv *priv);
-gboolean gmip_find_track_metadata_pre (GstMediaInfoPriv *priv);
-gboolean gmip_find_track_metadata_post (GstMediaInfoPriv *priv);
-gboolean gmip_find_track_metadata (GstMediaInfoPriv *priv);
-gboolean gmip_find_track_streaminfo_pre (GstMediaInfoPriv *priv);
-gboolean gmip_find_track_streaminfo_post (GstMediaInfoPriv *priv);
-gboolean gmip_find_track_streaminfo (GstMediaInfoPriv *priv);
-gboolean gmip_find_track_format_pre (GstMediaInfoPriv *priv);
-gboolean gmip_find_track_format_post (GstMediaInfoPriv *priv);
-gboolean gmip_find_track_format (GstMediaInfoPriv *priv);
+GstMediaInfoStream *gmi_stream_new (void);
+void gmi_stream_free (GstMediaInfoStream * stream);
+
+GstMediaInfoTrack *gmi_track_new (void);
+
+void gmip_reset (GstMediaInfoPriv * priv);
+gboolean gmip_init (GstMediaInfoPriv * priv, GError ** error);
+
+void gmi_clear_decoder (GstMediaInfo * info);
+
+gboolean gmi_seek_to_track (GstMediaInfo * info, long track);
+
+gboolean gmi_set_mime (GstMediaInfo * info, const char *mime);
+
+void deep_notify_callback (GObject * object,
+ GstObject * origin, GParamSpec * pspec, GstMediaInfoPriv * priv);
+void found_tag_callback (GObject * pipeline, GstElement * source,
+ GstTagList * tags, GstMediaInfoPriv * priv);
+void error_callback (GObject * element, GstElement * source, GError * error,
+ gchar * debug, GstMediaInfoPriv * priv);
+
+gboolean gmip_find_type_pre (GstMediaInfoPriv * priv, GError ** error);
+gboolean gmip_find_type_post (GstMediaInfoPriv * priv);
+gboolean gmip_find_type (GstMediaInfoPriv * priv, GError ** error);
+gboolean gmip_find_stream_pre (GstMediaInfoPriv * priv);
+gboolean gmip_find_stream_post (GstMediaInfoPriv * priv);
+gboolean gmip_find_stream (GstMediaInfoPriv * priv);
+gboolean gmip_find_track_metadata_pre (GstMediaInfoPriv * priv);
+gboolean gmip_find_track_metadata_post (GstMediaInfoPriv * priv);
+gboolean gmip_find_track_metadata (GstMediaInfoPriv * priv);
+gboolean gmip_find_track_streaminfo_pre (GstMediaInfoPriv * priv);
+gboolean gmip_find_track_streaminfo_post (GstMediaInfoPriv * priv);
+gboolean gmip_find_track_streaminfo (GstMediaInfoPriv * priv);
+gboolean gmip_find_track_format_pre (GstMediaInfoPriv * priv);
+gboolean gmip_find_track_format_post (GstMediaInfoPriv * priv);
+gboolean gmip_find_track_format (GstMediaInfoPriv * priv);
#endif /* __GST_MEDIA_INFO_PRIV_H__ */
diff --git a/gst-libs/gst/media-info/media-info-test.c b/gst-libs/gst/media-info/media-info-test.c
index 496267d9..67a16cdc 100644
--- a/gst-libs/gst/media-info/media-info-test.c
+++ b/gst-libs/gst/media-info/media-info-test.c
@@ -5,7 +5,7 @@
#include "media-info.h"
static void
-print_tag (const GstTagList *list, const gchar *tag, gpointer unused)
+print_tag (const GstTagList * list, const gchar * tag, gpointer unused)
{
gint i, count;
@@ -17,8 +17,8 @@ print_tag (const GstTagList *list, const gchar *tag, gpointer unused)
if (gst_tag_get_type (tag) == G_TYPE_STRING) {
g_assert (gst_tag_list_get_string_index (list, tag, i, &str));
} else {
- str = g_strdup_value_contents (
- gst_tag_list_get_value_index (list, tag, i));
+ str =
+ g_strdup_value_contents (gst_tag_list_get_value_index (list, tag, i));
}
if (i == 0) {
@@ -32,7 +32,7 @@ print_tag (const GstTagList *list, const gchar *tag, gpointer unused)
}
static void
-info_print (GstMediaInfoStream *stream)
+info_print (GstMediaInfoStream * stream)
{
int i;
GList *p;
@@ -40,17 +40,15 @@ info_print (GstMediaInfoStream *stream)
g_print ("- mime type: %s\n", stream->mime);
g_print ("- length: %.3f seconds\n",
- (gdouble) stream->length_time / GST_SECOND);
+ (gdouble) stream->length_time / GST_SECOND);
g_print ("- bitrate: %.3f kbps\n", stream->bitrate / 1000.0);
g_print ("- number of tracks: %ld\n", stream->length_tracks);
p = stream->tracks;
- if (p == NULL)
- {
+ if (p == NULL) {
g_print ("- no track information, probably an error\n");
return;
}
- for (i = 0; i < stream->length_tracks; ++i)
- {
+ for (i = 0; i < stream->length_tracks; ++i) {
g_print ("- track %d\n", i);
track = (GstMediaInfoTrack *) p->data;
g_print (" - metadata:\n");
@@ -80,16 +78,14 @@ main (int argc, char *argv[])
gst_init (&argc, &argv);
info = gst_media_info_new (&error);
- if (error != NULL)
- {
+ if (error != NULL) {
g_print ("Error creating media-info object: %s\n", error->message);
g_error_free (error);
return -1;
}
g_assert (G_IS_OBJECT (info));
- if (!gst_media_info_set_source (info, "gnomevfssrc", &error))
- {
+ if (!gst_media_info_set_source (info, "gnomevfssrc", &error)) {
g_print ("Could not set gnomevfssrc as a source\n");
g_print ("reason: %s\n", error->message);
g_error_free (error);
@@ -97,19 +93,18 @@ main (int argc, char *argv[])
}
g_print ("stream: %p, &stream: %p\n", stream, &stream);
- for (i = 1; i < argc; ++i)
- {
+ for (i = 1; i < argc; ++i) {
/*
- stream = gst_media_info_read (info, argv[i], GST_MEDIA_INFO_ALL);
- */
+ stream = gst_media_info_read (info, argv[i], GST_MEDIA_INFO_ALL);
+ */
gst_media_info_read_with_idler (info, argv[i], GST_MEDIA_INFO_ALL, &error);
while (gst_media_info_read_idler (info, &stream, &error) && stream == NULL)
- /* keep idling */ g_print ("+");
+ /* keep idling */
+ g_print ("+");
g_print ("\nFILE: %s\n", argv[i]);
g_print ("stream: %p, &stream: %p\n", stream, &stream);
- if (error)
- {
+ if (error) {
g_print ("Error reading media info: %s\n", error->message);
g_error_free (error);
}
diff --git a/gst-libs/gst/media-info/media-info.c b/gst-libs/gst/media-info/media-info.c
index 902b6cef..4f995359 100644
--- a/gst-libs/gst/media-info/media-info.c
+++ b/gst-libs/gst/media-info/media-info.c
@@ -26,12 +26,11 @@
#include "media-info.h"
#include "media-info-priv.h"
-static void gst_media_info_class_init (GstMediaInfoClass *klass);
-static void gst_media_info_instance_init (GstMediaInfo *info);
+static void gst_media_info_class_init (GstMediaInfoClass * klass);
+static void gst_media_info_instance_init (GstMediaInfo * info);
-static void gst_media_info_get_property (GObject *object, guint prop_id,
- GValue *value,
- GParamSpec *pspec);
+static void gst_media_info_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec);
static gboolean _media_info_inited = FALSE;
@@ -64,6 +63,7 @@ GQuark
gst_media_info_error_quark (void)
{
static GQuark quark = 0;
+
if (quark == 0)
quark = g_quark_from_static_string ("gst-media-info-error-quark");
return quark;
@@ -86,11 +86,12 @@ GST_DEBUG_CATEGORY (gst_media_info_debug);
void
gst_media_info_init (void)
{
- if (_media_info_inited) return;
+ if (_media_info_inited)
+ return;
/* register our debugging category */
GST_DEBUG_CATEGORY_INIT (gst_media_info_debug, "GST_MEDIA_INFO", 0,
- "GStreamer media-info library");
+ "GStreamer media-info library");
GST_DEBUG ("Initialized media-info library");
_media_info_inited = TRUE;
}
@@ -99,8 +100,8 @@ GType
gst_media_info_get_type (void)
{
static GType gst_media_info_type = 0;
- if (!gst_media_info_type)
- {
+
+ if (!gst_media_info_type) {
static const GTypeInfo gst_media_info_info = {
sizeof (GstMediaInfoClass),
(GBaseInitFunc) NULL,
@@ -113,14 +114,13 @@ gst_media_info_get_type (void)
NULL
};
gst_media_info_type = g_type_register_static (G_TYPE_OBJECT,
- "GstMediaInfo",
- &gst_media_info_info, 0);
+ "GstMediaInfo", &gst_media_info_info, 0);
}
return gst_media_info_type;
}
static void
-gst_media_info_class_init (GstMediaInfoClass *klass)
+gst_media_info_class_init (GstMediaInfoClass * klass)
{
GObjectClass *g_object_class = G_OBJECT_CLASS (klass);
@@ -129,36 +129,36 @@ gst_media_info_class_init (GstMediaInfoClass *klass)
/*
- object_class->finalize = gst_media_info_finalize;
- object_class->dispose = gst_media_info_dispose;
- */
+ object_class->finalize = gst_media_info_finalize;
+ object_class->dispose = gst_media_info_dispose;
+ */
/*
- g_object_class->set_property = gst_media_info_set_property;
- */
+ g_object_class->set_property = gst_media_info_set_property;
+ */
g_object_class->get_property = gst_media_info_get_property;
klass->media_info_signal = NULL;
- gst_media_info_signals [MEDIA_INFO_SIGNAL] =
- g_signal_new ("media-info",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstMediaInfoClass, media_info_signal),
- NULL, NULL,
- gst_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ gst_media_info_signals[MEDIA_INFO_SIGNAL] =
+ g_signal_new ("media-info",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GstMediaInfoClass, media_info_signal),
+ NULL, NULL, gst_marshal_VOID__VOID, G_TYPE_NONE, 0);
}
static void
-gst_media_info_instance_init (GstMediaInfo *info)
+gst_media_info_instance_init (GstMediaInfo * info)
{
GError **error;
info->priv = g_new0 (GstMediaInfoPriv, 1);
error = &info->priv->error;
- if (!_media_info_inited) { gst_media_info_init (); }
+ if (!_media_info_inited) {
+ gst_media_info_init ();
+ }
gmip_init (info->priv, error);
gmip_reset (info->priv);
@@ -166,13 +166,12 @@ gst_media_info_instance_init (GstMediaInfo *info)
/* get/set */
static void
-gst_media_info_get_property (GObject *object, guint prop_id,
- GValue *value, GParamSpec *pspec)
+gst_media_info_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec)
{
GstMediaInfo *info = GST_MEDIA_INFO (object);
- switch (prop_id)
- {
+ switch (prop_id) {
case PROP_SOURCE:
g_value_set_string (value, info->priv->source_name);
break;
@@ -183,21 +182,17 @@ gst_media_info_get_property (GObject *object, guint prop_id,
}
GstMediaInfo *
-gst_media_info_new (GError **error)
+gst_media_info_new (GError ** error)
{
GstMediaInfo *info = g_object_new (GST_MEDIA_INFO_TYPE, NULL);
- if (info->priv->error)
- {
- if (error)
- {
+ if (info->priv->error) {
+ if (error) {
*error = info->priv->error;
info->priv->error = NULL;
- }
- else
- {
+ } else {
g_warning ("Error creating GstMediaInfo object.\n%s",
- info->priv->error->message);
+ info->priv->error->message);
g_error_free (info->priv->error);
}
}
@@ -208,7 +203,8 @@ gst_media_info_new (GError **error)
* public methods
*/
gboolean
-gst_media_info_set_source (GstMediaInfo *info, const char *source, GError **error)
+gst_media_info_set_source (GstMediaInfo * info, const char *source,
+ GError ** error)
{
info->priv->source_name = g_strdup (source);
return TRUE;
@@ -221,12 +217,12 @@ gst_media_info_set_source (GstMediaInfo *info, const char *source, GError **erro
* previous one is done ?
*/
void
-gst_media_info_read_with_idler (GstMediaInfo *info, const char *location,
- guint16 flags, GError **error)
+gst_media_info_read_with_idler (GstMediaInfo * info, const char *location,
+ guint16 flags, GError ** error)
{
GstMediaInfoPriv *priv = info->priv;
- gmip_reset (info->priv); /* reset all structs */
+ gmip_reset (info->priv); /* reset all structs */
priv->location = g_strdup (location);
priv->flags = flags;
}
@@ -236,12 +232,14 @@ gst_media_info_read_with_idler (GstMediaInfo *info, const char *location,
* returns: TRUE if it was able to idle, FALSE if there was an error
*/
gboolean
-gst_media_info_read_idler (GstMediaInfo *info, GstMediaInfoStream **streamp, GError **error)
+gst_media_info_read_idler (GstMediaInfo * info, GstMediaInfoStream ** streamp,
+ GError ** error)
{
GstMediaInfoPriv *priv;
/* if it's NULL then we're sure something went wrong higher up) */
- if (info == NULL) return FALSE;
+ if (info == NULL)
+ return FALSE;
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
priv = info->priv;
@@ -249,15 +247,13 @@ gst_media_info_read_idler (GstMediaInfo *info, GstMediaInfoStream **streamp, GEr
g_assert (streamp != NULL);
g_assert (priv);
- switch (priv->state)
- {
+ switch (priv->state) {
case GST_MEDIA_INFO_STATE_NULL:
/* make sure we have a source */
- if (!priv->source_name)
- {
- *error = g_error_new (GST_MEDIA_INFO_ERROR, 0,
- "No source set on media info.");
- return FALSE;
+ if (!priv->source_name) {
+ *error = g_error_new (GST_MEDIA_INFO_ERROR, 0,
+ "No source set on media info.");
+ return FALSE;
}
/* need to find type */
@@ -269,29 +265,27 @@ gst_media_info_read_idler (GstMediaInfo *info, GstMediaInfoStream **streamp, GEr
gchar *mime;
GST_LOG ("STATE_TYPEFIND");
- if ((priv->type == NULL) && gst_bin_iterate (GST_BIN (priv->pipeline)))
- {
+ if ((priv->type == NULL) && gst_bin_iterate (GST_BIN (priv->pipeline))) {
GST_DEBUG ("iterating while in STATE_TYPEFIND");
- GMI_DEBUG("?");
- return TRUE;
+ GMI_DEBUG ("?");
+ return TRUE;
}
- if (priv->type == NULL)
- {
- g_warning ("Couldn't find type\n");
+ if (priv->type == NULL) {
+ g_warning ("Couldn't find type\n");
return FALSE;
}
/* do the state transition */
GST_DEBUG ("doing find_type_post");
gmip_find_type_post (priv);
GST_DEBUG ("finding out mime type");
- mime = g_strdup (gst_structure_get_name (
- gst_caps_get_structure(priv->type, 0)));
+ mime =
+ g_strdup (gst_structure_get_name (gst_caps_get_structure (priv->type,
+ 0)));
GST_DEBUG ("found out mime type: %s", mime);
- if (!gmi_set_mime (info, mime))
- {
- /* FIXME: pop up error */
- GST_DEBUG ("no decoder pipeline found for mime %s", mime);
- return FALSE;
+ if (!gmi_set_mime (info, mime)) {
+ /* FIXME: pop up error */
+ GST_DEBUG ("no decoder pipeline found for mime %s", mime);
+ return FALSE;
}
priv->stream = gmi_stream_new ();
GST_DEBUG ("new stream: %p", priv->stream);
@@ -303,14 +297,12 @@ gst_media_info_read_idler (GstMediaInfo *info, GstMediaInfoStream **streamp, GEr
case GST_MEDIA_INFO_STATE_STREAM:
{
GST_LOG ("STATE_STREAM");
- if ((priv->format == NULL) && gst_bin_iterate (GST_BIN (priv->pipeline)))
- {
- GMI_DEBUG("?");
- return TRUE;
+ if ((priv->format == NULL) && gst_bin_iterate (GST_BIN (priv->pipeline))) {
+ GMI_DEBUG ("?");
+ return TRUE;
}
- if (priv->format == NULL)
- {
- g_warning ("Couldn't find format\n");
+ if (priv->format == NULL) {
+ g_warning ("Couldn't find format\n");
return FALSE;
}
/* do state transition; stream -> first track metadata */
@@ -320,26 +312,25 @@ gst_media_info_read_idler (GstMediaInfo *info, GstMediaInfoStream **streamp, GEr
gmip_find_track_metadata_pre (priv);
return TRUE;
}
- /* these ones are repeated per track */
+ /* these ones are repeated per track */
case GST_MEDIA_INFO_STATE_METADATA:
{
if ((priv->metadata == NULL) &&
gst_bin_iterate (GST_BIN (priv->pipeline)) &&
- priv->metadata_iters < MAX_METADATA_ITERS)
- {
- GMI_DEBUG("?");
+ priv->metadata_iters < MAX_METADATA_ITERS) {
+ GMI_DEBUG ("?");
priv->metadata_iters++;
- return TRUE;
+ return TRUE;
}
if (priv->metadata_iters == MAX_METADATA_ITERS)
- g_print ("iterated a few times, didn't find metadata\n");
- if (priv->metadata == NULL)
- {
+ g_print ("iterated a few times, didn't find metadata\n");
+ if (priv->metadata == NULL) {
/* this is not a permanent failure */
- GST_DEBUG ("Couldn't find metadata");
+ GST_DEBUG ("Couldn't find metadata");
}
GST_DEBUG ("found metadata of track %ld", priv->current_track_num);
- if (!gmip_find_track_metadata_post (priv)) return FALSE;
+ if (!gmip_find_track_metadata_post (priv))
+ return FALSE;
GST_DEBUG ("METADATA: going to STREAMINFO\n");
priv->state = GST_MEDIA_INFO_STATE_STREAMINFO;
return gmip_find_track_streaminfo_pre (priv);
@@ -347,53 +338,47 @@ gst_media_info_read_idler (GstMediaInfo *info, GstMediaInfoStream **streamp, GEr
case GST_MEDIA_INFO_STATE_STREAMINFO:
{
if ((priv->streaminfo == NULL) &&
- gst_bin_iterate (GST_BIN (priv->pipeline)))
- {
- GMI_DEBUG("?");
- return TRUE;
+ gst_bin_iterate (GST_BIN (priv->pipeline))) {
+ GMI_DEBUG ("?");
+ return TRUE;
}
- if (priv->streaminfo == NULL)
- {
+ if (priv->streaminfo == NULL) {
/* this is not a permanent failure */
- GST_DEBUG ("Couldn't find streaminfo");
- }
- else
- GST_DEBUG ("found streaminfo of track %ld", priv->current_track_num);
- if (!gmip_find_track_streaminfo_post (priv)) return FALSE;
+ GST_DEBUG ("Couldn't find streaminfo");
+ } else
+ GST_DEBUG ("found streaminfo of track %ld", priv->current_track_num);
+ if (!gmip_find_track_streaminfo_post (priv))
+ return FALSE;
priv->state = GST_MEDIA_INFO_STATE_FORMAT;
return gmip_find_track_format_pre (priv);
}
case GST_MEDIA_INFO_STATE_FORMAT:
{
- if ((priv->format == NULL) &&
- gst_bin_iterate (GST_BIN (priv->pipeline)))
- {
- GMI_DEBUG("?");
- return TRUE;
+ if ((priv->format == NULL) && gst_bin_iterate (GST_BIN (priv->pipeline))) {
+ GMI_DEBUG ("?");
+ return TRUE;
}
- if (priv->format == NULL)
- {
- g_warning ("Couldn't find format\n");
+ if (priv->format == NULL) {
+ g_warning ("Couldn't find format\n");
return FALSE;
}
GST_DEBUG ("found format of track %ld", priv->current_track_num);
- if (!gmip_find_track_format_post (priv)) return FALSE;
+ if (!gmip_find_track_format_post (priv))
+ return FALSE;
/* save the track info */
priv->stream->tracks = g_list_append (priv->stream->tracks,
- priv->current_track);
+ priv->current_track);
/* these alloc'd data types have been handed off */
priv->current_track = NULL;
priv->location = NULL;
/* now see if we need to seek to a next track or not */
priv->current_track_num++;
- if (priv->current_track_num < priv->stream->length_tracks)
- {
- gmi_seek_to_track (info, priv->current_track_num);
- priv->current_track = gmi_track_new ();
- if (!gmip_find_track_metadata_pre (priv))
- {
+ if (priv->current_track_num < priv->stream->length_tracks) {
+ gmi_seek_to_track (info, priv->current_track_num);
+ priv->current_track = gmi_track_new ();
+ if (!gmip_find_track_metadata_pre (priv)) {
g_free (priv->current_track);
- return FALSE;
+ return FALSE;
}
priv->state = GST_MEDIA_INFO_STATE_METADATA;
return TRUE;
@@ -407,24 +392,26 @@ gst_media_info_read_idler (GstMediaInfo *info, GstMediaInfoStream **streamp, GEr
}
case GST_MEDIA_INFO_STATE_DONE:
return TRUE;
- default:
+ default:
g_warning ("don't know what to do\n");
return FALSE;
- }
+ }
}
/* main function
* read all possible info from the file pointed to by location
* use flags to limit the type of information searched for */
GstMediaInfoStream *
-gst_media_info_read (GstMediaInfo *info, const char *location, guint16 flags, GError **error)
+gst_media_info_read (GstMediaInfo * info, const char *location, guint16 flags,
+ GError ** error)
{
GstMediaInfoStream *stream = NULL;
gst_media_info_read_with_idler (info, location, flags, error);
- if (*error) return FALSE;
+ if (*error)
+ return FALSE;
while (gst_media_info_read_idler (info, &stream, error) && stream == NULL)
- /* keep looping */;
+ /* keep looping */ ;
if (*error)
return NULL;
diff --git a/gst-libs/gst/media-info/media-info.h b/gst-libs/gst/media-info/media-info.h
index c134999d..bbbcce2b 100644
--- a/gst-libs/gst/media-info/media-info.h
+++ b/gst-libs/gst/media-info/media-info.h
@@ -23,11 +23,9 @@
#include <gst/gst.h>
-G_BEGIN_DECLS
-
-typedef struct GstMediaInfoPriv GstMediaInfoPriv;
-typedef struct _GstMediaInfo GstMediaInfo;
-typedef struct _GstMediaInfoClass GstMediaInfoClass;
+G_BEGIN_DECLS typedef struct GstMediaInfoPriv GstMediaInfoPriv;
+typedef struct _GstMediaInfo GstMediaInfo;
+typedef struct _GstMediaInfoClass GstMediaInfoClass;
struct _GstMediaInfo
{
@@ -43,8 +41,9 @@ struct _GstMediaInfoClass
GObjectClass parent_class;
/* signals */
- void (*media_info_signal) (GstMediaInfo *gst_media_info);
- void (*error_signal) (GstMediaInfo *gst_media_info, GError *error, const gchar *debug);
+ void (*media_info_signal) (GstMediaInfo * gst_media_info);
+ void (*error_signal) (GstMediaInfo * gst_media_info, GError * error,
+ const gchar * debug);
gpointer _gst_reserved[GST_PADDING];
};
@@ -100,34 +99,25 @@ typedef struct
#define GST_MEDIA_INFO_FORMAT 1 << 5
#define GST_MEDIA_INFO_ALL ((1 << 6) - 1)
-GQuark gst_media_info_error_quark (void);
-
-void gst_media_info_init (void);
-GType gst_media_info_get_type (void);
-
-GstMediaInfo * gst_media_info_new (GError **error);
-
-gboolean gst_media_info_set_source (GstMediaInfo *info,
- const char *source,
- GError **error);
-void gst_media_info_read_with_idler (GstMediaInfo *media_info,
- const char *location,
- guint16 GST_MEDIA_INFO_FLAGS,
- GError **error);
-gboolean gst_media_info_read_idler (GstMediaInfo *media_info,
- GstMediaInfoStream **streamp,
- GError **error);
-GstMediaInfoStream *
- gst_media_info_read (GstMediaInfo *media_info,
- const char *location,
- guint16 GST_MEDIA_INFO_FLAGS,
- GError **error);
-gboolean gst_media_info_read_many (GstMediaInfo *media_info,
- GList *locations,
- guint16 GST_MEDIA_INFO_FLAGS,
- GError **error);
-GstCaps * gst_media_info_get_next (GstMediaInfo *media_info,
- GError **error);
+GQuark gst_media_info_error_quark (void);
+
+void gst_media_info_init (void);
+GType gst_media_info_get_type (void);
+
+GstMediaInfo *gst_media_info_new (GError ** error);
+
+gboolean gst_media_info_set_source (GstMediaInfo * info,
+ const char *source, GError ** error);
+void gst_media_info_read_with_idler (GstMediaInfo * media_info,
+ const char *location, guint16 GST_MEDIA_INFO_FLAGS, GError ** error);
+gboolean gst_media_info_read_idler (GstMediaInfo * media_info,
+ GstMediaInfoStream ** streamp, GError ** error);
+GstMediaInfoStream *gst_media_info_read (GstMediaInfo * media_info,
+ const char *location, guint16 GST_MEDIA_INFO_FLAGS, GError ** error);
+gboolean gst_media_info_read_many (GstMediaInfo * media_info,
+ GList * locations, guint16 GST_MEDIA_INFO_FLAGS, GError ** error);
+GstCaps *gst_media_info_get_next (GstMediaInfo * media_info, GError ** error);
+
/*
* FIXME: reset ?
gboolean gst_media_info_write (GstMediaInfo *media_info,
@@ -136,5 +126,4 @@ gboolean gst_media_info_write (GstMediaInfo *media_info,
*/
G_END_DECLS
-
#endif /* __GST_MEDIA_INFO_H__ */
diff --git a/gst-libs/gst/mixer/mixer.c b/gst-libs/gst/mixer/mixer.c
index 0c1d6e0f..a9034f60 100644
--- a/gst-libs/gst/mixer/mixer.c
+++ b/gst-libs/gst/mixer/mixer.c
@@ -26,14 +26,15 @@
#include "mixer.h"
#include "mixer-marshal.h"
-enum {
+enum
+{
MUTE_TOGGLED,
RECORD_TOGGLED,
VOLUME_CHANGED,
LAST_SIGNAL
};
-static void gst_mixer_class_init (GstMixerClass *klass);
+static void gst_mixer_class_init (GstMixerClass * klass);
static guint gst_mixer_signals[LAST_SIGNAL] = { 0 };
@@ -56,48 +57,47 @@ gst_mixer_get_type (void)
};
gst_mixer_type = g_type_register_static (G_TYPE_INTERFACE,
- "GstMixer",
- &gst_mixer_info, 0);
+ "GstMixer", &gst_mixer_info, 0);
g_type_interface_add_prerequisite (gst_mixer_type,
- GST_TYPE_IMPLEMENTS_INTERFACE);
+ GST_TYPE_IMPLEMENTS_INTERFACE);
}
return gst_mixer_type;
}
static void
-gst_mixer_class_init (GstMixerClass *klass)
+gst_mixer_class_init (GstMixerClass * klass)
{
static gboolean initialized = FALSE;
-
+
if (!initialized) {
gst_mixer_signals[RECORD_TOGGLED] =
- g_signal_new ("record-toggled",
- GST_TYPE_MIXER, G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstMixerClass, record_toggled),
- NULL, NULL,
- gst_mixer_marshal_VOID__OBJECT_BOOLEAN, G_TYPE_NONE, 2,
- GST_TYPE_MIXER_TRACK, G_TYPE_BOOLEAN);
+ g_signal_new ("record-toggled",
+ GST_TYPE_MIXER, G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GstMixerClass, record_toggled),
+ NULL, NULL,
+ gst_mixer_marshal_VOID__OBJECT_BOOLEAN, G_TYPE_NONE, 2,
+ GST_TYPE_MIXER_TRACK, G_TYPE_BOOLEAN);
gst_mixer_signals[MUTE_TOGGLED] =
- g_signal_new ("mute-toggled",
- GST_TYPE_MIXER, G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstMixerClass, mute_toggled),
- NULL, NULL,
- gst_mixer_marshal_VOID__OBJECT_BOOLEAN, G_TYPE_NONE, 2,
- GST_TYPE_MIXER_TRACK, G_TYPE_BOOLEAN);
+ g_signal_new ("mute-toggled",
+ GST_TYPE_MIXER, G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GstMixerClass, mute_toggled),
+ NULL, NULL,
+ gst_mixer_marshal_VOID__OBJECT_BOOLEAN, G_TYPE_NONE, 2,
+ GST_TYPE_MIXER_TRACK, G_TYPE_BOOLEAN);
gst_mixer_signals[VOLUME_CHANGED] =
- g_signal_new ("volume-changed",
- GST_TYPE_MIXER, G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstMixerClass, volume_changed),
- NULL, NULL,
- gst_mixer_marshal_VOID__OBJECT_POINTER, G_TYPE_NONE, 2,
- GST_TYPE_MIXER_TRACK, G_TYPE_POINTER);
-
+ g_signal_new ("volume-changed",
+ GST_TYPE_MIXER, G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GstMixerClass, volume_changed),
+ NULL, NULL,
+ gst_mixer_marshal_VOID__OBJECT_POINTER, G_TYPE_NONE, 2,
+ GST_TYPE_MIXER_TRACK, G_TYPE_POINTER);
+
initialized = TRUE;
}
klass->mixer_type = GST_MIXER_SOFTWARE;
-
+
/* default virtual functions */
klass->list_tracks = NULL;
klass->set_volume = NULL;
@@ -119,7 +119,7 @@ gst_mixer_class_init (GstMixerClass *klass)
*/
const GList *
-gst_mixer_list_tracks (GstMixer *mixer)
+gst_mixer_list_tracks (GstMixer * mixer)
{
GstMixerClass *klass = GST_MIXER_GET_CLASS (mixer);
@@ -146,9 +146,7 @@ gst_mixer_list_tracks (GstMixer *mixer)
*/
void
-gst_mixer_set_volume (GstMixer *mixer,
- GstMixerTrack *track,
- gint *volumes)
+gst_mixer_set_volume (GstMixer * mixer, GstMixerTrack * track, gint * volumes)
{
GstMixerClass *klass = GST_MIXER_GET_CLASS (mixer);
@@ -169,9 +167,7 @@ gst_mixer_set_volume (GstMixer *mixer,
*/
void
-gst_mixer_get_volume (GstMixer *mixer,
- GstMixerTrack *track,
- gint *volumes)
+gst_mixer_get_volume (GstMixer * mixer, GstMixerTrack * track, gint * volumes)
{
GstMixerClass *klass = GST_MIXER_GET_CLASS (mixer);
@@ -198,9 +194,7 @@ gst_mixer_get_volume (GstMixer *mixer,
*/
void
-gst_mixer_set_mute (GstMixer *mixer,
- GstMixerTrack *track,
- gboolean mute)
+gst_mixer_set_mute (GstMixer * mixer, GstMixerTrack * track, gboolean mute)
{
GstMixerClass *klass = GST_MIXER_GET_CLASS (mixer);
@@ -223,9 +217,7 @@ gst_mixer_set_mute (GstMixer *mixer,
*/
void
-gst_mixer_set_record (GstMixer *mixer,
- GstMixerTrack *track,
- gboolean record)
+gst_mixer_set_record (GstMixer * mixer, GstMixerTrack * track, gboolean record)
{
GstMixerClass *klass = GST_MIXER_GET_CLASS (mixer);
@@ -235,43 +227,30 @@ gst_mixer_set_record (GstMixer *mixer,
}
void
-gst_mixer_mute_toggled (GstMixer *mixer,
- GstMixerTrack *track,
- gboolean mute)
+gst_mixer_mute_toggled (GstMixer * mixer, GstMixerTrack * track, gboolean mute)
{
g_signal_emit (G_OBJECT (mixer),
- gst_mixer_signals[MUTE_TOGGLED], 0,
- track, mute);
+ gst_mixer_signals[MUTE_TOGGLED], 0, track, mute);
- g_signal_emit_by_name (G_OBJECT (track),
- "mute_toggled",
- mute);
+ g_signal_emit_by_name (G_OBJECT (track), "mute_toggled", mute);
}
void
-gst_mixer_record_toggled (GstMixer *mixer,
- GstMixerTrack *track,
- gboolean record)
+gst_mixer_record_toggled (GstMixer * mixer,
+ GstMixerTrack * track, gboolean record)
{
g_signal_emit (G_OBJECT (mixer),
- gst_mixer_signals[RECORD_TOGGLED], 0,
- track, record);
+ gst_mixer_signals[RECORD_TOGGLED], 0, track, record);
- g_signal_emit_by_name (G_OBJECT (track),
- "record_toggled",
- record);
+ g_signal_emit_by_name (G_OBJECT (track), "record_toggled", record);
}
void
-gst_mixer_volume_changed (GstMixer *mixer,
- GstMixerTrack *track,
- gint *volumes)
+gst_mixer_volume_changed (GstMixer * mixer,
+ GstMixerTrack * track, gint * volumes)
{
g_signal_emit (G_OBJECT (mixer),
- gst_mixer_signals[VOLUME_CHANGED], 0,
- track, volumes);
+ gst_mixer_signals[VOLUME_CHANGED], 0, track, volumes);
- g_signal_emit_by_name (G_OBJECT (track),
- "volume_changed",
- volumes);
+ g_signal_emit_by_name (G_OBJECT (track), "volume_changed", volumes);
}
diff --git a/gst-libs/gst/mixer/mixer.h b/gst-libs/gst/mixer/mixer.h
index 50ba3fd8..2caad164 100644
--- a/gst-libs/gst/mixer/mixer.h
+++ b/gst-libs/gst/mixer/mixer.h
@@ -27,7 +27,6 @@
#include <gst/mixer/mixer-enumtypes.h>
G_BEGIN_DECLS
-
#define GST_TYPE_MIXER \
(gst_mixer_get_type ())
#define GST_MIXER(obj) \
@@ -40,9 +39,7 @@ G_BEGIN_DECLS
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MIXER))
#define GST_MIXER_GET_CLASS(inst) \
(G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_MIXER, GstMixerClass))
-
#define GST_MIXER_TYPE(klass) (klass->mixer_type)
-
typedef struct _GstMixer GstMixer;
typedef enum
@@ -51,70 +48,52 @@ typedef enum
GST_MIXER_SOFTWARE
} GstMixerType;
-typedef struct _GstMixerClass {
+typedef struct _GstMixerClass
+{
GTypeInterface klass;
GstMixerType mixer_type;
-
+
/* virtual functions */
- const GList * (* list_tracks) (GstMixer *mixer);
+ const GList *(*list_tracks) (GstMixer * mixer);
- void (* set_volume) (GstMixer *mixer,
- GstMixerTrack *track,
- gint *volumes);
- void (* get_volume) (GstMixer *mixer,
- GstMixerTrack *track,
- gint *volumes);
+ void (*set_volume) (GstMixer * mixer, GstMixerTrack * track, gint * volumes);
+ void (*get_volume) (GstMixer * mixer, GstMixerTrack * track, gint * volumes);
- void (* set_mute) (GstMixer *mixer,
- GstMixerTrack *track,
- gboolean mute);
- void (* set_record) (GstMixer *mixer,
- GstMixerTrack *track,
- gboolean record);
+ void (*set_mute) (GstMixer * mixer, GstMixerTrack * track, gboolean mute);
+ void (*set_record) (GstMixer * mixer, GstMixerTrack * track, gboolean record);
/* signals */
- void (* mute_toggled) (GstMixer *mixer,
- GstMixerTrack *channel,
- gboolean mute);
- void (* record_toggled) (GstMixer *mixer,
- GstMixerTrack *channel,
- gboolean record);
- void (* volume_changed) (GstMixer *mixer,
- GstMixerTrack *channel,
- gint *volumes);
+ void (*mute_toggled) (GstMixer * mixer,
+ GstMixerTrack * channel, gboolean mute);
+ void (*record_toggled) (GstMixer * mixer,
+ GstMixerTrack * channel, gboolean record);
+ void (*volume_changed) (GstMixer * mixer,
+ GstMixerTrack * channel, gint * volumes);
gpointer _gst_reserved[GST_PADDING];
} GstMixerClass;
-GType gst_mixer_get_type (void);
+GType gst_mixer_get_type (void);
/* virtual class function wrappers */
-const GList * gst_mixer_list_tracks (GstMixer *mixer);
-void gst_mixer_set_volume (GstMixer *mixer,
- GstMixerTrack *track,
- gint *volumes);
-void gst_mixer_get_volume (GstMixer *mixer,
- GstMixerTrack *track,
- gint *volumes);
-void gst_mixer_set_mute (GstMixer *mixer,
- GstMixerTrack *track,
- gboolean mute);
-void gst_mixer_set_record (GstMixer *mixer,
- GstMixerTrack *track,
- gboolean record);
+const GList *gst_mixer_list_tracks (GstMixer * mixer);
+void gst_mixer_set_volume (GstMixer * mixer,
+ GstMixerTrack * track, gint * volumes);
+void gst_mixer_get_volume (GstMixer * mixer,
+ GstMixerTrack * track, gint * volumes);
+void gst_mixer_set_mute (GstMixer * mixer,
+ GstMixerTrack * track, gboolean mute);
+void gst_mixer_set_record (GstMixer * mixer,
+ GstMixerTrack * track, gboolean record);
/* trigger signals */
-void gst_mixer_mute_toggled (GstMixer *mixer,
- GstMixerTrack *track,
- gboolean mute);
-void gst_mixer_record_toggled (GstMixer *mixer,
- GstMixerTrack *track,
- gboolean record);
-void gst_mixer_volume_changed (GstMixer *mixer,
- GstMixerTrack *track,
- gint *volumes);
+void gst_mixer_mute_toggled (GstMixer * mixer,
+ GstMixerTrack * track, gboolean mute);
+void gst_mixer_record_toggled (GstMixer * mixer,
+ GstMixerTrack * track, gboolean record);
+void gst_mixer_volume_changed (GstMixer * mixer,
+ GstMixerTrack * track, gint * volumes);
G_END_DECLS
-
#endif /* __GST_MIXER_H__ */
diff --git a/gst-libs/gst/mixer/mixertrack.c b/gst-libs/gst/mixer/mixertrack.c
index 242b5915..af52aec8 100644
--- a/gst-libs/gst/mixer/mixertrack.c
+++ b/gst-libs/gst/mixer/mixertrack.c
@@ -25,7 +25,8 @@
#include "mixertrack.h"
-enum {
+enum
+{
/* FILL ME */
SIGNAL_VOLUME_CHANGED,
SIGNAL_RECORD_TOGGLED,
@@ -33,9 +34,9 @@ enum {
LAST_SIGNAL
};
-static void gst_mixer_track_class_init (GstMixerTrackClass *klass);
-static void gst_mixer_track_init (GstMixerTrack *mixer);
-static void gst_mixer_track_dispose (GObject *object);
+static void gst_mixer_track_class_init (GstMixerTrackClass * klass);
+static void gst_mixer_track_init (GstMixerTrack * mixer);
+static void gst_mixer_track_dispose (GObject * object);
static GObjectClass *parent_class = NULL;
static guint signals[LAST_SIGNAL] = { 0 };
@@ -61,47 +62,46 @@ gst_mixer_track_get_type (void)
gst_mixer_track_type =
g_type_register_static (G_TYPE_OBJECT,
- "GstMixerTrack",
- &mixer_track_info, 0);
+ "GstMixerTrack", &mixer_track_info, 0);
}
return gst_mixer_track_type;
}
static void
-gst_mixer_track_class_init (GstMixerTrackClass *klass)
+gst_mixer_track_class_init (GstMixerTrackClass * klass)
{
GObjectClass *object_klass = (GObjectClass *) klass;
parent_class = g_type_class_ref (G_TYPE_OBJECT);
signals[SIGNAL_RECORD_TOGGLED] =
- g_signal_new ("record_toggled", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstMixerTrackClass,
- record_toggled),
- NULL, NULL, g_cclosure_marshal_VOID__BOOLEAN,
- G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
+ g_signal_new ("record_toggled", G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GstMixerTrackClass,
+ record_toggled),
+ NULL, NULL, g_cclosure_marshal_VOID__BOOLEAN,
+ G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
signals[SIGNAL_MUTE_TOGGLED] =
- g_signal_new ("mute_toggled", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstMixerTrackClass,
- mute_toggled),
- NULL, NULL, g_cclosure_marshal_VOID__BOOLEAN,
- G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
+ g_signal_new ("mute_toggled", G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GstMixerTrackClass,
+ mute_toggled),
+ NULL, NULL, g_cclosure_marshal_VOID__BOOLEAN,
+ G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
signals[SIGNAL_VOLUME_CHANGED] =
- g_signal_new ("volume_changed", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstMixerTrackClass,
- volume_changed),
- NULL, NULL, g_cclosure_marshal_VOID__POINTER,
- G_TYPE_NONE, 1, G_TYPE_POINTER);
+ g_signal_new ("volume_changed", G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GstMixerTrackClass,
+ volume_changed),
+ NULL, NULL, g_cclosure_marshal_VOID__POINTER,
+ G_TYPE_NONE, 1, G_TYPE_POINTER);
object_klass->dispose = gst_mixer_track_dispose;
}
static void
-gst_mixer_track_init (GstMixerTrack *channel)
+gst_mixer_track_init (GstMixerTrack * channel)
{
channel->label = NULL;
channel->min_volume = channel->max_volume = 0;
@@ -110,7 +110,7 @@ gst_mixer_track_init (GstMixerTrack *channel)
}
static void
-gst_mixer_track_dispose (GObject *object)
+gst_mixer_track_dispose (GObject * object)
{
GstMixerTrack *channel = GST_MIXER_TRACK (object);
diff --git a/gst-libs/gst/mixer/mixertrack.h b/gst-libs/gst/mixer/mixertrack.h
index 0e05d9cb..872b0904 100644
--- a/gst-libs/gst/mixer/mixertrack.h
+++ b/gst-libs/gst/mixer/mixertrack.h
@@ -25,7 +25,6 @@
#include <gst/gst.h>
G_BEGIN_DECLS
-
#define GST_TYPE_MIXER_TRACK \
(gst_mixer_track_get_type ())
#define GST_MIXER_TRACK(obj) \
@@ -38,7 +37,6 @@ G_BEGIN_DECLS
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MIXER_TRACK))
#define GST_IS_MIXER_TRACK_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MIXER_TRACK))
-
/*
* Naming:
*
@@ -54,45 +52,41 @@ G_BEGIN_DECLS
* mixer, which means that setting this track will change
* the hearable volume on any output.
*/
-
-typedef enum {
- GST_MIXER_TRACK_INPUT = (1<<0),
- GST_MIXER_TRACK_OUTPUT = (1<<1),
- GST_MIXER_TRACK_MUTE = (1<<2),
- GST_MIXER_TRACK_RECORD = (1<<3),
- GST_MIXER_TRACK_MASTER = (1<<4),
- GST_MIXER_TRACK_SOFTWARE = (1<<5)
+ typedef enum
+{
+ GST_MIXER_TRACK_INPUT = (1 << 0),
+ GST_MIXER_TRACK_OUTPUT = (1 << 1),
+ GST_MIXER_TRACK_MUTE = (1 << 2),
+ GST_MIXER_TRACK_RECORD = (1 << 3),
+ GST_MIXER_TRACK_MASTER = (1 << 4),
+ GST_MIXER_TRACK_SOFTWARE = (1 << 5)
} GstMixerTrackFlags;
#define GST_MIXER_TRACK_HAS_FLAG(channel, flag) \
((channel)->flags & flag)
-typedef struct _GstMixerTrack {
- GObject parent;
+typedef struct _GstMixerTrack
+{
+ GObject parent;
- gchar *label;
+ gchar *label;
GstMixerTrackFlags flags;
- gint num_channels,
- min_volume,
- max_volume;
+ gint num_channels, min_volume, max_volume;
} GstMixerTrack;
-typedef struct _GstMixerTrackClass {
+typedef struct _GstMixerTrackClass
+{
GObjectClass parent;
/* signals */
- void (* mute_toggled) (GstMixerTrack *channel,
- gboolean mute);
- void (* record_toggled) (GstMixerTrack *channel,
- gboolean record);
- void (* volume_changed) (GstMixerTrack *channel,
- gint *volumes);
+ void (*mute_toggled) (GstMixerTrack * channel, gboolean mute);
+ void (*record_toggled) (GstMixerTrack * channel, gboolean record);
+ void (*volume_changed) (GstMixerTrack * channel, gint * volumes);
gpointer _gst_reserved[GST_PADDING];
} GstMixerTrackClass;
-GType gst_mixer_track_get_type (void);
+GType gst_mixer_track_get_type (void);
G_END_DECLS
-
#endif /* __GST_MIXER_TRACK_H__ */
diff --git a/gst-libs/gst/navigation/navigation.c b/gst-libs/gst/navigation/navigation.c
index e3333cba..35ae2ba5 100644
--- a/gst-libs/gst/navigation/navigation.c
+++ b/gst-libs/gst/navigation/navigation.c
@@ -25,7 +25,7 @@
#include <gst/navigation/navigation.h>
-static void gst_navigation_class_init (GstNavigationInterface *iface);
+static void gst_navigation_class_init (GstNavigationInterface * iface);
GType
gst_navigation_get_type (void)
@@ -46,22 +46,21 @@ gst_navigation_get_type (void)
};
gst_navigation_type = g_type_register_static (G_TYPE_INTERFACE,
- "GstNavigation",
- &gst_navigation_info, 0);
+ "GstNavigation", &gst_navigation_info, 0);
}
return gst_navigation_type;
}
static void
-gst_navigation_class_init (GstNavigationInterface *iface)
+gst_navigation_class_init (GstNavigationInterface * iface)
{
/* default virtual functions */
iface->send_event = NULL;
}
void
-gst_navigation_send_event (GstNavigation *navigation, GstStructure *structure)
+gst_navigation_send_event (GstNavigation * navigation, GstStructure * structure)
{
GstNavigationInterface *iface = GST_NAVIGATION_GET_IFACE (navigation);
@@ -71,25 +70,20 @@ gst_navigation_send_event (GstNavigation *navigation, GstStructure *structure)
}
void
-gst_navigation_send_key_event (GstNavigation *navigation, const char *event,
- const char *key)
+gst_navigation_send_key_event (GstNavigation * navigation, const char *event,
+ const char *key)
{
- gst_navigation_send_event (navigation, gst_structure_new (
- "application/x-gst-navigation",
- "event", G_TYPE_STRING, event,
- "key", G_TYPE_STRING, key, NULL));
+ gst_navigation_send_event (navigation,
+ gst_structure_new ("application/x-gst-navigation", "event", G_TYPE_STRING,
+ event, "key", G_TYPE_STRING, key, NULL));
}
void
-gst_navigation_send_mouse_event (GstNavigation *navigation, const char *event,
- int button, double x, double y)
+gst_navigation_send_mouse_event (GstNavigation * navigation, const char *event,
+ int button, double x, double y)
{
- gst_navigation_send_event (navigation, gst_structure_new (
- "application/x-gst-navigation",
- "event", G_TYPE_STRING, event,
- "button", G_TYPE_INT, button,
- "pointer_x", G_TYPE_DOUBLE, x,
- "pointer_y", G_TYPE_DOUBLE, y, NULL));
+ gst_navigation_send_event (navigation,
+ gst_structure_new ("application/x-gst-navigation", "event", G_TYPE_STRING,
+ event, "button", G_TYPE_INT, button, "pointer_x", G_TYPE_DOUBLE, x,
+ "pointer_y", G_TYPE_DOUBLE, y, NULL));
}
-
-
diff --git a/gst-libs/gst/navigation/navigation.h b/gst-libs/gst/navigation/navigation.h
index 5ccaf748..342ff9af 100644
--- a/gst-libs/gst/navigation/navigation.h
+++ b/gst-libs/gst/navigation/navigation.h
@@ -26,7 +26,6 @@
#include <gst/gst.h>
G_BEGIN_DECLS
-
#define GST_TYPE_NAVIGATION \
(gst_navigation_get_type ())
#define GST_NAVIGATION(obj) \
@@ -35,28 +34,28 @@ G_BEGIN_DECLS
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_NAVIGATION))
#define GST_NAVIGATION_GET_IFACE(obj) \
(G_TYPE_INSTANCE_GET_INTERFACE ((obj), GST_TYPE_NAVIGATION, GstNavigationInterface))
-
typedef struct _GstNavigation GstNavigation;
-typedef struct _GstNavigationInterface {
+typedef struct _GstNavigationInterface
+{
GTypeInterface g_iface;
/* virtual functions */
- void (*send_event) (GstNavigation *navigation, GstStructure *structure);
-
+ void (*send_event) (GstNavigation * navigation, GstStructure * structure);
+
gpointer _gst_reserved[GST_PADDING];
} GstNavigationInterface;
-GType gst_navigation_get_type (void);
+GType gst_navigation_get_type (void);
/* virtual class function wrappers */
-void gst_navigation_send_event (GstNavigation *navigation, GstStructure *structure);
+void gst_navigation_send_event (GstNavigation * navigation,
+ GstStructure * structure);
-void gst_navigation_send_key_event (GstNavigation *navigation,
- const char *event, const char *key);
-void gst_navigation_send_mouse_event (GstNavigation *navigation,
- const char *event, int button, double x, double y);
+void gst_navigation_send_key_event (GstNavigation * navigation,
+ const char *event, const char *key);
+void gst_navigation_send_mouse_event (GstNavigation * navigation,
+ const char *event, int button, double x, double y);
G_END_DECLS
-
#endif /* __GST_NAVIGATION_H__ */
diff --git a/gst-libs/gst/play/play.c b/gst-libs/gst/play/play.c
index f46fbabc..97ce3060 100644
--- a/gst-libs/gst/play/play.c
+++ b/gst-libs/gst/play/play.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
@@ -34,22 +34,23 @@ enum
LAST_SIGNAL
};
-struct _GstPlayPrivate {
+struct _GstPlayPrivate
+{
char *location;
-
+
GHashTable *elements;
-
+
gint64 time_nanos;
gint64 length_nanos;
-
+
gint get_length_attempt;
-
- gint tick_unblock_remaining; /* how many msecs left
- to unblock due to seeking */
+
+ gint tick_unblock_remaining; /* how many msecs left
+ to unblock due to seeking */
guint tick_id;
guint length_id;
-
+
gulong handoff_hid;
/* error/debug handling */
@@ -67,13 +68,16 @@ static GstPipelineClass *parent_class = NULL;
/* */
/* ======================================================= */
-static GstCaps * gst_play_video_fixate (GstPad *pad, const GstCaps *caps, gpointer user_data);
-static GstCaps * gst_play_audio_fixate (GstPad *pad, const GstCaps *caps, gpointer user_data);
+static GstCaps *gst_play_video_fixate (GstPad * pad, const GstCaps * caps,
+ gpointer user_data);
+static GstCaps *gst_play_audio_fixate (GstPad * pad, const GstCaps * caps,
+ gpointer user_data);
static GQuark
gst_play_error_quark (void)
{
static GQuark quark = 0;
+
if (quark == 0)
quark = g_quark_from_static_string ("gst-play-error-quark");
return quark;
@@ -81,7 +85,7 @@ gst_play_error_quark (void)
/* General GError creation */
static void
-gst_play_error_create (GError ** error, const gchar *message)
+gst_play_error_create (GError ** error, const gchar * message)
{
/* check if caller wanted an error reported */
if (error == NULL)
@@ -95,15 +99,14 @@ gst_play_error_create (GError ** error, const gchar *message)
/* FIXME: what if multiple elements could have been used and they're all
* missing ? varargs ? */
static void
-gst_play_error_plugin (const gchar *element, GError ** error)
+gst_play_error_plugin (const gchar * element, GError ** error)
{
gchar *message;
message = g_strdup_printf ("The %s element could not be found. "
- "This element is essential for playback. "
- "Please install the right plug-in and verify "
- "that it works by running 'gst-inspect %s'",
- element, element);
+ "This element is essential for playback. "
+ "Please install the right plug-in and verify "
+ "that it works by running 'gst-inspect %s'", element, element);
gst_play_error_create (error, message);
g_free (message);
return;
@@ -127,263 +130,273 @@ G_STMT_START { \
static gboolean
-gst_play_pipeline_setup (GstPlay *play, GError **error)
+gst_play_pipeline_setup (GstPlay * play, GError ** error)
{
/* Threads */
GstElement *work_thread, *audio_thread, *video_thread;
+
/* Main Thread elements */
GstElement *source, *autoplugger, *audioconvert, *volume, *tee, *identity;
GstElement *identity_cs;
+
/* Visualization bin */
GstElement *vis_bin, *vis_queue, *vis_element, *vis_cs;
+
/* Video Thread elements */
GstElement *video_queue, *video_switch, *video_cs, *video_balance;
GstElement *balance_cs, *video_scaler, *video_sink;
+
/* Audio Thread elements */
GstElement *audio_queue, *audio_sink;
+
/* Some useful pads */
GstPad *tee_pad1, *tee_pad2;
-
+
g_return_val_if_fail (play != NULL, FALSE);
g_return_val_if_fail (GST_IS_PLAY (play), FALSE);
-
+
/* Creating main thread and its elements */
{
- GST_PLAY_MAKE_OR_ERROR (work_thread, "thread", "work_thread", error);
- g_hash_table_insert (play->priv->elements, "work_thread", work_thread);
- gst_bin_add (GST_BIN (play), work_thread);
-
- /* Placeholder for datasrc */
- GST_PLAY_MAKE_OR_ERROR (source, "fakesrc", "source", error);
- g_hash_table_insert (play->priv->elements, "source", source);
-
- /* Autoplugger */
- GST_PLAY_MAKE_OR_ERROR (autoplugger, "spider", "autoplugger", error);
- g_hash_table_insert (play->priv->elements, "autoplugger", autoplugger);
-
- /* Make sure we convert audio to the needed format */
- GST_PLAY_MAKE_OR_ERROR (audioconvert, "audioconvert", "audioconvert", error);
- g_hash_table_insert (play->priv->elements, "audioconvert", audioconvert);
-
- /* Duplicate audio signal to audio sink and visualization thread */
- GST_PLAY_MAKE_OR_ERROR (tee, "tee", "tee", error);
- tee_pad1 = gst_element_get_request_pad (tee, "src%d");
- tee_pad2 = gst_element_get_request_pad (tee, "src%d");
- g_hash_table_insert (play->priv->elements, "tee_pad1", tee_pad1);
- g_hash_table_insert (play->priv->elements, "tee_pad2", tee_pad2);
- g_hash_table_insert (play->priv->elements, "tee", tee);
-
- gst_bin_add_many (GST_BIN (work_thread), source, autoplugger, audioconvert, tee, NULL);
- if (!gst_element_link_many (source, autoplugger, audioconvert, tee, NULL))
- GST_PLAY_ERROR_RETURN (error, "Could not link source thread elements");
-
- /* identity ! colorspace ! switch */
- GST_PLAY_MAKE_OR_ERROR (identity, "identity", "identity", error);
- g_hash_table_insert (play->priv->elements, "identity", identity);
-
- identity_cs = gst_element_factory_make ("ffcolorspace", "identity_cs");
- if (!GST_IS_ELEMENT (identity_cs)) {
- identity_cs = gst_element_factory_make ("colorspace", "identity_cs");
- if (!GST_IS_ELEMENT (identity_cs))
- {
- gst_play_error_plugin ("colorspace", error);
- return FALSE;
+ GST_PLAY_MAKE_OR_ERROR (work_thread, "thread", "work_thread", error);
+ g_hash_table_insert (play->priv->elements, "work_thread", work_thread);
+ gst_bin_add (GST_BIN (play), work_thread);
+
+ /* Placeholder for datasrc */
+ GST_PLAY_MAKE_OR_ERROR (source, "fakesrc", "source", error);
+ g_hash_table_insert (play->priv->elements, "source", source);
+
+ /* Autoplugger */
+ GST_PLAY_MAKE_OR_ERROR (autoplugger, "spider", "autoplugger", error);
+ g_hash_table_insert (play->priv->elements, "autoplugger", autoplugger);
+
+ /* Make sure we convert audio to the needed format */
+ GST_PLAY_MAKE_OR_ERROR (audioconvert, "audioconvert", "audioconvert",
+ error);
+ g_hash_table_insert (play->priv->elements, "audioconvert", audioconvert);
+
+ /* Duplicate audio signal to audio sink and visualization thread */
+ GST_PLAY_MAKE_OR_ERROR (tee, "tee", "tee", error);
+ tee_pad1 = gst_element_get_request_pad (tee, "src%d");
+ tee_pad2 = gst_element_get_request_pad (tee, "src%d");
+ g_hash_table_insert (play->priv->elements, "tee_pad1", tee_pad1);
+ g_hash_table_insert (play->priv->elements, "tee_pad2", tee_pad2);
+ g_hash_table_insert (play->priv->elements, "tee", tee);
+
+ gst_bin_add_many (GST_BIN (work_thread), source, autoplugger, audioconvert,
+ tee, NULL);
+ if (!gst_element_link_many (source, autoplugger, audioconvert, tee, NULL))
+ GST_PLAY_ERROR_RETURN (error, "Could not link source thread elements");
+
+ /* identity ! colorspace ! switch */
+ GST_PLAY_MAKE_OR_ERROR (identity, "identity", "identity", error);
+ g_hash_table_insert (play->priv->elements, "identity", identity);
+
+ identity_cs = gst_element_factory_make ("ffcolorspace", "identity_cs");
+ if (!GST_IS_ELEMENT (identity_cs)) {
+ identity_cs = gst_element_factory_make ("colorspace", "identity_cs");
+ if (!GST_IS_ELEMENT (identity_cs)) {
+ gst_play_error_plugin ("colorspace", error);
+ return FALSE;
+ }
}
+ g_hash_table_insert (play->priv->elements, "identity_cs", identity_cs);
+ gst_bin_add_many (GST_BIN (work_thread), identity, identity_cs, NULL);
+ if (!gst_element_link_many (autoplugger, identity, identity_cs, NULL))
+ GST_PLAY_ERROR_RETURN (error, "Could not link work thread elements");
}
- g_hash_table_insert (play->priv->elements, "identity_cs", identity_cs);
- gst_bin_add_many (GST_BIN (work_thread), identity, identity_cs, NULL);
- if (!gst_element_link_many (autoplugger, identity, identity_cs, NULL))
- GST_PLAY_ERROR_RETURN (error, "Could not link work thread elements");
- }
-
+
/* Visualization bin (note: it s not added to the pipeline yet) */
{
- vis_bin = gst_bin_new ("vis_bin");
- if (!GST_IS_ELEMENT (vis_bin))
- {
- gst_play_error_plugin ("bin", error);
- return FALSE;
- }
-
- g_hash_table_insert (play->priv->elements, "vis_bin", vis_bin);
-
- /* Buffer queue for video data */
- GST_PLAY_MAKE_OR_ERROR (vis_queue, "queue", "vis_queue", error);
- g_hash_table_insert (play->priv->elements, "vis_queue", vis_queue);
-
- /* Visualization element placeholder */
- GST_PLAY_MAKE_OR_ERROR (vis_element, "identity", "vis_element", error);
- g_hash_table_insert (play->priv->elements, "vis_element", vis_element);
-
- /* Colorspace conversion */
- vis_cs = gst_element_factory_make ("ffcolorspace", "vis_cs");
- if (!GST_IS_ELEMENT (vis_cs)) {
- vis_cs = gst_element_factory_make ("colorspace", "vis_cs");
- if (!GST_IS_ELEMENT (vis_cs))
- {
- gst_play_error_plugin ("colorspace", error);
+ vis_bin = gst_bin_new ("vis_bin");
+ if (!GST_IS_ELEMENT (vis_bin)) {
+ gst_play_error_plugin ("bin", error);
return FALSE;
}
- }
-
- g_hash_table_insert (play->priv->elements, "vis_cs", vis_cs);
-
- gst_bin_add_many (GST_BIN (vis_bin), vis_queue, vis_element, vis_cs, NULL);
- if (!gst_element_link_many (vis_queue, vis_element, vis_cs, NULL))
- GST_PLAY_ERROR_RETURN (error, "Could not link visualisation thread elements");
- gst_element_add_ghost_pad (vis_bin,
- gst_element_get_pad (vis_cs, "src"), "src");
+
+ g_hash_table_insert (play->priv->elements, "vis_bin", vis_bin);
+
+ /* Buffer queue for video data */
+ GST_PLAY_MAKE_OR_ERROR (vis_queue, "queue", "vis_queue", error);
+ g_hash_table_insert (play->priv->elements, "vis_queue", vis_queue);
+
+ /* Visualization element placeholder */
+ GST_PLAY_MAKE_OR_ERROR (vis_element, "identity", "vis_element", error);
+ g_hash_table_insert (play->priv->elements, "vis_element", vis_element);
+
+ /* Colorspace conversion */
+ vis_cs = gst_element_factory_make ("ffcolorspace", "vis_cs");
+ if (!GST_IS_ELEMENT (vis_cs)) {
+ vis_cs = gst_element_factory_make ("colorspace", "vis_cs");
+ if (!GST_IS_ELEMENT (vis_cs)) {
+ gst_play_error_plugin ("colorspace", error);
+ return FALSE;
+ }
+ }
+
+ g_hash_table_insert (play->priv->elements, "vis_cs", vis_cs);
+
+ gst_bin_add_many (GST_BIN (vis_bin), vis_queue, vis_element, vis_cs, NULL);
+ if (!gst_element_link_many (vis_queue, vis_element, vis_cs, NULL))
+ GST_PLAY_ERROR_RETURN (error,
+ "Could not link visualisation thread elements");
+ gst_element_add_ghost_pad (vis_bin, gst_element_get_pad (vis_cs, "src"),
+ "src");
}
/* Creating our video output bin */
{
- GST_PLAY_MAKE_OR_ERROR (video_thread, "thread", "video_thread", error);
- g_hash_table_insert (play->priv->elements, "video_thread", video_thread);
- gst_bin_add (GST_BIN (work_thread), video_thread);
-
- /* Buffer queue for video data */
- GST_PLAY_MAKE_OR_ERROR (video_queue, "queue", "video_queue", error);
- g_hash_table_insert (play->priv->elements, "video_queue", video_queue);
-
- GST_PLAY_MAKE_OR_ERROR (video_switch, "switch", "video_switch", error);
- g_hash_table_insert (play->priv->elements, "video_switch", video_switch);
-
- /* Colorspace conversion */
- video_cs = gst_element_factory_make ("ffcolorspace", "video_cs");
- if (!GST_IS_ELEMENT (video_cs)) {
- video_cs = gst_element_factory_make ("colorspace", "video_cs");
- if (!GST_IS_ELEMENT (video_cs))
- {
- gst_play_error_plugin ("colorspace", error);
- return FALSE;
+ GST_PLAY_MAKE_OR_ERROR (video_thread, "thread", "video_thread", error);
+ g_hash_table_insert (play->priv->elements, "video_thread", video_thread);
+ gst_bin_add (GST_BIN (work_thread), video_thread);
+
+ /* Buffer queue for video data */
+ GST_PLAY_MAKE_OR_ERROR (video_queue, "queue", "video_queue", error);
+ g_hash_table_insert (play->priv->elements, "video_queue", video_queue);
+
+ GST_PLAY_MAKE_OR_ERROR (video_switch, "switch", "video_switch", error);
+ g_hash_table_insert (play->priv->elements, "video_switch", video_switch);
+
+ /* Colorspace conversion */
+ video_cs = gst_element_factory_make ("ffcolorspace", "video_cs");
+ if (!GST_IS_ELEMENT (video_cs)) {
+ video_cs = gst_element_factory_make ("colorspace", "video_cs");
+ if (!GST_IS_ELEMENT (video_cs)) {
+ gst_play_error_plugin ("colorspace", error);
+ return FALSE;
+ }
}
- }
- g_hash_table_insert (play->priv->elements, "video_cs", video_cs);
-
- /* Software colorbalance */
- GST_PLAY_MAKE_OR_ERROR (video_balance, "videobalance", "video_balance", error);
- g_hash_table_insert (play->priv->elements, "video_balance", video_balance);
-
- /* Colorspace conversion */
- balance_cs = gst_element_factory_make ("ffcolorspace", "balance_cs");
- if (!GST_IS_ELEMENT (balance_cs)) {
- balance_cs = gst_element_factory_make ("colorspace", "balance_cs");
- if (!GST_IS_ELEMENT (balance_cs))
- {
- gst_play_error_plugin ("colorspace", error);
- return FALSE;
+ g_hash_table_insert (play->priv->elements, "video_cs", video_cs);
+
+ /* Software colorbalance */
+ GST_PLAY_MAKE_OR_ERROR (video_balance, "videobalance", "video_balance",
+ error);
+ g_hash_table_insert (play->priv->elements, "video_balance", video_balance);
+
+ /* Colorspace conversion */
+ balance_cs = gst_element_factory_make ("ffcolorspace", "balance_cs");
+ if (!GST_IS_ELEMENT (balance_cs)) {
+ balance_cs = gst_element_factory_make ("colorspace", "balance_cs");
+ if (!GST_IS_ELEMENT (balance_cs)) {
+ gst_play_error_plugin ("colorspace", error);
+ return FALSE;
+ }
}
- }
- g_hash_table_insert (play->priv->elements, "balance_cs", balance_cs);
-
- /* Software scaling of video stream */
- GST_PLAY_MAKE_OR_ERROR (video_scaler, "videoscale", "video_scaler", error);
- g_hash_table_insert (play->priv->elements, "video_scaler", video_scaler);
- g_signal_connect (gst_element_get_pad(video_scaler, "src"), "fixate",
- G_CALLBACK (gst_play_video_fixate), play);
-
- /* Placeholder for future video sink bin */
- GST_PLAY_MAKE_OR_ERROR (video_sink, "fakesink", "video_sink", error);
- g_hash_table_insert (play->priv->elements, "video_sink", video_sink);
-
- gst_bin_add_many (GST_BIN (video_thread), video_queue, video_switch, video_cs,
- video_balance, balance_cs, video_scaler, video_sink, NULL);
- /* break down linking so we can figure out what might be failing */
- if (!gst_element_link (video_queue, video_switch))
- GST_PLAY_ERROR_RETURN (error, "Could not link video output thread (queue and switch)");
- if (!gst_element_link (video_switch, video_cs))
- GST_PLAY_ERROR_RETURN (error, "Could not link video output thread (switch and cs)");
- if (!gst_element_link (video_cs, video_balance))
- GST_PLAY_ERROR_RETURN (error, "Could not link video output thread (cs and balance)");
- if (!gst_element_link (video_balance, balance_cs))
- GST_PLAY_ERROR_RETURN (error, "Could not link video output thread (balance and balance_cs)");
- if (!gst_element_link (balance_cs, video_scaler))
- GST_PLAY_ERROR_RETURN (error, "Could not link video output thread (balance_cs and scaler)");
- if (!gst_element_link (video_scaler, video_sink))
- GST_PLAY_ERROR_RETURN (error, "Could not link video output thread (balance_cs and scaler)");
- gst_element_add_ghost_pad (video_thread,
- gst_element_get_pad (video_queue, "sink"),
- "sink");
- if (!gst_element_link (identity_cs, video_thread))
- GST_PLAY_ERROR_RETURN (error, "Could not link video output thread elements");
+ g_hash_table_insert (play->priv->elements, "balance_cs", balance_cs);
+
+ /* Software scaling of video stream */
+ GST_PLAY_MAKE_OR_ERROR (video_scaler, "videoscale", "video_scaler", error);
+ g_hash_table_insert (play->priv->elements, "video_scaler", video_scaler);
+ g_signal_connect (gst_element_get_pad (video_scaler, "src"), "fixate",
+ G_CALLBACK (gst_play_video_fixate), play);
+
+ /* Placeholder for future video sink bin */
+ GST_PLAY_MAKE_OR_ERROR (video_sink, "fakesink", "video_sink", error);
+ g_hash_table_insert (play->priv->elements, "video_sink", video_sink);
+
+ gst_bin_add_many (GST_BIN (video_thread), video_queue, video_switch,
+ video_cs, video_balance, balance_cs, video_scaler, video_sink, NULL);
+ /* break down linking so we can figure out what might be failing */
+ if (!gst_element_link (video_queue, video_switch))
+ GST_PLAY_ERROR_RETURN (error,
+ "Could not link video output thread (queue and switch)");
+ if (!gst_element_link (video_switch, video_cs))
+ GST_PLAY_ERROR_RETURN (error,
+ "Could not link video output thread (switch and cs)");
+ if (!gst_element_link (video_cs, video_balance))
+ GST_PLAY_ERROR_RETURN (error,
+ "Could not link video output thread (cs and balance)");
+ if (!gst_element_link (video_balance, balance_cs))
+ GST_PLAY_ERROR_RETURN (error,
+ "Could not link video output thread (balance and balance_cs)");
+ if (!gst_element_link (balance_cs, video_scaler))
+ GST_PLAY_ERROR_RETURN (error,
+ "Could not link video output thread (balance_cs and scaler)");
+ if (!gst_element_link (video_scaler, video_sink))
+ GST_PLAY_ERROR_RETURN (error,
+ "Could not link video output thread (balance_cs and scaler)");
+ gst_element_add_ghost_pad (video_thread, gst_element_get_pad (video_queue,
+ "sink"), "sink");
+ if (!gst_element_link (identity_cs, video_thread))
+ GST_PLAY_ERROR_RETURN (error,
+ "Could not link video output thread elements");
}
/* Creating our audio output bin
{ queue ! fakesink } */
{
- GST_PLAY_MAKE_OR_ERROR (audio_thread, "thread", "audio_thread", error);
- g_hash_table_insert (play->priv->elements, "audio_thread", audio_thread);
- gst_bin_add (GST_BIN (work_thread), audio_thread);
-
- /* Buffer queue for our audio thread */
- GST_PLAY_MAKE_OR_ERROR (audio_queue, "queue", "audio_queue", error);
- g_hash_table_insert (play->priv->elements, "audio_queue", audio_queue);
-
- /* Volume control */
- GST_PLAY_MAKE_OR_ERROR (volume, "volume", "volume", error);
- g_hash_table_insert (play->priv->elements, "volume", volume);
- g_signal_connect (gst_element_get_pad(volume, "src"), "fixate",
- G_CALLBACK (gst_play_audio_fixate), play);
-
- /* Placeholder for future audio sink bin */
- GST_PLAY_MAKE_OR_ERROR (audio_sink, "fakesink", "audio_sink", error);
- g_hash_table_insert (play->priv->elements, "audio_sink", audio_sink);
-
- gst_bin_add_many (GST_BIN (audio_thread), audio_queue, volume, audio_sink, NULL);
- if (!gst_element_link_many (audio_queue, volume, audio_sink, NULL))
- GST_PLAY_ERROR_RETURN (error, "Could not link audio output thread elements");
- gst_element_add_ghost_pad (audio_thread,
- gst_element_get_pad (audio_queue, "sink"),
- "sink");
- gst_pad_link (tee_pad2, gst_element_get_pad (audio_queue, "sink"));
+ GST_PLAY_MAKE_OR_ERROR (audio_thread, "thread", "audio_thread", error);
+ g_hash_table_insert (play->priv->elements, "audio_thread", audio_thread);
+ gst_bin_add (GST_BIN (work_thread), audio_thread);
+
+ /* Buffer queue for our audio thread */
+ GST_PLAY_MAKE_OR_ERROR (audio_queue, "queue", "audio_queue", error);
+ g_hash_table_insert (play->priv->elements, "audio_queue", audio_queue);
+
+ /* Volume control */
+ GST_PLAY_MAKE_OR_ERROR (volume, "volume", "volume", error);
+ g_hash_table_insert (play->priv->elements, "volume", volume);
+ g_signal_connect (gst_element_get_pad (volume, "src"), "fixate",
+ G_CALLBACK (gst_play_audio_fixate), play);
+
+ /* Placeholder for future audio sink bin */
+ GST_PLAY_MAKE_OR_ERROR (audio_sink, "fakesink", "audio_sink", error);
+ g_hash_table_insert (play->priv->elements, "audio_sink", audio_sink);
+
+ gst_bin_add_many (GST_BIN (audio_thread), audio_queue, volume, audio_sink,
+ NULL);
+ if (!gst_element_link_many (audio_queue, volume, audio_sink, NULL))
+ GST_PLAY_ERROR_RETURN (error,
+ "Could not link audio output thread elements");
+ gst_element_add_ghost_pad (audio_thread, gst_element_get_pad (audio_queue,
+ "sink"), "sink");
+ gst_pad_link (tee_pad2, gst_element_get_pad (audio_queue, "sink"));
}
-
+
return TRUE;
}
static void
-gst_play_have_video_size (GstElement *element, gint width,
- gint height, GstPlay *play)
+gst_play_have_video_size (GstElement * element, gint width,
+ gint height, GstPlay * play)
{
g_return_if_fail (play != NULL);
g_return_if_fail (GST_IS_PLAY (play));
g_signal_emit (G_OBJECT (play), gst_play_signals[HAVE_VIDEO_SIZE],
- 0, width, height);
+ 0, width, height);
}
static gboolean
-gst_play_tick_callback (GstPlay *play)
+gst_play_tick_callback (GstPlay * play)
{
GstFormat format = GST_FORMAT_TIME;
gboolean q = FALSE;
GstElement *audio_sink_element = NULL;
-
+
g_return_val_if_fail (play != NULL, FALSE);
/* just return without updating the UI when we are in the middle of seeking */
- if (play->priv->tick_unblock_remaining > 0)
- {
+ if (play->priv->tick_unblock_remaining > 0) {
play->priv->tick_unblock_remaining -= TICK_INTERVAL_MSEC;
return TRUE;
}
-
+
if (!GST_IS_PLAY (play)) {
play->priv->tick_id = 0;
return FALSE;
}
-
+
audio_sink_element = g_hash_table_lookup (play->priv->elements,
- "audio_sink_element");
-
+ "audio_sink_element");
+
if (!GST_IS_ELEMENT (audio_sink_element)) {
play->priv->tick_id = 0;
return FALSE;
}
-
+
q = gst_element_query (audio_sink_element, GST_QUERY_POSITION, &format,
- &(play->priv->time_nanos));
-
+ &(play->priv->time_nanos));
+
if (q)
g_signal_emit (G_OBJECT (play), gst_play_signals[TIME_TICK],
- 0,play->priv->time_nanos);
-
+ 0, play->priv->time_nanos);
+
if (GST_STATE (GST_ELEMENT (play)) == GST_STATE_PLAYING)
return TRUE;
else {
@@ -393,63 +406,63 @@ gst_play_tick_callback (GstPlay *play)
}
static gboolean
-gst_play_get_length_callback (GstPlay *play)
+gst_play_get_length_callback (GstPlay * play)
{
GstElement *audio_sink_element, *video_sink_element;
GstFormat format = GST_FORMAT_TIME;
gint64 value;
gboolean q = FALSE;
-
+
g_return_val_if_fail (play != NULL, FALSE);
g_return_val_if_fail (GST_IS_PLAY (play), FALSE);
-
+
/* We try to get length from all real sink elements */
audio_sink_element = g_hash_table_lookup (play->priv->elements,
- "audio_sink_element");
+ "audio_sink_element");
video_sink_element = g_hash_table_lookup (play->priv->elements,
- "video_sink_element");
+ "video_sink_element");
if (!GST_IS_ELEMENT (audio_sink_element) &&
!GST_IS_ELEMENT (video_sink_element)) {
play->priv->length_id = 0;
return FALSE;
}
-
+
/* Audio first and then Video */
if (GST_IS_ELEMENT (audio_sink_element))
q = gst_element_query (audio_sink_element, GST_QUERY_TOTAL, &format,
- &value);
- if ( (!q) && (GST_IS_ELEMENT (video_sink_element)) )
+ &value);
+ if ((!q) && (GST_IS_ELEMENT (video_sink_element)))
q = gst_element_query (video_sink_element, GST_QUERY_TOTAL, &format,
- &value);
-
+ &value);
+
if (q) {
play->priv->length_nanos = value;
g_signal_emit (G_OBJECT (play), gst_play_signals[STREAM_LENGTH],
- 0,play->priv->length_nanos);
+ 0, play->priv->length_nanos);
play->priv->length_id = 0;
return FALSE;
}
-
+
play->priv->get_length_attempt++;
-
+
/* We try 16 times */
if (play->priv->get_length_attempt > 15) {
play->priv->length_id = 0;
return FALSE;
- }
- else
+ } else
return TRUE;
}
static GstCaps *
-gst_play_video_fixate (GstPad *pad, const GstCaps *caps, gpointer user_data)
+gst_play_video_fixate (GstPad * pad, const GstCaps * caps, gpointer user_data)
{
GstStructure *structure;
GstCaps *newcaps;
GST_DEBUG ("video fixate %p %" GST_PTR_FORMAT, pad, caps);
- if (gst_caps_get_size (caps) > 1) return NULL;
+ if (gst_caps_get_size (caps) > 1)
+ return NULL;
newcaps = gst_caps_copy (caps);
structure = gst_caps_get_structure (newcaps, 0);
@@ -461,7 +474,7 @@ gst_play_video_fixate (GstPad *pad, const GstCaps *caps, gpointer user_data)
return newcaps;
}
if (gst_caps_structure_fixate_field_nearest_double (structure, "framerate",
- 30.0)) {
+ 30.0)) {
return newcaps;
}
@@ -471,15 +484,16 @@ gst_play_video_fixate (GstPad *pad, const GstCaps *caps, gpointer user_data)
}
static GstCaps *
-gst_play_audio_fixate (GstPad *pad, const GstCaps *caps, gpointer user_data)
+gst_play_audio_fixate (GstPad * pad, const GstCaps * caps, gpointer user_data)
{
GstCaps *newcaps;
GstStructure *structure;
GST_DEBUG ("audio fixate %p %" GST_PTR_FORMAT, pad, caps);
- newcaps = gst_caps_new_full (gst_structure_copy (
- gst_caps_get_structure (caps, 0)), NULL);
+ newcaps =
+ gst_caps_new_full (gst_structure_copy (gst_caps_get_structure (caps, 0)),
+ NULL);
structure = gst_caps_get_structure (newcaps, 0);
if (gst_caps_structure_fixate_field_nearest_int (structure, "rate", 44100)) {
@@ -501,38 +515,35 @@ gst_play_audio_fixate (GstPad *pad, const GstCaps *caps, gpointer user_data)
}
static void
-gst_play_state_change (GstElement *element, GstElementState old,
- GstElementState state)
+gst_play_state_change (GstElement * element, GstElementState old,
+ GstElementState state)
{
GstPlay *play;
-
+
g_return_if_fail (element != NULL);
g_return_if_fail (GST_IS_PLAY (element));
-
+
play = GST_PLAY (element);
-
+
if (state == GST_STATE_PLAYING) {
if (play->priv->tick_id) {
g_source_remove (play->priv->tick_id);
play->priv->tick_id = 0;
}
-
+
play->priv->tick_id = g_timeout_add (TICK_INTERVAL_MSEC,
- (GSourceFunc) gst_play_tick_callback,
- play);
-
+ (GSourceFunc) gst_play_tick_callback, play);
+
play->priv->get_length_attempt = 0;
-
+
if (play->priv->length_id) {
g_source_remove (play->priv->length_id);
play->priv->length_id = 0;
}
-
+
play->priv->length_id = g_timeout_add (TICK_INTERVAL_MSEC,
- (GSourceFunc) gst_play_get_length_callback,
- play);
- }
- else {
+ (GSourceFunc) gst_play_get_length_callback, play);
+ } else {
if (play->priv->tick_id) {
g_source_remove (play->priv->tick_id);
play->priv->tick_id = 0;
@@ -542,13 +553,14 @@ gst_play_state_change (GstElement *element, GstElementState old,
play->priv->length_id = 0;
}
}
-
+
if (GST_ELEMENT_CLASS (parent_class)->state_change)
GST_ELEMENT_CLASS (parent_class)->state_change (element, old, state);
}
static void
-gst_play_identity_handoff (GstElement *identity, GstBuffer *buf, GstPlay *play)
+gst_play_identity_handoff (GstElement * identity, GstBuffer * buf,
+ GstPlay * play)
{
g_signal_handler_disconnect (G_OBJECT (identity), play->priv->handoff_hid);
play->priv->handoff_hid = 0;
@@ -562,40 +574,40 @@ gst_play_identity_handoff (GstElement *identity, GstBuffer *buf, GstPlay *play)
/* =========================================== */
static void
-gst_play_dispose (GObject *object)
+gst_play_dispose (GObject * object)
{
GstPlay *play;
-
+
g_return_if_fail (object != NULL);
g_return_if_fail (GST_IS_PLAY (object));
-
+
play = GST_PLAY (object);
-
+
if (play->priv->length_id) {
g_source_remove (play->priv->length_id);
play->priv->length_id = 0;
}
-
+
if (play->priv->tick_id) {
g_source_remove (play->priv->tick_id);
play->priv->tick_id = 0;
}
-
+
if (play->priv->location) {
g_free (play->priv->location);
play->priv->location = NULL;
}
-
+
if (play->priv->elements) {
g_hash_table_destroy (play->priv->elements);
play->priv->elements = NULL;
}
-
+
G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
-gst_play_init (GstPlay *play)
+gst_play_init (GstPlay * play)
{
play->priv = g_new0 (GstPlayPrivate, 1);
play->priv->location = NULL;
@@ -604,41 +616,39 @@ gst_play_init (GstPlay *play)
play->priv->elements = g_hash_table_new (g_str_hash, g_str_equal);
play->priv->error = NULL;
play->priv->debug = NULL;
-
- if (!gst_play_pipeline_setup (play, &play->priv->error))
- {
+
+ if (!gst_play_pipeline_setup (play, &play->priv->error)) {
g_warning ("libgstplay: failed initializing pipeline, error: %s",
- play->priv->error->message);
+ play->priv->error->message);
}
}
static void
-gst_play_class_init (GstPlayClass *klass)
+gst_play_class_init (GstPlayClass * klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
+
parent_class = g_type_class_peek_parent (klass);
gobject_class->dispose = gst_play_dispose;
element_class->state_change = gst_play_state_change;
-
+
gst_play_signals[TIME_TICK] =
- g_signal_new ("time-tick", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (GstPlayClass, time_tick), NULL, NULL,
- gst_marshal_VOID__INT64, G_TYPE_NONE, 1, G_TYPE_INT64);
+ g_signal_new ("time-tick", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (GstPlayClass, time_tick), NULL, NULL,
+ gst_marshal_VOID__INT64, G_TYPE_NONE, 1, G_TYPE_INT64);
gst_play_signals[STREAM_LENGTH] =
- g_signal_new ("stream-length", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (GstPlayClass, stream_length), NULL, NULL,
- gst_marshal_VOID__INT64, G_TYPE_NONE, 1, G_TYPE_INT64);
+ g_signal_new ("stream-length", G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (GstPlayClass, stream_length), NULL, NULL,
+ gst_marshal_VOID__INT64, G_TYPE_NONE, 1, G_TYPE_INT64);
gst_play_signals[HAVE_VIDEO_SIZE] =
- g_signal_new ("have-video-size", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (GstPlayClass, have_video_size), NULL, NULL,
- gst_marshal_VOID__INT_INT, G_TYPE_NONE, 2,
- G_TYPE_INT, G_TYPE_INT);
+ g_signal_new ("have-video-size", G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (GstPlayClass, have_video_size), NULL, NULL,
+ gst_marshal_VOID__INT_INT, G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
}
/* ======================================================= */
@@ -657,22 +667,22 @@ gst_play_class_init (GstPlayClass *klass)
* Returns: TRUE if location was set successfully.
*/
gboolean
-gst_play_set_location (GstPlay *play, const char *location)
+gst_play_set_location (GstPlay * play, const char *location)
{
GstElement *work_thread, *source, *autoplugger;
GstElement *audioconvert, *identity;
-
+
g_return_val_if_fail (play != NULL, FALSE);
g_return_val_if_fail (GST_IS_PLAY (play), FALSE);
-
+
if (play->priv->location)
g_free (play->priv->location);
-
+
play->priv->location = g_strdup (location);
-
+
if (GST_STATE (GST_ELEMENT (play)) != GST_STATE_READY)
gst_element_set_state (GST_ELEMENT (play), GST_STATE_READY);
-
+
work_thread = g_hash_table_lookup (play->priv->elements, "work_thread");
if (!GST_IS_ELEMENT (work_thread))
return FALSE;
@@ -688,34 +698,34 @@ gst_play_set_location (GstPlay *play, const char *location)
identity = g_hash_table_lookup (play->priv->elements, "identity");
if (!GST_IS_ELEMENT (identity))
return FALSE;
-
+
/* Spider can autoplugg only once. We remove the actual one and put a new
autoplugger */
gst_element_unlink (source, autoplugger);
gst_element_unlink (autoplugger, identity);
gst_element_unlink (autoplugger, audioconvert);
gst_bin_remove (GST_BIN (work_thread), autoplugger);
-
+
autoplugger = gst_element_factory_make ("spider", "autoplugger");
if (!GST_IS_ELEMENT (autoplugger))
return FALSE;
-
+
gst_bin_add (GST_BIN (work_thread), autoplugger);
gst_element_link (source, autoplugger);
gst_element_link (autoplugger, audioconvert);
gst_element_link (autoplugger, identity);
-
+
g_hash_table_replace (play->priv->elements, "autoplugger", autoplugger);
-
+
/* FIXME: Why don't we have an interface to do that kind of stuff ? */
g_object_set (G_OBJECT (source), "location", play->priv->location, NULL);
-
+
play->priv->length_nanos = 0LL;
play->priv->time_nanos = 0LL;
-
+
g_signal_emit (G_OBJECT (play), gst_play_signals[STREAM_LENGTH], 0, 0LL);
g_signal_emit (G_OBJECT (play), gst_play_signals[TIME_TICK], 0, 0LL);
-
+
return TRUE;
}
@@ -728,7 +738,7 @@ gst_play_set_location (GstPlay *play, const char *location)
* Returns: a const #char* pointer to current location.
*/
char *
-gst_play_get_location (GstPlay *play)
+gst_play_get_location (GstPlay * play)
{
g_return_val_if_fail (play != NULL, NULL);
g_return_val_if_fail (GST_IS_PLAY (play), NULL);
@@ -746,52 +756,49 @@ gboolean
gst_play_seek_to_time (GstPlay * play, gint64 time_nanos)
{
GstElement *audio_seek_element, *video_seek_element, *audio_sink_element;
-
+
g_return_val_if_fail (play != NULL, FALSE);
g_return_val_if_fail (GST_IS_PLAY (play), FALSE);
-
+
if (time_nanos < 0LL)
time_nanos = 0LL;
-
+
audio_seek_element = g_hash_table_lookup (play->priv->elements,
- "audioconvert");
+ "audioconvert");
audio_sink_element = g_hash_table_lookup (play->priv->elements,
- "audio_sink_element");
- video_seek_element = g_hash_table_lookup (play->priv->elements,
- "identity");
-
+ "audio_sink_element");
+ video_seek_element = g_hash_table_lookup (play->priv->elements, "identity");
+
if (GST_IS_ELEMENT (audio_seek_element) &&
GST_IS_ELEMENT (video_seek_element) &&
GST_IS_ELEMENT (audio_sink_element)) {
gboolean s = FALSE;
-
+
/* HACK: block tick signal from idler for 500 msec */
/* GStreamer can't currently report when seeking is finished,
so we just chose a .5 sec default block time */
play->priv->tick_unblock_remaining = 500;
-
+
s = gst_element_seek (video_seek_element, GST_FORMAT_TIME |
- GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH,
- time_nanos);
+ GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH, time_nanos);
if (!s) {
s = gst_element_seek (audio_seek_element, GST_FORMAT_TIME |
- GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH,
- time_nanos);
+ GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH, time_nanos);
}
-
+
if (s) {
GstFormat format = GST_FORMAT_TIME;
gboolean q = FALSE;
-
+
q = gst_element_query (audio_sink_element, GST_QUERY_POSITION, &format,
- &(play->priv->time_nanos));
+ &(play->priv->time_nanos));
if (q)
- g_signal_emit (G_OBJECT (play), gst_play_signals[TIME_TICK],
- 0,play->priv->time_nanos);
+ g_signal_emit (G_OBJECT (play), gst_play_signals[TIME_TICK],
+ 0, play->priv->time_nanos);
}
}
-
+
return TRUE;
}
@@ -805,17 +812,17 @@ gst_play_seek_to_time (GstPlay * play, gint64 time_nanos)
* Returns: TRUE if call succeeded.
*/
gboolean
-gst_play_set_data_src (GstPlay *play, GstElement *data_src)
+gst_play_set_data_src (GstPlay * play, GstElement * data_src)
{
GstElement *work_thread, *old_data_src, *autoplugger;
-
+
g_return_val_if_fail (play != NULL, FALSE);
g_return_val_if_fail (GST_IS_PLAY (play), FALSE);
-
+
/* We bring back the pipeline to READY */
if (GST_STATE (GST_ELEMENT (play)) != GST_STATE_READY)
gst_element_set_state (GST_ELEMENT (play), GST_STATE_READY);
-
+
/* Getting needed objects */
work_thread = g_hash_table_lookup (play->priv->elements, "work_thread");
if (!GST_IS_ELEMENT (work_thread))
@@ -826,7 +833,7 @@ gst_play_set_data_src (GstPlay *play, GstElement *data_src)
autoplugger = g_hash_table_lookup (play->priv->elements, "autoplugger");
if (!GST_IS_ELEMENT (autoplugger))
return FALSE;
-
+
/* Unlinking old source from autoplugger, removing it from pipeline, adding
the new one and connecting it to autoplugger FIXME: we should put a new
autoplugger here as spider can autoplugg only once */
@@ -834,9 +841,9 @@ gst_play_set_data_src (GstPlay *play, GstElement *data_src)
gst_bin_remove (GST_BIN (work_thread), old_data_src);
gst_bin_add (GST_BIN (work_thread), data_src);
gst_element_link (data_src, autoplugger);
-
+
g_hash_table_replace (play->priv->elements, "source", data_src);
-
+
return TRUE;
}
@@ -850,19 +857,19 @@ gst_play_set_data_src (GstPlay *play, GstElement *data_src)
* Returns: TRUE if call succeeded.
*/
gboolean
-gst_play_set_video_sink (GstPlay *play, GstElement *video_sink)
+gst_play_set_video_sink (GstPlay * play, GstElement * video_sink)
{
GstElement *video_thread, *old_video_sink, *video_scaler, *video_sink_element;
-
+
g_return_val_if_fail (play != NULL, FALSE);
g_return_val_if_fail (GST_IS_PLAY (play), FALSE);
g_return_val_if_fail (video_sink != NULL, FALSE);
g_return_val_if_fail (GST_IS_ELEMENT (video_sink), FALSE);
-
+
/* We bring back the pipeline to READY */
if (GST_STATE (GST_ELEMENT (play)) != GST_STATE_READY)
gst_element_set_state (GST_ELEMENT (play), GST_STATE_READY);
-
+
/* Getting needed objects */
video_thread = g_hash_table_lookup (play->priv->elements, "video_thread");
if (!GST_IS_ELEMENT (video_thread))
@@ -873,30 +880,29 @@ gst_play_set_video_sink (GstPlay *play, GstElement *video_sink)
video_scaler = g_hash_table_lookup (play->priv->elements, "video_scaler");
if (!GST_IS_ELEMENT (video_scaler))
return FALSE;
-
+
/* Unlinking old video sink from video scaler, removing it from pipeline,
adding the new one and linking it */
gst_element_unlink (video_scaler, old_video_sink);
gst_bin_remove (GST_BIN (video_thread), old_video_sink);
gst_bin_add (GST_BIN (video_thread), video_sink);
gst_element_link (video_scaler, video_sink);
-
+
g_hash_table_replace (play->priv->elements, "video_sink", video_sink);
-
+
video_sink_element = gst_play_get_sink_element (play, video_sink,
- GST_PLAY_SINK_TYPE_VIDEO);
+ GST_PLAY_SINK_TYPE_VIDEO);
if (GST_IS_ELEMENT (video_sink_element)) {
g_hash_table_replace (play->priv->elements, "video_sink_element",
- video_sink_element);
+ video_sink_element);
if (GST_IS_X_OVERLAY (video_sink_element)) {
g_signal_connect (G_OBJECT (video_sink_element),
- "desired_size_changed",
- G_CALLBACK (gst_play_have_video_size), play);
+ "desired_size_changed", G_CALLBACK (gst_play_have_video_size), play);
}
- }
-
- gst_element_set_state (video_sink, GST_STATE (GST_ELEMENT(play)));
-
+ }
+
+ gst_element_set_state (video_sink, GST_STATE (GST_ELEMENT (play)));
+
return TRUE;
}
@@ -910,19 +916,19 @@ gst_play_set_video_sink (GstPlay *play, GstElement *video_sink)
* Returns: TRUE if call succeeded.
*/
gboolean
-gst_play_set_audio_sink (GstPlay *play, GstElement *audio_sink)
+gst_play_set_audio_sink (GstPlay * play, GstElement * audio_sink)
{
GstElement *old_audio_sink, *audio_thread, *volume, *audio_sink_element;
-
+
g_return_val_if_fail (play != NULL, FALSE);
g_return_val_if_fail (GST_IS_PLAY (play), FALSE);
g_return_val_if_fail (audio_sink != NULL, FALSE);
g_return_val_if_fail (GST_IS_ELEMENT (audio_sink), FALSE);
-
+
/* We bring back the pipeline to READY */
if (GST_STATE (GST_ELEMENT (play)) != GST_STATE_READY)
gst_element_set_state (GST_ELEMENT (play), GST_STATE_READY);
-
+
/* Getting needed objects */
old_audio_sink = g_hash_table_lookup (play->priv->elements, "audio_sink");
if (!GST_IS_ELEMENT (old_audio_sink))
@@ -933,25 +939,25 @@ gst_play_set_audio_sink (GstPlay *play, GstElement *audio_sink)
volume = g_hash_table_lookup (play->priv->elements, "volume");
if (!GST_IS_ELEMENT (volume))
return FALSE;
-
+
/* Unlinking old audiosink, removing it from pipeline, putting the new one
and linking it */
gst_element_unlink (volume, old_audio_sink);
gst_bin_remove (GST_BIN (audio_thread), old_audio_sink);
gst_bin_add (GST_BIN (audio_thread), audio_sink);
gst_element_link (volume, audio_sink);
-
+
g_hash_table_replace (play->priv->elements, "audio_sink", audio_sink);
-
+
audio_sink_element = gst_play_get_sink_element (play, audio_sink,
- GST_PLAY_SINK_TYPE_AUDIO);
+ GST_PLAY_SINK_TYPE_AUDIO);
if (GST_IS_ELEMENT (audio_sink_element)) {
g_hash_table_replace (play->priv->elements, "audio_sink_element",
- audio_sink_element);
+ audio_sink_element);
}
-
- gst_element_set_state (audio_sink, GST_STATE (GST_ELEMENT(play)));
-
+
+ gst_element_set_state (audio_sink, GST_STATE (GST_ELEMENT (play)));
+
return TRUE;
}
@@ -965,16 +971,16 @@ gst_play_set_audio_sink (GstPlay *play, GstElement *audio_sink)
* Returns: TRUE if call succeeded.
*/
gboolean
-gst_play_set_visualization (GstPlay *play, GstElement *vis_element)
+gst_play_set_visualization (GstPlay * play, GstElement * vis_element)
{
GstElement *vis_bin, *vis_queue, *old_vis_element, *vis_cs;
gboolean was_playing = FALSE;
-
+
g_return_val_if_fail (play != NULL, FALSE);
g_return_val_if_fail (GST_IS_PLAY (play), FALSE);
g_return_val_if_fail (vis_element != NULL, FALSE);
g_return_val_if_fail (GST_IS_ELEMENT (vis_element), FALSE);
-
+
/* Getting needed objects */
vis_bin = g_hash_table_lookup (play->priv->elements, "vis_bin");
if (!GST_IS_ELEMENT (vis_bin))
@@ -982,14 +988,13 @@ gst_play_set_visualization (GstPlay *play, GstElement *vis_element)
vis_queue = g_hash_table_lookup (play->priv->elements, "vis_queue");
if (!GST_IS_ELEMENT (vis_queue))
return FALSE;
- old_vis_element = g_hash_table_lookup (play->priv->elements,
- "vis_element");
+ old_vis_element = g_hash_table_lookup (play->priv->elements, "vis_element");
if (!GST_IS_ELEMENT (old_vis_element))
return FALSE;
vis_cs = g_hash_table_lookup (play->priv->elements, "vis_cs");
if (!GST_IS_ELEMENT (vis_cs))
return FALSE;
-
+
/* We bring back the pipeline to PAUSED */
if (GST_STATE (GST_ELEMENT (play)) == GST_STATE_PLAYING) {
gst_element_set_state (GST_ELEMENT (play), GST_STATE_PAUSED);
@@ -1000,12 +1005,12 @@ gst_play_set_visualization (GstPlay *play, GstElement *vis_element)
gst_bin_remove (GST_BIN (vis_bin), old_vis_element);
gst_bin_add (GST_BIN (vis_bin), vis_element);
gst_element_link_many (vis_queue, vis_element, vis_cs, NULL);
-
+
g_hash_table_replace (play->priv->elements, "vis_element", vis_element);
-
+
if (was_playing)
gst_element_set_state (GST_ELEMENT (play), GST_STATE_PLAYING);
-
+
return TRUE;
}
@@ -1025,13 +1030,13 @@ gst_play_connect_visualization (GstPlay * play, gboolean connect)
GstElement *video_thread, *vis_queue, *vis_bin, *video_switch, *identity;
GstPad *tee_pad1, *vis_queue_pad, *vis_bin_pad, *switch_pad;
gboolean was_playing = FALSE;
-
+
g_return_val_if_fail (play != NULL, FALSE);
g_return_val_if_fail (GST_IS_PLAY (play), FALSE);
-
+
/* Until i fix the switch */
return TRUE;
-
+
/* Getting needed objects */
video_thread = g_hash_table_lookup (play->priv->elements, "video_thread");
if (!GST_IS_ELEMENT (video_thread))
@@ -1051,26 +1056,26 @@ gst_play_connect_visualization (GstPlay * play, gboolean connect)
tee_pad1 = g_hash_table_lookup (play->priv->elements, "tee_pad1");
if (!GST_IS_PAD (tee_pad1))
return FALSE;
-
+
vis_queue_pad = gst_element_get_pad (vis_queue, "sink");
-
+
/* Check if the vis element is in the pipeline. That means visualization is
connected already */
if (gst_element_get_managing_bin (vis_bin)) {
-
+
/* If we are supposed to connect then nothing to do we return */
if (connect) {
return TRUE;
}
-
+
/* Disconnecting visualization */
-
+
/* We bring back the pipeline to PAUSED */
if (GST_STATE (GST_ELEMENT (play)) == GST_STATE_PLAYING) {
gst_element_set_state (GST_ELEMENT (play), GST_STATE_PAUSED);
was_playing = TRUE;
}
-
+
/* Unlinking, removing */
gst_pad_unlink (tee_pad1, vis_queue_pad);
vis_bin_pad = gst_element_get_pad (vis_bin, "src");
@@ -1079,26 +1084,24 @@ gst_play_connect_visualization (GstPlay * play, gboolean connect)
gst_element_release_request_pad (video_switch, switch_pad);
gst_object_ref (GST_OBJECT (vis_bin));
gst_bin_remove (GST_BIN (video_thread), vis_bin);
- }
- else {
-
+ } else {
+
/* If we are supposed to disconnect then nothing to do we return */
if (!connect) {
return TRUE;
}
-
+
/* Connecting visualization */
-
+
/* We bring back the pipeline to PAUSED */
if (GST_STATE (GST_ELEMENT (play)) == GST_STATE_PLAYING) {
gst_element_set_state (GST_ELEMENT (play), GST_STATE_PAUSED);
was_playing = TRUE;
}
-
+
/* Adding, linking */
play->priv->handoff_hid = g_signal_connect (G_OBJECT (identity),
- "handoff",
- G_CALLBACK (gst_play_identity_handoff), play);
+ "handoff", G_CALLBACK (gst_play_identity_handoff), play);
gst_bin_add (GST_BIN (video_thread), vis_bin);
gst_pad_link (tee_pad1, vis_queue_pad);
gst_element_link (vis_bin, video_switch);
@@ -1106,7 +1109,7 @@ gst_play_connect_visualization (GstPlay * play, gboolean connect)
if (was_playing)
gst_element_set_state (GST_ELEMENT (play), GST_STATE_PLAYING);
-
+
return TRUE;
}
@@ -1122,8 +1125,8 @@ gst_play_connect_visualization (GstPlay * play, gboolean connect)
* Returns: the sink #GstElement of @element.
*/
GstElement *
-gst_play_get_sink_element (GstPlay *play,
- GstElement *element, GstPlaySinkType sink_type)
+gst_play_get_sink_element (GstPlay * play,
+ GstElement * element, GstPlaySinkType sink_type)
{
GList *elements = NULL;
const GList *pads = NULL;
@@ -1152,91 +1155,86 @@ gst_play_get_sink_element (GstPlay *play,
if (GST_IS_BIN (element)) {
element = gst_play_get_sink_element (play, element, sink_type);
if (GST_IS_ELEMENT (element))
- return element;
- }
- else {
+ return element;
+ } else {
pads = gst_element_get_pad_list (element);
has_src = FALSE;
has_correct_type = FALSE;
while (pads) {
- /* check for src pad */
- if (GST_PAD_DIRECTION (GST_PAD (pads->data)) == GST_PAD_SRC) {
- has_src = TRUE;
- break;
- }
- else {
- /* If not a src pad checking caps */
- GstCaps *caps;
- GstStructure *structure;
- gboolean has_video_cap = FALSE;
- gboolean has_audio_cap = FALSE;
-
- caps = gst_pad_get_caps (GST_PAD (pads->data));
- structure = gst_caps_get_structure (caps, 0);
-
- if (strcmp (gst_structure_get_name (structure),
- "audio/x-raw-int") == 0) {
- has_audio_cap = TRUE;
- }
-
- if (strcmp (gst_structure_get_name (structure),
- "video/x-raw-yuv") == 0 ||
- strcmp (gst_structure_get_name (structure),
- "video/x-raw-rgb") == 0) {
- has_video_cap = TRUE;
- }
-
- gst_caps_free (caps);
-
- switch (sink_type) {
- case GST_PLAY_SINK_TYPE_AUDIO:
- if (has_audio_cap)
- has_correct_type = TRUE;
- break;
- case GST_PLAY_SINK_TYPE_VIDEO:
- if (has_video_cap)
- has_correct_type = TRUE;
- break;
- case GST_PLAY_SINK_TYPE_ANY:
- if ((has_video_cap) || (has_audio_cap))
- has_correct_type = TRUE;
- break;
- default:
- has_correct_type = FALSE;
- }
- }
-
- pads = g_list_next (pads);
-
+ /* check for src pad */
+ if (GST_PAD_DIRECTION (GST_PAD (pads->data)) == GST_PAD_SRC) {
+ has_src = TRUE;
+ break;
+ } else {
+ /* If not a src pad checking caps */
+ GstCaps *caps;
+ GstStructure *structure;
+ gboolean has_video_cap = FALSE;
+ gboolean has_audio_cap = FALSE;
+
+ caps = gst_pad_get_caps (GST_PAD (pads->data));
+ structure = gst_caps_get_structure (caps, 0);
+
+ if (strcmp (gst_structure_get_name (structure),
+ "audio/x-raw-int") == 0) {
+ has_audio_cap = TRUE;
+ }
+
+ if (strcmp (gst_structure_get_name (structure),
+ "video/x-raw-yuv") == 0 ||
+ strcmp (gst_structure_get_name (structure),
+ "video/x-raw-rgb") == 0) {
+ has_video_cap = TRUE;
+ }
+
+ gst_caps_free (caps);
+
+ switch (sink_type) {
+ case GST_PLAY_SINK_TYPE_AUDIO:
+ if (has_audio_cap)
+ has_correct_type = TRUE;
+ break;
+ case GST_PLAY_SINK_TYPE_VIDEO:
+ if (has_video_cap)
+ has_correct_type = TRUE;
+ break;
+ case GST_PLAY_SINK_TYPE_ANY:
+ if ((has_video_cap) || (has_audio_cap))
+ has_correct_type = TRUE;
+ break;
+ default:
+ has_correct_type = FALSE;
+ }
+ }
+
+ pads = g_list_next (pads);
+
}
-
+
if ((!has_src) && (has_correct_type))
- return element;
+ return element;
}
-
+
elements = g_list_next (elements);
}
-
+
/* we didn't find a sink element */
-
+
return NULL;
}
GstPlay *
-gst_play_new (GError **error)
+gst_play_new (GError ** error)
{
GstPlay *play = g_object_new (GST_TYPE_PLAY, NULL);
- if (play->priv->error)
- {
- if (error)
- {
+ if (play->priv->error) {
+ if (error) {
*error = play->priv->error;
play->priv->error = NULL;
- }
- else
- {
- g_warning ("Error creating GstPlay object.\n%s", play->priv->error->message);
+ } else {
+ g_warning ("Error creating GstPlay object.\n%s",
+ play->priv->error->message);
g_error_free (play->priv->error);
}
}
@@ -1267,9 +1265,9 @@ gst_play_get_type (void)
(GInstanceInitFunc) gst_play_init,
NULL
};
-
+
play_type = g_type_register_static (GST_TYPE_PIPELINE, "GstPlay",
- &play_info, 0);
+ &play_info, 0);
}
return play_type;
diff --git a/gst-libs/gst/play/play.h b/gst-libs/gst/play/play.h
index 8ccf827d..36d8aca2 100644
--- a/gst-libs/gst/play/play.h
+++ b/gst-libs/gst/play/play.h
@@ -16,7 +16,7 @@
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
-
+
#ifndef __GST_PLAY_H__
#define __GST_PLAY_H__
@@ -46,51 +46,43 @@ typedef enum
typedef struct _GstPlay GstPlay;
typedef struct _GstPlayClass GstPlayClass;
typedef struct _GstPlayPrivate GstPlayPrivate;
-
+
struct _GstPlay
{
GstPipeline pipeline;
-
+
GstPlayPrivate *priv;
-
+
gpointer _gst_reserved[GST_PADDING];
};
-
+
struct _GstPlayClass
{
GstPipelineClass parent_class;
-
- void (*time_tick) (GstPlay *play, gint64 time_nanos);
- void (*stream_length) (GstPlay *play, gint64 length_nanos);
- void (*have_video_size) (GstPlay *play, gint width, gint height);
-
+
+ void (*time_tick) (GstPlay * play, gint64 time_nanos);
+ void (*stream_length) (GstPlay * play, gint64 length_nanos);
+ void (*have_video_size) (GstPlay * play, gint width, gint height);
+
gpointer _gst_reserved[GST_PADDING];
};
-GType gst_play_get_type (void);
-GstPlay * gst_play_new (GError **error);
+GType gst_play_get_type (void);
+GstPlay *gst_play_new (GError ** error);
-gboolean gst_play_set_data_src (GstPlay *play,
- GstElement *data_src);
-gboolean gst_play_set_video_sink (GstPlay *play,
- GstElement *video_sink);
-gboolean gst_play_set_audio_sink (GstPlay *play,
- GstElement *audio_sink);
+gboolean gst_play_set_data_src (GstPlay * play, GstElement * data_src);
+gboolean gst_play_set_video_sink (GstPlay * play, GstElement * video_sink);
+gboolean gst_play_set_audio_sink (GstPlay * play, GstElement * audio_sink);
-gboolean gst_play_set_visualization (GstPlay *play,
- GstElement *element);
-gboolean gst_play_connect_visualization (GstPlay *play,
- gboolean connect);
+gboolean gst_play_set_visualization (GstPlay * play, GstElement * element);
+gboolean gst_play_connect_visualization (GstPlay * play, gboolean connect);
-gboolean gst_play_set_location (GstPlay *play,
- const char *location);
-char * gst_play_get_location (GstPlay *play);
+gboolean gst_play_set_location (GstPlay * play, const char *location);
+char *gst_play_get_location (GstPlay * play);
-gboolean gst_play_seek_to_time (GstPlay *play,
- gint64 time_nanos);
+gboolean gst_play_seek_to_time (GstPlay * play, gint64 time_nanos);
-GstElement * gst_play_get_sink_element (GstPlay *play,
- GstElement *element,
- GstPlaySinkType sink_type);
+GstElement *gst_play_get_sink_element (GstPlay * play,
+ GstElement * element, GstPlaySinkType sink_type);
#endif /* __GST_PLAY_H__ */
diff --git a/gst-libs/gst/propertyprobe/propertyprobe.c b/gst-libs/gst/propertyprobe/propertyprobe.c
index 85a98932..05dd3f8f 100644
--- a/gst-libs/gst/propertyprobe/propertyprobe.c
+++ b/gst-libs/gst/propertyprobe/propertyprobe.c
@@ -27,12 +27,13 @@
#include "propertyprobe.h"
-enum {
+enum
+{
SIGNAL_PROBE_NEEDED,
LAST_SIGNAL
};
-static void gst_property_probe_iface_init (GstPropertyProbeInterface *iface);
+static void gst_property_probe_iface_init (GstPropertyProbeInterface * iface);
static guint gst_property_probe_signals[LAST_SIGNAL] = { 0 };
@@ -56,30 +57,29 @@ gst_property_probe_get_type (void)
gst_property_probe_type =
g_type_register_static (G_TYPE_INTERFACE,
- "GstPropertyProbe",
- &gst_property_probe_info, 0);
+ "GstPropertyProbe", &gst_property_probe_info, 0);
}
return gst_property_probe_type;
}
static void
-gst_property_probe_iface_init (GstPropertyProbeInterface *iface)
+gst_property_probe_iface_init (GstPropertyProbeInterface * iface)
{
static gboolean initialized = FALSE;
if (!initialized) {
gst_property_probe_signals[SIGNAL_PROBE_NEEDED] =
- g_signal_new ("probe-needed", G_TYPE_FROM_CLASS (iface), G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstPropertyProbeInterface, probe_needed),
- NULL, NULL, g_cclosure_marshal_VOID__POINTER,
- G_TYPE_NONE, 1, G_TYPE_POINTER);
+ g_signal_new ("probe-needed", G_TYPE_FROM_CLASS (iface),
+ G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstPropertyProbeInterface,
+ probe_needed), NULL, NULL, g_cclosure_marshal_VOID__POINTER,
+ G_TYPE_NONE, 1, G_TYPE_POINTER);
initialized = TRUE;
}
/* default virtual functions */
iface->get_properties = NULL;
- iface->get_values = NULL;
+ iface->get_values = NULL;
}
/**
@@ -93,23 +93,22 @@ gst_property_probe_iface_init (GstPropertyProbeInterface *iface)
*/
const GList *
-gst_property_probe_get_properties (GstPropertyProbe *probe)
+gst_property_probe_get_properties (GstPropertyProbe * probe)
{
GstPropertyProbeInterface *iface;
g_return_val_if_fail (probe != NULL, NULL);
-
+
iface = GST_PROPERTY_PROBE_GET_IFACE (probe);
-
+
if (iface->get_properties)
return iface->get_properties (probe);
-
+
return NULL;
}
const GParamSpec *
-gst_property_probe_get_property (GstPropertyProbe *probe,
- const gchar *name)
+gst_property_probe_get_property (GstPropertyProbe * probe, const gchar * name)
{
const GList *pspecs = gst_property_probe_get_properties (probe);
@@ -129,8 +128,8 @@ gst_property_probe_get_property (GstPropertyProbe *probe,
}
void
-gst_property_probe_probe_property (GstPropertyProbe *probe,
- const GParamSpec *pspec)
+gst_property_probe_probe_property (GstPropertyProbe * probe,
+ const GParamSpec * pspec)
{
GstPropertyProbeInterface *iface;
@@ -156,8 +155,8 @@ gst_property_probe_probe_property (GstPropertyProbe *probe,
*/
void
-gst_property_probe_probe_property_name (GstPropertyProbe *probe,
- const gchar *name)
+gst_property_probe_probe_property_name (GstPropertyProbe * probe,
+ const gchar * name)
{
const GParamSpec *pspec;
@@ -188,8 +187,8 @@ gst_property_probe_probe_property_name (GstPropertyProbe *probe,
*/
gboolean
-gst_property_probe_needs_probe (GstPropertyProbe *probe,
- const GParamSpec *pspec)
+gst_property_probe_needs_probe (GstPropertyProbe * probe,
+ const GParamSpec * pspec)
{
GstPropertyProbeInterface *iface;
@@ -215,8 +214,8 @@ gst_property_probe_needs_probe (GstPropertyProbe *probe,
*/
gboolean
-gst_property_probe_needs_probe_name (GstPropertyProbe *probe,
- const gchar *name)
+gst_property_probe_needs_probe_name (GstPropertyProbe * probe,
+ const gchar * name)
{
const GParamSpec *pspec;
@@ -242,10 +241,10 @@ gst_property_probe_needs_probe_name (GstPropertyProbe *probe,
*
* Returns: A list of valid values for the given property.
*/
-
+
GValueArray *
-gst_property_probe_get_values (GstPropertyProbe *probe,
- const GParamSpec *pspec)
+gst_property_probe_get_values (GstPropertyProbe * probe,
+ const GParamSpec * pspec)
{
GstPropertyProbeInterface *iface;
@@ -271,8 +270,8 @@ gst_property_probe_get_values (GstPropertyProbe *probe,
*/
GValueArray *
-gst_property_probe_get_values_name (GstPropertyProbe *probe,
- const gchar *name)
+gst_property_probe_get_values_name (GstPropertyProbe * probe,
+ const gchar * name)
{
const GParamSpec *pspec;
@@ -301,8 +300,8 @@ gst_property_probe_get_values_name (GstPropertyProbe *probe,
*/
GValueArray *
-gst_property_probe_probe_and_get_values (GstPropertyProbe *probe,
- const GParamSpec *pspec)
+gst_property_probe_probe_and_get_values (GstPropertyProbe * probe,
+ const GParamSpec * pspec)
{
GstPropertyProbeInterface *iface;
@@ -328,8 +327,8 @@ gst_property_probe_probe_and_get_values (GstPropertyProbe *probe,
*/
GValueArray *
-gst_property_probe_probe_and_get_values_name (GstPropertyProbe *probe,
- const gchar *name)
+gst_property_probe_probe_and_get_values_name (GstPropertyProbe * probe,
+ const gchar * name)
{
const GParamSpec *pspec;
diff --git a/gst-libs/gst/propertyprobe/propertyprobe.h b/gst-libs/gst/propertyprobe/propertyprobe.h
index 695aa4da..39250a32 100644
--- a/gst-libs/gst/propertyprobe/propertyprobe.h
+++ b/gst-libs/gst/propertyprobe/propertyprobe.h
@@ -25,7 +25,6 @@
#include <gst/gst.h>
G_BEGIN_DECLS
-
#define GST_TYPE_PROPERTY_PROBE \
(gst_property_probe_get_type ())
#define GST_PROPERTY_PROBE(obj) \
@@ -34,64 +33,59 @@ G_BEGIN_DECLS
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PROPERTY_PROBE))
#define GST_PROPERTY_PROBE_GET_IFACE(obj) \
(G_TYPE_INSTANCE_GET_INTERFACE ((obj), GST_TYPE_PROPERTY_PROBE, GstPropertyProbeInterface))
+typedef struct _GstPropertyProbe GstPropertyProbe; /* dummy typedef */
-typedef struct _GstPropertyProbe GstPropertyProbe; /* dummy typedef */
-
-typedef struct _GstPropertyProbeInterface {
+typedef struct _GstPropertyProbeInterface
+{
GTypeInterface klass;
/* signals */
- void (*probe_needed) (GstPropertyProbe *probe,
- const GParamSpec *pspec);
+ void (*probe_needed) (GstPropertyProbe * probe, const GParamSpec * pspec);
/* virtual functions */
- const GList * (*get_properties) (GstPropertyProbe *probe);
- gboolean (*needs_probe) (GstPropertyProbe *probe,
- guint prop_id,
- const GParamSpec *pspec);
- void (*probe_property) (GstPropertyProbe *probe,
- guint prop_id,
- const GParamSpec *pspec);
- GValueArray * (*get_values) (GstPropertyProbe *probe,
- guint prop_id,
- const GParamSpec *pspec);
+ const GList *(*get_properties) (GstPropertyProbe * probe);
+ gboolean (*needs_probe) (GstPropertyProbe * probe,
+ guint prop_id, const GParamSpec * pspec);
+ void (*probe_property) (GstPropertyProbe * probe,
+ guint prop_id, const GParamSpec * pspec);
+ GValueArray *(*get_values) (GstPropertyProbe * probe,
+ guint prop_id, const GParamSpec * pspec);
gpointer _gst_reserved[GST_PADDING];
} GstPropertyProbeInterface;
-GType gst_property_probe_get_type (void);
+GType gst_property_probe_get_type (void);
/* virtual class function wrappers */
/* returns list of GParamSpecs */
-const GList * gst_property_probe_get_properties (GstPropertyProbe *probe);
-const GParamSpec *gst_property_probe_get_property (GstPropertyProbe *probe,
- const gchar *name);
+const GList *gst_property_probe_get_properties (GstPropertyProbe * probe);
+const GParamSpec *gst_property_probe_get_property (GstPropertyProbe * probe,
+ const gchar * name);
/* probe one property */
-void gst_property_probe_probe_property (GstPropertyProbe *probe,
- const GParamSpec *pspec);
-void gst_property_probe_probe_property_name (GstPropertyProbe *probe,
- const gchar *name);
+void gst_property_probe_probe_property (GstPropertyProbe * probe,
+ const GParamSpec * pspec);
+void gst_property_probe_probe_property_name (GstPropertyProbe * probe,
+ const gchar * name);
/* do we need a probe? */
-gboolean gst_property_probe_needs_probe (GstPropertyProbe *probe,
- const GParamSpec *pspec);
-gboolean gst_property_probe_needs_probe_name (GstPropertyProbe *probe,
- const gchar *name);
+gboolean gst_property_probe_needs_probe (GstPropertyProbe * probe,
+ const GParamSpec * pspec);
+gboolean gst_property_probe_needs_probe_name (GstPropertyProbe * probe,
+ const gchar * name);
/* returns list of GValues */
-GValueArray * gst_property_probe_get_values (GstPropertyProbe *probe,
- const GParamSpec *pspec);
-GValueArray * gst_property_probe_get_values_name (GstPropertyProbe *probe,
- const gchar *name);
+GValueArray *gst_property_probe_get_values (GstPropertyProbe * probe,
+ const GParamSpec * pspec);
+GValueArray *gst_property_probe_get_values_name (GstPropertyProbe * probe,
+ const gchar * name);
/* sugar */
-GValueArray * gst_property_probe_probe_and_get_values (GstPropertyProbe *probe,
- const GParamSpec *pspec);
-GValueArray * gst_property_probe_probe_and_get_values_name (GstPropertyProbe *probe,
- const gchar *name);
+GValueArray *gst_property_probe_probe_and_get_values (GstPropertyProbe * probe,
+ const GParamSpec * pspec);
+GValueArray *gst_property_probe_probe_and_get_values_name (GstPropertyProbe *
+ probe, const gchar * name);
G_END_DECLS
-
#endif /* __GST_PROPERTY_PROBE_H__ */
diff --git a/gst-libs/gst/resample/dtof.c b/gst-libs/gst/resample/dtof.c
index 7650453a..83534927 100644
--- a/gst-libs/gst/resample/dtof.c
+++ b/gst-libs/gst/resample/dtof.c
@@ -29,40 +29,46 @@
/*#include <ml.h> */
#include "private.h"
-void conv_double_float_ref(double *dest, float *src, int n)
+void
+conv_double_float_ref (double *dest, float *src, int n)
{
- int i;
- for(i=0;i<n;i++){
- dest[i]=src[i];
- }
+ int i;
+
+ for (i = 0; i < n; i++) {
+ dest[i] = src[i];
+ }
}
-void conv_float_double_ref(float *dest, double *src, int n)
+void
+conv_float_double_ref (float *dest, double *src, int n)
{
- int i;
- for(i=0;i<n;i++){
- dest[i]=src[i];
- }
+ int i;
+
+ for (i = 0; i < n; i++) {
+ dest[i] = src[i];
+ }
}
-void conv_double_float_dstr(double *dest, float *src, int n, int dstr)
+void
+conv_double_float_dstr (double *dest, float *src, int n, int dstr)
{
- int i;
- void *d = dest;
- for(i=0;i<n;i++){
- (*(double *)d)=*src++;
- d += dstr;
- }
+ int i;
+ void *d = dest;
+
+ for (i = 0; i < n; i++) {
+ (*(double *) d) = *src++;
+ d += dstr;
+ }
}
-void conv_float_double_sstr(float *dest, double *src, int n, int sstr)
+void
+conv_float_double_sstr (float *dest, double *src, int n, int sstr)
{
- int i;
- void *s = src;
+ int i;
+ void *s = src;
- for(i=0;i<n;i++){
- *dest++ = *(double *)s;
- s += sstr;
- }
+ for (i = 0; i < n; i++) {
+ *dest++ = *(double *) s;
+ s += sstr;
+ }
}
-
diff --git a/gst-libs/gst/resample/dtos.c b/gst-libs/gst/resample/dtos.c
index 268c401a..98e8f6a6 100644
--- a/gst-libs/gst/resample/dtos.c
+++ b/gst-libs/gst/resample/dtos.c
@@ -39,92 +39,98 @@
static float ints_high[256];
static float ints_low[256];
-void conv_double_short_table(double *dest, short *src, int n)
+void
+conv_double_short_table (double *dest, short *src, int n)
{
- static int init = 0;
- int i;
- unsigned int idx;
- if(!init){
- for(i=0;i<256;i++){
- ints_high[i]=256.0*((i<128)?i:i-256);
- ints_low[i]=i;
- }
- init = 1;
- }
-
- if(n&1){
- idx = (unsigned short)*src++;
- *dest++ = ints_high[(idx>>8)] + ints_low[(idx&0xff)];
- n-=1;
- }
- for(i=0;i<n;i+=2){
- idx = (unsigned short)*src++;
- *dest++ = ints_high[(idx>>8)] + ints_low[(idx&0xff)];
- idx = (unsigned short)*src++;
- *dest++ = ints_high[(idx>>8)] + ints_low[(idx&0xff)];
- }
+ static int init = 0;
+ int i;
+ unsigned int idx;
+
+ if (!init) {
+ for (i = 0; i < 256; i++) {
+ ints_high[i] = 256.0 * ((i < 128) ? i : i - 256);
+ ints_low[i] = i;
+ }
+ init = 1;
+ }
+
+ if (n & 1) {
+ idx = (unsigned short) *src++;
+ *dest++ = ints_high[(idx >> 8)] + ints_low[(idx & 0xff)];
+ n -= 1;
+ }
+ for (i = 0; i < n; i += 2) {
+ idx = (unsigned short) *src++;
+ *dest++ = ints_high[(idx >> 8)] + ints_low[(idx & 0xff)];
+ idx = (unsigned short) *src++;
+ *dest++ = ints_high[(idx >> 8)] + ints_low[(idx & 0xff)];
+ }
}
#endif
#ifdef short_to_double_unroll
-void conv_double_short_unroll(double *dest, short *src, int n)
+void
+conv_double_short_unroll (double *dest, short *src, int n)
{
- if(n&1){
- *dest++ = *src++;
- n--;
- }
- if(n&2){
- *dest++ = *src++;
- *dest++ = *src++;
- n-=2;
- }
- while(n>0){
- *dest++ = *src++;
- *dest++ = *src++;
- *dest++ = *src++;
- *dest++ = *src++;
- n-=4;
- }
+ if (n & 1) {
+ *dest++ = *src++;
+ n--;
+ }
+ if (n & 2) {
+ *dest++ = *src++;
+ *dest++ = *src++;
+ n -= 2;
+ }
+ while (n > 0) {
+ *dest++ = *src++;
+ *dest++ = *src++;
+ *dest++ = *src++;
+ *dest++ = *src++;
+ n -= 4;
+ }
}
#endif
-void conv_double_short_ref(double *dest, short *src, int n)
+void
+conv_double_short_ref (double *dest, short *src, int n)
{
- int i;
- for(i=0;i<n;i++){
- dest[i]=src[i];
- }
+ int i;
+
+ for (i = 0; i < n; i++) {
+ dest[i] = src[i];
+ }
}
#ifdef HAVE_CPU_PPC
#if 0
-static union { int i[4]; float f[4]; } av_tmp __attribute__ ((__aligned__ (16)));
+static union
+{
+ int i[4];
+ float f[4];
+} av_tmp __attribute__ ((__aligned__ (16)));
-void conv_double_short_altivec(double *dest, short *src, int n)
+void
+conv_double_short_altivec (double *dest, short *src, int n)
{
- int i;
-
- for(i=0;i<n;i+=4){
- av_tmp.i[0] = src[0];
- av_tmp.i[1] = src[1];
- av_tmp.i[2] = src[2];
- av_tmp.i[3] = src[3];
-
- asm(
- " lvx 0,0,%0\n"
- " vcfsx 1,0,0\n"
- " stvx 1,0,%0\n"
- : : "r" (&av_tmp)
- );
-
- dest[0]=av_tmp.f[0];
- dest[1]=av_tmp.f[1];
- dest[2]=av_tmp.f[2];
- dest[3]=av_tmp.f[3];
- src += 4;
- dest += 4;
- }
+ int i;
+
+ for (i = 0; i < n; i += 4) {
+ av_tmp.i[0] = src[0];
+ av_tmp.i[1] = src[1];
+ av_tmp.i[2] = src[2];
+ av_tmp.i[3] = src[3];
+
+ asm (" lvx 0,0,%0\n" " vcfsx 1,0,0\n" " stvx 1,0,%0\n": :"r" (&av_tmp)
+ );
+
+ dest[0] = av_tmp.f[0];
+ dest[1] = av_tmp.f[1];
+ dest[2] = av_tmp.f[2];
+ dest[3] = av_tmp.f[3];
+ src += 4;
+ dest += 4;
+ }
}
#endif
#endif
@@ -133,73 +139,78 @@ void conv_double_short_altivec(double *dest, short *src, int n)
/* double to short */
-void conv_short_double_ref(short *dest, double *src, int n)
+void
+conv_short_double_ref (short *dest, double *src, int n)
{
- int i;
- double x;
-
- for(i=0;i<n;i++){
- x = *src++;
- if(x<-32768.0)x=-32768.0;
- if(x>32767.0)x=32767.0;
- *dest++ = rint(x);
- }
+ int i;
+ double x;
+
+ for (i = 0; i < n; i++) {
+ x = *src++;
+ if (x < -32768.0)
+ x = -32768.0;
+ if (x > 32767.0)
+ x = 32767.0;
+ *dest++ = rint (x);
+ }
}
/* #ifdef HAVE_CPU_PPC */
#if 0
-void conv_short_double_ppcasm(short *dest, double *src, int n)
+void
+conv_short_double_ppcasm (short *dest, double *src, int n)
{
- int tmp[2];
- double min = -32768.0;
- double max = 32767.0;
- double ftmp0, ftmp1;
-
- asm __volatile__(
- "\taddic. %3,%3,-8\n"
- "\taddic. %6,%6,-2\n"
- "loop:\n"
- "\tlfdu %0,8(%3)\n"
- "\tfsub %1,%0,%4\n"
- "\tfsel %0,%1,%0,%4\n"
- "\tfsub %1,%0,%5\n"
- "\tfsel %0,%1,%5,%0\n"
- "\tfctiw %1,%0\n"
- "\taddic. 5,5,-1\n"
- "\tstfd %1,0(%2)\n"
- "\tlhz 9,6(%2)\n"
- "\tsthu 9,2(%6)\n"
- "\tbne loop\n"
- : "=&f" (ftmp0), "=&f" (ftmp1)
- : "b" (tmp), "r" (src), "f" (min), "f" (max), "r" (dest)
- : "r9", "r5" );
+ int tmp[2];
+ double min = -32768.0;
+ double max = 32767.0;
+ double ftmp0, ftmp1;
+
+ asm __volatile__ ("\taddic. %3,%3,-8\n"
+ "\taddic. %6,%6,-2\n"
+ "loop:\n"
+ "\tlfdu %0,8(%3)\n"
+ "\tfsub %1,%0,%4\n"
+ "\tfsel %0,%1,%0,%4\n"
+ "\tfsub %1,%0,%5\n"
+ "\tfsel %0,%1,%5,%0\n"
+ "\tfctiw %1,%0\n"
+ "\taddic. 5,5,-1\n"
+ "\tstfd %1,0(%2)\n"
+ "\tlhz 9,6(%2)\n"
+ "\tsthu 9,2(%6)\n" "\tbne loop\n":"=&f" (ftmp0), "=&f" (ftmp1)
+ :"b" (tmp), "r" (src), "f" (min), "f" (max), "r" (dest)
+ :"r9", "r5");
}
#endif
-void conv_double_short_dstr(double *dest, short *src, int n, int dstr)
+void
+conv_double_short_dstr (double *dest, short *src, int n, int dstr)
{
- int i;
- void *d = dest;
- for(i=0;i<n;i++){
- (*(double *)d)=*src++;
- d += dstr;
- }
+ int i;
+ void *d = dest;
+
+ for (i = 0; i < n; i++) {
+ (*(double *) d) = *src++;
+ d += dstr;
+ }
}
-void conv_short_double_sstr(short *dest, double *src, int n, int sstr)
+void
+conv_short_double_sstr (short *dest, double *src, int n, int sstr)
{
- int i;
- double x;
- void *s = src;
-
- for(i=0;i<n;i++){
- x = *(double *)s;
- if(x<-32768.0)x=-32768.0;
- if(x>32767.0)x=32767.0;
- *dest++ = rint(x);
- s += sstr;
- }
+ int i;
+ double x;
+ void *s = src;
+
+ for (i = 0; i < n; i++) {
+ x = *(double *) s;
+ if (x < -32768.0)
+ x = -32768.0;
+ if (x > 32767.0)
+ x = 32767.0;
+ *dest++ = rint (x);
+ s += sstr;
+ }
}
-
diff --git a/gst-libs/gst/resample/functable.c b/gst-libs/gst/resample/functable.c
index 75b81f36..29ce0418 100644
--- a/gst-libs/gst/resample/functable.c
+++ b/gst-libs/gst/resample/functable.c
@@ -30,285 +30,293 @@
-double functable_sinc(void *p,double x)
+double
+functable_sinc (void *p, double x)
{
- if(x==0)return 1;
- return sin(x)/x;
+ if (x == 0)
+ return 1;
+ return sin (x) / x;
}
-double functable_dsinc(void *p,double x)
+double
+functable_dsinc (void *p, double x)
{
- if(x==0)return 0;
- return cos(x)/x - sin(x)/(x*x);
+ if (x == 0)
+ return 0;
+ return cos (x) / x - sin (x) / (x * x);
}
-double functable_window_boxcar(void *p,double x)
+double
+functable_window_boxcar (void *p, double x)
{
- if(x<-1 || x>1)return 0;
- return 1;
+ if (x < -1 || x > 1)
+ return 0;
+ return 1;
}
-double functable_window_dboxcar(void *p,double x)
+double
+functable_window_dboxcar (void *p, double x)
{
- return 0;
+ return 0;
}
-double functable_window_std(void *p,double x)
+double
+functable_window_std (void *p, double x)
{
- if(x<-1 || x>1)return 0;
- return (1-x*x)*(1-x*x);
+ if (x < -1 || x > 1)
+ return 0;
+ return (1 - x * x) * (1 - x * x);
}
-double functable_window_dstd(void *p,double x)
+double
+functable_window_dstd (void *p, double x)
{
- if(x<-1 || x>1)return 0;
- return -4*x*(1-x*x);
+ if (x < -1 || x > 1)
+ return 0;
+ return -4 * x * (1 - x * x);
}
-void functable_init(functable_t *t)
+void
+functable_init (functable_t * t)
{
- int i;
- double x;
+ int i;
+ double x;
- t->fx = malloc(sizeof(double)*(t->len+1));
- t->fdx = malloc(sizeof(double)*(t->len+1));
+ t->fx = malloc (sizeof (double) * (t->len + 1));
+ t->fdx = malloc (sizeof (double) * (t->len + 1));
- t->invoffset = 1.0 / t->offset;
+ t->invoffset = 1.0 / t->offset;
- for(i=0;i<t->len+1;i++){
- x = t->start + t->offset * i;
- x *= t->scale;
+ for (i = 0; i < t->len + 1; i++) {
+ x = t->start + t->offset * i;
+ x *= t->scale;
- t->fx[i] = t->func_x(t->priv,x);
- t->fdx[i] = t->scale * t->func_dx(t->priv,x);
- }
- if(t->func2_x){
- double f1x,f1dx;
- double f2x,f2dx;
+ t->fx[i] = t->func_x (t->priv, x);
+ t->fdx[i] = t->scale * t->func_dx (t->priv, x);
+ }
+ if (t->func2_x) {
+ double f1x, f1dx;
+ double f2x, f2dx;
- for(i=0;i<t->len+1;i++){
- x = t->start + t->offset * i;
- x *= t->scale2;
+ for (i = 0; i < t->len + 1; i++) {
+ x = t->start + t->offset * i;
+ x *= t->scale2;
- f2x = t->func2_x(t->priv,x);
- f2dx = t->scale2 * t->func2_dx(t->priv,x);
+ f2x = t->func2_x (t->priv, x);
+ f2dx = t->scale2 * t->func2_dx (t->priv, x);
- f1x = t->fx[i];
- f1dx = t->fdx[i];
+ f1x = t->fx[i];
+ f1dx = t->fdx[i];
- t->fx[i] = f1x * f2x;
- t->fdx[i] = f1x * f2dx + f1dx * f2x;
- }
- }
+ t->fx[i] = f1x * f2x;
+ t->fdx[i] = f1x * f2dx + f1dx * f2x;
+ }
+ }
}
-double functable_eval(functable_t *t,double x)
+double
+functable_eval (functable_t * t, double x)
{
- int i;
- double f0, f1, w0, w1;
- double x2, x3;
- double w;
+ int i;
+ double f0, f1, w0, w1;
+ double x2, x3;
+ double w;
- if(x<t->start || x>(t->start+(t->len+1)*t->offset)){
- printf("x out of range %g\n",x);
- }
- x -= t->start;
- x /= t->offset;
- i = floor(x);
- x -= i;
+ if (x < t->start || x > (t->start + (t->len + 1) * t->offset)) {
+ printf ("x out of range %g\n", x);
+ }
+ x -= t->start;
+ x /= t->offset;
+ i = floor (x);
+ x -= i;
- x2 = x * x;
- x3 = x2 * x;
+ x2 = x * x;
+ x3 = x2 * x;
- f1 = 3 * x2 - 2 * x3;
- f0 = 1 - f1;
- w0 = (x - 2 * x2 + x3) * t->offset;
- w1 = (-x2 + x3) * t->offset;
+ f1 = 3 * x2 - 2 * x3;
+ f0 = 1 - f1;
+ w0 = (x - 2 * x2 + x3) * t->offset;
+ w1 = (-x2 + x3) * t->offset;
- /*printf("i=%d x=%g f0=%g f1=%g w0=%g w1=%g\n",i,x,f0,f1,w0,w1); */
+ /*printf("i=%d x=%g f0=%g f1=%g w0=%g w1=%g\n",i,x,f0,f1,w0,w1); */
- w = t->fx[i] * f0 + t->fx[i + 1] * f1 +
- t->fdx[i] * w0 + t->fdx[i + 1] * w1;
+ w = t->fx[i] * f0 + t->fx[i + 1] * f1 + t->fdx[i] * w0 + t->fdx[i + 1] * w1;
- /*w = t->fx[i] * (1-x) + t->fx[i+1] * x; */
+ /*w = t->fx[i] * (1-x) + t->fx[i+1] * x; */
- return w;
+ return w;
}
-double functable_fir(functable_t *t, double x, int n, double *data, int len)
+double
+functable_fir (functable_t * t, double x, int n, double *data, int len)
{
- int i,j;
- double f0, f1, w0, w1;
- double x2, x3;
- double w;
- double sum;
-
- x -= t->start;
- x /= t->offset;
- i = floor(x);
- x -= i;
-
- x2 = x * x;
- x3 = x2 * x;
-
- f1 = 3 * x2 - 2 * x3;
- f0 = 1 - f1;
- w0 = (x - 2 * x2 + x3) * t->offset;
- w1 = (-x2 + x3) * t->offset;
-
- sum = 0;
- for(j=0;j<len;j++){
- w = t->fx[i] * f0 + t->fx[i + 1] * f1 +
- t->fdx[i] * w0 + t->fdx[i + 1] * w1;
- sum += data[j*2] * w;
- i += n;
- }
-
- return sum;
+ int i, j;
+ double f0, f1, w0, w1;
+ double x2, x3;
+ double w;
+ double sum;
+
+ x -= t->start;
+ x /= t->offset;
+ i = floor (x);
+ x -= i;
+
+ x2 = x * x;
+ x3 = x2 * x;
+
+ f1 = 3 * x2 - 2 * x3;
+ f0 = 1 - f1;
+ w0 = (x - 2 * x2 + x3) * t->offset;
+ w1 = (-x2 + x3) * t->offset;
+
+ sum = 0;
+ for (j = 0; j < len; j++) {
+ w = t->fx[i] * f0 + t->fx[i + 1] * f1 + t->fdx[i] * w0 + t->fdx[i + 1] * w1;
+ sum += data[j * 2] * w;
+ i += n;
+ }
+
+ return sum;
}
-void functable_fir2(functable_t *t, double *r0, double *r1, double x,
- int n, double *data, int len)
+void
+functable_fir2 (functable_t * t, double *r0, double *r1, double x,
+ int n, double *data, int len)
{
- int i,j;
- double f0, f1, w0, w1;
- double x2, x3;
- double w;
- double sum0, sum1;
- double floor_x;
-
- x -= t->start;
- x *= t->invoffset;
- floor_x = floor(x);
- i = floor_x;
- x -= floor_x;
-
- x2 = x * x;
- x3 = x2 * x;
-
- f1 = 3 * x2 - 2 * x3;
- f0 = 1 - f1;
- w0 = (x - 2 * x2 + x3) * t->offset;
- w1 = (-x2 + x3) * t->offset;
-
- sum0 = 0;
- sum1 = 0;
- for(j=0;j<len;j++){
- w = t->fx[i] * f0 + t->fx[i + 1] * f1 +
- t->fdx[i] * w0 + t->fdx[i + 1] * w1;
- sum0 += data[j*2] * w;
- sum1 += data[j*2+1] * w;
- i += n;
+ int i, j;
+ double f0, f1, w0, w1;
+ double x2, x3;
+ double w;
+ double sum0, sum1;
+ double floor_x;
+
+ x -= t->start;
+ x *= t->invoffset;
+ floor_x = floor (x);
+ i = floor_x;
+ x -= floor_x;
+
+ x2 = x * x;
+ x3 = x2 * x;
+
+ f1 = 3 * x2 - 2 * x3;
+ f0 = 1 - f1;
+ w0 = (x - 2 * x2 + x3) * t->offset;
+ w1 = (-x2 + x3) * t->offset;
+
+ sum0 = 0;
+ sum1 = 0;
+ for (j = 0; j < len; j++) {
+ w = t->fx[i] * f0 + t->fx[i + 1] * f1 + t->fdx[i] * w0 + t->fdx[i + 1] * w1;
+ sum0 += data[j * 2] * w;
+ sum1 += data[j * 2 + 1] * w;
+ i += n;
#define unroll2
#define unroll3
#define unroll4
#ifdef unroll2
- j++;
+ j++;
- w = t->fx[i] * f0 + t->fx[i + 1] * f1 +
- t->fdx[i] * w0 + t->fdx[i + 1] * w1;
- sum0 += data[j*2] * w;
- sum1 += data[j*2+1] * w;
- i += n;
+ w = t->fx[i] * f0 + t->fx[i + 1] * f1 + t->fdx[i] * w0 + t->fdx[i + 1] * w1;
+ sum0 += data[j * 2] * w;
+ sum1 += data[j * 2 + 1] * w;
+ i += n;
#endif
#ifdef unroll3
- j++;
+ j++;
- w = t->fx[i] * f0 + t->fx[i + 1] * f1 +
- t->fdx[i] * w0 + t->fdx[i + 1] * w1;
- sum0 += data[j*2] * w;
- sum1 += data[j*2+1] * w;
- i += n;
+ w = t->fx[i] * f0 + t->fx[i + 1] * f1 + t->fdx[i] * w0 + t->fdx[i + 1] * w1;
+ sum0 += data[j * 2] * w;
+ sum1 += data[j * 2 + 1] * w;
+ i += n;
#endif
#ifdef unroll4
- j++;
+ j++;
- w = t->fx[i] * f0 + t->fx[i + 1] * f1 +
- t->fdx[i] * w0 + t->fdx[i + 1] * w1;
- sum0 += data[j*2] * w;
- sum1 += data[j*2+1] * w;
- i += n;
+ w = t->fx[i] * f0 + t->fx[i + 1] * f1 + t->fdx[i] * w0 + t->fdx[i + 1] * w1;
+ sum0 += data[j * 2] * w;
+ sum1 += data[j * 2 + 1] * w;
+ i += n;
#endif
- }
+ }
- *r0 = sum0;
- *r1 = sum1;
+ *r0 = sum0;
+ *r1 = sum1;
}
#ifdef unused
-void functable_fir2_altivec(functable_t *t, float *r0, float *r1,
- double x, int n, float *data, int len)
+void
+functable_fir2_altivec (functable_t * t, float *r0, float *r1,
+ double x, int n, float *data, int len)
{
- int i,j;
- double f0, f1, w0, w1;
- double x2, x3;
- double w;
- double sum0, sum1;
- double floor_x;
-
- x -= t->start;
- x *= t->invoffset;
- floor_x = floor(x);
- i = floor_x;
- x -= floor_x;
-
- x2 = x * x;
- x3 = x2 * x;
-
- f1 = 3 * x2 - 2 * x3;
- f0 = 1 - f1;
- w0 = (x - 2 * x2 + x3) * t->offset;
- w1 = (-x2 + x3) * t->offset;
-
- sum0 = 0;
- sum1 = 0;
- for(j=0;j<len;j++){
- /* t->fx, t->fdx needs to be multiplexed by n */
- /* we need 5 consecutive floats, which fit into 2 vecs */
- /* load v0, t->fx[i] */
- /* load v1, t->fx[i+n] */
- /* v2 = v0 (not correct) */
- /* v3 = (v0>>32) || (v1<<3*32) (not correct) */
- /* */
- /* load v4, t->dfx[i] */
- /* load v5, t->dfx[i+n] */
- /* v6 = v4 (not correct) */
- /* v7 = (v4>>32) || (v5<<3*32) (not correct) */
- /* */
- /* v8 = splat(f0) */
- /* v9 = splat(f1) */
- /* v10 = splat(w0) */
- /* v11 = splat(w1) */
- /* */
- /* v12 = v2 * v8 */
- /* v12 += v3 * v9 */
- /* v12 += v6 * v10 */
- /* v12 += v7 * v11 */
-
- w = t->fx[i] * f0 + t->fx[i + 1] * f1 +
- t->fdx[i] * w0 + t->fdx[i + 1] * w1;
-
- /* v13 = data[j*2] */
- /* v14 = data[j*2+4] */
- /* v15 = deinterlace_high(v13,v14) */
- /* v16 = deinterlace_low(v13,v14) */
- /* (sum0) v17 += multsum(v13,v15) */
- /* (sum1) v18 += multsum(v14,v16) */
-
- sum0 += data[j*2] * w;
- sum1 += data[j*2+1] * w;
- i += n;
-
- }
-
- *r0 = sum0;
- *r1 = sum1;
+ int i, j;
+ double f0, f1, w0, w1;
+ double x2, x3;
+ double w;
+ double sum0, sum1;
+ double floor_x;
+
+ x -= t->start;
+ x *= t->invoffset;
+ floor_x = floor (x);
+ i = floor_x;
+ x -= floor_x;
+
+ x2 = x * x;
+ x3 = x2 * x;
+
+ f1 = 3 * x2 - 2 * x3;
+ f0 = 1 - f1;
+ w0 = (x - 2 * x2 + x3) * t->offset;
+ w1 = (-x2 + x3) * t->offset;
+
+ sum0 = 0;
+ sum1 = 0;
+ for (j = 0; j < len; j++) {
+ /* t->fx, t->fdx needs to be multiplexed by n */
+ /* we need 5 consecutive floats, which fit into 2 vecs */
+ /* load v0, t->fx[i] */
+ /* load v1, t->fx[i+n] */
+ /* v2 = v0 (not correct) */
+ /* v3 = (v0>>32) || (v1<<3*32) (not correct) */
+ /* */
+ /* load v4, t->dfx[i] */
+ /* load v5, t->dfx[i+n] */
+ /* v6 = v4 (not correct) */
+ /* v7 = (v4>>32) || (v5<<3*32) (not correct) */
+ /* */
+ /* v8 = splat(f0) */
+ /* v9 = splat(f1) */
+ /* v10 = splat(w0) */
+ /* v11 = splat(w1) */
+ /* */
+ /* v12 = v2 * v8 */
+ /* v12 += v3 * v9 */
+ /* v12 += v6 * v10 */
+ /* v12 += v7 * v11 */
+
+ w = t->fx[i] * f0 + t->fx[i + 1] * f1 + t->fdx[i] * w0 + t->fdx[i + 1] * w1;
+
+ /* v13 = data[j*2] */
+ /* v14 = data[j*2+4] */
+ /* v15 = deinterlace_high(v13,v14) */
+ /* v16 = deinterlace_low(v13,v14) */
+ /* (sum0) v17 += multsum(v13,v15) */
+ /* (sum1) v18 += multsum(v14,v16) */
+
+ sum0 += data[j * 2] * w;
+ sum1 += data[j * 2 + 1] * w;
+ i += n;
+
+ }
+
+ *r0 = sum0;
+ *r1 = sum1;
}
#endif
-
diff --git a/gst-libs/gst/resample/private.h b/gst-libs/gst/resample/private.h
index 5791f580..a0d37f41 100644
--- a/gst-libs/gst/resample/private.h
+++ b/gst-libs/gst/resample/private.h
@@ -23,68 +23,71 @@
#include "resample.h"
-void gst_resample_nearest_s16(gst_resample_t *r);
-void gst_resample_bilinear_s16(gst_resample_t *r);
-void gst_resample_sinc_s16(gst_resample_t *r);
-void gst_resample_sinc_slow_s16(gst_resample_t *r);
-void gst_resample_sinc_ft_s16(gst_resample_t * r);
+void gst_resample_nearest_s16 (gst_resample_t * r);
+void gst_resample_bilinear_s16 (gst_resample_t * r);
+void gst_resample_sinc_s16 (gst_resample_t * r);
+void gst_resample_sinc_slow_s16 (gst_resample_t * r);
+void gst_resample_sinc_ft_s16 (gst_resample_t * r);
-void gst_resample_nearest_float(gst_resample_t *r);
-void gst_resample_bilinear_float(gst_resample_t *r);
-void gst_resample_sinc_float(gst_resample_t *r);
-void gst_resample_sinc_slow_float(gst_resample_t *r);
-void gst_resample_sinc_ft_float(gst_resample_t * r);
+void gst_resample_nearest_float (gst_resample_t * r);
+void gst_resample_bilinear_float (gst_resample_t * r);
+void gst_resample_sinc_float (gst_resample_t * r);
+void gst_resample_sinc_slow_float (gst_resample_t * r);
+void gst_resample_sinc_ft_float (gst_resample_t * r);
typedef struct functable_s functable_t;
-struct functable_s {
- double start;
- double offset;
- int len;
+struct functable_s
+{
+ double start;
+ double offset;
+ int len;
- double invoffset;
+ double invoffset;
- double scale;
- double scale2;
+ double scale;
+ double scale2;
- double (*func_x)(void *,double x);
- double (*func_dx)(void *,double x);
+ double (*func_x) (void *, double x);
+ double (*func_dx) (void *, double x);
- double (*func2_x)(void *,double x);
- double (*func2_dx)(void *,double x);
+ double (*func2_x) (void *, double x);
+ double (*func2_dx) (void *, double x);
- double *fx;
- double *fdx;
+ double *fx;
+ double *fdx;
- void *priv;
+ void *priv;
};
-void functable_init(functable_t *t);
-double functable_eval(functable_t *t,double x);
+void functable_init (functable_t * t);
+double functable_eval (functable_t * t, double x);
-double functable_fir(functable_t *t,double x0,int n,double *data,int len);
-void functable_fir2(functable_t *t,double *r0, double *r1, double x0,
- int n,double *data,int len);
+double functable_fir (functable_t * t, double x0, int n, double *data, int len);
+void functable_fir2 (functable_t * t, double *r0, double *r1, double x0,
+ int n, double *data, int len);
-double functable_sinc(void *p, double x);
-double functable_dsinc(void *p, double x);
-double functable_window_std(void *p, double x);
-double functable_window_dstd(void *p, double x);
-double functable_window_boxcar(void *p, double x);
-double functable_window_dboxcar(void *p, double x);
+double functable_sinc (void *p, double x);
+double functable_dsinc (void *p, double x);
+double functable_window_std (void *p, double x);
+double functable_window_dstd (void *p, double x);
+double functable_window_boxcar (void *p, double x);
+double functable_window_dboxcar (void *p, double x);
/* math lib stuff */
-void conv_double_short_table(double *dest, short *src, int n);
-void conv_double_short_unroll(double *dest, short *src, int n);
-void conv_double_short_ref(double *dest, short *src, int n);
+void conv_double_short_table (double *dest, short *src, int n);
+void conv_double_short_unroll (double *dest, short *src, int n);
+void conv_double_short_ref (double *dest, short *src, int n);
+
#ifdef HAVE_CPU_PPC
-void conv_double_short_altivec(double *dest, short *src, int n);
+void conv_double_short_altivec (double *dest, short *src, int n);
#endif
-void conv_short_double_ref(short *dest, double *src, int n);
+void conv_short_double_ref (short *dest, double *src, int n);
+
#ifdef HAVE_CPU_PPC
-void conv_short_double_ppcasm(short *dest, double *src, int n);
+void conv_short_double_ppcasm (short *dest, double *src, int n);
#endif
#ifdef HAVE_CPU_PPC
@@ -98,12 +101,12 @@ void conv_short_double_ppcasm(short *dest, double *src, int n);
#define conv_double_float conv_double_float_ref
#define conv_float_double conv_float_double_ref
-void conv_double_short_dstr(double *dest, short *src, int n, int dstr);
-void conv_short_double_sstr(short *dest, double *src, int n, int dstr);
+void conv_double_short_dstr (double *dest, short *src, int n, int dstr);
+void conv_short_double_sstr (short *dest, double *src, int n, int dstr);
-void conv_double_float_ref(double *dest, float *src, int n);
-void conv_float_double_ref(float *dest, double *src, int n);
-void conv_double_float_dstr(double *dest, float *src, int n, int dstr);
-void conv_float_double_sstr(float *dest, double *src, int n, int sstr);
+void conv_double_float_ref (double *dest, float *src, int n);
+void conv_float_double_ref (float *dest, double *src, int n);
+void conv_double_float_dstr (double *dest, float *src, int n, int dstr);
+void conv_float_double_sstr (float *dest, double *src, int n, int sstr);
#endif /* __PRIVATE_H__ */
diff --git a/gst-libs/gst/resample/resample.c b/gst-libs/gst/resample/resample.c
index 8cac9de6..cd409d23 100644
--- a/gst-libs/gst/resample/resample.c
+++ b/gst-libs/gst/resample/resample.c
@@ -30,100 +30,107 @@
#include <gst/gstplugin.h>
#include <gst/gstversion.h>
-inline double sinc(double x)
+inline double
+sinc (double x)
{
- if(x==0)return 1;
- return sin(x) / x;
+ if (x == 0)
+ return 1;
+ return sin (x) / x;
}
-inline double window_func(double x)
+inline double
+window_func (double x)
{
- x = 1 - x*x;
- return x*x;
+ x = 1 - x * x;
+ return x * x;
}
-signed short double_to_s16(double x)
+signed short
+double_to_s16 (double x)
{
- if(x<-32768){
- printf("clipped\n");
- return -32768;
- }
- if(x>32767){
- printf("clipped\n");
- return -32767;
- }
- return rint(x);
+ if (x < -32768) {
+ printf ("clipped\n");
+ return -32768;
+ }
+ if (x > 32767) {
+ printf ("clipped\n");
+ return -32767;
+ }
+ return rint (x);
}
-signed short double_to_s16_ppcasm(double x)
+signed short
+double_to_s16_ppcasm (double x)
{
- if(x<-32768){
- return -32768;
- }
- if(x>32767){
- return -32767;
- }
- return rint(x);
+ if (x < -32768) {
+ return -32768;
+ }
+ if (x > 32767) {
+ return -32767;
+ }
+ return rint (x);
}
-void gst_resample_init(gst_resample_t * r)
+void
+gst_resample_init (gst_resample_t * r)
{
- r->i_start = 0;
- if(r->filter_length&1){
- r->o_start = 0;
- }else{
- r->o_start = r->o_inc * 0.5;
- }
+ r->i_start = 0;
+ if (r->filter_length & 1) {
+ r->o_start = 0;
+ } else {
+ r->o_start = r->o_inc * 0.5;
+ }
- memset(r->acc, 0, sizeof(r->acc));
+ memset (r->acc, 0, sizeof (r->acc));
- gst_resample_reinit(r);
+ gst_resample_reinit (r);
}
-void gst_resample_reinit(gst_resample_t * r)
+void
+gst_resample_reinit (gst_resample_t * r)
{
- /* i_inc is the number of samples that the output increments for
- * each input sample. o_inc is the opposite. */
- r->i_inc = (double) r->o_rate / r->i_rate;
- r->o_inc = (double) r->i_rate / r->o_rate;
-
- r->halftaps = (r->filter_length - 1.0) * 0.5;
-
- if (r->format == GST_RESAMPLE_S16) {
- switch (r->method) {
- default:
- case GST_RESAMPLE_NEAREST:
- r->scale = gst_resample_nearest_s16;
- break;
- case GST_RESAMPLE_BILINEAR:
- r->scale = gst_resample_bilinear_s16;
- break;
- case GST_RESAMPLE_SINC_SLOW:
- r->scale = gst_resample_sinc_s16;
- break;
- case GST_RESAMPLE_SINC:
- r->scale = gst_resample_sinc_ft_s16;
- break;
- }
- } else if (r->format == GST_RESAMPLE_FLOAT) {
- switch (r->method) {
- default:
- case GST_RESAMPLE_NEAREST:
- r->scale = gst_resample_nearest_float;
- break;
- case GST_RESAMPLE_BILINEAR:
- r->scale = gst_resample_bilinear_float;
- break;
- case GST_RESAMPLE_SINC_SLOW:
- r->scale = gst_resample_sinc_float;
- break;
- case GST_RESAMPLE_SINC:
- r->scale = gst_resample_sinc_ft_float;
- break;
- }
- } else {
- fprintf (stderr, "gst_resample: Unexpected format \"%d\"\n", r->format);
- }
+ /* i_inc is the number of samples that the output increments for
+ * each input sample. o_inc is the opposite. */
+ r->i_inc = (double) r->o_rate / r->i_rate;
+ r->o_inc = (double) r->i_rate / r->o_rate;
+
+ r->halftaps = (r->filter_length - 1.0) * 0.5;
+
+ if (r->format == GST_RESAMPLE_S16) {
+ switch (r->method) {
+ default:
+ case GST_RESAMPLE_NEAREST:
+ r->scale = gst_resample_nearest_s16;
+ break;
+ case GST_RESAMPLE_BILINEAR:
+ r->scale = gst_resample_bilinear_s16;
+ break;
+ case GST_RESAMPLE_SINC_SLOW:
+ r->scale = gst_resample_sinc_s16;
+ break;
+ case GST_RESAMPLE_SINC:
+ r->scale = gst_resample_sinc_ft_s16;
+ break;
+ }
+ } else if (r->format == GST_RESAMPLE_FLOAT) {
+ switch (r->method) {
+ default:
+ case GST_RESAMPLE_NEAREST:
+ r->scale = gst_resample_nearest_float;
+ break;
+ case GST_RESAMPLE_BILINEAR:
+ r->scale = gst_resample_bilinear_float;
+ break;
+ case GST_RESAMPLE_SINC_SLOW:
+ r->scale = gst_resample_sinc_float;
+ break;
+ case GST_RESAMPLE_SINC:
+ r->scale = gst_resample_sinc_ft_float;
+ break;
+ }
+ } else {
+ fprintf (stderr, "gst_resample: Unexpected format \"%d\"\n", r->format);
+ }
}
/*
@@ -140,94 +147,94 @@ void gst_resample_reinit(gst_resample_t * r)
* i_start_buf is the time of the first sample in the temporary
* buffer.
*/
-void gst_resample_scale(gst_resample_t * r, void *i_buf, unsigned int i_size)
+void
+gst_resample_scale (gst_resample_t * r, void *i_buf, unsigned int i_size)
{
- int o_size;
-
- r->i_buf = i_buf;
-
- r->i_samples = i_size / 2 / r->channels;
-
- r->i_start_buf = r->i_start - r->filter_length * r->i_inc;
-
- /* i_start is the offset (in a given output sample) that is the
- * beginning of the current input buffer */
- r->i_end = r->i_start + r->i_inc * r->i_samples;
-
- r->o_samples = floor(r->i_end - r->halftaps * r->i_inc);
-
- o_size = r->o_samples * r->channels * 2;
- r->o_buf = r->get_buffer(r->priv, o_size);
-
- if(r->verbose){
- printf("gst_resample_scale: i_buf=%p i_size=%d\n",
- i_buf,i_size);
- printf("gst_resample_scale: i_samples=%d o_samples=%d i_inc=%g o_buf=%p\n",
- r->i_samples, r->o_samples, r->i_inc, r->o_buf);
- printf("gst_resample_scale: i_start=%g i_end=%g o_start=%g\n",
- r->i_start, r->i_end, r->o_start);
- }
-
- if ((r->filter_length + r->i_samples)*sizeof(double)*2 > r->buffer_len) {
- int size = (r->filter_length + r->i_samples) * sizeof(double) * 2;
-
- if(r->verbose){
- printf("gst_resample temp buffer size=%d\n",size);
- }
- if(r->buffer)free(r->buffer);
- r->buffer_len = size;
- r->buffer = malloc(size);
- memset(r->buffer, 0, size);
- }
-
- if (r->format==GST_RESAMPLE_S16) {
- if(r->channels==2){
- conv_double_short(
- r->buffer + r->filter_length * sizeof(double) * 2,
- r->i_buf, r->i_samples * 2);
- } else {
- conv_double_short_dstr(
- r->buffer + r->filter_length * sizeof(double) * 2,
- r->i_buf, r->i_samples, sizeof(double) * 2);
- }
- } else if (r->format==GST_RESAMPLE_FLOAT) {
- if(r->channels==2){
- conv_double_float(
- r->buffer + r->filter_length * sizeof(double) * 2,
- r->i_buf, r->i_samples * 2);
- } else {
- conv_double_float_dstr(
- r->buffer + r->filter_length * sizeof(double) * 2,
- r->i_buf, r->i_samples, sizeof(double) * 2);
- }
- }
-
- r->scale(r);
-
- memcpy(r->buffer,
- r->buffer + r->i_samples * sizeof(double) * 2,
- r->filter_length * sizeof(double) * 2);
-
- /* updating times */
- r->i_start += r->i_samples * r->i_inc;
- r->o_start += r->o_samples * r->o_inc - r->i_samples;
-
- /* adjusting timebase zero */
- r->i_start -= r->o_samples;
+ int o_size;
+
+ r->i_buf = i_buf;
+
+ r->i_samples = i_size / 2 / r->channels;
+
+ r->i_start_buf = r->i_start - r->filter_length * r->i_inc;
+
+ /* i_start is the offset (in a given output sample) that is the
+ * beginning of the current input buffer */
+ r->i_end = r->i_start + r->i_inc * r->i_samples;
+
+ r->o_samples = floor (r->i_end - r->halftaps * r->i_inc);
+
+ o_size = r->o_samples * r->channels * 2;
+ r->o_buf = r->get_buffer (r->priv, o_size);
+
+ if (r->verbose) {
+ printf ("gst_resample_scale: i_buf=%p i_size=%d\n", i_buf, i_size);
+ printf ("gst_resample_scale: i_samples=%d o_samples=%d i_inc=%g o_buf=%p\n",
+ r->i_samples, r->o_samples, r->i_inc, r->o_buf);
+ printf ("gst_resample_scale: i_start=%g i_end=%g o_start=%g\n",
+ r->i_start, r->i_end, r->o_start);
+ }
+
+ if ((r->filter_length + r->i_samples) * sizeof (double) * 2 > r->buffer_len) {
+ int size = (r->filter_length + r->i_samples) * sizeof (double) * 2;
+
+ if (r->verbose) {
+ printf ("gst_resample temp buffer size=%d\n", size);
+ }
+ if (r->buffer)
+ free (r->buffer);
+ r->buffer_len = size;
+ r->buffer = malloc (size);
+ memset (r->buffer, 0, size);
+ }
+
+ if (r->format == GST_RESAMPLE_S16) {
+ if (r->channels == 2) {
+ conv_double_short (r->buffer + r->filter_length * sizeof (double) * 2,
+ r->i_buf, r->i_samples * 2);
+ } else {
+ conv_double_short_dstr (r->buffer +
+ r->filter_length * sizeof (double) * 2, r->i_buf, r->i_samples,
+ sizeof (double) * 2);
+ }
+ } else if (r->format == GST_RESAMPLE_FLOAT) {
+ if (r->channels == 2) {
+ conv_double_float (r->buffer + r->filter_length * sizeof (double) * 2,
+ r->i_buf, r->i_samples * 2);
+ } else {
+ conv_double_float_dstr (r->buffer +
+ r->filter_length * sizeof (double) * 2, r->i_buf, r->i_samples,
+ sizeof (double) * 2);
+ }
+ }
+
+ r->scale (r);
+
+ memcpy (r->buffer,
+ r->buffer + r->i_samples * sizeof (double) * 2,
+ r->filter_length * sizeof (double) * 2);
+
+ /* updating times */
+ r->i_start += r->i_samples * r->i_inc;
+ r->o_start += r->o_samples * r->o_inc - r->i_samples;
+
+ /* adjusting timebase zero */
+ r->i_start -= r->o_samples;
}
-void gst_resample_nearest_s16(gst_resample_t * r)
+void
+gst_resample_nearest_s16 (gst_resample_t * r)
{
- signed short *i_ptr, *o_ptr;
- int i_count = 0;
- double a;
- int i;
+ signed short *i_ptr, *o_ptr;
+ int i_count = 0;
+ double a;
+ int i;
- i_ptr = (signed short *) r->i_buf;
- o_ptr = (signed short *) r->o_buf;
+ i_ptr = (signed short *) r->i_buf;
+ o_ptr = (signed short *) r->o_buf;
- a = r->o_start;
- i_count = 0;
+ a = r->o_start;
+ i_count = 0;
#define SCALE_LOOP(COPY,INC) \
for (i = 0; i < r->o_samples; i++) { \
COPY; \
@@ -240,191 +247,190 @@ void gst_resample_nearest_s16(gst_resample_t * r)
o_ptr+=INC; \
}
- switch (r->channels) {
- case 1:
- SCALE_LOOP(o_ptr[0] = i_ptr[0], 1);
- break;
- case 2:
- SCALE_LOOP(o_ptr[0] = i_ptr[0];
- o_ptr[1] = i_ptr[1], 2);
- break;
- default:
- {
- int n, n_chan = r->channels;
-
- SCALE_LOOP(for (n = 0; n < n_chan; n++) o_ptr[n] =
- i_ptr[n], n_chan);
- }
- }
- if (i_count != r->i_samples) {
- printf("handled %d in samples (expected %d)\n", i_count,
- r->i_samples);
- }
+ switch (r->channels) {
+ case 1:
+ SCALE_LOOP (o_ptr[0] = i_ptr[0], 1);
+ break;
+ case 2:
+ SCALE_LOOP (o_ptr[0] = i_ptr[0]; o_ptr[1] = i_ptr[1], 2);
+ break;
+ default:
+ {
+ int n, n_chan = r->channels;
+
+ SCALE_LOOP (for (n = 0; n < n_chan; n++) o_ptr[n] = i_ptr[n], n_chan);
+ }
+ }
+ if (i_count != r->i_samples) {
+ printf ("handled %d in samples (expected %d)\n", i_count, r->i_samples);
+ }
}
-void gst_resample_bilinear_s16(gst_resample_t * r)
+void
+gst_resample_bilinear_s16 (gst_resample_t * r)
{
- signed short *i_ptr, *o_ptr;
- int o_count = 0;
- double b;
- int i;
- double acc0, acc1;
-
- i_ptr = (signed short *) r->i_buf;
- o_ptr = (signed short *) r->o_buf;
-
- acc0 = r->acc[0];
- acc1 = r->acc[1];
- b = r->i_start;
- for (i = 0; i < r->i_samples; i++) {
- b += r->i_inc;
- /*printf("in %d\n",i_ptr[0]); */
- if(b>=2){
- printf("not expecting b>=2\n");
- }
- if (b >= 1) {
- acc0 += (1.0 - (b-r->i_inc)) * i_ptr[0];
- acc1 += (1.0 - (b-r->i_inc)) * i_ptr[1];
-
- o_ptr[0] = rint(acc0);
- /*printf("out %d\n",o_ptr[0]); */
- o_ptr[1] = rint(acc1);
- o_ptr += 2;
- o_count++;
-
- b -= 1.0;
-
- acc0 = b * i_ptr[0];
- acc1 = b * i_ptr[1];
- } else {
- acc0 += i_ptr[0] * r->i_inc;
- acc1 += i_ptr[1] * r->i_inc;
- }
- i_ptr += 2;
- }
- r->acc[0] = acc0;
- r->acc[1] = acc1;
-
- if (o_count != r->o_samples) {
- printf("handled %d out samples (expected %d)\n", o_count,
- r->o_samples);
- }
+ signed short *i_ptr, *o_ptr;
+ int o_count = 0;
+ double b;
+ int i;
+ double acc0, acc1;
+
+ i_ptr = (signed short *) r->i_buf;
+ o_ptr = (signed short *) r->o_buf;
+
+ acc0 = r->acc[0];
+ acc1 = r->acc[1];
+ b = r->i_start;
+ for (i = 0; i < r->i_samples; i++) {
+ b += r->i_inc;
+ /*printf("in %d\n",i_ptr[0]); */
+ if (b >= 2) {
+ printf ("not expecting b>=2\n");
+ }
+ if (b >= 1) {
+ acc0 += (1.0 - (b - r->i_inc)) * i_ptr[0];
+ acc1 += (1.0 - (b - r->i_inc)) * i_ptr[1];
+
+ o_ptr[0] = rint (acc0);
+ /*printf("out %d\n",o_ptr[0]); */
+ o_ptr[1] = rint (acc1);
+ o_ptr += 2;
+ o_count++;
+
+ b -= 1.0;
+
+ acc0 = b * i_ptr[0];
+ acc1 = b * i_ptr[1];
+ } else {
+ acc0 += i_ptr[0] * r->i_inc;
+ acc1 += i_ptr[1] * r->i_inc;
+ }
+ i_ptr += 2;
+ }
+ r->acc[0] = acc0;
+ r->acc[1] = acc1;
+
+ if (o_count != r->o_samples) {
+ printf ("handled %d out samples (expected %d)\n", o_count, r->o_samples);
+ }
}
-void gst_resample_sinc_slow_s16(gst_resample_t * r)
+void
+gst_resample_sinc_slow_s16 (gst_resample_t * r)
{
- signed short *i_ptr, *o_ptr;
- int i, j;
- double c0, c1;
- double a;
- int start;
- double center;
- double weight;
-
- if (!r->buffer) {
- int size = r->filter_length * 2 * r->channels;
-
- printf("gst_resample temp buffer\n");
- r->buffer = malloc(size);
- memset(r->buffer, 0, size);
- }
-
- i_ptr = (signed short *) r->i_buf;
- o_ptr = (signed short *) r->o_buf;
-
- a = r->i_start;
+ signed short *i_ptr, *o_ptr;
+ int i, j;
+ double c0, c1;
+ double a;
+ int start;
+ double center;
+ double weight;
+
+ if (!r->buffer) {
+ int size = r->filter_length * 2 * r->channels;
+
+ printf ("gst_resample temp buffer\n");
+ r->buffer = malloc (size);
+ memset (r->buffer, 0, size);
+ }
+
+ i_ptr = (signed short *) r->i_buf;
+ o_ptr = (signed short *) r->o_buf;
+
+ a = r->i_start;
#define GETBUF(index,chan) (((index)<0) \
? ((short *)(r->buffer))[((index)+r->filter_length)*2+(chan)] \
: i_ptr[(index)*2+(chan)])
- {
- double sinx, cosx, sind, cosd;
- double x, d;
- double t;
-
- for (i = 0; i < r->o_samples; i++) {
- start = floor(a) - r->filter_length;
- center = a - r->halftaps;
- x = M_PI * (start - center) * r->o_inc;
- sinx = sin(M_PI * (start - center) * r->o_inc);
- cosx = cos(M_PI * (start - center) * r->o_inc);
- d = M_PI * r->o_inc;
- sind = sin(M_PI * r->o_inc);
- cosd = cos(M_PI * r->o_inc);
- c0 = 0;
- c1 = 0;
- for (j = 0; j < r->filter_length; j++) {
- weight = (x==0)?1:(sinx/x);
+ {
+ double sinx, cosx, sind, cosd;
+ double x, d;
+ double t;
+
+ for (i = 0; i < r->o_samples; i++) {
+ start = floor (a) - r->filter_length;
+ center = a - r->halftaps;
+ x = M_PI * (start - center) * r->o_inc;
+ sinx = sin (M_PI * (start - center) * r->o_inc);
+ cosx = cos (M_PI * (start - center) * r->o_inc);
+ d = M_PI * r->o_inc;
+ sind = sin (M_PI * r->o_inc);
+ cosd = cos (M_PI * r->o_inc);
+ c0 = 0;
+ c1 = 0;
+ for (j = 0; j < r->filter_length; j++) {
+ weight = (x == 0) ? 1 : (sinx / x);
/*printf("j %d sin %g cos %g\n",j,sinx,cosx); */
/*printf("j %d sin %g x %g sinc %g\n",j,sinx,x,weight); */
- c0 += weight * GETBUF((start + j), 0);
- c1 += weight * GETBUF((start + j), 1);
- t = cosx * cosd - sinx * sind;
- sinx = cosx * sind + sinx * cosd;
- cosx = t;
- x += d;
- }
- o_ptr[0] = rint(c0);
- o_ptr[1] = rint(c1);
- o_ptr += 2;
- a += r->o_inc;
- }
- }
+ c0 += weight * GETBUF ((start + j), 0);
+ c1 += weight * GETBUF ((start + j), 1);
+ t = cosx * cosd - sinx * sind;
+ sinx = cosx * sind + sinx * cosd;
+ cosx = t;
+ x += d;
+ }
+ o_ptr[0] = rint (c0);
+ o_ptr[1] = rint (c1);
+ o_ptr += 2;
+ a += r->o_inc;
+ }
+ }
#undef GETBUF
- memcpy(r->buffer,
- i_ptr + (r->i_samples - r->filter_length) * r->channels,
- r->filter_length * 2 * r->channels);
+ memcpy (r->buffer,
+ i_ptr + (r->i_samples - r->filter_length) * r->channels,
+ r->filter_length * 2 * r->channels);
}
/* only works for channels == 2 ???? */
-void gst_resample_sinc_s16(gst_resample_t * r)
+void
+gst_resample_sinc_s16 (gst_resample_t * r)
{
- double *ptr;
- signed short *o_ptr;
- int i, j;
- double c0, c1;
- double a;
- int start;
- double center;
- double weight;
- double x0, x, d;
- double scale;
-
- ptr = (double *) r->buffer;
- o_ptr = (signed short *) r->o_buf;
-
- /* scale provides a cutoff frequency for the low
- * pass filter aspects of sinc(). scale=M_PI
- * will cut off at the input frequency, which is
- * good for up-sampling, but will cause aliasing
- * for downsampling. Downsampling needs to be
- * cut off at o_rate, thus scale=M_PI*r->i_inc. */
- /* actually, it needs to be M_PI*r->i_inc*r->i_inc.
- * Need to research why. */
- scale = M_PI*r->i_inc;
- for (i = 0; i < r->o_samples; i++) {
- a = r->o_start + i * r->o_inc;
- start = floor(a - r->halftaps);
+ double *ptr;
+ signed short *o_ptr;
+ int i, j;
+ double c0, c1;
+ double a;
+ int start;
+ double center;
+ double weight;
+ double x0, x, d;
+ double scale;
+
+ ptr = (double *) r->buffer;
+ o_ptr = (signed short *) r->o_buf;
+
+ /* scale provides a cutoff frequency for the low
+ * pass filter aspects of sinc(). scale=M_PI
+ * will cut off at the input frequency, which is
+ * good for up-sampling, but will cause aliasing
+ * for downsampling. Downsampling needs to be
+ * cut off at o_rate, thus scale=M_PI*r->i_inc. */
+ /* actually, it needs to be M_PI*r->i_inc*r->i_inc.
+ * Need to research why. */
+ scale = M_PI * r->i_inc;
+ for (i = 0; i < r->o_samples; i++) {
+ a = r->o_start + i * r->o_inc;
+ start = floor (a - r->halftaps);
/*printf("%d: a=%g start=%d end=%d\n",i,a,start,start+r->filter_length-1); */
- center = a;
- /*x = M_PI * (start - center) * r->o_inc; */
- /*d = M_PI * r->o_inc; */
- /*x = (start - center) * r->o_inc; */
- x0 = (start - center) * r->o_inc;
- d = r->o_inc;
- c0 = 0;
- c1 = 0;
- for (j = 0; j < r->filter_length; j++) {
- x = x0 + d * j;
- weight = sinc(x*scale*r->i_inc)*scale/M_PI;
- weight *= window_func(x/r->halftaps*r->i_inc);
- c0 += weight * ptr[(start + j + r->filter_length)*2 + 0];
- c1 += weight * ptr[(start + j + r->filter_length)*2 + 1];
- }
- o_ptr[0] = double_to_s16(c0);
- o_ptr[1] = double_to_s16(c1);
- o_ptr += 2;
- }
+ center = a;
+ /*x = M_PI * (start - center) * r->o_inc; */
+ /*d = M_PI * r->o_inc; */
+ /*x = (start - center) * r->o_inc; */
+ x0 = (start - center) * r->o_inc;
+ d = r->o_inc;
+ c0 = 0;
+ c1 = 0;
+ for (j = 0; j < r->filter_length; j++) {
+ x = x0 + d * j;
+ weight = sinc (x * scale * r->i_inc) * scale / M_PI;
+ weight *= window_func (x / r->halftaps * r->i_inc);
+ c0 += weight * ptr[(start + j + r->filter_length) * 2 + 0];
+ c1 += weight * ptr[(start + j + r->filter_length) * 2 + 1];
+ }
+ o_ptr[0] = double_to_s16 (c0);
+ o_ptr[1] = double_to_s16 (c1);
+ o_ptr += 2;
+ }
}
/*
@@ -468,98 +474,100 @@ static functable_t *ft;
double out_tmp[10000];
-void gst_resample_sinc_ft_s16(gst_resample_t * r)
+void
+gst_resample_sinc_ft_s16 (gst_resample_t * r)
{
- double *ptr;
- signed short *o_ptr;
- int i;
- /*int j; */
- double c0, c1;
- /*double a; */
- double start_f, start_x;
- int start;
- double center;
- /*double weight; */
- double x, d;
- double scale;
- int n = 4;
-
- scale = r->i_inc; /* cutoff at 22050 */
- /*scale = 1.0; // cutoff at 24000 */
- /*scale = r->i_inc * 0.5; // cutoff at 11025 */
-
- if(!ft){
- ft = malloc(sizeof(*ft));
- memset(ft,0,sizeof(*ft));
-
- ft->len = (r->filter_length + 2) * n;
- ft->offset = 1.0 / n;
- ft->start = - ft->len * 0.5 * ft->offset;
-
- ft->func_x = functable_sinc;
- ft->func_dx = functable_dsinc;
- ft->scale = M_PI * scale;
-
- ft->func2_x = functable_window_std;
- ft->func2_dx = functable_window_dstd;
- ft->scale2 = 1.0 / r->halftaps;
-
- functable_init(ft);
-
- /*printf("len=%d offset=%g start=%g\n",ft->len,ft->offset,ft->start); */
- }
-
- ptr = r->buffer;
- o_ptr = (signed short *) r->o_buf;
-
- center = r->o_start;
- start_x = center - r->halftaps;
- start_f = floor(start_x);
- start_x -= start_f;
- start = start_f;
- for (i = 0; i < r->o_samples; i++) {
- /*start_f = floor(center - r->halftaps); */
+ double *ptr;
+ signed short *o_ptr;
+ int i;
+
+ /*int j; */
+ double c0, c1;
+
+ /*double a; */
+ double start_f, start_x;
+ int start;
+ double center;
+
+ /*double weight; */
+ double x, d;
+ double scale;
+ int n = 4;
+
+ scale = r->i_inc; /* cutoff at 22050 */
+ /*scale = 1.0; // cutoff at 24000 */
+ /*scale = r->i_inc * 0.5; // cutoff at 11025 */
+
+ if (!ft) {
+ ft = malloc (sizeof (*ft));
+ memset (ft, 0, sizeof (*ft));
+
+ ft->len = (r->filter_length + 2) * n;
+ ft->offset = 1.0 / n;
+ ft->start = -ft->len * 0.5 * ft->offset;
+
+ ft->func_x = functable_sinc;
+ ft->func_dx = functable_dsinc;
+ ft->scale = M_PI * scale;
+
+ ft->func2_x = functable_window_std;
+ ft->func2_dx = functable_window_dstd;
+ ft->scale2 = 1.0 / r->halftaps;
+
+ functable_init (ft);
+
+ /*printf("len=%d offset=%g start=%g\n",ft->len,ft->offset,ft->start); */
+ }
+
+ ptr = r->buffer;
+ o_ptr = (signed short *) r->o_buf;
+
+ center = r->o_start;
+ start_x = center - r->halftaps;
+ start_f = floor (start_x);
+ start_x -= start_f;
+ start = start_f;
+ for (i = 0; i < r->o_samples; i++) {
+ /*start_f = floor(center - r->halftaps); */
/*printf("%d: a=%g start=%d end=%d\n",i,a,start,start+r->filter_length-1); */
- x = start_f - center;
- d = 1;
- c0 = 0;
- c1 = 0;
+ x = start_f - center;
+ d = 1;
+ c0 = 0;
+ c1 = 0;
/*#define slow */
#ifdef slow
- for (j = 0; j < r->filter_length; j++) {
- weight = functable_eval(ft,x)*scale;
- /*weight = sinc(M_PI * scale * x)*scale*r->i_inc; */
- /*weight *= window_func(x / r->halftaps); */
- c0 += weight * ptr[(start + j + r->filter_length)*2 + 0];
- c1 += weight * ptr[(start + j + r->filter_length)*2 + 1];
- x += d;
- }
+ for (j = 0; j < r->filter_length; j++) {
+ weight = functable_eval (ft, x) * scale;
+ /*weight = sinc(M_PI * scale * x)*scale*r->i_inc; */
+ /*weight *= window_func(x / r->halftaps); */
+ c0 += weight * ptr[(start + j + r->filter_length) * 2 + 0];
+ c1 += weight * ptr[(start + j + r->filter_length) * 2 + 1];
+ x += d;
+ }
#else
- functable_fir2(ft,
- &c0,&c1,
- x, n,
- ptr+(start + r->filter_length)*2,
- r->filter_length);
- c0 *= scale;
- c1 *= scale;
+ functable_fir2 (ft,
+ &c0, &c1, x, n, ptr + (start + r->filter_length) * 2, r->filter_length);
+ c0 *= scale;
+ c1 *= scale;
#endif
- out_tmp[2 * i + 0] = c0;
- out_tmp[2 * i + 1] = c1;
- center += r->o_inc;
- start_x += r->o_inc;
- while(start_x>=1.0){
- start_f++;
- start_x -= 1.0;
- start++;
- }
- }
-
- if(r->channels==2){
- conv_short_double(r->o_buf,out_tmp,2 * r->o_samples);
- }else{
- conv_short_double_sstr(r->o_buf,out_tmp,r->o_samples,2 * sizeof(double));
- }
+ out_tmp[2 * i + 0] = c0;
+ out_tmp[2 * i + 1] = c1;
+ center += r->o_inc;
+ start_x += r->o_inc;
+ while (start_x >= 1.0) {
+ start_f++;
+ start_x -= 1.0;
+ start++;
+ }
+ }
+
+ if (r->channels == 2) {
+ conv_short_double (r->o_buf, out_tmp, 2 * r->o_samples);
+ } else {
+ conv_short_double_sstr (r->o_buf, out_tmp, r->o_samples,
+ 2 * sizeof (double));
+ }
}
/********
@@ -567,18 +575,19 @@ void gst_resample_sinc_ft_s16(gst_resample_t * r)
********/
-void gst_resample_nearest_float(gst_resample_t * r)
+void
+gst_resample_nearest_float (gst_resample_t * r)
{
- float *i_ptr, *o_ptr;
- int i_count = 0;
- double a;
- int i;
+ float *i_ptr, *o_ptr;
+ int i_count = 0;
+ double a;
+ int i;
- i_ptr = (float *) r->i_buf;
- o_ptr = (float *) r->o_buf;
+ i_ptr = (float *) r->i_buf;
+ o_ptr = (float *) r->o_buf;
- a = r->o_start;
- i_count = 0;
+ a = r->o_start;
+ i_count = 0;
#define SCALE_LOOP(COPY,INC) \
for (i = 0; i < r->o_samples; i++) { \
COPY; \
@@ -591,302 +600,296 @@ void gst_resample_nearest_float(gst_resample_t * r)
o_ptr+=INC; \
}
- switch (r->channels) {
- case 1:
- SCALE_LOOP(o_ptr[0] = i_ptr[0], 1);
- break;
- case 2:
- SCALE_LOOP(o_ptr[0] = i_ptr[0];
- o_ptr[1] = i_ptr[1], 2);
- break;
- default:
- {
- int n, n_chan = r->channels;
-
- SCALE_LOOP(for (n = 0; n < n_chan; n++) o_ptr[n] =
- i_ptr[n], n_chan);
- }
- }
- if (i_count != r->i_samples) {
- printf("handled %d in samples (expected %d)\n", i_count,
- r->i_samples);
- }
+ switch (r->channels) {
+ case 1:
+ SCALE_LOOP (o_ptr[0] = i_ptr[0], 1);
+ break;
+ case 2:
+ SCALE_LOOP (o_ptr[0] = i_ptr[0]; o_ptr[1] = i_ptr[1], 2);
+ break;
+ default:
+ {
+ int n, n_chan = r->channels;
+
+ SCALE_LOOP (for (n = 0; n < n_chan; n++) o_ptr[n] = i_ptr[n], n_chan);
+ }
+ }
+ if (i_count != r->i_samples) {
+ printf ("handled %d in samples (expected %d)\n", i_count, r->i_samples);
+ }
}
-void gst_resample_bilinear_float(gst_resample_t * r)
+void
+gst_resample_bilinear_float (gst_resample_t * r)
{
- float *i_ptr, *o_ptr;
- int o_count = 0;
- double b;
- int i;
- double acc0, acc1;
-
- i_ptr = (float *) r->i_buf;
- o_ptr = (float *) r->o_buf;
-
- acc0 = r->acc[0];
- acc1 = r->acc[1];
- b = r->i_start;
- for (i = 0; i < r->i_samples; i++) {
- b += r->i_inc;
- /*printf("in %d\n",i_ptr[0]); */
- if(b>=2){
- printf("not expecting b>=2\n");
- }
- if (b >= 1) {
- acc0 += (1.0 - (b-r->i_inc)) * i_ptr[0];
- acc1 += (1.0 - (b-r->i_inc)) * i_ptr[1];
-
- o_ptr[0] = acc0;
- /*printf("out %d\n",o_ptr[0]); */
- o_ptr[1] = acc1;
- o_ptr += 2;
- o_count++;
-
- b -= 1.0;
-
- acc0 = b * i_ptr[0];
- acc1 = b * i_ptr[1];
- } else {
- acc0 += i_ptr[0] * r->i_inc;
- acc1 += i_ptr[1] * r->i_inc;
- }
- i_ptr += 2;
- }
- r->acc[0] = acc0;
- r->acc[1] = acc1;
-
- if (o_count != r->o_samples) {
- printf("handled %d out samples (expected %d)\n", o_count,
- r->o_samples);
- }
+ float *i_ptr, *o_ptr;
+ int o_count = 0;
+ double b;
+ int i;
+ double acc0, acc1;
+
+ i_ptr = (float *) r->i_buf;
+ o_ptr = (float *) r->o_buf;
+
+ acc0 = r->acc[0];
+ acc1 = r->acc[1];
+ b = r->i_start;
+ for (i = 0; i < r->i_samples; i++) {
+ b += r->i_inc;
+ /*printf("in %d\n",i_ptr[0]); */
+ if (b >= 2) {
+ printf ("not expecting b>=2\n");
+ }
+ if (b >= 1) {
+ acc0 += (1.0 - (b - r->i_inc)) * i_ptr[0];
+ acc1 += (1.0 - (b - r->i_inc)) * i_ptr[1];
+
+ o_ptr[0] = acc0;
+ /*printf("out %d\n",o_ptr[0]); */
+ o_ptr[1] = acc1;
+ o_ptr += 2;
+ o_count++;
+
+ b -= 1.0;
+
+ acc0 = b * i_ptr[0];
+ acc1 = b * i_ptr[1];
+ } else {
+ acc0 += i_ptr[0] * r->i_inc;
+ acc1 += i_ptr[1] * r->i_inc;
+ }
+ i_ptr += 2;
+ }
+ r->acc[0] = acc0;
+ r->acc[1] = acc1;
+
+ if (o_count != r->o_samples) {
+ printf ("handled %d out samples (expected %d)\n", o_count, r->o_samples);
+ }
}
-void gst_resample_sinc_slow_float(gst_resample_t * r)
+void
+gst_resample_sinc_slow_float (gst_resample_t * r)
{
- float *i_ptr, *o_ptr;
- int i, j;
- double c0, c1;
- double a;
- int start;
- double center;
- double weight;
-
- if (!r->buffer) {
- int size = r->filter_length * sizeof(float) * r->channels;
-
- printf("gst_resample temp buffer\n");
- r->buffer = malloc(size);
- memset(r->buffer, 0, size);
- }
-
- i_ptr = (float *) r->i_buf;
- o_ptr = (float *) r->o_buf;
-
- a = r->i_start;
+ float *i_ptr, *o_ptr;
+ int i, j;
+ double c0, c1;
+ double a;
+ int start;
+ double center;
+ double weight;
+
+ if (!r->buffer) {
+ int size = r->filter_length * sizeof (float) * r->channels;
+
+ printf ("gst_resample temp buffer\n");
+ r->buffer = malloc (size);
+ memset (r->buffer, 0, size);
+ }
+
+ i_ptr = (float *) r->i_buf;
+ o_ptr = (float *) r->o_buf;
+
+ a = r->i_start;
#define GETBUF(index,chan) (((index)<0) \
? ((float *)(r->buffer))[((index)+r->filter_length)*2+(chan)] \
: i_ptr[(index)*2+(chan)])
- {
- double sinx, cosx, sind, cosd;
- double x, d;
- double t;
-
- for (i = 0; i < r->o_samples; i++) {
- start = floor(a) - r->filter_length;
- center = a - r->halftaps;
- x = M_PI * (start - center) * r->o_inc;
- sinx = sin(M_PI * (start - center) * r->o_inc);
- cosx = cos(M_PI * (start - center) * r->o_inc);
- d = M_PI * r->o_inc;
- sind = sin(M_PI * r->o_inc);
- cosd = cos(M_PI * r->o_inc);
- c0 = 0;
- c1 = 0;
- for (j = 0; j < r->filter_length; j++) {
- weight = (x==0)?1:(sinx/x);
+ {
+ double sinx, cosx, sind, cosd;
+ double x, d;
+ double t;
+
+ for (i = 0; i < r->o_samples; i++) {
+ start = floor (a) - r->filter_length;
+ center = a - r->halftaps;
+ x = M_PI * (start - center) * r->o_inc;
+ sinx = sin (M_PI * (start - center) * r->o_inc);
+ cosx = cos (M_PI * (start - center) * r->o_inc);
+ d = M_PI * r->o_inc;
+ sind = sin (M_PI * r->o_inc);
+ cosd = cos (M_PI * r->o_inc);
+ c0 = 0;
+ c1 = 0;
+ for (j = 0; j < r->filter_length; j++) {
+ weight = (x == 0) ? 1 : (sinx / x);
/*printf("j %d sin %g cos %g\n",j,sinx,cosx); */
/*printf("j %d sin %g x %g sinc %g\n",j,sinx,x,weight); */
- c0 += weight * GETBUF((start + j), 0);
- c1 += weight * GETBUF((start + j), 1);
- t = cosx * cosd - sinx * sind;
- sinx = cosx * sind + sinx * cosd;
- cosx = t;
- x += d;
- }
- o_ptr[0] = c0;
- o_ptr[1] = c1;
- o_ptr += 2;
- a += r->o_inc;
- }
- }
+ c0 += weight * GETBUF ((start + j), 0);
+ c1 += weight * GETBUF ((start + j), 1);
+ t = cosx * cosd - sinx * sind;
+ sinx = cosx * sind + sinx * cosd;
+ cosx = t;
+ x += d;
+ }
+ o_ptr[0] = c0;
+ o_ptr[1] = c1;
+ o_ptr += 2;
+ a += r->o_inc;
+ }
+ }
#undef GETBUF
- memcpy(r->buffer,
- i_ptr + (r->i_samples - r->filter_length) * r->channels,
- r->filter_length * sizeof(float) * r->channels);
+ memcpy (r->buffer,
+ i_ptr + (r->i_samples - r->filter_length) * r->channels,
+ r->filter_length * sizeof (float) * r->channels);
}
/* only works for channels == 2 ???? */
-void gst_resample_sinc_float(gst_resample_t * r)
+void
+gst_resample_sinc_float (gst_resample_t * r)
{
- double *ptr;
- float *o_ptr;
- int i, j;
- double c0, c1;
- double a;
- int start;
- double center;
- double weight;
- double x0, x, d;
- double scale;
-
- ptr = (double *) r->buffer;
- o_ptr = (float *) r->o_buf;
-
- /* scale provides a cutoff frequency for the low
- * pass filter aspects of sinc(). scale=M_PI
- * will cut off at the input frequency, which is
- * good for up-sampling, but will cause aliasing
- * for downsampling. Downsampling needs to be
- * cut off at o_rate, thus scale=M_PI*r->i_inc. */
- /* actually, it needs to be M_PI*r->i_inc*r->i_inc.
- * Need to research why. */
- scale = M_PI*r->i_inc;
- for (i = 0; i < r->o_samples; i++) {
- a = r->o_start + i * r->o_inc;
- start = floor(a - r->halftaps);
+ double *ptr;
+ float *o_ptr;
+ int i, j;
+ double c0, c1;
+ double a;
+ int start;
+ double center;
+ double weight;
+ double x0, x, d;
+ double scale;
+
+ ptr = (double *) r->buffer;
+ o_ptr = (float *) r->o_buf;
+
+ /* scale provides a cutoff frequency for the low
+ * pass filter aspects of sinc(). scale=M_PI
+ * will cut off at the input frequency, which is
+ * good for up-sampling, but will cause aliasing
+ * for downsampling. Downsampling needs to be
+ * cut off at o_rate, thus scale=M_PI*r->i_inc. */
+ /* actually, it needs to be M_PI*r->i_inc*r->i_inc.
+ * Need to research why. */
+ scale = M_PI * r->i_inc;
+ for (i = 0; i < r->o_samples; i++) {
+ a = r->o_start + i * r->o_inc;
+ start = floor (a - r->halftaps);
/*printf("%d: a=%g start=%d end=%d\n",i,a,start,start+r->filter_length-1); */
- center = a;
- /*x = M_PI * (start - center) * r->o_inc; */
- /*d = M_PI * r->o_inc; */
- /*x = (start - center) * r->o_inc; */
- x0 = (start - center) * r->o_inc;
- d = r->o_inc;
- c0 = 0;
- c1 = 0;
- for (j = 0; j < r->filter_length; j++) {
- x = x0 + d * j;
- weight = sinc(x*scale*r->i_inc)*scale/M_PI;
- weight *= window_func(x/r->halftaps*r->i_inc);
- c0 += weight * ptr[(start + j + r->filter_length)*2 + 0];
- c1 += weight * ptr[(start + j + r->filter_length)*2 + 1];
- }
- o_ptr[0] = c0;
- o_ptr[1] = c1;
- o_ptr += 2;
- }
+ center = a;
+ /*x = M_PI * (start - center) * r->o_inc; */
+ /*d = M_PI * r->o_inc; */
+ /*x = (start - center) * r->o_inc; */
+ x0 = (start - center) * r->o_inc;
+ d = r->o_inc;
+ c0 = 0;
+ c1 = 0;
+ for (j = 0; j < r->filter_length; j++) {
+ x = x0 + d * j;
+ weight = sinc (x * scale * r->i_inc) * scale / M_PI;
+ weight *= window_func (x / r->halftaps * r->i_inc);
+ c0 += weight * ptr[(start + j + r->filter_length) * 2 + 0];
+ c1 += weight * ptr[(start + j + r->filter_length) * 2 + 1];
+ }
+ o_ptr[0] = c0;
+ o_ptr[1] = c1;
+ o_ptr += 2;
+ }
}
-void gst_resample_sinc_ft_float(gst_resample_t * r)
+void
+gst_resample_sinc_ft_float (gst_resample_t * r)
{
- double *ptr;
- float *o_ptr;
- int i;
- /*int j; */
- double c0, c1;
- /*double a; */
- double start_f, start_x;
- int start;
- double center;
- /*double weight; */
- double x, d;
- double scale;
- int n = 4;
-
- scale = r->i_inc; /* cutoff at 22050 */
- /*scale = 1.0; // cutoff at 24000 */
- /*scale = r->i_inc * 0.5; // cutoff at 11025 */
-
- if(!ft){
- ft = malloc(sizeof(*ft));
- memset(ft,0,sizeof(*ft));
-
- ft->len = (r->filter_length + 2) * n;
- ft->offset = 1.0 / n;
- ft->start = - ft->len * 0.5 * ft->offset;
-
- ft->func_x = functable_sinc;
- ft->func_dx = functable_dsinc;
- ft->scale = M_PI * scale;
-
- ft->func2_x = functable_window_std;
- ft->func2_dx = functable_window_dstd;
- ft->scale2 = 1.0 / r->halftaps;
-
- functable_init(ft);
-
- /*printf("len=%d offset=%g start=%g\n",ft->len,ft->offset,ft->start); */
- }
-
- ptr = r->buffer;
- o_ptr = (float *) r->o_buf;
-
- center = r->o_start;
- start_x = center - r->halftaps;
- start_f = floor(start_x);
- start_x -= start_f;
- start = start_f;
- for (i = 0; i < r->o_samples; i++) {
- /*start_f = floor(center - r->halftaps); */
+ double *ptr;
+ float *o_ptr;
+ int i;
+
+ /*int j; */
+ double c0, c1;
+
+ /*double a; */
+ double start_f, start_x;
+ int start;
+ double center;
+
+ /*double weight; */
+ double x, d;
+ double scale;
+ int n = 4;
+
+ scale = r->i_inc; /* cutoff at 22050 */
+ /*scale = 1.0; // cutoff at 24000 */
+ /*scale = r->i_inc * 0.5; // cutoff at 11025 */
+
+ if (!ft) {
+ ft = malloc (sizeof (*ft));
+ memset (ft, 0, sizeof (*ft));
+
+ ft->len = (r->filter_length + 2) * n;
+ ft->offset = 1.0 / n;
+ ft->start = -ft->len * 0.5 * ft->offset;
+
+ ft->func_x = functable_sinc;
+ ft->func_dx = functable_dsinc;
+ ft->scale = M_PI * scale;
+
+ ft->func2_x = functable_window_std;
+ ft->func2_dx = functable_window_dstd;
+ ft->scale2 = 1.0 / r->halftaps;
+
+ functable_init (ft);
+
+ /*printf("len=%d offset=%g start=%g\n",ft->len,ft->offset,ft->start); */
+ }
+
+ ptr = r->buffer;
+ o_ptr = (float *) r->o_buf;
+
+ center = r->o_start;
+ start_x = center - r->halftaps;
+ start_f = floor (start_x);
+ start_x -= start_f;
+ start = start_f;
+ for (i = 0; i < r->o_samples; i++) {
+ /*start_f = floor(center - r->halftaps); */
/*printf("%d: a=%g start=%d end=%d\n",i,a,start,start+r->filter_length-1); */
- x = start_f - center;
- d = 1;
- c0 = 0;
- c1 = 0;
+ x = start_f - center;
+ d = 1;
+ c0 = 0;
+ c1 = 0;
/*#define slow */
#ifdef slow
- for (j = 0; j < r->filter_length; j++) {
- weight = functable_eval(ft,x)*scale;
- /*weight = sinc(M_PI * scale * x)*scale*r->i_inc; */
- /*weight *= window_func(x / r->halftaps); */
- c0 += weight * ptr[(start + j + r->filter_length)*2 + 0];
- c1 += weight * ptr[(start + j + r->filter_length)*2 + 1];
- x += d;
- }
+ for (j = 0; j < r->filter_length; j++) {
+ weight = functable_eval (ft, x) * scale;
+ /*weight = sinc(M_PI * scale * x)*scale*r->i_inc; */
+ /*weight *= window_func(x / r->halftaps); */
+ c0 += weight * ptr[(start + j + r->filter_length) * 2 + 0];
+ c1 += weight * ptr[(start + j + r->filter_length) * 2 + 1];
+ x += d;
+ }
#else
- functable_fir2(ft,
- &c0,&c1,
- x, n,
- ptr+(start + r->filter_length)*2,
- r->filter_length);
- c0 *= scale;
- c1 *= scale;
+ functable_fir2 (ft,
+ &c0, &c1, x, n, ptr + (start + r->filter_length) * 2, r->filter_length);
+ c0 *= scale;
+ c1 *= scale;
#endif
- out_tmp[2 * i + 0] = c0;
- out_tmp[2 * i + 1] = c1;
- center += r->o_inc;
- start_x += r->o_inc;
- while(start_x>=1.0){
- start_f++;
- start_x -= 1.0;
- start++;
- }
- }
-
- if(r->channels==2){
- conv_float_double(r->o_buf,out_tmp,2 * r->o_samples);
- }else{
- conv_float_double_sstr(r->o_buf,out_tmp,r->o_samples,2 * sizeof(double));
- }
+ out_tmp[2 * i + 0] = c0;
+ out_tmp[2 * i + 1] = c1;
+ center += r->o_inc;
+ start_x += r->o_inc;
+ while (start_x >= 1.0) {
+ start_f++;
+ start_x -= 1.0;
+ start++;
+ }
+ }
+
+ if (r->channels == 2) {
+ conv_float_double (r->o_buf, out_tmp, 2 * r->o_samples);
+ } else {
+ conv_float_double_sstr (r->o_buf, out_tmp, r->o_samples,
+ 2 * sizeof (double));
+ }
}
static gboolean
-plugin_init (GstPlugin *plugin)
+plugin_init (GstPlugin * plugin)
{
return TRUE;
}
-GST_PLUGIN_DEFINE (
- GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "gstresample",
- "Resampling routines for use in audio plugins",
- plugin_init,
- VERSION,
- GST_LICENSE,
- GST_PACKAGE,
- GST_ORIGIN
-);
-
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ "gstresample",
+ "Resampling routines for use in audio plugins",
+ plugin_init, VERSION, GST_LICENSE, GST_PACKAGE, GST_ORIGIN);
diff --git a/gst-libs/gst/resample/resample.h b/gst-libs/gst/resample/resample.h
index 1c4216b3..699d7d3b 100644
--- a/gst-libs/gst/resample/resample.h
+++ b/gst-libs/gst/resample/resample.h
@@ -21,76 +21,78 @@
#ifndef __GST_RESAMPLE_H__
#define __GST_RESAMPLE_H__
-typedef enum {
- GST_RESAMPLE_NEAREST = 0,
- GST_RESAMPLE_BILINEAR,
- GST_RESAMPLE_SINC_SLOW,
- GST_RESAMPLE_SINC,
+typedef enum
+{
+ GST_RESAMPLE_NEAREST = 0,
+ GST_RESAMPLE_BILINEAR,
+ GST_RESAMPLE_SINC_SLOW,
+ GST_RESAMPLE_SINC,
} gst_resample_method;
-typedef enum {
- GST_RESAMPLE_S16 = 0,
- GST_RESAMPLE_FLOAT
+typedef enum
+{
+ GST_RESAMPLE_S16 = 0,
+ GST_RESAMPLE_FLOAT
} gst_resample_format;
typedef struct gst_resample_s gst_resample_t;
-struct gst_resample_s {
- /* parameters */
+struct gst_resample_s
+{
+ /* parameters */
- gst_resample_method method;
- int channels;
- int verbose;
- gst_resample_format format;
+ gst_resample_method method;
+ int channels;
+ int verbose;
+ gst_resample_format format;
- int filter_length;
+ int filter_length;
- double i_rate;
- double o_rate;
+ double i_rate;
+ double o_rate;
- void *priv;
+ void *priv;
- void *(*get_buffer)(void *priv, unsigned int size);
+ void *(*get_buffer) (void *priv, unsigned int size);
- /* internal parameters */
+ /* internal parameters */
- double halftaps;
+ double halftaps;
- /* filter state */
+ /* filter state */
- void *buffer;
- int buffer_len;
+ void *buffer;
+ int buffer_len;
- double i_start;
- double o_start;
+ double i_start;
+ double o_start;
- double i_start_buf;
- double i_end_buf;
+ double i_start_buf;
+ double i_end_buf;
- double i_inc;
- double o_inc;
+ double i_inc;
+ double o_inc;
- double i_end;
- double o_end;
+ double i_end;
+ double o_end;
- int i_samples;
- int o_samples;
+ int i_samples;
+ int o_samples;
- void *i_buf, *o_buf;
+ void *i_buf, *o_buf;
- double acc[10];
+ double acc[10];
- /* methods */
- void (*scale)(gst_resample_t *r);
+ /* methods */
+ void (*scale) (gst_resample_t * r);
- double ack;
+ double ack;
};
-void gst_resample_init(gst_resample_t *r);
+void gst_resample_init (gst_resample_t * r);
-void gst_resample_reinit(gst_resample_t *r);
+void gst_resample_reinit (gst_resample_t * r);
-void gst_resample_scale(gst_resample_t *r, void *i_buf, unsigned int size);
+void gst_resample_scale (gst_resample_t * r, void *i_buf, unsigned int size);
#endif /* __GST_RESAMPLE_H__ */
-
diff --git a/gst-libs/gst/resample/test.c b/gst-libs/gst/resample/test.c
index f268a592..152d12a6 100644
--- a/gst-libs/gst/resample/test.c
+++ b/gst-libs/gst/resample/test.c
@@ -16,337 +16,360 @@
/*#define test_func(x) sin(2*M_PI*(x)*(x)*1000) */
#define test_func(x) sin(2*M_PI*(x)*(x)*12000)
-short i_buf[I_RATE*2*2];
-short o_buf[O_RATE*2*2];
+short i_buf[I_RATE * 2 * 2];
+short o_buf[O_RATE * 2 * 2];
static int i_offset;
static int o_offset;
FILE *out;
-void test_res1(void);
-void test_res2(void);
-void test_res3(void);
-void test_res4(void);
-void test_res5(void);
-void test_res6(void);
-void test_res7(void);
+void test_res1 (void);
+void test_res2 (void);
+void test_res3 (void);
+void test_res4 (void);
+void test_res5 (void);
+void test_res6 (void);
+void test_res7 (void);
-int main(int argc,char *argv[])
+int
+main (int argc, char *argv[])
{
- out = fopen("out","w");
+ out = fopen ("out", "w");
- test_res7();
+ test_res7 ();
- return 0;
+ return 0;
}
-void *get_buffer(void *priv, unsigned int size)
+void *
+get_buffer (void *priv, unsigned int size)
{
- void *ret;
- ret = ((void *)o_buf) + o_offset;
- o_offset += size;
- return ret;
+ void *ret;
+
+ ret = ((void *) o_buf) + o_offset;
+ o_offset += size;
+ return ret;
}
struct timeval start_time;
-void start_timer(void)
+void
+start_timer (void)
{
- gettimeofday(&start_time,NULL);
- /*printf("start %ld.%06ld\n",start_time.tv_sec,start_time.tv_usec); */
+ gettimeofday (&start_time, NULL);
+ /*printf("start %ld.%06ld\n",start_time.tv_sec,start_time.tv_usec); */
}
-void end_timer(void)
+void
+end_timer (void)
{
- struct timeval end_time;
- double diff;
+ struct timeval end_time;
+ double diff;
- gettimeofday(&end_time,NULL);
- /*printf("end %ld.%06ld\n",end_time.tv_sec,end_time.tv_usec); */
- diff = (end_time.tv_sec - start_time.tv_sec) +
- 1e-6*(end_time.tv_usec - start_time.tv_usec);
+ gettimeofday (&end_time, NULL);
+ /*printf("end %ld.%06ld\n",end_time.tv_sec,end_time.tv_usec); */
+ diff = (end_time.tv_sec - start_time.tv_sec) +
+ 1e-6 * (end_time.tv_usec - start_time.tv_usec);
- printf("time %g\n",diff);
+ printf ("time %g\n", diff);
}
-void test_res1(void)
+void
+test_res1 (void)
{
- resample_t *r;
- int i;
- double sum10k,sum22k;
- double f;
- int n10k,n22k;
- double x;
-
- for(i=0;i<I_RATE;i++){
- i_buf[i*2+0] = rint(AMP * test_func((double)i/I_RATE));
- /*i_buf[i*2+1] = rint(AMP * test_func((double)i/I_RATE)); */
- i_buf[i*2+1] = (i<1000)?AMP:0;
- }
-
- r = malloc(sizeof(resample_t));
- memset(r,0,sizeof(resample_t));
-
- r->i_rate = I_RATE;
- r->o_rate = O_RATE;
- /*r->method = RESAMPLE_SINC_SLOW; */
- r->method = RESAMPLE_SINC;
- r->channels = 2;
- /*r->verbose = 1; */
- r->filter_length = 64;
- r->get_buffer = get_buffer;
-
- resample_init(r);
-
- start_timer();
+ resample_t *r;
+ int i;
+ double sum10k, sum22k;
+ double f;
+ int n10k, n22k;
+ double x;
+
+ for (i = 0; i < I_RATE; i++) {
+ i_buf[i * 2 + 0] = rint (AMP * test_func ((double) i / I_RATE));
+ /*i_buf[i*2+1] = rint(AMP * test_func((double)i/I_RATE)); */
+ i_buf[i * 2 + 1] = (i < 1000) ? AMP : 0;
+ }
+
+ r = malloc (sizeof (resample_t));
+ memset (r, 0, sizeof (resample_t));
+
+ r->i_rate = I_RATE;
+ r->o_rate = O_RATE;
+ /*r->method = RESAMPLE_SINC_SLOW; */
+ r->method = RESAMPLE_SINC;
+ r->channels = 2;
+ /*r->verbose = 1; */
+ r->filter_length = 64;
+ r->get_buffer = get_buffer;
+
+ resample_init (r);
+
+ start_timer ();
#define blocked
#ifdef blocked
- for(i=0;i+256<I_RATE;i+=256){
- resample_scale(r,i_buf+i*2,256*2*2);
- }
- if(I_RATE-i){
- resample_scale(r,i_buf+i*2,(I_RATE-i)*2*2);
- }
+ for (i = 0; i + 256 < I_RATE; i += 256) {
+ resample_scale (r, i_buf + i * 2, 256 * 2 * 2);
+ }
+ if (I_RATE - i) {
+ resample_scale (r, i_buf + i * 2, (I_RATE - i) * 2 * 2);
+ }
#else
- resample_scale(r,i_buf,I_RATE*2*2);
+ resample_scale (r, i_buf, I_RATE * 2 * 2);
#endif
- end_timer();
-
- for(i=0;i<O_RATE;i++){
- f = AMP*test_func((double)i/O_RATE);
- /*f = rint(AMP*test_func((double)i/O_RATE)); */
- fprintf(out,"%d %d %d %g %g\n",i,
- o_buf[2*i+0],o_buf[2*i+1],
- f,o_buf[2*i+0]-f);
- }
-
- sum10k=0;
- sum22k=0;
- n10k=0;
- n22k=0;
- for(i=0;i<O_RATE;i++){
- f = AMP*test_func((double)i/O_RATE);
- /*f = rint(AMP*test_func((double)i/O_RATE)); */
- x = o_buf[2*i+0]-f;
- if(((0.5*i)/O_RATE*I_RATE)<10000){
- sum10k += x*x;
- n10k++;
- }
- if(((0.5*i)/O_RATE*I_RATE)<22050){
- sum22k += x*x;
- n22k++;
- }
- }
- printf("average error 10k=%g 22k=%g\n",
- sqrt(sum10k/n10k),
- sqrt(sum22k/n22k));
+ end_timer ();
+
+ for (i = 0; i < O_RATE; i++) {
+ f = AMP * test_func ((double) i / O_RATE);
+ /*f = rint(AMP*test_func((double)i/O_RATE)); */
+ fprintf (out, "%d %d %d %g %g\n", i,
+ o_buf[2 * i + 0], o_buf[2 * i + 1], f, o_buf[2 * i + 0] - f);
+ }
+
+ sum10k = 0;
+ sum22k = 0;
+ n10k = 0;
+ n22k = 0;
+ for (i = 0; i < O_RATE; i++) {
+ f = AMP * test_func ((double) i / O_RATE);
+ /*f = rint(AMP*test_func((double)i/O_RATE)); */
+ x = o_buf[2 * i + 0] - f;
+ if (((0.5 * i) / O_RATE * I_RATE) < 10000) {
+ sum10k += x * x;
+ n10k++;
+ }
+ if (((0.5 * i) / O_RATE * I_RATE) < 22050) {
+ sum22k += x * x;
+ n22k++;
+ }
+ }
+ printf ("average error 10k=%g 22k=%g\n",
+ sqrt (sum10k / n10k), sqrt (sum22k / n22k));
}
-void test_res2(void)
+void
+test_res2 (void)
{
- functable_t *t;
- int i;
- double x;
- double f1,f2;
+ functable_t *t;
+ int i;
+ double x;
+ double f1, f2;
- t = malloc(sizeof(*t));
- memset(t,0,sizeof(*t));
+ t = malloc (sizeof (*t));
+ memset (t, 0, sizeof (*t));
- t->start = -50.0;
- t->offset = 1;
- t->len = 100;
+ t->start = -50.0;
+ t->offset = 1;
+ t->len = 100;
- t->func_x = functable_sinc;
- t->func_dx = functable_dsinc;
+ t->func_x = functable_sinc;
+ t->func_dx = functable_dsinc;
- functable_init(t);
+ functable_init (t);
- for(i=0;i<1000;i++){
- x = -50.0 + 0.1 * i;
- f1 = functable_sinc(NULL,x);
- f2 = functable_eval(t,x);
- fprintf(out,"%d %g %g %g\n",i,f1,f2,f1-f2);
- }
+ for (i = 0; i < 1000; i++) {
+ x = -50.0 + 0.1 * i;
+ f1 = functable_sinc (NULL, x);
+ f2 = functable_eval (t, x);
+ fprintf (out, "%d %g %g %g\n", i, f1, f2, f1 - f2);
+ }
}
-void test_res3(void)
+void
+test_res3 (void)
{
- functable_t *t;
- int i;
- double x;
- double f1,f2;
- int n = 1;
+ functable_t *t;
+ int i;
+ double x;
+ double f1, f2;
+ int n = 1;
- t = malloc(sizeof(*t));
- memset(t,0,sizeof(*t));
+ t = malloc (sizeof (*t));
+ memset (t, 0, sizeof (*t));
- t->start = -50.0;
- t->offset = 1.0 / n;
- t->len = 100 * n;
+ t->start = -50.0;
+ t->offset = 1.0 / n;
+ t->len = 100 * n;
- t->func_x = functable_sinc;
- t->func_dx = functable_dsinc;
+ t->func_x = functable_sinc;
+ t->func_dx = functable_dsinc;
- t->func2_x = functable_window_std;
- t->func2_dx = functable_window_dstd;
+ t->func2_x = functable_window_std;
+ t->func2_dx = functable_window_dstd;
- t->scale = 1.0;
- t->scale2 = 1.0 / (M_PI * 16);
+ t->scale = 1.0;
+ t->scale2 = 1.0 / (M_PI * 16);
- functable_init(t);
+ functable_init (t);
- for(i=0;i<1000 * n;i++){
- x = -50.0 + 0.1/n * i;
- f1 = functable_sinc(NULL,t->scale * x) *
- functable_window_std(NULL,t->scale2 * x);
- f2 = functable_eval(t,x);
- fprintf(out,"%d %g %g %g\n",i,f1,f2,f2-f1);
- }
+ for (i = 0; i < 1000 * n; i++) {
+ x = -50.0 + 0.1 / n * i;
+ f1 = functable_sinc (NULL, t->scale * x) *
+ functable_window_std (NULL, t->scale2 * x);
+ f2 = functable_eval (t, x);
+ fprintf (out, "%d %g %g %g\n", i, f1, f2, f2 - f1);
+ }
}
-double sinc_poly(double x)
+double
+sinc_poly (double x)
{
#define INV3FAC 1.66666666666666666e-1
#define INV5FAC 8.33333333333333333e-3
#define INV7FAC 1.984126984e-4
#define INV9FAC 2.755731922e-6
#define INV11FAC 2.505210839e-8
- double x2 = x * x;
+ double x2 = x * x;
- return 1
- - x2 * INV3FAC
- + x2 * x2 * INV5FAC
- - x2 * x2 * x2 * INV7FAC;
- /*+ x2 * x2 * x2 * x2 * INV9FAC */
+ return 1 - x2 * INV3FAC + x2 * x2 * INV5FAC - x2 * x2 * x2 * INV7FAC;
+ /*+ x2 * x2 * x2 * x2 * INV9FAC */
/*- x2 * x2 * x2 * x2 * x2 * INV11FAC; */
}
-void test_res4(void)
+void
+test_res4 (void)
{
- int i;
- double x,f1,f2;
-
- for(i=1;i<100;i++){
- x = 0.01 * i;
- f1 = 1 - sin(x)/x;
- f2 = 1 - sinc_poly(x);
-
- fprintf(out,"%g %.20g %.20g %.20g\n",x,f1,f2,f2-f1);
- }
+ int i;
+ double x, f1, f2;
+
+ for (i = 1; i < 100; i++) {
+ x = 0.01 * i;
+ f1 = 1 - sin (x) / x;
+ f2 = 1 - sinc_poly (x);
+
+ fprintf (out, "%g %.20g %.20g %.20g\n", x, f1, f2, f2 - f1);
+ }
}
-void test_res5(void)
+void
+test_res5 (void)
{
- int i;
- double sum;
-
- start_timer();
- sum = 0;
- for(i=0;i<I_RATE;i++){
- sum += i_buf[i*2];
- }
- end_timer();
- i_buf[0] = sum;
+ int i;
+ double sum;
+
+ start_timer ();
+ sum = 0;
+ for (i = 0; i < I_RATE; i++) {
+ sum += i_buf[i * 2];
+ }
+ end_timer ();
+ i_buf[0] = sum;
}
-void short_to_double(double *d,short *x) { *d = *x; }
-void short_to_float(float *f,short *x) { *f = *x; }
-void float_to_double(double *f,float *x) { *f = *x; }
-void double_to_short(short *f,double *x) { *f = *x; }
+void
+short_to_double (double *d, short *x)
+{
+ *d = *x;
+}
+
+void
+short_to_float (float *f, short *x)
+{
+ *f = *x;
+}
+
+void
+float_to_double (double *f, float *x)
+{
+ *f = *x;
+}
+
+void
+double_to_short (short *f, double *x)
+{
+ *f = *x;
+}
double res6_tmp[1000];
-void test_res6(void)
+void
+test_res6 (void)
{
- int i;
+ int i;
- for(i=0;i<I_RATE;i++){
- i_buf[i] = rint(AMP * test_func((double)i/I_RATE));
- }
+ for (i = 0; i < I_RATE; i++) {
+ i_buf[i] = rint (AMP * test_func ((double) i / I_RATE));
+ }
- conv_double_short_ref(res6_tmp,i_buf,1000);
- for(i=0;i<1000;i++){
- res6_tmp[i] *= 3.0;
- }
- conv_short_double_ppcasm(o_buf,res6_tmp,1000);
+ conv_double_short_ref (res6_tmp, i_buf, 1000);
+ for (i = 0; i < 1000; i++) {
+ res6_tmp[i] *= 3.0;
+ }
+ conv_short_double_ppcasm (o_buf, res6_tmp, 1000);
- for(i=0;i<1000;i++){
- fprintf(out,"%d %d %g %d\n",i,i_buf[i],res6_tmp[i],o_buf[i]);
- }
+ for (i = 0; i < 1000; i++) {
+ fprintf (out, "%d %d %g %d\n", i, i_buf[i], res6_tmp[i], o_buf[i]);
+ }
}
-void test_res7(void)
+void
+test_res7 (void)
{
- resample_t *r;
- int i;
- double sum10k,sum22k;
- double f;
- int n10k,n22k;
- double x;
-
- for(i=0;i<I_RATE;i++){
- i_buf[i] = rint(AMP * test_func((double)i/I_RATE));
- }
-
- r = malloc(sizeof(resample_t));
- memset(r,0,sizeof(resample_t));
-
- r->i_rate = I_RATE;
- r->o_rate = O_RATE;
- /*r->method = RESAMPLE_SINC_SLOW; */
- r->method = RESAMPLE_SINC;
- r->channels = 1;
- /*r->verbose = 1; */
- r->filter_length = 64;
- r->get_buffer = get_buffer;
-
- resample_init(r);
-
- start_timer();
+ resample_t *r;
+ int i;
+ double sum10k, sum22k;
+ double f;
+ int n10k, n22k;
+ double x;
+
+ for (i = 0; i < I_RATE; i++) {
+ i_buf[i] = rint (AMP * test_func ((double) i / I_RATE));
+ }
+
+ r = malloc (sizeof (resample_t));
+ memset (r, 0, sizeof (resample_t));
+
+ r->i_rate = I_RATE;
+ r->o_rate = O_RATE;
+ /*r->method = RESAMPLE_SINC_SLOW; */
+ r->method = RESAMPLE_SINC;
+ r->channels = 1;
+ /*r->verbose = 1; */
+ r->filter_length = 64;
+ r->get_buffer = get_buffer;
+
+ resample_init (r);
+
+ start_timer ();
#define blocked
#ifdef blocked
- for(i=0;i+256<I_RATE;i+=256){
- resample_scale(r,i_buf+i,256*2);
- }
- if(I_RATE-i){
- resample_scale(r,i_buf+i,(I_RATE-i)*2);
- }
+ for (i = 0; i + 256 < I_RATE; i += 256) {
+ resample_scale (r, i_buf + i, 256 * 2);
+ }
+ if (I_RATE - i) {
+ resample_scale (r, i_buf + i, (I_RATE - i) * 2);
+ }
#else
- resample_scale(r,i_buf,I_RATE*2);
+ resample_scale (r, i_buf, I_RATE * 2);
#endif
- end_timer();
-
- for(i=0;i<O_RATE;i++){
- f = AMP*test_func((double)i/O_RATE);
- /*f = rint(AMP*test_func((double)i/O_RATE)); */
- fprintf(out,"%d %d %d %g %g\n",i,
- o_buf[i],0,
- f,o_buf[i]-f);
- }
-
- sum10k=0;
- sum22k=0;
- n10k=0;
- n22k=0;
- for(i=0;i<O_RATE;i++){
- f = AMP*test_func((double)i/O_RATE);
- /*f = rint(AMP*test_func((double)i/O_RATE)); */
- x = o_buf[i]-f;
- if(((0.5*i)/O_RATE*I_RATE)<10000){
- sum10k += x*x;
- n10k++;
- }
- if(((0.5*i)/O_RATE*I_RATE)<22050){
- sum22k += x*x;
- n22k++;
- }
- }
- printf("average error 10k=%g 22k=%g\n",
- sqrt(sum10k/n10k),
- sqrt(sum22k/n22k));
+ end_timer ();
+
+ for (i = 0; i < O_RATE; i++) {
+ f = AMP * test_func ((double) i / O_RATE);
+ /*f = rint(AMP*test_func((double)i/O_RATE)); */
+ fprintf (out, "%d %d %d %g %g\n", i, o_buf[i], 0, f, o_buf[i] - f);
+ }
+
+ sum10k = 0;
+ sum22k = 0;
+ n10k = 0;
+ n22k = 0;
+ for (i = 0; i < O_RATE; i++) {
+ f = AMP * test_func ((double) i / O_RATE);
+ /*f = rint(AMP*test_func((double)i/O_RATE)); */
+ x = o_buf[i] - f;
+ if (((0.5 * i) / O_RATE * I_RATE) < 10000) {
+ sum10k += x * x;
+ n10k++;
+ }
+ if (((0.5 * i) / O_RATE * I_RATE) < 22050) {
+ sum22k += x * x;
+ n22k++;
+ }
+ }
+ printf ("average error 10k=%g 22k=%g\n",
+ sqrt (sum10k / n10k), sqrt (sum22k / n22k));
}
-
diff --git a/gst-libs/gst/riff/riff-ids.h b/gst-libs/gst/riff/riff-ids.h
index da465c2d..141cbab5 100644
--- a/gst-libs/gst/riff/riff-ids.h
+++ b/gst-libs/gst/riff/riff-ids.h
@@ -66,29 +66,29 @@
#define GST_RIFF_FCCH_MSVC GST_MAKE_FOURCC ('M','S','V','C')
/* INFO types - see http://www.saettler.com/RIFFMCI/riffmci.html */
-#define GST_RIFF_INFO_IARL GST_MAKE_FOURCC ('I','A','R','L') /* location */
-#define GST_RIFF_INFO_IART GST_MAKE_FOURCC ('I','A','R','T') /* artist */
-#define GST_RIFF_INFO_ICMS GST_MAKE_FOURCC ('I','C','M','S') /* commissioned */
-#define GST_RIFF_INFO_ICMT GST_MAKE_FOURCC ('I','C','M','T') /* comment */
-#define GST_RIFF_INFO_ICOP GST_MAKE_FOURCC ('I','C','O','P') /* copyright */
-#define GST_RIFF_INFO_ICRD GST_MAKE_FOURCC ('I','C','R','D') /* creation date */
-#define GST_RIFF_INFO_ICRP GST_MAKE_FOURCC ('I','C','R','P') /* cropped */
-#define GST_RIFF_INFO_IDIM GST_MAKE_FOURCC ('I','D','I','M') /* dimensions */
-#define GST_RIFF_INFO_IDPI GST_MAKE_FOURCC ('I','D','P','I') /* dots-per-inch */
-#define GST_RIFF_INFO_IENG GST_MAKE_FOURCC ('I','E','N','G') /* engineer(s) */
-#define GST_RIFF_INFO_IGNR GST_MAKE_FOURCC ('I','G','N','R') /* genre */
-#define GST_RIFF_INFO_IKEY GST_MAKE_FOURCC ('I','K','E','Y') /* keywords */
-#define GST_RIFF_INFO_ILGT GST_MAKE_FOURCC ('I','L','G','T') /* lightness */
-#define GST_RIFF_INFO_IMED GST_MAKE_FOURCC ('I','M','E','D') /* medium */
-#define GST_RIFF_INFO_INAM GST_MAKE_FOURCC ('I','N','A','M') /* name */
-#define GST_RIFF_INFO_IPLT GST_MAKE_FOURCC ('I','P','L','T') /* palette setting */
-#define GST_RIFF_INFO_IPRD GST_MAKE_FOURCC ('I','P','R','D') /* product */
-#define GST_RIFF_INFO_ISBJ GST_MAKE_FOURCC ('I','S','B','J') /* subject */
-#define GST_RIFF_INFO_ISFT GST_MAKE_FOURCC ('I','S','F','T') /* software */
-#define GST_RIFF_INFO_ISHP GST_MAKE_FOURCC ('I','S','H','P') /* sharpness */
-#define GST_RIFF_INFO_ISRC GST_MAKE_FOURCC ('I','S','R','C') /* source */
-#define GST_RIFF_INFO_ISRF GST_MAKE_FOURCC ('I','S','R','F') /* source form */
-#define GST_RIFF_INFO_ITCH GST_MAKE_FOURCC ('I','T','C','H') /* technician(s) */
+#define GST_RIFF_INFO_IARL GST_MAKE_FOURCC ('I','A','R','L') /* location */
+#define GST_RIFF_INFO_IART GST_MAKE_FOURCC ('I','A','R','T') /* artist */
+#define GST_RIFF_INFO_ICMS GST_MAKE_FOURCC ('I','C','M','S') /* commissioned */
+#define GST_RIFF_INFO_ICMT GST_MAKE_FOURCC ('I','C','M','T') /* comment */
+#define GST_RIFF_INFO_ICOP GST_MAKE_FOURCC ('I','C','O','P') /* copyright */
+#define GST_RIFF_INFO_ICRD GST_MAKE_FOURCC ('I','C','R','D') /* creation date */
+#define GST_RIFF_INFO_ICRP GST_MAKE_FOURCC ('I','C','R','P') /* cropped */
+#define GST_RIFF_INFO_IDIM GST_MAKE_FOURCC ('I','D','I','M') /* dimensions */
+#define GST_RIFF_INFO_IDPI GST_MAKE_FOURCC ('I','D','P','I') /* dots-per-inch */
+#define GST_RIFF_INFO_IENG GST_MAKE_FOURCC ('I','E','N','G') /* engineer(s) */
+#define GST_RIFF_INFO_IGNR GST_MAKE_FOURCC ('I','G','N','R') /* genre */
+#define GST_RIFF_INFO_IKEY GST_MAKE_FOURCC ('I','K','E','Y') /* keywords */
+#define GST_RIFF_INFO_ILGT GST_MAKE_FOURCC ('I','L','G','T') /* lightness */
+#define GST_RIFF_INFO_IMED GST_MAKE_FOURCC ('I','M','E','D') /* medium */
+#define GST_RIFF_INFO_INAM GST_MAKE_FOURCC ('I','N','A','M') /* name */
+#define GST_RIFF_INFO_IPLT GST_MAKE_FOURCC ('I','P','L','T') /* palette setting */
+#define GST_RIFF_INFO_IPRD GST_MAKE_FOURCC ('I','P','R','D') /* product */
+#define GST_RIFF_INFO_ISBJ GST_MAKE_FOURCC ('I','S','B','J') /* subject */
+#define GST_RIFF_INFO_ISFT GST_MAKE_FOURCC ('I','S','F','T') /* software */
+#define GST_RIFF_INFO_ISHP GST_MAKE_FOURCC ('I','S','H','P') /* sharpness */
+#define GST_RIFF_INFO_ISRC GST_MAKE_FOURCC ('I','S','R','C') /* source */
+#define GST_RIFF_INFO_ISRF GST_MAKE_FOURCC ('I','S','R','F') /* source form */
+#define GST_RIFF_INFO_ITCH GST_MAKE_FOURCC ('I','T','C','H') /* technician(s) */
/*********Chunk Names***************/
#define GST_RIFF_FF00 GST_MAKE_FOURCC (0xFF,0xFF,0x00,0x00)
@@ -167,7 +167,7 @@
#define GST_RIFF_v422 GST_MAKE_FOURCC ('v', '4', '2', '2')
#define GST_RIFF_V422 GST_MAKE_FOURCC ('V', '4', '2', '2')
#define GST_RIFF_mvi1 GST_MAKE_FOURCC ('m', 'v', 'i', '1')
-#define GST_RIFF_MPIX GST_MAKE_FOURCC (0x04,0x00, 'i', '1') /* MotionPixels munged their id */
+#define GST_RIFF_MPIX GST_MAKE_FOURCC (0x04,0x00, 'i', '1') /* MotionPixels munged their id */
#define GST_RIFF_AURA GST_MAKE_FOURCC ('A', 'U', 'R', 'A')
#define GST_RIFF_DMB1 GST_MAKE_FOURCC ('D', 'M', 'B', '1')
#define GST_RIFF_dmb1 GST_MAKE_FOURCC ('d', 'm', 'b', '1')
@@ -203,7 +203,7 @@
#define GST_RIFF_rpza GST_MAKE_FOURCC ('r', 'p', 'z', 'a')
/* And this here's the mistakes that need to be supported */
-#define GST_RIFF_azpr GST_MAKE_FOURCC ('a', 'z', 'p', 'r') /* recognize Apple's rpza mangled? */
+#define GST_RIFF_azpr GST_MAKE_FOURCC ('a', 'z', 'p', 'r') /* recognize Apple's rpza mangled? */
/*********** FND in MJPG **********/
#define GST_RIFF_ISFT GST_MAKE_FOURCC ('I', 'S', 'F', 'T')
@@ -216,26 +216,28 @@
#define GST_RIFF_rec GST_MAKE_FOURCC ('r', 'e', 'c', ' ')
/* common data structures */
-typedef struct _gst_riff_strh {
- guint32 type; /* stream type */
- guint32 fcc_handler; /* fcc_handler */
+typedef struct _gst_riff_strh
+{
+ guint32 type; /* stream type */
+ guint32 fcc_handler; /* fcc_handler */
guint32 flags;
/* flags values */
#define GST_RIFF_STRH_DISABLED 0x000000001
#define GST_RIFF_STRH_VIDEOPALCHANGES 0x000010000
guint32 priority;
- guint32 init_frames; /* initial frames (???) */
+ guint32 init_frames; /* initial frames (???) */
guint32 scale;
guint32 rate;
guint32 start;
guint32 length;
- guint32 bufsize; /* suggested buffer size */
+ guint32 bufsize; /* suggested buffer size */
guint32 quality;
guint32 samplesize;
/* XXX 16 bytes ? */
} gst_riff_strh;
-typedef struct _gst_riff_strf_vids { /* == BitMapInfoHeader */
+typedef struct _gst_riff_strf_vids
+{ /* == BitMapInfoHeader */
guint32 size;
guint32 width;
guint32 height;
@@ -245,13 +247,14 @@ typedef struct _gst_riff_strf_vids { /* == BitMapInfoHeader */
guint32 image_size;
guint32 xpels_meter;
guint32 ypels_meter;
- guint32 num_colors; /* used colors */
- guint32 imp_colors; /* important colors */
+ guint32 num_colors; /* used colors */
+ guint32 imp_colors; /* important colors */
/* may be more for some codecs */
} gst_riff_strf_vids;
-typedef struct _gst_riff_strf_auds { /* == WaveHeader (?) */
+typedef struct _gst_riff_strf_auds
+{ /* == WaveHeader (?) */
guint16 format;
/**** from public Microsoft RIFF docs ******/
#define GST_RIFF_WAVE_FORMAT_UNKNOWN (0x0000)
@@ -290,7 +293,8 @@ typedef struct _gst_riff_strf_auds { /* == WaveHeader (?) */
guint16 size;
} gst_riff_strf_auds;
-typedef struct _gst_riff_strf_iavs {
+typedef struct _gst_riff_strf_iavs
+{
guint32 DVAAuxSrc;
guint32 DVAAuxCtl;
guint32 DVAAuxSrc1;
@@ -301,7 +305,8 @@ typedef struct _gst_riff_strf_iavs {
guint32 DVReserved2;
} gst_riff_strf_iavs;
-typedef struct _gst_riff_index_entry {
+typedef struct _gst_riff_index_entry
+{
guint32 id;
guint32 flags;
#define GST_RIFF_IF_LIST (0x00000001L)
@@ -312,7 +317,8 @@ typedef struct _gst_riff_index_entry {
guint32 size;
} gst_riff_index_entry;
-typedef struct _gst_riff_dmlh {
+typedef struct _gst_riff_dmlh
+{
guint32 totalframes;
} gst_riff_dmlh;
diff --git a/gst-libs/gst/riff/riff-media.c b/gst-libs/gst/riff/riff-media.c
index 424e243b..b51b4fb5 100644
--- a/gst-libs/gst/riff/riff-media.c
+++ b/gst-libs/gst/riff/riff-media.c
@@ -27,198 +27,183 @@
#include "riff-media.h"
GstCaps *
-gst_riff_create_video_caps (guint32 codec_fcc,
- gst_riff_strh *strh,
- gst_riff_strf_vids *strf,
- char **codec_name)
+gst_riff_create_video_caps (guint32 codec_fcc,
+ gst_riff_strh * strh, gst_riff_strf_vids * strf, char **codec_name)
{
GstCaps *caps = NULL;
switch (codec_fcc) {
- case GST_MAKE_FOURCC('I','4','2','0'):
+ case GST_MAKE_FOURCC ('I', '4', '2', '0'):
caps = gst_caps_new_simple ("video/x-raw-yuv",
- "format", GST_TYPE_FOURCC, codec_fcc,
- NULL);
+ "format", GST_TYPE_FOURCC, codec_fcc, NULL);
if (codec_name)
- *codec_name = g_strdup ("Raw, uncompressed I420");
+ *codec_name = g_strdup ("Raw, uncompressed I420");
break;
- case GST_MAKE_FOURCC('Y','U','Y','2'):
+ case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'):
caps = gst_caps_new_simple ("video/x-raw-yuv",
- "format", GST_TYPE_FOURCC, codec_fcc,
- NULL);
+ "format", GST_TYPE_FOURCC, codec_fcc, NULL);
if (codec_name)
- *codec_name = g_strdup ("Raw, uncompressed YUV 4:2:2");
+ *codec_name = g_strdup ("Raw, uncompressed YUV 4:2:2");
break;
- case GST_MAKE_FOURCC('M','J','P','G'): /* YUY2 MJPEG */
+ case GST_MAKE_FOURCC ('M', 'J', 'P', 'G'): /* YUY2 MJPEG */
caps = gst_caps_new_simple ("video/x-jpeg", NULL);
if (codec_name)
- *codec_name = g_strdup ("Motion JPEG");
+ *codec_name = g_strdup ("Motion JPEG");
break;
- case GST_MAKE_FOURCC('J','P','E','G'): /* generic (mostly RGB) MJPEG */
+ case GST_MAKE_FOURCC ('J', 'P', 'E', 'G'): /* generic (mostly RGB) MJPEG */
caps = gst_caps_new_simple ("video/x-jpeg", NULL);
if (codec_name)
- *codec_name = g_strdup ("JPEG Still Image");
+ *codec_name = g_strdup ("JPEG Still Image");
break;
-
- case GST_MAKE_FOURCC('P','I','X','L'): /* Miro/Pinnacle fourccs */
- case GST_MAKE_FOURCC('V','I','X','L'): /* Miro/Pinnacle fourccs */
+
+ case GST_MAKE_FOURCC ('P', 'I', 'X', 'L'): /* Miro/Pinnacle fourccs */
+ case GST_MAKE_FOURCC ('V', 'I', 'X', 'L'): /* Miro/Pinnacle fourccs */
caps = gst_caps_new_simple ("video/x-jpeg", NULL);
if (codec_name)
- *codec_name = g_strdup ("Miro/Pinnacle Video XL");
+ *codec_name = g_strdup ("Miro/Pinnacle Video XL");
break;
-
- case GST_MAKE_FOURCC('H','F','Y','U'):
- caps = gst_caps_new_simple ( "video/x-huffyuv", NULL);
+
+ case GST_MAKE_FOURCC ('H', 'F', 'Y', 'U'):
+ caps = gst_caps_new_simple ("video/x-huffyuv", NULL);
if (codec_name)
- *codec_name = g_strdup ("Huffman Lossless Codec");
+ *codec_name = g_strdup ("Huffman Lossless Codec");
break;
-
- case GST_MAKE_FOURCC('M','P','E','G'):
- case GST_MAKE_FOURCC('M','P','G','I'):
+
+ case GST_MAKE_FOURCC ('M', 'P', 'E', 'G'):
+ case GST_MAKE_FOURCC ('M', 'P', 'G', 'I'):
caps = gst_caps_new_simple ("video/mpeg",
- "systemstream", G_TYPE_BOOLEAN, FALSE,
- "mpegversion", G_TYPE_BOOLEAN, 1,
- NULL);
+ "systemstream", G_TYPE_BOOLEAN, FALSE,
+ "mpegversion", G_TYPE_BOOLEAN, 1, NULL);
if (codec_name)
- *codec_name = g_strdup ("MPEG video");
+ *codec_name = g_strdup ("MPEG video");
break;
- case GST_MAKE_FOURCC('H','2','6','3'):
+ case GST_MAKE_FOURCC ('H', '2', '6', '3'):
caps = gst_caps_new_simple ("video/x-h263", NULL);
if (codec_name)
- *codec_name = g_strdup ("ITU H.26n");
+ *codec_name = g_strdup ("ITU H.26n");
break;
- case GST_MAKE_FOURCC('i','2','6','3'):
+ case GST_MAKE_FOURCC ('i', '2', '6', '3'):
caps = gst_caps_new_simple ("video/x-h263", NULL);
if (codec_name)
- *codec_name = g_strdup ("ITU H.263");
+ *codec_name = g_strdup ("ITU H.263");
break;
- case GST_MAKE_FOURCC('L','2','6','3'):
+ case GST_MAKE_FOURCC ('L', '2', '6', '3'):
caps = gst_caps_new_simple ("video/x-h263", NULL);
if (codec_name)
- *codec_name = g_strdup ("Lead H.263");
+ *codec_name = g_strdup ("Lead H.263");
break;
- case GST_MAKE_FOURCC('M','2','6','3'):
+ case GST_MAKE_FOURCC ('M', '2', '6', '3'):
caps = gst_caps_new_simple ("video/x-h263", NULL);
if (codec_name)
- *codec_name = g_strdup ("Microsoft H.263");
+ *codec_name = g_strdup ("Microsoft H.263");
break;
- case GST_MAKE_FOURCC('V','D','O','W'):
+ case GST_MAKE_FOURCC ('V', 'D', 'O', 'W'):
caps = gst_caps_new_simple ("video/x-h263", NULL);
if (codec_name)
- *codec_name = g_strdup ("VDOLive");
+ *codec_name = g_strdup ("VDOLive");
break;
- case GST_MAKE_FOURCC('V','I','V','O'):
+ case GST_MAKE_FOURCC ('V', 'I', 'V', 'O'):
caps = gst_caps_new_simple ("video/x-h263", NULL);
if (codec_name)
- *codec_name = g_strdup ("Vivo H.263");
+ *codec_name = g_strdup ("Vivo H.263");
break;
- case GST_MAKE_FOURCC('x','2','6','3'):
+ case GST_MAKE_FOURCC ('x', '2', '6', '3'):
caps = gst_caps_new_simple ("video/x-h263", NULL);
if (codec_name)
- *codec_name = g_strdup ("Xirlink H.263");
+ *codec_name = g_strdup ("Xirlink H.263");
break;
- case GST_MAKE_FOURCC('D','I','V','3'):
+ case GST_MAKE_FOURCC ('D', 'I', 'V', '3'):
caps = gst_caps_new_simple ("video/x-divx",
- "divxversion", G_TYPE_INT, 3,
- NULL);
+ "divxversion", G_TYPE_INT, 3, NULL);
if (codec_name)
- *codec_name = g_strdup ("DivX MPEG-4 Version 3");
+ *codec_name = g_strdup ("DivX MPEG-4 Version 3");
break;
- case GST_MAKE_FOURCC('D','I','V','4'):
+ case GST_MAKE_FOURCC ('D', 'I', 'V', '4'):
caps = gst_caps_new_simple ("video/x-divx",
- "divxversion", G_TYPE_INT, 4,
- NULL);
+ "divxversion", G_TYPE_INT, 4, NULL);
if (codec_name)
- *codec_name = g_strdup ("DivX MPEG-4 Version 4");
+ *codec_name = g_strdup ("DivX MPEG-4 Version 4");
break;
- case GST_MAKE_FOURCC('d','i','v','x'):
- case GST_MAKE_FOURCC('D','I','V','X'):
- case GST_MAKE_FOURCC('D','X','5','0'):
- case GST_MAKE_FOURCC('D','I','V','5'):
+ case GST_MAKE_FOURCC ('d', 'i', 'v', 'x'):
+ case GST_MAKE_FOURCC ('D', 'I', 'V', 'X'):
+ case GST_MAKE_FOURCC ('D', 'X', '5', '0'):
+ case GST_MAKE_FOURCC ('D', 'I', 'V', '5'):
caps = gst_caps_new_simple ("video/x-divx",
- "divxversion", G_TYPE_INT, 5,
- NULL);
+ "divxversion", G_TYPE_INT, 5, NULL);
if (codec_name)
- *codec_name = g_strdup ("DivX MPEG-4 Version 5");
+ *codec_name = g_strdup ("DivX MPEG-4 Version 5");
break;
- case GST_MAKE_FOURCC('X','V','I','D'):
- case GST_MAKE_FOURCC('x','v','i','d'):
+ case GST_MAKE_FOURCC ('X', 'V', 'I', 'D'):
+ case GST_MAKE_FOURCC ('x', 'v', 'i', 'd'):
caps = gst_caps_new_simple ("video/x-xvid", NULL);
if (codec_name)
- *codec_name = g_strdup ("XVID MPEG-4");
+ *codec_name = g_strdup ("XVID MPEG-4");
break;
- case GST_MAKE_FOURCC('M','P','G','4'):
+ case GST_MAKE_FOURCC ('M', 'P', 'G', '4'):
caps = gst_caps_new_simple ("video/x-msmpeg",
- "msmpegversion", G_TYPE_INT, 41,
- NULL);
+ "msmpegversion", G_TYPE_INT, 41, NULL);
if (codec_name)
- *codec_name = g_strdup ("Microsoft MPEG-4 4.1");
+ *codec_name = g_strdup ("Microsoft MPEG-4 4.1");
break;
- case GST_MAKE_FOURCC('M','P','4','2'):
+ case GST_MAKE_FOURCC ('M', 'P', '4', '2'):
caps = gst_caps_new_simple ("video/x-msmpeg",
- "msmpegversion", G_TYPE_INT, 42,
- NULL);
+ "msmpegversion", G_TYPE_INT, 42, NULL);
if (codec_name)
- *codec_name = g_strdup ("Microsoft MPEG-4 4.2");
+ *codec_name = g_strdup ("Microsoft MPEG-4 4.2");
break;
- case GST_MAKE_FOURCC('M','P','4','3'):
+ case GST_MAKE_FOURCC ('M', 'P', '4', '3'):
caps = gst_caps_new_simple ("video/x-msmpeg",
- "msmpegversion", G_TYPE_INT, 43,
- NULL);
+ "msmpegversion", G_TYPE_INT, 43, NULL);
if (codec_name)
- *codec_name = g_strdup ("Microsoft MPEG-4 4.3");
+ *codec_name = g_strdup ("Microsoft MPEG-4 4.3");
break;
- case GST_MAKE_FOURCC('3','I','V','1'):
- case GST_MAKE_FOURCC('3','I','V','2'):
- caps = gst_caps_new_simple ( "video/x-3ivx", NULL);
+ case GST_MAKE_FOURCC ('3', 'I', 'V', '1'):
+ case GST_MAKE_FOURCC ('3', 'I', 'V', '2'):
+ caps = gst_caps_new_simple ("video/x-3ivx", NULL);
if (codec_name)
- *codec_name = g_strdup ("3ivx");
+ *codec_name = g_strdup ("3ivx");
break;
- case GST_MAKE_FOURCC('D','V','S','D'):
- case GST_MAKE_FOURCC('d','v','s','d'):
+ case GST_MAKE_FOURCC ('D', 'V', 'S', 'D'):
+ case GST_MAKE_FOURCC ('d', 'v', 's', 'd'):
caps = gst_caps_new_simple ("video/x-dv",
- "systemstream", G_TYPE_BOOLEAN, FALSE,
- NULL);
+ "systemstream", G_TYPE_BOOLEAN, FALSE, NULL);
if (codec_name)
- *codec_name = g_strdup ("Generic DV");
+ *codec_name = g_strdup ("Generic DV");
break;
- case GST_MAKE_FOURCC('W','M','V','1'):
+ case GST_MAKE_FOURCC ('W', 'M', 'V', '1'):
caps = gst_caps_new_simple ("video/x-wmv",
- "wmvversion", G_TYPE_INT, 1,
- NULL);
+ "wmvversion", G_TYPE_INT, 1, NULL);
if (codec_name)
- *codec_name = g_strdup ("Windows Media Video 7");
+ *codec_name = g_strdup ("Windows Media Video 7");
break;
- case GST_MAKE_FOURCC('W','M','V','2'):
+ case GST_MAKE_FOURCC ('W', 'M', 'V', '2'):
caps = gst_caps_new_simple ("video/x-wmv",
- "wmvversion", G_TYPE_INT, 2,
- NULL);
+ "wmvversion", G_TYPE_INT, 2, NULL);
if (codec_name)
- *codec_name = g_strdup ("Windows Media Video 8");
+ *codec_name = g_strdup ("Windows Media Video 8");
break;
-
- case GST_MAKE_FOURCC('W','M','V','3'):
+
+ case GST_MAKE_FOURCC ('W', 'M', 'V', '3'):
caps = gst_caps_new_simple ("video/x-wmv",
- "wmvversion", G_TYPE_INT, 3,
- NULL);
+ "wmvversion", G_TYPE_INT, 3, NULL);
if (codec_name)
- *codec_name = g_strdup ("Windows Media Video 9");
+ *codec_name = g_strdup ("Windows Media Video 9");
break;
default:
GST_WARNING ("Unkown video fourcc " GST_FOURCC_FORMAT,
- GST_FOURCC_ARGS (codec_fcc));
+ GST_FOURCC_ARGS (codec_fcc));
return NULL;
}
@@ -228,153 +213,136 @@ gst_riff_create_video_caps (guint32 codec_fcc,
gst_caps_set_simple (caps, "framerate", G_TYPE_DOUBLE, fps, NULL);
} else {
gst_caps_set_simple (caps,
- "framerate", GST_TYPE_DOUBLE_RANGE, 0., G_MAXDOUBLE,
- NULL);
+ "framerate", GST_TYPE_DOUBLE_RANGE, 0., G_MAXDOUBLE, NULL);
}
if (strf != NULL) {
gst_caps_set_simple (caps,
- "width", G_TYPE_INT, strf->width,
- "height", G_TYPE_INT, strf->height,
- NULL);
+ "width", G_TYPE_INT, strf->width,
+ "height", G_TYPE_INT, strf->height, NULL);
} else {
gst_caps_set_simple (caps,
- "width", GST_TYPE_INT_RANGE, 16, 4096,
- "height", GST_TYPE_INT_RANGE, 16, 4096,
- NULL);
+ "width", GST_TYPE_INT_RANGE, 16, 4096,
+ "height", GST_TYPE_INT_RANGE, 16, 4096, NULL);
}
return caps;
}
GstCaps *
-gst_riff_create_audio_caps (guint16 codec_id,
- gst_riff_strh *strh,
- gst_riff_strf_auds *strf,
- char **codec_name)
+gst_riff_create_audio_caps (guint16 codec_id,
+ gst_riff_strh * strh, gst_riff_strf_auds * strf, char **codec_name)
{
GstCaps *caps = NULL;
switch (codec_id) {
- case GST_RIFF_WAVE_FORMAT_MPEGL3: /* mp3 */
+ case GST_RIFF_WAVE_FORMAT_MPEGL3: /* mp3 */
caps = gst_caps_new_simple ("audio/mpeg",
- "mpegversion", G_TYPE_INT, 1,
- "layer", G_TYPE_INT, 3,
- NULL);
+ "mpegversion", G_TYPE_INT, 1, "layer", G_TYPE_INT, 3, NULL);
if (codec_name)
- *codec_name = g_strdup ("MPEG 1 layer 3");
+ *codec_name = g_strdup ("MPEG 1 layer 3");
break;
- case GST_RIFF_WAVE_FORMAT_MPEGL12: /* mp1 or mp2 */
+ case GST_RIFF_WAVE_FORMAT_MPEGL12: /* mp1 or mp2 */
caps = gst_caps_new_simple ("audio/mpeg",
- "mpegversion", G_TYPE_INT, 1,
- "layer", G_TYPE_INT, 2,
- NULL);
+ "mpegversion", G_TYPE_INT, 1, "layer", G_TYPE_INT, 2, NULL);
if (codec_name)
- *codec_name = g_strdup ("MPEG 1 layer 2");
+ *codec_name = g_strdup ("MPEG 1 layer 2");
break;
- case GST_RIFF_WAVE_FORMAT_PCM: /* PCM/wav */
+ case GST_RIFF_WAVE_FORMAT_PCM: /* PCM/wav */
if (strf != NULL) {
- gint ba = GUINT16_FROM_LE (strf->blockalign);
- gint ch = GUINT16_FROM_LE (strf->channels);
- gint ws = GUINT16_FROM_LE (strf->size);
-
- caps = gst_caps_new_simple ("audio/x-raw-int",
- "endianness", G_TYPE_INT, G_LITTLE_ENDIAN,
- "width", G_TYPE_INT, (int)(ba * 8 / ch),
- "depth", G_TYPE_INT, ws,
- "signed", G_TYPE_BOOLEAN, ws != 8,
- NULL);
+ gint ba = GUINT16_FROM_LE (strf->blockalign);
+ gint ch = GUINT16_FROM_LE (strf->channels);
+ gint ws = GUINT16_FROM_LE (strf->size);
+
+ caps = gst_caps_new_simple ("audio/x-raw-int",
+ "endianness", G_TYPE_INT, G_LITTLE_ENDIAN,
+ "width", G_TYPE_INT, (int) (ba * 8 / ch),
+ "depth", G_TYPE_INT, ws, "signed", G_TYPE_BOOLEAN, ws != 8, NULL);
} else {
- caps = gst_caps_from_string ("audio/x-raw-int, "
- "endianness = (int) LITTLE_ENDIAN, "
- "signed = (boolean) { true, false }, "
- "width = (int) { 8, 16 }, "
- "height = (int) { 8, 16 }");
+ caps = gst_caps_from_string ("audio/x-raw-int, "
+ "endianness = (int) LITTLE_ENDIAN, "
+ "signed = (boolean) { true, false }, "
+ "width = (int) { 8, 16 }, " "height = (int) { 8, 16 }");
}
if (codec_name)
- *codec_name = g_strdup ("PCM WAV");
+ *codec_name = g_strdup ("PCM WAV");
break;
case GST_RIFF_WAVE_FORMAT_MULAW:
if (strf != NULL && strf->size != 8) {
- GST_WARNING ("invalid depth (%d) of mulaw audio, overwriting.",
- strf->size);
+ GST_WARNING ("invalid depth (%d) of mulaw audio, overwriting.",
+ strf->size);
}
caps = gst_caps_new_simple ("audio/x-mulaw", NULL);
if (codec_name)
- *codec_name = g_strdup ("Mulaw");
+ *codec_name = g_strdup ("Mulaw");
break;
case GST_RIFF_WAVE_FORMAT_ALAW:
if (strf != NULL && strf->size != 8) {
- GST_WARNING ("invalid depth (%d) of alaw audio, overwriting.",
- strf->size);
+ GST_WARNING ("invalid depth (%d) of alaw audio, overwriting.",
+ strf->size);
}
caps = gst_caps_new_simple ("audio/x-alaw", NULL);
if (codec_name)
- *codec_name = g_strdup ("Alaw");
+ *codec_name = g_strdup ("Alaw");
break;
- case GST_RIFF_WAVE_FORMAT_VORBIS1: /* ogg/vorbis mode 1 */
- case GST_RIFF_WAVE_FORMAT_VORBIS2: /* ogg/vorbis mode 2 */
- case GST_RIFF_WAVE_FORMAT_VORBIS3: /* ogg/vorbis mode 3 */
- case GST_RIFF_WAVE_FORMAT_VORBIS1PLUS: /* ogg/vorbis mode 1+ */
- case GST_RIFF_WAVE_FORMAT_VORBIS2PLUS: /* ogg/vorbis mode 2+ */
- case GST_RIFF_WAVE_FORMAT_VORBIS3PLUS: /* ogg/vorbis mode 3+ */
+ case GST_RIFF_WAVE_FORMAT_VORBIS1: /* ogg/vorbis mode 1 */
+ case GST_RIFF_WAVE_FORMAT_VORBIS2: /* ogg/vorbis mode 2 */
+ case GST_RIFF_WAVE_FORMAT_VORBIS3: /* ogg/vorbis mode 3 */
+ case GST_RIFF_WAVE_FORMAT_VORBIS1PLUS: /* ogg/vorbis mode 1+ */
+ case GST_RIFF_WAVE_FORMAT_VORBIS2PLUS: /* ogg/vorbis mode 2+ */
+ case GST_RIFF_WAVE_FORMAT_VORBIS3PLUS: /* ogg/vorbis mode 3+ */
caps = gst_caps_new_simple ("audio/x-vorbis", NULL);
if (codec_name)
- *codec_name = g_strdup ("Vorbis");
+ *codec_name = g_strdup ("Vorbis");
break;
case GST_RIFF_WAVE_FORMAT_A52:
caps = gst_caps_new_simple ("audio/x-ac3", NULL);
if (codec_name)
- *codec_name = g_strdup ("AC3");
+ *codec_name = g_strdup ("AC3");
break;
default:
- GST_WARNING ("Unkown audio tag 0x%04x",
- codec_id);
+ GST_WARNING ("Unkown audio tag 0x%04x", codec_id);
break;
}
if (strf != NULL) {
gst_caps_set_simple (caps,
- "rate", G_TYPE_INT, strf->rate,
- "channels", G_TYPE_INT, strf->channels,
- NULL);
+ "rate", G_TYPE_INT, strf->rate,
+ "channels", G_TYPE_INT, strf->channels, NULL);
} else {
gst_caps_set_simple (caps,
- "rate", GST_TYPE_INT_RANGE, 8000, 96000,
- "channels", GST_TYPE_INT_RANGE, 1, 2,
- NULL);
+ "rate", GST_TYPE_INT_RANGE, 8000, 96000,
+ "channels", GST_TYPE_INT_RANGE, 1, 2, NULL);
}
return caps;
}
GstCaps *
-gst_riff_create_iavs_caps (guint32 codec_fcc,
- gst_riff_strh *strh,
- gst_riff_strf_iavs *strf,
- char **codec_name)
+gst_riff_create_iavs_caps (guint32 codec_fcc,
+ gst_riff_strh * strh, gst_riff_strf_iavs * strf, char **codec_name)
{
GstCaps *caps = NULL;
switch (codec_fcc) {
- /* is this correct? */
- case GST_MAKE_FOURCC ('D','V','S','D'):
- case GST_MAKE_FOURCC ('d','v','s','d'):
- caps = gst_caps_new_simple ("video/x-dv",
- "systemstream", G_TYPE_BOOLEAN, TRUE, NULL);
+ /* is this correct? */
+ case GST_MAKE_FOURCC ('D', 'V', 'S', 'D'):
+ case GST_MAKE_FOURCC ('d', 'v', 's', 'd'):
+ caps = gst_caps_new_simple ("video/x-dv",
+ "systemstream", G_TYPE_BOOLEAN, TRUE, NULL);
if (codec_name)
- *codec_name = g_strdup ("Generic DV");
+ *codec_name = g_strdup ("Generic DV");
default:
GST_WARNING ("Unkown IAVS fourcc " GST_FOURCC_FORMAT,
- GST_FOURCC_ARGS (codec_fcc));
+ GST_FOURCC_ARGS (codec_fcc));
return NULL;
}
@@ -389,22 +357,22 @@ GstCaps *
gst_riff_create_video_template_caps (void)
{
guint32 tags[] = {
- GST_MAKE_FOURCC ('I','4','2','0'),
- GST_MAKE_FOURCC ('Y','U','Y','2'),
- GST_MAKE_FOURCC ('M','J','P','G'),
- GST_MAKE_FOURCC ('D','V','S','D'),
- GST_MAKE_FOURCC ('W','M','V','1'),
- GST_MAKE_FOURCC ('W','M','V','2'),
- GST_MAKE_FOURCC ('M','P','G','4'),
- GST_MAKE_FOURCC ('M','P','4','2'),
- GST_MAKE_FOURCC ('M','P','4','3'),
- GST_MAKE_FOURCC ('H','F','Y','U'),
- GST_MAKE_FOURCC ('D','I','V','3'),
- GST_MAKE_FOURCC ('M','P','E','G'),
- GST_MAKE_FOURCC ('H','2','6','3'),
- GST_MAKE_FOURCC ('D','I','V','X'),
- GST_MAKE_FOURCC ('X','V','I','D'),
- GST_MAKE_FOURCC ('3','I','V','1'),
+ GST_MAKE_FOURCC ('I', '4', '2', '0'),
+ GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'),
+ GST_MAKE_FOURCC ('M', 'J', 'P', 'G'),
+ GST_MAKE_FOURCC ('D', 'V', 'S', 'D'),
+ GST_MAKE_FOURCC ('W', 'M', 'V', '1'),
+ GST_MAKE_FOURCC ('W', 'M', 'V', '2'),
+ GST_MAKE_FOURCC ('M', 'P', 'G', '4'),
+ GST_MAKE_FOURCC ('M', 'P', '4', '2'),
+ GST_MAKE_FOURCC ('M', 'P', '4', '3'),
+ GST_MAKE_FOURCC ('H', 'F', 'Y', 'U'),
+ GST_MAKE_FOURCC ('D', 'I', 'V', '3'),
+ GST_MAKE_FOURCC ('M', 'P', 'E', 'G'),
+ GST_MAKE_FOURCC ('H', '2', '6', '3'),
+ GST_MAKE_FOURCC ('D', 'I', 'V', 'X'),
+ GST_MAKE_FOURCC ('X', 'V', 'I', 'D'),
+ GST_MAKE_FOURCC ('3', 'I', 'V', '1'),
/* FILL ME */
0
};
@@ -452,7 +420,7 @@ GstCaps *
gst_riff_create_iavs_template_caps (void)
{
guint32 tags[] = {
- GST_MAKE_FOURCC ('D','V','S','D'),
+ GST_MAKE_FOURCC ('D', 'V', 'S', 'D'),
/* FILL ME */
0
};
diff --git a/gst-libs/gst/riff/riff-media.h b/gst-libs/gst/riff/riff-media.h
index 220671af..ca4a9434 100644
--- a/gst-libs/gst/riff/riff-media.h
+++ b/gst-libs/gst/riff/riff-media.h
@@ -27,23 +27,15 @@
#include "riff-ids.h"
G_BEGIN_DECLS
-
/*
* Create one caps. strh/strf can be NULL (for non-fixed caps).
*/
-
-GstCaps *gst_riff_create_video_caps (guint32 codec_fcc,
- gst_riff_strh *strh,
- gst_riff_strf_vids *strf,
- char **codec_name);
-GstCaps *gst_riff_create_audio_caps (guint16 codec_id,
- gst_riff_strh *strh,
- gst_riff_strf_auds *strf,
- char **codec_name);
-GstCaps *gst_riff_create_iavs_caps (guint32 codec_fcc,
- gst_riff_strh *strh,
- gst_riff_strf_iavs *strf,
- char **codec_name);
+ GstCaps * gst_riff_create_video_caps (guint32 codec_fcc,
+ gst_riff_strh * strh, gst_riff_strf_vids * strf, char **codec_name);
+GstCaps *gst_riff_create_audio_caps (guint16 codec_id,
+ gst_riff_strh * strh, gst_riff_strf_auds * strf, char **codec_name);
+GstCaps *gst_riff_create_iavs_caps (guint32 codec_fcc,
+ gst_riff_strh * strh, gst_riff_strf_iavs * strf, char **codec_name);
/*
* Create template caps (includes all known types).
@@ -51,8 +43,7 @@ GstCaps *gst_riff_create_iavs_caps (guint32 codec_fcc,
GstCaps *gst_riff_create_video_template_caps (void);
GstCaps *gst_riff_create_audio_template_caps (void);
-GstCaps *gst_riff_create_iavs_template_caps (void);
+GstCaps *gst_riff_create_iavs_template_caps (void);
G_END_DECLS
-
#endif /* __GST_RIFF_READ_H__ */
diff --git a/gst-libs/gst/riff/riff-read.c b/gst-libs/gst/riff/riff-read.c
index 6f282c51..c8c5b634 100644
--- a/gst-libs/gst/riff/riff-read.c
+++ b/gst-libs/gst/riff/riff-read.c
@@ -28,28 +28,28 @@
#include "riff-ids.h"
#include "riff-read.h"
-enum {
+enum
+{
ARG_0,
ARG_METADATA
- /* FILL ME */
+ /* FILL ME */
};
-static void gst_riff_read_class_init (GstRiffReadClass *klass);
-static void gst_riff_read_init (GstRiffRead *riff);
+static void gst_riff_read_class_init (GstRiffReadClass * klass);
+static void gst_riff_read_init (GstRiffRead * riff);
-static GstElementStateReturn
- gst_riff_read_change_state (GstElement *element);
+static GstElementStateReturn gst_riff_read_change_state (GstElement * element);
static GstElementClass *parent_class = NULL;
GType
-gst_riff_read_get_type (void)
+gst_riff_read_get_type (void)
{
static GType gst_riff_read_type = 0;
if (!gst_riff_read_type) {
static const GTypeInfo gst_riff_read_info = {
- sizeof (GstRiffReadClass),
+ sizeof (GstRiffReadClass),
NULL,
NULL,
(GClassInitFunc) gst_riff_read_class_init,
@@ -62,24 +62,24 @@ gst_riff_read_get_type (void)
gst_riff_read_type =
g_type_register_static (GST_TYPE_ELEMENT, "GstRiffRead",
- &gst_riff_read_info, 0);
+ &gst_riff_read_info, 0);
}
return gst_riff_read_type;
}
static void
-gst_riff_read_class_init (GstRiffReadClass *klass)
+gst_riff_read_class_init (GstRiffReadClass * klass)
{
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
-
+
gstelement_class->change_state = gst_riff_read_change_state;
}
static void
-gst_riff_read_init (GstRiffRead *riff)
+gst_riff_read_init (GstRiffRead * riff)
{
riff->sinkpad = NULL;
riff->bs = NULL;
@@ -87,23 +87,23 @@ gst_riff_read_init (GstRiffRead *riff)
}
static GstElementStateReturn
-gst_riff_read_change_state (GstElement *element)
+gst_riff_read_change_state (GstElement * element)
{
GstRiffRead *riff = GST_RIFF_READ (element);
switch (GST_STATE_TRANSITION (element)) {
case GST_STATE_READY_TO_PAUSED:
if (!riff->sinkpad)
- return GST_STATE_FAILURE;
+ return GST_STATE_FAILURE;
riff->bs = gst_bytestream_new (riff->sinkpad);
break;
case GST_STATE_PAUSED_TO_READY:
gst_bytestream_destroy (riff->bs);
while (riff->level) {
- GstRiffLevel *level = riff->level->data;
+ GstRiffLevel *level = riff->level->data;
- riff->level = g_list_remove (riff->level, level);
- g_free (level);
+ riff->level = g_list_remove (riff->level, level);
+ g_free (level);
}
break;
default:
@@ -124,7 +124,7 @@ gst_riff_read_change_state (GstElement *element)
*/
static guint
-gst_riff_read_element_level_up (GstRiffRead *riff)
+gst_riff_read_element_level_up (GstRiffRead * riff)
{
guint num = 0;
guint64 pos = gst_bytestream_tell (riff->bs);
@@ -150,10 +150,8 @@ gst_riff_read_element_level_up (GstRiffRead *riff)
*/
static gboolean
-gst_riff_peek_head (GstRiffRead *riff,
- guint32 *tag,
- guint32 *length,
- guint *level_up)
+gst_riff_peek_head (GstRiffRead * riff,
+ guint32 * tag, guint32 * length, guint * level_up)
{
guint8 *data;
@@ -167,7 +165,7 @@ gst_riff_peek_head (GstRiffRead *riff,
if (GST_IS_EVENT (event)) {
gst_pad_event_default (riff->sinkpad, event);
if (GST_EVENT_TYPE (event) == GST_EVENT_EOS)
- return FALSE;
+ return FALSE;
} else {
GST_ELEMENT_ERROR (riff, RESOURCE, READ, (NULL), (NULL));
return FALSE;
@@ -192,8 +190,7 @@ gst_riff_peek_head (GstRiffRead *riff,
*/
static GstBuffer *
-gst_riff_read_element_data (GstRiffRead *riff,
- guint length)
+gst_riff_read_element_data (GstRiffRead * riff, guint length)
{
GstBuffer *buf = NULL;
@@ -218,8 +215,7 @@ gst_riff_read_element_data (GstRiffRead *riff,
*/
GstEvent *
-gst_riff_read_seek (GstRiffRead *riff,
- guint64 offset)
+gst_riff_read_seek (GstRiffRead * riff, guint64 offset)
{
guint64 length = gst_bytestream_length (riff->bs);
guint32 remaining;
@@ -261,7 +257,7 @@ gst_riff_read_seek (GstRiffRead *riff,
} else if (GST_EVENT_TYPE (event) != GST_EVENT_DISCONTINUOUS) {
gst_pad_event_default (riff->sinkpad, event);
if (GST_EVENT_TYPE (event) == GST_EVENT_EOS)
- return NULL;
+ return NULL;
event = NULL;
}
}
@@ -274,8 +270,7 @@ gst_riff_read_seek (GstRiffRead *riff,
*/
guint32
-gst_riff_peek_tag (GstRiffRead *riff,
- guint *level_up)
+gst_riff_peek_tag (GstRiffRead * riff, guint * level_up)
{
guint32 tag;
@@ -290,7 +285,7 @@ gst_riff_peek_tag (GstRiffRead *riff,
*/
guint32
-gst_riff_peek_list (GstRiffRead *riff)
+gst_riff_peek_list (GstRiffRead * riff)
{
guint32 lst;
guint8 *data;
@@ -315,7 +310,7 @@ gst_riff_peek_list (GstRiffRead *riff)
*/
gboolean
-gst_riff_read_skip (GstRiffRead *riff)
+gst_riff_read_skip (GstRiffRead * riff)
{
guint32 tag, length;
GstEvent *event;
@@ -346,7 +341,7 @@ gst_riff_read_skip (GstRiffRead *riff)
/* no */
if (!(event = gst_riff_read_seek (riff,
- gst_bytestream_tell (riff->bs) + length)))
+ gst_bytestream_tell (riff->bs) + length)))
return FALSE;
gst_event_unref (event);
@@ -359,9 +354,7 @@ gst_riff_read_skip (GstRiffRead *riff)
*/
gboolean
-gst_riff_read_data (GstRiffRead *riff,
- guint32 *tag,
- GstBuffer **buf)
+gst_riff_read_data (GstRiffRead * riff, guint32 * tag, GstBuffer ** buf)
{
guint32 length;
@@ -377,9 +370,7 @@ gst_riff_read_data (GstRiffRead *riff,
*/
gboolean
-gst_riff_read_ascii (GstRiffRead *riff,
- guint32 *tag,
- gchar **str)
+gst_riff_read_ascii (GstRiffRead * riff, guint32 * tag, gchar ** str)
{
GstBuffer *buf;
@@ -400,8 +391,7 @@ gst_riff_read_ascii (GstRiffRead *riff,
*/
gboolean
-gst_riff_read_strh (GstRiffRead *riff,
- gst_riff_strh **header)
+gst_riff_read_strh (GstRiffRead * riff, gst_riff_strh ** header)
{
guint32 tag;
GstBuffer *buf;
@@ -417,28 +407,27 @@ gst_riff_read_strh (GstRiffRead *riff,
}
if (GST_BUFFER_SIZE (buf) < sizeof (gst_riff_strh)) {
g_warning ("Too small strh (%d available, %d needed)",
- GST_BUFFER_SIZE (buf), (int) sizeof (gst_riff_strh));
+ GST_BUFFER_SIZE (buf), (int) sizeof (gst_riff_strh));
gst_buffer_unref (buf);
return FALSE;
}
- strh = g_memdup (GST_BUFFER_DATA (buf),
- GST_BUFFER_SIZE (buf));
+ strh = g_memdup (GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
gst_buffer_unref (buf);
#if (G_BYTE_ORDER == G_BIG_ENDIAN)
- strh->type = GUINT32_FROM_LE (strh->type);
+ strh->type = GUINT32_FROM_LE (strh->type);
strh->fcc_handler = GUINT32_FROM_LE (strh->fcc_handler);
- strh->flags = GUINT32_FROM_LE (strh->flags);
- strh->priority = GUINT32_FROM_LE (strh->priority);
+ strh->flags = GUINT32_FROM_LE (strh->flags);
+ strh->priority = GUINT32_FROM_LE (strh->priority);
strh->init_frames = GUINT32_FROM_LE (strh->init_frames);
- strh->scale = GUINT32_FROM_LE (strh->scale);
- strh->rate = GUINT32_FROM_LE (strh->rate);
- strh->start = GUINT32_FROM_LE (strh->start);
- strh->length = GUINT32_FROM_LE (strh->length);
- strh->bufsize = GUINT32_FROM_LE (strh->bufsize);
- strh->quality = GUINT32_FROM_LE (strh->quality);
- strh->samplesize = GUINT32_FROM_LE (strh->samplesize);
+ strh->scale = GUINT32_FROM_LE (strh->scale);
+ strh->rate = GUINT32_FROM_LE (strh->rate);
+ strh->start = GUINT32_FROM_LE (strh->start);
+ strh->length = GUINT32_FROM_LE (strh->length);
+ strh->bufsize = GUINT32_FROM_LE (strh->bufsize);
+ strh->quality = GUINT32_FROM_LE (strh->quality);
+ strh->samplesize = GUINT32_FROM_LE (strh->samplesize);
#endif
/* avoid divisions by zero */
@@ -449,20 +438,19 @@ gst_riff_read_strh (GstRiffRead *riff,
/* debug */
GST_INFO ("strh tag found");
- GST_INFO (" type " GST_FOURCC_FORMAT,
- GST_FOURCC_ARGS (strh->type));
+ GST_INFO (" type " GST_FOURCC_FORMAT, GST_FOURCC_ARGS (strh->type));
GST_INFO (" fcc_handler " GST_FOURCC_FORMAT,
- GST_FOURCC_ARGS (strh->fcc_handler));
+ GST_FOURCC_ARGS (strh->fcc_handler));
GST_INFO (" flags 0x%08x", strh->flags);
- GST_INFO (" priority %d", strh->priority);
- GST_INFO (" init_frames %d", strh->init_frames);
- GST_INFO (" scale %d", strh->scale);
- GST_INFO (" rate %d", strh->rate);
- GST_INFO (" start %d", strh->start);
- GST_INFO (" length %d", strh->length);
- GST_INFO (" bufsize %d", strh->bufsize);
- GST_INFO (" quality %d", strh->quality);
- GST_INFO (" samplesize %d", strh->samplesize);
+ GST_INFO (" priority %d", strh->priority);
+ GST_INFO (" init_frames %d", strh->init_frames);
+ GST_INFO (" scale %d", strh->scale);
+ GST_INFO (" rate %d", strh->rate);
+ GST_INFO (" start %d", strh->start);
+ GST_INFO (" length %d", strh->length);
+ GST_INFO (" bufsize %d", strh->bufsize);
+ GST_INFO (" quality %d", strh->quality);
+ GST_INFO (" samplesize %d", strh->samplesize);
*header = strh;
@@ -470,8 +458,7 @@ gst_riff_read_strh (GstRiffRead *riff,
}
gboolean
-gst_riff_read_strf_vids (GstRiffRead *riff,
- gst_riff_strf_vids **header)
+gst_riff_read_strf_vids (GstRiffRead * riff, gst_riff_strf_vids ** header)
{
guint32 tag;
GstBuffer *buf;
@@ -487,32 +474,31 @@ gst_riff_read_strf_vids (GstRiffRead *riff,
}
if (GST_BUFFER_SIZE (buf) < sizeof (gst_riff_strf_vids)) {
g_warning ("Too small strf_vids (%d available, %d needed)",
- GST_BUFFER_SIZE (buf), (int) sizeof (gst_riff_strf_vids));
+ GST_BUFFER_SIZE (buf), (int) sizeof (gst_riff_strf_vids));
gst_buffer_unref (buf);
return FALSE;
}
- strf = g_memdup (GST_BUFFER_DATA (buf),
- GST_BUFFER_SIZE (buf));
+ strf = g_memdup (GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
#if (G_BYTE_ORDER == G_BIG_ENDIAN)
- strf->size = GUINT32_FROM_LE (strf->size);
- strf->width = GUINT32_FROM_LE (strf->width);
- strf->height = GUINT32_FROM_LE (strf->height);
- strf->planes = GUINT16_FROM_LE (strf->planes);
- strf->bit_cnt = GUINT16_FROM_LE (strf->bit_cnt);
+ strf->size = GUINT32_FROM_LE (strf->size);
+ strf->width = GUINT32_FROM_LE (strf->width);
+ strf->height = GUINT32_FROM_LE (strf->height);
+ strf->planes = GUINT16_FROM_LE (strf->planes);
+ strf->bit_cnt = GUINT16_FROM_LE (strf->bit_cnt);
strf->compression = GUINT32_FROM_LE (strf->compression);
- strf->image_size = GUINT32_FROM_LE (strf->image_size);
+ strf->image_size = GUINT32_FROM_LE (strf->image_size);
strf->xpels_meter = GUINT32_FROM_LE (strf->xpels_meter);
strf->ypels_meter = GUINT32_FROM_LE (strf->ypels_meter);
- strf->num_colors = GUINT32_FROM_LE (strf->num_colors);
- strf->imp_colors = GUINT32_FROM_LE (strf->imp_colors);
+ strf->num_colors = GUINT32_FROM_LE (strf->num_colors);
+ strf->imp_colors = GUINT32_FROM_LE (strf->imp_colors);
#endif
/* size checking */
if (strf->size > GST_BUFFER_SIZE (buf)) {
g_warning ("strf_vids header gave %d bytes data, only %d available",
- strf->size, GST_BUFFER_SIZE (buf));
+ strf->size, GST_BUFFER_SIZE (buf));
strf->size = GST_BUFFER_SIZE (buf);
}
@@ -524,7 +510,7 @@ gst_riff_read_strf_vids (GstRiffRead *riff,
GST_INFO (" planes %d", strf->planes);
GST_INFO (" bit_cnt %d", strf->bit_cnt);
GST_INFO (" compression " GST_FOURCC_FORMAT,
- GST_FOURCC_ARGS (strf->compression));
+ GST_FOURCC_ARGS (strf->compression));
GST_INFO (" image_size %d", strf->image_size);
GST_INFO (" xpels_meter %d", strf->xpels_meter);
GST_INFO (" ypels_meter %d", strf->ypels_meter);
@@ -539,8 +525,7 @@ gst_riff_read_strf_vids (GstRiffRead *riff,
}
gboolean
-gst_riff_read_strf_auds (GstRiffRead *riff,
- gst_riff_strf_auds **header)
+gst_riff_read_strf_auds (GstRiffRead * riff, gst_riff_strf_auds ** header)
{
guint32 tag;
GstBuffer *buf;
@@ -556,21 +541,20 @@ gst_riff_read_strf_auds (GstRiffRead *riff,
}
if (GST_BUFFER_SIZE (buf) < sizeof (gst_riff_strf_auds)) {
g_warning ("Too small strf_auds (%d available, %d needed)",
- GST_BUFFER_SIZE (buf), (int) sizeof (gst_riff_strf_auds));
+ GST_BUFFER_SIZE (buf), (int) sizeof (gst_riff_strf_auds));
gst_buffer_unref (buf);
return FALSE;
}
- strf = g_memdup (GST_BUFFER_DATA (buf),
- GST_BUFFER_SIZE (buf));
+ strf = g_memdup (GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
#if (G_BYTE_ORDER == G_BIG_ENDIAN)
- strf->format = GUINT16_FROM_LE (strf->format);
- strf->channels = GUINT16_FROM_LE (strf->channels);
- strf->rate = GUINT32_FROM_LE (strf->rate);
- strf->av_bps = GUINT32_FROM_LE (strf->av_bps);
+ strf->format = GUINT16_FROM_LE (strf->format);
+ strf->channels = GUINT16_FROM_LE (strf->channels);
+ strf->rate = GUINT32_FROM_LE (strf->rate);
+ strf->av_bps = GUINT32_FROM_LE (strf->av_bps);
strf->blockalign = GUINT16_FROM_LE (strf->blockalign);
- strf->size = GUINT16_FROM_LE (strf->size);
+ strf->size = GUINT16_FROM_LE (strf->size);
#endif
/* debug */
@@ -580,7 +564,7 @@ gst_riff_read_strf_auds (GstRiffRead *riff,
GST_INFO (" rate %d", strf->rate);
GST_INFO (" av_bps %d", strf->av_bps);
GST_INFO (" blockalign %d", strf->blockalign);
- GST_INFO (" size %d", strf->size); /* wordsize, not extrasize! */
+ GST_INFO (" size %d", strf->size); /* wordsize, not extrasize! */
gst_buffer_unref (buf);
@@ -590,8 +574,7 @@ gst_riff_read_strf_auds (GstRiffRead *riff,
}
gboolean
-gst_riff_read_strf_iavs (GstRiffRead *riff,
- gst_riff_strf_iavs **header)
+gst_riff_read_strf_iavs (GstRiffRead * riff, gst_riff_strf_iavs ** header)
{
guint32 tag;
GstBuffer *buf;
@@ -607,22 +590,21 @@ gst_riff_read_strf_iavs (GstRiffRead *riff,
}
if (GST_BUFFER_SIZE (buf) < sizeof (gst_riff_strf_iavs)) {
g_warning ("Too small strf_iavs (%d available, %d needed)",
- GST_BUFFER_SIZE (buf), (int) sizeof (gst_riff_strf_iavs));
+ GST_BUFFER_SIZE (buf), (int) sizeof (gst_riff_strf_iavs));
gst_buffer_unref (buf);
return FALSE;
}
- strf = g_memdup (GST_BUFFER_DATA (buf),
- GST_BUFFER_SIZE (buf));
+ strf = g_memdup (GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
gst_buffer_unref (buf);
#if (G_BYTE_ORDER == G_BIG_ENDIAN)
- strf->DVAAuxSrc = GUINT32_FROM_LE (strf->DVAAuxSrc);
- strf->DVAAuxCtl = GUINT32_FROM_LE (strf->DVAAuxCtl);
- strf->DVAAuxSrc1 = GUINT32_FROM_LE (strf->DVAAuxSrc1);
- strf->DVAAuxCtl1 = GUINT32_FROM_LE (strf->DVAAuxCtl1);
- strf->DVVAuxSrc = GUINT32_FROM_LE (strf->DVVAuxSrc);
- strf->DVVAuxCtl = GUINT32_FROM_LE (strf->DVVAuxCtl);
+ strf->DVAAuxSrc = GUINT32_FROM_LE (strf->DVAAuxSrc);
+ strf->DVAAuxCtl = GUINT32_FROM_LE (strf->DVAAuxCtl);
+ strf->DVAAuxSrc1 = GUINT32_FROM_LE (strf->DVAAuxSrc1);
+ strf->DVAAuxCtl1 = GUINT32_FROM_LE (strf->DVAAuxCtl1);
+ strf->DVVAuxSrc = GUINT32_FROM_LE (strf->DVVAuxSrc);
+ strf->DVVAuxCtl = GUINT32_FROM_LE (strf->DVVAuxCtl);
strf->DVReserved1 = GUINT32_FROM_LE (strf->DVReserved1);
strf->DVReserved2 = GUINT32_FROM_LE (strf->DVReserved2);
#endif
@@ -648,8 +630,7 @@ gst_riff_read_strf_iavs (GstRiffRead *riff,
*/
gboolean
-gst_riff_read_list (GstRiffRead *riff,
- guint32 *tag)
+gst_riff_read_list (GstRiffRead * riff, guint32 * tag)
{
guint32 length, lst;
GstRiffLevel *level;
@@ -667,7 +648,7 @@ gst_riff_read_list (GstRiffRead *riff,
return FALSE;
}
gst_bytestream_flush_fast (riff->bs, 4);
- *tag = GUINT32_FROM_LE (* (guint32 *) data);
+ *tag = GUINT32_FROM_LE (*(guint32 *) data);
/* remember level */
level = g_new (GstRiffLevel, 1);
@@ -683,7 +664,7 @@ gst_riff_read_list (GstRiffRead *riff,
*/
gboolean
-gst_riff_read_info (GstRiffRead *riff)
+gst_riff_read_info (GstRiffRead * riff)
{
guint32 tag;
guint64 end;
@@ -713,100 +694,102 @@ gst_riff_read_info (GstRiffRead *riff)
/* find out the type of metadata */
switch (tag) {
case GST_RIFF_INFO_IARL:
- type = GST_TAG_LOCATION;
- break;
+ type = GST_TAG_LOCATION;
+ break;
case GST_RIFF_INFO_IART:
- type = GST_TAG_ARTIST;
- break;
+ type = GST_TAG_ARTIST;
+ break;
case GST_RIFF_INFO_ICMS:
- type = NULL; /*"Commissioner";*/
- break;
+ type = NULL; /*"Commissioner"; */
+ break;
case GST_RIFF_INFO_ICMT:
- type = GST_TAG_COMMENT;
- break;
+ type = GST_TAG_COMMENT;
+ break;
case GST_RIFF_INFO_ICOP:
- type = GST_TAG_COPYRIGHT;
- break;
+ type = GST_TAG_COPYRIGHT;
+ break;
case GST_RIFF_INFO_ICRD:
- type = GST_TAG_DATE;
- break;
+ type = GST_TAG_DATE;
+ break;
case GST_RIFF_INFO_ICRP:
- type = NULL; /*"Cropped";*/
- break;
+ type = NULL; /*"Cropped"; */
+ break;
case GST_RIFF_INFO_IDIM:
- type = NULL; /*"Dimensions";*/
- break;
+ type = NULL; /*"Dimensions"; */
+ break;
case GST_RIFF_INFO_IDPI:
- type = NULL; /*"Dots per Inch";*/
- break;
+ type = NULL; /*"Dots per Inch"; */
+ break;
case GST_RIFF_INFO_IENG:
- type = NULL; /*"Engineer";*/
- break;
+ type = NULL; /*"Engineer"; */
+ break;
case GST_RIFF_INFO_IGNR:
- type = GST_TAG_GENRE;
- break;
+ type = GST_TAG_GENRE;
+ break;
case GST_RIFF_INFO_IKEY:
- type = NULL; /*"Keywords";*/;
- break;
+ type = NULL; /*"Keywords"; */ ;
+ break;
case GST_RIFF_INFO_ILGT:
- type = NULL; /*"Lightness";*/
- break;
+ type = NULL; /*"Lightness"; */
+ break;
case GST_RIFF_INFO_IMED:
- type = NULL; /*"Medium";*/
- break;
+ type = NULL; /*"Medium"; */
+ break;
case GST_RIFF_INFO_INAM:
- type = GST_TAG_TITLE;
- break;
+ type = GST_TAG_TITLE;
+ break;
case GST_RIFF_INFO_IPLT:
- type = NULL; /*"Palette";*/
- break;
+ type = NULL; /*"Palette"; */
+ break;
case GST_RIFF_INFO_IPRD:
- type = NULL; /*"Product";*/
- break;
+ type = NULL; /*"Product"; */
+ break;
case GST_RIFF_INFO_ISBJ:
- type = NULL; /*"Subject";*/
- break;
+ type = NULL; /*"Subject"; */
+ break;
case GST_RIFF_INFO_ISFT:
- type = GST_TAG_ENCODER;
- break;
+ type = GST_TAG_ENCODER;
+ break;
case GST_RIFF_INFO_ISHP:
- type = NULL; /*"Sharpness";*/
- break;
+ type = NULL; /*"Sharpness"; */
+ break;
case GST_RIFF_INFO_ISRC:
- type = GST_TAG_ISRC;
- break;
+ type = GST_TAG_ISRC;
+ break;
case GST_RIFF_INFO_ISRF:
- type = NULL; /*"Source Form";*/
- break;
+ type = NULL; /*"Source Form"; */
+ break;
case GST_RIFF_INFO_ITCH:
- type = NULL; /*"Technician";*/
- break;
+ type = NULL; /*"Technician"; */
+ break;
default:
- type = NULL;
- GST_WARNING ("Unknown INFO (metadata) tag entry " GST_FOURCC_FORMAT,
- GST_FOURCC_ARGS (tag));
- break;
+ type = NULL;
+ GST_WARNING ("Unknown INFO (metadata) tag entry " GST_FOURCC_FORMAT,
+ GST_FOURCC_ARGS (tag));
+ break;
}
if (type) {
name = NULL;
if (!gst_riff_read_ascii (riff, &tag, &name)) {
- return FALSE;
+ return FALSE;
}
if (name && name[0] != '\0') {
- GValue src = { 0 }, dest = { 0 };
- GType dest_type = gst_tag_get_type (type);
-
- have_tags = TRUE;
- g_value_init (&src, G_TYPE_STRING);
- g_value_set_string (&src, name);
- g_value_init (&dest, dest_type);
- g_value_transform (&src, &dest);
- g_value_unset (&src);
- gst_tag_list_add_values (taglist, GST_TAG_MERGE_APPEND,
- type, &dest, NULL);
- g_value_unset (&dest);
+ GValue src = { 0 }
+ , dest = {
+ 0};
+ GType dest_type = gst_tag_get_type (type);
+
+ have_tags = TRUE;
+ g_value_init (&src, G_TYPE_STRING);
+ g_value_set_string (&src, name);
+ g_value_init (&dest, dest_type);
+ g_value_transform (&src, &dest);
+ g_value_unset (&src);
+ gst_tag_list_add_values (taglist, GST_TAG_MERGE_APPEND,
+ type, &dest, NULL);
+ g_value_unset (&dest);
}
g_free (name);
} else {
@@ -821,10 +804,10 @@ gst_riff_read_info (GstRiffRead *riff)
/* let the world know about this wonderful thing */
for (padlist = gst_element_get_pad_list (element);
- padlist != NULL; padlist = padlist->next) {
- if (GST_PAD_IS_SRC (padlist->data) && GST_PAD_IS_USABLE(padlist->data)) {
- gst_event_ref (event);
- gst_pad_push (GST_PAD (padlist->data), GST_DATA (event));
+ padlist != NULL; padlist = padlist->next) {
+ if (GST_PAD_IS_SRC (padlist->data) && GST_PAD_IS_USABLE (padlist->data)) {
+ gst_event_ref (event);
+ gst_pad_push (GST_PAD (padlist->data), GST_DATA (event));
}
}
gst_event_unref (event);
@@ -839,8 +822,7 @@ gst_riff_read_info (GstRiffRead *riff)
*/
gboolean
-gst_riff_read_header (GstRiffRead *riff,
- guint32 *doctype)
+gst_riff_read_header (GstRiffRead * riff, guint32 * doctype)
{
GstRiffLevel *level;
guint32 tag, length;
@@ -861,7 +843,7 @@ gst_riff_read_header (GstRiffRead *riff,
return FALSE;
}
gst_bytestream_flush_fast (riff->bs, 4);
- *doctype = GUINT32_FROM_LE (* (guint32 *) data);
+ *doctype = GUINT32_FROM_LE (*(guint32 *) data);
/* remember level */
level = g_new (GstRiffLevel, 1);
diff --git a/gst-libs/gst/riff/riff-read.h b/gst-libs/gst/riff/riff-read.h
index 9c663cca..41ae89e3 100644
--- a/gst-libs/gst/riff/riff-read.h
+++ b/gst-libs/gst/riff/riff-read.h
@@ -27,7 +27,6 @@
#include <gst/bytestream/bytestream.h>
G_BEGIN_DECLS
-
#define GST_TYPE_RIFF_READ \
(gst_riff_read_get_type ())
#define GST_RIFF_READ(obj) \
@@ -40,13 +39,13 @@ G_BEGIN_DECLS
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_RIFF_READ))
#define GST_RIFF_READ_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RIFF_READ, GstRiffReadClass))
-
-typedef struct _GstRiffLevel {
- guint64 start,
- length;
+ typedef struct _GstRiffLevel
+{
+ guint64 start, length;
} GstRiffLevel;
-typedef struct _GstRiffRead {
+typedef struct _GstRiffRead
+{
GstElement parent;
GstPad *sinkpad;
@@ -55,43 +54,35 @@ typedef struct _GstRiffRead {
GList *level;
} GstRiffRead;
-typedef struct _GstRiffReadClass {
+typedef struct _GstRiffReadClass
+{
GstElementClass parent;
} GstRiffReadClass;
-GType gst_riff_read_get_type (void);
+GType gst_riff_read_get_type (void);
-guint32 gst_riff_peek_tag (GstRiffRead *riff,
- guint *level_up);
-guint32 gst_riff_peek_list (GstRiffRead *riff);
+guint32 gst_riff_peek_tag (GstRiffRead * riff, guint * level_up);
+guint32 gst_riff_peek_list (GstRiffRead * riff);
-GstEvent *gst_riff_read_seek (GstRiffRead *riff,
- guint64 offset);
-gboolean gst_riff_read_skip (GstRiffRead *riff);
-gboolean gst_riff_read_data (GstRiffRead *riff,
- guint32 *tag,
- GstBuffer **buf);
-gboolean gst_riff_read_ascii (GstRiffRead *riff,
- guint32 *tag,
- gchar **str);
-gboolean gst_riff_read_list (GstRiffRead *riff,
- guint32 *tag);
-gboolean gst_riff_read_header (GstRiffRead *read,
- guint32 *doctype);
+GstEvent *gst_riff_read_seek (GstRiffRead * riff, guint64 offset);
+gboolean gst_riff_read_skip (GstRiffRead * riff);
+gboolean gst_riff_read_data (GstRiffRead * riff,
+ guint32 * tag, GstBuffer ** buf);
+gboolean gst_riff_read_ascii (GstRiffRead * riff, guint32 * tag, gchar ** str);
+gboolean gst_riff_read_list (GstRiffRead * riff, guint32 * tag);
+gboolean gst_riff_read_header (GstRiffRead * read, guint32 * doctype);
/*
* Utility functions (including byteswapping).
*/
-gboolean gst_riff_read_strh (GstRiffRead *riff,
- gst_riff_strh **header);
-gboolean gst_riff_read_strf_vids (GstRiffRead *riff,
- gst_riff_strf_vids **header);
-gboolean gst_riff_read_strf_auds (GstRiffRead *riff,
- gst_riff_strf_auds **header);
-gboolean gst_riff_read_strf_iavs (GstRiffRead *riff,
- gst_riff_strf_iavs **header);
-gboolean gst_riff_read_info (GstRiffRead *riff);
+gboolean gst_riff_read_strh (GstRiffRead * riff, gst_riff_strh ** header);
+gboolean gst_riff_read_strf_vids (GstRiffRead * riff,
+ gst_riff_strf_vids ** header);
+gboolean gst_riff_read_strf_auds (GstRiffRead * riff,
+ gst_riff_strf_auds ** header);
+gboolean gst_riff_read_strf_iavs (GstRiffRead * riff,
+ gst_riff_strf_iavs ** header);
+gboolean gst_riff_read_info (GstRiffRead * riff);
G_END_DECLS
-
#endif /* __GST_RIFF_READ_H__ */
diff --git a/gst-libs/gst/riff/riff.c b/gst-libs/gst/riff/riff.c
index 9c0ce2ae..ab8d47b5 100644
--- a/gst-libs/gst/riff/riff.c
+++ b/gst-libs/gst/riff/riff.c
@@ -26,19 +26,13 @@
#include <gst/gst.h>
static gboolean
-plugin_init (GstPlugin *plugin)
+plugin_init (GstPlugin * plugin)
{
return gst_library_load ("gstbytestream");
}
-GST_PLUGIN_DEFINE (
- GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "riff",
- "RIFF I/O functions",
- plugin_init,
- VERSION,
- GST_LICENSE,
- GST_PACKAGE,
- GST_ORIGIN
-)
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ "riff",
+ "RIFF I/O functions",
+ plugin_init, VERSION, GST_LICENSE, GST_PACKAGE, GST_ORIGIN)
diff --git a/gst-libs/gst/tag/tag.h b/gst-libs/gst/tag/tag.h
index 97eaf936..bbab48c5 100644
--- a/gst-libs/gst/tag/tag.h
+++ b/gst-libs/gst/tag/tag.h
@@ -24,39 +24,30 @@
#include <gst/gst.h>
G_BEGIN_DECLS
-
-
/* functions for vorbis comment manipulation */
+ G_CONST_RETURN gchar * gst_tag_from_vorbis_tag (const gchar * vorbis_tag);
+G_CONST_RETURN gchar *gst_tag_to_vorbis_tag (const gchar * gst_tag);
+void gst_vorbis_tag_add (GstTagList * list,
+ const gchar * tag, const gchar * value);
-G_CONST_RETURN gchar * gst_tag_from_vorbis_tag (const gchar * vorbis_tag);
-G_CONST_RETURN gchar * gst_tag_to_vorbis_tag (const gchar * gst_tag);
-void gst_vorbis_tag_add (GstTagList * list,
- const gchar * tag,
- const gchar * value);
-
-GList * gst_tag_to_vorbis_comments (const GstTagList * list,
- const gchar * tag);
+GList *gst_tag_to_vorbis_comments (const GstTagList * list, const gchar * tag);
/* functions to convert GstBuffers with vorbiscomment contents to GstTagLists and back */
-GstTagList * gst_tag_list_from_vorbiscomment_buffer (const GstBuffer * buffer,
- const guint8 * id_data,
- const guint id_data_length,
- gchar ** vendor_string);
-GstBuffer * gst_tag_list_to_vorbiscomment_buffer (const GstTagList * list,
- const guint8 * id_data,
- const guint id_data_length,
- const gchar * vendor_string);
+GstTagList *gst_tag_list_from_vorbiscomment_buffer (const GstBuffer * buffer,
+ const guint8 * id_data, const guint id_data_length, gchar ** vendor_string);
+GstBuffer *gst_tag_list_to_vorbiscomment_buffer (const GstTagList * list,
+ const guint8 * id_data,
+ const guint id_data_length, const gchar * vendor_string);
/* functions for ID3 tag manipulation */
-guint gst_tag_id3_genre_count (void);
-G_CONST_RETURN gchar * gst_tag_id3_genre_get (const guint id);
-GstTagList * gst_tag_list_new_from_id3v1 (const guint8 * data);
+guint gst_tag_id3_genre_count (void);
+G_CONST_RETURN gchar *gst_tag_id3_genre_get (const guint id);
+GstTagList *gst_tag_list_new_from_id3v1 (const guint8 * data);
-G_CONST_RETURN gchar * gst_tag_from_id3_tag (const gchar * vorbis_tag);
-G_CONST_RETURN gchar * gst_tag_to_id3_tag (const gchar * gst_tag);
+G_CONST_RETURN gchar *gst_tag_from_id3_tag (const gchar * vorbis_tag);
+G_CONST_RETURN gchar *gst_tag_to_id3_tag (const gchar * gst_tag);
G_END_DECLS
-
#endif /* __GST_TAG_TAG_H__ */
diff --git a/gst-libs/gst/tuner/tuner.c b/gst-libs/gst/tuner/tuner.c
index 1181bc13..fd1c354f 100644
--- a/gst-libs/gst/tuner/tuner.c
+++ b/gst-libs/gst/tuner/tuner.c
@@ -28,7 +28,8 @@
#include <string.h>
-enum {
+enum
+{
NORM_CHANGED,
CHANNEL_CHANGED,
FREQUENCY_CHANGED,
@@ -36,7 +37,7 @@ enum {
LAST_SIGNAL
};
-static void gst_tuner_class_init (GstTunerClass *klass);
+static void gst_tuner_class_init (GstTunerClass * klass);
static guint gst_tuner_signals[LAST_SIGNAL] = { 0 };
@@ -59,49 +60,47 @@ gst_tuner_get_type (void)
};
gst_tuner_type = g_type_register_static (G_TYPE_INTERFACE,
- "GstTuner",
- &gst_tuner_info, 0);
+ "GstTuner", &gst_tuner_info, 0);
g_type_interface_add_prerequisite (gst_tuner_type,
- GST_TYPE_IMPLEMENTS_INTERFACE);
+ GST_TYPE_IMPLEMENTS_INTERFACE);
}
return gst_tuner_type;
}
static void
-gst_tuner_class_init (GstTunerClass *klass)
+gst_tuner_class_init (GstTunerClass * klass)
{
static gboolean initialized = FALSE;
if (!initialized) {
gst_tuner_signals[NORM_CHANGED] =
- g_signal_new ("norm-changed",
- GST_TYPE_TUNER, G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstTunerClass, norm_changed),
- NULL, NULL,
- g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1,
- GST_TYPE_TUNER_NORM);
+ g_signal_new ("norm-changed",
+ GST_TYPE_TUNER, G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GstTunerClass, norm_changed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, GST_TYPE_TUNER_NORM);
gst_tuner_signals[CHANNEL_CHANGED] =
- g_signal_new ("channel-changed",
- GST_TYPE_TUNER, G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstTunerClass, channel_changed),
- NULL, NULL,
- g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1,
- GST_TYPE_TUNER_CHANNEL);
+ g_signal_new ("channel-changed",
+ GST_TYPE_TUNER, G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GstTunerClass, channel_changed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1,
+ GST_TYPE_TUNER_CHANNEL);
gst_tuner_signals[FREQUENCY_CHANGED] =
- g_signal_new ("frequency-changed",
- GST_TYPE_TUNER, G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstTunerClass, frequency_changed),
- NULL, NULL,
- gst_tuner_marshal_VOID__OBJECT_ULONG, G_TYPE_NONE, 2,
- GST_TYPE_TUNER_CHANNEL, G_TYPE_ULONG);
+ g_signal_new ("frequency-changed",
+ GST_TYPE_TUNER, G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GstTunerClass, frequency_changed),
+ NULL, NULL,
+ gst_tuner_marshal_VOID__OBJECT_ULONG, G_TYPE_NONE, 2,
+ GST_TYPE_TUNER_CHANNEL, G_TYPE_ULONG);
gst_tuner_signals[SIGNAL_CHANGED] =
- g_signal_new ("signal-changed",
- GST_TYPE_TUNER, G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstTunerClass, signal_changed),
- NULL, NULL,
- gst_tuner_marshal_VOID__OBJECT_INT, G_TYPE_NONE, 2,
- GST_TYPE_TUNER_CHANNEL, G_TYPE_INT);
+ g_signal_new ("signal-changed",
+ GST_TYPE_TUNER, G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GstTunerClass, signal_changed),
+ NULL, NULL,
+ gst_tuner_marshal_VOID__OBJECT_INT, G_TYPE_NONE, 2,
+ GST_TYPE_TUNER_CHANNEL, G_TYPE_INT);
initialized = TRUE;
}
@@ -131,7 +130,7 @@ gst_tuner_class_init (GstTunerClass *klass)
*/
const GList *
-gst_tuner_list_channels (GstTuner *tuner)
+gst_tuner_list_channels (GstTuner * tuner)
{
GstTunerClass *klass = GST_TUNER_GET_CLASS (tuner);
@@ -151,8 +150,7 @@ gst_tuner_list_channels (GstTuner *tuner)
*/
void
-gst_tuner_set_channel (GstTuner *tuner,
- GstTunerChannel *channel)
+gst_tuner_set_channel (GstTuner * tuner, GstTunerChannel * channel)
{
GstTunerClass *klass = GST_TUNER_GET_CLASS (tuner);
@@ -171,7 +169,7 @@ gst_tuner_set_channel (GstTuner *tuner,
*/
GstTunerChannel *
-gst_tuner_get_channel (GstTuner *tuner)
+gst_tuner_get_channel (GstTuner * tuner)
{
GstTunerClass *klass = GST_TUNER_GET_CLASS (tuner);
@@ -194,7 +192,7 @@ gst_tuner_get_channel (GstTuner *tuner)
*/
const GList *
-gst_tuner_list_norms (GstTuner *tuner)
+gst_tuner_list_norms (GstTuner * tuner)
{
GstTunerClass *klass = GST_TUNER_GET_CLASS (tuner);
@@ -214,8 +212,7 @@ gst_tuner_list_norms (GstTuner *tuner)
*/
void
-gst_tuner_set_norm (GstTuner *tuner,
- GstTunerNorm *norm)
+gst_tuner_set_norm (GstTuner * tuner, GstTunerNorm * norm)
{
GstTunerClass *klass = GST_TUNER_GET_CLASS (tuner);
@@ -235,7 +232,7 @@ gst_tuner_set_norm (GstTuner *tuner,
*/
GstTunerNorm *
-gst_tuner_get_norm (GstTuner *tuner)
+gst_tuner_get_norm (GstTuner * tuner)
{
GstTunerClass *klass = GST_TUNER_GET_CLASS (tuner);
@@ -259,14 +256,13 @@ gst_tuner_get_norm (GstTuner *tuner)
*/
void
-gst_tuner_set_frequency (GstTuner *tuner,
- GstTunerChannel *channel,
- gulong frequency)
+gst_tuner_set_frequency (GstTuner * tuner,
+ GstTunerChannel * channel, gulong frequency)
{
GstTunerClass *klass = GST_TUNER_GET_CLASS (tuner);
g_return_if_fail (GST_TUNER_CHANNEL_HAS_FLAG (channel,
- GST_TUNER_CHANNEL_FREQUENCY));
+ GST_TUNER_CHANNEL_FREQUENCY));
if (klass->set_frequency) {
klass->set_frequency (tuner, channel, frequency);
@@ -285,13 +281,12 @@ gst_tuner_set_frequency (GstTuner *tuner,
*/
gulong
-gst_tuner_get_frequency (GstTuner *tuner,
- GstTunerChannel *channel)
+gst_tuner_get_frequency (GstTuner * tuner, GstTunerChannel * channel)
{
GstTunerClass *klass = GST_TUNER_GET_CLASS (tuner);
g_return_val_if_fail (GST_TUNER_CHANNEL_HAS_FLAG (channel,
- GST_TUNER_CHANNEL_FREQUENCY), 0);
+ GST_TUNER_CHANNEL_FREQUENCY), 0);
if (klass->get_frequency) {
return klass->get_frequency (tuner, channel);
@@ -315,13 +310,12 @@ gst_tuner_get_frequency (GstTuner *tuner,
*/
gint
-gst_tuner_signal_strength (GstTuner *tuner,
- GstTunerChannel *channel)
+gst_tuner_signal_strength (GstTuner * tuner, GstTunerChannel * channel)
{
GstTunerClass *klass = GST_TUNER_GET_CLASS (tuner);
g_return_val_if_fail (GST_TUNER_CHANNEL_HAS_FLAG (channel,
- GST_TUNER_CHANNEL_FREQUENCY), 0);
+ GST_TUNER_CHANNEL_FREQUENCY), 0);
if (klass->signal_strength) {
return klass->signal_strength (tuner, channel);
@@ -331,8 +325,7 @@ gst_tuner_signal_strength (GstTuner *tuner,
}
GstTunerNorm *
-gst_tuner_find_norm_by_name (GstTuner *tuner,
- gchar *norm)
+gst_tuner_find_norm_by_name (GstTuner * tuner, gchar * norm)
{
GList *walk;
@@ -349,8 +342,7 @@ gst_tuner_find_norm_by_name (GstTuner *tuner,
}
GstTunerChannel *
-gst_tuner_find_channel_by_name (GstTuner *tuner,
- gchar *channel)
+gst_tuner_find_channel_by_name (GstTuner * tuner, gchar * channel)
{
GList *walk;
@@ -367,59 +359,46 @@ gst_tuner_find_channel_by_name (GstTuner *tuner,
}
void
-gst_tuner_channel_changed (GstTuner *tuner,
- GstTunerChannel *channel)
+gst_tuner_channel_changed (GstTuner * tuner, GstTunerChannel * channel)
{
g_return_if_fail (GST_IS_TUNER (tuner));
g_return_if_fail (GST_IS_TUNER_CHANNEL (channel));
g_signal_emit (G_OBJECT (tuner),
- gst_tuner_signals[CHANNEL_CHANGED], 0,
- channel);
+ gst_tuner_signals[CHANNEL_CHANGED], 0, channel);
}
void
-gst_tuner_norm_changed (GstTuner *tuner,
- GstTunerNorm *norm)
+gst_tuner_norm_changed (GstTuner * tuner, GstTunerNorm * norm)
{
g_return_if_fail (GST_IS_TUNER (tuner));
g_return_if_fail (GST_IS_TUNER_NORM (norm));
- g_signal_emit (G_OBJECT (tuner),
- gst_tuner_signals[NORM_CHANGED], 0,
- norm);
+ g_signal_emit (G_OBJECT (tuner), gst_tuner_signals[NORM_CHANGED], 0, norm);
}
void
-gst_tuner_frequency_changed (GstTuner *tuner,
- GstTunerChannel *channel,
- gulong frequency)
+gst_tuner_frequency_changed (GstTuner * tuner,
+ GstTunerChannel * channel, gulong frequency)
{
g_return_if_fail (GST_IS_TUNER (tuner));
g_return_if_fail (GST_IS_TUNER_CHANNEL (channel));
g_signal_emit (G_OBJECT (tuner),
- gst_tuner_signals[FREQUENCY_CHANGED], 0,
- channel, frequency);
+ gst_tuner_signals[FREQUENCY_CHANGED], 0, channel, frequency);
- g_signal_emit_by_name (G_OBJECT (channel),
- "frequency_changed",
- frequency);
+ g_signal_emit_by_name (G_OBJECT (channel), "frequency_changed", frequency);
}
void
-gst_tuner_signal_changed (GstTuner *tuner,
- GstTunerChannel *channel,
- gint signal)
+gst_tuner_signal_changed (GstTuner * tuner,
+ GstTunerChannel * channel, gint signal)
{
g_return_if_fail (GST_IS_TUNER (tuner));
g_return_if_fail (GST_IS_TUNER_CHANNEL (channel));
g_signal_emit (G_OBJECT (tuner),
- gst_tuner_signals[SIGNAL_CHANGED], 0,
- channel, signal);
+ gst_tuner_signals[SIGNAL_CHANGED], 0, channel, signal);
- g_signal_emit_by_name (G_OBJECT (channel),
- "signal_changed",
- signal);
+ g_signal_emit_by_name (G_OBJECT (channel), "signal_changed", signal);
}
diff --git a/gst-libs/gst/tuner/tuner.h b/gst-libs/gst/tuner/tuner.h
index 8c935389..cab3541d 100644
--- a/gst-libs/gst/tuner/tuner.h
+++ b/gst-libs/gst/tuner/tuner.h
@@ -28,7 +28,6 @@
#include <gst/tuner/tuner-enumtypes.h>
G_BEGIN_DECLS
-
#define GST_TYPE_TUNER \
(gst_tuner_get_type ())
#define GST_TUNER(obj) \
@@ -41,87 +40,65 @@ G_BEGIN_DECLS
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_TUNER))
#define GST_TUNER_GET_CLASS(inst) \
(G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_TUNER, GstTunerClass))
-
typedef struct _GstTuner GstTuner;
-typedef struct _GstTunerClass {
+typedef struct _GstTunerClass
+{
GTypeInterface klass;
/* virtual functions */
- const GList * (* list_channels) (GstTuner *tuner);
- void (* set_channel) (GstTuner *tuner,
- GstTunerChannel *channel);
- GstTunerChannel *
- (* get_channel) (GstTuner *tuner);
-
- const GList * (* list_norms) (GstTuner *tuner);
- void (* set_norm) (GstTuner *tuner,
- GstTunerNorm *norm);
- GstTunerNorm *(* get_norm) (GstTuner *tuner);
-
- void (* set_frequency) (GstTuner *tuner,
- GstTunerChannel *channel,
- gulong frequency);
- gulong (* get_frequency) (GstTuner *tuner,
- GstTunerChannel *channel);
- gint (* signal_strength) (GstTuner *tuner,
- GstTunerChannel *channel);
+ const GList *(*list_channels) (GstTuner * tuner);
+ void (*set_channel) (GstTuner * tuner, GstTunerChannel * channel);
+ GstTunerChannel *(*get_channel) (GstTuner * tuner);
+
+ const GList *(*list_norms) (GstTuner * tuner);
+ void (*set_norm) (GstTuner * tuner, GstTunerNorm * norm);
+ GstTunerNorm *(*get_norm) (GstTuner * tuner);
+
+ void (*set_frequency) (GstTuner * tuner,
+ GstTunerChannel * channel, gulong frequency);
+ gulong (*get_frequency) (GstTuner * tuner, GstTunerChannel * channel);
+ gint (*signal_strength) (GstTuner * tuner, GstTunerChannel * channel);
/* signals */
- void (*channel_changed) (GstTuner *tuner,
- GstTunerChannel *channel);
- void (*norm_changed) (GstTuner *tuner,
- GstTunerNorm *norm);
- void (*frequency_changed) (GstTuner *tuner,
- GstTunerChannel *channel,
- gulong frequency);
- void (*signal_changed) (GstTuner *tuner,
- GstTunerChannel *channel,
- gint signal);
+ void (*channel_changed) (GstTuner * tuner, GstTunerChannel * channel);
+ void (*norm_changed) (GstTuner * tuner, GstTunerNorm * norm);
+ void (*frequency_changed) (GstTuner * tuner,
+ GstTunerChannel * channel, gulong frequency);
+ void (*signal_changed) (GstTuner * tuner,
+ GstTunerChannel * channel, gint signal);
gpointer _gst_reserved[GST_PADDING];
} GstTunerClass;
-GType gst_tuner_get_type (void);
+GType gst_tuner_get_type (void);
/* virtual class function wrappers */
-const GList * gst_tuner_list_channels (GstTuner *tuner);
-void gst_tuner_set_channel (GstTuner *tuner,
- GstTunerChannel *channel);
-GstTunerChannel *
- gst_tuner_get_channel (GstTuner *tuner);
-
-const GList * gst_tuner_list_norms (GstTuner *tuner);
-void gst_tuner_set_norm (GstTuner *tuner,
- GstTunerNorm *channel);
-GstTunerNorm * gst_tuner_get_norm (GstTuner *tuner);
-
-void gst_tuner_set_frequency (GstTuner *tuner,
- GstTunerChannel *channel,
- gulong frequency);
-gulong gst_tuner_get_frequency (GstTuner *tuner,
- GstTunerChannel *channel);
-gint gst_tuner_signal_strength (GstTuner *tuner,
- GstTunerChannel *channel);
+const GList *gst_tuner_list_channels (GstTuner * tuner);
+void gst_tuner_set_channel (GstTuner * tuner, GstTunerChannel * channel);
+GstTunerChannel *gst_tuner_get_channel (GstTuner * tuner);
+
+const GList *gst_tuner_list_norms (GstTuner * tuner);
+void gst_tuner_set_norm (GstTuner * tuner, GstTunerNorm * channel);
+GstTunerNorm *gst_tuner_get_norm (GstTuner * tuner);
+
+void gst_tuner_set_frequency (GstTuner * tuner,
+ GstTunerChannel * channel, gulong frequency);
+gulong gst_tuner_get_frequency (GstTuner * tuner, GstTunerChannel * channel);
+gint gst_tuner_signal_strength (GstTuner * tuner, GstTunerChannel * channel);
/* helper functions */
-GstTunerNorm * gst_tuner_find_norm_by_name (GstTuner *tuner,
- gchar *norm);
-GstTunerChannel *gst_tuner_find_channel_by_name (GstTuner *tuner,
- gchar *channel);
+GstTunerNorm *gst_tuner_find_norm_by_name (GstTuner * tuner, gchar * norm);
+GstTunerChannel *gst_tuner_find_channel_by_name (GstTuner * tuner,
+ gchar * channel);
/* trigger signals */
-void gst_tuner_channel_changed (GstTuner *tuner,
- GstTunerChannel *channel);
-void gst_tuner_norm_changed (GstTuner *tuner,
- GstTunerNorm *norm);
-void gst_tuner_frequency_changed (GstTuner *tuner,
- GstTunerChannel *channel,
- gulong frequency);
-void gst_tuner_signal_changed (GstTuner *tuner,
- GstTunerChannel *channel,
- gint signal);
+void gst_tuner_channel_changed (GstTuner * tuner, GstTunerChannel * channel);
+void gst_tuner_norm_changed (GstTuner * tuner, GstTunerNorm * norm);
+void gst_tuner_frequency_changed (GstTuner * tuner,
+ GstTunerChannel * channel, gulong frequency);
+void gst_tuner_signal_changed (GstTuner * tuner,
+ GstTunerChannel * channel, gint signal);
G_END_DECLS
-
#endif /* __GST_TUNER_H__ */
diff --git a/gst-libs/gst/tuner/tunerchannel.c b/gst-libs/gst/tuner/tunerchannel.c
index ffcfcd9d..af93f568 100644
--- a/gst-libs/gst/tuner/tunerchannel.c
+++ b/gst-libs/gst/tuner/tunerchannel.c
@@ -25,16 +25,17 @@
#include "tunerchannel.h"
-enum {
+enum
+{
/* FILL ME */
SIGNAL_FREQUENCY_CHANGED,
SIGNAL_SIGNAL_CHANGED,
LAST_SIGNAL
};
-static void gst_tuner_channel_class_init (GstTunerChannelClass *klass);
-static void gst_tuner_channel_init (GstTunerChannel *channel);
-static void gst_tuner_channel_dispose (GObject *object);
+static void gst_tuner_channel_class_init (GstTunerChannelClass * klass);
+static void gst_tuner_channel_init (GstTunerChannel * channel);
+static void gst_tuner_channel_dispose (GObject * object);
static GObjectClass *parent_class = NULL;
static guint signals[LAST_SIGNAL] = { 0 };
@@ -60,40 +61,37 @@ gst_tuner_channel_get_type (void)
gst_tuner_channel_type =
g_type_register_static (G_TYPE_OBJECT,
- "GstTunerChannel",
- &tuner_channel_info, 0);
+ "GstTunerChannel", &tuner_channel_info, 0);
}
return gst_tuner_channel_type;
}
static void
-gst_tuner_channel_class_init (GstTunerChannelClass *klass)
+gst_tuner_channel_class_init (GstTunerChannelClass * klass)
{
GObjectClass *object_klass = (GObjectClass *) klass;
parent_class = g_type_class_ref (G_TYPE_OBJECT);
signals[SIGNAL_FREQUENCY_CHANGED] =
- g_signal_new ("frequency-changed", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstTunerChannelClass,
- frequency_changed),
- NULL, NULL, g_cclosure_marshal_VOID__ULONG,
- G_TYPE_NONE, 1, G_TYPE_ULONG);
+ g_signal_new ("frequency-changed", G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GstTunerChannelClass,
+ frequency_changed),
+ NULL, NULL, g_cclosure_marshal_VOID__ULONG, G_TYPE_NONE, 1, G_TYPE_ULONG);
signals[SIGNAL_SIGNAL_CHANGED] =
- g_signal_new ("signal-changed", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstTunerChannelClass,
- signal_changed),
- NULL, NULL, g_cclosure_marshal_VOID__INT,
- G_TYPE_NONE, 1, G_TYPE_INT);
+ g_signal_new ("signal-changed", G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GstTunerChannelClass,
+ signal_changed),
+ NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
object_klass->dispose = gst_tuner_channel_dispose;
}
static void
-gst_tuner_channel_init (GstTunerChannel *channel)
+gst_tuner_channel_init (GstTunerChannel * channel)
{
channel->label = NULL;
channel->flags = 0;
@@ -102,7 +100,7 @@ gst_tuner_channel_init (GstTunerChannel *channel)
}
static void
-gst_tuner_channel_dispose (GObject *object)
+gst_tuner_channel_dispose (GObject * object)
{
GstTunerChannel *channel = GST_TUNER_CHANNEL (object);
diff --git a/gst-libs/gst/tuner/tunerchannel.h b/gst-libs/gst/tuner/tunerchannel.h
index ee5654d0..663d682d 100644
--- a/gst-libs/gst/tuner/tunerchannel.h
+++ b/gst-libs/gst/tuner/tunerchannel.h
@@ -25,7 +25,6 @@
#include <gst/gst.h>
G_BEGIN_DECLS
-
#define GST_TYPE_TUNER_CHANNEL \
(gst_tuner_channel_get_type ())
#define GST_TUNER_CHANNEL(obj) \
@@ -38,42 +37,39 @@ G_BEGIN_DECLS
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_TUNER_CHANNEL))
#define GST_IS_TUNER_CHANNEL_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_TUNER_CHANNEL))
-
-typedef enum {
- GST_TUNER_CHANNEL_INPUT = (1<<0),
- GST_TUNER_CHANNEL_OUTPUT = (1<<1),
- GST_TUNER_CHANNEL_FREQUENCY = (1<<2),
- GST_TUNER_CHANNEL_AUDIO = (1<<3),
+ typedef enum
+{
+ GST_TUNER_CHANNEL_INPUT = (1 << 0),
+ GST_TUNER_CHANNEL_OUTPUT = (1 << 1),
+ GST_TUNER_CHANNEL_FREQUENCY = (1 << 2),
+ GST_TUNER_CHANNEL_AUDIO = (1 << 3),
} GstTunerChannelFlags;
#define GST_TUNER_CHANNEL_HAS_FLAG(channel, flag) \
((channel)->flags & flag)
-typedef struct _GstTunerChannel {
- GObject parent;
+typedef struct _GstTunerChannel
+{
+ GObject parent;
- gchar *label;
+ gchar *label;
GstTunerChannelFlags flags;
- gulong min_frequency,
- max_frequency;
- gint min_signal,
- max_signal;
+ gulong min_frequency, max_frequency;
+ gint min_signal, max_signal;
} GstTunerChannel;
-typedef struct _GstTunerChannelClass {
+typedef struct _GstTunerChannelClass
+{
GObjectClass parent;
/* signals */
- void (*frequency_changed) (GstTunerChannel *channel,
- gulong frequency);
- void (*signal_changed) (GstTunerChannel *channel,
- gint signal);
+ void (*frequency_changed) (GstTunerChannel * channel, gulong frequency);
+ void (*signal_changed) (GstTunerChannel * channel, gint signal);
gpointer _gst_reserved[GST_PADDING];
} GstTunerChannelClass;
-GType gst_tuner_channel_get_type (void);
+GType gst_tuner_channel_get_type (void);
G_END_DECLS
-
#endif /* __GST_TUNER_CHANNEL_H__ */
diff --git a/gst-libs/gst/tuner/tunernorm.c b/gst-libs/gst/tuner/tunernorm.c
index 48d75de2..41927d2b 100644
--- a/gst-libs/gst/tuner/tunernorm.c
+++ b/gst-libs/gst/tuner/tunernorm.c
@@ -25,16 +25,18 @@
#include "tunernorm.h"
-enum {
+enum
+{
/* FILL ME */
LAST_SIGNAL
};
-static void gst_tuner_norm_class_init (GstTunerNormClass *klass);
-static void gst_tuner_norm_init (GstTunerNorm *norm);
-static void gst_tuner_norm_dispose (GObject *object);
+static void gst_tuner_norm_class_init (GstTunerNormClass * klass);
+static void gst_tuner_norm_init (GstTunerNorm * norm);
+static void gst_tuner_norm_dispose (GObject * object);
static GObjectClass *parent_class = NULL;
+
/*static guint signals[LAST_SIGNAL] = { 0 };*/
GType
@@ -58,15 +60,14 @@ gst_tuner_norm_get_type (void)
gst_tuner_norm_type =
g_type_register_static (G_TYPE_OBJECT,
- "GstTunerNorm",
- &tuner_norm_info, 0);
+ "GstTunerNorm", &tuner_norm_info, 0);
}
return gst_tuner_norm_type;
}
static void
-gst_tuner_norm_class_init (GstTunerNormClass *klass)
+gst_tuner_norm_class_init (GstTunerNormClass * klass)
{
GObjectClass *object_klass = (GObjectClass *) klass;
@@ -76,14 +77,14 @@ gst_tuner_norm_class_init (GstTunerNormClass *klass)
}
static void
-gst_tuner_norm_init (GstTunerNorm *norm)
+gst_tuner_norm_init (GstTunerNorm * norm)
{
norm->label = NULL;
norm->fps = 0.;
}
static void
-gst_tuner_norm_dispose (GObject *object)
+gst_tuner_norm_dispose (GObject * object)
{
GstTunerNorm *norm = GST_TUNER_NORM (object);
diff --git a/gst-libs/gst/tuner/tunernorm.h b/gst-libs/gst/tuner/tunernorm.h
index cd89e1ee..94267b6e 100644
--- a/gst-libs/gst/tuner/tunernorm.h
+++ b/gst-libs/gst/tuner/tunernorm.h
@@ -25,7 +25,6 @@
#include <gst/gst.h>
G_BEGIN_DECLS
-
#define GST_TYPE_TUNER_NORM \
(gst_tuner_norm_get_type ())
#define GST_TUNER_NORM(obj) \
@@ -36,22 +35,22 @@ G_BEGIN_DECLS
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_TUNER_NORM))
#define GST_IS_TUNER_NORM_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_TUNER_NORM))
-
-typedef struct _GstTunerNorm {
+ typedef struct _GstTunerNorm
+{
GObject parent;
- gchar *label;
- gfloat fps;
+ gchar *label;
+ gfloat fps;
} GstTunerNorm;
-typedef struct _GstTunerNormClass {
+typedef struct _GstTunerNormClass
+{
GObjectClass parent;
gpointer _gst_reserved[GST_PADDING];
} GstTunerNormClass;
-GType gst_tuner_norm_get_type (void);
+GType gst_tuner_norm_get_type (void);
G_END_DECLS
-
#endif /* __GST_TUNER_NORM_H__ */
diff --git a/gst-libs/gst/video/gstvideosink.c b/gst-libs/gst/video/gstvideosink.c
index 15f27c16..2acf7e57 100644
--- a/gst-libs/gst/video/gstvideosink.c
+++ b/gst-libs/gst/video/gstvideosink.c
@@ -29,19 +29,19 @@ static GstElementClass *parent_class = NULL;
/* Private methods */
static void
-gst_videosink_set_clock (GstElement *element, GstClock *clock)
+gst_videosink_set_clock (GstElement * element, GstClock * clock)
{
GstVideoSink *videosink;
videosink = GST_VIDEOSINK (element);
-
+
videosink->clock = clock;
}
/* Initing stuff */
static void
-gst_videosink_init (GstVideoSink *videosink)
+gst_videosink_init (GstVideoSink * videosink)
{
videosink->width = 0;
videosink->height = 0;
@@ -49,13 +49,13 @@ gst_videosink_init (GstVideoSink *videosink)
}
static void
-gst_videosink_class_init (GstVideoSinkClass *klass)
+gst_videosink_class_init (GstVideoSinkClass * 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);
@@ -69,24 +69,22 @@ gst_videosink_get_type (void)
{
static GType videosink_type = 0;
- if (!videosink_type)
- {
- static const GTypeInfo videosink_info = {
- sizeof (GstVideoSinkClass),
- NULL,
- NULL,
- (GClassInitFunc) gst_videosink_class_init,
- NULL,
- NULL,
- sizeof (GstVideoSink),
- 0,
- (GInstanceInitFunc) gst_videosink_init,
- };
-
- videosink_type = g_type_register_static (GST_TYPE_ELEMENT,
- "GstVideoSink",
- &videosink_info, 0);
- }
-
+ if (!videosink_type) {
+ static const GTypeInfo videosink_info = {
+ sizeof (GstVideoSinkClass),
+ NULL,
+ NULL,
+ (GClassInitFunc) gst_videosink_class_init,
+ NULL,
+ NULL,
+ sizeof (GstVideoSink),
+ 0,
+ (GInstanceInitFunc) gst_videosink_init,
+ };
+
+ videosink_type = g_type_register_static (GST_TYPE_ELEMENT,
+ "GstVideoSink", &videosink_info, 0);
+ }
+
return videosink_type;
}
diff --git a/gst-libs/gst/video/video.c b/gst-libs/gst/video/video.c
index 114b4bac..8fed1e76 100644
--- a/gst-libs/gst/video/video.c
+++ b/gst-libs/gst/video/video.c
@@ -27,7 +27,7 @@
/* This is simply a convenience function, nothing more or less */
gdouble
-gst_video_frame_rate (GstPad *pad)
+gst_video_frame_rate (GstPad * pad)
{
gdouble fps = 0.;
const GstCaps *caps = NULL;
@@ -37,30 +37,25 @@ gst_video_frame_rate (GstPad *pad)
caps = GST_PAD_CAPS (pad);
if (caps == NULL) {
g_warning ("gstvideo: failed to get caps of pad %s:%s",
- GST_ELEMENT_NAME (gst_pad_get_parent (pad)),
- GST_PAD_NAME(pad));
+ GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad));
return 0.;
}
structure = gst_caps_get_structure (caps, 0);
- if (!gst_structure_get_double (structure, "framerate", &fps)){
+ if (!gst_structure_get_double (structure, "framerate", &fps)) {
g_warning ("gstvideo: failed to get framerate property of pad %s:%s",
- GST_ELEMENT_NAME (gst_pad_get_parent (pad)),
- GST_PAD_NAME (pad));
+ GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad));
return 0.;
}
GST_DEBUG ("Framerate request on pad %s:%s: %f",
- GST_ELEMENT_NAME (gst_pad_get_parent (pad)),
- GST_PAD_NAME(pad), fps);
+ GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad), fps);
return fps;
}
gboolean
-gst_video_get_size (GstPad *pad,
- gint *width,
- gint *height)
+gst_video_get_size (GstPad * pad, gint * width, gint * height)
{
const GstCaps *caps = NULL;
GstStructure *structure;
@@ -74,8 +69,7 @@ gst_video_get_size (GstPad *pad,
if (caps == NULL) {
g_warning ("gstvideo: failed to get caps of pad %s:%s",
- GST_ELEMENT_NAME (gst_pad_get_parent (pad)),
- GST_PAD_NAME(pad));
+ GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad));
return FALSE;
}
@@ -85,34 +79,25 @@ gst_video_get_size (GstPad *pad,
if (!ret) {
g_warning ("gstvideo: failed to get size properties on pad %s:%s",
- GST_ELEMENT_NAME (gst_pad_get_parent (pad)),
- GST_PAD_NAME(pad));
+ GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad));
return FALSE;
}
GST_DEBUG ("size request on pad %s:%s: %dx%d",
- GST_ELEMENT_NAME (gst_pad_get_parent (pad)),
- GST_PAD_NAME (pad),
- width ? *width : -1,
- height ? *height : -1);
+ GST_ELEMENT_NAME (gst_pad_get_parent (pad)),
+ GST_PAD_NAME (pad), width ? *width : -1, height ? *height : -1);
return TRUE;
}
static gboolean
-plugin_init (GstPlugin *plugin)
+plugin_init (GstPlugin * plugin)
{
return TRUE;
}
-GST_PLUGIN_DEFINE (
- GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "gstvideo",
- "Convenience routines for video plugins",
- plugin_init,
- VERSION,
- GST_LICENSE,
- GST_PACKAGE,
- GST_ORIGIN
-)
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ "gstvideo",
+ "Convenience routines for video plugins",
+ plugin_init, VERSION, GST_LICENSE, GST_PACKAGE, GST_ORIGIN)
diff --git a/gst-libs/gst/video/video.h b/gst-libs/gst/video/video.h
index cb8727a9..5ebe444f 100644
--- a/gst-libs/gst/video/video.h
+++ b/gst-libs/gst/video/video.h
@@ -98,31 +98,31 @@
#define GST_VIDEO_CAPS_RGBx \
__GST_VIDEO_CAPS_MAKE_32 (1, 2, 3)
-
+
#define GST_VIDEO_CAPS_xRGB \
__GST_VIDEO_CAPS_MAKE_32 (2, 3, 4)
-
+
#define GST_VIDEO_CAPS_BGRx \
__GST_VIDEO_CAPS_MAKE_32 (3, 2, 1)
-
+
#define GST_VIDEO_CAPS_xBGR \
__GST_VIDEO_CAPS_MAKE_32 (4, 3, 2)
/* note: the macro name uses the order on BE systems */
#if G_BYTE_ORDER == G_BIG_ENDIAN
- #define GST_VIDEO_CAPS_xRGB_HOST_ENDIAN \
+#define GST_VIDEO_CAPS_xRGB_HOST_ENDIAN \
GST_VIDEO_CAPS_xRGB
- #define GST_VIDEO_CAPS_BGRx_HOST_ENDIAN \
+#define GST_VIDEO_CAPS_BGRx_HOST_ENDIAN \
GST_VIDEO_CAPS_BGRx
#else
- #define GST_VIDEO_CAPS_xRGB_HOST_ENDIAN \
+#define GST_VIDEO_CAPS_xRGB_HOST_ENDIAN \
GST_VIDEO_CAPS_BGRx
- #define GST_VIDEO_CAPS_BGRx_HOST_ENDIAN \
+#define GST_VIDEO_CAPS_BGRx_HOST_ENDIAN \
GST_VIDEO_CAPS_xRGB
#endif
-
+
/* 15/16 bit */
-
+
#define GST_VIDEO_CAPS_RGB_16 \
"video/x-raw-rgb, " \
"bpp = (int) 16, " \
@@ -155,9 +155,7 @@
"framerate = " GST_VIDEO_FPS_RANGE
/* functions */
-gdouble gst_video_frame_rate (GstPad *pad);
-gboolean gst_video_get_size (GstPad *pad,
- gint *width,
- gint *height);
+gdouble gst_video_frame_rate (GstPad * pad);
+gboolean gst_video_get_size (GstPad * pad, gint * width, gint * height);
#endif /* __GST_VIDEO_H__ */
diff --git a/gst-libs/gst/video/videosink.h b/gst-libs/gst/video/videosink.h
index 129a47d6..68de26fa 100644
--- a/gst-libs/gst/video/videosink.h
+++ b/gst-libs/gst/video/videosink.h
@@ -17,16 +17,17 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-
+
#ifndef __GST_VIDEOSINK_H__
#define __GST_VIDEOSINK_H__
#include <gst/gst.h>
#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
+extern "C"
+{
+#endif /* __cplusplus */
+
#define GST_TYPE_VIDEOSINK (gst_videosink_get_type())
#define GST_VIDEOSINK(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VIDEOSINK, GstVideoSink))
@@ -38,37 +39,39 @@ extern "C" {
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_VIDEOSINK))
#define GST_VIDEOSINK_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_VIDEOSINK, GstVideoSinkClass))
-
+
#define GST_VIDEOSINK_PAD(obj) (GST_VIDEOSINK (obj)->sinkpad)
#define GST_VIDEOSINK_WIDTH(obj) (GST_VIDEOSINK (obj)->width)
#define GST_VIDEOSINK_HEIGHT(obj) (GST_VIDEOSINK (obj)->height)
#define GST_VIDEOSINK_CLOCK(obj) (GST_VIDEOSINK (obj)->clock)
-
-typedef struct _GstVideoSink GstVideoSink;
-typedef struct _GstVideoSinkClass GstVideoSinkClass;
-
-struct _GstVideoSink {
- GstElement element;
-
- GstPad *sinkpad;
-
- gint width, height;
-
- GstClock *clock;
-
- gpointer _gst_reserved[GST_PADDING];
-};
-
-struct _GstVideoSinkClass {
- GstElementClass parent_class;
-
- gpointer _gst_reserved[GST_PADDING];
-};
-
-GType gst_videosink_get_type (void);
+
+ typedef struct _GstVideoSink GstVideoSink;
+ typedef struct _GstVideoSinkClass GstVideoSinkClass;
+
+ struct _GstVideoSink
+ {
+ GstElement element;
+
+ GstPad *sinkpad;
+
+ gint width, height;
+
+ GstClock *clock;
+
+ gpointer _gst_reserved[GST_PADDING];
+ };
+
+ struct _GstVideoSinkClass
+ {
+ GstElementClass parent_class;
+
+ gpointer _gst_reserved[GST_PADDING];
+ };
+
+ GType gst_videosink_get_type (void);
#ifdef __cplusplus
}
-#endif /* __cplusplus */
+#endif /* __cplusplus */
-#endif /* __GST_VIDEOSINK_H__ */
+#endif /* __GST_VIDEOSINK_H__ */
diff --git a/gst-libs/gst/xoverlay/xoverlay.c b/gst-libs/gst/xoverlay/xoverlay.c
index 66af8d62..c1014eb1 100644
--- a/gst-libs/gst/xoverlay/xoverlay.c
+++ b/gst-libs/gst/xoverlay/xoverlay.c
@@ -25,7 +25,8 @@
#include "xoverlay.h"
-enum {
+enum
+{
HAVE_XWINDOW_ID,
DESIRED_SIZE,
LAST_SIGNAL
@@ -54,44 +55,40 @@ gst_x_overlay_get_type (void)
};
gst_x_overlay_type = g_type_register_static (G_TYPE_INTERFACE,
- "GstXOverlay",
- &gst_x_overlay_info, 0);
+ "GstXOverlay", &gst_x_overlay_info, 0);
g_type_interface_add_prerequisite (gst_x_overlay_type,
- GST_TYPE_IMPLEMENTS_INTERFACE);
+ GST_TYPE_IMPLEMENTS_INTERFACE);
}
return gst_x_overlay_type;
}
/* FIXME: evil hack, we should figure out our marshal handling in this interfaces some day */
-extern void gst_marshal_VOID__INT_INT (GClosure *closure, GValue *return_value, guint n_param_values,
- const GValue *param_values, gpointer invocation_hint, gpointer marshal_data);
+extern void gst_marshal_VOID__INT_INT (GClosure * closure,
+ GValue * return_value, guint n_param_values, const GValue * param_values,
+ gpointer invocation_hint, gpointer marshal_data);
static void
gst_x_overlay_base_init (gpointer g_class)
{
GstXOverlayClass *overlay_class = (GstXOverlayClass *) g_class;
static gboolean initialized = FALSE;
-
- if (! initialized)
- {
- gst_x_overlay_signals[HAVE_XWINDOW_ID] =
- g_signal_new ("have-xwindow-id",
- GST_TYPE_X_OVERLAY, G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstXOverlayClass, have_xwindow_id),
- NULL, NULL,
- g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1,
- G_TYPE_INT);
- gst_x_overlay_signals[DESIRED_SIZE] =
- g_signal_new ("desired-size-changed",
- GST_TYPE_X_OVERLAY, G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstXOverlayClass, desired_size),
- NULL, NULL,
- gst_marshal_VOID__INT_INT, G_TYPE_NONE, 2,
- G_TYPE_INT, G_TYPE_INT);
-
- initialized = TRUE;
- }
+
+ if (!initialized) {
+ gst_x_overlay_signals[HAVE_XWINDOW_ID] =
+ g_signal_new ("have-xwindow-id",
+ GST_TYPE_X_OVERLAY, G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GstXOverlayClass, have_xwindow_id),
+ NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
+ gst_x_overlay_signals[DESIRED_SIZE] =
+ g_signal_new ("desired-size-changed",
+ GST_TYPE_X_OVERLAY, G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GstXOverlayClass, desired_size),
+ NULL, NULL,
+ gst_marshal_VOID__INT_INT, G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
+
+ initialized = TRUE;
+ }
overlay_class->set_xwindow_id = NULL;
}
@@ -107,7 +104,7 @@ gst_x_overlay_base_init (gpointer g_class)
* stop using that window and create an internal one.
*/
void
-gst_x_overlay_set_xwindow_id (GstXOverlay *overlay, gulong xwindow_id)
+gst_x_overlay_set_xwindow_id (GstXOverlay * overlay, gulong xwindow_id)
{
GstXOverlayClass *klass = GST_X_OVERLAY_GET_CLASS (overlay);
@@ -126,13 +123,13 @@ gst_x_overlay_set_xwindow_id (GstXOverlay *overlay, gulong xwindow_id)
* This function should be used by video overlay developpers.
*/
void
-gst_x_overlay_got_xwindow_id (GstXOverlay *overlay, gulong xwindow_id)
+gst_x_overlay_got_xwindow_id (GstXOverlay * overlay, gulong xwindow_id)
{
g_return_if_fail (overlay != NULL);
g_return_if_fail (GST_IS_X_OVERLAY (overlay));
-
+
g_signal_emit (G_OBJECT (overlay),
- gst_x_overlay_signals[HAVE_XWINDOW_ID], 0, (gint) xwindow_id);
+ gst_x_overlay_signals[HAVE_XWINDOW_ID], 0, (gint) xwindow_id);
}
/**
@@ -145,18 +142,20 @@ gst_x_overlay_got_xwindow_id (GstXOverlay *overlay, gulong xwindow_id)
* size, width and height are set to 0.
*/
void
-gst_x_overlay_get_desired_size (GstXOverlay *overlay, guint *width, guint *height)
+gst_x_overlay_get_desired_size (GstXOverlay * overlay, guint * width,
+ guint * height)
{
guint width_tmp, height_tmp;
GstXOverlayClass *klass;
-
+
g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE ((overlay), GST_TYPE_X_OVERLAY));
-
+
klass = GST_X_OVERLAY_GET_CLASS (overlay);
if (klass->get_desired_size && GST_IS_X_OVERLAY (overlay)) {
/* this ensures that elements don't need to check width and height for NULL
but apps may use NULL */
- klass->get_desired_size (overlay, width ? width : &width_tmp, height ? height : &height_tmp);
+ klass->get_desired_size (overlay, width ? width : &width_tmp,
+ height ? height : &height_tmp);
} else {
if (width)
*width = 0;
@@ -176,12 +175,13 @@ gst_x_overlay_get_desired_size (GstXOverlay *overlay, guint *width, guint *heigh
* This function should be used by video overlay developpers.
*/
void
-gst_x_overlay_got_desired_size (GstXOverlay *overlay, guint width, guint height)
+gst_x_overlay_got_desired_size (GstXOverlay * overlay, guint width,
+ guint height)
{
g_return_if_fail (GST_IS_X_OVERLAY (overlay));
-
+
g_signal_emit (G_OBJECT (overlay),
- gst_x_overlay_signals[DESIRED_SIZE], 0, width, height);
+ gst_x_overlay_signals[DESIRED_SIZE], 0, width, height);
}
/**
@@ -192,7 +192,7 @@ gst_x_overlay_got_desired_size (GstXOverlay *overlay, guint width, guint height)
* in the drawable even if the pipeline is PAUSED.
*/
void
-gst_x_overlay_expose (GstXOverlay *overlay)
+gst_x_overlay_expose (GstXOverlay * overlay)
{
GstXOverlayClass *klass = GST_X_OVERLAY_GET_CLASS (overlay);
diff --git a/gst-libs/gst/xoverlay/xoverlay.h b/gst-libs/gst/xoverlay/xoverlay.h
index 5318fef3..b1c90690 100644
--- a/gst-libs/gst/xoverlay/xoverlay.h
+++ b/gst-libs/gst/xoverlay/xoverlay.h
@@ -26,7 +26,6 @@
#include <gst/gst.h>
G_BEGIN_DECLS
-
#define GST_TYPE_X_OVERLAY \
(gst_x_overlay_get_type ())
#define GST_X_OVERLAY(obj) \
@@ -40,42 +39,38 @@ G_BEGIN_DECLS
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_X_OVERLAY))
#define GST_X_OVERLAY_GET_CLASS(inst) \
(G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_X_OVERLAY, GstXOverlayClass))
-
typedef struct _GstXOverlay GstXOverlay;
-typedef struct _GstXOverlayClass {
+typedef struct _GstXOverlayClass
+{
GTypeInterface klass;
/* virtual functions */
- void (* set_xwindow_id) (GstXOverlay *overlay,
- gulong xwindow_id);
+ void (*set_xwindow_id) (GstXOverlay * overlay, gulong xwindow_id);
/* optional virtual functions */
- void (* get_desired_size) (GstXOverlay *overlay,
- guint *width,
- guint *height);
- void (* expose) (GstXOverlay *overlay);
-
+ void (*get_desired_size) (GstXOverlay * overlay,
+ guint * width, guint * height);
+ void (*expose) (GstXOverlay * overlay);
+
/* signals */
- void (*have_xwindow_id) (GstXOverlay *overlay,
- gulong xwindow_id);
- void (* desired_size) (GstXOverlay *overlay,
- guint width,
- guint height);
+ void (*have_xwindow_id) (GstXOverlay * overlay, gulong xwindow_id);
+ void (*desired_size) (GstXOverlay * overlay, guint width, guint height);
gpointer _gst_reserved[GST_PADDING];
} GstXOverlayClass;
-GType gst_x_overlay_get_type (void);
+GType gst_x_overlay_get_type (void);
/* virtual class function wrappers */
-void gst_x_overlay_set_xwindow_id (GstXOverlay *overlay, gulong xwindow_id);
-void gst_x_overlay_get_desired_size (GstXOverlay *overlay, guint *width, guint *height);
-void gst_x_overlay_expose (GstXOverlay *overlay);
+void gst_x_overlay_set_xwindow_id (GstXOverlay * overlay, gulong xwindow_id);
+void gst_x_overlay_get_desired_size (GstXOverlay * overlay, guint * width,
+ guint * height);
+void gst_x_overlay_expose (GstXOverlay * overlay);
/* public methods to fire signals */
-void gst_x_overlay_got_xwindow_id (GstXOverlay *overlay, gulong xwindow_id);
-void gst_x_overlay_got_desired_size (GstXOverlay *overlay, guint width, guint height);
+void gst_x_overlay_got_xwindow_id (GstXOverlay * overlay, gulong xwindow_id);
+void gst_x_overlay_got_desired_size (GstXOverlay * overlay, guint width,
+ guint height);
G_END_DECLS
-
#endif /* __GST_X_OVERLAY_H__ */
diff --git a/gst-libs/gst/xwindowlistener/xwindowlistener.c b/gst-libs/gst/xwindowlistener/xwindowlistener.c
index a2b76994..dc289854 100644
--- a/gst-libs/gst/xwindowlistener/xwindowlistener.c
+++ b/gst-libs/gst/xwindowlistener/xwindowlistener.c
@@ -28,12 +28,12 @@
#define NUM_CLIPS 1024
-static void gst_x_window_listener_class_init (GstXWindowListenerClass *klass);
-static void gst_x_window_listener_init (GstXWindowListener *xwin);
-static void gst_x_window_listener_dispose (GObject *object);
+static void gst_x_window_listener_class_init (GstXWindowListenerClass * klass);
+static void gst_x_window_listener_init (GstXWindowListener * xwin);
+static void gst_x_window_listener_dispose (GObject * object);
-static void gst_xwin_start (GstXWindowListener *xwin);
-static void gst_xwin_stop (GstXWindowListener *xwin);
+static void gst_xwin_start (GstXWindowListener * xwin);
+static void gst_xwin_stop (GstXWindowListener * xwin);
static GObjectClass *parent_class = NULL;
@@ -58,15 +58,14 @@ gst_x_window_listener_get_type (void)
x_window_listener_type =
g_type_register_static (G_TYPE_OBJECT,
- "GstXWindowListener",
- &x_window_listener_info, 0);
+ "GstXWindowListener", &x_window_listener_info, 0);
}
return x_window_listener_type;
}
static void
-gst_x_window_listener_class_init (GstXWindowListenerClass *klass)
+gst_x_window_listener_class_init (GstXWindowListenerClass * klass)
{
GObjectClass *object_klass = (GObjectClass *) klass;
@@ -76,7 +75,7 @@ gst_x_window_listener_class_init (GstXWindowListenerClass *klass)
}
static void
-gst_x_window_listener_init (GstXWindowListener *xwin)
+gst_x_window_listener_init (GstXWindowListener * xwin)
{
xwin->xwindow_id = 0;
xwin->display_name = NULL;
@@ -88,7 +87,7 @@ gst_x_window_listener_init (GstXWindowListener *xwin)
}
static void
-gst_x_window_listener_dispose (GObject *object)
+gst_x_window_listener_dispose (GObject * object)
{
GstXWindowListener *xwin = GST_X_WINDOW_LISTENER (object);
@@ -105,13 +104,11 @@ gst_x_window_listener_dispose (GObject *object)
}
GstXWindowListener *
-gst_x_window_listener_new (gchar *display,
- MapWindowFunc map_window_func,
- SetWindowFunc set_window_func,
- gpointer private_data)
+gst_x_window_listener_new (gchar * display,
+ MapWindowFunc map_window_func,
+ SetWindowFunc set_window_func, gpointer private_data)
{
- GstXWindowListener *xwin =
- g_object_new (GST_TYPE_X_WINDOW_LISTENER, NULL);
+ GstXWindowListener *xwin = g_object_new (GST_TYPE_X_WINDOW_LISTENER, NULL);
xwin->display_name = g_strdup (display);
xwin->map_window_func = map_window_func;
@@ -122,8 +119,7 @@ gst_x_window_listener_new (gchar *display,
}
void
-gst_x_window_listener_set_xid (GstXWindowListener *xwin,
- XID id)
+gst_x_window_listener_set_xid (GstXWindowListener * xwin, XID id)
{
g_return_if_fail (xwin != NULL);
@@ -137,9 +133,7 @@ gst_x_window_listener_set_xid (GstXWindowListener *xwin,
xwin->xwindow_id = id;
- if (xwin->xwindow_id &&
- xwin->display_name &&
- xwin->display_name[0] == ':') {
+ if (xwin->xwindow_id && xwin->display_name && xwin->display_name[0] == ':') {
g_return_if_fail (xwin->map_window_func != NULL);
g_return_if_fail (xwin->set_window_func != NULL);
@@ -163,8 +157,7 @@ gst_x_window_listener_set_xid (GstXWindowListener *xwin,
GST_DEBUG ("XWL: " format, ##args)
static void
-gst_xwin_set_overlay (GstXWindowListener *xwin,
- gboolean on)
+gst_xwin_set_overlay (GstXWindowListener * xwin, gboolean on)
{
xwin->map_window_func (xwin->private_data, on);
@@ -190,22 +183,20 @@ gst_xwin_refresh (gpointer data)
if (!xwin->ov_move && xwin->ov_map &&
xwin->ov_visibility == VisibilityUnobscured) {
g_mutex_unlock (xwin->main_lock);
- return FALSE; /* skip */
+ return FALSE; /* skip */
}
- if (xwin->ov_map &&
- xwin->ov_visibility != VisibilityFullyObscured) {
+ if (xwin->ov_map && xwin->ov_visibility != VisibilityFullyObscured) {
xwin->ov_refresh = TRUE;
}
xswa.override_redirect = True;
xswa.backing_store = NotUseful;
xswa.save_under = False;
- tmp = XCreateWindow (xwin->main_display,win, 0, 0,
- attr.width, attr.height, 0,
- CopyFromParent, InputOutput, CopyFromParent,
- (CWSaveUnder | CWBackingStore| CWOverrideRedirect ),
- &xswa);
+ tmp = XCreateWindow (xwin->main_display, win, 0, 0,
+ attr.width, attr.height, 0,
+ CopyFromParent, InputOutput, CopyFromParent,
+ (CWSaveUnder | CWBackingStore | CWOverrideRedirect), &xswa);
XMapWindow (xwin->main_display, tmp);
XUnmapWindow (xwin->main_display, tmp);
XDestroyWindow (xwin->main_display, tmp);
@@ -218,10 +209,9 @@ gst_xwin_refresh (gpointer data)
}
static int
-x11_error_dev_null (Display *display,
- XErrorEvent *event)
+x11_error_dev_null (Display * display, XErrorEvent * event)
{
- return 0;
+ return 0;
}
#define ADD_CLIP(_x, _y, _w, _h) \
@@ -235,7 +225,7 @@ x11_error_dev_null (Display *display,
} while (0);
static void
-gst_xwin_set_clips (GstXWindowListener *xwin)
+gst_xwin_set_clips (GstXWindowListener * xwin)
{
Window root, rroot, parent, *kids, me;
XWindowAttributes attr;
@@ -286,10 +276,9 @@ gst_xwin_set_clips (GstXWindowListener *xwin)
y1 = attr.y - xwin->y;
w1 = attr.width + 2 * attr.border_width;
h1 = attr.height + 2 * attr.border_width;
- if (((x1 + w1) < 0) || (x1 > xwin->w) ||
- ((y1 + h1) < 0) || (y1 > xwin->h))
+ if (((x1 + w1) < 0) || (x1 > xwin->w) || ((y1 + h1) < 0) || (y1 > xwin->h))
continue;
-
+
if (x1 < 0)
x1 = 0;
if (y1 < 0)
@@ -306,7 +295,7 @@ gst_xwin_set_clips (GstXWindowListener *xwin)
static gboolean
-gst_xwin_window (GstXWindowListener *xwin)
+gst_xwin_window (GstXWindowListener * xwin)
{
if (xwin->ov_map && xwin->ov_wmmap &&
xwin->ov_visibility != VisibilityFullyObscured) {
@@ -318,20 +307,17 @@ gst_xwin_window (GstXWindowListener *xwin)
if (xwin->ov_conf) {
xwin->set_window_func (xwin->private_data,
- xwin->x, xwin->y,
- xwin->w, xwin->h,
- xwin->clips, xwin->num_clips);
+ xwin->x, xwin->y, xwin->w, xwin->h, xwin->clips, xwin->num_clips);
if (!xwin->ov_visible)
- gst_xwin_set_overlay (xwin, TRUE);
+ gst_xwin_set_overlay (xwin, TRUE);
g_mutex_lock (xwin->main_lock);
if (xwin->ov_refresh_id)
- g_source_remove (xwin->ov_refresh_id);
+ g_source_remove (xwin->ov_refresh_id);
xwin->ov_refresh_id =
- g_timeout_add (200, (GSourceFunc) gst_xwin_refresh,
- (gpointer) xwin);
+ g_timeout_add (200, (GSourceFunc) gst_xwin_refresh, (gpointer) xwin);
xwin->ov_conf = FALSE;
@@ -345,10 +331,9 @@ gst_xwin_window (GstXWindowListener *xwin)
g_mutex_lock (xwin->main_lock);
if (xwin->ov_refresh_id)
- g_source_remove (xwin->ov_refresh_id);
+ g_source_remove (xwin->ov_refresh_id);
xwin->ov_refresh_id =
- g_timeout_add (200, (GSourceFunc) gst_xwin_refresh,
- (gpointer) xwin);
+ g_timeout_add (200, (GSourceFunc) gst_xwin_refresh, (gpointer) xwin);
xwin->ov_conf = FALSE;
@@ -363,31 +348,28 @@ gst_xwin_window (GstXWindowListener *xwin)
}
static void
-gst_xwin_configure (GstXWindowListener *xwin)
+gst_xwin_configure (GstXWindowListener * xwin)
{
#if 0
/* This part is disabled, because the idle task will be done
* in the main thread instead of here. */
if (!xwin->ov_conf_id)
xwin->ov_conf_id =
- g_idle_add ((GSourceFunc) gst_rec_xoverlay_window,
- (gpointer) xwin);
+ g_idle_add ((GSourceFunc) gst_rec_xoverlay_window, (gpointer) xwin);
#endif
gst_xwin_window ((gpointer) xwin);
}
static void
-gst_xwin_resize (GstXWindowListener *xwin)
+gst_xwin_resize (GstXWindowListener * xwin)
{
Drawable drawable, parent, *kids, root;
guint numkids;
XWindowAttributes attr;
- XGetWindowAttributes (xwin->display,
- xwin->xwindow_id, &attr);
- XMoveResizeWindow (xwin->display, xwin->child,
- 0, 0, attr.width, attr.height);
+ XGetWindowAttributes (xwin->display, xwin->xwindow_id, &attr);
+ XMoveResizeWindow (xwin->display, xwin->child, 0, 0, attr.width, attr.height);
/* set the video window - the first clip is our own window */
xwin->x = 0;
@@ -397,10 +379,9 @@ gst_xwin_resize (GstXWindowListener *xwin)
drawable = xwin->child;
while (1) {
- XQueryTree (xwin->display, drawable,
- &root, &parent, &kids, &numkids);
+ XQueryTree (xwin->display, drawable, &root, &parent, &kids, &numkids);
if (numkids)
- XFree(kids);
+ XFree (kids);
drawable = parent;
XGetWindowAttributes (xwin->display, drawable, &attr);
xwin->x += attr.x;
@@ -416,7 +397,7 @@ gst_xwin_resize (GstXWindowListener *xwin)
}
static void
-gst_xwin_init_window (GstXWindowListener *xwin)
+gst_xwin_init_window (GstXWindowListener * xwin)
{
XWindowAttributes attr;
@@ -438,20 +419,16 @@ gst_xwin_init_window (GstXWindowListener *xwin)
xwin->display = XOpenDisplay (xwin->display_name);
/* window */
- XGetWindowAttributes (xwin->display,
- xwin->xwindow_id, &attr);
+ XGetWindowAttributes (xwin->display, xwin->xwindow_id, &attr);
xwin->child = XCreateSimpleWindow (xwin->display,
- xwin->xwindow_id, 0, 0,
- attr.width, attr.height, 0, 0, 0);
+ xwin->xwindow_id, 0, 0, attr.width, attr.height, 0, 0, 0);
/* listen to certain X events */
- XSelectInput (xwin->display, xwin->xwindow_id,
- StructureNotifyMask);
+ XSelectInput (xwin->display, xwin->xwindow_id, StructureNotifyMask);
XSelectInput (xwin->display, xwin->child,
- VisibilityChangeMask | StructureNotifyMask);
+ VisibilityChangeMask | StructureNotifyMask);
XSelectInput (xwin->display, DefaultRootWindow (xwin->display),
- VisibilityChangeMask | StructureNotifyMask |
- SubstructureNotifyMask);
+ VisibilityChangeMask | StructureNotifyMask | SubstructureNotifyMask);
/* show */
XMapWindow (xwin->display, xwin->child);
@@ -460,7 +437,7 @@ gst_xwin_init_window (GstXWindowListener *xwin)
}
static void
-gst_xwin_exit_window (GstXWindowListener *xwin)
+gst_xwin_exit_window (GstXWindowListener * xwin)
{
/* disable overlay */
gst_xwin_set_overlay (xwin, FALSE);
@@ -496,89 +473,89 @@ gst_xwin_thread (gpointer data)
break;
if ((event.type == ConfigureNotify &&
- event.xconfigure.window == xwin->xwindow_id) ||
- (event.type == MapNotify &&
- event.xmap.window == xwin->xwindow_id) ||
- (event.type == UnmapNotify &&
- event.xunmap.window == xwin->xwindow_id)) {
+ event.xconfigure.window == xwin->xwindow_id) ||
+ (event.type == MapNotify &&
+ event.xmap.window == xwin->xwindow_id) ||
+ (event.type == UnmapNotify &&
+ event.xunmap.window == xwin->xwindow_id)) {
/* the 'parent' window, i.e. the widget provided by client */
switch (event.type) {
- case MapNotify:
- xwin->ov_map = TRUE;
- xwin->ov_conf = TRUE;
- gst_xwin_configure (xwin);
- break;
-
- case UnmapNotify:
- xwin->ov_map = FALSE;
- xwin->ov_conf = TRUE;
- gst_xwin_configure (xwin);
- break;
-
- case ConfigureNotify:
- gst_xwin_resize (xwin);
- break;
-
- default:
- /* nothing */
- break;
+ case MapNotify:
+ xwin->ov_map = TRUE;
+ xwin->ov_conf = TRUE;
+ gst_xwin_configure (xwin);
+ break;
+
+ case UnmapNotify:
+ xwin->ov_map = FALSE;
+ xwin->ov_conf = TRUE;
+ gst_xwin_configure (xwin);
+ break;
+
+ case ConfigureNotify:
+ gst_xwin_resize (xwin);
+ break;
+
+ default:
+ /* nothing */
+ break;
}
} else if (event.xany.window == xwin->child) {
/* our own private window */
switch (event.type) {
- case Expose:
- if (!event.xexpose.count) {
- if (xwin->ov_refresh) {
- xwin->ov_refresh = FALSE;
- } else {
- xwin->ov_conf = TRUE;
- gst_xwin_configure (xwin);
- }
- }
- break;
-
- case VisibilityNotify:
- xwin->ov_visibility = event.xvisibility.state;
- if (xwin->ov_refresh) {
- if (event.xvisibility.state != VisibilityFullyObscured)
- xwin->ov_refresh = FALSE;
- } else {
- xwin->ov_conf = TRUE;
- gst_xwin_configure (xwin);
- }
- break;
-
- default:
- /* nothing */
- break;
+ case Expose:
+ if (!event.xexpose.count) {
+ if (xwin->ov_refresh) {
+ xwin->ov_refresh = FALSE;
+ } else {
+ xwin->ov_conf = TRUE;
+ gst_xwin_configure (xwin);
+ }
+ }
+ break;
+
+ case VisibilityNotify:
+ xwin->ov_visibility = event.xvisibility.state;
+ if (xwin->ov_refresh) {
+ if (event.xvisibility.state != VisibilityFullyObscured)
+ xwin->ov_refresh = FALSE;
+ } else {
+ xwin->ov_conf = TRUE;
+ gst_xwin_configure (xwin);
+ }
+ break;
+
+ default:
+ /* nothing */
+ break;
}
} else {
/* root window */
switch (event.type) {
- case MapNotify:
- case UnmapNotify:
- /* are we still visible? */
- if (!xwin->ov_refresh) {
- XWindowAttributes attr;
- gboolean on;
- XGetWindowAttributes (xwin->display,
- xwin->xwindow_id, &attr);
- on = (attr.map_state == IsViewable);
- xwin->ov_wmmap = on;
- xwin->ov_conf = TRUE;
- gst_xwin_configure (xwin);
- }
- break;
-
- case ConfigureNotify:
- if (!xwin->ov_refresh) {
- gst_xwin_resize (xwin);
- }
- break;
-
- default:
- /* nothing */
- break;
+ case MapNotify:
+ case UnmapNotify:
+ /* are we still visible? */
+ if (!xwin->ov_refresh) {
+ XWindowAttributes attr;
+ gboolean on;
+
+ XGetWindowAttributes (xwin->display, xwin->xwindow_id, &attr);
+ on = (attr.map_state == IsViewable);
+ xwin->ov_wmmap = on;
+ xwin->ov_conf = TRUE;
+ gst_xwin_configure (xwin);
+ }
+ break;
+
+ case ConfigureNotify:
+ if (!xwin->ov_refresh) {
+ gst_xwin_resize (xwin);
+ }
+ break;
+
+ default:
+ /* nothing */
+ break;
}
}
}
@@ -592,7 +569,7 @@ gst_xwin_thread (gpointer data)
}
static void
-gst_xwin_start (GstXWindowListener *xwin)
+gst_xwin_start (GstXWindowListener * xwin)
{
DEBUG ("Starting XWindow listener");
@@ -603,15 +580,13 @@ gst_xwin_start (GstXWindowListener *xwin)
* event handler after we've stopped it */
xwin->main_lock = g_mutex_new ();
xwin->main_display = XOpenDisplay (xwin->display_name);
- xwin->thread = g_thread_create (gst_xwin_thread,
- (gpointer) xwin,
- TRUE, NULL);
+ xwin->thread = g_thread_create (gst_xwin_thread, (gpointer) xwin, TRUE, NULL);
DEBUG ("Started X-overlay");
}
static void
-gst_xwin_stop (GstXWindowListener *xwin)
+gst_xwin_stop (GstXWindowListener * xwin)
{
DEBUG ("Stopping XWindow listener");
@@ -637,19 +612,13 @@ gst_xwin_stop (GstXWindowListener *xwin)
*/
static gboolean
-plugin_init (GstPlugin *plugin)
+plugin_init (GstPlugin * plugin)
{
return TRUE;
}
-GST_PLUGIN_DEFINE (
- GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "xwindowlistener",
- "X11-based XWindow event/motion listener",
- plugin_init,
- VERSION,
- GST_LICENSE,
- GST_PACKAGE,
- GST_ORIGIN
-)
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ "xwindowlistener",
+ "X11-based XWindow event/motion listener",
+ plugin_init, VERSION, GST_LICENSE, GST_PACKAGE, GST_ORIGIN)
diff --git a/gst-libs/gst/xwindowlistener/xwindowlistener.h b/gst-libs/gst/xwindowlistener/xwindowlistener.h
index 834be67c..1d893640 100644
--- a/gst-libs/gst/xwindowlistener/xwindowlistener.h
+++ b/gst-libs/gst/xwindowlistener/xwindowlistener.h
@@ -26,7 +26,6 @@
#include <X11/Xlib.h>
G_BEGIN_DECLS
-
#define GST_TYPE_X_WINDOW_LISTENER \
(gst_x_window_listener_get_type())
#define GST_X_WINDOW_LISTENER(obj) \
@@ -39,28 +38,22 @@ G_BEGIN_DECLS
(G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_X_WINDOW_LISTENER))
#define GST_IS_X_WINDOW_LISTENER_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_X_WINDOW_LISTENER))
-
-typedef struct _GstXWindowListener GstXWindowListener;
-typedef struct _GstXWindowListenerClass GstXWindowListenerClass;
-typedef struct _GstXWindowClip GstXWindowClip;
-typedef void (* MapWindowFunc) (gpointer your_data,
- gboolean visible);
-typedef void (* SetWindowFunc) (gpointer your_data,
- gint x, gint y,
- gint w, gint h,
- GstXWindowClip *clips,
- gint num_clips);
-
-struct _GstXWindowClip {
- gint32 x_offset,
- y_offset,
- width,
- height;
+typedef struct _GstXWindowListener GstXWindowListener;
+typedef struct _GstXWindowListenerClass GstXWindowListenerClass;
+typedef struct _GstXWindowClip GstXWindowClip;
+typedef void (*MapWindowFunc) (gpointer your_data, gboolean visible);
+typedef void (*SetWindowFunc) (gpointer your_data,
+ gint x, gint y, gint w, gint h, GstXWindowClip * clips, gint num_clips);
+
+struct _GstXWindowClip
+{
+ gint32 x_offset, y_offset, width, height;
gpointer data;
};
-struct _GstXWindowListener {
- GObject parent;
+struct _GstXWindowListener
+{
+ GObject parent;
/* "per-instance virtual functions" */
MapWindowFunc map_window_func;
@@ -70,12 +63,12 @@ struct _GstXWindowListener {
gpointer private_data;
/* general information of what we're doing */
- gchar *display_name;
- XID xwindow_id;
+ gchar *display_name;
+ XID xwindow_id;
/* one extra... */
Display *main_display;
- GMutex *main_lock;
+ GMutex *main_lock;
/* oh my g*d, this is going to be so horribly ugly */
GThread *thread;
@@ -84,33 +77,24 @@ struct _GstXWindowListener {
/* the overlay window + own thread */
Display *display;
Drawable child;
- gboolean ov_conf,
- ov_map,
- ov_visible,
- ov_refresh,
- ov_move,
- ov_wmmap;
- gint ov_visibility;
- guint ov_conf_id,
- ov_refresh_id;
- gint x, y, w, h;
+ gboolean ov_conf, ov_map, ov_visible, ov_refresh, ov_move, ov_wmmap;
+ gint ov_visibility;
+ guint ov_conf_id, ov_refresh_id;
+ gint x, y, w, h;
GstXWindowClip *clips;
- gint num_clips;
+ gint num_clips;
};
-struct _GstXWindowListenerClass {
+struct _GstXWindowListenerClass
+{
GObjectClass parent;
};
-GType gst_x_window_listener_get_type (void);
-GstXWindowListener *
- gst_x_window_listener_new (gchar *display,
- MapWindowFunc map_window_func,
- SetWindowFunc set_window_func,
- gpointer private_data);
-void gst_x_window_listener_set_xid (GstXWindowListener *xwin,
- XID id);
+GType gst_x_window_listener_get_type (void);
+GstXWindowListener *gst_x_window_listener_new (gchar * display,
+ MapWindowFunc map_window_func,
+ SetWindowFunc set_window_func, gpointer private_data);
+void gst_x_window_listener_set_xid (GstXWindowListener * xwin, XID id);
G_END_DECLS
-
#endif /* __X_WINDOW_LISTENER_H__ */