<html><head></head><body>Hi,<br><br>I think this function sets the display ratio, not the sample ratio though.<br><br><div class="gmail_quote">Le 3 juin 2019 07:57:14 GMT+01:00, Steve Lhomme <robux4@ycbcr.xyz> a écrit :<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="k9mail">Using sample in the name is more accurate than just an "aspect ratio", even<br>though that's probably the one most people know.<hr> include/vlc/libvlc_media_player.h | 7 +++++--<br> lib/libvlc.sym | 2 +-<br> lib/video.c | 16 ++++++++++++----<br> 3 files changed, 18 insertions(+), 7 deletions(-)<br><br>diff --git a/include/vlc/libvlc_media_player.h b/include/vlc/libvlc_media_player.h<br>index 6ee926e362..8b8941c2de 100644<br>--- a/include/vlc/libvlc_media_player.h<br>+++ b/include/vlc/libvlc_media_player.h<br>@@ -1490,10 +1490,13 @@ LIBVLC_API void libvlc_video_set_scale( libvlc_media_player_t *p_mi, float f_fac<br> * Set new video aspect ratio.<br> *<br> * \param p_mi the media player<br>- * \param psz_aspect new video aspect-ratio or NULL to reset to default<br>+ * \param numerator new video aspect-ratio numerator or 0 to reset to default<br>+ * \param denominator new video aspect-ratio numerator or 0 to reset to default<br> * \note Invalid aspect ratios are ignored.<br> */<br>-LIBVLC_API void libvlc_video_set_aspect_ratio( libvlc_media_player_t *p_mi, const char *psz_aspect );<br>+LIBVLC_API void libvlc_video_set_sample_aspect_ratio( libvlc_media_player_t *p_mi,<br>+ unsigned numerator,<br>+ unsigned denominator );<br> <br> /**<br> * Create a video viewpoint structure.<br>diff --git a/lib/libvlc.sym b/lib/libvlc.sym<br>index 888c385a16..58c5221a47 100644<br>--- a/lib/libvlc.sym<br>+++ b/lib/libvlc.sym<br>@@ -234,7 +234,7 @@ libvlc_video_get_track_count<br> libvlc_video_get_track_description<br> libvlc_video_set_adjust_float<br> libvlc_video_set_adjust_int<br>-libvlc_video_set_aspect_ratio<br>+libvlc_video_set_sample_aspect_ratio<br> libvlc_video_set_callbacks<br> libvlc_video_set_crop_geometry<br> libvlc_video_set_deinterlace<br>diff --git a/lib/video.c b/lib/video.c<br>index e87ded45fc..fa6985c012 100644<br>--- a/lib/video.c<br>+++ b/lib/video.c<br>@@ -229,11 +229,18 @@ void libvlc_video_set_scale( libvlc_media_player_t *p_mp, float f_scale )<br> free (pp_vouts);<br> }<br> <br>-void libvlc_video_set_aspect_ratio( libvlc_media_player_t *p_mi,<br>- const char *psz_aspect )<br>+void libvlc_video_set_sample_aspect_ratio( libvlc_media_player_t *p_mi,<br>+ unsigned numerator,<br>+ unsigned denominator )<br> {<br>- if (psz_aspect == NULL)<br>- psz_aspect = "";<br>+ if (denominator == 0 || numerator == 0)<br>+ {<br>+ numerator = denominator = 0;<br>+ }<br>+<br>+ char *psz_aspect;<br>+ if (unlikely(asprintf(&psz_aspect, "%u:%u", numerator, denominator) == -1))<br>+ return;<br> var_SetString (p_mi, "aspect-ratio", psz_aspect);<br> <br> size_t n;<br>@@ -246,6 +253,7 @@ void libvlc_video_set_aspect_ratio( libvlc_media_player_t *p_mi,<br> vout_Release(p_vout);<br> }<br> free (pp_vouts);<br>+ free(psz_aspect);<br> }<br> <br> libvlc_video_viewpoint_t *libvlc_video_new_viewpoint(void)</pre></blockquote></div><br>-- <br>Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.</body></html>