[vlc-commits] vlc_stream: Allow fetching the underlying item type

Hugo Beauzée-Luyssen git at videolan.org
Thu Sep 17 17:53:30 CEST 2020


vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Thu Sep 10 15:11:21 2020 +0200| [9f2933fcd0f1d568ba75a0faf6fe5d48f0b86a34] | committer: Hugo Beauzée-Luyssen

vlc_stream: Allow fetching the underlying item type

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

 include/vlc_demux.h  | 6 ++++++
 include/vlc_stream.h | 1 +
 src/input/input.c    | 8 ++++++++
 3 files changed, 15 insertions(+)

diff --git a/include/vlc_demux.h b/include/vlc_demux.h
index 5d67813fc0..eca3d0c6dd 100644
--- a/include/vlc_demux.h
+++ b/include/vlc_demux.h
@@ -119,6 +119,12 @@ enum demux_query_e
      * arg1=double *quality, arg2=double *strength */
     DEMUX_GET_SIGNAL = 0x107,
 
+    /** Retrieves the demuxed content type
+     * Can fail if the control is not implemented
+     *
+     * arg1= int* */
+    DEMUX_GET_TYPE = 0x109,
+
     /** Sets the paused or playing/resumed state.
      *
      * Streams are initially in playing state. The control always specifies a
diff --git a/include/vlc_stream.h b/include/vlc_stream.h
index bc6c0d30b7..5627545df5 100644
--- a/include/vlc_stream.h
+++ b/include/vlc_stream.h
@@ -168,6 +168,7 @@ enum stream_query_e
     STREAM_GET_CONTENT_TYPE,    /**< arg1= char **         res=can fail */
     STREAM_GET_SIGNAL,      /**< arg1=double *pf_quality, arg2=double *pf_strength   res=can fail */
     STREAM_GET_TAGS,        /**< arg1=const block_t ** res=can fail */
+    STREAM_GET_TYPE,        /**< arg1=int*             res=can fail */
 
     STREAM_SET_PAUSE_STATE = 0x200, /**< arg1= bool        res=can fail */
     STREAM_SET_TITLE,       /**< arg1= int          res=can fail */
diff --git a/src/input/input.c b/src/input/input.c
index 28de738f8a..73b52530aa 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -2791,6 +2791,14 @@ static int InputSourceInit( input_source_t *in, input_thread_t *p_input,
     if( demux_Control( in->p_demux, DEMUX_GET_FPS, &in->f_fps ) )
         in->f_fps = 0.f;
 
+    int input_type;
+    if( !demux_Control( in->p_demux, DEMUX_GET_TYPE, &input_type ) )
+    {
+        vlc_mutex_lock( &input_priv(p_input)->p_item->lock );
+        input_priv(p_input)->p_item->i_type = input_type;
+        vlc_mutex_unlock( &input_priv(p_input)->p_item->lock );
+    }
+
     if( var_GetInteger( p_input, "clock-synchro" ) != -1 )
         in->b_can_pace_control = !var_GetInteger( p_input, "clock-synchro" );
 



More information about the vlc-commits mailing list