GST_DEBUG_BIN_TO_DOT_FILE doesn't show all elements.

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

GST_DEBUG_BIN_TO_DOT_FILE doesn't show all elements.

wl2776
Administrator
My media player uses playbin2.
If I load a wav file into it, the result of the call
GST_DEBUG_BIN_TO_DOT_FILE(GST_BIN(m_player), GST_DEBUG_GRAPH_SHOW_ALL, "player");
when m_player is in the playing state is this: player.png (217kb) , original dot is this: player.dot (11Kb)

Apparently, there are no any videosinks there.
However, I see messages
"0:00:12.958634000  1716   003D9140 ERROR         directdrawsink gstdirectdrawsink.c:887:gst_directdraw_sink_show_frame:<videosink> No buffer to render.
"
in the debug window.

The creation code is the following:

m_loop = g_main_loop_new(NULL,FALSE);
m_player = gst_element_factory_make("playbin2","playbin0");
m_bus = gst_pipeline_get_bus(GST_PIPELINE(m_player));
gst_bus_enable_sync_message_emission(m_bus);
gst_bus_set_sync_handler (m_bus, (GstBusSyncHandler)gst_bus_sync_handler, this);
gst_bus_add_watch (m_bus, bus_call, this);

if(!m_videosink){
  m_videosink = gst_element_factory_make("directdrawsink","videosink");
  if(m_videosink){
    g_object_set(m_videosink,"sync",TRUE,"force-aspect-ratio",TRUE,"preroll-queue-len",1,NULL);
  if(!m_hwnd && m_parent)
    m_hwnd=m_parent->hwnd();

  if(m_hwnd)
    gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (m_videosink),m_hwnd);

  g_object_set(G_OBJECT(m_player),"video-sink",m_videosink,NULL);
}
gchar *uri=g_filename_to_uri(g_convert(filename,-1,"UTF-8","CP1251",NULL,NULL,NULL),NULL,NULL);
if(uri){
  g_object_set(G_OBJECT(m_player),"uri",uri,NULL);
  g_free(uri);
}
m_loop_thread=g_thread_create((GThreadFunc)main_loop_run,this,FALSE,NULL)); GstStateChangeReturn r=gst_element_set_state(GST_ELEMENT(m_player),GST_STATE_PLAYING);


error handling is omitted for brevity.

Then, bus-sync-handler waits for m_player to go to the PLAYING state, and, when it does, calls
GST_DEBUG_BIN_TO_DOT_FILE(GST_BIN(m_player), GST_DEBUG_GRAPH_SHOW_ALL, "player");

Is it a bug?

What should I do with the already created video sink, if I want to insert additional elements to the playbin2 in order it can play sound and video from the separate sources?
Reply | Threaded
Open this post in threaded view
|

Re: GST_DEBUG_BIN_TO_DOT_FILE doesn't show all elements.

Stefan Sauer
wl2776 wrote:

> My media player uses playbin2.
> If I load a wav file into it, the result of the call
> GST_DEBUG_BIN_TO_DOT_FILE(GST_BIN(m_player), GST_DEBUG_GRAPH_SHOW_ALL,
> "player");
> when m_player is in the playing state is this:
> http://n4.nabble.com/file/n1752600/player.png player.png (217kb)  , original
> dot is this:  http://n4.nabble.com/file/n1752600/player.dot player.dot
> (11Kb)  
>
> Apparently, there are no any videosinks there.
> However, I see messages
> "0:00:12.958634000  1716   003D9140 ERROR         directdrawsink
> gstdirectdrawsink.c:887:gst_directdraw_sink_show_frame:<videosink> No buffer
> to render.
> "
> in the debug window.
>  

Ha ha, very funny. You play a wav file. Now try with a video and get
some coffe :)

Stefan

