<html><head></head><body>That's a catch-22 requirement. I can't do the transition without this patch.<br><br><div class="gmail_quote">Le 20 avril 2020 08:49:23 GMT+03: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">It seems to just double the code to do something. What is the use for that ?<br>Maybe it's better to wait until we have some real examples that use it <br>before merging.<br><br>On 2020-04-19 13:27, Rémi Denis-Courmont wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;"><hr> include/vlc_sout.h | 42 ++++++++++++++++++++++++++-----<br> src/stream_output/stream_output.c | 1 +<br> 2 files changed, 37 insertions(+), 6 deletions(-)<br><br>diff --git a/include/vlc_sout.h b/include/vlc_sout.h<br>index 9b9c898cfc..a6fcf2b028 100644<br>--- a/include/vlc_sout.h<br>+++ b/include/vlc_sout.h<br>@@ -188,6 +188,14 @@ enum sout_stream_query_e {<br> SOUT_STREAM_ID_SPU_HIGHLIGHT, /* arg1=void *, arg2=const vlc_spu_highlight_t *, res=can fail */<br> };<br> <br>+struct sout_stream_operations {<br>+ void *(*add)(sout_stream_t *, const es_format_t *);<br>+ void (*del)(sout_stream_t *, void *);<br>+ int (*send)(sout_stream_t *, void *, block_t *);<br>+ int (*control)( sout_stream_t *, int, va_list );<br>+ void (*flush)( sout_stream_t *, void *);<br>+};<br>+<br> struct sout_stream_t<br> {<br> struct vlc_object_t obj;<br>@@ -199,6 +207,8 @@ struct sout_stream_t<br> config_chain_t *p_cfg;<br> sout_stream_t *p_next;<br> <br>+ const struct sout_stream_operations *ops;<br>+<br> /* add, remove a stream */<br> void *(*pf_add)( sout_stream_t *, const es_format_t * );<br> void (*pf_del)( sout_stream_t *, void * );<br>@@ -218,31 +228,51 @@ VLC_API sout_stream_t *sout_StreamChainNew(sout_instance_t *p_sout,<br> static inline void *sout_StreamIdAdd( sout_stream_t *s,<br> const es_format_t *fmt )<br> {<br>- return s->pf_add( s, fmt );<br>+ if (s->ops == NULL)<br>+ return s->pf_add(s, fmt);<br>+ return s->ops->add(s, fmt);<br> }<br> <br> static inline void sout_StreamIdDel( sout_stream_t *s,<br> void *id )<br> {<br>- s->pf_del( s, id );<br>+ if (s->ops == NULL) {<br>+ s->pf_del(s, id);<br>+ return;<br>+ }<br>+ s->ops->del(s, id);<br> }<br> <br> static inline int sout_StreamIdSend( sout_stream_t *s,<br> void *id, block_t *b )<br> {<br>- return s->pf_send( s, id, b );<br>+ if (s->ops == NULL)<br>+ return s->pf_send(s, id, b);<br>+ return s->ops->send(s, id, b);<br> }<br> <br> static inline void sout_StreamFlush( sout_stream_t *s,<br> void *id )<br> {<br>- if (s->pf_flush)<br>- s->pf_flush( s, id );<br>+ if (s->ops == NULL) {<br>+ if (s->pf_flush != NULL)<br>+ s->pf_flush(s, id);<br>+ return;<br>+ }<br>+ if (s->ops->flush != NULL)<br>+ s->ops->flush(s, id);<br> }<br> <br> static inline int sout_StreamControlVa( sout_stream_t *s, int i_query, va_list args )<br> {<br>- return s->pf_control ? s->pf_control( s, i_query, args ) : VLC_EGENERIC;<br>+ if (s->ops == NULL) {<br>+ if (s->pf_control == NULL)<br>+ return VLC_EGENERIC;<br>+ return s->pf_control(s, i_query, args);<br>+ }<br>+ if (s->ops->control == NULL)<br>+ return VLC_EGENERIC;<br>+ return s->ops->control(s, i_query, args);<br> }<br> <br> static inline int sout_StreamControl( sout_stream_t *s, int i_query, ... )<br>diff --git a/src/stream_output/stream_output.c b/src/stream_output/stream_output.c<br>index a89b6601c5..524b1a65ca 100644<br>--- a/src/stream_output/stream_output.c<br>+++ b/src/stream_output/stream_output.c<br>@@ -810,6 +810,7 @@ static sout_stream_t *sout_StreamNew( sout_instance_t *p_sout, char *psz_name,<br> p_stream->psz_name = psz_name;<br> p_stream->p_cfg = p_cfg;<br> p_stream->p_next = p_next;<br>+ p_stream->ops = NULL;<br> p_stream->pf_flush = NULL;<br> p_stream->pf_control = NULL;<br> p_stream->pace_nocontrol = false;<br>-- <br>2.26.1<hr>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></blockquote><hr>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></pre></blockquote></div><br>-- <br>Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.</body></html>