mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-24 18:51:11 +00:00
972a1dea4d
Original commit message from CVS: * examples/dynparams/filter.c: (ui_control_create): * examples/gstplay/player.c: (print_tag): * ext/alsa/gstalsa.c: (gst_alsa_request_new_pad): * ext/gdk_pixbuf/gstgdkanimation.c: (gst_gdk_animation_iter_may_advance): * ext/jack/gstjack.c: (gst_jack_request_new_pad): * ext/mad/gstid3tag.c: (gst_mad_id3_to_tag_list), (tag_list_to_id3_tag_foreach), (gst_id3_tag_handle_event): * ext/vorbis/oggvorbisenc.c: (gst_oggvorbisenc_get_tag_value): * ext/vorbis/vorbisenc.c: (gst_vorbisenc_get_tag_value): * ext/xine/xineaudiodec.c: (gst_xine_audio_dec_chain): * gst-libs/gst/media-info/media-info-test.c: (print_tag): * gst/sine/demo-dparams.c: (main): * gst/tags/gstvorbistag.c: (gst_tag_to_vorbis_comments): * testsuite/alsa/formats.c: (create_pipeline): * testsuite/alsa/sinesrc.c: (sinesrc_force_caps), (sinesrc_get): fixes for G_DISABLE_ASSERT and friends * gst/typefind/gsttypefindfunctions.c: (aac_type_find), (mp3_type_frame_length_from_header), (mp3_type_find), (plugin_init): require mp3 typefinding to have at least MIN_HEADERS valid headers add typefinding for AAC adts files
120 lines
3 KiB
C
120 lines
3 KiB
C
/* media-info test app */
|
|
|
|
#include <gst/gst.h>
|
|
#include <string.h>
|
|
#include "media-info.h"
|
|
|
|
static void
|
|
print_tag (const GstTagList * list, const gchar * tag, gpointer unused)
|
|
{
|
|
gint i, count;
|
|
|
|
count = gst_tag_list_get_tag_size (list, tag);
|
|
|
|
for (i = 0; i < count; i++) {
|
|
gchar *str;
|
|
|
|
if (gst_tag_get_type (tag) == G_TYPE_STRING) {
|
|
if (!gst_tag_list_get_string_index (list, tag, i, &str))
|
|
g_assert_not_reached ();
|
|
} else {
|
|
str =
|
|
g_strdup_value_contents (gst_tag_list_get_value_index (list, tag, i));
|
|
}
|
|
|
|
if (i == 0) {
|
|
g_print ("%15s: %s\n", gst_tag_get_nick (tag), str);
|
|
} else {
|
|
g_print (" : %s\n", str);
|
|
}
|
|
|
|
g_free (str);
|
|
}
|
|
}
|
|
|
|
static void
|
|
info_print (GstMediaInfoStream * stream)
|
|
{
|
|
int i;
|
|
GList *p;
|
|
GstMediaInfoTrack *track;
|
|
|
|
g_print ("- mime type: %s\n", stream->mime);
|
|
g_print ("- length: %.3f seconds\n",
|
|
(gdouble) stream->length_time / GST_SECOND);
|
|
g_print ("- bitrate: %.3f kbps\n", stream->bitrate / 1000.0);
|
|
g_print ("- number of tracks: %ld\n", stream->length_tracks);
|
|
p = stream->tracks;
|
|
if (p == NULL) {
|
|
g_print ("- no track information, probably an error\n");
|
|
return;
|
|
}
|
|
for (i = 0; i < stream->length_tracks; ++i) {
|
|
g_print ("- track %d\n", i);
|
|
track = (GstMediaInfoTrack *) p->data;
|
|
g_print (" - metadata:\n");
|
|
if (track->metadata)
|
|
gst_tag_list_foreach (track->metadata, print_tag, NULL);
|
|
else
|
|
g_print (" (none found)\n");
|
|
g_print (" - streaminfo:\n");
|
|
gst_tag_list_foreach (track->streaminfo, print_tag, NULL);
|
|
g_print (" - format:\n");
|
|
g_print ("%s\n", gst_caps_to_string (track->format));
|
|
p = p->next;
|
|
}
|
|
}
|
|
|
|
int
|
|
main (int argc, char *argv[])
|
|
{
|
|
GstMediaInfo *info;
|
|
GstMediaInfoStream *stream = NULL;
|
|
GError *error = NULL;
|
|
gint i;
|
|
|
|
g_assert (argc > 1);
|
|
|
|
gst_media_info_init ();
|
|
gst_init (&argc, &argv);
|
|
|
|
info = gst_media_info_new (&error);
|
|
if (error != NULL) {
|
|
g_print ("Error creating media-info object: %s\n", error->message);
|
|
g_error_free (error);
|
|
return -1;
|
|
}
|
|
|
|
g_assert (G_IS_OBJECT (info));
|
|
if (!gst_media_info_set_source (info, "gnomevfssrc", &error)) {
|
|
g_print ("Could not set gnomevfssrc as a source\n");
|
|
g_print ("reason: %s\n", error->message);
|
|
g_error_free (error);
|
|
return -1;
|
|
}
|
|
|
|
g_print ("stream: %p, &stream: %p\n", stream, &stream);
|
|
for (i = 1; i < argc; ++i) {
|
|
|
|
/*
|
|
stream = gst_media_info_read (info, argv[i], GST_MEDIA_INFO_ALL);
|
|
*/
|
|
gst_media_info_read_with_idler (info, argv[i], GST_MEDIA_INFO_ALL, &error);
|
|
while (gst_media_info_read_idler (info, &stream, &error) && stream == NULL)
|
|
/* keep idling */
|
|
g_print ("+");
|
|
g_print ("\nFILE: %s\n", argv[i]);
|
|
g_print ("stream: %p, &stream: %p\n", stream, &stream);
|
|
if (error) {
|
|
g_print ("Error reading media info: %s\n", error->message);
|
|
g_error_free (error);
|
|
}
|
|
if (stream)
|
|
info_print (stream);
|
|
else
|
|
g_print ("no media info found.\n");
|
|
stream = NULL;
|
|
}
|
|
|
|
return 0;
|
|
}
|