> The creation code is the following:
>
> m_loop = g_main_loop_new(NULL,FALSE);
> m_player = gst_element_factory_make("playbin2","playbin0");
> m_bus = gst_pipeline_get_bus(GST_PIPELINE(m_player));
> gst_bus_enable_sync_message_emission(m_bus);
> gst_bus_set_sync_handler (m_bus, (GstBusSyncHandler)gst_bus_sync_handler,
> this);
> gst_bus_add_watch (m_bus, bus_call, this);
>
> if(!m_videosink){
>   m_videosink = gst_element_factory_make("directdrawsink","videosink");
>   if(m_videosink){
>    
> g_object_set(m_videosink,"sync",TRUE,"force-aspect-ratio",TRUE,"preroll-queue-len",1,NULL);
>   if(!m_hwnd && m_parent)
>     m_hwnd=m_parent->hwnd();
>
>   if(m_hwnd)
>     gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (m_videosink),m_hwnd);
>
>   g_object_set(G_OBJECT(m_player),"video-sink",m_videosink,NULL);
> }
> gchar
> *uri=g_filename_to_uri(g_convert(filename,-1,"UTF-8","CP1251",NULL,NULL,NULL),NULL,NULL);
> if(uri){
>   g_object_set(G_OBJECT(m_player),"uri",uri,NULL);
>   g_free(uri);
> }
> m_loop_thread=g_thread_create((GThreadFunc)main_loop_run,this,FALSE,NULL));
> GstStateChangeReturn
> r=gst_element_set_state(GST_ELEMENT(m_player),GST_STATE_PLAYING);
>
>
> error handling is omitted for brevity.
>
> Then, bus-sync-handler waits for m_player to go to the PLAYING state, and,
> when it does, calls
> GST_DEBUG_BIN_TO_DOT_FILE(GST_BIN(m_player), GST_DEBUG_GRAPH_SHOW_ALL,
> "player");
>
> Is it a bug?
>
> What should I do with the already created video sink, if I want to insert
> additional elements to the playbin2 in order it can play sound and video
> from the separate sources?
>
>  


------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: GST_DEBUG_BIN_TO_DOT_FILE doesn't show all elements.

wl2776
Administrator
Stefan Kost wrote
wl2776 wrote:
> My media player uses playbin2.
> If I load a wav file into it, the result of the call
> GST_DEBUG_BIN_TO_DOT_FILE(GST_BIN(m_player), GST_DEBUG_GRAPH_SHOW_ALL,
> "player");
Ha ha, very funny. You play a wav file. Now try with a video and get
some coffe :)
Yes, I know, I play a wav file. The question is - why has playbin2 left the video-sink?
And another question - why I don't see any video-sinks in the pipeline?
Reply | Threaded
Open this post in threaded view
|

Re: GST_DEBUG_BIN_TO_DOT_FILE doesn't show all elements.

Stefan Sauer
wl2776 wrote:

> Stefan Kost wrote:
>  
>> wl2776 wrote:
>>    
>>> My media player uses playbin2.
>>> If I load a wav file into it, the result of the call
>>> GST_DEBUG_BIN_TO_DOT_FILE(GST_BIN(m_player), GST_DEBUG_GRAPH_SHOW_ALL,
>>> "player");
>>>      
>> Ha ha, very funny. You play a wav file. Now try with a video and get
>> some coffe :)
>>
>>    
> Yes, I know, I play a wav file. The question is - why has playbin2 left the
> video-sink?
> And another question - why I don't see any video-sinks in the pipeline?
>  
why should playbin add the videosink to the pipleine if its not needed.
GST_DEBUG_BIN_TO_DOT_FILE() only shows the elements that are in the
pipeline, your videosink is not.
What is the problem that you have with that behaviour?

Stefan

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: GST_DEBUG_BIN_TO_DOT_FILE doesn't show all elements.

wl2776
Administrator
Stefan Kost wrote
wl2776 wrote:
> Yes, I know, I play a wav file. The question is - why has playbin2 left the
> video-sink?
> And another question - why I don't see any video-sinks in the pipeline?
why should playbin add the videosink to the pipleine if its not needed.
GST_DEBUG_BIN_TO_DOT_FILE() only shows the elements that are in the
pipeline, your videosink is not.
If I see messages from the videosink, then it's added to the playbin, right?

Stefan Kost wrote
What is the problem that you have with that behaviour?
No problems, just a wish to get the full understanding of GStreamer's details.
For now, I simply deleted this videosink from the pipeline and re-added it, when needed.

Currently, I am doing some surgery for the playbin2 in order to make it play sound and video from the separate files.
I've got some success: player.png (430Kb) .
This playbin has drawn the first movie frame and even has twitted something in speakers.

