[vlc-devel] commit: Retain certain flags from input_ItemAddOpt ( Rémi Denis-Courmont )
git version control
git at videolan.org
Mon Mar 17 20:11:32 CET 2008
vlc | branch: master | Rémi Denis-Courmont <rem at videolan.org> | Mon Mar 17 21:06:16 2008 +0200| [bf4a300705421cd16dd93e715b352a0a9f606f1b]
Retain certain flags from input_ItemAddOpt
(Oh! another ABI break - if only vlc_input_item_t weren't public)
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=bf4a300705421cd16dd93e715b352a0a9f606f1b
---
include/vlc_input.h | 18 ++++++++++++++----
src/input/input_internal.h | 1 +
src/input/item.c | 20 +++++++++++++++-----
3 files changed, 30 insertions(+), 9 deletions(-)
diff --git a/include/vlc_input.h b/include/vlc_input.h
index 9ec8038..4e94fb2 100644
--- a/include/vlc_input.h
+++ b/include/vlc_input.h
@@ -66,6 +66,8 @@ struct input_item_t
int i_options; /**< Number of input options */
char **ppsz_options; /**< Array of input options */
+ uint8_t *optflagv; /**< Some flags of input options */
+ unsigned optflagc;
mtime_t i_duration; /**< Duration in milliseconds*/
@@ -116,6 +118,10 @@ static inline void input_ItemCopyOptions( input_item_t *p_parent,
p_child->i_options *
sizeof( char * ) );
p_child->ppsz_options[p_child->i_options-1] = psz_option;
+ p_child->optflagc++;
+ p_child->optflagv = (uint8_t *)realloc( p_child->optflagv,
+ p_child->optflagc );
+ p_child->optflagv[p_child->optflagc - 1] = p_parent->optflagv[i];
}
}
@@ -142,15 +148,18 @@ static inline void input_ItemAddSubItem( input_item_t *p_parent,
vlc_event_send( &p_parent->event_manager, &event );
}
-#define VLC_INPUT_OPTION_UNIQUE 0x1
+/* Flags handled past input_ItemAddOpt() */
#define VLC_INPUT_OPTION_TRUSTED 0x2
-VLC_EXPORT( void, input_ItemAddOpt, ( input_item_t *, const char *str, unsigned flags ) );
+/* Flags handled within input_ItemAddOpt() */
+#define VLC_INPUT_OPTION_UNIQUE 0x100
+
+VLC_EXPORT( int, input_ItemAddOpt, ( input_item_t *, const char *str, unsigned flags ) );
static inline
-void input_ItemAddOption (input_item_t *item, const char *str)
+int input_ItemAddOption (input_item_t *item, const char *str)
{
- input_ItemAddOpt (item, str, VLC_INPUT_OPTION_TRUSTED);
+ return input_ItemAddOpt (item, str, VLC_INPUT_OPTION_TRUSTED);
}
static inline void input_ItemClean( input_item_t *p_i )
@@ -173,6 +182,7 @@ static inline void input_ItemClean( input_item_t *p_i )
for( i = 0; i < p_i->i_options; i++ )
free( p_i->ppsz_options[i] );
TAB_CLEAN( p_i->i_options, p_i->ppsz_options );
+ free( p_i->optflagv);
for( i = 0; i < p_i->i_es; i++ )
{
diff --git a/src/input/input_internal.h b/src/input/input_internal.h
index 0e707f1..cfc746a 100644
--- a/src/input/input_internal.h
+++ b/src/input/input_internal.h
@@ -226,6 +226,7 @@ static inline void input_ItemInit( vlc_object_t *p_o, input_item_t *p_i )
p_i->psz_uri = NULL;
TAB_INIT( p_i->i_es, p_i->es );
TAB_INIT( p_i->i_options, p_i->ppsz_options );
+ p_i->optflagv = NULL, p_i->optflagc = 0;
TAB_INIT( p_i->i_categories, p_i->pp_categories );
p_i->i_type = ITEM_TYPE_UNKNOWN;
diff --git a/src/input/item.c b/src/input/item.c
index 9452723..ac5bb5a 100644
--- a/src/input/item.c
+++ b/src/input/item.c
@@ -115,11 +115,13 @@ static void input_ItemDestroy ( gc_object_t *p_this )
free( p_input );
}
-void input_ItemAddOpt( input_item_t *p_input, const char *psz_option,
- unsigned flags )
+int input_ItemAddOpt( input_item_t *p_input, const char *psz_option,
+ unsigned flags )
{
+ int err = VLC_SUCCESS;
+
if( psz_option == NULL )
- return;
+ return VLC_EGENERIC;
vlc_mutex_lock( &p_input->lock );
if (flags & VLC_INPUT_OPTION_UNIQUE)
@@ -129,10 +131,20 @@ void input_ItemAddOpt( input_item_t *p_input, const char *psz_option,
goto out;
}
+ uint8_t *flagv = realloc (p_input->optflagv, p_input->optflagc + 1);
+ if (flagv == NULL)
+ {
+ err = VLC_ENOMEM;
+ goto out;
+ }
+ p_input->optflagv = flagv;
+ flagv[p_input->optflagc++] = flags;
+
INSERT_ELEM( p_input->ppsz_options, p_input->i_options,
p_input->i_options, strdup( psz_option ) );
out:
vlc_mutex_unlock( &p_input->lock );
+ return err;
}
int input_ItemAddInfo( input_item_t *p_i,
@@ -270,8 +282,6 @@ input_item_t *input_ItemNewWithType( vlc_object_t *p_obj, const char *psz_uri,
p_input->psz_name = strdup( p_input->psz_uri );
p_input->i_duration = i_duration;
- p_input->ppsz_options = NULL;
- p_input->i_options = 0;
for( int i = 0; i < i_options; i++ )
input_ItemAddOption( p_input, ppsz_options[i] );
More information about the vlc-devel
mailing list