summaryrefslogtreecommitdiffstats
path: root/gst/mpeg2sub
diff options
context:
space:
mode:
authorThomas Vander Stichele <thomas@apestaart.org>2004-03-14 22:34:33 +0000
committerThomas Vander Stichele <thomas@apestaart.org>2004-03-14 22:34:33 +0000
commit7a778ee4b7ec09a1f5b2185c9cceee3910dfbdf2 (patch)
treef863b467dea9559a6ec9c48affbfae11f8104164 /gst/mpeg2sub
parenta19db4bbdc4a15ea0d8f4d28e9a1302c9c3d1657 (diff)
downloadgst-plugins-bad-7a778ee4b7ec09a1f5b2185c9cceee3910dfbdf2.tar.gz
gst-plugins-bad-7a778ee4b7ec09a1f5b2185c9cceee3910dfbdf2.tar.bz2
gst-plugins-bad-7a778ee4b7ec09a1f5b2185c9cceee3910dfbdf2.zip
gst-indent
Original commit message from CVS: gst-indent
Diffstat (limited to 'gst/mpeg2sub')
-rw-r--r--gst/mpeg2sub/gstmpeg2subt.c329
-rw-r--r--gst/mpeg2sub/gstmpeg2subt.h49
2 files changed, 193 insertions, 185 deletions
diff --git a/gst/mpeg2sub/gstmpeg2subt.c b/gst/mpeg2sub/gstmpeg2subt.c
index d267932a..65047297 100644
--- a/gst/mpeg2sub/gstmpeg2subt.c
+++ b/gst/mpeg2sub/gstmpeg2subt.c
@@ -24,17 +24,20 @@
#endif
#include <gstmpeg2subt.h>
-static void gst_mpeg2subt_class_init (GstMpeg2SubtClass *klass);
-static void gst_mpeg2subt_base_init (GstMpeg2SubtClass *klass);
-static void gst_mpeg2subt_init (GstMpeg2Subt *mpeg2subt);
+static void gst_mpeg2subt_class_init (GstMpeg2SubtClass * klass);
+static void gst_mpeg2subt_base_init (GstMpeg2SubtClass * klass);
+static void gst_mpeg2subt_init (GstMpeg2Subt * mpeg2subt);
-static void gst_mpeg2subt_chain_video (GstPad *pad,GstData *_data);
-static void gst_mpeg2subt_chain_subtitle (GstPad *pad,GstData *_data);
+static void gst_mpeg2subt_chain_video (GstPad * pad, GstData * _data);
+static void gst_mpeg2subt_chain_subtitle (GstPad * pad, GstData * _data);
-static void gst_mpeg2subt_merge_title (GstMpeg2Subt *mpeg2subt, GstBuffer *buf);
+static void gst_mpeg2subt_merge_title (GstMpeg2Subt * mpeg2subt,
+ GstBuffer * buf);
-static void gst_mpeg2subt_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
-static void gst_mpeg2subt_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
+static void gst_mpeg2subt_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec);
+static void gst_mpeg2subt_get_property (GObject * object, guint prop_id,
+ GValue * value, GParamSpec * pspec);
/* elementfactory information */
static GstElementDetails mpeg2subt_details = {
@@ -45,12 +48,14 @@ static GstElementDetails mpeg2subt_details = {
};
/* GstMpeg2Subt signals and args */
-enum {
+enum
+{
/* FILL ME */
LAST_SIGNAL
};
-enum {
+enum
+{
ARG_0,
ARG_SKIP,
/* FILL ME */
@@ -79,6 +84,7 @@ static guchar yuv_color[16] = {
static GstElementClass *parent_class = NULL;
+
/*static guint gst_mpeg2subt_signals[LAST_SIGNAL] = { 0 };*/
GType
@@ -88,23 +94,25 @@ gst_mpeg2subt_get_type (void)
if (!mpeg2subt_type) {
static const GTypeInfo mpeg2subt_info = {
- sizeof(GstMpeg2SubtClass),
- (GBaseInitFunc)gst_mpeg2subt_base_init,
+ sizeof (GstMpeg2SubtClass),
+ (GBaseInitFunc) gst_mpeg2subt_base_init,
NULL,
- (GClassInitFunc)gst_mpeg2subt_class_init,
+ (GClassInitFunc) gst_mpeg2subt_class_init,
NULL,
NULL,
- sizeof(GstMpeg2Subt),
+ sizeof (GstMpeg2Subt),
0,
- (GInstanceInitFunc)gst_mpeg2subt_init,
+ (GInstanceInitFunc) gst_mpeg2subt_init,
};
- mpeg2subt_type = g_type_register_static(GST_TYPE_ELEMENT, "GstMpeg2Subt", &mpeg2subt_info, 0);
+ mpeg2subt_type =
+ g_type_register_static (GST_TYPE_ELEMENT, "GstMpeg2Subt",
+ &mpeg2subt_info, 0);
}
return mpeg2subt_type;
}
static void
-gst_mpeg2subt_base_init (GstMpeg2SubtClass *klass)
+gst_mpeg2subt_base_init (GstMpeg2SubtClass * klass)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
@@ -112,19 +120,17 @@ gst_mpeg2subt_base_init (GstMpeg2SubtClass *klass)
}
static void
-gst_mpeg2subt_class_init (GstMpeg2SubtClass *klass)
+gst_mpeg2subt_class_init (GstMpeg2SubtClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
- gobject_class = (GObjectClass*)klass;
- gstelement_class = (GstElementClass*)klass;
+ gobject_class = (GObjectClass *) klass;
+ gstelement_class = (GstElementClass *) klass;
- g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_SKIP,
- g_param_spec_int("skip","skip","skip",
- G_MININT,G_MAXINT,0,G_PARAM_READWRITE)); /* CHECKME */
+ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SKIP, g_param_spec_int ("skip", "skip", "skip", G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); /* CHECKME */
- parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
+ parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
gobject_class->set_property = gst_mpeg2subt_set_property;
gobject_class->get_property = gst_mpeg2subt_get_property;
@@ -132,150 +138,153 @@ gst_mpeg2subt_class_init (GstMpeg2SubtClass *klass)
}
static void
-gst_mpeg2subt_init (GstMpeg2Subt *mpeg2subt)
+gst_mpeg2subt_init (GstMpeg2Subt * mpeg2subt)
{
- mpeg2subt->videopad = gst_pad_new("video",GST_PAD_SINK);
- gst_element_add_pad(GST_ELEMENT(mpeg2subt),mpeg2subt->videopad);
- gst_pad_set_chain_function(mpeg2subt->videopad,gst_mpeg2subt_chain_video);
+ mpeg2subt->videopad = gst_pad_new ("video", GST_PAD_SINK);
+ gst_element_add_pad (GST_ELEMENT (mpeg2subt), mpeg2subt->videopad);
+ gst_pad_set_chain_function (mpeg2subt->videopad, gst_mpeg2subt_chain_video);
- mpeg2subt->subtitlepad = gst_pad_new("subtitle",GST_PAD_SINK);
- gst_element_add_pad(GST_ELEMENT(mpeg2subt),mpeg2subt->subtitlepad);
- gst_pad_set_chain_function(mpeg2subt->subtitlepad,gst_mpeg2subt_chain_subtitle);
+ mpeg2subt->subtitlepad = gst_pad_new ("subtitle", GST_PAD_SINK);
+ gst_element_add_pad (GST_ELEMENT (mpeg2subt), mpeg2subt->subtitlepad);
+ gst_pad_set_chain_function (mpeg2subt->subtitlepad,
+ gst_mpeg2subt_chain_subtitle);
- mpeg2subt->srcpad = gst_pad_new("src",GST_PAD_SRC);
- gst_element_add_pad(GST_ELEMENT(mpeg2subt),mpeg2subt->srcpad);
+ mpeg2subt->srcpad = gst_pad_new ("src", GST_PAD_SRC);
+ gst_element_add_pad (GST_ELEMENT (mpeg2subt), mpeg2subt->srcpad);
mpeg2subt->partialbuf = NULL;
mpeg2subt->have_title = FALSE;
}
static void
-gst_mpeg2subt_chain_video (GstPad *pad, GstData *_data)
+gst_mpeg2subt_chain_video (GstPad * pad, GstData * _data)
{
GstBuffer *buf = GST_BUFFER (_data);
GstMpeg2Subt *mpeg2subt;
guchar *data;
glong size;
- g_return_if_fail(pad != NULL);
- g_return_if_fail(GST_IS_PAD(pad));
- g_return_if_fail(buf != NULL);
+ g_return_if_fail (pad != NULL);
+ g_return_if_fail (GST_IS_PAD (pad));
+ g_return_if_fail (buf != NULL);
mpeg2subt = GST_MPEG2SUBT (GST_OBJECT_PARENT (pad));
- data = GST_BUFFER_DATA(buf);
- size = GST_BUFFER_SIZE(buf);
+ data = GST_BUFFER_DATA (buf);
+ size = GST_BUFFER_SIZE (buf);
if (mpeg2subt->have_title && mpeg2subt->duration != 0) {
- gst_mpeg2subt_merge_title(mpeg2subt, buf);
+ gst_mpeg2subt_merge_title (mpeg2subt, buf);
mpeg2subt->duration--;
}
- gst_pad_push(mpeg2subt->srcpad, GST_DATA (buf));
+ gst_pad_push (mpeg2subt->srcpad, GST_DATA (buf));
}
static void
-gst_mpeg2subt_parse_header (GstMpeg2Subt *mpeg2subt)
+gst_mpeg2subt_parse_header (GstMpeg2Subt * mpeg2subt)
{
- guchar *buffer = GST_BUFFER_DATA(mpeg2subt->partialbuf);
+ guchar *buffer = GST_BUFFER_DATA (mpeg2subt->partialbuf);
guchar dummy;
guint i;
i = mpeg2subt->data_size + 4;
- while (i < mpeg2subt->packet_size)
- {
- dummy = buffer [i];
- switch (dummy)
- {
- case 0x01: /* null packet ? */
- i++;
- break;
- case 0x02: /* 02 ff (ff) is the end of the packet */
- i = mpeg2subt->packet_size;
- break;
- case 0x03: /* palette */
- mpeg2subt->color[0] = yuv_color[buffer [i+1] >> 4];
- mpeg2subt->color[1] = yuv_color[buffer [i+1] & 0xf];
- mpeg2subt->color[2] = yuv_color[buffer [i+2] >> 4];
- mpeg2subt->color[3] = yuv_color[buffer [i+2] & 0xf];
- mpeg2subt->color[4] = yuv_color[0xf];
- GST_DEBUG ("mpeg2subt: colors %d %d %d %d", mpeg2subt->color[0],mpeg2subt->color[1],mpeg2subt->color[2],mpeg2subt->color[3]);
- i += 3;
- break;
- case 0x04: /* transparency palette */
- mpeg2subt->trans[3] = buffer [i+1] >> 4;
- mpeg2subt->trans[2] = buffer [i+1] & 0xf;
- mpeg2subt->trans[1] = buffer [i+2] >> 4;
- mpeg2subt->trans[0] = buffer [i+2] & 0xf;
- GST_DEBUG ("mpeg2subt: transparency %d %d %d %d", mpeg2subt->trans[0],mpeg2subt->trans[1],mpeg2subt->trans[2],mpeg2subt->trans[3]);
+ while (i < mpeg2subt->packet_size) {
+ dummy = buffer[i];
+ switch (dummy) {
+ case 0x01: /* null packet ? */
+ i++;
+ break;
+ case 0x02: /* 02 ff (ff) is the end of the packet */
+ i = mpeg2subt->packet_size;
+ break;
+ case 0x03: /* palette */
+ mpeg2subt->color[0] = yuv_color[buffer[i + 1] >> 4];
+ mpeg2subt->color[1] = yuv_color[buffer[i + 1] & 0xf];
+ mpeg2subt->color[2] = yuv_color[buffer[i + 2] >> 4];
+ mpeg2subt->color[3] = yuv_color[buffer[i + 2] & 0xf];
+ mpeg2subt->color[4] = yuv_color[0xf];
+ GST_DEBUG ("mpeg2subt: colors %d %d %d %d", mpeg2subt->color[0],
+ mpeg2subt->color[1], mpeg2subt->color[2], mpeg2subt->color[3]);
i += 3;
break;
- case 0x05: /* image coordinates */
- mpeg2subt->width = 1 + ( ((buffer[i+2] & 0x0f) << 8) + buffer[i+3] )
- - ( (((unsigned int)buffer[i+1]) << 4) + (buffer[i+2] >> 4) );
- mpeg2subt->height = 1 + ( ((buffer[i+5] & 0x0f) << 8) + buffer[i+6] )
- - ( (((unsigned int)buffer[i+4]) << 4) + (buffer[i+5] >> 4) );
- i += 7;
+ case 0x04: /* transparency palette */
+ mpeg2subt->trans[3] = buffer[i + 1] >> 4;
+ mpeg2subt->trans[2] = buffer[i + 1] & 0xf;
+ mpeg2subt->trans[1] = buffer[i + 2] >> 4;
+ mpeg2subt->trans[0] = buffer[i + 2] & 0xf;
+ GST_DEBUG ("mpeg2subt: transparency %d %d %d %d", mpeg2subt->trans[0],
+ mpeg2subt->trans[1], mpeg2subt->trans[2], mpeg2subt->trans[3]);
+ i += 3;
break;
- case 0x06: /* image 1 / image 2 offsets */
- mpeg2subt->offset[0] = (((unsigned int)buffer[i+1]) << 8) + buffer[i+2];
- mpeg2subt->offset[1] = (((unsigned int)buffer[i+3]) << 8) + buffer[i+4];
+ case 0x05: /* image coordinates */
+ mpeg2subt->width = 1 + (((buffer[i + 2] & 0x0f) << 8) + buffer[i + 3])
+ - ((((unsigned int) buffer[i + 1]) << 4) + (buffer[i + 2] >> 4));
+ mpeg2subt->height = 1 + (((buffer[i + 5] & 0x0f) << 8) + buffer[i + 6])
+ - ((((unsigned int) buffer[i + 4]) << 4) + (buffer[i + 5] >> 4));
+ i += 7;
+ break;
+ case 0x06: /* image 1 / image 2 offsets */
+ mpeg2subt->offset[0] =
+ (((unsigned int) buffer[i + 1]) << 8) + buffer[i + 2];
+ mpeg2subt->offset[1] =
+ (((unsigned int) buffer[i + 3]) << 8) + buffer[i + 4];
i += 5;
break;
- case 0xff: /* "ff xx yy zz uu" with 'zz uu' == start of control packet
- * xx and yy are the end time in 90th/sec
- */
- mpeg2subt->duration = (((buffer[i+1] << 8) + buffer[i+2]) * 25)/90;
+ case 0xff: /* "ff xx yy zz uu" with 'zz uu' == start of control packet
+ * xx and yy are the end time in 90th/sec
+ */
+ mpeg2subt->duration =
+ (((buffer[i + 1] << 8) + buffer[i + 2]) * 25) / 90;
GST_DEBUG ("duration %d", mpeg2subt->duration);
- if ( (buffer[i+3] != buffer[mpeg2subt->data_size+2])
- || (buffer[i+4] != buffer[mpeg2subt->data_size+3]) )
- {
- g_print("mpeg2subt: invalid control header (%.2x%.2x != %.2x%.2x) !\n",
- buffer[i+3], buffer[i+4], buffer[mpeg2subt->data_size+2], buffer[mpeg2subt->data_size+3] );
+ if ((buffer[i + 3] != buffer[mpeg2subt->data_size + 2])
+ || (buffer[i + 4] != buffer[mpeg2subt->data_size + 3])) {
+ g_print
+ ("mpeg2subt: invalid control header (%.2x%.2x != %.2x%.2x) !\n",
+ buffer[i + 3], buffer[i + 4], buffer[mpeg2subt->data_size + 2],
+ buffer[mpeg2subt->data_size + 3]);
/* FIXME */
/* exit(1); */
}
i += 5;
break;
default:
- g_print("mpeg2subt: invalid sequence in control header (%.2x) !\n", dummy);
+ g_print ("mpeg2subt: invalid sequence in control header (%.2x) !\n",
+ dummy);
break;
}
}
}
static int
-get_nibble (guchar *buffer, gint *offset, gint id, gint *aligned)
+get_nibble (guchar * buffer, gint * offset, gint id, gint * aligned)
{
static int next;
- if (*aligned)
- {
+ if (*aligned) {
next = buffer[offset[id]];
offset[id]++;
*aligned = 0;
return next >> 4;
- }
- else
- {
+ } else {
*aligned = 1;
return next & 0xf;
}
}
static void
-gst_mpeg2subt_merge_title (GstMpeg2Subt *mpeg2subt, GstBuffer *buf)
+gst_mpeg2subt_merge_title (GstMpeg2Subt * mpeg2subt, GstBuffer * buf)
{
- gint x=0, y=0;
+ gint x = 0, y = 0;
gint width = mpeg2subt->width;
gint height = mpeg2subt->height;
- guchar *buffer = GST_BUFFER_DATA(mpeg2subt->partialbuf);
- guchar *target = GST_BUFFER_DATA(buf);
- gint id=0, aligned=1;
+ guchar *buffer = GST_BUFFER_DATA (mpeg2subt->partialbuf);
+ guchar *target = GST_BUFFER_DATA (buf);
+ gint id = 0, aligned = 1;
gint offset[2];
offset[0] = mpeg2subt->offset[0];
@@ -284,59 +293,57 @@ gst_mpeg2subt_merge_title (GstMpeg2Subt *mpeg2subt, GstBuffer *buf)
GST_DEBUG ("mpeg2subt: merging subtitle");
- while ((offset[1] < mpeg2subt->data_size + 2) && (y < height))
- {
+ while ((offset[1] < mpeg2subt->data_size + 2) && (y < height)) {
gint code;
gint length, colorid;
- code = get_nibble();
- if (code >= 0x4) /* 4 .. f */
- {
-found_code:
+ code = get_nibble ();
+ if (code >= 0x4) { /* 4 .. f */
+ found_code:
length = code >> 2;
colorid = code & 3;
while (length--)
- if (x++ < width) {
+ if (x++ < width) {
if (mpeg2subt->trans[colorid] != 0x0) {
- *target++ = mpeg2subt->color[colorid];
- }
- else target++;
+ *target++ = mpeg2subt->color[colorid];
+ } else
+ target++;
}
- if (x >= width)
- {
- if (!aligned)
- get_nibble ();
- goto next_line;
+ if (x >= width) {
+ if (!aligned)
+ get_nibble ();
+ goto next_line;
}
continue;
}
- code = (code << 4) + get_nibble();
- if (code >= 0x10) /* 1x .. 3x */
+ code = (code << 4) + get_nibble ();
+ if (code >= 0x10) /* 1x .. 3x */
goto found_code;
- code = (code << 4) + get_nibble();
- if (code >= 0x40) /* 04x .. 0fx */
+ code = (code << 4) + get_nibble ();
+ if (code >= 0x40) /* 04x .. 0fx */
goto found_code;
- code = (code << 4) + get_nibble();
- if (code >= 0x100) /* 01xx .. 03xx */
+ code = (code << 4) + get_nibble ();
+ if (code >= 0x100) /* 01xx .. 03xx */
goto found_code;
/* 00xx - should only happen for 00 00 */
if (!aligned)
- code = (code << 4) + get_nibble(); /* 0 0x xx */
+ code = (code << 4) + get_nibble (); /* 0 0x xx */
- if (code)
- {
- g_print("mpeg2subt: got unknown code 00%x (offset %x side %x, x=%d, y=%d)\n", code, mpeg2subt->offset[id], id, x, y);
+ if (code) {
+ g_print
+ ("mpeg2subt: got unknown code 00%x (offset %x side %x, x=%d, y=%d)\n",
+ code, mpeg2subt->offset[id], id, x, y);
goto next_line;
}
-next_line:
+ next_line:
/* aligned 00 00 */
if (y < height) {
- target+=(width-x);
+ target += (width - x);
x = 0;
y++;
id = 1 - id;
@@ -345,64 +352,67 @@ next_line:
}
static void
-gst_mpeg2subt_chain_subtitle (GstPad *pad, GstData *_data)
+gst_mpeg2subt_chain_subtitle (GstPad * pad, GstData * _data)
{
GstBuffer *buf = GST_BUFFER (_data);
GstMpeg2Subt *mpeg2subt;
guchar *data;
glong size = 0;
- g_return_if_fail(pad != NULL);
- g_return_if_fail(GST_IS_PAD(pad));
- g_return_if_fail(buf != NULL);
+ g_return_if_fail (pad != NULL);
+ g_return_if_fail (GST_IS_PAD (pad));
+ g_return_if_fail (buf != NULL);
/* g_return_if_fail(GST_IS_BUFFER(buf)); */
mpeg2subt = GST_MPEG2SUBT (GST_OBJECT_PARENT (pad));
if (mpeg2subt->have_title) {
- gst_buffer_unref(mpeg2subt->partialbuf);
+ gst_buffer_unref (mpeg2subt->partialbuf);
mpeg2subt->partialbuf = NULL;
mpeg2subt->have_title = FALSE;
}
- GST_DEBUG ("presentation time %" G_GUINT64_FORMAT, GST_BUFFER_TIMESTAMP(buf));
+ GST_DEBUG ("presentation time %" G_GUINT64_FORMAT,
+ GST_BUFFER_TIMESTAMP (buf));
/* deal with partial frame from previous buffer */
if (mpeg2subt->partialbuf) {
GstBuffer *merge;
- merge = gst_buffer_merge(mpeg2subt->partialbuf, buf);
+
+ merge = gst_buffer_merge (mpeg2subt->partialbuf, buf);
gst_buffer_unref (mpeg2subt->partialbuf);
- gst_buffer_unref(buf);
+ gst_buffer_unref (buf);
mpeg2subt->partialbuf = merge;
- }
- else {
+ } else {
mpeg2subt->partialbuf = buf;
}
- data = GST_BUFFER_DATA(mpeg2subt->partialbuf);
- size = GST_BUFFER_SIZE(mpeg2subt->partialbuf);
+ data = GST_BUFFER_DATA (mpeg2subt->partialbuf);
+ size = GST_BUFFER_SIZE (mpeg2subt->partialbuf);
- mpeg2subt->packet_size = GUINT16_FROM_BE(*(guint16 *)data);
+ mpeg2subt->packet_size = GUINT16_FROM_BE (*(guint16 *) data);
if (mpeg2subt->packet_size == size) {
- GST_DEBUG ("mpeg2subt: subtitle packet size %d, current size %ld", mpeg2subt->packet_size, size);
+ GST_DEBUG ("mpeg2subt: subtitle packet size %d, current size %ld",
+ mpeg2subt->packet_size, size);
- mpeg2subt->data_size = GUINT16_FROM_BE(*(guint16 *)(data+2));
+ mpeg2subt->data_size = GUINT16_FROM_BE (*(guint16 *) (data + 2));
- gst_mpeg2subt_parse_header(mpeg2subt);
+ gst_mpeg2subt_parse_header (mpeg2subt);
mpeg2subt->have_title = TRUE;
}
}
static void
-gst_mpeg2subt_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
+gst_mpeg2subt_set_property (GObject * object, guint prop_id,
+ const GValue * value, GParamSpec * pspec)
{
GstMpeg2Subt *src;
/* it's not null if we got it, but it might not be ours */
- g_return_if_fail(GST_IS_MPEG2SUBT(object));
- src = GST_MPEG2SUBT(object);
+ g_return_if_fail (GST_IS_MPEG2SUBT (object));
+ src = GST_MPEG2SUBT (object);
switch (prop_id) {
default:
@@ -411,13 +421,14 @@ gst_mpeg2subt_set_property (GObject *object, guint prop_id, const GValue *value,
}
static void
-gst_mpeg2subt_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+gst_mpeg2subt_get_property (GObject * object, guint prop_id, GValue * value,
+ GParamSpec * pspec)
{
GstMpeg2Subt *src;
/* it's not null if we got it, but it might not be ours */
- g_return_if_fail(GST_IS_MPEG2SUBT(object));
- src = GST_MPEG2SUBT(object);
+ g_return_if_fail (GST_IS_MPEG2SUBT (object));
+ src = GST_MPEG2SUBT (object);
switch (prop_id) {
default:
@@ -426,20 +437,14 @@ gst_mpeg2subt_get_property (GObject *object, guint prop_id, GValue *value, GPara
}
static gboolean
-plugin_init (GstPlugin *plugin)
+plugin_init (GstPlugin * plugin)
{
- return gst_element_register(plugin, "mpeg2subt",
- GST_RANK_NONE, GST_TYPE_MPEG2SUBT);
+ return gst_element_register (plugin, "mpeg2subt",
+ GST_RANK_NONE, GST_TYPE_MPEG2SUBT);
}
-GST_PLUGIN_DEFINE (
- GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "mpeg2sub",
- "MPEG-2 video subtitle parser",
- plugin_init,
- VERSION,
- "LGPL",
- GST_PACKAGE,
- GST_ORIGIN
-)
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ "mpeg2sub",
+ "MPEG-2 video subtitle parser",
+ plugin_init, VERSION, "LGPL", GST_PACKAGE, GST_ORIGIN)
diff --git a/gst/mpeg2sub/gstmpeg2subt.h b/gst/mpeg2sub/gstmpeg2subt.h
index 29f60b27..5cde7058 100644
--- a/gst/mpeg2sub/gstmpeg2subt.h
+++ b/gst/mpeg2sub/gstmpeg2subt.h
@@ -26,8 +26,9 @@
#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
+extern "C"
+{
+#endif /* __cplusplus */
#define GST_TYPE_MPEG2SUBT \
@@ -41,41 +42,43 @@ extern "C" {
#define GST_IS_MPEG2SUBT_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_MPEG2SUBT))
-typedef struct _GstMpeg2Subt GstMpeg2Subt;
-typedef struct _GstMpeg2SubtClass GstMpeg2SubtClass;
+ typedef struct _GstMpeg2Subt GstMpeg2Subt;
+ typedef struct _GstMpeg2SubtClass GstMpeg2SubtClass;
-struct _GstMpeg2Subt {
- GstElement element;
+ struct _GstMpeg2Subt
+ {
+ GstElement element;
- GstPad *videopad,*subtitlepad,*srcpad;
+ GstPad *videopad, *subtitlepad, *srcpad;
- GstBuffer *partialbuf; /* previous buffer (if carryover) */
+ GstBuffer *partialbuf; /* previous buffer (if carryover) */
- gboolean have_title;
+ gboolean have_title;
- guint16 packet_size;
- guint16 data_size;
+ guint16 packet_size;
+ guint16 data_size;
- gint offset[2];
- guchar color[5];
- guchar trans[4];
+ gint offset[2];
+ guchar color[5];
+ guchar trans[4];
- guint duration;
+ guint duration;
- gint width, height;
+ gint width, height;
-};
+ };
-struct _GstMpeg2SubtClass {
- GstElementClass parent_class;
-};
+ struct _GstMpeg2SubtClass
+ {
+ GstElementClass parent_class;
+ };
-GType gst_mpeg2subt_get_type(void);
+ GType gst_mpeg2subt_get_type (void);
#ifdef __cplusplus
}
-#endif /* __cplusplus */
+#endif /* __cplusplus */
-#endif /* __GST_MPEG2SUBT_H__ */
+#endif /* __GST_MPEG2SUBT_H__ */