how to get the final caps of gstplaybin (or gstdecodebin)?

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

how to get the final caps of gstplaybin (or gstdecodebin)?

Zhao, Halley

In gstplaybin.c, after the dynamic pipeline has created, I try to get the final src pad (caps) of gstplaybin (gstdecodebin), but failed in function: gen_video_element();

I recursively parse the element in gstplaybin, but gst_caps_get_structure() will report error that “gst_caps_get_structure: assertion `GST_IS_CAPS (caps)' failed”.

The error msg and my source code is as following, thanks for your help

 

################error message:

====element name -2:mpeg2dec0

    file: gstplaybin.c, func: gen_video_element,      line: 920

    file: gstplaybin.c, func: gen_video_element,      line: 926

it is not a bin

    file: gstplaybin.c, func: gen_video_element,      line: 935

 

(gst-launch-0.10:14448): GStreamer-CRITICAL **: gst_caps_get_structure: assertion `GST_IS_CAPS (caps)' failed

===Error, we can't find the src structure of play_bin, wuwu~~~

====element name -2:fakesink

===Error, we can't find the src pad of play_bin, wuwu~~~

====element name -2:typefind

    file: gstplaybin.c, func: gen_video_element,      line: 920

    file: gstplaybin.c, func: gen_video_element,      line: 926

it is not a bin

    file: gstplaybin.c, func: gen_video_element,      line: 935

 

################my src codec

iter = gst_bin_iterate_elements (GST_BIN_CAST(play_bin));

   

    while (!done) {

        switch (gst_iterator_next (iter, &data)) {

          case GST_ITERATOR_OK:

          {

              child = GST_ELEMENT_CAST (data);

              temp_name = gst_element_get_name (child);

              if(!strncmp(temp_name, "decodebin",9))

              {

                  GstIterator *iter_2 = NULL;

                  gboolean done_2 = FALSE;

                  gpointer data_2 = NULL;

                  GstElement *child_2=NULL;

                  gboolean res_2 = TRUE;

                  gchar *temp_name_2 = NULL;

 

                  iter_2 = gst_bin_iterate_elements (GST_BIN_CAST(child));

                 

                  while (!done_2) {

                      switch (gst_iterator_next (iter_2, &data_2)) {

                        case GST_ITERATOR_OK:

                        {

                            child_2 = GST_ELEMENT_CAST (data_2);

                            temp_name_2 = gst_element_get_name (child_2);

                            PRINTF("====element name -2:%s\n",temp_name_2);

                            g_free (temp_name_2);

                                       

                            if ((play_bin_src_pad = gst_element_get_pad (child_2, "src")) == NULL) {

                                PRINTF("===Error, we can't find the src pad of play_bin, wuwu~~~\n");

                                break;

                            }

                           

                            PRINT_MARK;

                            if (play_bin_src_caps = gst_pad_get_caps (play_bin_src_pad) == NULL) {

                                PRINTF("===Error, we can't find the src caps of play_bin, wuwu~~~\n");

                                break;

                            }

 

                            PRINT_MARK;

                            if (GST_IS_BIN(child_2)) {

                                PRINTF("it is a bin\n");

                            }

                            else

                            {

                                PRINTF("it is not a bin\n");

                            }

                           

                            PRINT_MARK;   

                            if ((structure = gst_caps_get_structure (play_bin_src_caps, 0)) == NULL) {

                            PRINTF("===Error, we can't find the src structure of play_bin, wuwu~~~\n");

                            break;

                            }

 

                            PRINT_MARK;

                          structure_name = gst_structure_get_name(structure);

                          PRINTF("==== structure_name: %s====\n",structure_name);

           

                            gst_object_unref (structure);

                            gst_object_unref (structure_name);

                            gst_object_unref (child_2);

 

                        }

                       break;

                        case GST_ITERATOR_RESYNC:

                          gst_iterator_resync (iter_2);

                          res_2 = TRUE;

                          break;

                        case GST_ITERATOR_DONE:

                          done_2 = TRUE;

                          break;

                        case GST_ITERATOR_ERROR:

                          g_assert_not_reached ();

                          break;

                      }

                  }

                gst_iterator_free (iter_2);

 

              }

 

              g_free (temp_name);

 

                // gst_object_unref (child);

            }     

           break;

            case GST_ITERATOR_RESYNC:

              gst_iterator_resync (iter);

              res = TRUE;

              break;

            case GST_ITERATOR_DONE:

              done = TRUE;

              break;

            case GST_ITERATOR_ERROR:

              g_assert_not_reached ();

              break;

          }

    }

    gst_iterator_free (iter);

