[vlc-commits] [Git][videolan/vlc][master] 5 commits: es_out: avoid static const forward declarations

Steve Lhomme (@robUx4) gitlab at videolan.org
Tue Feb 28 09:35:02 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
5c96e6c5 by Steve Lhomme at 2023-02-28T09:06:57+00:00
es_out: avoid static const forward declarations

No functional changes.

- - - - -
7e43a19a by Steve Lhomme at 2023-02-28T09:06:57+00:00
es_out_timeshift: avoid static const forward declarations

No functional changes.

- - - - -
f16b63f7 by Steve Lhomme at 2023-02-28T09:06:57+00:00
es_out_timeshift: avoid forward declaration of GetTmpFile

- - - - -
caca6ffb by Steve Lhomme at 2023-02-28T09:06:57+00:00
input: don't compile local ControlInsertDemuxFilter without sout support

Just as the function above, it's never called in that case.

- - - - -
58900685 by Steve Lhomme at 2023-02-28T09:06:57+00:00
http: remove uneeded cast

psz_meta is already a char*

- - - - -


4 changed files:

- modules/access/http.c
- src/input/es_out.c
- src/input/es_out_timeshift.c
- src/input/input.c


Changes:

=====================================
modules/access/http.c
=====================================
@@ -491,7 +491,7 @@ static int ReadICYMeta( stream_t *p_access )
 
     /* Now parse the meta */
     /* Look for StreamTitle= */
-    p = strcasestr( (char *)psz_meta, "StreamTitle=" );
+    p = strcasestr( psz_meta, "StreamTitle=" );
     if( p )
     {
         p += strlen( "StreamTitle=" );


=====================================
src/input/es_out.c
=====================================
@@ -530,61 +530,6 @@ static void EsOutPropsInit( es_out_es_props_t *p_props,
     }
 }
 
-static const struct es_out_callbacks es_out_cbs;
-
-/*****************************************************************************
- * input_EsOutNew:
- *****************************************************************************/
-es_out_t *input_EsOutNew( input_thread_t *p_input, input_source_t *main_source, float rate,
-                          enum input_type input_type )
-{
-    es_out_sys_t *p_sys = calloc( 1, sizeof( *p_sys ) );
-    if( !p_sys )
-        return NULL;
-
-    p_sys->out.cbs = &es_out_cbs;
-
-    vlc_mutex_init( &p_sys->lock );
-    p_sys->p_input = p_input;
-    p_sys->main_source = main_source;
-
-    p_sys->b_active = false;
-    p_sys->p_next_frame_es = NULL;
-    p_sys->i_mode   = ES_OUT_MODE_NONE;
-    p_sys->input_type = input_type;
-
-    vlc_list_init(&p_sys->programs);
-    vlc_list_init(&p_sys->es);
-    vlc_list_init(&p_sys->es_slaves);
-
-    /* */
-    EsOutPropsInit( &p_sys->video, true, p_input, input_type,
-                    ES_OUT_ES_POLICY_AUTO,
-                    "video-track-id", "video-track", NULL, NULL );
-    EsOutPropsInit( &p_sys->audio, true, p_input, input_type,
-                    ES_OUT_ES_POLICY_EXCLUSIVE,
-                    "audio-track-id", "audio-track", "audio-language", "audio" );
-    EsOutPropsInit( &p_sys->sub,  false, p_input, input_type,
-                    ES_OUT_ES_POLICY_AUTO,
-                    "sub-track-id", "sub-track", "sub-language", "sub" );
-
-    p_sys->cc_decoder = var_InheritInteger( p_input, "captions" );
-
-    p_sys->i_group_id = var_GetInteger( p_input, "program" );
-
-    p_sys->user_clock_source = clock_source_Inherit( VLC_OBJECT(p_input) );
-
-    p_sys->i_pause_date = -1;
-
-    p_sys->rate = rate;
-
-    p_sys->b_buffering = true;
-    p_sys->i_preroll_end = -1;
-    p_sys->i_prev_stream_level = -1;
-
-    return &p_sys->out;
-}
-
 /*****************************************************************************
  *
  *****************************************************************************/
@@ -4065,6 +4010,59 @@ static const struct es_out_callbacks es_out_cbs =
     .priv_control = EsOutPrivControl,
 };
 
