[gst-devel] video file and pad...

Tim Muller t.i.m at zen.co.uk
Tue May 8 12:47:15 CEST 2007


Fabien <fabien.castan at free.fr> wrote :

Hi Fabian,

> It's me again. I tried and I tried by I still can't read
> a video file. So I tried to write the smallest and simplest
> code possible, based on  the example that was sent to the
> mailing list. 
> The only thing missing is the connection of the "pad" in
> the "cb_new_pad()" function and without this connection
> nothing can really happen..
> I added the video pipeline to the global pipeline, but
> there must be something missing and I don't know what?
>
> I've attached the file to this e-mail.

The code is a bit messy, and not very easy to read :)

Here's a bunch of comments (I just gave the code a quick look, I haven't actually compiled or run it):

 - gst_element_get_state (pipeline, NULL, NULL, -1) will
   block; it might not return in all cases when there's
   an error and an element posts an error message on the
   bus (it will only return a failure if the error happens
   immediately during the state change).

   In other words: set up a bus watch and check for
   error messages and state-changed messages instead
   (and run a main loop instead of doing the blocking
   _get_state(), so that the bus watch callback actually
   gets called.

   Alternatively you could do a
     while (msg = gst_bus_poll())
   kind of loop and process messages there directly.


 - the video pipeline and audio pipeline bits should
   probably be GstBins and not proper pipelines; I
   recommend creating them in the callback and not
   right at the start, but either should work fine.

 - don't use gst_bin_sync_children_state(), it's not
   the function you want; when you add your audio/video
   bin or other elements in the pad-added callback,
   just use gst_element_state() to set them to PLAYING
   (or PAUSED). (you do this in the video case, but
   not in the audio case it seems)

 - you're not linking the new pad to anything, are you?
   (like the sink pad of your audio/video bin)

 - you should probably define red_mask, green_mask and
   blue_mask fields in the RGB capsfilter caps too
   (don't think this makes anything fail here though)

 - what are the typefind elements in the audio/video
   bin for? Are they there so you can easily get to
   the negotiated caps once they're set?

Hope this helps a bit to make things work for you.

 Cheers
  -Tim









More information about the gstreamer-devel mailing list