small media-info fixes

Original commit message from CVS:
small media-info fixes
This commit is contained in:
Thomas Vander Stichele 2004-03-08 22:16:04 +00:00
parent cb85c127bd
commit 956ab077d5
3 changed files with 18 additions and 66 deletions

View file

@ -1,3 +1,9 @@
2004-03-08 Thomas Vander Stichele <thomas at apestaart dot org>
* gst-libs/gst/media-info/media-info-priv.c: (gmi_set_mime):
* gst-libs/gst/media-info/media-info.c: (gst_media_info_read):
adding mime types, fixing the one-stop function
2004-03-08 Christian Schaller <Uraeus@gnome.org>
* tools/gst-launch-ext.in:

View file

@ -354,22 +354,25 @@ gmi_set_mime (GstMediaInfo *info, const char *mime)
/* FIXME: please figure out proper mp3 mimetypes */
if ((strcmp (mime, "application/x-ogg") == 0) ||
(strcmp (mime, "application/ogg") == 0))
desc = g_strdup_printf ("%s name=source ! oggdemux ! vorbisdec name=decoder ! audioconvert ! audio/x-raw-int ! fakesink name=sink", priv->source_name);
desc = g_strdup_printf ("%s name=source ! oggdemux ! vorbisdec name=decoder ! fakesink name=sink", priv->source_name);
else if ((strcmp (mime, "audio/mpeg") == 0) ||
(strcmp (mime, "audio/x-mp3") == 0) ||
(strcmp (mime, "audio/mp3") == 0) ||
(strcmp (mime, "application/x-id3") == 0) ||
(strcmp (mime, "audio/x-id3") == 0))
desc = g_strdup_printf ("%s name=source ! id3tag ! mad name=decoder ! audio/x-raw-int ! fakesink name=sink", priv->source_name);
else if (strcmp (mime, "application/x-flac") == 0)
desc = g_strdup_printf ("%s name=source ! flac name=decoder ! audio/x-raw-int ! fakesink name=sink", priv->source_name);
else if (strcmp (mime, "audio/x-wav") == 0)
else if ((strcmp (mime, "application/x-flac") == 0) ||
(strcmp (mime, "audio/x-flac") == 0))
desc = g_strdup_printf ("%s name=source ! flacdec name=decoder ! audio/x-raw-int ! fakesink name=sink", priv->source_name);
else if ((strcmp (mime, "audio/wav") == 0) ||
(strcmp (mime, "audio/x-wav") == 0))
desc = g_strdup_printf ("%s ! wavparse name=decoder ! audio/x-raw-int ! fakesink name=sink", priv->source_name);
else if (strcmp (mime, "audio/x-mod") == 0 ||
strcmp (mime, "audio/x-s3m") == 0 ||
strcmp (mime, "audio/x-xm") == 0 ||
strcmp (mime, "audio/x-it") == 0)
desc = g_strdup_printf ("%s name=source ! modplug name=decoder ! audio/x-raw-int ! fakesink name=sink", priv->source_name);
else return FALSE;
GST_DEBUG ("using description %s", desc);
priv->pipeline_desc = desc;

View file

@ -419,72 +419,15 @@ gst_media_info_read_idler (GstMediaInfo *info, GstMediaInfoStream **streamp, GEr
GstMediaInfoStream *
gst_media_info_read (GstMediaInfo *info, const char *location, guint16 flags, GError **error)
{
GstMediaInfoPriv *priv = info->priv;
GstMediaInfoStream *stream = NULL;
GstElement *decoder = NULL;
gchar *mime;
int i;
GST_DEBUG ("DEBUG: gst_media_info_read: start");
gmip_reset (info->priv); /* reset all structs */
priv->location = g_strdup (location);
priv->flags = flags;
if (!gmip_find_type (priv, error)) return NULL;
mime = g_strdup (gst_structure_get_name (
gst_caps_get_structure(priv->type, 0)));
GST_DEBUG ("mime type: %s", mime);
/* c) figure out decoding pipeline */
//FIXMEdecoder = gmi_get_pipeline_description (info, mime);
g_print ("DEBUG: using decoder %s\n", gst_element_get_name (decoder));
/* if it's NULL, then that's a sign we can't decode it */
if (decoder == NULL)
{
g_warning ("Can't find a decoder for type %s\n", mime);
gst_media_info_read_with_idler (info, location, flags, error);
if (*error) return FALSE;
while (gst_media_info_read_idler (info, &stream, error) && stream == NULL)
/* keep looping */;
if (*error)
return NULL;
}
/* b) create media info stream object */
priv->stream = gmi_stream_new ();
priv->stream->mime = mime;
priv->stream->path = priv->location;
/* install this decoder in the pipeline */
//FIXME: use new systemgmi_set_decoder (info, decoder);
/* collect total stream properties */
/* d) get all stream properties */
gmip_find_stream (priv);
/* e) if we have multiple tracks, loop over them; if not, just get
* metadata and return it */
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)
{
GST_DEBUG ("seeking to track %d", i);
gmi_seek_to_track (info, i);
}
if (flags & GST_MEDIA_INFO_METADATA)
gmip_find_track_metadata (priv);
if (flags & GST_MEDIA_INFO_STREAMINFO)
gmip_find_track_streaminfo (priv);
if (flags & GST_MEDIA_INFO_FORMAT)
gmip_find_track_format (priv);
priv->stream->tracks = g_list_append (priv->stream->tracks,
priv->current_track);
priv->current_track = NULL;
}
/* please return it */
stream = priv->stream;
priv->stream = NULL;
return stream;
}