funcify macros

Original commit message from CVS:
funcify macros
This commit is contained in:
Thomas Vander Stichele 2004-03-14 21:34:03 +00:00
parent 8ac839e64b
commit 9bcba871ea
4 changed files with 140 additions and 132 deletions

View File

@ -38,9 +38,9 @@ static void create_pipeline (void);
static void
pre_get_func (SineSrc *src)
pre_get_func (SineSrc * src)
{
counter ++;
counter++;
};
static void
create_pipeline (void)
@ -64,7 +64,8 @@ create_pipeline (void)
if (last < NUMBER_OF_INT_TESTS) {
sinesrc->type = SINE_SRC_INT;
sinesrc->sign = ((last % 2) == 0) ? TRUE : FALSE;
sinesrc->endianness = ((last / 2) % 2 == 0) ? G_LITTLE_ENDIAN : G_BIG_ENDIAN;
sinesrc->endianness =
((last / 2) % 2 == 0) ? G_LITTLE_ENDIAN : G_BIG_ENDIAN;
switch ((last / 4) % 8) {
case 0:
sinesrc->depth = 8;
@ -101,7 +102,7 @@ create_pipeline (void)
sinesrc->width = 8;
break;
default:
g_assert_not_reached();
g_assert_not_reached ();
}
g_print ("Setting format to: format: \"int\"\n"
@ -113,6 +114,7 @@ create_pipeline (void)
sinesrc->width, sinesrc->depth);
} else if (last < NUMBER_OF_INT_TESTS + NUMBER_OF_FLOAT_TESTS) {
gint temp = last - NUMBER_OF_INT_TESTS;
sinesrc->type = SINE_SRC_FLOAT;
switch (temp) {
case 0:
@ -125,7 +127,8 @@ create_pipeline (void)
g_assert_not_reached ();
}
g_print ("Setting format to float width %d\n", sinesrc->width);
} else if (last < NUMBER_OF_INT_TESTS + NUMBER_OF_FLOAT_TESTS + NUMBER_OF_LAW_TESTS) {
} else if (last <
NUMBER_OF_INT_TESTS + NUMBER_OF_FLOAT_TESTS + NUMBER_OF_LAW_TESTS) {
gint temp = last - NUMBER_OF_INT_TESTS - NUMBER_OF_FLOAT_TESTS;
GstElement *law;
@ -154,16 +157,16 @@ create_pipeline (void)
}
gst_element_set_state (pipeline, GST_STATE_PLAYING);
}
gint
main (gint argc, gchar *argv[])
main (gint argc, gchar * argv[])
{
gst_init (&argc, &argv);
g_print ("\n"
"This test will test the various formats ALSA and GStreamer support.\n"
"You will hear a short sine tone on your default ALSA soundcard for every\n"
"format tested. They should all sound the same (incl. volume).\n"
"\n");
"format tested. They should all sound the same (incl. volume).\n" "\n");
create_pipeline ();
while (pipeline) {

View File

@ -146,7 +146,7 @@ sinesrc_force_caps (SineSrc *src) {
*/
static guint8 UIDENTITY(guint8 x) { return x; };
static gint8 IDENTITY(gint8 x) { return x; };
#define POPULATE(format, be_func, le_func) {\
#define POPULATE(format, be_func, le_func) G_STMT_START {\
format val = (format) int_value;\
format *p = data;\
switch (src->endianness) {\
@ -164,7 +164,8 @@ static gint8 IDENTITY(gint8 x) { return x; };
p ++;\
}\
data = p;\
}
} G_STMT_END
static GstData *
sinesrc_get (GstPad *pad)
{
@ -193,15 +194,15 @@ sinesrc_get (GstPad *pad)
switch (src->width) {
case 8:
if (src->sign)
POPULATE (gint8, IDENTITY, IDENTITY)
POPULATE (gint8, IDENTITY, IDENTITY);
else
POPULATE (guint8, UIDENTITY, UIDENTITY)
POPULATE (guint8, UIDENTITY, UIDENTITY);
break;
case 16:
if (src->sign)
POPULATE (gint16, GINT16_TO_BE, GINT16_TO_LE)
POPULATE (gint16, GINT16_TO_BE, GINT16_TO_LE);
else
POPULATE (guint16, GUINT16_TO_BE, GUINT16_TO_LE)
POPULATE (guint16, GUINT16_TO_BE, GUINT16_TO_LE);
break;
case 24:
if (src->sign) {
@ -248,9 +249,9 @@ sinesrc_get (GstPad *pad)
break;
case 32:
if (src->sign)
POPULATE (gint32, GINT32_TO_BE, GINT32_TO_LE)
POPULATE (gint32, GINT32_TO_BE, GINT32_TO_LE);
else
POPULATE (guint32, GUINT32_TO_BE, GUINT32_TO_LE)
POPULATE (guint32, GUINT32_TO_BE, GUINT32_TO_LE);
break;
default:
g_assert_not_reached ();

View File

@ -38,9 +38,9 @@ static void create_pipeline (void);
static void
pre_get_func (SineSrc *src)
pre_get_func (SineSrc * src)
{
counter ++;
counter++;
};
static void
create_pipeline (void)
@ -64,7 +64,8 @@ create_pipeline (void)
if (last < NUMBER_OF_INT_TESTS) {
sinesrc->type = SINE_SRC_INT;
sinesrc->sign = ((last % 2) == 0) ? TRUE : FALSE;
sinesrc->endianness = ((last / 2) % 2 == 0) ? G_LITTLE_ENDIAN : G_BIG_ENDIAN;
sinesrc->endianness =
((last / 2) % 2 == 0) ? G_LITTLE_ENDIAN : G_BIG_ENDIAN;
switch ((last / 4) % 8) {
case 0:
sinesrc->depth = 8;
@ -101,7 +102,7 @@ create_pipeline (void)
sinesrc->width = 8;
break;
default:
g_assert_not_reached();
g_assert_not_reached ();
}
g_print ("Setting format to: format: \"int\"\n"
@ -113,6 +114,7 @@ create_pipeline (void)
sinesrc->width, sinesrc->depth);
} else if (last < NUMBER_OF_INT_TESTS + NUMBER_OF_FLOAT_TESTS) {
gint temp = last - NUMBER_OF_INT_TESTS;
sinesrc->type = SINE_SRC_FLOAT;
switch (temp) {
case 0:
@ -125,7 +127,8 @@ create_pipeline (void)
g_assert_not_reached ();
}
g_print ("Setting format to float width %d\n", sinesrc->width);
} else if (last < NUMBER_OF_INT_TESTS + NUMBER_OF_FLOAT_TESTS + NUMBER_OF_LAW_TESTS) {
} else if (last <
NUMBER_OF_INT_TESTS + NUMBER_OF_FLOAT_TESTS + NUMBER_OF_LAW_TESTS) {
gint temp = last - NUMBER_OF_INT_TESTS - NUMBER_OF_FLOAT_TESTS;
GstElement *law;
@ -154,16 +157,16 @@ create_pipeline (void)
}
gst_element_set_state (pipeline, GST_STATE_PLAYING);
}
gint
main (gint argc, gchar *argv[])
main (gint argc, gchar * argv[])
{
gst_init (&argc, &argv);
g_print ("\n"
"This test will test the various formats ALSA and GStreamer support.\n"
"You will hear a short sine tone on your default ALSA soundcard for every\n"
"format tested. They should all sound the same (incl. volume).\n"
"\n");
"format tested. They should all sound the same (incl. volume).\n" "\n");
create_pipeline ();
while (pipeline) {

View File

@ -146,7 +146,7 @@ sinesrc_force_caps (SineSrc *src) {
*/
static guint8 UIDENTITY(guint8 x) { return x; };
static gint8 IDENTITY(gint8 x) { return x; };
#define POPULATE(format, be_func, le_func) {\
#define POPULATE(format, be_func, le_func) G_STMT_START {\
format val = (format) int_value;\
format *p = data;\
switch (src->endianness) {\
@ -164,7 +164,8 @@ static gint8 IDENTITY(gint8 x) { return x; };
p ++;\
}\
data = p;\
}
} G_STMT_END
static GstData *
sinesrc_get (GstPad *pad)
{
@ -193,15 +194,15 @@ sinesrc_get (GstPad *pad)
switch (src->width) {
case 8:
if (src->sign)
POPULATE (gint8, IDENTITY, IDENTITY)
POPULATE (gint8, IDENTITY, IDENTITY);
else
POPULATE (guint8, UIDENTITY, UIDENTITY)
POPULATE (guint8, UIDENTITY, UIDENTITY);
break;
case 16:
if (src->sign)
POPULATE (gint16, GINT16_TO_BE, GINT16_TO_LE)
POPULATE (gint16, GINT16_TO_BE, GINT16_TO_LE);
else
POPULATE (guint16, GUINT16_TO_BE, GUINT16_TO_LE)
POPULATE (guint16, GUINT16_TO_BE, GUINT16_TO_LE);
break;
case 24:
if (src->sign) {
@ -248,9 +249,9 @@ sinesrc_get (GstPad *pad)
break;
case 32:
if (src->sign)
POPULATE (gint32, GINT32_TO_BE, GINT32_TO_LE)
POPULATE (gint32, GINT32_TO_BE, GINT32_TO_LE);
else
POPULATE (guint32, GUINT32_TO_BE, GUINT32_TO_LE)
POPULATE (guint32, GUINT32_TO_BE, GUINT32_TO_LE);
break;
default:
g_assert_not_reached ();