Audio Metadata
Stefan Sauer
ensonic at hora-obscura.de
Sun Apr 15 12:23:53 PDT 2012
On 04/12/2012 06:23 AM, Sree Gowri wrote:
> Hi,
>
> I am trying to extract audio metadata like
> streamurl,streamtitle,artist,genre,album.However I am not able to
> extract the metadata using GstTagList. Below is the snippet of the
> code. Does anyone suggest what are the additions to be done in order
> to extract the metadata?
>
> Only the following data has been extracted.
> layer: 3
> mode: joint
> emphasis: none
> audio codec: MPEG-1 layer 3
> bitrate: 128000
>
> Pipeline is as follows:
>
> [code]
> app->pipeline= gst_parse_launch("appsrc name=mysource ! audio/mpeg !
> mad ! alsasink", NULL);
> [/code]
"appsrc name=mysource ! audio/mpeg ! mp3parse ! mad ! alsasink"
or even better
"appsrc name=mysource ! audio/mpeg ! decodebin2! alsasink"
Stefan
>
> Audio data fed to the appsrc element
>
> [code]
> buf =( GstBuffer *) gst_app_buffer_new (data, READBUF, g_free, data);
> g_signal_emit_by_name (GST_APP_SRC (app->appsrc), "push-buffer", buf,
> &ret);
> [/code]
>
> Bus message
>
> [code]
> case GST_MESSAGE_TAG:
> {
> GstTagList *tags = NULL;
> char *artist;
> gst_message_parse_tag (message, &tags);
> g_print ("Got tags from element %s:\n", GST_OBJECT_NAME
> (message->src));
> if (gst_tag_list_get_string (tags, GST_TAG_ARTIST, &artist))
> {
> printf("got artist: %s\n",artist);
> }
> else
> {
> printf("no artist!! \n");
> }
> gst_tag_list_foreach (tags, print_tag, NULL);
> g_print ("\n");
> gst_tag_list_free (tags);
> break;
> [/code]
>
> print_tag function code
> [code]
> 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);
> }
> }
> [/code]
>
> Thanks and Regards,
> Sree Gowri
>
>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20120415/c163d45c/attachment.htm>
More information about the gstreamer-devel
mailing list