[vlc-devel] [PATCH 08/20] input_item: add input_item_CreateFilename

Thomas Guillem thomas at gllm.fr
Fri May 31 15:59:34 CEST 2019


---
 include/vlc_input.h      |  6 ------
 include/vlc_input_item.h | 13 +++++++++++++
 src/input/item.c         |  7 +++++++
 src/libvlccore.sym       |  1 +
 4 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/include/vlc_input.h b/include/vlc_input.h
index 7a9db09fdb..15695533d2 100644
--- a/include/vlc_input.h
+++ b/include/vlc_input.h
@@ -224,12 +224,6 @@ struct input_thread_t
     struct vlc_object_t obj;
 };
 
-/**
- * Record prefix string.
- * TODO make it configurable.
- */
-#define INPUT_RECORD_PREFIX "vlc-record-%Y-%m-%d-%Hh%Mm%Ss-$ N-$ p"
-
 /*****************************************************************************
  * Input events and variables
  *****************************************************************************/
diff --git a/include/vlc_input_item.h b/include/vlc_input_item.h
index 272f774306..3ecfd45dc7 100644
--- a/include/vlc_input_item.h
+++ b/include/vlc_input_item.h
@@ -371,6 +371,19 @@ VLC_API input_item_t *input_item_Hold(input_item_t *);
 /** Releases an input item, i.e. decrements its reference counter. */
 VLC_API void input_item_Release(input_item_t *);
 
+/**
+ * Record prefix string.
+ * TODO make it configurable.
+ */
+#define INPUT_RECORD_PREFIX "vlc-record-%Y-%m-%d-%Hh%Mm%Ss-$ N-$ p"
+
+/**
+ * This function creates a sane filename path.
+ */
+VLC_API char * input_item_CreateFilename( input_item_t *,
+                                          const char *psz_path, const char *psz_prefix,
+                                          const char *psz_extension ) VLC_USED;
+
 /**
  * input item parser opaque structure
  */
diff --git a/src/input/item.c b/src/input/item.c
index ce58b90122..a7afa2c2d6 100644
--- a/src/input/item.c
+++ b/src/input/item.c
@@ -1325,6 +1325,13 @@ void input_item_UpdateTracksInfo(input_item_t *item, const es_format_t *fmt)
     vlc_mutex_unlock( &item->lock );
 }
 
+char *input_item_CreateFilename(input_item_t *item,
+                                const char *dir, const char *filenamefmt,
+                                const char *ext)
+{
+    return input_CreateFilename(NULL, item, dir, filenamefmt, ext);
+}
+
 struct input_item_parser_t
 {
     input_thread_t *input;
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index ae7cc6d8b4..82bcb939ae 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -176,6 +176,7 @@ input_item_AddOptions
 input_item_AddOpaque
 input_item_Copy
 input_item_CopyOptions
+input_item_CreateFilename
 input_item_DelInfo
 input_item_GetDuration
 input_item_GetInfo
-- 
2.20.1



More information about the vlc-devel mailing list