I has asked a question on the list, but it was left without the answer.
My task is to play a video and a sound from separate files, some media is recorded this way - DV video in the AVI container and a sound in WAV files.
The user selects one of files, either .avi, or .wav. The player must detect, that one of two streams is missing, find another file with the same name and the different extension and load it.

What is the correct approach to this?

I decided to create a playbin2, set it to playing, capture bus messages, check for "vqueue" or "audiosink" in their owners and find which stream is missing.
Then, in case of missing streams, I could remove the created playbin2 and create my own bin.
However, I was afraid, this could cause some flickering. Therefore I decided to add missing parts to the playbin2.

Could anyone comment on this?
Reply | Threaded
Open this post in threaded view
|

Re: GST_DEBUG_BIN_TO_DOT_FILE doesn't show all elements.

Stefan Sauer
wl2776 wrote:

> Stefan Kost wrote:
>  
>> wl2776 wrote:
>>    
>>> Yes, I know, I play a wav file. The question is - why has playbin2 left
>>> the
>>> video-sink?
>>> And another question - why I don't see any video-sinks in the pipeline?
>>>      
>> why should playbin add the videosink to the pipleine if its not needed.
>> GST_DEBUG_BIN_TO_DOT_FILE() only shows the elements that are in the
>> pipeline, your videosink is not.
>>
>>    
> If I see messages from the videosink, then it's added to the playbin, right?
>  
No. It is instantiated.
Stefan

>
> Stefan Kost wrote:
>  
>> What is the problem that you have with that behaviour?
>>
>>    
> No problems, just a wish to get the full understanding of GStreamer's
> details.
> For now, I simply deleted this videosink from the pipeline and re-added it,
> when needed.
>
> Currently, I am doing some surgery for the playbin2 in order to make it play
> sound and video from the separate files.
> I've got some success:
> http://n4.nabble.com/file/n1773975/0.01.37.910789000-player.png player.png
> (430Kb)  .
> This playbin has drawn the first movie frame and even has twitted something
> in speakers.
>
> I has asked a question on the list, but it was left without the answer.
> My task is to play a video and a sound from separate files, some media is
> recorded this way - DV video in the AVI container and a sound in WAV files.
> The user selects one of files, either .avi, or .wav. The player must detect,
> that one of two streams is missing, find another file with the same name and
> the different extension and load it.
>  
I don't think its a good idea to force playbin2 into that. just use one
pipeline, stick two uridecodebins into it and add your sinks.

Stefan

> What is the correct approach to this?
>
> I decided to create a playbin2, set it to playing, capture bus messages,
> check for "vqueue" or "audiosink" in their owners and find which stream is
> missing.
> Then, in case of missing streams, I could remove the created playbin2 and
> create my own bin.
> However, I was afraid, this could cause some flickering. Therefore I decided
> to add missing parts to the playbin2.
>
> Could anyone comment on this?
>  


------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: GST_DEBUG_BIN_TO_DOT_FILE doesn't show all elements.

wl2776
Administrator
Stefan Kost wrote
>>> Yes, I know, I play a wav file. The question is - why has playbin2 left
>>> the video-sink?
>>> And another question - why I don't see any video-sinks in the pipeline?
>>>      
>> why should playbin add the videosink to the pipleine if its not needed.
>> GST_DEBUG_BIN_TO_DOT_FILE() only shows the elements that are in the
>> pipeline, your videosink is not.
>>    
> If I see messages from the videosink, then it's added to the playbin, right?
>
No. It is instantiated.
Sorry, I don't understand. How many instances of videosink has my application?

My code is like the following

GstElement *m_player;
GstElement *m_videosink;

void open(char *filename)
{
  ...
  m_player=gst_element_factory_make("playbin2","player");
  m_videosink=gst_element_factory_make("directdrawsink","videosink");
  g_object_set(m_player,"video-sink",m_videosink);
...
}

I don't call gst_object_unref(m_videosink) in the open().
And even calls to this in close(), where I set m_player state to NULL and unref all objects, caused segmentation violations.

I think, my application has one videosink instance. Right?
Reply | Threaded
Open this post in threaded view
|

Re: GST_DEBUG_BIN_TO_DOT_FILE doesn't show all elements.

wl2776
Administrator
In reply to this post by Stefan Sauer
Stefan Kost wrote
> Currently, I am doing some surgery for the playbin2 in order to make it play
> sound and video from the separate files.
> I've got some success:
> http://n4.nabble.com/file/n1773975/0.01.37.910789000-player.png (430Kb).
> This playbin has drawn the first movie frame and even has twitted something
> in speakers.
>
I don't think its a good idea to force playbin2 into that. just use one
pipeline, stick two uridecodebins into it and add your sinks.
I am afraid that destruction of the already created playbin and creation of the new one can cause undesired image flickering.
Am I right?
Moreover, my sinks would be a single playsink with the similar structure - the same thing which was already built by the playbin2.
Reply | Threaded
Open this post in threaded view
|

Re: GST_DEBUG_BIN_TO_DOT_FILE doesn't show all elements.

Stefan Sauer
In reply to this post by wl2776
Am 09.04.2010 08:26, schrieb wl2776:

>
>
> Stefan Kost wrote:
>>
>>>>> Yes, I know, I play a wav file. The question is - why has playbin2 left
>>>>> the video-sink?
>>>>> And another question - why I don't see any video-sinks in the pipeline?
>>>>>      
>>>> why should playbin add the videosink to the pipleine if its not needed.
>>>> GST_DEBUG_BIN_TO_DOT_FILE() only shows the elements that are in the
>>>> pipeline, your videosink is not.
>>>>    
>>> If I see messages from the videosink, then it's added to the playbin,
>>> right?
>>>
>> No. It is instantiated.
>>
> Sorry, I don't understand. How many instances of videosink has my
> application?
>
> My code is like the following
>
> GstElement *m_player;
> GstElement *m_videosink;
>
> void open(char *filename)
> {
>   ...
>   m_player=gst_element_factory_make("playbin2","player");
>   m_videosink=gst_element_factory_make("directdrawsink","videosink");
>   g_object_set(m_player,"video-sink",m_videosink);
> ...
> }
>
> I don't call gst_object_unref(m_videosink) in the open().
> And even calls to this in close(), where I set m_player state to NULL and
> unref all objects, caused segmentation violations.
>
> I think, my application has one videosink instance. Right?

WHat I was saying is that as soon as you create an instance of an gstream
element, it is alive and thus can log to the debug log. It has nothing to do
wheter it has been added to a pipeline or not. Also passing your videosink to
playbin2 via the property does not *add* it to the pipeline. The graphviz dump
dumps all element in the given pipeline. It does not dump all instantiated
elemnts (imho that information is only available to your application).

Stefan

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: GST_DEBUG_BIN_TO_DOT_FILE doesn't show all elements.

wl2776
Administrator
Stefan Kost wrote
> I don't call gst_object_unref(m_videosink) in the open().
> And even calls to this in close(), where I set m_player state to NULL and
> unref all objects, caused segmentation violations.
>
> I think, my application has one videosink instance. Right?
What I was saying is that as soon as you create an instance of an gstream
element, it is alive and thus can log to the debug log. It has nothing to do
wheter it has been added to a pipeline or not.
Yes, you're right. I've forgot, that my application had the OnDraw handler, which called
gst_x_overlay_expose(GST_X_OVERLAY(m_videosink));
And this call was that causing the messages about no frame to draw in the debug window.

Stefan Kost wrote
Also passing your videosink to playbin2 via the property does not *add* it to the pipeline.
I doubt.
My application keeps a reference to the video-sink instance.
When I tried unreffing it in the destruction code, I got segmentation violations, looking very similar to double free-s.
Since that, I conclude that the call to gst_object_unref(m_player) also unreffed this instance.
Therefore, this video-sink was a part of the playbin2.

Stefan Kost wrote
The graphviz dump dumps all element in the given pipeline. It does not dump all instantiated
elements (imho that information is only available to your application).
I understand this. The macro is called _BIN_TO_DOT_FILE, that is it writes a bin.

PS. Ahha... About video-sink.
It dawned on me, that when I create an element with _factory_make, it doesn't have a parent, and its refcount == 0.
Just looked in the debugger, after I set "video-sink" property, m_videosink has a parent, but its refcount still 0.
Destruction of the playbin2 unrefs m_videosink along with all other elements, and since video-sinks's refcount is 0, it is destructed.
So, my application should also call gst_object_ref(m_videosink) and gst_object_unref(m_videosink), since it also keeps references to it.