[vlc-devel] commit: Constify es_out_Add es_format_t* argument. (Laurent Aimar )

git version control git at videolan.org
Mon Nov 10 19:07:52 CET 2008


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Mon Nov 10 19:07:00 2008 +0100| [f1d4df64c430242f395e5aa4db05c092c940d691] | committer: Laurent Aimar 

Constify es_out_Add es_format_t* argument.

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

 include/vlc_es_out.h |    4 ++--
 src/input/es_out.c   |   20 ++++++++++----------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/include/vlc_es_out.h b/include/vlc_es_out.h
index d7fb754..5b255ad 100644
--- a/include/vlc_es_out.h
+++ b/include/vlc_es_out.h
@@ -100,7 +100,7 @@ enum es_out_query_e
 
 struct es_out_t
 {
-    es_out_id_t *(*pf_add)    ( es_out_t *, es_format_t * );
+    es_out_id_t *(*pf_add)    ( es_out_t *, const es_format_t * );
     int          (*pf_send)   ( es_out_t *, es_out_id_t *, block_t * );
     void         (*pf_del)    ( es_out_t *, es_out_id_t * );
     int          (*pf_control)( es_out_t *, int i_query, va_list );
@@ -112,7 +112,7 @@ struct es_out_t
 };
 
 LIBVLC_USED
-static inline es_out_id_t * es_out_Add( es_out_t *out, es_format_t *fmt )
+static inline es_out_id_t * es_out_Add( es_out_t *out, const es_format_t *fmt )
 {
     return out->pf_add( out, fmt );
 }
diff --git a/src/input/es_out.c b/src/input/es_out.c
index efe3e59..f15c4be 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -157,7 +157,7 @@ struct es_out_sys_t
     sout_instance_t *p_sout_record;
 };
 
-static es_out_id_t *EsOutAdd    ( es_out_t *, es_format_t * );
+static es_out_id_t *EsOutAdd    ( es_out_t *, const es_format_t * );
 static int          EsOutSend   ( es_out_t *, es_out_id_t *, block_t * );
 static void         EsOutDel    ( es_out_t *, es_out_id_t * );
 static int          EsOutControl( es_out_t *, int i_query, va_list );
@@ -1279,7 +1279,7 @@ static void EsOutProgramEpg( es_out_t *out, int i_group, vlc_epg_t *p_epg )
 /* EsOutAdd:
  *  Add an es_out
  */
-static es_out_id_t *EsOutAdd( es_out_t *out, es_format_t *fmt )
+static es_out_id_t *EsOutAdd( es_out_t *out, const es_format_t *fmt )
 {
     es_out_sys_t      *p_sys = out->p_sys;
     input_thread_t    *p_input = p_sys->p_input;
@@ -1318,13 +1318,13 @@ static es_out_id_t *EsOutAdd( es_out_t *out, es_format_t *fmt )
     p_pgrm->i_es++;
 
     /* Set up ES */
-    if( fmt->i_id < 0 )
-        fmt->i_id = out->p_sys->i_id;
-    es->i_id = fmt->i_id;
     es->p_pgrm = p_pgrm;
     es_format_Copy( &es->fmt, fmt );
+    if( es->fmt.i_id < 0 )
+        es->fmt.i_id = out->p_sys->i_id;
+    es->i_id = fmt->i_id;
 
-    switch( fmt->i_cat )
+    switch( es->fmt.i_cat )
     {
     case AUDIO_ES:
     {
@@ -1355,7 +1355,7 @@ static es_out_id_t *EsOutAdd( es_out_t *out, es_format_t *fmt )
 
     case VIDEO_ES:
         es->i_channel = p_sys->i_video;
-        if( fmt->video.i_frame_rate && fmt->video.i_frame_rate_base )
+        if( es->fmt.video.i_frame_rate && es->fmt.video.i_frame_rate_base )
             vlc_ureduce( &es->fmt.video.i_frame_rate,
                          &es->fmt.video.i_frame_rate_base,
                          fmt->video.i_frame_rate,
@@ -1370,8 +1370,8 @@ static es_out_id_t *EsOutAdd( es_out_t *out, es_format_t *fmt )
         es->i_channel = 0;
         break;
     }
-    es->psz_language = LanguageGetName( fmt->psz_language ); /* remember so we only need to do it once */
-    es->psz_language_code = LanguageGetCode( fmt->psz_language );
+    es->psz_language = LanguageGetName( es->fmt.psz_language ); /* remember so we only need to do it once */
+    es->psz_language_code = LanguageGetCode( es->fmt.psz_language );
     es->p_dec = NULL;
     es->p_dec_record = NULL;
     for( i = 0; i < 4; i++ )
@@ -1387,7 +1387,7 @@ static es_out_id_t *EsOutAdd( es_out_t *out, es_format_t *fmt )
 
     TAB_APPEND( out->p_sys->i_es, out->p_sys->es, es );
     p_sys->i_id++;  /* always incremented */
-    switch( fmt->i_cat )
+    switch( es->fmt.i_cat )
     {
         case AUDIO_ES:
             p_sys->i_audio++;




More information about the vlc-devel mailing list