<p dir="ltr"></p>
<p dir="ltr">Le 13 sept. 2016 16:57, "Rémi Denis-Courmont" <<a href="mailto:remi@remlab.net">remi@remlab.net</a>> a écrit :<br>
><br>
> Le vendredi 9 septembre 2016, 09:37:28 Steve Lhomme a écrit :<br>
> > On Thu, Sep 8, 2016 at 5:50 PM, Rémi Denis-Courmont <<a href="mailto:remi@remlab.net">remi@remlab.net</a>> wrote:<br>
> > > Le jeudi 8 septembre 2016, 17:35:30 Steve Lhomme a écrit :<br>
> > >> ---<br>
> > >><br>
> > >> include/vlc/libvlc_media_player.h | 28 ++++++++++++++++++++++++++++<br>
> > >> lib/media_player.c | 3 +++<br>
> > >> lib/video.c | 37<br>
> > >><br>
> > >> +++++++++++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+)<br>
> > >><br>
> > >> diff --git a/include/vlc/libvlc_media_player.h<br>
> > >> b/include/vlc/libvlc_media_player.h index 2718a33..222b25a 100644<br>
> > >> --- a/include/vlc/libvlc_media_player.h<br>
> > >> +++ b/include/vlc/libvlc_media_player.h<br>
> > >> @@ -104,6 +104,16 @@ typedef struct libvlc_audio_output_device_t<br>
> > >><br>
> > >> } libvlc_audio_output_device_t;<br>
> > >><br>
> > >> /**<br>
> > >><br>
> > >> + * Viewpoint for video outputs<br>
> > >> + */<br>
> > >> +typedef struct libvlc_video_viewpoint_t<br>
> > >> +{<br>
> > >> + float f_yaw; /**< view point yaw in degrees ]-180;180] */<br>
> > >> + float f_pitch; /**< view point pitch in degrees ]-180;180] */<br>
> > >> + float f_roll; /**< view point roll in degrees ]-180;180] */<br>
> > >> +} libvlc_video_viewpoint_t;<br>
> > >> +<br>
> > >> +/**<br>
> > >><br>
> > >> * Marq options definition<br>
> > >> */<br>
> > >><br>
> > >> typedef enum libvlc_video_marquee_option_t {<br>
> > >><br>
> > >> @@ -1127,6 +1137,24 @@ LIBVLC_API char *libvlc_video_get_aspect_ratio(<br>
> > >> libvlc_media_player_t *p_mi ); LIBVLC_API void<br>
> > >> libvlc_video_set_aspect_ratio( libvlc_media_player_t *p_mi, const char<br>
> > >> *psz_aspect );<br>
> > >><br>
> > >> /**<br>
> > >><br>
> > >> + * Get current video viewpoint.<br>
> > >> + *<br>
> > >> + * \param p_mi the media player<br>
> > >> + * \return the video viewpoint or NULL if unspecified<br>
> > >> + * (the result must be released with free() or libvlc_free()).<br>
> > >> + */<br>
> > >> +LIBVLC_API libvlc_video_viewpoint_t *libvlc_video_get_viewpoint(<br>
> > >> libvlc_media_player_t *p_mi ); +<br>
> > >> +/**<br>
> > >> + * Set new video viewpoint information.<br>
> > >> + *<br>
> > >> + * \param p_mi the media player<br>
> > >> + * \param psz_aspect new video viewpoint or NULL to reset to default<br>
> > >> + */<br>
> > >> +LIBVLC_API void libvlc_video_set_viewpoint( libvlc_media_player_t *p_mi,<br>
> > >> + const<br>
> > >> libvlc_video_viewpoint_t<br>
> > >> *p_viewpoint ); +<br>
> > >> +/**<br>
> > >><br>
> > >> * Get current video subtitle.<br>
> > >> *<br>
> > >> * \param p_mi the media player<br>
> > >><br>
> > >> diff --git a/lib/media_player.c b/lib/media_player.c<br>
> > >> index 69d3523..197c9be 100644<br>
> > >> --- a/lib/media_player.c<br>
> > >> +++ b/lib/media_player.c<br>
> > >> @@ -640,6 +640,9 @@ libvlc_media_player_new( libvlc_instance_t *instance<br>
> > >> )<br>
> > >><br>
> > >> var_Create (mp, "zoom", VLC_VAR_FLOAT | VLC_VAR_DOINHERIT);<br>
> > >> var_Create (mp, "aspect-ratio", VLC_VAR_STRING);<br>
> > >> var_Create (mp, "crop", VLC_VAR_STRING);<br>
> > >><br>
> > >> + var_Create (mp, "viewpoint-yaw", VLC_VAR_FLOAT | VLC_VAR_DOINHERIT);<br>
> > >> + var_Create (mp, "viewpoint-pitch", VLC_VAR_FLOAT |<br>
> > >> VLC_VAR_DOINHERIT);<br>
> > >> + var_Create (mp, "viewpoint-roll", VLC_VAR_FLOAT |<br>
> > >> VLC_VAR_DOINHERIT);<br>
> > >><br>
> > >> var_Create (mp, "deinterlace", VLC_VAR_INTEGER);<br>
> > >> var_Create (mp, "deinterlace-mode", VLC_VAR_STRING);<br>
> > >><br>
> > >> diff --git a/lib/video.c b/lib/video.c<br>
> > >> index b2c9b34..bee4e6d 100644<br>
> > >> --- a/lib/video.c<br>
> > >> +++ b/lib/video.c<br>
> > >> @@ -281,6 +281,43 @@ void libvlc_video_set_aspect_ratio(<br>
> > >> libvlc_media_player_t *p_mi, free (pp_vouts);<br>
> > >><br>
> > >> }<br>
> > >><br>
> > >> +libvlc_video_viewpoint_t *libvlc_video_get_viewpoint(<br>
> > >> libvlc_media_player_t *p_mi )<br>
> > >> +{<br>
> > >> + libvlc_video_viewpoint_t *p_viewpoint =<br>
> > >> malloc(sizeof(libvlc_video_viewpoint_t));<br>
> > >> + if (p_viewpoint == NULL)<br>
> > >> + return NULL;<br>
> > ><br>
> > > If you want to be able to expand the structure later, this is not enough<br>
> > > due to libvlc_video_set_viewpoint. And if you don't care, then malloc()<br>
> > > seems overkill.<br>
> ><br>
> > I don't understand the issue. You mean expand the structure and remain<br>
> > libvlc ABI backward compatible ? Is that something we're trying to<br>
> > achieve ? Also if you expand the structure more memory is allocated<br>
> > but it's still the same free() that has to be used and should know<br>
> > about it.<br>
><br>
> I don't understand what there is to not understand here.<br>
><br>
> Either we want the possibility to extend the structure later, and the patch is</p>
<p dir="ltr">Which I did locally with no issue. Adding elements at the end of a structure will not break backward compatibility. </p>
<p dir="ltr">> wrong. Or we don't and the patch is over-engineered/needlessly complicated.</p>
<p dir="ltr">We do and there is no issue.</p>
<p dir="ltr">> ><br>
> > Do you suggest using a get for each of the 3 values ? The viewpoint<br>
> > will still has to be set with all values at once otherwise you'll end<br>
> > up with weird transitions between states. And if it's not via a<br>
> > structure than adding a value will break backward compatibility<br>
> > anyway.<br>
> ><br>
> > >> +<br>
> > >> + p_viewpoint->f_yaw = var_GetFloat( p_mi,"viewpoint-yaw" );<br>
> > >> + p_viewpoint->f_pitch = var_GetFloat( p_mi,"viewpoint-pitch" );<br>
> > >> + p_viewpoint->f_roll = var_GetFloat( p_mi,"viewpoint-roll" );<br>
> > >> + return p_viewpoint;<br>
> > >> +}<br>
> > >> +<br>
> > >> +void libvlc_video_set_viewpoint( libvlc_media_player_t *p_mi,<br>
> > >> + const libvlc_video_viewpoint_t<br>
> > >> *p_viewpoint ) +{<br>
> > >> + if (p_viewpoint == NULL)<br>
> > >> + return;<br>
> > >> +<br>
> > >> + var_SetFloat(p_mi, "viewpoint-yaw", p_viewpoint->f_yaw);<br>
> > >> + var_SetFloat(p_mi, "viewpoint-pitch", p_viewpoint->f_pitch);<br>
> > >> + var_SetFloat(p_mi, "viewpoint-roll", p_viewpoint->f_roll);<br>
> > >> +<br>
> > >> + char psz_viewpoint[3 * 13];<br>
> > >> + sprintf( psz_viewpoint, "%.7f:%.7f:%.7f",<br>
> > >> + p_viewpoint->f_yaw, p_viewpoint->f_pitch,<br>
> > >> p_viewpoint->f_roll<br>
> > >> ); + size_t n;<br>
> > >> + vout_thread_t **pp_vouts = GetVouts (p_mi, &n);<br>
> > >> + for (size_t i = 0; i < n; i++)<br>
> > >> + {<br>
> > >> + vout_thread_t *p_vout = pp_vouts[i];<br>
> > >> +<br>
> > >> + var_SetString (p_vout, "viewpoint", psz_viewpoint);<br>
> > >> + vlc_object_release (p_vout);<br>
> > >> + }<br>
> > >> + free (pp_vouts);<br>
> > >> +}<br>
> > >> +<br>
> > >><br>
> > >> int libvlc_video_get_spu( libvlc_media_player_t *p_mi )<br>
> > >> {<br>
> > >><br>
> > >> input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi );<br>
> > ><br>
> > > --<br>
> > > Rémi Denis-Courmont<br>
> > > <a href="http://www.remlab.net/">http://www.remlab.net/</a><br>
> > ><br>
> > > _______________________________________________<br>
> > > vlc-devel mailing list<br>
> > > To unsubscribe or modify your subscription options:<br>
> > > <a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a><br>
> ><br>
> > _______________________________________________<br>
> > vlc-devel mailing list<br>
> > To unsubscribe or modify your subscription options:<br>
> > <a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a><br>
><br>
> --<br>
> Rémi Denis-Courmont<br>
> <a href="http://www.remlab.net/">http://www.remlab.net/</a><br>
><br>
> _______________________________________________<br>
> vlc-devel mailing list<br>
> To unsubscribe or modify your subscription options:<br>
> <a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a><br></p>