summaryrefslogtreecommitdiffstats
path: root/gst-libs/gst/media-info
diff options
context:
space:
mode:
Diffstat (limited to 'gst-libs/gst/media-info')
-rw-r--r--gst-libs/gst/media-info/media-info-priv.c95
-rw-r--r--gst-libs/gst/media-info/media-info-test.c2
-rw-r--r--gst-libs/gst/media-info/media-info.c101
3 files changed, 100 insertions, 98 deletions
diff --git a/gst-libs/gst/media-info/media-info-priv.c b/gst-libs/gst/media-info/media-info-priv.c
index fb012209..22ac6c45 100644
--- a/gst-libs/gst/media-info/media-info-priv.c
+++ b/gst-libs/gst/media-info/media-info-priv.c
@@ -104,11 +104,11 @@ have_type_callback (GstElement * typefind, guint probability, GstCaps * type,
/* FIXME: signal error */
g_warning ("Couldn't create id3tag");
if (!gst_element_link_many (priv->source, priv->decontainer, priv->typefind,
- NULL));
+ NULL));
g_warning ("Couldn't link in id3tag");
if (gst_element_set_state (priv->pipeline, GST_STATE_PLAYING)
- == GST_STATE_FAILURE)
+ == GST_STATE_FAILURE)
g_warning ("Couldn't set to playing");
}
#endif
@@ -139,8 +139,8 @@ deep_notify_callback (GObject * object, GstObject * origin,
GST_DEBUG ("caps: %" GST_PTR_FORMAT, priv->format);
} else
GST_DEBUG ("ignoring caps on object %s:%s",
- gst_object_get_name (gst_object_get_parent (origin)),
- gst_object_get_name (origin));
+ gst_object_get_name (gst_object_get_parent (origin)),
+ gst_object_get_name (origin));
} else if (strcmp (pspec->name, "offset") == 0) {
/* we REALLY ignore offsets, we hate them */
}
@@ -151,7 +151,8 @@ typedef struct
{
guint meta;
guint encoded;
-} TagFlagScore;
+}
+TagFlagScore;
static void
tag_flag_score (const GstTagList * list, const gchar * tag, gpointer user_data)
@@ -323,7 +324,7 @@ gmi_seek_to_track (GstMediaInfo * info, long track)
res = gst_pad_send_event (info->priv->decoder_pad, event);
if (!res) {
g_warning ("seek to logical track on pad %s:%s failed",
- GST_DEBUG_PAD_NAME (info->priv->decoder_pad));
+ GST_DEBUG_PAD_NAME (info->priv->decoder_pad));
return FALSE;
}
/* clear structs because of the seek */
@@ -350,37 +351,37 @@ gmi_set_mime (GstMediaInfo * info, const char *mime)
if ((strcmp (mime, "application/x-ogg") == 0) ||
(strcmp (mime, "application/ogg") == 0))
desc =
- g_strdup_printf
- ("%s name=source ! oggdemux ! vorbisdec name=decoder ! fakesink name=sink",
- priv->source_name);
+ 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);
+ 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)
|| (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);
+ 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);
+ 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);
+ g_strdup_printf
+ ("%s name=source ! modplug name=decoder ! audio/x-raw-int ! fakesink name=sink",
+ priv->source_name);
else
return FALSE;
@@ -409,7 +410,7 @@ gmi_set_mime (GstMediaInfo * info, const char *mime)
g_assert (GST_IS_PAD (priv->decoder_pad));
GST_DEBUG ("decoder pad: %s:%s",
gst_object_get_name (gst_object_get_parent (GST_OBJECT (priv->
- decoder_pad))), gst_pad_get_name (priv->decoder_pad));
+ decoder_pad))), gst_pad_get_name (priv->decoder_pad));
/* attach notify handler */
g_signal_connect (G_OBJECT (info->priv->pipeline), "deep_notify",
@@ -557,21 +558,21 @@ gmip_find_stream_post (GstMediaInfoPriv * priv)
if (res) {
switch (format) {
- case GST_FORMAT_TIME:
- stream->length_time = value;
- GST_DEBUG (" total %s: %lld", definition->nick, value);
- break;
- case GST_FORMAT_DEFAULT:
- case GST_FORMAT_BYTES:
- break;
- default:
- /* separation is necessary because track_format doesn't resolve to
- * int */
- if (format == track_format) {
- stream->length_tracks = value;
- GST_DEBUG (" total %s: %lld", definition->nick, value);
- } else
- GST_DEBUG ("unhandled format %s", definition->nick);
+ case GST_FORMAT_TIME:
+ stream->length_time = value;
+ GST_DEBUG (" total %s: %lld", definition->nick, value);
+ break;
+ case GST_FORMAT_DEFAULT:
+ case GST_FORMAT_BYTES:
+ break;
+ default:
+ /* separation is necessary because track_format doesn't resolve to
+ * int */
+ if (format == track_format) {
+ stream->length_tracks = value;
+ GST_DEBUG (" total %s: %lld", definition->nick, value);
+ } else
+ GST_DEBUG ("unhandled format %s", definition->nick);
}
} else
GST_DEBUG ("query didn't return result for %s", definition->nick);
@@ -597,7 +598,7 @@ gmip_find_stream_post (GstMediaInfoPriv * priv)
stream->bitrate = (long) (bits / seconds);
}
GST_DEBUG ("moving to STATE_METADATA\n");
- priv->state = GST_MEDIA_INFO_STATE_METADATA; /* metadata of first track */
+ priv->state = GST_MEDIA_INFO_STATE_METADATA; /* metadata of first track */
return TRUE;
}
@@ -694,23 +695,23 @@ gmip_find_track_streaminfo_post (GstMediaInfoPriv * priv)
gboolean res;
res = gst_pad_query (priv->decoder_pad, GST_QUERY_POSITION,
- &track_format, &value_start);
+ &track_format, &value_start);
if (res) {
format = GST_FORMAT_TIME;
track_num = value_start;
GST_DEBUG ("we are currently at %ld", track_num);
res = gst_pad_convert (priv->decoder_pad,
- track_format, track_num, &format, &value_start);
+ track_format, track_num, &format, &value_start);
res &= gst_pad_convert (priv->decoder_pad,
- track_format, track_num + 1, &format, &value_end);
+ track_format, track_num + 1, &format, &value_end);
if (res) {
- /* substract to get the length */
- GST_DEBUG ("start %lld, end %lld", value_start, value_end);
- value_end -= value_start;
- /* FIXME: check units; this is in seconds */
+ /* substract to get the length */
+ GST_DEBUG ("start %lld, end %lld", value_start, value_end);
+ value_end -= value_start;
+ /* FIXME: check units; this is in seconds */
- gst_tag_list_add (priv->streaminfo, GST_TAG_MERGE_REPLACE,
- GST_TAG_DURATION, (int) (value_end / 1E6), NULL);
+ gst_tag_list_add (priv->streaminfo, GST_TAG_MERGE_REPLACE,
+ GST_TAG_DURATION, (int) (value_end / 1E6), NULL);
}
}
}
diff --git a/gst-libs/gst/media-info/media-info-test.c b/gst-libs/gst/media-info/media-info-test.c
index 67a16cdc..e0778d9f 100644
--- a/gst-libs/gst/media-info/media-info-test.c
+++ b/gst-libs/gst/media-info/media-info-test.c
@@ -18,7 +18,7 @@ print_tag (const GstTagList * list, const gchar * tag, gpointer unused)
g_assert (gst_tag_list_get_string_index (list, tag, i, &str));
} else {
str =
- g_strdup_value_contents (gst_tag_list_get_value_index (list, tag, i));
+ g_strdup_value_contents (gst_tag_list_get_value_index (list, tag, i));
}
if (i == 0) {
diff --git a/gst-libs/gst/media-info/media-info.c b/gst-libs/gst/media-info/media-info.c
index 4f995359..16a66250 100644
--- a/gst-libs/gst/media-info/media-info.c
+++ b/gst-libs/gst/media-info/media-info.c
@@ -113,8 +113,9 @@ gst_media_info_get_type (void)
(GInstanceInitFunc) gst_media_info_instance_init,
NULL
};
+
gst_media_info_type = g_type_register_static (G_TYPE_OBJECT,
- "GstMediaInfo", &gst_media_info_info, 0);
+ "GstMediaInfo", &gst_media_info_info, 0);
}
return gst_media_info_type;
}
@@ -192,7 +193,7 @@ gst_media_info_new (GError ** error)
info->priv->error = NULL;
} else {
g_warning ("Error creating GstMediaInfo object.\n%s",
- info->priv->error->message);
+ info->priv->error->message);
g_error_free (info->priv->error);
}
}
@@ -222,7 +223,7 @@ gst_media_info_read_with_idler (GstMediaInfo * info, const char *location,
{
GstMediaInfoPriv *priv = info->priv;
- gmip_reset (info->priv); /* reset all structs */
+ gmip_reset (info->priv); /* reset all structs */
priv->location = g_strdup (location);
priv->flags = flags;
}
@@ -251,9 +252,9 @@ gst_media_info_read_idler (GstMediaInfo * info, GstMediaInfoStream ** streamp,
case GST_MEDIA_INFO_STATE_NULL:
/* make sure we have a source */
if (!priv->source_name) {
- *error = g_error_new (GST_MEDIA_INFO_ERROR, 0,
- "No source set on media info.");
- return FALSE;
+ *error = g_error_new (GST_MEDIA_INFO_ERROR, 0,
+ "No source set on media info.");
+ return FALSE;
}
/* need to find type */
@@ -266,26 +267,26 @@ gst_media_info_read_idler (GstMediaInfo * info, GstMediaInfoStream ** streamp,
GST_LOG ("STATE_TYPEFIND");
if ((priv->type == NULL) && gst_bin_iterate (GST_BIN (priv->pipeline))) {
- GST_DEBUG ("iterating while in STATE_TYPEFIND");
- GMI_DEBUG ("?");
- return TRUE;
+ GST_DEBUG ("iterating while in STATE_TYPEFIND");
+ GMI_DEBUG ("?");
+ return TRUE;
}
if (priv->type == NULL) {
- g_warning ("Couldn't find type\n");
- return FALSE;
+ g_warning ("Couldn't find type\n");
+ return FALSE;
}
/* do the state transition */
GST_DEBUG ("doing find_type_post");
gmip_find_type_post (priv);
GST_DEBUG ("finding out mime type");
mime =
- g_strdup (gst_structure_get_name (gst_caps_get_structure (priv->type,
- 0)));
+ g_strdup (gst_structure_get_name (gst_caps_get_structure (priv->type,
+ 0)));
GST_DEBUG ("found out mime type: %s", mime);
if (!gmi_set_mime (info, mime)) {
- /* FIXME: pop up error */
- GST_DEBUG ("no decoder pipeline found for mime %s", mime);
- return FALSE;
+ /* FIXME: pop up error */
+ GST_DEBUG ("no decoder pipeline found for mime %s", mime);
+ return FALSE;
}
priv->stream = gmi_stream_new ();
GST_DEBUG ("new stream: %p", priv->stream);
@@ -298,12 +299,12 @@ gst_media_info_read_idler (GstMediaInfo * info, GstMediaInfoStream ** streamp,
{
GST_LOG ("STATE_STREAM");
if ((priv->format == NULL) && gst_bin_iterate (GST_BIN (priv->pipeline))) {
- GMI_DEBUG ("?");
- return TRUE;
+ GMI_DEBUG ("?");
+ return TRUE;
}
if (priv->format == NULL) {
- g_warning ("Couldn't find format\n");
- return FALSE;
+ g_warning ("Couldn't find format\n");
+ return FALSE;
}
/* do state transition; stream -> first track metadata */
priv->current_track_num = 0;
@@ -316,21 +317,21 @@ gst_media_info_read_idler (GstMediaInfo * info, GstMediaInfoStream ** streamp,
case GST_MEDIA_INFO_STATE_METADATA:
{
if ((priv->metadata == NULL) &&
- gst_bin_iterate (GST_BIN (priv->pipeline)) &&
- priv->metadata_iters < MAX_METADATA_ITERS) {
- GMI_DEBUG ("?");
- priv->metadata_iters++;
- return TRUE;
+ gst_bin_iterate (GST_BIN (priv->pipeline)) &&
+ priv->metadata_iters < MAX_METADATA_ITERS) {
+ GMI_DEBUG ("?");
+ priv->metadata_iters++;
+ return TRUE;
}
if (priv->metadata_iters == MAX_METADATA_ITERS)
- g_print ("iterated a few times, didn't find metadata\n");
+ g_print ("iterated a few times, didn't find metadata\n");
if (priv->metadata == NULL) {
- /* this is not a permanent failure */
- GST_DEBUG ("Couldn't find metadata");
+ /* this is not a permanent failure */
+ GST_DEBUG ("Couldn't find metadata");
}
GST_DEBUG ("found metadata of track %ld", priv->current_track_num);
if (!gmip_find_track_metadata_post (priv))
- return FALSE;
+ return FALSE;
GST_DEBUG ("METADATA: going to STREAMINFO\n");
priv->state = GST_MEDIA_INFO_STATE_STREAMINFO;
return gmip_find_track_streaminfo_pre (priv);
@@ -338,50 +339,50 @@ gst_media_info_read_idler (GstMediaInfo * info, GstMediaInfoStream ** streamp,
case GST_MEDIA_INFO_STATE_STREAMINFO:
{
if ((priv->streaminfo == NULL) &&
- gst_bin_iterate (GST_BIN (priv->pipeline))) {
- GMI_DEBUG ("?");
- return TRUE;
+ gst_bin_iterate (GST_BIN (priv->pipeline))) {
+ GMI_DEBUG ("?");
+ return TRUE;
}
if (priv->streaminfo == NULL) {
- /* this is not a permanent failure */
- GST_DEBUG ("Couldn't find streaminfo");
+ /* this is not a permanent failure */
+ GST_DEBUG ("Couldn't find streaminfo");
} else
- GST_DEBUG ("found streaminfo of track %ld", priv->current_track_num);
+ GST_DEBUG ("found streaminfo of track %ld", priv->current_track_num);
if (!gmip_find_track_streaminfo_post (priv))
- return FALSE;
+ return FALSE;
priv->state = GST_MEDIA_INFO_STATE_FORMAT;
return gmip_find_track_format_pre (priv);
}
case GST_MEDIA_INFO_STATE_FORMAT:
{
if ((priv->format == NULL) && gst_bin_iterate (GST_BIN (priv->pipeline))) {
- GMI_DEBUG ("?");
- return TRUE;
+ GMI_DEBUG ("?");
+ return TRUE;
}
if (priv->format == NULL) {
- g_warning ("Couldn't find format\n");
- return FALSE;
+ g_warning ("Couldn't find format\n");
+ return FALSE;
}
GST_DEBUG ("found format of track %ld", priv->current_track_num);
if (!gmip_find_track_format_post (priv))
- return FALSE;
+ return FALSE;
/* save the track info */
priv->stream->tracks = g_list_append (priv->stream->tracks,
- priv->current_track);
+ priv->current_track);
/* these alloc'd data types have been handed off */
priv->current_track = NULL;
priv->location = NULL;
/* now see if we need to seek to a next track or not */
priv->current_track_num++;
if (priv->current_track_num < priv->stream->length_tracks) {
- gmi_seek_to_track (info, priv->current_track_num);
- priv->current_track = gmi_track_new ();
- if (!gmip_find_track_metadata_pre (priv)) {
- g_free (priv->current_track);
- return FALSE;
- }
- priv->state = GST_MEDIA_INFO_STATE_METADATA;
- return TRUE;
+ gmi_seek_to_track (info, priv->current_track_num);
+ priv->current_track = gmi_track_new ();
+ if (!gmip_find_track_metadata_pre (priv)) {
+ g_free (priv->current_track);
+ return FALSE;
+ }
+ priv->state = GST_MEDIA_INFO_STATE_METADATA;
+ return TRUE;
}
priv->state = GST_MEDIA_INFO_STATE_DONE;
gmi_clear_decoder (info);