[vlc-commits] commit: input_item: new input_item_Copy() (Jakob Leben )
git at videolan.org
git at videolan.org
Sat Mar 13 17:17:49 CET 2010
vlc | branch: master | Jakob Leben <jleben at videolan.org> | Thu Mar 11 19:20:20 2010 +0100| [6f436e214f44f2e604f9db29edf88b22997e7322] | committer: Jakob Leben
input_item: new input_item_Copy()
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6f436e214f44f2e604f9db29edf88b22997e7322
---
include/vlc_input_item.h | 6 ++++++
src/input/item.c | 25 +++++++++++++++++++++++++
src/libvlccore.sym | 1 +
3 files changed, 32 insertions(+), 0 deletions(-)
diff --git a/include/vlc_input_item.h b/include/vlc_input_item.h
index d4858c9..3ad41a6 100644
--- a/include/vlc_input_item.h
+++ b/include/vlc_input_item.h
@@ -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
******************/
diff --git a/src/input/item.c b/src/input/item.c
index f10067a..32b5586 100644
--- a/src/input/item.c
+++ b/src/input/item.c
@@ -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];
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index ae488f8..4343aa1 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -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
More information about the vlc-commits
mailing list