[vlc-commits] es_out: add ES_OUT_VOUT_ADD_OVERLAY

Thomas Guillem git at videolan.org
Fri Jul 20 09:37:24 CEST 2018


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Jul 17 09:57:36 2018 +0200| [1e511f370e43362a50a7a0c0bf2e1749a93ea9d0] | committer: Thomas Guillem

es_out: add ES_OUT_VOUT_ADD_OVERLAY

This control allow demuxers to send subpicture_t directly to the vout of the
video es. This will be used by the bluray demuxer.

ES_OUT_VOUT_FLUSH allow to clear any subpictures previously sent via
ES_OUT_VOUT_ADD_OVERLAY.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1e511f370e43362a50a7a0c0bf2e1749a93ea9d0
---

 include/vlc_es_out.h         |  7 +++++++
 src/input/decoder.c          | 42 ++++++++++++++++++++++++++++++++++++++++++
 src/input/decoder.h          |  3 +++
 src/input/es_out.c           | 17 +++++++++++++++++
 src/input/es_out_timeshift.c | 15 +++++++++++++++
 5 files changed, 84 insertions(+)

diff --git a/include/vlc_es_out.h b/include/vlc_es_out.h
index 6fc28115bc..cad9d0567f 100644
--- a/include/vlc_es_out.h
+++ b/include/vlc_es_out.h
@@ -102,6 +102,13 @@ enum es_out_query_e
                                     arg2=vlc_mouse_event, arg3=void *(user_data),
                                     res=can fail */
 
+    ES_OUT_VOUT_ADD_OVERLAY, /* arg1= es_out_id_t* (video es),
+                              * arg2= subpicture_t *,
+                              * arg3= int * (channel id), res= can fail */
+
+    ES_OUT_VOUT_FLUSH_OVERLAY, /* arg1= es_out_id_t* (video es),
+                                * arg2= int (channel id), res= can fail */
+
     /* First value usable for private control */
     ES_OUT_PRIVATE_START = 0x10000,
 };
diff --git a/src/input/decoder.c b/src/input/decoder.c
index 9d066a4aff..4d9d42d36c 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -2481,3 +2481,45 @@ void input_DecoderSetVoutMouseEvent( decoder_t *dec, vlc_mouse_event mouse_event
 
     vlc_mutex_unlock( &owner->mouse_lock );
 }
+
+int input_DecoderAddVoutOverlay( decoder_t *dec, subpicture_t *sub,
+                                 int *channel )
+{
+    struct decoder_owner *owner = dec_get_owner( dec );
+    assert( dec->fmt_out.i_cat == VIDEO_ES );
+    assert( sub && channel );
+
+    vlc_mutex_lock( &owner->lock );
+
+    if( !owner->p_vout )
+    {
+        vlc_mutex_unlock( &owner->lock );
+        return VLC_EGENERIC;
+    }
+    sub->i_start = sub->i_stop = vlc_tick_now();
+    sub->i_channel = *channel = vout_RegisterSubpictureChannel( owner->p_vout );
+    sub->i_order = 0;
+    sub->b_ephemer = true;
+    vout_PutSubpicture( owner->p_vout, sub );
+
+    vlc_mutex_unlock( &owner->lock );
+    return VLC_SUCCESS;
+}
+
+int input_DecoderFlushVoutOverlay( decoder_t *dec, int channel )
+{
+    struct decoder_owner *owner = dec_get_owner( dec );
+    assert( dec->fmt_out.i_cat == VIDEO_ES );
+
+    vlc_mutex_lock( &owner->lock );
+
+    if( !owner->p_vout )
+    {
+        vlc_mutex_unlock( &owner->lock );
+        return VLC_EGENERIC;
+    }
+    vout_FlushSubpictureChannel( owner->p_vout, channel );
+
+    vlc_mutex_unlock( &owner->lock );
+    return VLC_SUCCESS;
+}
diff --git a/src/input/decoder.h b/src/input/decoder.h
index acf5ba7617..2da6eb78a2 100644
--- a/src/input/decoder.h
+++ b/src/input/decoder.h
@@ -119,4 +119,7 @@ void input_DecoderGetObjects( decoder_t *, vout_thread_t **, audio_output_t ** )
 
 void input_DecoderSetVoutMouseEvent( decoder_t *, vlc_mouse_event, void * );
 
+int  input_DecoderAddVoutOverlay( decoder_t *, subpicture_t *, int * );
+int  input_DecoderFlushVoutOverlay( decoder_t *, int );
+
 #endif
diff --git a/src/input/es_out.c b/src/input/es_out.c
index d437dd1b07..cc1ddb53c2 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -2941,6 +2941,23 @@ static int EsOutVaControlLocked( es_out_t *out, int i_query, va_list args )
 
         return VLC_SUCCESS;
     }
+    case ES_OUT_VOUT_ADD_OVERLAY:
+    {
+        es_out_id_t *p_es = va_arg( args, es_out_id_t * );
+        subpicture_t *sub = va_arg( args, subpicture_t * );
+        int *channel = va_arg( args, int * );
+        if( p_es && p_es->fmt.i_cat == VIDEO_ES && p_es->p_dec )
+            return input_DecoderAddVoutOverlay( p_es->p_dec, sub, channel );
+        return VLC_EGENERIC;
+    }
+    case ES_OUT_VOUT_FLUSH_OVERLAY:
+    {
+        es_out_id_t *p_es = va_arg( args, es_out_id_t * );
+        int channel = va_arg( args, int );
+        if( p_es && p_es->fmt.i_cat == VIDEO_ES && p_es->p_dec )
+            return input_DecoderFlushVoutOverlay( p_es->p_dec, channel );
+        return VLC_EGENERIC;
+    }
 
     default:
         msg_Err( p_sys->p_input, "unknown query 0x%x in %s", i_query,
diff --git a/src/input/es_out_timeshift.c b/src/input/es_out_timeshift.c
index 3795ac9d05..42d8584b2e 100644
--- a/src/input/es_out_timeshift.c
+++ b/src/input/es_out_timeshift.c
@@ -661,6 +661,21 @@ static int ControlLocked( es_out_t *p_out, int i_query, va_list args )
         return es_out_Control( p_sys->p_out, ES_OUT_VOUT_SET_MOUSE_EVENT,
                                p_es->p_es, cb, user_data );
     }
+    case ES_OUT_VOUT_ADD_OVERLAY:
+    {
+        es_out_id_t *p_es = va_arg( args, es_out_id_t * );
+        subpicture_t *sub = va_arg( args, subpicture_t * );
+        int *channel = va_arg( args, int * );
+        return es_out_Control( p_sys->p_out, ES_OUT_VOUT_ADD_OVERLAY,
+                               p_es->p_es, sub, channel );
+    }
+    case ES_OUT_VOUT_FLUSH_OVERLAY:
+    {
+        es_out_id_t *p_es = va_arg( args, es_out_id_t * );
+        int channel = va_arg( args, int );
+        return es_out_Control( p_sys->p_out, ES_OUT_VOUT_FLUSH_OVERLAY,
+                               p_es->p_es, channel );
+    }
     /* Special internal input control */
     case ES_OUT_GET_EMPTY:
     {



More information about the vlc-commits mailing list