[vlc-commits] input: inline input_CreateAndStart(), fix error handling

Rémi Denis-Courmont git at videolan.org
Sun Jun 28 16:35:00 CEST 2015


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Jun 28 17:34:33 2015 +0300| [5f17cb41c07254f2760131079c0f87024396287a] | committer: Rémi Denis-Courmont

input: inline input_CreateAndStart(), fix error handling

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

 include/vlc_input.h |   24 +++++++++++++++++++++---
 src/input/input.c   |   21 ---------------------
 src/libvlccore.sym  |    1 -
 3 files changed, 21 insertions(+), 25 deletions(-)

diff --git a/include/vlc_input.h b/include/vlc_input.h
index 21b8d1c..075c694 100644
--- a/include/vlc_input.h
+++ b/include/vlc_input.h
@@ -495,9 +495,6 @@ enum input_query_e
 VLC_API input_thread_t * input_Create( vlc_object_t *p_parent, input_item_t *, const char *psz_log, input_resource_t * ) VLC_USED;
 #define input_Create(a,b,c,d) input_Create(VLC_OBJECT(a),b,c,d)
 
-VLC_API input_thread_t * input_CreateAndStart( vlc_object_t *p_parent, input_item_t *, const char *psz_log ) VLC_USED;
-#define input_CreateAndStart(a,b,c) input_CreateAndStart(VLC_OBJECT(a),b,c)
-
 VLC_API int input_Start( input_thread_t * );
 
 VLC_API void input_Stop( input_thread_t * );
@@ -512,6 +509,27 @@ VLC_API int input_Control( input_thread_t *, int i_query, ...  );
 VLC_API void input_Close( input_thread_t * );
 
 /**
+ * Create a new input_thread_t and start it.
+ *
+ * Provided for convenience.
+ *
+ * \see input_Create
+ */
+static inline
+input_thread_t *input_CreateAndStart( vlc_object_t *parent,
+                                      input_item_t *item, const char *log )
+{
+    input_thread_t *input = input_Create( parent, item, log, NULL );
+    if( input != NULL && input_Start( input ) )
+    {
+        vlc_object_release( input );
+        input = NULL;
+    }
+    return input;
+}
+#define input_CreateAndStart(a,b,c) input_CreateAndStart(VLC_OBJECT(a),b,c)
+
+/**
  * Get the input item for an input thread
  *
  * You have to keep a reference to the input or to the input_item_t until
diff --git a/src/input/input.c b/src/input/input.c
index a1a9032..1260f2c 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -129,27 +129,6 @@ input_thread_t *input_Create( vlc_object_t *p_parent,
     return Create( p_parent, p_item, psz_log, false, p_resource );
 }
 
-#undef input_CreateAndStart
-/**
- * Create a new input_thread_t and start it.
- *
- * Provided for convenience.
- *
- * \see input_Create
- */
-input_thread_t *input_CreateAndStart( vlc_object_t *p_parent,
-                                      input_item_t *p_item, const char *psz_log )
-{
-    input_thread_t *p_input = input_Create( p_parent, p_item, psz_log, NULL );
-
-    if( input_Start( p_input ) )
-    {
-        vlc_object_release( p_input );
-        return NULL;
-    }
-    return p_input;
-}
-
 #undef input_Read
 /**
  * Initialize an input thread and run it until it stops by itself.
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index be6e4e3..73e7dd1 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -173,7 +173,6 @@ image_Type2Fourcc
 InitMD5
 input_Control
 input_Create
-input_CreateAndStart
 input_CreateFilename
 input_DecoderCreate
 input_DecoderDelete



More information about the vlc-commits mailing list