Audio Metadata

Stefan Sauer ensonic at hora-obscura.de
Tue Apr 24 05:16:16 PDT 2012


On 04/24/2012 11:18 AM, Sree Gowri wrote:
>
>
> On Mon, Apr 16, 2012 at 12:53 AM, Stefan Sauer
> <ensonic at hora-obscura.de <mailto:ensonic at hora-obscura.de>> wrote:
>
>     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
>
>       Hi stephan,
>
>       First would like to thank you for the input you provided.
>    
>       I tried both the pipelines that you have mentioned,however meta
> data has not been    extracted.
>  
>      Kindly request you to let me know if there are any other changes
> that needs to be done.

Are you sure the stream you are looking at is tagged with such metadata?
Try gst-launch-0.10 -t playbin2 uri=...

Stefan

>  
> Regards,
> Sree Gowri
>  
>
>>
>>     _______________________________________________
>>     gstreamer-devel mailing list
>>     gstreamer-devel at lists.freedesktop.org <mailto:gstreamer-devel at lists.freedesktop.org>
>>     http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
>
>     _______________________________________________
>     gstreamer-devel mailing list
>     gstreamer-devel at lists.freedesktop.org
>     <mailto:gstreamer-devel at lists.freedesktop.org>
>     http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
>
>
> _______________________________________________
> 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/20120424/9546a42b/attachment.html>


More information about the gstreamer-devel mailing list