Hello...<br><br><div class="gmail_quote">On 29 July 2012 14:49, Rémi Denis-Courmont <span dir="ltr"><<a href="mailto:remi@remlab.net" target="_blank">remi@remlab.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Le dimanche 29 juillet 2012 16:30:15 Mark Lee, vous avez écrit :<br>
<div><div class="h5">> +/**<br>
> + * Can the media player record the current media?<br>
> + *<br>
> + * Media must be playing or buffering before it can be recorded.<br>
> + *<br>
> + * \param p_mi media player<br>
> + * \return non-zero if the media player can record, zero if it can not<br>
> + * \version LibVLC 2.1.0 or later<br>
> + */<br>
> +LIBVLC_API int libvlc_media_player_can_record( libvlc_media_player_t *p_mi<br>
> );<br>
<br>
</div></div>I don't see how that's supposed to work. How does the caller know when to call<br>
the function? How does the caller know that the state has not changed since it<br>
checked the result of the function? This function seems intrinsically broken<br>
by design.<br>
<div><div class="h5"></div></div></blockquote><div> </div><div>As to when: the caller could query this on receipt of a buffering or 
playing event. Similarly if an event like stopped or media changed is 
received then the caller would know the old state was no longer valid. 
Is that approach not acceptable?<br>
<br>As to the state changing: I did not expect that the state of this 
variable would change whilst the media was playing, but I suppose I 
don't know enough about vlc to be sure. <br><br>Anyway, do you think it is simply useless to include this function or should it be fixed somehow? <br>
 </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
> +<br>
> +/**<br>
> + * Set whether or not recording is enabled.<br>
> + *<br>
> + * Media must be buffering or playing before it can be recorded.<br>
> + *<br>
> + * Media will be saved to the appropriate media directory, for example<br>
> "~/Videos". The + * file will not be immediately available in that<br>
> directory until recording is finished. + *<br>
> + * Recording can be started and stopped on-the-fly once the media has<br>
> started playing, + * each time recording is stopped and restarted a new<br>
> file will be created. + *<br>
> + * Recording will be stopped when the media stops playing, and must be<br>
> explicitly enabled + * again to restart recording.<br>
> + *<br>
> + * Features such as next/previous chapter, set time or position and so on<br>
> are ineffective + * when recording is enabled.<br>
> + *<br>
> + * \param p_mi media player<br>
> + * \param i_record start recording if non-zero, stop recording if zero<br>
> + * \return zero on success, -1 on error<br>
> + * \version LibVLC 2.1.0 or later<br>
> + */<br>
> +LIBVLC_API int libvlc_media_player_set_record( libvlc_media_player_t<br>
> *p_mi, int i_record );<br>
<br>
</div></div>You can use 'bool' here.<br>
<div class="HOEnZb"><div class="h5"></div></div></blockquote><div><br>OK, I will change that.<br><br>I can submit a new patch, but I don't 
know what I can do about the prior contentious can_record() method apart
 from removing it from the patch.<br> 
<br>Maybe something similar to how is_seekable has been implemented is necessary and possible, a new recordable_changed event?<br><br>Thanks for the comments.<div class="yj6qo ajU"><div id=":10c" class="ajR" tabindex="0">
<img class="ajT" src="https://mail.google.com/mail/u/0/images/cleardot.gif"></div></div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">