ZHAO, Halley (Aihua)

Email: halley.zhao[hidden email]

Tel: +86(21)61166476

iNet: 8821-6476

SSG/OTC/UMD 3W033

 


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel

gen_video_element.c (12K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: how to get the final caps of gstplaybin (or gstdecodebin)?

Stefan Sauer
hi,
Zhao, Halley schrieb:
>
> In gstplaybin.c, after the dynamic pipeline has created, I try to get
> the final src pad (caps) of gstplaybin (gstdecodebin), but failed in
> function: gen_video_element();
>
> I recursively parse the element in gstplaybin, but
> gst_caps_get_structure() will report error that
> “gst_caps_get_structure: assertion `GST_IS_CAPS (caps)' failed”.
>
You can also connect signal handlers to "notify:caps" on the pad you get
from decodebin. In your handler you can check if the caps are fixed and
use them.

Stefan


> The error msg and my source code is as following, thanks for your help
>
>  
>
> ################error message:
>
> ====element name -2:mpeg2dec0
>
>     file: gstplaybin.c, func: gen_video_element,      line: 920
>
>     file: gstplaybin.c, func: gen_video_element,      line: 926
>
> it is not a bin
>
>     file: gstplaybin.c, func: gen_video_element,      line: 935
>
>  
>
> (gst-launch-0.10:14448): GStreamer-CRITICAL **:
> gst_caps_get_structure: assertion `GST_IS_CAPS (caps)' failed
>
> ===Error, we can't find the src structure of play_bin, wuwu~~~
>
> ====element name -2:fakesink
>
> ===Error, we can't find the src pad of play_bin, wuwu~~~
>
> ====element name -2:typefind
>
>     file: gstplaybin.c, func: gen_video_element,      line: 920
>
>     file: gstplaybin.c, func: gen_video_element,      line: 926
>
> it is not a bin
>
>     file: gstplaybin.c, func: gen_video_element,      line: 935
>
>  
>
> ################my src codec
>
> iter = gst_bin_iterate_elements (GST_BIN_CAST(play_bin));
>
>    
>
>     while (!done) {
>
>         switch (gst_iterator_next (iter, &data)) {
>
>           case GST_ITERATOR_OK:
>
>           {
>
>               child = GST_ELEMENT_CAST (data);
>
>               temp_name = gst_element_get_name (child);
>
>               if(!strncmp(temp_name, "decodebin",9))
>
>               {
>
>                   GstIterator *iter_2 = NULL;
>
>                   gboolean done_2 = FALSE;
>
>                   gpointer data_2 = NULL;
>
>                   GstElement *child_2=NULL;
>
>                   gboolean res_2 = TRUE;
>
>                   gchar *temp_name_2 = NULL;
>
>  
>
>                   iter_2 = gst_bin_iterate_elements (GST_BIN_CAST(child));
>
>                  
>
>                   while (!done_2) {
>
>                       switch (gst_iterator_next (iter_2, &data_2)) {
>
>                         case GST_ITERATOR_OK:
>
>                         {
>
>                             child_2 = GST_ELEMENT_CAST (data_2);
>
>                             temp_name_2 = gst_element_get_name (child_2);
>
>                             PRINTF("====element name
> -2:%s\n",temp_name_2);
>
>                             g_free (temp_name_2);
>
>                                        
>
>                             if ((play_bin_src_pad =
> gst_element_get_pad (child_2, "src")) == NULL) {
>
>                                 PRINTF("===Error, we can't find the
> src pad of play_bin, wuwu~~~\n");
>
>                                 break;
>
>                             }
>
>                            
>
>                             PRINT_MARK;
>
>                             if (play_bin_src_caps = gst_pad_get_caps
> (play_bin_src_pad) == NULL) {
>
>                                 PRINTF("===Error, we can't find the
> src caps of play_bin, wuwu~~~\n");
>
>                                 break;
>
>                             }
>
>  
>
>                             PRINT_MARK;
>
>                             if (GST_IS_BIN(child_2)) {
>
>                                 PRINTF("it is a bin\n");
>
>                             }
>
>                             else
>
>                             {
>
>                                 PRINTF("it is not a bin\n");
>
>                             }
>
>                            
>
>                             PRINT_MARK;  
>
>                             if ((structure = gst_caps_get_structure
> (play_bin_src_caps, 0)) == NULL) {
>
>                             PRINTF("===Error, we can't find the src
> structure of play_bin, wuwu~~~\n");
>
>                             break;
>
>                             }
>
>  
>
>                             PRINT_MARK;
>
>                           structure_name =
> gst_structure_get_name(structure);
>
>                           PRINTF("==== structure_name:
> %s====\n",structure_name);
>
>            
>
>                             gst_object_unref (structure);
>
>                             gst_object_unref (structure_name);
>
>                             gst_object_unref (child_2);
>
>  
>
>                         }
>
>                        break;
>
>                         case GST_ITERATOR_RESYNC:
>
>                           gst_iterator_resync (iter_2);
>
>                           res_2 = TRUE;
>
>                           break;
>
>                         case GST_ITERATOR_DONE:
>
>                           done_2 = TRUE;
>
>                           break;
>
>                         case GST_ITERATOR_ERROR:
>
>                           g_assert_not_reached ();
>
>                           break;
>
>                       }
>
>                   }
>
>                 gst_iterator_free (iter_2);
>
>  
>
>               }
>
>  
>
>               g_free (temp_name);
>
>  
>
>                 // gst_object_unref (child);
>
>             }    
>
>            break;
>
>             case GST_ITERATOR_RESYNC:
>
>               gst_iterator_resync (iter);
>
>               res = TRUE;
>
>               break;
>
>             case GST_ITERATOR_DONE:
>
>               done = TRUE;
>
>               break;
>
>             case GST_ITERATOR_ERROR:
>
>               g_assert_not_reached ();
>
>               break;
>
>           }
>
>     }
>
>     gst_iterator_free (iter);
>
> *ZHAO, Halley (Aihua)*
>
> Email: [hidden email] <mailto:[hidden email]>
>
> Tel: +86(21)61166476
>
> iNet: 8821-6476
>
> SSG/OTC/UMD 3W033
>
>  
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> ------------------------------------------------------------------------
>
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: how to get the final caps of gstplaybin (or gstdecodebin)?

Arnout Vandecappelle
In reply to this post by Zhao, Halley
On Friday 14 November 2008 11:10:26 Zhao, Halley wrote:
>   if (play_bin_src_caps = gst_pad_get_caps (play_bin_src_pad) == NULL) {

 You're missing brackets here: == binds tighter than =, so you're
assigning 0 to play_bin_src_caps.

 Regards,
 Arnout
--
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
Essensium/Mind                                     http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium                BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  D206 D44B 5155 DF98 550D  3F2A 2213 88AA A1C7 C933

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: how to get the final caps of gstplaybin (or gstdecodebin)?

Zhao, Halley
In reply to this post by Stefan Sauer
  Thank you.
  Finally I use group->type[GST_STREAM_TYPE_VIDEO-1].preroll in setup_sinks().
  
  
  It is really a long time before my response :-)
  Your response and mail list was filtered out at that time.
  
  
  >-----Original Message-----
  >From: Stefan Kost [mailto:[hidden email]]
  >Sent: 2008年11月17日 16:16
  >To: Discussion of the development of GStreamer
  >Subject: Re: [gst-devel] how to get the final caps of gstplaybin (or
  >gstdecodebin)?
  >
  >hi,
  >Zhao, Halley schrieb:
  >>
  >> In gstplaybin.c, after the dynamic pipeline has created, I try to get
  >> the final src pad (caps) of gstplaybin (gstdecodebin), but failed in
  >> function: gen_video_element();
  >>
  >> I recursively parse the element in gstplaybin, but
  >> gst_caps_get_structure() will report error that
  >> “gst_caps_get_structure: assertion `GST_IS_CAPS (caps)' failed”.
  >>
  >You can also connect signal handlers to "notify:caps" on the pad you get
  >from decodebin. In your handler you can check if the caps are fixed and
  >use them.
  >
  >Stefan
  >
  >
  >> The error msg and my source code is as following, thanks for your help
  >>
  >>
  >>
  >> ################error message:
  >>
  >> ====element name -2:mpeg2dec0
  >>
  >>     file: gstplaybin.c, func: gen_video_element,      line: 920
  >>
  >>     file: gstplaybin.c, func: gen_video_element,      line: 926
  >>
  >> it is not a bin
  >>
  >>     file: gstplaybin.c, func: gen_video_element,      line: 935
  >>
  >>
  >>
  >> (gst-launch-0.10:14448): GStreamer-CRITICAL **:
  >> gst_caps_get_structure: assertion `GST_IS_CAPS (caps)' failed
  >>
  >> ===Error, we can't find the src structure of play_bin, wuwu~~~
  >>
  >> ====element name -2:fakesink
  >>
  >> ===Error, we can't find the src pad of play_bin, wuwu~~~
  >>
  >> ====element name -2:typefind
  >>
  >>     file: gstplaybin.c, func: gen_video_element,      line: 920
  >>
  >>     file: gstplaybin.c, func: gen_video_element,      line: 926
  >>
  >> it is not a bin
  >>
  >>     file: gstplaybin.c, func: gen_video_element,      line: 935
  >>
  >>
  >>
  >> ################my src codec
  >>
  >> iter = gst_bin_iterate_elements (GST_BIN_CAST(play_bin));
  >>
  >>
  >>
  >>     while (!done) {
  >>
  >>         switch (gst_iterator_next (iter, &data)) {
  >>
  >>           case GST_ITERATOR_OK:
  >>
  >>           {
  >>
  >>               child = GST_ELEMENT_CAST (data);
  >>
  >>               temp_name = gst_element_get_name (child);
  >>
  >>               if(!strncmp(temp_name, "decodebin",9))
  >>
  >>               {
  >>
  >>                   GstIterator *iter_2 = NULL;
  >>
  >>                   gboolean done_2 = FALSE;
  >>
  >>                   gpointer data_2 = NULL;
  >>
  >>                   GstElement *child_2=NULL;
  >>
  >>                   gboolean res_2 = TRUE;
  >>
  >>                   gchar *temp_name_2 = NULL;
  >>
  >>
  >>
  >>                   iter_2 = gst_bin_iterate_elements
  >(GST_BIN_CAST(child));
  >>
  >>
  >>
  >>                   while (!done_2) {
  >>
  >>                       switch (gst_iterator_next (iter_2, &data_2)) {
  >>
  >>                         case GST_ITERATOR_OK:
  >>
  >>                         {
  >>
  >>                             child_2 = GST_ELEMENT_CAST (data_2);
  >>
  >>                             temp_name_2 = gst_element_get_name
  >(child_2);
  >>
  >>                             PRINTF("====element name
  >> -2:%s\n",temp_name_2);
  >>
  >>                             g_free (temp_name_2);
  >>
  >>
  >>
  >>                             if ((play_bin_src_pad =
  >> gst_element_get_pad (child_2, "src")) == NULL) {
  >>
  >>                                 PRINTF("===Error, we can't find the
  >> src pad of play_bin, wuwu~~~\n");
  >>
  >>                                 break;
  >>
  >>                             }
  >>
  >>
  >>
  >>                             PRINT_MARK;
  >>
  >>                             if (play_bin_src_caps = gst_pad_get_caps
  >> (play_bin_src_pad) == NULL) {
  >>
  >>                                 PRINTF("===Error, we can't find the
  >> src caps of play_bin, wuwu~~~\n");
  >>
  >>                                 break;
  >>
  >>                             }
  >>
  >>
  >>
  >>                             PRINT_MARK;
  >>
  >>                             if (GST_IS_BIN(child_2)) {
  >>
  >>                                 PRINTF("it is a bin\n");
  >>
  >>                             }
  >>
  >>                             else
  >>
  >>                             {
  >>
  >>                                 PRINTF("it is not a bin\n");
  >>
  >>                             }
  >>
  >>
  >>
  >>                             PRINT_MARK;
  >>
  >>                             if ((structure = gst_caps_get_structure
  >> (play_bin_src_caps, 0)) == NULL) {
  >>
  >>                             PRINTF("===Error, we can't find the src
  >> structure of play_bin, wuwu~~~\n");
  >>
  >>                             break;
  >>
  >>                             }
  >>
  >>
  >>
  >>                             PRINT_MARK;
  >>
  >>                           structure_name =
  >> gst_structure_get_name(structure);
  >>
  >>                           PRINTF("==== structure_name:
  >> %s====\n",structure_name);
  >>
  >>
  >>
  >>                             gst_object_unref (structure);
  >>
  >>                             gst_object_unref (structure_name);
  >>
  >>                             gst_object_unref (child_2);
  >>
  >>
  >>
  >>                         }
  >>
  >>                        break;
  >>
  >>                         case GST_ITERATOR_RESYNC:
  >>
  >>                           gst_iterator_resync (iter_2);
  >>
  >>                           res_2 = TRUE;
  >>
  >>                           break;
  >>
  >>                         case GST_ITERATOR_DONE:
  >>
  >>                           done_2 = TRUE;
  >>
  >>                           break;
  >>
  >>                         case GST_ITERATOR_ERROR:
  >>
  >>                           g_assert_not_reached ();
  >>
  >>                           break;
  >>
  >>                       }
  >>
  >>                   }
  >>
  >>                 gst_iterator_free (iter_2);
  >>
  >>
  >>
  >>               }
  >>
  >>
  >>
  >>               g_free (temp_name);
  >>
  >>
  >>
  >>                 // gst_object_unref (child);
  >>
  >>             }
  >>
  >>            break;
  >>
  >>             case GST_ITERATOR_RESYNC:
  >>
  >>               gst_iterator_resync (iter);
  >>
  >>               res = TRUE;
  >>
  >>               break;
  >>
  >>             case GST_ITERATOR_DONE:
  >>
  >>               done = TRUE;
  >>
  >>               break;
  >>
  >>             case GST_ITERATOR_ERROR:
  >>
  >>               g_assert_not_reached ();
  >>
  >>               break;
  >>
  >>           }
  >>
  >>     }
  >>
  >>     gst_iterator_free (iter);
  >>
  >> *ZHAO, Halley (Aihua)*
  >>
  >> Email: [hidden email] <mailto:[hidden email]>
  >>
  >> Tel: +86(21)61166476
  >>
  >> iNet: 8821-6476
  >>
  >> SSG/OTC/UMD 3W033
  >>
  >>
  >>
  >>
  >-----------------------------------------------------------------------
  >-
  >>
  >>
  >-----------------------------------------------------------------------
  >--
  >> This SF.Net email is sponsored by the Moblin Your Move Developer's
  >challenge
  >> Build the coolest Linux based applications with Moblin SDK & win great
  >prizes
  >> Grand prize is a trip for two to an Open Source event anywhere in the world
  >> http://moblin-contest.org/redirect.php?banner_id=100&url=/
  >>
  >-----------------------------------------------------------------------
  >-
  >>
  >> _______________________________________________
  >> gstreamer-devel mailing list
  >> [hidden email]
  >> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
  >
  >
  >-----------------------------------------------------------------------
  >--
  >This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
  >Build the coolest Linux based applications with Moblin SDK & win great prizes
  >Grand prize is a trip for two to an Open Source event anywhere in the world
  >http://moblin-contest.org/redirect.php?banner_id=100&url=/
  >_______________________________________________
  >gstreamer-devel mailing list
  >[hidden email]
  >https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel