[vlc-commits] input: move var_OptionParse() code to item.c

Rémi Denis-Courmont git at videolan.org
Mon Mar 30 22:05:07 CEST 2015


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Mar 30 21:08:45 2015 +0300| [f640890df3e93a8af0d00162583952033c0775ee] | committer: Rémi Denis-Courmont

input: move var_OptionParse() code to item.c

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

 include/vlc_input_item.h |    2 ++
 src/input/input.c        |    7 +------
 src/input/item.c         |   11 +++++++++++
 3 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/include/vlc_input_item.h b/include/vlc_input_item.h
index 36db7b3..4bb84c5 100644
--- a/include/vlc_input_item.h
+++ b/include/vlc_input_item.h
@@ -188,6 +188,8 @@ enum input_item_option_e
  */
 VLC_API int input_item_AddOption(input_item_t *, const char *, unsigned i_flags );
 
+void input_item_ApplyOptions(vlc_object_t *, input_item_t *);
+
 /* */
 VLC_API bool input_item_HasErrorWhenReading( input_item_t * );
 VLC_API void input_item_SetMeta( input_item_t *, vlc_meta_type_t meta_type, const char *psz_val );
diff --git a/src/input/input.c b/src/input/input.c
index 8c54746..c005a01 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -318,12 +318,7 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item,
     }
 
     /* Parse input options */
-    vlc_mutex_lock( &p_item->lock );
-    assert( (int)p_item->optflagc == p_item->i_options );
-    for( i = 0; i < p_item->i_options; i++ )
-        var_OptionParse( VLC_OBJECT(p_input), p_item->ppsz_options[i],
-                         !!(p_item->optflagv[i] & VLC_INPUT_OPTION_TRUSTED) );
-    vlc_mutex_unlock( &p_item->lock );
+    input_item_ApplyOptions( VLC_OBJECT(p_input), p_item );
 
     p_input->b_preparsing = b_quick;
     p_input->psz_header = psz_header ? strdup( psz_header ) : NULL;
diff --git a/src/input/item.c b/src/input/item.c
index ff53f67..a4c1d74 100644
--- a/src/input/item.c
+++ b/src/input/item.c
@@ -518,6 +518,17 @@ out:
     return err;
 }
 
+void input_item_ApplyOptions(vlc_object_t *obj, input_item_t *item)
+{
+    vlc_mutex_lock(&item->lock);
+    assert(item->optflagc == (unsigned)item->i_options);
+
+    for (unsigned i = 0; i < (unsigned)item->i_options; i++)
+        var_OptionParse(obj, item->ppsz_options[i],
+                        !!(item->optflagv[i] & VLC_INPUT_OPTION_TRUSTED));
+    vlc_mutex_unlock(&item->lock);
+}
+
 static info_category_t *InputItemFindCat( input_item_t *p_item,
                                           int *pi_index, const char *psz_cat )
 {



More information about the vlc-commits mailing list