Commit 20111b55 authored by Sebastian Dröge's avatar Sebastian Dröge 🍵
Browse files

tests/check/elements/: Don't use declarations after statements.

Original commit message from CVS:
* tests/check/elements/cmmldec.c: (GST_START_TEST):
* tests/check/elements/rtp-payloading.c: (rtp_pipeline_create),
(rtp_pipeline_run):
* tests/check/elements/souphttpsrc.c: (souphttpsrc_suite):
Don't use declarations after statements.
parent 173741c1
2008-07-14 Sebastian Dröge <slomo@circular-chaos.org>
* tests/check/elements/cmmldec.c: (GST_START_TEST):
* tests/check/elements/rtp-payloading.c: (rtp_pipeline_create),
(rtp_pipeline_run):
* tests/check/elements/souphttpsrc.c: (souphttpsrc_suite):
Don't use declarations after statements.
2008-07-14 Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
* ext/jpeg/gstjpegdec.c:
......
......@@ -87,12 +87,19 @@ G_STMT_START { \
} G_STMT_END;
static GstElement *cmmldec;
static GstBus *bus;
static GstFlowReturn flow;
GList *buffers;
static GList *current_buf;
static gint64 granulerate;
static guint8 granuleshift;
static GstPad *srcpad, *sinkpad;
static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
......@@ -111,6 +118,7 @@ static GstBuffer *
buffer_new (const gchar * buffer_data, guint size)
{
GstBuffer *buffer;
GstCaps *caps;
buffer = gst_buffer_new_and_alloc (size);
......@@ -205,8 +213,11 @@ static GObject *
cmml_tag_message_pop (GstBus * bus, const gchar * tag)
{
GstMessage *message;
GstTagList *taglist;
const GValue *value;
GObject *obj;
message = gst_bus_poll (bus, GST_MESSAGE_TAG, 0);
......@@ -232,7 +243,9 @@ static void
check_headers ()
{
GObject *head_tag;
gchar *title, *base;
GValueArray *meta;
/* push the ident header */
......@@ -276,7 +289,9 @@ push_clip_full (const gchar * name, const gchar * track, const gchar * template,
GstClockTime prev, GstClockTime start)
{
gchar *clip;
gint64 keyindex, keyoffset, granulepos;
GstFlowReturn res;
if (track == NULL)
......@@ -328,7 +343,9 @@ check_output_clip (const gchar * name, const gchar * track,
GST_START_TEST (test_dec)
{
GstClockTime clip1_start = 1 * GST_SECOND + 234 * GST_MSECOND;
GstClockTime clip2_start = clip1_start;
GstClockTime clip3_start =
((100 * 3600) + (59 * 60) + 59) * GST_SECOND + 678 * GST_MSECOND;
......@@ -374,13 +391,21 @@ GST_END_TEST;
GST_START_TEST (test_tags)
{
GObject *tag;
gboolean empty;
gchar *id, *track;
gint64 start_time, end_time;
gchar *anchor_href, *anchor_text;
gchar *img_src, *img_alt;
gchar *desc;
GValueArray *meta;
GstClockTime clip1_start;
check_headers ();
......@@ -427,19 +452,25 @@ GST_END_TEST;
GST_START_TEST (test_wait_clip_end)
{
GObject *tag;
gchar *id;
GstClockTime end_time = 0;
g_object_set (cmmldec, "wait-clip-end-time", TRUE, NULL);
gchar *id;
check_headers ();
GstClockTime end_time = 0;
GstClockTime clip1_start = 1 * GST_SECOND + 234 * GST_MSECOND;
GstClockTime clip2_start = 2 * GST_SECOND + 234 * GST_MSECOND;
GstClockTime clip3_start = 3 * GST_SECOND + 234 * GST_MSECOND;
GstClockTime clip3_end = 4 * GST_SECOND + 234 * GST_MSECOND;
GstClockTime clip4_start = 5 * GST_SECOND + 234 * GST_MSECOND;
g_object_set (cmmldec, "wait-clip-end-time", TRUE, NULL);
check_headers ();
flow = push_clip ("clip-1", "default", 0, clip1_start);
fail_unless_equals_flow_return (flow, GST_FLOW_OK);
/* no tag has been posted yet */
......@@ -521,8 +552,11 @@ GST_END_TEST;
GST_START_TEST (test_sink_query_convert)
{
guint64 keyindex, keyoffset, granulepos;
GstClockTime index_time, offset_time;
GstFormat dstfmt = GST_FORMAT_TIME;
gint64 dstval;
/* send headers to set the granulerate */
......@@ -550,6 +584,7 @@ Suite *
cmmldec_suite ()
{
Suite *s = suite_create ("cmmldec");
TCase *tc_general = tcase_create ("general");
suite_add_tcase (s, tc_general);
......
......@@ -54,7 +54,9 @@ rtp_bus_callback (GstBus * bus, GstMessage * message, gpointer data)
case GST_MESSAGE_ERROR:
{
GError *err;
gchar *debug;
gchar *element_name;
element_name = (message->src) ? gst_object_get_name (message->src) : NULL;
......@@ -104,13 +106,17 @@ rtp_pipeline_create (const char *frame_data, int frame_data_size,
{
gchar *pipeline_name;
rtp_pipeline *p;
GstCaps *caps;
/* Check parameters. */
if (!frame_data || !pay || !depay) {
return NULL;
}
/* Allocate memory for the RTP pipeline. */
rtp_pipeline *p = (rtp_pipeline *) malloc (sizeof (rtp_pipeline));
p = (rtp_pipeline *) malloc (sizeof (rtp_pipeline));
p->frame_data = frame_data;
p->frame_data_size = frame_data_size;
......@@ -159,7 +165,7 @@ rtp_pipeline_create (const char *frame_data, int frame_data_size,
g_object_set (p->fdsrc, "num-buffers", p->frame_count * LOOP_COUNT, NULL);
/* Set caps filters. */
GstCaps *caps = gst_caps_from_string (filtercaps);
caps = gst_caps_from_string (filtercaps);
g_object_set (p->capsfilter, "caps", caps, NULL);
gst_caps_unref (caps);
......@@ -217,6 +223,10 @@ rtp_pipeline_run (rtp_pipeline * p)
{
GMainLoop *mainloop = NULL;
GstBus *bus;
gint i;
/* Check parameters. */
if (p == NULL) {
return;
......@@ -229,7 +239,7 @@ rtp_pipeline_run (rtp_pipeline * p)
}
/* Add bus callback. */
GstBus *bus = gst_pipeline_get_bus (GST_PIPELINE (p->pipeline));
bus = gst_pipeline_get_bus (GST_PIPELINE (p->pipeline));
gst_bus_add_watch (bus, rtp_bus_callback, (gpointer) mainloop);
gst_object_unref (bus);
......@@ -239,10 +249,9 @@ rtp_pipeline_run (rtp_pipeline * p)
/* TODO: Writing may need some changes... */
int i = 0;
for (; i < LOOP_COUNT; i++) {
for (i = 0; i < LOOP_COUNT; i++) {
const char *frame_data_pointer = p->frame_data;
int frame_count = p->frame_count;
/* Write in to the pipe. */
......@@ -296,7 +305,9 @@ static char rtp_ilbc_frame_data[] =
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
static int rtp_ilbc_frame_data_size = 20;
static int rtp_ilbc_frame_count = 1;
GST_START_TEST (rtp_ilbc)
......@@ -311,7 +322,9 @@ static char rtp_gsm_frame_data[] =
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
static int rtp_gsm_frame_data_size = 20;
static int rtp_gsm_frame_count = 1;
GST_START_TEST (rtp_gsm)
......@@ -327,7 +340,9 @@ static char rtp_amr_frame_data[] =
0x7a, 0x37, 0x16, 0x41, 0x41, 0xc0, 0x00, 0x0d, 0xcd, 0x12, 0xed,
0xad, 0x80, 0x00, 0x00, 0x11, 0x31, 0x00, 0x00, 0x0d, 0xa0
};
static int rtp_amr_frame_data_size = 32;
static int rtp_amr_frame_count = 1;
GST_START_TEST (rtp_amr)
......@@ -342,7 +357,9 @@ static char rtp_pcma_frame_data[] =
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
static int rtp_pcma_frame_data_size = 20;
static int rtp_pcma_frame_count = 1;
GST_START_TEST (rtp_pcma)
......@@ -357,7 +374,9 @@ static char rtp_pcmu_frame_data[] =
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
static int rtp_pcmu_frame_data_size = 20;
static int rtp_pcmu_frame_count = 1;
GST_START_TEST (rtp_pcmu)
......@@ -372,7 +391,9 @@ static char rtp_mpa_frame_data[] =
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
static int rtp_mpa_frame_data_size = 20;
static int rtp_mpa_frame_count = 1;
GST_START_TEST (rtp_mpa)
......@@ -386,7 +407,9 @@ static char rtp_h263_frame_data[] =
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
static int rtp_h263_frame_data_size = 20;
static int rtp_h263_frame_count = 1;
GST_START_TEST (rtp_h263)
......@@ -401,7 +424,9 @@ static char rtp_h263p_frame_data[] =
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
static int rtp_h263p_frame_data_size = 20;
static int rtp_h263p_frame_count = 1;
GST_START_TEST (rtp_h263p)
......@@ -416,7 +441,9 @@ static char rtp_h264_frame_data[] =
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
static int rtp_h264_frame_data_size = 20;
static int rtp_h264_frame_count = 1;
GST_START_TEST (rtp_h264)
......@@ -430,7 +457,9 @@ static char rtp_L16_frame_data[] =
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
static int rtp_L16_frame_data_size = 20;
static int rtp_L16_frame_count = 1;
GST_START_TEST (rtp_L16)
......@@ -446,7 +475,9 @@ static char rtp_mp2t_frame_data[] =
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
static int rtp_mp2t_frame_data_size = 20;
static int rtp_mp2t_frame_count = 1;
GST_START_TEST (rtp_mp2t)
......@@ -461,7 +492,9 @@ static char rtp_mp4v_frame_data[] =
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
static int rtp_mp4v_frame_data_size = 20;
static int rtp_mp4v_frame_count = 1;
GST_START_TEST (rtp_mp4v)
......@@ -476,7 +509,9 @@ static char rtp_mp4g_frame_data[] =
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
static int rtp_mp4g_frame_data_size = 20;
static int rtp_mp4g_frame_count = 1;
GST_START_TEST (rtp_mp4g)
......@@ -492,7 +527,9 @@ static char rtp_theora_frame_data[] =
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
static int rtp_theora_frame_data_size = 20;
static int rtp_theora_frame_count = 1;
GST_START_TEST (rtp_theora)
......@@ -507,7 +544,9 @@ static char rtp_vorbis_frame_data[] =
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
static int rtp_vorbis_frame_data_size = 20;
static int rtp_vorbis_frame_count = 1;
GST_START_TEST (rtp_vorbis)
......@@ -527,6 +566,7 @@ static Suite *
rtp_payloading_suite ()
{
Suite *s = suite_create ("rtp_data_test");
TCase *tc_chain = tcase_create ("linear");
/* Set timeout to 60 seconds. */
......
......@@ -31,7 +31,9 @@
#include <gst/check/gstcheck.h>
static int http_port = 0, https_port = 0;
gboolean redirect = TRUE;
static const char **cookies = NULL;
static int run_server (int *http_port, int *https_port);
......@@ -50,11 +52,17 @@ int
run_test (const char *format, ...)
{
GstStateChangeReturn ret;
GstElement *pipe, *src, *sink;
GstBuffer *buf = NULL;
GstMessage *msg;
gchar *url;
va_list args;
int rc = -1;
pipe = gst_pipeline_new (NULL);
......@@ -97,6 +105,7 @@ run_test (const char *format, ...)
GST_MESSAGE_EOS | GST_MESSAGE_ERROR, -1);
if (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_ERROR) {
gchar *debug = NULL;
GError *err = NULL;
gst_message_parse_error (msg, &err, &debug);
......@@ -222,6 +231,7 @@ got_buffer (GstElement * fakesink, GstBuffer * buf, GstPad * pad,
GST_START_TEST (test_icy_stream)
{
GstElement *pipe, *src, *sink;
GstMessage *msg;
pipe = gst_pipeline_new (NULL);
......@@ -301,12 +311,16 @@ GST_END_TEST;
static Suite *
souphttpsrc_suite (void)
{
Suite *s;
TCase *tc_chain, *tc_internet;
g_type_init ();
g_thread_init (NULL);
Suite *s = suite_create ("souphttpsrc");
TCase *tc_chain = tcase_create ("general");
TCase *tc_internet = tcase_create ("internet");
s = suite_create ("souphttpsrc");
tc_chain = tcase_create ("general");
tc_internet = tcase_create ("internet");
suite_add_tcase (s, tc_chain);
run_server (&http_port, &https_port);
......@@ -331,7 +345,9 @@ static void
do_get (SoupMessage * msg, const char *path)
{
char *uri;
int buflen = 4096;
SoupKnownStatusCode status = SOUP_STATUS_OK;
uri = soup_uri_to_string (soup_message_get_uri (msg), FALSE);
......@@ -413,10 +429,15 @@ int
run_server (int *http_port, int *https_port)
{
SoupServer *server, *ssl_server;
int port = SOUP_ADDRESS_ANY_PORT;
int ssl_port = SOUP_ADDRESS_ANY_PORT;
const char *ssl_cert_file = G_STRINGIFY (CHECKDATA_DIR) "/test-cert.pem";
const char *ssl_key_file = G_STRINGIFY (CHECKDATA_DIR) "/test-key.pem";
static int server_running = 0;
if (server_running)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment