[vlc-devel] [PATCH] Add new API to libvlc to record the current media to either an application-specified file or a file automatically created by vlc:

Mark Lee mark.lee at capricasoftware.co.uk
Thu Sep 6 10:22:00 CEST 2012


Hello,

On 6 September 2012 08:46, Rémi Denis-Courmont <remi at remlab.net> wrote:

> Le lundi 3 septembre 2012 19:52:18, Mark Lee a écrit :

>+int libvlc_media_player_record_stop( libvlc_media_player_t *p_mi )
> > +{
> > +    input_thread_t *p_input_thread;
> > +
> > +    p_input_thread = libvlc_get_input_thread( p_mi );
> > +    if( !p_input_thread )
> > +        return -1;
> > +
> > +    var_SetBool( p_input_thread, "record", false );
> > +
> > +    vlc_object_release( p_input_thread );
> > +    return 0;
> > +}
>
> I'm not sure it makes sense to have a return value here. How is the caller
> supposed to deal with a failure?
>

It was just an indication, trying to be consistent with other methods.
Trivial to remove it of course.


>  > diff --git a/modules/stream_out/record.c b/modules/stream_out/record.c
> > index de6d32e..40ddfea 100644
> > --- a/modules/stream_out/record.c
> > +++ b/modules/stream_out/record.c
> > @@ -172,6 +176,19 @@ static void Close( vlc_object_t * p_this )
> >      if( p_sys->p_out )
> >          sout_StreamChainDelete( p_sys->p_out, p_sys->p_out );
> >
> > +    if( p_sys->psz_record_file ) {
> > +        for( vlc_object_t *p_mp = p_stream->p_parent; p_mp; p_mp =
> > p_mp->p_parent )
> > +        {
> > +            if( var_Type( p_mp, "recording-finished" ) )
> > +            {
> > +                var_SetString( p_mp, "recording-finished",
> > p_sys->psz_record_file ); +                break;
> > +            }
> > +        }
> > +
> > +        free( p_sys->psz_record_file );
> > +    }
>
> Oh? That actually works? I thought the parent is the stream output instance
> (or the upstream stream out plugin) rather than the input thread...
>

It does work. You eventually (IIRC three iterations) get back to the libvlc
media player instance.


> That's not really the recommended way to provide callbacks.
>

OK, but I can't see any other way to link up the sout with the media player
so the media player knows the recording is finished. I couldn't find a way
for the media player to add a callback to the sout - i.e. I found no route
to get to the sout reference from the libvlc media player.

There's also a minor code-style error I spotted, which I would address with
a new patch, but maybe I'm now at a dead end with this.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20120906/06f81c34/attachment.html>


More information about the vlc-devel mailing list