getting profile of a file in appilication

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

getting profile of a file in appilication

kalyan
This post was updated on .
Hi,
I have written parser kind of plugin(aacparser) in which I have parsed the
header name.And I linked it to the decoder plugin.

My question is how to get the profile name in gstreamer application.Based
on that I have to link my parser to decoder.

Ex:
filesrc ! parser ! faad ! alsasink
      filesrc ! parser ! MyDecoder ! alsasink

_______________________________________________
gstreamer-devel mailing list
gstreamer-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re:

kalyan
If I set it as property in my parser plugin,will I be able to read it from gstreamer application?


On Fri, Jul 20, 2012 at 8:50 PM, kalyan chowdary <[hidden email]> wrote:
Hi,
I have written parser kind of plugin(aacparser) in which I have parsed the header name.And I linked it to the decoder plugin.

My question is how to get the profile name in gstreamer application.Based on that I have to link my parser to decoder.

Ex: 
filesrc ! parser ! faad ! alsasink
      filesrc ! parser ! MyDecoder ! alsasink


_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Re:

Tim-Philipp Müller-2
On Mon, 2012-07-23 at 19:17 +0530, kalyan chowdary wrote:

Hi,

In future you might want to consider using an actual subject line that
describes your question/problem, so people interested in that area can
spot it right away. Mails with empty subject often get ignored or sorted
to /dev/null.

> On Fri, Jul 20, 2012 at 8:50 PM, kalyan chowdary
> <[hidden email]> wrote:

>         I have written parser kind of plugin(aacparser) in which I
>         have parsed the header name.And I linked it to the decoder
>         plugin.

Out of curiosity - why have you written another aacparser in addition to
the existing aacparse? What does it do that aacparse doesn't do?

>         My question is how to get the profile name in gstreamer
>         application.Based on that I have to link my parser to decoder.
>         Ex:
>         filesrc ! parser ! faad ! alsasink
>               filesrc ! parser ! MyDecoder ! alsasink
>
> If I set it as property in my parser plugin,will I be able to
> read it from gstreamer application?

You can put the profile/level into the caps, as aacparse does. The
application can then either query the caps after the pipeline is
prerolled, or it could use

  g_signal_connect(pipeline, "deep-notify::caps" ...)

to get notified of caps changes on pads (this will be called from a
streaming thread then usually).

If it's just between your element and your application, you could also
post a custom element message with the information you want the app to
know. It will then get the element message on the GstBus.

Cheers
 -Tim

_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Re:

kalyan
This post was updated on .
Thank you for reply Tim.

why I have written because aacparse plugin is not giving profile.It is only
giving rate,channels,stream-format,mpegversion and framed=true.

I put the profile/level into the caps. But when I query the caps I am
getting CAPS which are set in GST_STATIC_PAD_TEMPLATE.(I am getting ANY).

I am setting the caps in the chain function only.Is it correct way of doing?

Do I have to use gst_set_src_caps()?I am not using gst_set_src_caps() in my
plugin.

Also can u please tell me about gst_set_src_caps() function why it should
be used?

Below is the code what I am using(template and chain function which parse
only header information and push the buffer at it is).



static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
    GST_PAD_SRC,
    GST_PAD_ALWAYS,
    GST_STATIC_CAPS_ANY
    );

and,
static GstFlowReturn
gst_MyParser_chain (GstPad * pad, GstBuffer * buf)
{
    Myfilter *filter;
    filter = GST_MYPARSER (GST_OBJECT_PARENT (pad));
    if (filter->silent == FALSE)
        g_print ("I'm plugged, therefore I'm in.\n");
    GstCaps *caps=NULL;
    gint8 profile;
    GstBuffer * tempBuffer = buf;
    profile = ( tempBuffer->data[2] &  0xc0 ) >> 6;

    switch(profile)
    {
        case AAC_MAIN_PROFILE:
                 caps = gst_caps_new_simple("audio/mpeg", "profile",G_TYPE_STRING,"HE-AAC", NULL);
                break;
        case AAC_LOW_COMPLEXITY_PROFILE:
            caps = gst_caps_new_simple(  "audio/mpeg", "profile",G_TYPE_STRING,"LC", NULL);
            break;
        case AAC_SCALABLE_SAMPLING_RATE_PROFILE:
               caps = gst_caps_new_simple("audio/mpeg","profile",G_TYPE_STRING,"AAC_SCALABLE_SAMPLING_RATE_PROFILE", NULL);
            break;
        case AAC_RESERVED:
            printf("\nAAC_RESERVED\n");
            break;
    }
//Sets the capabilities of this  source pad.
            if (FALSE == gst_pad_set_caps(filter->srcpad, caps))
            {
                return GST_FLOW_ERROR;
            }

            if ( caps != NULL)
           {
               gst_caps_unref(caps);
               caps = NULL;
           }
            //setting the source pad caps to out buffer
            gst_buffer_set_caps(buf, GST_PAD_CAPS(filter->srcpad));


  /* just push out the incoming buffer without touching it */
  return gst_pad_push (filter->srcpad, buf);
}





On Mon, Jul 23, 2012 at 7:34 PM, Tim-Philipp Müller <t.i.m@zen.co.uk> wrote:

> On Mon, 2012-07-23 at 19:17 +0530, kalyan chowdary wrote:
>
> Hi,
>
> In future you might want to consider using an actual subject line that
> describes your question/problem, so people interested in that area can
> spot it right away. Mails with empty subject often get ignored or sorted
> to /dev/null.
>
> > On Fri, Jul 20, 2012 at 8:50 PM, kalyan chowdary
> > <kalyanc007@gmail.com> wrote:
>
> >         I have written parser kind of plugin(aacparser) in which I
> >         have parsed the header name.And I linked it to the decoder
> >         plugin.
>
> Out of curiosity - why have you written another aacparser in addition to
> the existing aacparse? What does it do that aacparse doesn't do?
>
> >         My question is how to get the profile name in gstreamer
> >         application.Based on that I have to link my parser to decoder.
> >         Ex:
> >         filesrc ! parser ! faad ! alsasink
> >               filesrc ! parser ! MyDecoder ! alsasink
> >
> > If I set it as property in my parser plugin,will I be able to
> > read it from gstreamer application?
>
> You can put the profile/level into the caps, as aacparse does. The
> application can then either query the caps after the pipeline is
> prerolled, or it could use
>
>   g_signal_connect(pipeline, "deep-notify::caps" ...)
>
> to get notified of caps changes on pads (this will be called from a
> streaming thread then usually).
>
> If it's just between your element and your application, you could also
> post a custom element message with the information you want the app to
> know. It will then get the element message on the GstBus.
>
> Cheers
>  -Tim
>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>

_______________________________________________
gstreamer-devel mailing list
gstreamer-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel