indentation test

Original commit message from CVS:
indentation test
This commit is contained in:
Thomas Vander Stichele 2004-03-14 20:47:18 +00:00
parent bcddae04d6
commit a19db4bbdc
2 changed files with 377 additions and 409 deletions

View file

@ -33,39 +33,33 @@ GstElementDetails gst_divxdec_details = {
"Ronald Bultje <rbultje@ronald.bitfreak.net>"
};
static GstStaticPadTemplate sink_template =
GST_STATIC_PAD_TEMPLATE (
"sink",
static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (
"video/x-divx, "
GST_STATIC_CAPS ("video/x-divx, "
"divxversion = (int) [ 3, 5 ], "
"width = (int) [ 16, 4096 ], "
"height = (int) [ 16, 4096 ], "
"framerate = (double) [ 0, MAX ]"
)
"height = (int) [ 16, 4096 ], " "framerate = (double) [ 0, MAX ]")
);
static GstStaticPadTemplate src_template =
GST_STATIC_PAD_TEMPLATE (
"src",
static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (
GST_VIDEO_CAPS_YUV ("{ I420, YUY2, YV12, UYVY }")
GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("{ I420, YUY2, YV12, UYVY }")
/* FIXME: 15/16/24/32bpp RGB */
)
);
/* DivxDec signals and args */
enum {
enum
{
/* FILL ME */
LAST_SIGNAL
};
enum {
enum
{
ARG_0
/* FILL ME */
};
@ -75,13 +69,13 @@ static void gst_divxdec_base_init (GstDivxDecClass *klass);
static void gst_divxdec_class_init (GstDivxDecClass * klass);
static void gst_divxdec_init (GstDivxDec * divxdec);
static void gst_divxdec_dispose (GObject * object);
static void gst_divxdec_chain (GstPad *pad,
GstData *data);
static void gst_divxdec_chain (GstPad * pad, GstData * data);
static GstPadLinkReturn gst_divxdec_connect (GstPad * pad,
const GstCaps * vscapslist);
static GstPadLinkReturn gst_divxdec_negotiate (GstDivxDec * divxdec);
static GstElementClass *parent_class = NULL;
/* static guint gst_divxdec_signals[LAST_SIGNAL] = { 0 }; */
@ -119,8 +113,7 @@ gst_divxdec_get_type(void)
{
static GType divxdec_type = 0;
if (!divxdec_type)
{
if (!divxdec_type) {
static const GTypeInfo divxdec_info = {
sizeof (GstDivxDecClass),
(GBaseInitFunc) gst_divxdec_base_init,
@ -133,8 +126,7 @@ gst_divxdec_get_type(void)
(GInstanceInitFunc) gst_divxdec_init,
};
divxdec_type = g_type_register_static (GST_TYPE_ELEMENT,
"GstDivxDec",
&divxdec_info, 0);
"GstDivxDec", &divxdec_info, 0);
}
return divxdec_type;
}
@ -169,16 +161,16 @@ static void
gst_divxdec_init (GstDivxDec * divxdec)
{
/* create the sink pad */
divxdec->sinkpad = gst_pad_new_from_template(
gst_static_pad_template_get (&sink_template),
divxdec->sinkpad =
gst_pad_new_from_template (gst_static_pad_template_get (&sink_template),
"sink");
gst_element_add_pad (GST_ELEMENT (divxdec), divxdec->sinkpad);
gst_pad_set_chain_function (divxdec->sinkpad, gst_divxdec_chain);
gst_pad_set_link_function (divxdec->sinkpad, gst_divxdec_connect);
/* create the src pad */
divxdec->srcpad = gst_pad_new_from_template(
gst_static_pad_template_get (&src_template),
divxdec->srcpad =
gst_pad_new_from_template (gst_static_pad_template_get (&src_template),
"src");
gst_element_add_pad (GST_ELEMENT (divxdec), divxdec->srcpad);
gst_pad_use_explicit_caps (divxdec->srcpad);
@ -245,11 +237,9 @@ gst_divxdec_setup (GstDivxDec *divxdec)
output.biBitCount = divxdec->bitcnt;
output.biCompression = divxdec->csp;
if ((ret = decore(divxdec->handle, DEC_OPT_SETOUT,
&output, NULL)) != 0) {
if ((ret = decore (divxdec->handle, DEC_OPT_SETOUT, &output, NULL)) != 0) {
GST_ELEMENT_ERROR (divxdec, LIBRARY, SETTINGS, (NULL),
("error setting output: %s (%d)",
gst_divxdec_error (ret), ret));
("error setting output: %s (%d)", gst_divxdec_error (ret), ret));
gst_divxdec_unset (divxdec);
return FALSE;
}
@ -268,8 +258,7 @@ gst_divxdec_dispose (GObject *object)
static void
gst_divxdec_chain (GstPad *pad,
GstData *_data)
gst_divxdec_chain (GstPad * pad, GstData * _data)
{
GstBuffer *buf = GST_BUFFER (_data);
GstDivxDec *divxdec;
@ -293,12 +282,10 @@ gst_divxdec_chain (GstPad *pad,
}
outbuf = gst_buffer_new_and_alloc (divxdec->width *
divxdec->height *
divxdec->bpp / 8);
divxdec->height * divxdec->bpp / 8);
GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (buf);
GST_BUFFER_SIZE (outbuf) = divxdec->width *
divxdec->height *
divxdec->bpp / 8;
divxdec->height * divxdec->bpp / 8;
/* encode and so ... */
xframe.bitstream = (void *) GST_BUFFER_DATA (buf);
@ -307,11 +294,9 @@ gst_divxdec_chain (GstPad *pad,
xframe.stride = 0;
xframe.render_flag = 1;
if ((ret = decore(divxdec->handle, DEC_OPT_FRAME,
&xframe, NULL))) {
if ((ret = decore (divxdec->handle, DEC_OPT_FRAME, &xframe, NULL))) {
GST_ELEMENT_ERROR (divxdec, STREAM, DECODE, (NULL),
("Error decoding divx frame: %s (%d)",
gst_divxdec_error(ret), ret));
("Error decoding divx frame: %s (%d)", gst_divxdec_error (ret), ret));
gst_buffer_unref (buf);
return;
}
@ -321,76 +306,67 @@ gst_divxdec_chain (GstPad *pad,
}
static GstPadLinkReturn
gst_divxdec_negotiate (GstDivxDec *divxdec)
/* FIXME: moved all the bits out here that are broken so the syntax
* stays clear */
/*
{
GstCaps *caps;
struct {
guint32 fourcc;
gint depth, bpp;
guint32 csp;
gint bitcnt;
} fmt_list[] = {
{ GST_MAKE_FOURCC('Y','U','Y','2'), 16, 16,
GST_MAKE_FOURCC('Y','U','Y','2'), 0 },
{ GST_MAKE_FOURCC('U','Y','V','Y'), 16, 16,
GST_MAKE_FOURCC('U','Y','V','Y'), 0 },
{ GST_MAKE_FOURCC('I','4','2','0'), 12, 12,
GST_MAKE_FOURCC('I','4','2','0'), 0 },
{ GST_MAKE_FOURCC('Y','V','1','2'), 12, 12,
GST_MAKE_FOURCC('Y','V','1','2'), 0 },
#if 0
/* FIXME: someone fix RGB here please */
{ GST_MAKE_FOURCC('R','G','B',' '), 32, 32,
GST_MAKE_FOURCC ('R', 'G', 'B', ' '), 32, 32,
#if (G_BYTE_ORDER == G_BIG_ENDIAN)
GST_MAKE_FOURCC('A','B','G','R'), 32 },
GST_MAKE_FOURCC ('A', 'B', 'G', 'R'), 32}
,
#else
0, 32 },
0, 32}
,
#endif
{ GST_MAKE_FOURCC('R','G','B',' '), 24, 24,
{
GST_MAKE_FOURCC ('R', 'G', 'B', ' '), 24, 24,
#if (G_BYTE_ORDER == G_BIG_ENDIAN)
GST_MAKE_FOURCC('A','B','G','R'), 24 },
GST_MAKE_FOURCC ('A', 'B', 'G', 'R'), 24}
,
#else
0, 24 },
#endif
{ GST_MAKE_FOURCC('R','G','B',' '), 16, 16,
3, 16 },
{ GST_MAKE_FOURCC('R','G','B',' '), 15, 16,
0, 16 },
#endif
{ 0, 0, 0, 0, 0 }
};
gint i;
0, 24}
for (i = 0; fmt_list[i].fourcc != 0; i++) {
divxdec->csp = fmt_list[i].csp;
,
#endif
{
GST_MAKE_FOURCC ('R', 'G', 'B', ' '), 16, 16, 3, 16}
#if 0
/* try making a caps to set on the other side */
, {
GST_MAKE_FOURCC ('R', 'G', 'B', ' '), 15, 16, 0, 16}
,
#endif
if (fmt_list[i].fourcc == GST_MAKE_FOURCC ('R', 'G', 'B', ' ')) {
guint32 r_mask = 0, b_mask = 0, g_mask = 0;
gint endianness = 0;
switch (fmt_list[i].depth) {
case 15:
endianness = G_BYTE_ORDER;
r_mask = 0xf800; g_mask = 0x07c0; b_mask = 0x003e;
r_mask = 0xf800;
g_mask = 0x07c0;
b_mask = 0x003e;
break;
case 16:
endianness = G_BYTE_ORDER;
r_mask = 0xf800; g_mask = 0x07e0; b_mask = 0x001f;
r_mask = 0xf800;
g_mask = 0x07e0;
b_mask = 0x001f;
break;
case 24:
endianness = G_BIG_ENDIAN;
r_mask = GST_VIDEO_BYTE1_MASK_24_INT;
g_mask = GST_VIDEO_BYTE2_MASK_24_INT;
b_mask = GST_VIDEO_BYTE3_MASK_24_INT
break;
b_mask = GST_VIDEO_BYTE3_MASK_24_INT break;
case 32:
endianness = G_BIG_ENDIAN;
r_mask = GST_VIDEO_BYTE1_MASK_32_INT;
g_mask = GST_VIDEO_BYTE2_MASK_32_INT;
b_mask = GST_VIDEO_BYTE3_MASK_32_INT
break;
b_mask = GST_VIDEO_BYTE3_MASK_32_INT break;
}
caps = GST_CAPS_NEW ("divxdec_src_pad_rgb",
"video/x-raw-rgb",
@ -405,13 +381,42 @@ gst_divxdec_negotiate (GstDivxDec *divxdec)
"blue_mask", GST_PROPS_INT (b_mask));
} else {
#endif
#endif
*/
static GstPadLinkReturn
gst_divxdec_negotiate (GstDivxDec * divxdec)
{
GstCaps *caps;
struct
{
guint32 fourcc;
gint depth, bpp;
guint32 csp;
gint bitcnt;
} fmt_list[] = {
{
GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'), 16, 16,
GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'), 0}, {
GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'), 16, 16,
GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'), 0}, {
GST_MAKE_FOURCC ('I', '4', '2', '0'), 12, 12,
GST_MAKE_FOURCC ('I', '4', '2', '0'), 0}, {
GST_MAKE_FOURCC ('Y', 'V', '1', '2'), 12, 12,
GST_MAKE_FOURCC ('Y', 'V', '1', '2'), 0}, {
0, 0, 0, 0, 0}
};
gint i;
for (i = 0; fmt_list[i].fourcc != 0; i++) {
divxdec->csp = fmt_list[i].csp;
caps = gst_caps_new_simple ("video/x-raw-yuv",
"width", G_TYPE_INT, divxdec->width,
"height", G_TYPE_INT, divxdec->height,
"framerate", G_TYPE_DOUBLE, divxdec->fps,
"format", GST_TYPE_FOURCC, fmt_list[i].fourcc,
NULL);
/*}*/
"format", GST_TYPE_FOURCC, fmt_list[i].fourcc, NULL);
if (gst_divxdec_setup (divxdec) &&
gst_pad_set_explicit_caps (divxdec->srcpad, caps)) {
@ -428,8 +433,7 @@ gst_divxdec_negotiate (GstDivxDec *divxdec)
static GstPadLinkReturn
gst_divxdec_connect (GstPad *pad,
const GstCaps *caps)
gst_divxdec_connect (GstPad * pad, const GstCaps * caps)
{
GstDivxDec *divxdec;
GstStructure *structure = gst_caps_get_structure (caps, 0);
@ -475,14 +479,9 @@ plugin_init (GstPlugin *plugin)
}
GST_PLUGIN_DEFINE (
GST_VERSION_MAJOR,
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
GST_VERSION_MINOR,
"divxdec",
"DivX decoder",
plugin_init,
"5.03",
GST_LICENSE_UNKNOWN,
"divx4linux",
"http://www.divx.com/"
)
"5.03", GST_LICENSE_UNKNOWN, "divx4linux", "http://www.divx.com/");

View file

@ -34,39 +34,33 @@ GstElementDetails gst_divxenc_details = {
"Ronald Bultje <rbultje@ronald.bitfreak.net>"
};
static GstStaticPadTemplate sink_template =
GST_STATIC_PAD_TEMPLATE (
"sink",
static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (
GST_VIDEO_CAPS_YUV ("{ I420, YUY2, YV12, YVYU, UYVY }")
GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("{ I420, YUY2, YV12, YVYU, UYVY }")
/* FIXME: 15/16/24/32bpp RGB */
)
);
static GstStaticPadTemplate src_template =
GST_STATIC_PAD_TEMPLATE (
"src",
static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (
"video/x-divx, "
GST_STATIC_CAPS ("video/x-divx, "
"divxversion = (int) 5, "
"width = (int) [ 16, 4096 ], "
"height = (int) [ 16, 4096 ], "
"framerate = (double) [ 0, MAX ]"
)
"height = (int) [ 16, 4096 ], " "framerate = (double) [ 0, MAX ]")
);
/* DivxEnc signals and args */
enum {
enum
{
FRAME_ENCODED,
LAST_SIGNAL
};
enum {
enum
{
ARG_0,
ARG_BITRATE,
ARG_MAXKEYINTERVAL,
@ -79,20 +73,15 @@ static void gst_divxenc_class_init (GstDivxEncClass *klass);
static void gst_divxenc_base_init (GstDivxEncClass * klass);
static void gst_divxenc_init (GstDivxEnc * divxenc);
static void gst_divxenc_dispose (GObject * object);
static void gst_divxenc_chain (GstPad *pad,
GstData *data);
static void gst_divxenc_chain (GstPad * pad, GstData * data);
static GstPadLinkReturn gst_divxenc_connect (GstPad * pad,
const GstCaps * vscapslist);
/* properties */
static void gst_divxenc_set_property (GObject * object,
guint prop_id,
const GValue *value,
GParamSpec *pspec);
guint prop_id, const GValue * value, GParamSpec * pspec);
static void gst_divxenc_get_property (GObject * object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
guint prop_id, GValue * value, GParamSpec * pspec);
static GstElementClass *parent_class = NULL;
static guint gst_divxenc_signals[LAST_SIGNAL] = { 0 };
@ -136,8 +125,7 @@ gst_divxenc_get_type(void)
{
static GType divxenc_type = 0;
if (!divxenc_type)
{
if (!divxenc_type) {
static const GTypeInfo divxenc_info = {
sizeof (GstDivxEncClass),
(GBaseInitFunc) gst_divxenc_base_init,
@ -150,8 +138,7 @@ gst_divxenc_get_type(void)
(GInstanceInitFunc) gst_divxenc_init,
};
divxenc_type = g_type_register_static (GST_TYPE_ELEMENT,
"GstDivxEnc",
&divxenc_info, 0);
"GstDivxEnc", &divxenc_info, 0);
}
return divxenc_type;
}
@ -184,8 +171,7 @@ gst_divxenc_class_init (GstDivxEncClass *klass)
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BITRATE,
g_param_spec_ulong ("bitrate", "Bitrate",
"Target video bitrate",
0,G_MAXULONG,0,G_PARAM_READWRITE));
"Target video bitrate", 0, G_MAXULONG, 0, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MAXKEYINTERVAL,
g_param_spec_int ("max_key_interval", "Max. Key Interval",
@ -194,13 +180,11 @@ gst_divxenc_class_init (GstDivxEncClass *klass)
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BUFSIZE,
g_param_spec_ulong ("buffer_size", "Buffer Size",
"Size of the video buffers",
0,G_MAXULONG,0,G_PARAM_READABLE));
"Size of the video buffers", 0, G_MAXULONG, 0, G_PARAM_READABLE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_QUALITY,
g_param_spec_int ("quality", "Quality",
"Amount of Motion Estimation",
1,5,3,G_PARAM_READWRITE));
"Amount of Motion Estimation", 1, 5, 3, G_PARAM_READWRITE));
gobject_class->set_property = gst_divxenc_set_property;
gobject_class->get_property = gst_divxenc_get_property;
@ -211,8 +195,7 @@ gst_divxenc_class_init (GstDivxEncClass *klass)
g_signal_new ("frame-encoded", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstDivxEncClass, frame_encoded),
NULL, NULL,
g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}
@ -220,8 +203,8 @@ static void
gst_divxenc_init (GstDivxEnc * divxenc)
{
/* create the sink pad */
divxenc->sinkpad = gst_pad_new_from_template(
gst_static_pad_template_get (&sink_template),
divxenc->sinkpad =
gst_pad_new_from_template (gst_static_pad_template_get (&sink_template),
"sink");
gst_element_add_pad (GST_ELEMENT (divxenc), divxenc->sinkpad);
@ -229,8 +212,8 @@ gst_divxenc_init (GstDivxEnc *divxenc)
gst_pad_set_link_function (divxenc->sinkpad, gst_divxenc_connect);
/* create the src pad */
divxenc->srcpad = gst_pad_new_from_template(
gst_static_pad_template_get (&src_template),
divxenc->srcpad =
gst_pad_new_from_template (gst_static_pad_template_get (&src_template),
"src");
gst_pad_use_explicit_caps (divxenc->srcpad);
gst_element_add_pad (GST_ELEMENT (divxenc), divxenc->srcpad);
@ -330,8 +313,7 @@ gst_divxenc_dispose (GObject *object)
static void
gst_divxenc_chain (GstPad *pad,
GstData *_data)
gst_divxenc_chain (GstPad * pad, GstData * _data)
{
GstBuffer *buf = GST_BUFFER (_data);
GstDivxEnc *divxenc;
@ -355,11 +337,9 @@ gst_divxenc_chain (GstPad *pad,
xframe.length = GST_BUFFER_MAXSIZE (outbuf);
xframe.produce_empty_frame = 0;
if ((ret = encore(divxenc->handle, ENC_OPT_ENCODE,
&xframe, &xres))) {
if ((ret = encore (divxenc->handle, ENC_OPT_ENCODE, &xframe, &xres))) {
GST_ELEMENT_ERROR (divxenc, LIBRARY, ENCODE, (NULL),
("Error encoding divx frame: %s (%d)",
gst_divxenc_error(ret), ret));
("Error encoding divx frame: %s (%d)", gst_divxenc_error (ret), ret));
gst_buffer_unref (buf);
return;
}
@ -378,10 +358,24 @@ gst_divxenc_chain (GstPad *pad,
gst_buffer_unref (buf);
}
/* FIXME: moving broken bits here for others to fix */
/* someone fix RGB please */
/*
case GST_MAKE_FOURCC ('R', 'G', 'B', ' '):
gst_caps_get_int (caps, "depth", &d);
switch (d) {
case 24:
divx_cs = 0;
bitcnt = 24;
break;
case 32:
divx_cs = 0;
bitcnt = 32;
break;
*/
static GstPadLinkReturn
gst_divxenc_connect (GstPad *pad,
const GstCaps *caps)
gst_divxenc_connect (GstPad * pad, const GstCaps * caps)
{
GstDivxEnc *divxenc;
GstStructure *structure = gst_caps_get_structure (caps, 0);
@ -417,20 +411,6 @@ gst_divxenc_connect (GstPad *pad,
case GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'):
divx_cs = GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y');
break;
#if 0
/* someone fix RGB please */
case GST_MAKE_FOURCC('R','G','B',' '):
gst_caps_get_int(caps, "depth", &d);
switch (d) {
case 24:
divx_cs = 0;
bitcnt = 24;
break;
case 32:
divx_cs = 0;
bitcnt = 32;
break;
#endif
default:
return GST_PAD_LINK_REFUSED;
}
@ -449,9 +429,7 @@ gst_divxenc_connect (GstPad *pad,
new_caps = gst_caps_new_simple ("video/x-divx",
"divxversion", G_TYPE_INT, 5,
"width", G_TYPE_INT, w,
"height", G_TYPE_INT, h,
"framerate", G_TYPE_DOUBLE, fps,
NULL);
"height", G_TYPE_INT, h, "framerate", G_TYPE_DOUBLE, fps, NULL);
ret = gst_pad_set_explicit_caps (divxenc->srcpad, new_caps);
if (ret <= 0) {
@ -468,9 +446,7 @@ gst_divxenc_connect (GstPad *pad,
static void
gst_divxenc_set_property (GObject * object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
guint prop_id, const GValue * value, GParamSpec * pspec)
{
GstDivxEnc *divxenc;
@ -497,9 +473,7 @@ gst_divxenc_set_property (GObject *object,
static void
gst_divxenc_get_property (GObject * object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
guint prop_id, GValue * value, GParamSpec * pspec)
{
GstDivxEnc *divxenc;
@ -546,14 +520,9 @@ plugin_init (GstPlugin *plugin)
}
GST_PLUGIN_DEFINE (
GST_VERSION_MAJOR,
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
GST_VERSION_MINOR,
"divxenc",
"DivX encoder",
plugin_init,
"5.03",
GST_LICENSE_UNKNOWN,
"divx4linux",
"http://www.divx.com/"
)
"5.03", GST_LICENSE_UNKNOWN, "divx4linux", "http://www.divx.com/");