unable to use bus events

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

unable to use bus events

florian iragne-2
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

i've made a little program to grab video from an ip camera. The problem
is that the pipeline won't stop, even if the EOS message is well sent (i
see it in the log).

My code is almost the same as the one provided in the hello wolrd
example of the documentation.

here you can find the relevant parts
#########################################################################
static gboolean bus_call ( GstBus* bus, GstMessage* msg, gpointer data ){
    GMainLoop* loop = ( GMainLoop* ) data;

    switch ( GST_MESSAGE_TYPE ( msg ) ){
    case GST_MESSAGE_EOS:
        g_print ( "End of stream\n" );
        g_main_loop_quit ( loop );
        break;
    case GST_MESSAGE_ERROR: {
        gchar* debug;
        GError* error;

        gst_message_parse_error ( msg, &error, &debug );
        g_free ( debug );

        g_printerr ( "Error: %s\n", error->message );
        g_error_free ( error );

        g_main_loop_quit ( loop );
        break;
    }
    default:
        break;
    }

    return true;
}

void* grabVideo( void* source ){
    char _gstCmd[ 1024 << 2 ];

    /* do the work */
    GMainLoop* loop;

    GstElement *pipeline, *src, *depay, *muxer, *sink;
    GstBus* bus;

    /* Initialisation */
    gst_init ( NULL, NULL );
  gst_debug_set_active (false);
    gst_debug_set_default_threshold (GST_LEVEL_INFO);

    loop = g_main_loop_new ( NULL, false );

    /* Create gstreamer elements */
    pipeline = gst_pipeline_new ( "video_recorder" );
    sprintf( _gstCmd,
             "rtspsrc location=\"%s\" ! queue2 ! rtph264depay
byte-stream=false !"
             " capsfilter
caps=\"video/x-h264,width=%d,height=%d,framerate=(fraction)25/1\" !"
             " ffmux_mp4 ! filesink location=%s",
             source, 768, 576, "/tmp/totototototot.mp4" );

    /* Set up the pipeline */

    /* we set the input filename to the source element */
    /* we add a message handler */
    bus = gst_pipeline_get_bus ( GST_PIPELINE ( pipeline ) );
    gst_bus_add_watch ( bus, bus_call, loop );
    gst_object_unref ( bus );

    /* we add all elements into the pipeline */
    pipeline = gst_parse_launch( _gstCmd, NULL );

    /* Set the pipeline to "playing" state*/
    g_print ( "Now playing: %s\n", _gstCmd );
    gst_element_set_state ( pipeline, GST_STATE_PLAYING );

    /* Iterate */
    g_print ( "Running...\n" );
    g_main_loop_run ( loop );

    /* Out of the main loop, clean up nicely */
    g_print ( "Returned, stopping playback\n" );
    gst_element_set_state ( pipeline, GST_STATE_NULL );

    g_print ( "Deleting pipeline\n" );
    gst_object_unref ( GST_OBJECT ( pipeline ) );

    return NULL;
}
######################################################################

thanks for your help

Florian
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkpDPesACgkQO8DE9K7b370jnwCglIVcRMm+zO8rCM4okbmoMONk
IVoAoNn5cgrm18ELOCDBUNvI8M3D1ZT4
=H3zN
-----END PGP SIGNATURE-----

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

Re: unable to use bus events

Tim-Philipp Müller-2
On Thu, 2009-06-25 at 11:05 +0200, florian iragne wrote:

Spot the problem:

>     pipeline = gst_pipeline_new ( "video_recorder" );
>     ...
>     bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
>     gst_bus_add_watch (bus, bus_call, loop);
>     ...
>     pipeline = gst_parse_launch( _gstCmd, NULL );

 Cheers
  -Tim



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

Re: unable to use bus events

florian iragne-2
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Tim-Philipp Müller a écrit :

> On Thu, 2009-06-25 at 11:05 +0200, florian iragne wrote:
>
> Spot the problem:
>
>>     pipeline = gst_pipeline_new ( "video_recorder" );
>>     ...
>>     bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
>>     gst_bus_add_watch (bus, bus_call, loop);
>>     ...
>>     pipeline = gst_parse_launch( _gstCmd, NULL );

thanks for the highlight!

i'm going to take a coffe and some sleep ... ;-)

cheers

- --
Florian Iragne
Directeur R&D

Viewsurf S.A.S.
16 rue du 8 mai 1945
Le Forum
33150 Cenon
Tel: 05.57.22.54.40
Fax: 05.56.08.22.62
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkpDXFAACgkQO8DE9K7b372nlACgv9JeP+TgiGsUNCjnbv3UWe4I
Ii8An0aFQhEEhyl2bBCkp5Ju+nqJLsxv
=gYlu
-----END PGP SIGNATURE-----

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

Re: unable to use bus events

E. Westbrook-4
Here's an idea...  any plans to turn it into a source element plugin when you've got it going? ;)

(Actually, now that I think of it, that's how I'd do it anyway if it were me, and it might well be in the future!)

I'm curious, if you don't mind:  What kind of ip camera(s) are you working with?  What kind of caps apply to the video transmission?  I plan to purchase a number of them over the next year for a surveillance application.

I'm working on a source element plugin right now for a capture card whose video format is proprietary (not my choice, as I inherited 600 channels worth of them in 22 capture servers) and therefore a bit difficult to inject into a gstreamer pipeline (which of course is required!).

Thanks,
E. Westbrook

On Thu, Jun 25, 2009 at 5:15 AM, florian iragne <[hidden email]> wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Tim-Philipp Müller a écrit :
> On Thu, 2009-06-25 at 11:05 +0200, florian iragne wrote:
>
> Spot the problem:
>
>>     pipeline = gst_pipeline_new ( "video_recorder" );
>>     ...
>>     bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
>>     gst_bus_add_watch (bus, bus_call, loop);
>>     ...
>>     pipeline = gst_parse_launch( _gstCmd, NULL );

thanks for the highlight!

i'm going to take a coffe and some sleep ... ;-)

cheers

- --
Florian Iragne
Directeur R&D

Viewsurf S.A.S.
16 rue du 8 mai 1945
Le Forum
33150 Cenon
Tel: 05.57.22.54.40
Fax: 05.56.08.22.62
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkpDXFAACgkQO8DE9K7b372nlACgv9JeP+TgiGsUNCjnbv3UWe4I
Ii8An0aFQhEEhyl2bBCkp5Ju+nqJLsxv
=gYlu
-----END PGP SIGNATURE-----

------------------------------------------------------------------------------
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel


------------------------------------------------------------------------------

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

Re: unable to use bus events

florian iragne-2
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

E. Westbrook a écrit :
> Here's an idea...  any plans to turn it into a source element plugin
> when you've got it going? ;)

the source element is rtsp, thus i don't need to create a new plugin, do i?

> I'm curious, if you don't mind:  What kind of ip camera(s) are you
> working with?  What kind of caps apply to the video transmission?  I
> plan to purchase a number of them over the next year for a surveillance
> application.

i'm testing several ip cameras currently, and the current is an Axis Q1755

Florian

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkpEXIIACgkQO8DE9K7b370o2QCgsleb9ZbJFN3UGJLmSuJ5/Sbd
HXsAoN5rBms4Q2SK3VCVctfOEHPU3jca
=e599
-----END PGP SIGNATURE-----

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

Re: unable to use bus events

E. Westbrook-4
On Thu, Jun 25, 2009 at 11:28 PM, florian iragne <[hidden email]> wrote:
the source element is rtsp, thus i don't need to create a new plugin, do i?

I didn't realize you were sourcing from a device with a standard protocol.  Sorry.
 
EW


------------------------------------------------------------------------------

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel