From 6a096813d4e931610fbebb21e782c35eb53071c1 Mon Sep 17 00:00:00 2001 From: David Schleef Date: Thu, 29 Jan 2004 01:20:23 +0000 Subject: [PATCH] configure.ac: Add detection for HAVE_PRINTF_EXTENSION and Original commit message from CVS: * configure.ac: Add detection for HAVE_PRINTF_EXTENSION and GST_PRINTF_EXTENSION_FORMAT_DEFINE. * docs/random/ds/0.9-suggested-changes: Notes from Company. * gst/gstcaps.c: (gst_caps_to_string): Add comment. * gst/gstconfig.h.in: Add define for GST_PTR_FORMAT * gst/gstinfo.c: (_gst_debug_init), (gst_debug_print_object), (gst_debug_log_default), (_gst_info_printf_extension), (_gst_info_printf_extension_arginfo): Add printf extension. * gst/gstinfo.h: remove G_GNUC_PRINTF, because it doesn't work with %P * gst/gststructure.c: (gst_structure_to_string), (_gst_structure_parse_value): Use gst_value_deserialize() and remove old code. * gst/gstvalue.c: (gst_value_deserialize_fourcc), (gst_value_deserialize_boolean), (gst_strtoi), (gst_value_deserialize_int), (gst_value_deserialize_double), (gst_value_deserialize_string), (gst_value_deserialize): Implement a bunch of deserialize functions and gst_value_deserialize. * gst/gstvalue.h: er, _de_serialize, not unserialize * testsuite/caps/string-conversions.c: (main): We don't currently handle (float) in caps, so convert these to (double). * testsuite/debug/Makefile.am: Add new test for the printf extension * testsuite/debug/printf_extension.c: (main): same --- ChangeLog | 25 +++++ common | 2 +- configure.ac | 11 ++ docs/random/ds/0.9-suggested-changes | 22 ++++ gst/gstcaps.c | 6 ++ gst/gstconfig.h.in | 2 + gst/gstinfo.c | 106 +++++++++++++++++-- gst/gstinfo.h | 4 +- gst/gststructure.c | 146 ++------------------------ gst/gstvalue.c | 121 +++++++++++++++++++-- gst/gstvalue.h | 2 +- tests/old/testsuite/caps/string-conversions.c | 4 +- tests/old/testsuite/debug/Makefile.am | 2 +- tests/old/testsuite/debug/printf_extension.c | 41 ++++++++ testsuite/caps/string-conversions.c | 4 +- testsuite/debug/Makefile.am | 2 +- testsuite/debug/printf_extension.c | 41 ++++++++ 17 files changed, 372 insertions(+), 169 deletions(-) create mode 100644 tests/old/testsuite/debug/printf_extension.c create mode 100644 testsuite/debug/printf_extension.c diff --git a/ChangeLog b/ChangeLog index f8b3c86..876e54f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,28 @@ +2004-01-28 David Schleef + + * configure.ac: Add detection for HAVE_PRINTF_EXTENSION and + GST_PRINTF_EXTENSION_FORMAT_DEFINE. + * docs/random/ds/0.9-suggested-changes: Notes from Company. + * gst/gstcaps.c: (gst_caps_to_string): Add comment. + * gst/gstconfig.h.in: Add define for GST_PTR_FORMAT + * gst/gstinfo.c: (_gst_debug_init), (gst_debug_print_object), + (gst_debug_log_default), (_gst_info_printf_extension), + (_gst_info_printf_extension_arginfo): Add printf extension. + * gst/gstinfo.h: remove G_GNUC_PRINTF, because it doesn't work with %P + * gst/gststructure.c: (gst_structure_to_string), + (_gst_structure_parse_value): Use gst_value_deserialize() and + remove old code. + * gst/gstvalue.c: (gst_value_deserialize_fourcc), + (gst_value_deserialize_boolean), (gst_strtoi), + (gst_value_deserialize_int), (gst_value_deserialize_double), + (gst_value_deserialize_string), (gst_value_deserialize): Implement + a bunch of deserialize functions and gst_value_deserialize. + * gst/gstvalue.h: er, _de_serialize, not unserialize + * testsuite/caps/string-conversions.c: (main): We don't currently + handle (float) in caps, so convert these to (double). + * testsuite/debug/Makefile.am: Add new test for the printf extension + * testsuite/debug/printf_extension.c: (main): same + 2004-01-28 Benjamin Otte * docs/random/company/time: diff --git a/common b/common index 0bcde34..5da247b 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 0bcde342015b96d9a6ba3b9d9102e2a543399d96 +Subproject commit 5da247bb6f217c5c32e5ebab0d3a2014dfa452c3 diff --git a/configure.ac b/configure.ac index d5be793..4aa8c53 100644 --- a/configure.ac +++ b/configure.ac @@ -454,6 +454,17 @@ AC_CHECK_FUNC(sigaction, AC_DEFINE(HAVE_SIGACTION, 1, [Defined if we have sigaction ()])) +dnl test for register_printf_function +AC_CHECK_FUNC(register_printf_function, + [ + GST_PRINTF_EXTENSION_FORMAT_DEFINE="#define GST_PTR_FORMAT \"P\"" + AC_DEFINE(HAVE_PRINTF_EXTENSION, 1, + [Defined if we have register_printf_function ()]) + ], + GST_PRINTF_EXTENSION_FORMAT_DEFINE="#define GST_PTR_FORMAT \"p\"" +) +AC_SUBST(GST_PRINTF_EXTENSION_FORMAT_DEFINE) + dnl test if we have dladdr(); we use it for debugging save_cflags="$CFLAGS" CFLAGS="$CFLAGS -D_GNU_SOURCE" diff --git a/docs/random/ds/0.9-suggested-changes b/docs/random/ds/0.9-suggested-changes index dbba051..283669e 100644 --- a/docs/random/ds/0.9-suggested-changes +++ b/docs/random/ds/0.9-suggested-changes @@ -6,5 +6,27 @@ API: +caps: + + (Company:) + + "An idea I had once was to force registration of mimetypes and then + only allow caps with a registered mimetype - like it's done now with caps. + You could then add functions to those registrations like + - gchar *get_human_readable_string (caps); + should be kinda selfexplanatory. Would return stuff like "16bit signed + integer audio", "MPEG2 video" or "video format in RGB colorspace" (for + unfixed RGB) + - GstCaps *default_fixate (const GstCaps *caps); + A default fixation function, so we don't fixate to minimum integer + anymore but have the ability to fixate to 320x240 for video or 44100 for + audio rates + - gboolean validate (const GstCaps *caps); + check if the given caps are ok for this mimetype - debugging only function + I'd _really_ like to have - especially during gst_register. + + But that's 0.10 material." + + diff --git a/gst/gstcaps.c b/gst/gstcaps.c index 2fdef57..681b0d7 100644 --- a/gst/gstcaps.c +++ b/gst/gstcaps.c @@ -1023,6 +1023,12 @@ gchar *gst_caps_to_string (const GstCaps *caps) GstStructure *structure; GString *s; + /* NOTE: This function is potentially called by the debug system, + * so any calls to gst_log() (and GST_DEBUG(), GST_LOG(), etc.) + * should be careful to avoid recursion. This includes any functions + * called by gst_caps_to_string. In particular, calls should + * not use the GST_PTR_FORMAT extension. */ + /* FIXME does this leak? */ if (caps == NULL) { diff --git a/gst/gstconfig.h.in b/gst/gstconfig.h.in index 9898435..78046d4 100644 --- a/gst/gstconfig.h.in +++ b/gst/gstconfig.h.in @@ -53,6 +53,8 @@ /* DOES NOT WORK */ @GST_DISABLE_URI_DEFINE@ +/* printf extension format */ +@GST_PRINTF_EXTENSION_FORMAT_DEFINE@ /***** Deal with XML stuff, we have to handle both loadsave and registry *****/ diff --git a/gst/gstinfo.c b/gst/gstinfo.c index 210ff94..3655095 100644 --- a/gst/gstinfo.c +++ b/gst/gstinfo.c @@ -30,6 +30,9 @@ #ifdef HAVE_DLFCN_H #include #endif +#ifdef HAVE_PRINTF_EXTENSION +#include +#endif #include #include /* G_VA_COPY */ #include "gstinfo.h" @@ -72,6 +75,13 @@ static void gst_debug_reset_threshold (gpointer category, gpointer unused); static void gst_debug_reset_all_thresholds (void); +#ifdef HAVE_PRINTF_EXTENSION +static int _gst_info_printf_extension (FILE *stream, const struct printf_info *info, + const void *const *args); +static int _gst_info_printf_extension_arginfo (const struct printf_info *info, size_t n, + int *argtypes); +#endif + struct _GstDebugMessage { gchar * message; const gchar * format; @@ -146,6 +156,11 @@ void _gst_debug_init (void) gst_atomic_int_init (&__default_level, GST_LEVEL_DEFAULT); gst_atomic_int_init (&__use_color, 1); +#ifdef HAVE_PRINTF_EXTENSION + register_printf_function (GST_PTR_FORMAT[0], _gst_info_printf_extension, + _gst_info_printf_extension_arginfo); +#endif + /* do NOT use a single debug function before this line has been run */ GST_CAT_DEFAULT = _gst_debug_category_new ("default", GST_DEBUG_UNDERLINE, @@ -328,6 +343,53 @@ gst_debug_message_get (GstDebugMessage *message) return message->message; } + +static gchar * +gst_debug_print_object (gpointer ptr) +{ + GObject *object = (GObject *)ptr; + +#ifdef unused + /* This is a cute trick to detect unmapped memory, but is unportable, + * slow, screws around with madvise, and not actually that useful. */ + { + int ret; + + ret = madvise ((void *)((unsigned long)ptr & (~0xfff)), 4096, 0); + if (ret == -1 && errno == ENOMEM) { + buffer = g_strdup_printf ("%p (unmapped memory)", ptr); + } + } +#endif + + /* nicely printed object */ + if (object == NULL) { + return g_strdup ("NULL"); + } + if (*(GType *)ptr == GST_TYPE_CAPS) { + return gst_caps_to_string ((GstCaps *)ptr); + } + if (*(GType *)ptr == GST_TYPE_STRUCTURE) { + return gst_structure_to_string ((GstStructure *)ptr); + } +#ifdef USE_POISONING + if (*(int *)ptr == 0xffffffff) { + return g_strdup_printf ("", ptr); + } +#endif + if (GST_IS_PAD (object) && GST_OBJECT_NAME (object)) { + return g_strdup_printf ("<%s:%s>", GST_DEBUG_PAD_NAME (object)); + } + if (GST_IS_OBJECT (object) && GST_OBJECT_NAME (object)) { + return g_strdup_printf ("<%s>", GST_OBJECT_NAME (object)); + } + if (G_IS_OBJECT (object)) { + return g_strdup_printf ("<%s@%p>", G_OBJECT_TYPE_NAME(object), object); + } + + return g_strdup_printf ("%p", ptr); +} + /** * gst_debug_construct_term_color: * @colorinfo: the color info @@ -408,18 +470,10 @@ gst_debug_log_default (GstDebugCategory *category, GstDebugLevel level, clear = ""; pidcolor = g_strdup (""); } - /* nicely printed object */ - if (object == NULL) { - obj = g_strdup (""); - } else if (GST_IS_PAD (object) && GST_OBJECT_NAME (object)) { - obj = g_strdup_printf (" [%s:%s]", GST_DEBUG_PAD_NAME (object)); - } else if (GST_IS_OBJECT (object) && GST_OBJECT_NAME (object)) { - obj = g_strdup_printf (" [%s]", GST_OBJECT_NAME (object)); - } else { - obj = g_strdup_printf (" [%s@%p]", G_OBJECT_TYPE_NAME(object), object); - } - g_printerr ("%s %s%15s%s(%s%5d%s) %s%s(%d):%s:%s%s %s\n", + obj = gst_debug_print_object (object); + + g_printerr ("%s %s%15s%s(%s%5d%s) %s%s(%d):%s: %s%s %s\n", gst_debug_level_get_name (level), color, gst_debug_category_get_name (category), clear, pidcolor, pid, clear, @@ -949,6 +1003,36 @@ _gst_debug_register_funcptr (void *ptr, gchar *ptrname) return ptr; } +#ifdef HAVE_PRINTF_EXTENSION +static int +_gst_info_printf_extension (FILE *stream, const struct printf_info *info, + const void *const *args) +{ + char *buffer; + int len; + void *ptr; + + buffer = NULL; + ptr = *(void **)args[0]; + + buffer = gst_debug_print_object (ptr); + len = fprintf (stream, "%*s", (info->left ? -info->width : info->width), + buffer); + + free (buffer); + return len; +} + +static int +_gst_info_printf_extension_arginfo (const struct printf_info *info, size_t n, + int *argtypes) +{ + if (n > 0) + argtypes[0] = PA_POINTER; + return 1; +} +#endif /* HAVE_PRINTF_EXTENSION */ + #endif /* GST_DISABLE_GST_DEBUG */ #ifdef GST_ENABLE_FUNC_INSTRUMENTATION diff --git a/gst/gstinfo.h b/gst/gstinfo.h index cbe5c82..ab8c2b4 100644 --- a/gst/gstinfo.h +++ b/gst/gstinfo.h @@ -155,6 +155,8 @@ typedef void (*GstLogFunction) (GstDebugCategory * category, void _gst_debug_init (void); +/* note we can't use G_GNUC_PRINTF (7, 8) because gcc chokes on %P, which + * we use for GST_PTR_FORMAT. */ void gst_debug_log (GstDebugCategory * category, GstDebugLevel level, const gchar * file, @@ -162,7 +164,7 @@ void gst_debug_log (GstDebugCategory * category, gint line, GObject * object, const gchar * format, - ...) G_GNUC_PRINTF (7, 8) G_GNUC_NO_INSTRUMENT; + ...) G_GNUC_NO_INSTRUMENT; void gst_debug_log_valist (GstDebugCategory * category, GstDebugLevel level, const gchar * file, diff --git a/gst/gststructure.c b/gst/gststructure.c index 8a48084..9a629f7 100644 --- a/gst/gststructure.c +++ b/gst/gststructure.c @@ -552,13 +552,6 @@ gst_structure_id_get_value(const GstStructure *structure, GQuark id) return &field->value; } -#if 0 -void gst_structure_get(GstStructure *structure, const gchar *fieldname, ...) -{ - -} -#endif - /** * gst_structure_remove_field: * @structure: a #GstStructure @@ -969,6 +962,12 @@ gst_structure_to_string(const GstStructure *structure) GstStructureField *field; GString *s; int i; + + /* NOTE: This function is potentially called by the debug system, + * so any calls to gst_log() (and GST_DEBUG(), GST_LOG(), etc.) + * should be careful to avoid recursion. This includes any functions + * called by gst_structure_to_string. In particular, calls should + * not use the GST_PTR_FORMAT extension. */ g_return_val_if_fail(structure != NULL, NULL); @@ -1050,135 +1049,6 @@ _gst_structure_parse_string (gchar *s, gchar **end, gchar **next) return TRUE; } -static int -gst_strtoi (const char *s, char **end, int base) -{ - int i; - - if (s[0] == '-') { - i = - (int) strtoul (s + 1, end, base); - } else { - i = strtoul (s, end, base); - } - - return i; -} - -static gboolean -gst_value_from_string (GValue *value, const char *s) -{ - gboolean ret = FALSE; - gchar *end; - GType type = G_VALUE_TYPE (value); - - if (type == G_TYPE_INVALID) return FALSE; - - switch (type) { - case G_TYPE_INT: - { - int x; - x = gst_strtoi (s, &end, 0); - if (*end == 0) { - ret = TRUE; - } else { - if (g_ascii_strcasecmp (s, "little_endian") == 0) { - x = G_LITTLE_ENDIAN; - ret = TRUE; - } else if (g_ascii_strcasecmp (s, "big_endian") == 0) { - x = G_BIG_ENDIAN; - ret = TRUE; - } else if (g_ascii_strcasecmp (s, "byte_order") == 0) { - x = G_BYTE_ORDER; - ret = TRUE; - } else if (g_ascii_strcasecmp (s, "min") == 0) { - x = G_MININT; - ret = TRUE; - } else if (g_ascii_strcasecmp (s, "max") == 0) { - x = G_MAXINT; - ret = TRUE; - } - } - if (ret) { - g_value_set_int (value, x); - } - } - break; - case G_TYPE_FLOAT: - { - double x; - x = g_ascii_strtod (s, &end); - if (*end == 0) { - g_value_set_float (value, x); - ret = TRUE; - } - } - break; - case G_TYPE_DOUBLE: - { - double x; - x = g_ascii_strtod (s, &end); - if (*end == 0) { - ret = TRUE; - } else { - if (g_ascii_strcasecmp (s, "min") == 0) { - x = -G_MAXDOUBLE; - ret = TRUE; - } else if (g_ascii_strcasecmp (s, "max") == 0) { - x = G_MAXDOUBLE; - ret = TRUE; - } - } - if (ret) { - g_value_set_double (value, x); - } - } - break; - case G_TYPE_BOOLEAN: - { - if (g_ascii_strcasecmp (s, "true") == 0 || - g_ascii_strcasecmp (s, "yes") == 0 || - g_ascii_strcasecmp (s, "t") == 0 || - strcmp (s, "1") == 0) { - g_value_set_boolean (value, TRUE); - ret = TRUE; - } else if (g_ascii_strcasecmp (s, "false") == 0 || - g_ascii_strcasecmp (s, "no") == 0 || - g_ascii_strcasecmp (s, "f") == 0 || - strcmp (s, "0") == 0) { - g_value_set_boolean (value, FALSE); - ret = TRUE; - } - } - break; - case G_TYPE_STRING: - { - g_value_set_string (value, s); - ret = TRUE; - } - break; - default: - /* FIXME: make more general */ - if (type == GST_TYPE_FOURCC) { - guint32 fourcc = 0; - if (strlen(s) == 4) { - fourcc = GST_MAKE_FOURCC(s[0], s[1], s[2], s[3]); - ret = TRUE; - } else if (g_ascii_isdigit (*s)) { - fourcc = strtoul (s, &end, 0); - if (*end == 0) { - ret = TRUE; - } - } - gst_value_set_fourcc (value, fourcc); - } else { - g_critical("type %s not handled", g_type_name(type)); - } - break; - } - - return ret; -} - static gboolean _gst_structure_parse_value (gchar *str, gchar **after, GValue *value, GType default_type); @@ -1384,14 +1254,14 @@ _gst_structure_parse_value (gchar *str, gchar **after, GValue *value, for(i=0;i<3;i++) { g_value_init(value, try_types[i]); - ret = gst_value_from_string (value, value_s); + ret = gst_value_deserialize (value, value_s); if (ret) break; g_value_unset(value); } } else { g_value_init(value, type); - ret = gst_value_from_string (value, value_s); + ret = gst_value_deserialize (value, value_s); } *value_end = c; } diff --git a/gst/gstvalue.c b/gst/gstvalue.c index 7035f82..26d874a 100644 --- a/gst/gstvalue.c +++ b/gst/gstvalue.c @@ -415,8 +415,22 @@ gst_value_serialize_fourcc (const GValue *value) static gboolean gst_value_deserialize_fourcc (GValue *dest, const char *s) { - g_warning("unimplemented"); - return FALSE; + gboolean ret = FALSE; + guint32 fourcc = 0; + char *end; + + if (strlen(s) == 4) { + fourcc = GST_MAKE_FOURCC(s[0], s[1], s[2], s[3]); + ret = TRUE; + } else if (g_ascii_isdigit (*s)) { + fourcc = strtoul (s, &end, 0); + if (*end == 0) { + ret = TRUE; + } + } + gst_value_set_fourcc (dest, fourcc); + + return ret; } /*************************************/ @@ -707,8 +721,23 @@ gst_value_serialize_boolean (const GValue *value) static gboolean gst_value_deserialize_boolean (GValue *dest, const char *s) { - g_warning("unimplemented"); - return FALSE; + gboolean ret = FALSE; + + if (g_ascii_strcasecmp (s, "true") == 0 || + g_ascii_strcasecmp (s, "yes") == 0 || + g_ascii_strcasecmp (s, "t") == 0 || + strcmp (s, "1") == 0) { + g_value_set_boolean (dest, TRUE); + ret = TRUE; + } else if (g_ascii_strcasecmp (s, "false") == 0 || + g_ascii_strcasecmp (s, "no") == 0 || + g_ascii_strcasecmp (s, "f") == 0 || + strcmp (s, "0") == 0) { + g_value_set_boolean (dest, FALSE); + ret = TRUE; + } + + return ret; } /*************************************/ @@ -730,11 +759,52 @@ gst_value_serialize_int (const GValue *value) return g_strdup_printf ("%d", value->data[0].v_int); } +static int +gst_strtoi (const char *s, char **end, int base) +{ + int i; + + if (s[0] == '-') { + i = - (int) strtoul (s + 1, end, base); + } else { + i = strtoul (s, end, base); + } + + return i; +} + static gboolean gst_value_deserialize_int (GValue *dest, const char *s) { - g_warning("unimplemented"); - return FALSE; + int x; + char *end; + gboolean ret = FALSE; + + x = gst_strtoi (s, &end, 0); + if (*end == 0) { + ret = TRUE; + } else { + if (g_ascii_strcasecmp (s, "little_endian") == 0) { + x = G_LITTLE_ENDIAN; + ret = TRUE; + } else if (g_ascii_strcasecmp (s, "big_endian") == 0) { + x = G_BIG_ENDIAN; + ret = TRUE; + } else if (g_ascii_strcasecmp (s, "byte_order") == 0) { + x = G_BYTE_ORDER; + ret = TRUE; + } else if (g_ascii_strcasecmp (s, "min") == 0) { + x = G_MININT; + ret = TRUE; + } else if (g_ascii_strcasecmp (s, "max") == 0) { + x = G_MAXINT; + ret = TRUE; + } + } + if (ret) { + g_value_set_int (dest, x); + } + return ret; } /*************************************/ @@ -763,8 +833,26 @@ gst_value_serialize_double (const GValue *value) static gboolean gst_value_deserialize_double (GValue *dest, const char *s) { - g_warning("unimplemented"); - return FALSE; + double x; + gboolean ret = FALSE; + char *end; + + x = g_ascii_strtod (s, &end); + if (*end == 0) { + ret = TRUE; + } else { + if (g_ascii_strcasecmp (s, "min") == 0) { + x = -G_MAXDOUBLE; + ret = TRUE; + } else if (g_ascii_strcasecmp (s, "max") == 0) { + x = G_MAXDOUBLE; + ret = TRUE; + } + } + if (ret) { + g_value_set_double (dest, x); + } + return ret; } /*************************************/ @@ -840,8 +928,9 @@ gst_value_serialize_string (const GValue *value) static gboolean gst_value_deserialize_string (GValue *dest, const char *s) { - g_warning("unimplemented"); - return FALSE; + g_value_set_string (dest, s); + + return TRUE; } /*************************************/ @@ -1217,7 +1306,17 @@ gst_value_serialize (const GValue *value) gboolean gst_value_deserialize (GValue *dest, const gchar *src) { - g_warning("unimplemented"); + GstValueTable *table; + int i; + + for(i=0;ilen;i++){ + table = &g_array_index(gst_value_table, GstValueTable, i); + if(table->type != G_VALUE_TYPE(dest) || + table->deserialize == NULL) continue; + + return table->deserialize(dest, src); + } + return FALSE; } diff --git a/gst/gstvalue.h b/gst/gstvalue.h index 27d8eef..6c24560 100644 --- a/gst/gstvalue.h +++ b/gst/gstvalue.h @@ -39,7 +39,7 @@ struct _GstValueTable { GType type; GstValueCompareFunc compare; GstValueSerializeFunc serialize; - GstValueDeserializeFunc unserialize; + GstValueDeserializeFunc deserialize; void *_gst_reserved [GST_PADDING]; }; diff --git a/tests/old/testsuite/caps/string-conversions.c b/tests/old/testsuite/caps/string-conversions.c index d94ee38..8e9e7d6 100644 --- a/tests/old/testsuite/caps/string-conversions.c +++ b/tests/old/testsuite/caps/string-conversions.c @@ -147,10 +147,10 @@ bla: /* fixed props entries */ test_string ("audio/raw ,test=(int)1"); - test_string ("audio/raw ,test=(float) 1"); + test_string ("audio/raw ,test=(double) 1"); test_string ("audio/raw, test=(fourcc )1"); test_string ("audio/raw ,test=(i)1"); - test_string ("audio/raw ,test=(f) 1"); + test_string ("audio/raw ,test=(d) 1"); test_string ("audio/raw, test=(4 )1"); test_string ("audio/raw,test=( fourcc ) 0x0000001"); test_string ("audio/raw,test =(fourcc) \"RGB \""); diff --git a/tests/old/testsuite/debug/Makefile.am b/tests/old/testsuite/debug/Makefile.am index 9c7397e..c0c9663 100644 --- a/tests/old/testsuite/debug/Makefile.am +++ b/tests/old/testsuite/debug/Makefile.am @@ -1,6 +1,6 @@ include ../Rules -tests_pass = commandline category output +tests_pass = commandline category output printf_extension tests_fail = tests_inconsistent = global diff --git a/tests/old/testsuite/debug/printf_extension.c b/tests/old/testsuite/debug/printf_extension.c new file mode 100644 index 0000000..8832687 --- /dev/null +++ b/tests/old/testsuite/debug/printf_extension.c @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2004 David A. Schleef + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + +gint +main (gint argc, gchar *argv[]) +{ + GstCaps *caps; + GstElement *element; + int zero = 0; + + gst_init (&argc, &argv); + + caps = gst_caps_from_string ("audio/x-raw-int, rate=44100"); + + element = gst_element_factory_make ("identity", NULL); + + GST_ERROR ("This should print caps: %" GST_PTR_FORMAT, caps); + GST_ERROR ("This should print an object: %" GST_PTR_FORMAT, element); + GST_ERROR ("This should print null: %" GST_PTR_FORMAT, NULL); + GST_ERROR ("This should print a pointer: %" GST_PTR_FORMAT, &zero); + //GST_ERROR ("This should print a pointer: %" GST_PTR_FORMAT, (void *)1); + + return 0; +} diff --git a/testsuite/caps/string-conversions.c b/testsuite/caps/string-conversions.c index d94ee38..8e9e7d6 100644 --- a/testsuite/caps/string-conversions.c +++ b/testsuite/caps/string-conversions.c @@ -147,10 +147,10 @@ bla: /* fixed props entries */ test_string ("audio/raw ,test=(int)1"); - test_string ("audio/raw ,test=(float) 1"); + test_string ("audio/raw ,test=(double) 1"); test_string ("audio/raw, test=(fourcc )1"); test_string ("audio/raw ,test=(i)1"); - test_string ("audio/raw ,test=(f) 1"); + test_string ("audio/raw ,test=(d) 1"); test_string ("audio/raw, test=(4 )1"); test_string ("audio/raw,test=( fourcc ) 0x0000001"); test_string ("audio/raw,test =(fourcc) \"RGB \""); diff --git a/testsuite/debug/Makefile.am b/testsuite/debug/Makefile.am index 9c7397e..c0c9663 100644 --- a/testsuite/debug/Makefile.am +++ b/testsuite/debug/Makefile.am @@ -1,6 +1,6 @@ include ../Rules -tests_pass = commandline category output +tests_pass = commandline category output printf_extension tests_fail = tests_inconsistent = global diff --git a/testsuite/debug/printf_extension.c b/testsuite/debug/printf_extension.c new file mode 100644 index 0000000..8832687 --- /dev/null +++ b/testsuite/debug/printf_extension.c @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2004 David A. Schleef + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include + +gint +main (gint argc, gchar *argv[]) +{ + GstCaps *caps; + GstElement *element; + int zero = 0; + + gst_init (&argc, &argv); + + caps = gst_caps_from_string ("audio/x-raw-int, rate=44100"); + + element = gst_element_factory_make ("identity", NULL); + + GST_ERROR ("This should print caps: %" GST_PTR_FORMAT, caps); + GST_ERROR ("This should print an object: %" GST_PTR_FORMAT, element); + GST_ERROR ("This should print null: %" GST_PTR_FORMAT, NULL); + GST_ERROR ("This should print a pointer: %" GST_PTR_FORMAT, &zero); + //GST_ERROR ("This should print a pointer: %" GST_PTR_FORMAT, (void *)1); + + return 0; +} -- 2.7.4