register and use debugging category in media-info make vorbisfile emit tags for streaminfo

Original commit message from CVS:
register and use debugging category in media-info
make vorbisfile emit tags for streaminfo
This commit is contained in:
Thomas Vander Stichele 2004-01-20 16:25:11 +00:00
parent 8bb2349e3f
commit fd060aa027
7 changed files with 104 additions and 118 deletions

View file

@ -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> 2004-01-20 Ronald Bultje <rbultje@ronald.bitfreak.net>
* ext/mplex/gstmplex.cc: * ext/mplex/gstmplex.cc:

View file

@ -66,8 +66,7 @@ struct _VorbisFile {
guint64 offset; guint64 offset;
gulong blocksize; gulong blocksize;
GstCaps *metadata; GstTagList *streaminfo;
GstCaps *streaminfo;
}; };
struct _VorbisFileClass { struct _VorbisFileClass {
@ -415,97 +414,47 @@ ov_callbacks vorbisfile_ov_callbacks =
gst_vorbisfile_tell, gst_vorbisfile_tell,
}; };
#if 0 /* retrieve logical stream properties and put them in streaminfo GstTagList.
/* retrieve the comment field (or tags) and put in metadata GstCaps * returns TRUE if tags could be set,
* returns TRUE if caps could be set,
* FALSE if they couldn't be read somehow */
static gboolean
gst_vorbisfile_update_metadata (VorbisFile *vorbisfile, gint link)
{
OggVorbis_File *vf = &vorbisfile->vf;
gchar **ptr;
vorbis_comment *vc;
GstProps *props = NULL;
GstPropsEntry *entry;
gchar *name, *value;
/* clear old one */
if (vorbisfile->metadata) {
gst_caps_unref (vorbisfile->metadata);
vorbisfile->metadata = NULL;
}
/* create props to hold the key/value pairs */
props = gst_props_empty_new ();
vc = ov_comment (vf, link);
ptr = vc->user_comments;
while (*ptr) {
value = strstr (*ptr, "=");
if (value) {
name = g_strndup (*ptr, value-*ptr);
entry = gst_props_entry_new (name, G_TYPE_STRING_TYPE, value+1);
gst_props_add_entry (props, (GstPropsEntry *) entry);
}
ptr++;
}
vorbisfile->metadata = gst_caps_new ("vorbisfile_metadata",
"application/x-gst-metadata",
props);
g_object_notify (G_OBJECT (vorbisfile), "metadata");
return TRUE;
}
/* retrieve logical stream properties and put them in streaminfo GstCaps
* returns TRUE if caps could be set,
* FALSE if they couldn't be read somehow */ * FALSE if they couldn't be read somehow */
static gboolean static gboolean
gst_vorbisfile_update_streaminfo (VorbisFile *vorbisfile, gint link) gst_vorbisfile_update_streaminfo (VorbisFile *vorbisfile, gint link)
{ {
OggVorbis_File *vf = &vorbisfile->vf; OggVorbis_File *vf = &vorbisfile->vf;
vorbis_info *vi; vorbis_info *vi;
GstProps *props = NULL; GstTagList *tag_list;
GstPropsEntry *entry;
/* clear old one */ /* clear old one */
if (vorbisfile->streaminfo) { if (vorbisfile->streaminfo) {
gst_caps_unref (vorbisfile->streaminfo); gst_tag_list_free (vorbisfile->streaminfo);
vorbisfile->streaminfo = NULL; vorbisfile->streaminfo = NULL;
} }
/* create props to hold the key/value pairs */ tag_list = gst_tag_list_new ();
props = gst_props_empty_new ();
vi = ov_info (vf, link); vi = ov_info (vf, link);
entry = gst_props_entry_new ("version", G_TYPE_INT_TYPE, vi->version);
gst_props_add_entry (props, (GstPropsEntry *) entry);
entry = gst_props_entry_new ("bitrate_upper", G_TYPE_INT_TYPE,
vi->bitrate_upper);
gst_props_add_entry (props, (GstPropsEntry *) entry);
entry = gst_props_entry_new ("bitrate_nominal", G_TYPE_INT_TYPE,
vi->bitrate_nominal);
gst_props_add_entry (props, (GstPropsEntry *) entry);
entry = gst_props_entry_new ("bitrate_lower", G_TYPE_INT_TYPE,
vi->bitrate_lower);
gst_props_add_entry (props, (GstPropsEntry *) entry);
entry = gst_props_entry_new ("serial", G_TYPE_INT_TYPE,
ov_serialnumber (vf, link));
gst_props_add_entry (props, (GstPropsEntry *) entry);
entry = gst_props_entry_new ("bitrate", G_TYPE_INT_TYPE,
ov_bitrate (vf, link));
gst_props_add_entry (props, (GstPropsEntry *) entry);
vorbisfile->streaminfo = gst_caps_new ("vorbisfile_streaminfo", gst_tag_list_add (tag_list, GST_TAG_MERGE_APPEND,
"application/x-gst-streaminfo", GST_TAG_ENCODER_VERSION, vi->version,
props); GST_TAG_BITRATE, ov_bitrate (vf, link),
GST_TAG_SERIAL, ov_serialnumber (vf, link),
NULL);
if (vi->bitrate_nominal > 0)
gst_tag_list_add (tag_list, GST_TAG_MERGE_APPEND,
GST_TAG_NOMINAL_BITRATE, vi->bitrate_nominal, NULL);
if (vi->bitrate_lower > 0)
gst_tag_list_add (tag_list, GST_TAG_MERGE_APPEND,
GST_TAG_MINIMUM_BITRATE, vi->bitrate_lower, NULL);
if (vi->bitrate_upper > 0)
gst_tag_list_add (tag_list, GST_TAG_MERGE_APPEND,
GST_TAG_MAXIMUM_BITRATE, vi->bitrate_upper, NULL);
g_object_notify (G_OBJECT (vorbisfile), "streaminfo"); vorbisfile->streaminfo = tag_list;
gst_element_found_tags (GST_ELEMENT (vorbisfile), tag_list);
return TRUE; return TRUE;
} }
#endif
static gboolean static gboolean
gst_vorbisfile_new_link (VorbisFile *vorbisfile, gint link) gst_vorbisfile_new_link (VorbisFile *vorbisfile, gint link)
@ -515,6 +464,7 @@ gst_vorbisfile_new_link (VorbisFile *vorbisfile, gint link)
/* new logical bitstream */ /* new logical bitstream */
vorbisfile->current_link = link; vorbisfile->current_link = link;
gst_vorbisfile_update_streaminfo (vorbisfile, link);
caps = gst_caps_new_simple ("audio/x-raw-int", caps = gst_caps_new_simple ("audio/x-raw-int",
"endianness", G_TYPE_INT, G_BYTE_ORDER, "endianness", G_TYPE_INT, G_BYTE_ORDER,

View file

@ -91,7 +91,7 @@ deep_notify_callback (GObject *object, GstObject *origin,
if (strcmp (pspec->name, "metadata") == 0) 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_value_init (&value, pspec->value_type);
g_object_get_property (G_OBJECT (origin), pspec->name, &value); g_object_get_property (G_OBJECT (origin), pspec->name, &value);
priv->metadata = g_value_peek_pointer (&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 */ /* check if we're getting it from the source we want it from */
if (GST_IS_PAD (origin) && GST_PAD (origin) == priv->decoder_pad) 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_value_init (&value, pspec->value_type);
g_object_get_property (G_OBJECT (origin), pspec->name, &value); g_object_get_property (G_OBJECT (origin), pspec->name, &value);
priv->format = g_value_peek_pointer (&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 (gst_object_get_parent (origin)),
gst_object_get_name (origin)); gst_object_get_name (origin));
} }
@ -116,12 +116,12 @@ deep_notify_callback (GObject *object, GstObject *origin,
} }
else if (strcmp (pspec->name, "streaminfo") == 0) 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_value_init (&value, pspec->value_type);
g_object_get_property (G_OBJECT (origin), pspec->name, &value); g_object_get_property (G_OBJECT (origin), pspec->name, &value);
priv->streaminfo = g_value_peek_pointer (&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 */ /* helpers */
@ -173,7 +173,7 @@ gmi_seek_to_track (GstMediaInfo *info, long track)
/* FIXME: consider more nicks as "track" */ /* FIXME: consider more nicks as "track" */
track_format = gst_format_get_by_nick ("logical_stream"); track_format = gst_format_get_by_nick ("logical_stream");
if (track_format == 0) return FALSE; 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) if (gst_element_set_state (priv->pipeline, GST_STATE_PLAYING)
== GST_STATE_FAILURE) == GST_STATE_FAILURE)
@ -217,7 +217,7 @@ gmi_get_decoder (GstMediaInfo *info, const char *mime)
decoder = g_hash_table_lookup (info->priv->decoders, mime); decoder = g_hash_table_lookup (info->priv->decoders, mime);
if (decoder == NULL) 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 */ /* FIXME: please figure out proper mp3 mimetypes */
if ((strcmp (mime, "application/x-ogg") == 0) || if ((strcmp (mime, "application/x-ogg") == 0) ||
(strcmp (mime, "application/ogg") == 0)) (strcmp (mime, "application/ogg") == 0))
@ -240,7 +240,7 @@ gmi_get_decoder (GstMediaInfo *info, const char *mime)
if (factory == NULL) if (factory == NULL)
return NULL; return NULL;
GMI_DEBUG("DEBUG: using factory %s\n", factory); GST_DEBUG ("using factory %s", factory);
decoder = gst_element_factory_make (factory, "decoder"); decoder = gst_element_factory_make (factory, "decoder");
g_free (factory); g_free (factory);
@ -309,7 +309,7 @@ gmip_find_type_pre (GstMediaInfoPriv *priv)
priv->type = NULL; priv->type = NULL;
} }
GMI_DEBUG("DEBUG: gmip_find_type_pre: start\n"); GST_DEBUG ("gmip_find_type_pre: start");
/* find out type */ /* find out type */
/* FIXME: we could move caps for typefind out of struct and /* FIXME: we could move caps for typefind out of struct and
* just use it through this function only */ * just use it through this function only */
@ -354,7 +354,7 @@ gmip_find_type (GstMediaInfoPriv *priv)
{ {
if (!gmip_find_type_pre (priv)) if (!gmip_find_type_pre (priv))
return FALSE; return FALSE;
GMI_DEBUG("DEBUG: gmip_find_type: iterating\n"); GST_DEBUG ("gmip_find_type: iterating");
while ((priv->type == NULL) && while ((priv->type == NULL) &&
gst_bin_iterate (GST_BIN (priv->pipeline))) gst_bin_iterate (GST_BIN (priv->pipeline)))
GMI_DEBUG("+"); GMI_DEBUG("+");
@ -388,7 +388,7 @@ gmip_find_stream_post (GstMediaInfoPriv *priv)
glong bytes = 0; 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 */ /* find a format that matches the "track" concept */
/* FIXME: this is used in vorbis, but we might have to loop when /* FIXME: this is used in vorbis, but we might have to loop when
* more codecs have tracks */ * more codecs have tracks */
@ -404,7 +404,7 @@ gmip_find_stream_post (GstMediaInfoPriv *priv)
g_assert (GST_IS_PAD (priv->decoder_pad)); g_assert (GST_IS_PAD (priv->decoder_pad));
definition = gst_format_get_details (*formats); 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, res = gst_pad_query (priv->decoder_pad, GST_QUERY_TOTAL,
&format, &value); &format, &value);
@ -415,7 +415,7 @@ gmip_find_stream_post (GstMediaInfoPriv *priv)
{ {
case GST_FORMAT_TIME: case GST_FORMAT_TIME:
stream->length_time = value; stream->length_time = value;
GMI_DEBUG(" total %s: %lld\n", definition->nick, value); GST_DEBUG (" total %s: %lld", definition->nick, value);
break; break;
case GST_FORMAT_DEFAULT: case GST_FORMAT_DEFAULT:
case GST_FORMAT_BYTES: case GST_FORMAT_BYTES:
@ -426,14 +426,14 @@ gmip_find_stream_post (GstMediaInfoPriv *priv)
if (format == track_format) if (format == track_format)
{ {
stream->length_tracks = value; stream->length_tracks = value;
GMI_DEBUG(" total %s: %lld\n", definition->nick, value); GST_DEBUG (" total %s: %lld", definition->nick, value);
} }
else else
GMI_DEBUG("unhandled format %s\n", definition->nick); GST_DEBUG ("unhandled format %s", definition->nick);
} }
} }
else 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++; formats++;
} }
@ -445,7 +445,7 @@ gmip_find_stream_post (GstMediaInfoPriv *priv)
&format, &value); &format, &value);
if (!res) g_warning ("Failed to query on sink pad !"); if (!res) g_warning ("Failed to query on sink pad !");
bytes = value; bytes = value;
GMI_DEBUG("bitrate calc: bytes gotten: %ld\n", bytes); GST_DEBUG ("bitrate calc: bytes gotten: %ld", bytes);
if (bytes) if (bytes)
{ {
@ -462,7 +462,7 @@ gmip_find_stream_post (GstMediaInfoPriv *priv)
gboolean gboolean
gmip_find_stream (GstMediaInfoPriv *priv) gmip_find_stream (GstMediaInfoPriv *priv)
{ {
GMI_DEBUG("DEBUG:gmip_find_stream start\n"); GST_DEBUG ("mip_find_stream start");
gmip_find_stream_pre (priv); gmip_find_stream_pre (priv);
/* iterate until caps are found */ /* iterate until caps are found */
@ -477,7 +477,7 @@ gmip_find_stream (GstMediaInfoPriv *priv)
if (priv->format == NULL) 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 FALSE;
} }
return gmip_find_stream_post (priv); return gmip_find_stream_post (priv);
@ -514,7 +514,7 @@ gboolean
gmip_find_track_metadata (GstMediaInfoPriv *priv) gmip_find_track_metadata (GstMediaInfoPriv *priv)
{ {
gmip_find_track_metadata_pre (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) && while ((priv->metadata == NULL) &&
gst_bin_iterate (GST_BIN (priv->pipeline))) gst_bin_iterate (GST_BIN (priv->pipeline)))
GMI_DEBUG("+"); GMI_DEBUG("+");
@ -564,7 +564,7 @@ gmip_find_track_streaminfo_post (GstMediaInfoPriv *priv)
{ {
format = GST_FORMAT_TIME; format = GST_FORMAT_TIME;
track_num = value_start; 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, res = gst_pad_convert (priv->decoder_pad,
track_format, track_num, track_format, track_num,
&format, &value_start); &format, &value_start);
@ -574,7 +574,7 @@ gmip_find_track_streaminfo_post (GstMediaInfoPriv *priv)
if (res) if (res)
{ {
/* substract to get the length */ /* 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; value_end -= value_start;
/* FIXME: check units; this is in seconds */ /* FIXME: check units; this is in seconds */
@ -593,7 +593,7 @@ gboolean
gmip_find_track_streaminfo (GstMediaInfoPriv *priv) gmip_find_track_streaminfo (GstMediaInfoPriv *priv)
{ {
gmip_find_track_streaminfo_pre (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) && while ((priv->streaminfo == NULL) &&
gst_bin_iterate (GST_BIN (priv->pipeline))) gst_bin_iterate (GST_BIN (priv->pipeline)))
GMI_DEBUG("+"); GMI_DEBUG("+");
@ -631,7 +631,7 @@ gboolean
gmip_find_track_format (GstMediaInfoPriv *priv) gmip_find_track_format (GstMediaInfoPriv *priv)
{ {
gmip_find_track_format_pre (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) && while ((priv->format == NULL) &&
gst_bin_iterate (GST_BIN (priv->pipeline))) gst_bin_iterate (GST_BIN (priv->pipeline)))
GMI_DEBUG("+"); GMI_DEBUG("+");

View file

@ -25,6 +25,9 @@
#include <gst/gst.h> #include <gst/gst.h>
/* debug */ /* debug */
GST_DEBUG_CATEGORY_EXTERN (gst_media_info_debug);
#define GST_CAT_DEFAULT gst_media_info_debug
#define DEBUG #define DEBUG
#ifdef DEBUG #ifdef DEBUG
static gboolean _gmi_debug = TRUE; static gboolean _gmi_debug = TRUE;

View file

@ -46,6 +46,7 @@ main (int argc, char *argv[])
g_assert (argc > 1); g_assert (argc > 1);
gst_init (&argc, &argv); gst_init (&argc, &argv);
gst_media_info_init ();
info = g_object_new (GST_MEDIA_INFO_TYPE, NULL); info = g_object_new (GST_MEDIA_INFO_TYPE, NULL);
g_print ("stream: %p, &stream: %p\n", stream, &stream); g_print ("stream: %p, &stream: %p\n", stream, &stream);

View file

@ -77,6 +77,16 @@ enum
static GObjectClass *parent_class = NULL; 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 GType
gst_media_info_get_type (void) 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: case GST_MEDIA_INFO_STATE_NULL:
/* need to find type */ /* 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); return gmip_find_type_pre (priv);
case GST_MEDIA_INFO_STATE_TYPEFIND: case GST_MEDIA_INFO_STATE_TYPEFIND:
@ -279,7 +289,7 @@ gst_media_info_read_idler (GstMediaInfo *info, GstMediaInfoStream **streamp)
gchar *mime; gchar *mime;
GstElement *decoder; GstElement *decoder;
GMI_DEBUG("STATE_TYPEFIND\n"); GST_DEBUG ("STATE_TYPEFIND");
if ((priv->type == NULL) && gst_bin_iterate (GST_BIN (priv->pipeline))) if ((priv->type == NULL) && gst_bin_iterate (GST_BIN (priv->pipeline)))
{ {
GMI_DEBUG("?"); GMI_DEBUG("?");
@ -291,21 +301,21 @@ gst_media_info_read_idler (GstMediaInfo *info, GstMediaInfoStream **streamp)
return FALSE; return FALSE;
} }
/* do the state transition */ /* do the state transition */
GMI_DEBUG("doing find_type_post\n"); GST_DEBUG ("doing find_type_post");
gmip_find_type_post (priv); 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 ( mime = g_strdup (gst_structure_get_name (
gst_caps_get_structure(priv->type, 0))); 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); decoder = gmi_get_decoder (info, mime);
if (decoder == NULL) if (decoder == NULL)
{ {
/* FIXME: pop up error */ /* 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; return FALSE;
} }
priv->stream = gmi_stream_new (); 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->mime = mime;
priv->stream->path = priv->location; priv->stream->path = priv->location;
gmi_set_decoder (info, decoder); gmi_set_decoder (info, decoder);
@ -314,7 +324,7 @@ gst_media_info_read_idler (GstMediaInfo *info, GstMediaInfoStream **streamp)
} }
case GST_MEDIA_INFO_STATE_STREAM: 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))) if ((priv->format == NULL) && gst_bin_iterate (GST_BIN (priv->pipeline)))
{ {
GMI_DEBUG("?"); GMI_DEBUG("?");
@ -348,11 +358,11 @@ gst_media_info_read_idler (GstMediaInfo *info, GstMediaInfoStream **streamp)
if (priv->metadata == NULL) if (priv->metadata == NULL)
{ {
/* this is not a permanent failure */ /* 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; 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; priv->state = GST_MEDIA_INFO_STATE_STREAMINFO;
return gmip_find_track_streaminfo_pre (priv); return gmip_find_track_streaminfo_pre (priv);
} }
@ -367,10 +377,10 @@ gst_media_info_read_idler (GstMediaInfo *info, GstMediaInfoStream **streamp)
if (priv->streaminfo == NULL) if (priv->streaminfo == NULL)
{ {
/* this is not a permanent failure */ /* this is not a permanent failure */
GMI_DEBUG("Couldn't find streaminfo\n"); GST_DEBUG ("Couldn't find streaminfo");
} }
else 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; if (!gmip_find_track_streaminfo_post (priv)) return FALSE;
priv->state = GST_MEDIA_INFO_STATE_FORMAT; priv->state = GST_MEDIA_INFO_STATE_FORMAT;
return gmip_find_track_format_pre (priv); 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"); g_warning ("Couldn't find format\n");
return FALSE; 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; if (!gmip_find_track_format_post (priv)) return FALSE;
/* save the track info */ /* save the track info */
priv->stream->tracks = g_list_append (priv->stream->tracks, 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; priv->state = GST_MEDIA_INFO_STATE_DONE;
*streamp = priv->stream; *streamp = priv->stream;
priv->stream = NULL; 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); gmi_clear_decoder (info);
return TRUE; return TRUE;
} }
@ -437,7 +447,7 @@ gst_media_info_read (GstMediaInfo *info, const char *location, guint16 flags)
gchar *mime; gchar *mime;
int i; 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 */ gmi_reset (info); /* reset all structs */
priv->location = g_strdup (location); priv->location = g_strdup (location);
priv->flags = flags; 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 ( mime = g_strdup (gst_structure_get_name (
gst_caps_get_structure(priv->type, 0))); gst_caps_get_structure(priv->type, 0)));
GMI_DEBUG("mime type: %s\n", mime); GST_DEBUG ("mime type: %s", mime);
/* c) figure out decoder */ /* c) figure out decoder */
decoder = gmi_get_decoder (info, mime); 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 /* e) if we have multiple tracks, loop over them; if not, just get
* metadata and return it */ * 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) for (i = 0; i < priv->stream->length_tracks; ++i)
{ {
priv->current_track = gmi_track_new (); priv->current_track = gmi_track_new ();
if (i > 0) if (i > 0)
{ {
GMI_DEBUG("seeking to track %d\n", i); GST_DEBUG ("seeking to track %d", i);
gmi_seek_to_track (info, i); gmi_seek_to_track (info, i);
} }
if (flags & GST_MEDIA_INFO_METADATA) if (flags & GST_MEDIA_INFO_METADATA)

View file

@ -99,6 +99,7 @@ typedef struct
#define GST_MEDIA_INFO_FORMAT 1 << 5 #define GST_MEDIA_INFO_FORMAT 1 << 5
#define GST_MEDIA_INFO_ALL ((1 << 6) - 1) #define GST_MEDIA_INFO_ALL ((1 << 6) - 1)
void gst_media_info_init (void);
GType gst_media_info_get_type (void); GType gst_media_info_get_type (void);
GstMediaInfo * gst_media_info_new (const char *source_element); GstMediaInfo * gst_media_info_new (const char *source_element);