<html><head></head><body>This API design looks much too simplistic/naive to be viable. Due to input resources, the mapping of ES to output can change. I also expect synchronization problems like François already pointed out.<br><br><div class="gmail_quote">Le 19 octobre 2018 15:19:25 GMT+03:00, Thomas Guillem <thomas@gllm.fr> 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">Useful when multiple video ESes are selected, in order to do an action on one<br>specific vout.<br><br>This could be used by the future player API.<hr> include/vlc_es.h | 23 +++++++++++++++++++++++<br> src/input/es_out.c | 37 ++++++++++++++++++++++++++++++++++++-<br> src/libvlccore.sym | 2 ++<br> 3 files changed, 61 insertions(+), 1 deletion(-)<br><br>diff --git a/include/vlc_es.h b/include/vlc_es.h<br>index c32fddb096..c0f4f85c15 100644<br>--- a/include/vlc_es.h<br>+++ b/include/vlc_es.h<br>@@ -717,4 +717,27 @@ vlc_es_id_GetInputId(vlc_es_id_t *id);<br> VLC_API enum es_format_category_e<br> vlc_es_id_GetCat(vlc_es_id_t *id);<br> <br>+/**<br>+ * Get the Vout used by this ES<br>+ *<br>+ * @param id pointer to the ES track id<br>+ *<br>+ * @return a valid Vout (to release with vlc_oject_release()) or NULL (if the<br>+ * ES is not selected, if it's not a VIDEO_ES or if the vout is not (yet)<br>+ * created).<br>+ */<br>+VLC_API vout_thread_t * vlc_es_id_GetVout(vlc_es_id_t *id);<br>+<br>+/**<br>+ * Get the Aout used by this ES<br>+ *<br>+ * @param id pointer to the ES track id<br>+ *<br>+ * @return a valid Aout (to release with vlc_oject_release()) or NULL (if the<br>+ * ES is not selected, if it's not a AUDIO_ES or if the aout is not (yet)<br>+ * created).<br>+ */<br>+VLC_API audio_output_t *<br>+vlc_es_id_GetAout(vlc_es_id_t *id);<br>+<br> #endif<br>diff --git a/src/input/es_out.c b/src/input/es_out.c<br>index 98f71b3ec0..a772934ce2 100644<br>--- a/src/input/es_out.c<br>+++ b/src/input/es_out.c<br>@@ -112,6 +112,7 @@ struct es_out_id_t<br> char *psz_title;<br> bool b_terminated;<br> <br>+ vlc_mutex_t dec_lock;<br> decoder_t *p_dec;<br> decoder_t *p_dec_record;<br> <br>@@ -407,6 +408,7 @@ static void EsRelease(es_out_id_t *es)<br> free(es->psz_language);<br> free(es->psz_language_code);<br> es_format_Clean(&es->fmt);<br>+ vlc_mutex_destroy(&es->dec_lock);<br> free(es);<br> }<br> }<br>@@ -1689,6 +1691,7 @@ static es_out_id_t *EsOutAddSlaveLocked( es_out_t *out, const es_format_t *fmt,<br> <br> vlc_list_append(&es->node, es->p_master ? &p_sys->es_slaves : &p_sys->es);<br> <br>+ vlc_mutex_init(&es->dec_lock);<br> vlc_atomic_rc_init(&es->rc);<br> <br> if( es->p_pgrm == p_sys->p_pgrm )<br>@@ -1761,7 +1764,9 @@ static void EsOutCreateDecoder( es_out_t *out, es_out_id_t *p_es )<br> input_DecoderSetVoutMouseEvent( dec, p_es->mouse_event_cb,<br> p_es->mouse_event_userdata );<br> }<br>+ vlc_mutex_lock(&p_es->dec_lock);<br> p_es->p_dec = dec;<br>+ vlc_mutex_unlock(&p_es->dec_lock);<br> <br> EsOutDecoderChangeDelay( out, p_es );<br> }<br>@@ -1772,8 +1777,12 @@ static void EsOutDestroyDecoder( es_out_t *out, es_out_id_t *p_es )<br> if( !p_es->p_dec )<br> return;<br> <br>- input_DecoderDelete( p_es->p_dec );<br>+ decoder_t *p_dec = p_es->p_dec;<br>+ vlc_mutex_lock( &p_es->dec_lock );<br> p_es->p_dec = NULL;<br>+ vlc_mutex_unlock( &p_es->dec_lock );<br>+<br>+ input_DecoderDelete( p_dec );<br> <br> if( p_es->p_dec_record )<br> {<br>@@ -3665,3 +3674,29 @@ vlc_es_id_GetCat(vlc_es_id_t *id)<br> {<br> return id->i_cat;<br> }<br>+<br>+vout_thread_t *<br>+vlc_es_id_GetVout(vlc_es_id_t *id)<br>+{<br>+ es_out_id_t *es = vlc_es_id_get_out(id);<br>+<br>+ vlc_mutex_lock(&es->dec_lock);<br>+ vout_thread_t *vout = NULL;<br>+ if (es->p_dec)<br>+ input_DecoderGetObjects(es->p_dec, &vout, NULL);<br>+ vlc_mutex_unlock(&es->dec_lock);<br>+ return vout;<br>+}<br>+<br>+audio_output_t *<br>+vlc_es_id_GetAout(vlc_es_id_t *id)<br>+{<br>+ es_out_id_t *es = vlc_es_id_get_out(id);<br>+<br>+ vlc_mutex_lock(&es->dec_lock);<br>+ audio_output_t *aout = NULL;<br>+ if (es->p_dec)<br>+ input_DecoderGetObjects(es->p_dec, NULL, &aout);<br>+ vlc_mutex_unlock(&es->dec_lock);<br>+ return aout;<br>+}<br>diff --git a/src/libvlccore.sym b/src/libvlccore.sym<br>index a4ba469b14..bf3d341abe 100644<br>--- a/src/libvlccore.sym<br>+++ b/src/libvlccore.sym<br>@@ -785,3 +785,5 @@ vlc_es_id_Hold<br> vlc_es_id_Release<br> vlc_es_id_GetInputId<br> vlc_es_id_GetCat<br>+vlc_es_id_GetAout<br>+vlc_es_id_GetVout</pre></blockquote></div><br>-- <br>Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.</body></html>