Commit 6f436e21 authored by Jakob Leben's avatar Jakob Leben

input_item: new input_item_Copy()

parent 190459cf
......@@ -263,6 +263,12 @@ VLC_EXPORT( input_item_t *, input_item_NewExt, (vlc_object_t *, const char *psz_
*/
#define input_item_New( a,b,c ) input_item_NewExt( a, b, c, 0, NULL, 0, -1 )
/**
* This function creates a new input_item_t as a copy of another.
*/
VLC_EXPORT( input_item_t *, input_item_Copy, (vlc_object_t *, input_item_t * ) );
/******************
* Input stats
******************/
......
......@@ -876,6 +876,31 @@ input_item_t *input_item_NewWithType( vlc_object_t *p_obj, const char *psz_uri,
return p_input;
}
input_item_t *input_item_Copy( vlc_object_t *p_obj, input_item_t *p_input )
{
vlc_mutex_lock( &p_input->lock );
input_item_t *p_new_input =
input_item_NewWithType( p_obj,
p_input->psz_uri, p_input->psz_name,
0, NULL, 0, p_input->i_duration,
p_input->i_type );
if( p_new_input )
{
for( int i = 0 ; i< p_input->i_options; i++ )
{
input_item_AddOption( p_new_input,
p_input->ppsz_options[i],
p_input->optflagv[i] );
}
}
vlc_mutex_unlock( &p_input->lock );
return p_new_input;
}
struct item_type_entry
{
const char psz_scheme[7];
......
......@@ -189,6 +189,7 @@ input_DetachResource
input_GetItem
input_item_AddInfo
input_item_AddOption
input_item_Copy
input_item_CopyOptions
input_item_DelInfo
input_item_GetDuration
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment