gstreamer correct way to get ghost pad element by name

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

gstreamer correct way to get ghost pad element by name

vanderhoffer

Using GST 1.11,

I have created a ghost pad and confirmed it is working by the following

gchar *ghost_pad_1_name = NULL;
ghost_pad_1_name = "myGhostPad'
ghost_pad_1 = gst_ghost_pad_new (ghost_pad_1_name, pad_src_1);

if(GST_PAD_DIRECTION(ghost_pad_1) == GST_PAD_SRC){
    printf("Ghost is SRC -> correct\n"); // Correct
    }  

printf("Ghost Pad Name = %s\n",GST_ELEMENT_NAME(ghost_pad_1)); // myGhostPad

however trying to get the element by using the following returns NULL

GstElement *TestGhostPad = gst_bin_get_by_name (ghost_pad_1_name);
if (!TestGhostPad){
    printf("Ghost Pad is NULL\n"); // This is called
}
if (TestGhostPad){
    printf("Ghost Pad is NOT NULL\n");
}

Am I using this function correctly? Is there another method to get the Ghost Pad by name.

thanks Art


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

Re: gstreamer correct way to get ghost pad element by name

Sebastian Dröge-3
On Wed, 2016-12-07 at 10:46 +0000, art vanderhoff wrote:

> Using GST 1.11,
>
> I have created a ghost pad and confirmed it is working by the following
>
> gchar *ghost_pad_1_name = NULL;
> ghost_pad_1_name = "myGhostPad'
> ghost_pad_1 = gst_ghost_pad_new (ghost_pad_1_name, pad_src_1);
>
> if(GST_PAD_DIRECTION(ghost_pad_1) == GST_PAD_SRC){
>     printf("Ghost is SRC -> correct\n"); // Correct
>     }  
>
> printf("Ghost Pad Name = %s\n",GST_ELEMENT_NAME(ghost_pad_1)); // myGhostPad
> however trying to get the element by using the following returns NULL
>
> GstElement *TestGhostPad = gst_bin_get_by_name (ghost_pad_1_name);
> if (!TestGhostPad){
>     printf("Ghost Pad is NULL\n"); // This is called
> }
> if (TestGhostPad){
>     printf("Ghost Pad is NOT NULL\n");
> }
> Am I using this function correctly? Is there another method to get the Ghost Pad by name.
(Ghost) pads are not elements, but pads. You can get the (ghost) pad
from the element it was added by name via gst_element_get_static_pad().

--
Sebastian Dröge, Centricular Ltd · http://www.centricular.com
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

signature.asc (981 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: gstreamer correct way to get ghost pad element by name

vanderhoffer
@Sebastian, thank you very much for your reply, it works exactly.

Thanks
Art
Reply | Threaded
Open this post in threaded view
|

Re: gstreamer correct way to get ghost pad element by name

Nicolas Dufresne-4
In reply to this post by vanderhoffer


Le 7 déc. 2016 5:52 AM, "art vanderhoff" <[hidden email]> a écrit :

Using GST 1.11,

I have created a ghost pad and confirmed it is working by the following

gchar *ghost_pad_1_name = NULL;
ghost_pad_1_name = "myGhostPad'
ghost_pad_1 = gst_ghost_pad_new (ghost_pad_1_name, pad_src_1);

if(GST_PAD_DIRECTION(ghost_pad_1) == GST_PAD_SRC){
    printf("Ghost is SRC -> correct\n"); // Correct
    }  

printf("Ghost Pad Name = %s\n",GST_ELEMENT_NAME(ghost_pad_1)); // myGhostPad

however trying to get the element by using the following returns NULL

GstElement *TestGhostPad = gst_bin_get_by_name (ghost_pad_1_name);
if (!TestGhostPad){
    printf("Ghost Pad is NULL\n"); // This is called
}
if (TestGhostPad){
    printf("Ghost Pad is NOT NULL\n");
}

Am I using this function correctly? Is there another method to get the Ghost Pad by name.

No, because gst_bin_get_by_name() search for elements, not name. Use gst_element_get_static_pad() instead.

thanks Art


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel



_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel