[gst-devel] Start recording from a webcam already playing

Arnout Vandecappelle arnout at mind.be
Mon Feb 2 10:07:01 CET 2009


On Saturday 31 January 2009 18:41:31 Andoni Morales wrote:
> The 'reset' property must be setted to true just before dinamically linking
> the encoder tail or after linking it? 

 It must be set before the first buffer arrives that must be re-timestamped.  
In practice, that means before it is set to PAUSED.

> Is it possible to record various 
> segments in the same file using this method? I mean, for the first segment
> you set the base_time to 0, but if I want to encode another segment in the
> same file, by unliking the encoding tail and relinking it later, if I set
> the 'reset' property to TRUE this will reset the base_time to 0 again, when
> it should be setted to the elapsed time of the previous segment. 

 If you want to concatenate several pieces of stream with continuous 
timestamps, it indeed won't work.  There is anyway no way you can do the 
right thing there, since the first timestamp of the second piece has to be 'a 
bit' later than the last one of the first piece, but there's no way of 
knowing how much later (unless you have a known and fixed buffer rate).

 You best bet is to use the shift element from gentrans and calculate the 
offsets manually.


> One last 
> thing, if I pause the recording, by unlinking the encoding tail and setting
> its state to PAUSED, how do I send an EOS event to the muxer (which is not
> linked anymore) if I defenitively want to stop the recording?

 You have to push an EOS event either on an element or a pad, upstream from 
the muxer, in the tail you're unlinking.  Since you're blocking on a pad you 
have to take care it's downstream from the block, of course.  Also you have 
to make sure there are no more queues behind it, otherwise the EOS will be 
handled asynchronously which means you have to wait for an EOS message on the 
bus before you actually unlink and destroy the elements.

 I have a block callback that looks like this:

static void pipe_tail_replace_block_cb (GstPad *pad, gboolean blocked, 
gpointer user_data)
{
    if (!blocked)
    {
        error("pipe_tail_replace_cb called while not blocked!\n");
        free(user_data);
        return;
    }
    log_message("Pipe tail queue is blocked.\n");

    /* Close the output file by sending it an EOS.  That's the peer pad of
       the pad we're blocking on. Not the pad itself, that one is blocked! */
    gst_pad_send_event(GST_PAD_PEER(pad), gst_event_new_eos());

    /* Do the actual replacement in the main thread 
       (it accesses global variables). */
    g_idle_add(pipe_tail_replace_cb, user_data);
}


 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




More information about the gstreamer-devel mailing list