+/*****************************************************************************
+ * input_EsOutNew:
+ *****************************************************************************/
+es_out_t *input_EsOutNew( input_thread_t *p_input, input_source_t *main_source, float rate,
+                          enum input_type input_type )
+{
+    es_out_sys_t *p_sys = calloc( 1, sizeof( *p_sys ) );
+    if( !p_sys )
+        return NULL;
+
+    p_sys->out.cbs = &es_out_cbs;
+
+    vlc_mutex_init( &p_sys->lock );
+    p_sys->p_input = p_input;
+    p_sys->main_source = main_source;
+
+    p_sys->b_active = false;
+    p_sys->p_next_frame_es = NULL;
+    p_sys->i_mode   = ES_OUT_MODE_NONE;
+    p_sys->input_type = input_type;
+
+    vlc_list_init(&p_sys->programs);
+    vlc_list_init(&p_sys->es);
+    vlc_list_init(&p_sys->es_slaves);
+
+    /* */
+    EsOutPropsInit( &p_sys->video, true, p_input, input_type,
+                    ES_OUT_ES_POLICY_AUTO,
+                    "video-track-id", "video-track", NULL, NULL );
+    EsOutPropsInit( &p_sys->audio, true, p_input, input_type,
+                    ES_OUT_ES_POLICY_EXCLUSIVE,
+                    "audio-track-id", "audio-track", "audio-language", "audio" );
+    EsOutPropsInit( &p_sys->sub,  false, p_input, input_type,
+                    ES_OUT_ES_POLICY_AUTO,
+                    "sub-track-id", "sub-track", "sub-language", "sub" );
+
+    p_sys->cc_decoder = var_InheritInteger( p_input, "captions" );
+
+    p_sys->i_group_id = var_GetInteger( p_input, "program" );
+
+    p_sys->user_clock_source = clock_source_Inherit( VLC_OBJECT(p_input) );
+
+    p_sys->i_pause_date = -1;
+
+    p_sys->rate = rate;
+
+    p_sys->b_buffering = true;
+    p_sys->i_preroll_end = -1;
+    p_sys->i_prev_stream_level = -1;
+
+    return &p_sys->out;
+}
+
 /****************************************************************************
  * LanguageGetName: try to expand iso639 into plain name
  ****************************************************************************/


=====================================
src/input/es_out_timeshift.c
=====================================
@@ -322,101 +322,31 @@ static int  CmdExecuteControl( es_out_t *, ts_cmd_control_t * );
 static int  CmdExecutePrivControl( es_out_t *, ts_cmd_privcontrol_t * );
 
 /* File helpers */
-static int GetTmpFile( char **ppsz_file, const char *psz_path );
-
-static const struct es_out_callbacks es_out_timeshift_cbs;
-
-/*****************************************************************************
- * input_EsOutTimeshiftNew:
- *****************************************************************************/
-es_out_t *input_EsOutTimeshiftNew( input_thread_t *p_input, es_out_t *p_next_out, float rate )
+static int GetTmpFile( char **filename, const char *dirname )
 {
-    es_out_sys_t *p_sys = malloc( sizeof(*p_sys) );
-    if( !p_sys )
-        return NULL;
-
-    p_sys->out.cbs = &es_out_timeshift_cbs;
-
-    /* */
-    p_sys->b_input_paused = false;
-    p_sys->b_input_paused_source = false;
-    p_sys->p_input = p_input;
-    p_sys->input_rate = rate;
-    p_sys->input_rate_source = rate;
-
-    p_sys->p_out = p_next_out;
-    vlc_mutex_init_recursive( &p_sys->lock );
-
-    p_sys->b_delayed = false;
-    p_sys->p_ts = NULL;
-
-    TAB_INIT( p_sys->i_es, p_sys->pp_es );
-
-    /* */
-    const int i_tmp_size_max = var_CreateGetInteger( p_input, "input-timeshift-granularity" );
-    if( i_tmp_size_max < 0 )
-        p_sys->i_tmp_size_max = 50*1024*1024;
-    else
-        p_sys->i_tmp_size_max = __MAX( i_tmp_size_max, 1*1024*1024 );
-    msg_Dbg( p_input, "using timeshift granularity of %d MiB",
-             (int)p_sys->i_tmp_size_max/(1024*1024) );
-
-    p_sys->psz_tmp_path = var_InheritString( p_input, "input-timeshift-path" );
-#if defined (_WIN32) && !defined(VLC_WINSTORE_APP)
-    if( p_sys->psz_tmp_path == NULL )
-    {
-        const DWORD count = GetTempPath( 0, NULL );
-        if( count > 0 )
-        {
-            WCHAR *path = vlc_alloc( count + 1, sizeof(WCHAR) );
-            if( path != NULL )
-            {
-                DWORD ret = GetTempPath( count + 1, path );
-                if( ret != 0 && ret <= count )
-                    p_sys->psz_tmp_path = FromWide( path );
-                free( path );
-            }
-        }
-    }
-    if( p_sys->psz_tmp_path == NULL )
-    {
-        wchar_t *wpath = _wgetcwd( NULL, 0 );
-        if( wpath != NULL )
-        {
-            p_sys->psz_tmp_path = FromWide( wpath );
-            free( wpath );
-        }
-    }
-    if( p_sys->psz_tmp_path == NULL )
-        p_sys->psz_tmp_path = strdup( "C:" );
-
-    if( p_sys->psz_tmp_path != NULL )
+    if( dirname != NULL
+     && asprintf( filename, "%s"DIR_SEP PACKAGE_NAME"-timeshift.XXXXXX",
+                  dirname ) >= 0 )
     {
-        size_t len = strlen( p_sys->psz_tmp_path );
+        vlc_mkdir( dirname, 0700 );
 
-        while( len > 0 && p_sys->psz_tmp_path[len - 1] == DIR_SEP_CHAR )
-            len--;
+        int fd = vlc_mkstemp( *filename );
+        if( fd != -1 )
+            return fd;
 
-        p_sys->psz_tmp_path[len] = '\0';
+        free( *filename );
     }
-#endif
-    if( p_sys->psz_tmp_path != NULL )
-        msg_Dbg( p_input, "using timeshift path: %s", p_sys->psz_tmp_path );
-    else
-        msg_Dbg( p_input, "using default timeshift path" );
 
-#if 0
-#define S(t) msg_Err( p_input, "SIZEOF("#t")=%zd", sizeof(t) )
-    S(ts_cmd_t);
-    S(ts_cmd_control_t);
-    S(ts_cmd_privcontrol_t);
-    S(ts_cmd_send_t);
-    S(ts_cmd_del_t);
-    S(ts_cmd_add_t);
-#undef S
-#endif
+    *filename = strdup( DIR_SEP"tmp"DIR_SEP PACKAGE_NAME"-timeshift.XXXXXX" );
+    if( unlikely(*filename == NULL) )
+        return -1;
 
-    return &p_sys->out;
+    int fd = vlc_mkstemp( *filename );
+    if( fd != -1 )
+        return fd;
+
+    free( *filename );
+    return -1;
 }
 
 /*****************************************************************************
@@ -872,6 +802,99 @@ static const struct es_out_callbacks es_out_timeshift_cbs =
     .priv_control = PrivControl,
 };
 
+/*****************************************************************************
+ * input_EsOutTimeshiftNew:
+ *****************************************************************************/
+es_out_t *input_EsOutTimeshiftNew( input_thread_t *p_input, es_out_t *p_next_out, float rate )
+{
+    es_out_sys_t *p_sys = malloc( sizeof(*p_sys) );
+    if( !p_sys )
+        return NULL;
+
+    p_sys->out.cbs = &es_out_timeshift_cbs;
+
+    /* */
+    p_sys->b_input_paused = false;
+    p_sys->b_input_paused_source = false;
+    p_sys->p_input = p_input;
+    p_sys->input_rate = rate;
+    p_sys->input_rate_source = rate;
+
+    p_sys->p_out = p_next_out;
+    vlc_mutex_init_recursive( &p_sys->lock );
+
+    p_sys->b_delayed = false;
+    p_sys->p_ts = NULL;
+
+    TAB_INIT( p_sys->i_es, p_sys->pp_es );
+
+    /* */
+    const int i_tmp_size_max = var_CreateGetInteger( p_input, "input-timeshift-granularity" );
+    if( i_tmp_size_max < 0 )
+        p_sys->i_tmp_size_max = 50*1024*1024;
+    else
+        p_sys->i_tmp_size_max = __MAX( i_tmp_size_max, 1*1024*1024 );
+    msg_Dbg( p_input, "using timeshift granularity of %d MiB",
+             (int)p_sys->i_tmp_size_max/(1024*1024) );
+
+    p_sys->psz_tmp_path = var_InheritString( p_input, "input-timeshift-path" );
+#if defined (_WIN32) && !defined(VLC_WINSTORE_APP)
+    if( p_sys->psz_tmp_path == NULL )
+    {
+        const DWORD count = GetTempPath( 0, NULL );
+        if( count > 0 )
+        {
+            WCHAR *path = vlc_alloc( count + 1, sizeof(WCHAR) );
+            if( path != NULL )
+            {
+                DWORD ret = GetTempPath( count + 1, path );
+                if( ret != 0 && ret <= count )
+                    p_sys->psz_tmp_path = FromWide( path );
+                free( path );
+            }
+        }
+    }
+    if( p_sys->psz_tmp_path == NULL )
+    {
+        wchar_t *wpath = _wgetcwd( NULL, 0 );
+        if( wpath != NULL )
+        {
+            p_sys->psz_tmp_path = FromWide( wpath );
+            free( wpath );
+        }
+    }
+    if( p_sys->psz_tmp_path == NULL )
+        p_sys->psz_tmp_path = strdup( "C:" );
+
+    if( p_sys->psz_tmp_path != NULL )
+    {
+        size_t len = strlen( p_sys->psz_tmp_path );
+
+        while( len > 0 && p_sys->psz_tmp_path[len - 1] == DIR_SEP_CHAR )
+            len--;
+
+        p_sys->psz_tmp_path[len] = '\0';
+    }
+#endif
+    if( p_sys->psz_tmp_path != NULL )
+        msg_Dbg( p_input, "using timeshift path: %s", p_sys->psz_tmp_path );
+    else
+        msg_Dbg( p_input, "using default timeshift path" );
+
+#if 0
+#define S(t) msg_Err( p_input, "SIZEOF("#t")=%zd", sizeof(t) )
+    S(ts_cmd_t);
+    S(ts_cmd_control_t);
+    S(ts_cmd_privcontrol_t);
+    S(ts_cmd_send_t);
+    S(ts_cmd_del_t);
+    S(ts_cmd_add_t);
+#undef S
+#endif
+
+    return &p_sys->out;
+}
+
 /*****************************************************************************
  *
  *****************************************************************************/
@@ -1822,30 +1845,3 @@ static int CmdExecutePrivControl( es_out_t *p_tsout, ts_cmd_privcontrol_t *p_cmd
     default: vlc_assert_unreachable();
     }
 }
-
-static int GetTmpFile( char **filename, const char *dirname )
-{
-    if( dirname != NULL
-     && asprintf( filename, "%s"DIR_SEP PACKAGE_NAME"-timeshift.XXXXXX",
-                  dirname ) >= 0 )
-    {
-        vlc_mkdir( dirname, 0700 );
-
-        int fd = vlc_mkstemp( *filename );
-        if( fd != -1 )
-            return fd;
-
-        free( *filename );
-    }
-
-    *filename = strdup( DIR_SEP"tmp"DIR_SEP PACKAGE_NAME"-timeshift.XXXXXX" );
-    if( unlikely(*filename == NULL) )
-        return -1;
-
-    int fd = vlc_mkstemp( *filename );
-    if( fd != -1 )
-        return fd;
-
-    free( *filename );
-    return -1;
-}


=====================================
src/input/input.c
=====================================
@@ -1830,7 +1830,6 @@ static void ControlUpdateRenderer( input_thread_t *p_input, bool b_enable )
         input_priv(p_input)->p_sout = NULL;
     }
 }
-#endif
 
 static void ControlInsertDemuxFilter( input_thread_t* p_input, const char* psz_demux_chain )
 {
@@ -1842,6 +1841,8 @@ static void ControlInsertDemuxFilter( input_thread_t* p_input, const char* psz_d
         msg_Dbg(p_input, "Failed to create demux filter %s", psz_demux_chain);
 }
 
+#endif // ENABLE_SOUT
+
 void input_SetProgramId(input_thread_t *input, int group_id)
 
 {



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/eb8ddf30d554ba33663a8bf028122aaf91fd79a6...589006857e1d234a8f312249c6e2746b0902b29f

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/eb8ddf30d554ba33663a8bf028122aaf91fd79a6...589006857e1d234a8f312249c6e2746b0902b29f
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list