> +<br>
> +/**<br>
> + * Get whether or not the media is currently being recorded.<br>
> + *<br>
> + * \param p_mi media player<br>
> + * \return non-zero if recording, zero if not<br>
> + * \version LibVLC 2.1.0 or later<br>
> + */<br>
> +LIBVLC_API int libvlc_media_player_get_record( libvlc_media_player_t *p_mi<br>
> ); +<br>
>  /** @} media_player */<br>
><br>
>  # ifdef __cplusplus<br>
> diff --git a/lib/libvlc.sym b/lib/libvlc.sym<br>
> index 974e04f..059471c 100644<br>
> --- a/lib/libvlc.sym<br>
> +++ b/lib/libvlc.sym<br>
> @@ -116,6 +116,7 @@ libvlc_media_new_from_input_item<br>
>  libvlc_media_parse<br>
>  libvlc_media_parse_async<br>
>  libvlc_media_player_can_pause<br>
> +libvlc_media_player_can_record<br>
>  libvlc_media_player_next_frame<br>
>  libvlc_media_player_event_manager<br>
>  libvlc_media_player_get_agl<br>
> @@ -129,6 +130,7 @@ libvlc_media_player_get_media<br>
>  libvlc_media_player_get_nsobject<br>
>  libvlc_media_player_get_position<br>
>  libvlc_media_player_get_rate<br>
> +libvlc_media_player_get_record<br>
>  libvlc_media_player_get_state<br>
>  libvlc_media_player_get_time<br>
>  libvlc_media_player_get_title<br>
> @@ -153,6 +155,7 @@ libvlc_media_player_set_media<br>
>  libvlc_media_player_set_nsobject<br>
>  libvlc_media_player_set_position<br>
>  libvlc_media_player_set_rate<br>
> +libvlc_media_player_set_record<br>
>  libvlc_media_player_set_time<br>
>  libvlc_media_player_set_title<br>
>  libvlc_media_player_set_xwindow<br>
> diff --git a/lib/media_player.c b/lib/media_player.c<br>
> index f30f184..4d93e42 100644<br>
> --- a/lib/media_player.c<br>
> +++ b/lib/media_player.c<br>
> @@ -1408,3 +1408,47 @@ void libvlc_media_player_next_frame(<br>
> libvlc_media_player_t *p_mi ) vlc_object_release( p_input_thread );<br>
>      }<br>
>  }<br>
> +<br>
> +int libvlc_media_player_can_record( libvlc_media_player_t *p_mi )<br>
> +{<br>
> +    input_thread_t *p_input_thread;<br>
> +    bool b_can_record;<br>
> +<br>
> +    p_input_thread = libvlc_get_input_thread( p_mi );<br>
> +    if( !p_input_thread )<br>
> +        return 0;<br>
> +<br>
> +    b_can_record = var_GetBool( p_input_thread, "can-record" );<br>
> +<br>
> +    vlc_object_release( p_input_thread );<br>
> +    return b_can_record;<br>
> +}<br>
> +<br>
> +int libvlc_media_player_set_record( libvlc_media_player_t *p_mi, int<br>
> i_record ) +{<br>
> +    input_thread_t *p_input_thread;<br>
> +<br>
> +    p_input_thread = libvlc_get_input_thread( p_mi );<br>
> +    if( !p_input_thread )<br>
> +        return -1;<br>
> +<br>
> +    var_SetBool( p_input_thread, "record", i_record );<br>
> +<br>
> +    vlc_object_release( p_input_thread );<br>
> +    return 0;<br>
> +}<br>
> +<br>
> +int libvlc_media_player_get_record( libvlc_media_player_t *p_mi )<br>
> +{<br>
> +    input_thread_t *p_input_thread;<br>
> +    bool b_record;<br>
> +<br>
> +    p_input_thread = libvlc_get_input_thread( p_mi );<br>
> +    if( !p_input_thread )<br>
> +        return 0;<br>
> +<br>
> +    b_record = var_GetBool( p_input_thread, "record" );<br>
> +<br>
> +    vlc_object_release( p_input_thread );<br>
> +    return b_record;<br>
> +}<br>
<br>
<br>
--<br>
</div></div><span class="HOEnZb"><font color="#888888">Rémi Denis-Courmont<br>
<a href="http://www.remlab.net/" target="_blank">http://www.remlab.net/</a><br>
<a href="http://fi.linkedin.com/in/remidenis" target="_blank">http://fi.linkedin.com/in/remidenis</a><br>
</font></span></blockquote></div><br>