Does "about-to-finish" signal work for video files?

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

Does "about-to-finish" signal work for video files?

rossana
Hello everyone, I am trying to solve the gapless issue programming the event triggered for that signal. I am handling video files (.avi)
The code is very straightforward andn simple, nonetheless it doesn't work.
It plays the first and for the second one it throws the following message:

(playbin:4324): GLib-GObject-CRITICAL **: g_object_set: assertion `G_IS_OBJECT (object)' failed

Any suggestion? thansks

Rossana

Here is the code:


void about_to_finish_cb (GstElement * element, gpointer * uri)
{
   // uri has the name of the next avi file

    gchar* uri2 = (gchar*)uri;
    g_object_set (G_OBJECT (element), "uri",uri2, NULL);
    g_object_set (G_OBJECT (element), "suburi","file:///home/rossana/video3.srt", NULL);
 
}

gint main (gint argc, gchar *argv[])
{
    GMainLoop *loop = 0;
    GstElement *play = 0;
    GstBus *bus = 0;   
   

    /* set up */
    gst_init (&argc, &argv);

    loop = g_main_loop_new (NULL, FALSE);
    play = gst_element_factory_make ("playbin2", "play");

    g_object_set (G_OBJECT (play), "uri","file:///home/rossana/video1.avi", NULL);

    bus = gst_pipeline_get_bus (GST_PIPELINE (play));
    gst_bus_add_watch (bus, bus_call, loop);
    gst_object_unref (bus);

    char uri_next[] = "file:///home/rossana/video3.avi";
    g_signal_connect (play, "about-to-finish", G_CALLBACK (about_to_finish_cb),uri_next);
    gst_element_set_state (play, GST_STATE_PLAYING);

    /* now run */
    g_main_loop_run (loop);

    /* also clean up */
    gst_element_set_state (play, GST_STATE_NULL);
    gst_object_unref (GST_OBJECT (play));

    return 0;
}



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

Re: Does "about-to-finish" signal work for video files?

Stefan Sauer
Am 24.02.2012 00:41, schrieb Rossana Guerra:
> Hello everyone, I am trying to solve the gapless issue programming the event
> triggered for that signal. I am handling video files (.avi)
> The code is very straightforward andn simple, nonetheless it doesn't work.
> It plays the first and for the second one it throws the following message:
>
> (playbin:4324): GLib-GObject-CRITICAL **: g_object_set: assertion `G_IS_OBJECT
> (object)' failed

run your app as
G_DEBUG="fatal_critials" gdb --args ./myapp <options>

this will terminate the app on that error. WHen that happend type "bt" to get a
backtrace and you see where the error happend.

Stefan

>
> Any suggestion? thansks
>
> Rossana
>
> Here is the code:
>
>
> void about_to_finish_cb (GstElement * element, gpointer * uri)
> {
>    // uri has the name of the next avi file
>
>     gchar* uri2 = (gchar*)uri;
>     g_object_set (G_OBJECT (element), "uri",uri2, NULL);
>     g_object_set (G_OBJECT (element),
> "suburi","file:///home/rossana/video3.srt", NULL);
>  
> }
>
> gint main (gint argc, gchar *argv[])
> {
>     GMainLoop *loop = 0;
>     GstElement *play = 0;
>     GstBus *bus = 0;  
>    
>
>     /* set up */
>     gst_init (&argc, &argv);
>
>     loop = g_main_loop_new (NULL, FALSE);
>     play = gst_element_factory_make ("playbin2", "play");
>
>     g_object_set (G_OBJECT (play), "uri","file:///home/rossana/video1.avi", NULL);
>
>     bus = gst_pipeline_get_bus (GST_PIPELINE (play));
>     gst_bus_add_watch (bus, bus_call, loop);
>     gst_object_unref (bus);
>
>     char uri_next[] = "file:///home/rossana/video3.avi";
>     g_signal_connect (play, "about-to-finish", G_CALLBACK
> (about_to_finish_cb),uri_next);
>     gst_element_set_state (play, GST_STATE_PLAYING);
>
>     /* now run */
>     g_main_loop_run (loop);
>
>     /* also clean up */
>     gst_element_set_state (play, GST_STATE_NULL);
>     gst_object_unref (GST_OBJECT (play));
>
>     return 0;
> }
>
>
>
>
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

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

Re: Does "about-to-finish" signal work for video files?

rossana
thanks, I'll respond as soon as I try.
Cheers

Rossana

2012/2/26 Stefan Kost <[hidden email]>:

> Am 24.02.2012 00:41, schrieb Rossana Guerra:
>> Hello everyone, I am trying to solve the gapless issue programming the event
>> triggered for that signal. I am handling video files (.avi)
>> The code is very straightforward andn simple, nonetheless it doesn't work.
>> It plays the first and for the second one it throws the following message:
>>
>> (playbin:4324): GLib-GObject-CRITICAL **: g_object_set: assertion `G_IS_OBJECT
>> (object)' failed
>
> run your app as
> G_DEBUG="fatal_critials" gdb --args ./myapp <options>
>
> this will terminate the app on that error. WHen that happend type "bt" to get a
> backtrace and you see where the error happend.
>
> Stefan
>
>>
>> Any suggestion? thansks
>>
>> Rossana
>>
>> Here is the code:
>>
>>
>> void about_to_finish_cb (GstElement * element, gpointer * uri)
>> {
>>    // uri has the name of the next avi file
>>
>>     gchar* uri2 = (gchar*)uri;
>>     g_object_set (G_OBJECT (element), "uri",uri2, NULL);
>>     g_object_set (G_OBJECT (element),
>> "suburi","file:///home/rossana/video3.srt", NULL);
>>
>> }
>>
>> gint main (gint argc, gchar *argv[])
>> {
>>     GMainLoop *loop = 0;
>>     GstElement *play = 0;
>>     GstBus *bus = 0;
>>
>>
>>     /* set up */
>>     gst_init (&argc, &argv);
>>
>>     loop = g_main_loop_new (NULL, FALSE);
>>     play = gst_element_factory_make ("playbin2", "play");
>>
>>     g_object_set (G_OBJECT (play), "uri","file:///home/rossana/video1.avi", NULL);
>>
>>     bus = gst_pipeline_get_bus (GST_PIPELINE (play));
>>     gst_bus_add_watch (bus, bus_call, loop);
>>     gst_object_unref (bus);
>>
>>     char uri_next[] = "file:///home/rossana/video3.avi";
>>     g_signal_connect (play, "about-to-finish", G_CALLBACK
>> (about_to_finish_cb),uri_next);
>>     gst_element_set_state (play, GST_STATE_PLAYING);
>>
>>     /* now run */
>>     g_main_loop_run (loop);
>>
>>     /* also clean up */
>>     gst_element_set_state (play, GST_STATE_NULL);
>>     gst_object_unref (GST_OBJECT (play));
>>
>>     return 0;
>> }
>>
>>
>>
>>
>> _______________________________________________
>> gstreamer-devel mailing list
>> [hidden email]
>> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Does "about-to-finish" signal work for video files?

forestzhu
Hi Rossana ,
I ever met the same issue.
It turns to be the bug of video-sink.

FYI:
You 'd better change the uri in the main thread,
and add change state READY ,change state PLAYING around it.

Forrest
Reply | Threaded
Open this post in threaded view
|

Re: Does "about-to-finish" signal work for video files?

rossana
Hi, yes, the bug issue Stephan suggested didn't help so much, bund of code hard to see.

Forrest, could you give me an example please? I don't get it.

Thanks and regards

Rossana

2012/2/27 forestzhu <[hidden email]>
Hi Rossana ,
I ever met the same issue.
It turns to be the bug of video-sink.

FYI:
You 'd better change the uri in the main thread,
and add change state READY ,change state PLAYING around it.

Forrest

--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Does-about-to-finish-signal-work-for-video-files-tp4415640p4424110.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


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

Re: Does "about-to-finish" signal work for video files?

forestzhu
Hi Rossana,
My method is a temporary solution.
You should push the plugin-developer to fix the  bug.

1.Build a listening thread in the main process before build the pipeline
2.In the "about-to-finish" signal handle send a message to the listening thread.
3.In the listening thread change the uri of playbin2.

static void player_change_uri (PLAYER *player)
{
  gst_element_set_state(player->pipeline,GST_STATE_READY);
        g_object_set (player->pipeline, "uri", get_new_uri(), NULL);
        gst_element_set_state(player->pipeline,GST_STATE_PLAYING);    
}

Regards!

forrest
Reply | Threaded
Open this post in threaded view
|

Re: Does "about-to-finish" signal work for video files?

rossana
Hi, thanks for the response, interesting tip. I´ll need to work around a little in some concepts before trying it.
Cheers!

Rossana


2012/2/28 forestzhu <[hidden email]>
Hi Rossana,
My method is a temporary solution.
You should push the plugin-developer to fix the  bug.

1.Build a listening thread in the main process before build the pipeline
2.In the "about-to-finish" signal handle send a message to the listening
thread.
3.In the listening thread change the uri of playbin2.

static void player_change_uri (PLAYER *player)
{
       gst_element_set_state(player->pipeline,GST_STATE_READY);
       g_object_set (player->pipeline, "uri", get_new_uri(), NULL);
       gst_element_set_state(player->pipeline,GST_STATE_PLAYING);
}

Regards!

forrest

--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Does-about-to-finish-signal-work-for-video-files-tp4415640p4426702.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


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