[vlc-commits] input: remove input_CreateFilename
Thomas Guillem
git at videolan.org
Tue Jun 11 07:58:46 CEST 2019
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Jun 7 10:36:24 2019 +0200| [c08201c788da08e147f8b7ebd05b21dee6566f6a] | committer: Thomas Guillem
input: remove input_CreateFilename
Move implementation to input_item_CreateFilename().
Since str_format works only with a player now.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c08201c788da08e147f8b7ebd05b21dee6566f6a
---
src/input/es_out.c | 5 +++--
src/input/input.c | 22 ----------------------
src/input/input_internal.h | 7 -------
src/input/item.c | 15 ++++++++++++++-
4 files changed, 17 insertions(+), 32 deletions(-)
diff --git a/src/input/es_out.c b/src/input/es_out.c
index 868ecbe9a1..6f35f2c323 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -601,8 +601,9 @@ static int EsOutSetRecord( es_out_t *out, bool b_record )
if( !psz_sout && psz_path )
{
- char *psz_file = input_CreateFilename( p_input, NULL, psz_path,
- INPUT_RECORD_PREFIX, NULL );
+ char *psz_file = input_item_CreateFilename( input_GetItem(p_input),
+ psz_path,
+ INPUT_RECORD_PREFIX, NULL );
if( psz_file )
{
char* psz_file_esc = config_StringEscape( psz_file );
diff --git a/src/input/input.c b/src/input/input.c
index 1736d62cc6..ea667d4941 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -3317,28 +3317,6 @@ static char *input_SubtitleFile2Uri( input_thread_t *p_input,
return psz_uri;
}
-/**/
-/* TODO FIXME nearly the same logic that snapshot code */
-char *input_CreateFilename(input_thread_t *input, input_item_t *item,
- const char *dir, const char *filenamefmt,
- const char *ext)
-{
- char *path;
- char *filename = str_format(NULL, item, filenamefmt);
- if (unlikely(filename == NULL))
- return NULL;
-
- filename_sanitize(filename);
-
- if (((ext != NULL)
- ? asprintf(&path, "%s"DIR_SEP"%s.%s", dir, filename, ext)
- : asprintf(&path, "%s"DIR_SEP"%s", dir, filename)) < 0)
- path = NULL;
-
- free(filename);
- return path;
-}
-
int input_GetAttachments(input_thread_t *input,
input_attachment_t ***attachments)
{
diff --git a/src/input/input_internal.h b/src/input/input_internal.h
index a36183ccf2..a2295420b7 100644
--- a/src/input/input_internal.h
+++ b/src/input/input_internal.h
@@ -640,13 +640,6 @@ int input_GetAttachments(input_thread_t *input, input_attachment_t ***attachment
input_attachment_t *input_GetAttachment(input_thread_t *input, const char *name);
-/**
- * This function creates a sane filename path.
- */
-char * input_CreateFilename( input_thread_t *, input_item_t *,
- const char *psz_path, const char *psz_prefix,
- const char *psz_extension ) VLC_USED;
-
/* Bound pts_delay */
#define INPUT_PTS_DELAY_MAX VLC_TICK_FROM_SEC(60)
diff --git a/src/input/item.c b/src/input/item.c
index 4b65d02ed6..ac79336540 100644
--- a/src/input/item.c
+++ b/src/input/item.c
@@ -1329,7 +1329,20 @@ 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);
+ char *path;
+ char *filename = str_format(NULL, item, filenamefmt);
+ if (unlikely(filename == NULL))
+ return NULL;
+
+ filename_sanitize(filename);
+
+ if (((ext != NULL)
+ ? asprintf(&path, "%s"DIR_SEP"%s.%s", dir, filename, ext)
+ : asprintf(&path, "%s"DIR_SEP"%s", dir, filename)) < 0)
+ path = NULL;
+
+ free(filename);
+ return path;
}
struct input_item_parser_id_t
More information about the vlc-commits
mailing list