summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog21
-rw-r--r--gst-libs/gst/media-info/media-info-priv.c48
-rw-r--r--gst-libs/gst/media-info/media-info-priv.h3
-rw-r--r--gst-libs/gst/media-info/media-info-test.c1
-rw-r--r--gst-libs/gst/media-info/media-info.c48
-rw-r--r--gst-libs/gst/media-info/media-info.h1
6 files changed, 79 insertions, 43 deletions
diff --git a/ChangeLog b/ChangeLog
index 54a83b1b..62b67f44 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,24 @@
+2004-01-20 Thomas Vander Stichele <thomas at apestaart dot org>
+
+ * gst-libs/gst/media-info/media-info-priv.c:
+ (deep_notify_callback), (gmi_seek_to_track), (gmi_get_decoder),
+ (gmip_find_type_pre), (gmip_find_type), (gmip_find_stream_post),
+ (gmip_find_stream), (gmip_find_track_metadata),
+ (gmip_find_track_streaminfo_post), (gmip_find_track_streaminfo),
+ (gmip_find_track_format):
+ * gst-libs/gst/media-info/media-info-priv.h:
+ * gst-libs/gst/media-info/media-info-test.c: (main):
+ * gst-libs/gst/media-info/media-info.c: (gst_media_info_init),
+ (gst_media_info_read_idler), (gst_media_info_read):
+ * gst-libs/gst/media-info/media-info.h:
+ register debugging category and use it for debugging
+
+2004-01-20 Thomas Vander Stichele <thomas at apestaart dot org>
+
+ * ext/vorbis/vorbisfile.c: (gst_vorbisfile_update_streaminfo),
+ (gst_vorbisfile_new_link):
+ signal streaminfo through tags
+
2004-01-20 Ronald Bultje <rbultje@ronald.bitfreak.net>
* ext/mplex/gstmplex.cc:
diff --git a/gst-libs/gst/media-info/media-info-priv.c b/gst-libs/gst/media-info/media-info-priv.c
index c7f470ea..27077936 100644
--- a/gst-libs/gst/media-info/media-info-priv.c
+++ b/gst-libs/gst/media-info/media-info-priv.c
@@ -91,7 +91,7 @@ deep_notify_callback (GObject *object, GstObject *origin,
if (strcmp (pspec->name, "metadata") == 0)
{
- GMI_DEBUG("DEBUG: deep_notify: have metadata !\n");
+ GST_DEBUG ("DEBUG: deep_notify: have metadata !");
g_value_init (&value, pspec->value_type);
g_object_get_property (G_OBJECT (origin), pspec->name, &value);
priv->metadata = g_value_peek_pointer (&value);
@@ -101,12 +101,12 @@ deep_notify_callback (GObject *object, GstObject *origin,
/* check if we're getting it from the source we want it from */
if (GST_IS_PAD (origin) && GST_PAD (origin) == priv->decoder_pad)
{
- GMI_DEBUG("DEBUG: deep_notify: have caps on decoder_pad !\n");
+ GST_DEBUG ("DEBUG: deep_notify: have caps on decoder_pad !");
g_value_init (&value, pspec->value_type);
g_object_get_property (G_OBJECT (origin), pspec->name, &value);
priv->format = g_value_peek_pointer (&value);
}
- else GMI_DEBUG("DEBUG: igoring caps on object %s:%s\n",
+ else GST_DEBUG ("ignoring caps on object %s:%s",
gst_object_get_name (gst_object_get_parent (origin)),
gst_object_get_name (origin));
}
@@ -116,12 +116,12 @@ deep_notify_callback (GObject *object, GstObject *origin,
}
else if (strcmp (pspec->name, "streaminfo") == 0)
{
- GMI_DEBUG("DEBUG: deep_notify: have streaminfo !\n");
+ GST_DEBUG ("deep_notify: have streaminfo !");
g_value_init (&value, pspec->value_type);
g_object_get_property (G_OBJECT (origin), pspec->name, &value);
priv->streaminfo = g_value_peek_pointer (&value);
}
- else GMI_DEBUG("DEBUG: ignoring notify of %s\n", pspec->name);
+ else GST_DEBUG ("ignoring notify of %s", pspec->name);
}
/* helpers */
@@ -173,7 +173,7 @@ gmi_seek_to_track (GstMediaInfo *info, long track)
/* FIXME: consider more nicks as "track" */
track_format = gst_format_get_by_nick ("logical_stream");
if (track_format == 0) return FALSE;
- GMI_DEBUG("Track format: %d\n", track_format);
+ GST_DEBUG ("Track format: %d", track_format);
if (gst_element_set_state (priv->pipeline, GST_STATE_PLAYING)
== GST_STATE_FAILURE)
@@ -217,7 +217,7 @@ gmi_get_decoder (GstMediaInfo *info, const char *mime)
decoder = g_hash_table_lookup (info->priv->decoders, mime);
if (decoder == NULL)
{
- GMI_DEBUG("DEBUG: no decoder in table, inserting one\n");
+ GST_DEBUG ("no decoder in table, inserting one");
/* FIXME: please figure out proper mp3 mimetypes */
if ((strcmp (mime, "application/x-ogg") == 0) ||
(strcmp (mime, "application/ogg") == 0))
@@ -240,7 +240,7 @@ gmi_get_decoder (GstMediaInfo *info, const char *mime)
if (factory == NULL)
return NULL;
- GMI_DEBUG("DEBUG: using factory %s\n", factory);
+ GST_DEBUG ("using factory %s", factory);
decoder = gst_element_factory_make (factory, "decoder");
g_free (factory);
@@ -309,7 +309,7 @@ gmip_find_type_pre (GstMediaInfoPriv *priv)
priv->type = NULL;
}
- GMI_DEBUG("DEBUG: gmip_find_type_pre: start\n");
+ GST_DEBUG ("gmip_find_type_pre: start");
/* find out type */
/* FIXME: we could move caps for typefind out of struct and
* just use it through this function only */
@@ -354,7 +354,7 @@ gmip_find_type (GstMediaInfoPriv *priv)
{
if (!gmip_find_type_pre (priv))
return FALSE;
- GMI_DEBUG("DEBUG: gmip_find_type: iterating\n");
+ GST_DEBUG ("gmip_find_type: iterating");
while ((priv->type == NULL) &&
gst_bin_iterate (GST_BIN (priv->pipeline)))
GMI_DEBUG("+");
@@ -388,7 +388,7 @@ gmip_find_stream_post (GstMediaInfoPriv *priv)
glong bytes = 0;
- GMI_DEBUG("gmip_find_stream_post: start\n");
+ GST_DEBUG ("gmip_find_stream_post: start");
/* find a format that matches the "track" concept */
/* FIXME: this is used in vorbis, but we might have to loop when
* more codecs have tracks */
@@ -404,7 +404,7 @@ gmip_find_stream_post (GstMediaInfoPriv *priv)
g_assert (GST_IS_PAD (priv->decoder_pad));
definition = gst_format_get_details (*formats);
- GMI_DEBUG("trying to figure out length for format %s\n", definition->nick);
+ GST_DEBUG ("trying to figure out length for format %s", definition->nick);
res = gst_pad_query (priv->decoder_pad, GST_QUERY_TOTAL,
&format, &value);
@@ -415,7 +415,7 @@ gmip_find_stream_post (GstMediaInfoPriv *priv)
{
case GST_FORMAT_TIME:
stream->length_time = value;
- GMI_DEBUG(" total %s: %lld\n", definition->nick, value);
+ GST_DEBUG (" total %s: %lld", definition->nick, value);
break;
case GST_FORMAT_DEFAULT:
case GST_FORMAT_BYTES:
@@ -426,14 +426,14 @@ gmip_find_stream_post (GstMediaInfoPriv *priv)
if (format == track_format)
{
stream->length_tracks = value;
- GMI_DEBUG(" total %s: %lld\n", definition->nick, value);
+ GST_DEBUG (" total %s: %lld", definition->nick, value);
}
else
- GMI_DEBUG("unhandled format %s\n", definition->nick);
+ GST_DEBUG ("unhandled format %s", definition->nick);
}
}
else
- GMI_DEBUG("query didn't return result for %s\n", definition->nick);
+ GST_DEBUG ("query didn't return result for %s", definition->nick);
formats++;
}
@@ -445,7 +445,7 @@ gmip_find_stream_post (GstMediaInfoPriv *priv)
&format, &value);
if (!res) g_warning ("Failed to query on sink pad !");
bytes = value;
- GMI_DEBUG("bitrate calc: bytes gotten: %ld\n", bytes);
+ GST_DEBUG ("bitrate calc: bytes gotten: %ld", bytes);
if (bytes)
{
@@ -462,7 +462,7 @@ gmip_find_stream_post (GstMediaInfoPriv *priv)
gboolean
gmip_find_stream (GstMediaInfoPriv *priv)
{
- GMI_DEBUG("DEBUG:gmip_find_stream start\n");
+ GST_DEBUG ("mip_find_stream start");
gmip_find_stream_pre (priv);
/* iterate until caps are found */
@@ -477,7 +477,7 @@ gmip_find_stream (GstMediaInfoPriv *priv)
if (priv->format == NULL)
{
- GMI_DEBUG("DEBUG: gmip_find_stream: couldn't get caps !");
+ GMI_DEBUG("gmip_find_stream: couldn't get caps !");
return FALSE;
}
return gmip_find_stream_post (priv);
@@ -514,7 +514,7 @@ gboolean
gmip_find_track_metadata (GstMediaInfoPriv *priv)
{
gmip_find_track_metadata_pre (priv);
- GMI_DEBUG("DEBUG: gmip_find_metadata: iterating\n");
+ GST_DEBUG ("gmip_find_metadata: iterating");
while ((priv->metadata == NULL) &&
gst_bin_iterate (GST_BIN (priv->pipeline)))
GMI_DEBUG("+");
@@ -564,7 +564,7 @@ gmip_find_track_streaminfo_post (GstMediaInfoPriv *priv)
{
format = GST_FORMAT_TIME;
track_num = value_start;
- GMI_DEBUG("DEBUG: we are currently at %ld\n", track_num);
+ GST_DEBUG ("we are currently at %ld", track_num);
res = gst_pad_convert (priv->decoder_pad,
track_format, track_num,
&format, &value_start);
@@ -574,7 +574,7 @@ gmip_find_track_streaminfo_post (GstMediaInfoPriv *priv)
if (res)
{
/* substract to get the length */
- GMI_DEBUG("DEBUG: start %lld, end %lld\n", value_start, value_end);
+ GST_DEBUG ("start %lld, end %lld", value_start, value_end);
value_end -= value_start;
/* FIXME: check units; this is in seconds */
@@ -593,7 +593,7 @@ gboolean
gmip_find_track_streaminfo (GstMediaInfoPriv *priv)
{
gmip_find_track_streaminfo_pre (priv);
- GMI_DEBUG("DEBUG: gmip_find_streaminfo: iterating\n");
+ GST_DEBUG ("DEBUG: gmip_find_streaminfo: iterating");
while ((priv->streaminfo == NULL) &&
gst_bin_iterate (GST_BIN (priv->pipeline)))
GMI_DEBUG("+");
@@ -631,7 +631,7 @@ gboolean
gmip_find_track_format (GstMediaInfoPriv *priv)
{
gmip_find_track_format_pre (priv);
- GMI_DEBUG("DEBUG: gmip_find_format: iterating\n");
+ GST_DEBUG ("DEBUG: gmip_find_format: iterating");
while ((priv->format == NULL) &&
gst_bin_iterate (GST_BIN (priv->pipeline)))
GMI_DEBUG("+");
diff --git a/gst-libs/gst/media-info/media-info-priv.h b/gst-libs/gst/media-info/media-info-priv.h
index 0a7aa500..e7ae708f 100644
--- a/gst-libs/gst/media-info/media-info-priv.h
+++ b/gst-libs/gst/media-info/media-info-priv.h
@@ -25,6 +25,9 @@
#include <gst/gst.h>
/* debug */
+GST_DEBUG_CATEGORY_EXTERN (gst_media_info_debug);
+#define GST_CAT_DEFAULT gst_media_info_debug
+
#define DEBUG
#ifdef DEBUG
static gboolean _gmi_debug = TRUE;
diff --git a/gst-libs/gst/media-info/media-info-test.c b/gst-libs/gst/media-info/media-info-test.c
index 5a73c8bd..6c396b38 100644
--- a/gst-libs/gst/media-info/media-info-test.c
+++ b/gst-libs/gst/media-info/media-info-test.c
@@ -46,6 +46,7 @@ main (int argc, char *argv[])
g_assert (argc > 1);
gst_init (&argc, &argv);
+ gst_media_info_init ();
info = g_object_new (GST_MEDIA_INFO_TYPE, NULL);
g_print ("stream: %p, &stream: %p\n", stream, &stream);
diff --git a/gst-libs/gst/media-info/media-info.c b/gst-libs/gst/media-info/media-info.c
index e214e8e1..a847785f 100644
--- a/gst-libs/gst/media-info/media-info.c
+++ b/gst-libs/gst/media-info/media-info.c
@@ -77,6 +77,16 @@ enum
static GObjectClass *parent_class = NULL;
+GST_DEBUG_CATEGORY (gst_media_info_debug);
+void
+gst_media_info_init (void)
+{
+ /* register our debugging category */
+ GST_DEBUG_CATEGORY_INIT (gst_media_info_debug, "GST_MEDIA_INFO", 0,
+ "GStreamer media-info library");
+ GST_DEBUG ("Initialized media-info library");
+}
+
GType
gst_media_info_get_type (void)
{
@@ -271,7 +281,7 @@ gst_media_info_read_idler (GstMediaInfo *info, GstMediaInfoStream **streamp)
{
case GST_MEDIA_INFO_STATE_NULL:
/* need to find type */
- GMI_DEBUG("idler: NULL, need to find type\n");
+ GST_DEBUG ("idler: NULL, need to find type");
return gmip_find_type_pre (priv);
case GST_MEDIA_INFO_STATE_TYPEFIND:
@@ -279,7 +289,7 @@ gst_media_info_read_idler (GstMediaInfo *info, GstMediaInfoStream **streamp)
gchar *mime;
GstElement *decoder;
- GMI_DEBUG("STATE_TYPEFIND\n");
+ GST_DEBUG ("STATE_TYPEFIND");
if ((priv->type == NULL) && gst_bin_iterate (GST_BIN (priv->pipeline)))
{
GMI_DEBUG("?");
@@ -291,21 +301,21 @@ gst_media_info_read_idler (GstMediaInfo *info, GstMediaInfoStream **streamp)
return FALSE;
}
/* do the state transition */
- GMI_DEBUG("doing find_type_post\n");
+ GST_DEBUG ("doing find_type_post");
gmip_find_type_post (priv);
- GMI_DEBUG("finding out mime type\n");
+ GST_DEBUG ("finding out mime type");
mime = g_strdup (gst_structure_get_name (
gst_caps_get_structure(priv->type, 0)));
- GMI_DEBUG("found out mime type: %s\n", mime);
+ GST_DEBUG ("found out mime type: %s", mime);
decoder = gmi_get_decoder (info, mime);
if (decoder == NULL)
{
/* FIXME: pop up error */
- GMI_DEBUG("DEBUG: no decoder found for mime %s\n", mime);
+ GST_DEBUG ("no decoder found for mime %s", mime);
return FALSE;
}
priv->stream = gmi_stream_new ();
- GMI_DEBUG("DEBUG: new stream: %p\n", priv->stream);
+ GST_DEBUG ("new stream: %p", priv->stream);
priv->stream->mime = mime;
priv->stream->path = priv->location;
gmi_set_decoder (info, decoder);
@@ -314,7 +324,7 @@ gst_media_info_read_idler (GstMediaInfo *info, GstMediaInfoStream **streamp)
}
case GST_MEDIA_INFO_STATE_STREAM:
{
- GMI_DEBUG("STATE_STREAM\n");
+ GST_DEBUG ("STATE_STREAM");
if ((priv->format == NULL) && gst_bin_iterate (GST_BIN (priv->pipeline)))
{
GMI_DEBUG("?");
@@ -348,11 +358,11 @@ gst_media_info_read_idler (GstMediaInfo *info, GstMediaInfoStream **streamp)
if (priv->metadata == NULL)
{
/* this is not a permanent failure */
- GMI_DEBUG("Couldn't find metadata\n");
+ GST_DEBUG ("Couldn't find metadata");
}
- GMI_DEBUG("found metadata of track %ld\n", priv->current_track_num);
+ GST_DEBUG ("found metadata of track %ld", priv->current_track_num);
if (!gmip_find_track_metadata_post (priv)) return FALSE;
- GMI_DEBUG("METADATA: going to STREAMINFO\n");
+ GST_DEBUG ("METADATA: going to STREAMINFO");
priv->state = GST_MEDIA_INFO_STATE_STREAMINFO;
return gmip_find_track_streaminfo_pre (priv);
}
@@ -367,10 +377,10 @@ gst_media_info_read_idler (GstMediaInfo *info, GstMediaInfoStream **streamp)
if (priv->streaminfo == NULL)
{
/* this is not a permanent failure */
- GMI_DEBUG("Couldn't find streaminfo\n");
+ GST_DEBUG ("Couldn't find streaminfo");
}
else
- GMI_DEBUG("found streaminfo of track %ld\n", priv->current_track_num);
+ GST_DEBUG ("found streaminfo of track %ld", priv->current_track_num);
if (!gmip_find_track_streaminfo_post (priv)) return FALSE;
priv->state = GST_MEDIA_INFO_STATE_FORMAT;
return gmip_find_track_format_pre (priv);
@@ -388,7 +398,7 @@ gst_media_info_read_idler (GstMediaInfo *info, GstMediaInfoStream **streamp)
g_warning ("Couldn't find format\n");
return FALSE;
}
- GMI_DEBUG("found format of track %ld\n", priv->current_track_num);
+ GST_DEBUG ("found format of track %ld", priv->current_track_num);
if (!gmip_find_track_format_post (priv)) return FALSE;
/* save the track info */
priv->stream->tracks = g_list_append (priv->stream->tracks,
@@ -413,7 +423,7 @@ gst_media_info_read_idler (GstMediaInfo *info, GstMediaInfoStream **streamp)
priv->state = GST_MEDIA_INFO_STATE_DONE;
*streamp = priv->stream;
priv->stream = NULL;
- GMI_DEBUG("TOTALLY DONE, setting pointer *streamp to %p\n", *streamp);
+ GST_DEBUG ("TOTALLY DONE, setting pointer *streamp to %p", *streamp);
gmi_clear_decoder (info);
return TRUE;
}
@@ -437,7 +447,7 @@ gst_media_info_read (GstMediaInfo *info, const char *location, guint16 flags)
gchar *mime;
int i;
- GMI_DEBUG("DEBUG: gst_media_info_read: start\n");
+ GST_DEBUG ("DEBUG: gst_media_info_read: start");
gmi_reset (info); /* reset all structs */
priv->location = g_strdup (location);
priv->flags = flags;
@@ -446,7 +456,7 @@ gst_media_info_read (GstMediaInfo *info, const char *location, guint16 flags)
mime = g_strdup (gst_structure_get_name (
gst_caps_get_structure(priv->type, 0)));
- GMI_DEBUG("mime type: %s\n", mime);
+ GST_DEBUG ("mime type: %s", mime);
/* c) figure out decoder */
decoder = gmi_get_decoder (info, mime);
@@ -473,13 +483,13 @@ gst_media_info_read (GstMediaInfo *info, const char *location, guint16 flags)
/* e) if we have multiple tracks, loop over them; if not, just get
* metadata and return it */
- GMI_DEBUG("DEBUG: num tracks %ld\n", priv->stream->length_tracks);
+ GST_DEBUG ("num tracks %ld", priv->stream->length_tracks);
for (i = 0; i < priv->stream->length_tracks; ++i)
{
priv->current_track = gmi_track_new ();
if (i > 0)
{
- GMI_DEBUG("seeking to track %d\n", i);
+ GST_DEBUG ("seeking to track %d", i);
gmi_seek_to_track (info, i);
}
if (flags & GST_MEDIA_INFO_METADATA)
diff --git a/gst-libs/gst/media-info/media-info.h b/gst-libs/gst/media-info/media-info.h
index d42a4af7..896e4e4c 100644
--- a/gst-libs/gst/media-info/media-info.h
+++ b/gst-libs/gst/media-info/media-info.h
@@ -99,6 +99,7 @@ typedef struct
#define GST_MEDIA_INFO_FORMAT 1 << 5
#define GST_MEDIA_INFO_ALL ((1 << 6) - 1)
+void gst_media_info_init (void);
GType gst_media_info_get_type (void);
GstMediaInfo * gst_media_info_new (const char *source_element);