Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
53cf4a01
Commit
53cf4a01
authored
Nov 06, 2006
by
Antoine Cellerier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move string formating functions used in marq to the core.
parent
8da13714
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
343 additions
and
327 deletions
+343
-327
include/vlc_input.h
include/vlc_input.h
+1
-0
include/vlc_strings.h
include/vlc_strings.h
+4
-0
include/vlc_symbols.h
include/vlc_symbols.h
+6
-0
modules/video_filter/marq.c
modules/video_filter/marq.c
+4
-327
src/misc/strings.c
src/misc/strings.c
+328
-0
No files found.
include/vlc_input.h
View file @
53cf4a01
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
#ifndef _VLC__INPUT_H
#ifndef _VLC__INPUT_H
#define _VLC__INPUT_H 1
#define _VLC__INPUT_H 1
#include <vlc_es.h>
#include <vlc_playlist.h>
#include <vlc_playlist.h>
#include <vlc_meta.h>
#include <vlc_meta.h>
...
...
include/vlc_strings.h
View file @
53cf4a01
...
@@ -34,6 +34,10 @@
...
@@ -34,6 +34,10 @@
VLC_EXPORT
(
void
,
resolve_xml_special_chars
,
(
char
*
psz_value
)
);
VLC_EXPORT
(
void
,
resolve_xml_special_chars
,
(
char
*
psz_value
)
);
VLC_EXPORT
(
char
*
,
convert_xml_special_chars
,
(
const
char
*
psz_content
)
);
VLC_EXPORT
(
char
*
,
convert_xml_special_chars
,
(
const
char
*
psz_content
)
);
VLC_EXPORT
(
char
*
,
str_format_time
,
(
char
*
)
);
#define str_format_meta( a, b ) __str_format_meta( VLC_OBJECT( a ), b )
VLC_EXPORT
(
char
*
,
__str_format_meta
,
(
vlc_object_t
*
,
char
*
)
);
/**
/**
* @}
* @}
*/
*/
...
...
include/vlc_symbols.h
View file @
53cf4a01
...
@@ -555,6 +555,8 @@ struct module_symbols_t
...
@@ -555,6 +555,8 @@ struct module_symbols_t
char
*
(
*
config_ChainCreate_inner
)
(
char
**
,
config_chain_t
**
,
char
*
);
char
*
(
*
config_ChainCreate_inner
)
(
char
**
,
config_chain_t
**
,
char
*
);
int
(
*
utf8_open_inner
)
(
const
char
*
filename
,
int
flags
,
mode_t
mode
);
int
(
*
utf8_open_inner
)
(
const
char
*
filename
,
int
flags
,
mode_t
mode
);
int
(
*
net_ListenSingle_inner
)
(
vlc_object_t
*
p_this
,
const
char
*
psz_host
,
int
i_port
,
int
family
,
int
socktype
,
int
protocol
);
int
(
*
net_ListenSingle_inner
)
(
vlc_object_t
*
p_this
,
const
char
*
psz_host
,
int
i_port
,
int
family
,
int
socktype
,
int
protocol
);
char
*
(
*
str_format_time_inner
)
(
char
*
);
char
*
(
*
__str_format_meta_inner
)
(
vlc_object_t
*
,
char
*
);
};
};
# if defined (__PLUGIN__)
# if defined (__PLUGIN__)
# define aout_FiltersCreatePipeline (p_symbols)->aout_FiltersCreatePipeline_inner
# define aout_FiltersCreatePipeline (p_symbols)->aout_FiltersCreatePipeline_inner
...
@@ -1033,6 +1035,8 @@ struct module_symbols_t
...
@@ -1033,6 +1035,8 @@ struct module_symbols_t
# define config_ChainCreate (p_symbols)->config_ChainCreate_inner
# define config_ChainCreate (p_symbols)->config_ChainCreate_inner
# define utf8_open (p_symbols)->utf8_open_inner
# define utf8_open (p_symbols)->utf8_open_inner
# define net_ListenSingle (p_symbols)->net_ListenSingle_inner
# define net_ListenSingle (p_symbols)->net_ListenSingle_inner
# define str_format_time (p_symbols)->str_format_time_inner
# define __str_format_meta (p_symbols)->__str_format_meta_inner
# elif defined (HAVE_DYNAMIC_PLUGINS) && !defined (__BUILTIN__)
# elif defined (HAVE_DYNAMIC_PLUGINS) && !defined (__BUILTIN__)
/******************************************************************
/******************************************************************
* STORE_SYMBOLS: store VLC APIs into p_symbols for plugin access.
* STORE_SYMBOLS: store VLC APIs into p_symbols for plugin access.
...
@@ -1514,6 +1518,8 @@ struct module_symbols_t
...
@@ -1514,6 +1518,8 @@ struct module_symbols_t
((p_symbols)->config_ChainCreate_inner) = config_ChainCreate; \
((p_symbols)->config_ChainCreate_inner) = config_ChainCreate; \
((p_symbols)->utf8_open_inner) = utf8_open; \
((p_symbols)->utf8_open_inner) = utf8_open; \
((p_symbols)->net_ListenSingle_inner) = net_ListenSingle; \
((p_symbols)->net_ListenSingle_inner) = net_ListenSingle; \
((p_symbols)->str_format_time_inner) = str_format_time; \
((p_symbols)->__str_format_meta_inner) = __str_format_meta; \
(p_symbols)->net_ConvertIPv4_deprecated = NULL; \
(p_symbols)->net_ConvertIPv4_deprecated = NULL; \
(p_symbols)->__sout_CfgParse_deprecated = NULL; \
(p_symbols)->__sout_CfgParse_deprecated = NULL; \
(p_symbols)->sout_CfgCreate_deprecated = NULL; \
(p_symbols)->sout_CfgCreate_deprecated = NULL; \
...
...
modules/video_filter/marq.c
View file @
53cf4a01
...
@@ -29,18 +29,14 @@
...
@@ -29,18 +29,14 @@
#include <stdlib.h>
/* malloc(), free() */
#include <stdlib.h>
/* malloc(), free() */
#include <string.h>
#include <string.h>
#include <time.h>
#include <vlc/vlc.h>
#include <vlc/vlc.h>
#include <vlc/vout.h>
#include <vlc/vout.h>
#include "vlc_filter.h"
#include "vlc_filter.h"
#include "vlc_block.h"
#include "vlc_block.h"
#include "vlc_osd.h"
#include "vlc_osd.h"
#include "vlc_playlist.h"
#include "vlc_meta.h"
#include "vlc_strings.h"
#include "vlc_input.h"
#include <vlc/aout.h>
/*****************************************************************************
/*****************************************************************************
* Local prototypes
* Local prototypes
...
@@ -243,325 +239,6 @@ static void DestroyFilter( vlc_object_t *p_this )
...
@@ -243,325 +239,6 @@ static void DestroyFilter( vlc_object_t *p_this )
free
(
p_sys
);
free
(
p_sys
);
}
}
/****************************************************************************
* String formating functions
****************************************************************************/
static
char
*
FormatTime
(
char
*
tformat
)
{
char
buffer
[
255
];
time_t
curtime
;
#if defined(HAVE_LOCALTIME_R)
struct
tm
loctime
;
#else
struct
tm
*
loctime
;
#endif
/* Get the current time. */
curtime
=
time
(
NULL
);
/* Convert it to local time representation. */
#if defined(HAVE_LOCALTIME_R)
localtime_r
(
&
curtime
,
&
loctime
);
strftime
(
buffer
,
255
,
tformat
,
&
loctime
);
#else
loctime
=
localtime
(
&
curtime
);
strftime
(
buffer
,
255
,
tformat
,
loctime
);
#endif
return
strdup
(
buffer
);
}
#define INSERT_STRING( check, string ) \
if( check && string ) \
{ \
int len = strlen( string ); \
dst = realloc( dst, \
i_size = i_size + len + 1 ); \
strncpy( d, string, len+1 ); \
d += len; \
} \
else \
{ \
*d = '-'; \
d++; \
}
char
*
FormatMeta
(
vlc_object_t
*
p_object
,
char
*
string
)
{
char
*
s
=
string
;
char
*
dst
=
malloc
(
1000
);
char
*
d
=
dst
;
int
b_is_format
=
0
;
char
buf
[
10
];
int
i_size
=
strlen
(
string
);
playlist_t
*
p_playlist
=
pl_Yield
(
p_object
);
input_thread_t
*
p_input
=
p_playlist
->
p_input
;
input_item_t
*
p_item
=
NULL
;
pl_Release
(
p_object
);
if
(
p_input
)
{
vlc_object_yield
(
p_input
);
p_item
=
p_input
->
input
.
p_item
;
if
(
p_item
)
vlc_mutex_lock
(
&
p_item
->
lock
);
}
sprintf
(
dst
,
string
);
while
(
*
s
)
{
if
(
b_is_format
)
{
switch
(
*
s
)
{
case
'a'
:
INSERT_STRING
(
p_item
&&
p_item
->
p_meta
,
p_item
->
p_meta
->
psz_artist
);
break
;
case
'b'
:
INSERT_STRING
(
p_item
&&
p_item
->
p_meta
,
p_item
->
p_meta
->
psz_album
);
break
;
case
'c'
:
INSERT_STRING
(
p_item
&&
p_item
->
p_meta
,
p_item
->
p_meta
->
psz_copyright
);
break
;
case
'd'
:
INSERT_STRING
(
p_item
&&
p_item
->
p_meta
,
p_item
->
p_meta
->
psz_description
);
break
;
case
'e'
:
INSERT_STRING
(
p_item
&&
p_item
->
p_meta
,
p_item
->
p_meta
->
psz_encodedby
);
break
;
case
'g'
:
INSERT_STRING
(
p_item
&&
p_item
->
p_meta
,
p_item
->
p_meta
->
psz_genre
);
break
;
case
'l'
:
INSERT_STRING
(
p_item
&&
p_item
->
p_meta
,
p_item
->
p_meta
->
psz_language
);
break
;
case
'n'
:
INSERT_STRING
(
p_item
&&
p_item
->
p_meta
,
p_item
->
p_meta
->
psz_tracknum
);
break
;
case
'p'
:
INSERT_STRING
(
p_item
&&
p_item
->
p_meta
,
p_item
->
p_meta
->
psz_nowplaying
);
break
;
case
'r'
:
INSERT_STRING
(
p_item
&&
p_item
->
p_meta
,
p_item
->
p_meta
->
psz_rating
);
break
;
case
's'
:
{
char
*
lang
;
if
(
p_input
)
{
lang
=
var_GetString
(
p_input
,
"sub-language"
);
}
else
{
lang
=
strdup
(
"-"
);
}
INSERT_STRING
(
1
,
lang
);
free
(
lang
);
break
;
}
case
't'
:
INSERT_STRING
(
p_item
&&
p_item
->
p_meta
,
p_item
->
p_meta
->
psz_title
);
break
;
case
'u'
:
INSERT_STRING
(
p_item
&&
p_item
->
p_meta
,
p_item
->
p_meta
->
psz_url
);
break
;
case
'A'
:
INSERT_STRING
(
p_item
&&
p_item
->
p_meta
,
p_item
->
p_meta
->
psz_date
);
break
;
case
'B'
:
if
(
p_input
)
{
snprintf
(
buf
,
10
,
"%d"
,
var_GetInteger
(
p_input
,
"bit-rate"
)
/
1000
);
}
else
{
sprintf
(
buf
,
"-"
);
}
INSERT_STRING
(
1
,
buf
);
break
;
case
'C'
:
if
(
p_input
)
{
snprintf
(
buf
,
10
,
"%d"
,
var_GetInteger
(
p_input
,
"chapter"
)
);
}
else
{
sprintf
(
buf
,
"-"
);
}
INSERT_STRING
(
1
,
buf
);
break
;
case
'D'
:
if
(
p_item
)
{
sprintf
(
buf
,
"%02d:%02d:%02d"
,
(
int
)(
p_item
->
i_duration
/
(
3600000000
)),
(
int
)((
p_item
->
i_duration
/
(
60000000
))
%
60
),
(
int
)((
p_item
->
i_duration
/
1000000
)
%
60
)
);
}
else
{
sprintf
(
buf
,
"--:--:--"
);
}
INSERT_STRING
(
1
,
buf
);
break
;
case
'F'
:
INSERT_STRING
(
p_item
,
p_item
->
psz_uri
);
break
;
case
'I'
:
if
(
p_input
)
{
snprintf
(
buf
,
10
,
"%d"
,
var_GetInteger
(
p_input
,
"title"
)
);
}
else
{
sprintf
(
buf
,
"-"
);
}
INSERT_STRING
(
1
,
buf
);
break
;
case
'L'
:
if
(
p_item
&&
p_input
)
{
sprintf
(
buf
,
"%02d:%02d:%02d"
,
(
int
)((
p_item
->
i_duration
-
p_input
->
i_time
)
/
(
3600000000
)),
(
int
)(((
p_item
->
i_duration
-
p_input
->
i_time
)
/
(
60000000
))
%
60
),
(
int
)(((
p_item
->
i_duration
-
p_input
->
i_time
)
/
1000000
)
%
60
)
);
}
else
{
sprintf
(
buf
,
"--:--:--"
);
}
INSERT_STRING
(
1
,
buf
);
break
;
case
'N'
:
INSERT_STRING
(
p_item
,
p_item
->
psz_name
);
break
;
case
'O'
:
{
char
*
lang
;
if
(
p_input
)
{
lang
=
var_GetString
(
p_input
,
"audio-language"
);
}
else
{
lang
=
strdup
(
"-"
);
}
INSERT_STRING
(
1
,
lang
);
free
(
lang
);
break
;
}
case
'P'
:
if
(
p_input
)
{
snprintf
(
buf
,
10
,
"%2.1lf"
,
var_GetFloat
(
p_input
,
"position"
)
*
100
.
);
}
else
{
sprintf
(
buf
,
"--.-%%"
);
}
INSERT_STRING
(
1
,
buf
);
break
;
case
'R'
:
if
(
p_input
)
{
int
r
=
var_GetInteger
(
p_input
,
"rate"
);
snprintf
(
buf
,
10
,
"%d.%d"
,
r
/
1000
,
r
%
1000
);
}
else
{
sprintf
(
buf
,
"-"
);
}
INSERT_STRING
(
1
,
buf
);
break
;
case
'S'
:
if
(
p_input
)
{
int
r
=
var_GetInteger
(
p_input
,
"sample-rate"
);
snprintf
(
buf
,
10
,
"%d.%d"
,
r
/
1000
,
(
r
/
100
)
%
10
);
}
else
{
sprintf
(
buf
,
"-"
);
}
INSERT_STRING
(
1
,
buf
);
break
;
case
'T'
:
if
(
p_input
)
{
sprintf
(
buf
,
"%02d:%02d:%02d"
,
(
int
)(
p_input
->
i_time
/
(
3600000000
)),
(
int
)((
p_input
->
i_time
/
(
60000000
))
%
60
),
(
int
)((
p_input
->
i_time
/
1000000
)
%
60
)
);
}
else
{
sprintf
(
buf
,
"--:--:--"
);
}
INSERT_STRING
(
1
,
buf
);
break
;
case
'U'
:
INSERT_STRING
(
p_item
&&
p_item
->
p_meta
,
p_item
->
p_meta
->
psz_publisher
);
break
;
case
'V'
:
{
audio_volume_t
volume
;
aout_VolumeGet
(
p_object
,
&
volume
);
snprintf
(
buf
,
10
,
"%d"
,
volume
);
INSERT_STRING
(
1
,
buf
);
break
;
}
case
'_'
:
*
d
=
'\n'
;
d
++
;
break
;
default:
*
d
=
*
s
;
d
++
;
break
;
}
b_is_format
=
0
;
}
else
if
(
*
s
==
'$'
)
{
b_is_format
=
1
;
}
else
{
*
d
=
*
s
;
d
++
;
}
s
++
;
}
*
d
=
'\0'
;
if
(
p_input
)
{
vlc_object_release
(
p_input
);
if
(
p_item
)
vlc_mutex_unlock
(
&
p_item
->
lock
);
}
return
dst
;
}
/****************************************************************************
/****************************************************************************
* Filter: the whole thing
* Filter: the whole thing
...
@@ -612,8 +289,8 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
...
@@ -612,8 +289,8 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
{
{
p_sys
->
b_need_update
=
VLC_FALSE
;
p_sys
->
b_need_update
=
VLC_FALSE
;
}
}
buf
=
FormatT
ime
(
p_sys
->
psz_marquee
);
buf
=
str_format_t
ime
(
p_sys
->
psz_marquee
);
p_spu
->
p_region
->
psz_text
=
FormatMeta
(
VLC_OBJECT
(
p_filter
)
,
buf
);
p_spu
->
p_region
->
psz_text
=
str_format_meta
(
p_filter
,
buf
);
free
(
buf
);
free
(
buf
);
p_spu
->
i_start
=
date
;
p_spu
->
i_start
=
date
;
p_spu
->
i_stop
=
p_sys
->
i_timeout
==
0
?
0
:
date
+
p_sys
->
i_timeout
*
1000
;
p_spu
->
i_stop
=
p_sys
->
i_timeout
==
0
?
0
:
date
+
p_sys
->
i_timeout
*
1000
;
...
...
src/misc/strings.c
View file @
53cf4a01
...
@@ -32,6 +32,15 @@
...
@@ -32,6 +32,15 @@
#include <stdlib.h>
#include <stdlib.h>
#include <assert.h>
#include <assert.h>
/* Needed by str_format_time */
#include <time.h>
/* Needed by str_format_meta */
#include "vlc_input.h"
#include "vlc_meta.h"
#include "vlc_playlist.h"
#include <vlc/aout.h>
#include "vlc_strings.h"
#include "vlc_strings.h"
#include "vlc_url.h"
#include "vlc_url.h"
#include "charset.h"
#include "charset.h"
...
@@ -318,3 +327,322 @@ char *convert_xml_special_chars( const char *psz_content )
...
@@ -318,3 +327,322 @@ char *convert_xml_special_chars( const char *psz_content )
return
psz_temp
;
return
psz_temp
;
}
}
/****************************************************************************
* String formating functions
****************************************************************************/
char
*
str_format_time
(
char
*
tformat
)
{
char
buffer
[
255
];
time_t
curtime
;
#if defined(HAVE_LOCALTIME_R)
struct
tm
loctime
;
#else
struct
tm
*
loctime
;
#endif
/* Get the current time. */
curtime
=
time
(
NULL
);
/* Convert it to local time representation. */
#if defined(HAVE_LOCALTIME_R)
localtime_r
(
&
curtime
,
&
loctime
);
strftime
(
buffer
,
255
,
tformat
,
&
loctime
);
#else
loctime
=
localtime
(
&
curtime
);
strftime
(
buffer
,
255
,
tformat
,
loctime
);
#endif
return
strdup
(
buffer
);
}
#define INSERT_STRING( check, string ) \
if( check && string ) \
{ \
int len = strlen( string ); \
dst = realloc( dst, \
i_size = i_size + len + 1 ); \
strncpy( d, string, len+1 ); \
d += len; \
} \
else \
{ \
*d = '-'; \
d++; \
}
char
*
__str_format_meta
(
vlc_object_t
*
p_object
,
char
*
string
)
{
char
*
s
=
string
;
char
*
dst
=
malloc
(
1000
);
char
*
d
=
dst
;
int
b_is_format
=
0
;
char
buf
[
10
];
int
i_size
=
strlen
(
string
);
playlist_t
*
p_playlist
=
pl_Yield
(
p_object
);
input_thread_t
*
p_input
=
p_playlist
->
p_input
;
input_item_t
*
p_item
=
NULL
;
pl_Release
(
p_object
);
if
(
p_input
)
{
vlc_object_yield
(
p_input
);
p_item
=
p_input
->
input
.
p_item
;
if
(
p_item
)
vlc_mutex_lock
(
&
p_item
->
lock
);
}
sprintf
(
dst
,
string
);
while
(
*
s
)
{
if
(
b_is_format
)
{
switch
(
*
s
)
{
case
'a'
:
INSERT_STRING
(
p_item
&&
p_item
->
p_meta
,
p_item
->
p_meta
->
psz_artist
);
break
;
case
'b'
:
INSERT_STRING
(
p_item
&&
p_item
->
p_meta
,
p_item
->
p_meta
->
psz_album
);
break
;
case
'c'
:
INSERT_STRING
(
p_item
&&
p_item
->
p_meta
,
p_item
->
p_meta
->
psz_copyright
);
break
;
case
'd'
:
INSERT_STRING
(
p_item
&&
p_item
->
p_meta
,
p_item
->
p_meta
->
psz_description
);
break
;
case
'e'
:
INSERT_STRING
(
p_item
&&
p_item
->
p_meta
,
p_item
->
p_meta
->
psz_encodedby
);
break
;
case
'g'
:
INSERT_STRING
(
p_item
&&
p_item
->
p_meta
,
p_item
->
p_meta
->
psz_genre
);
break
;
case
'l'
:
INSERT_STRING
(
p_item
&&
p_item
->
p_meta
,
p_item
->
p_meta
->
psz_language
);
break
;
case
'n'
:
INSERT_STRING
(
p_item
&&
p_item
->
p_meta
,
p_item
->
p_meta
->
psz_tracknum
);
break
;
case
'p'
:
INSERT_STRING
(
p_item
&&
p_item
->
p_meta
,
p_item
->
p_meta
->
psz_nowplaying
);
break
;
case
'r'
:
INSERT_STRING
(
p_item
&&
p_item
->
p_meta
,
p_item
->
p_meta
->
psz_rating
);
break
;
case
's'
:
{
char
*
lang
;
if
(
p_input
)
{
lang
=
var_GetString
(
p_input
,
"sub-language"
);
}
else
{
lang
=
strdup
(
"-"
);
}
INSERT_STRING
(
1
,
lang
);
free
(
lang
);
break
;
}
case
't'
:
INSERT_STRING
(
p_item
&&
p_item
->
p_meta
,
p_item
->
p_meta
->
psz_title
);
break
;
case
'u'
:
INSERT_STRING
(
p_item
&&
p_item
->
p_meta
,
p_item
->
p_meta
->
psz_url
);
break
;
case
'A'
:
INSERT_STRING
(
p_item
&&
p_item
->
p_meta
,
p_item
->
p_meta
->
psz_date
);
break
;
case
'B'
:
if
(
p_input
)
{
snprintf
(
buf
,
10
,
"%d"
,
var_GetInteger
(
p_input
,
"bit-rate"
)
/
1000
);
}
else
{
sprintf
(
buf
,
"-"
);
}
INSERT_STRING
(
1
,
buf
);
break
;
case
'C'
:
if
(
p_input
)
{
snprintf
(
buf
,
10
,
"%d"
,
var_GetInteger
(
p_input
,
"chapter"
)
);
}
else
{
sprintf
(
buf
,
"-"
);
}
INSERT_STRING
(
1
,
buf
);
break
;
case
'D'
:
if
(
p_item
)
{
sprintf
(
buf
,
"%02d:%02d:%02d"
,
(
int
)(
p_item
->
i_duration
/
(
3600000000
)),
(
int
)((
p_item
->
i_duration
/
(
60000000
))
%
60
),
(
int
)((
p_item
->
i_duration
/
1000000
)
%
60
)
);
}
else
{
sprintf
(
buf
,
"--:--:--"
);
}
INSERT_STRING
(
1
,
buf
);
break
;
case
'F'
:
INSERT_STRING
(
p_item
,
p_item
->
psz_uri
);
break
;
case
'I'
:
if
(
p_input
)
{
snprintf
(
buf
,
10
,
"%d"
,
var_GetInteger
(
p_input
,
"title"
)
);
}
else
{
sprintf
(
buf
,
"-"
);
}
INSERT_STRING
(
1
,
buf
);
break
;
case
'L'
:
if
(
p_item
&&
p_input
)
{
sprintf
(
buf
,
"%02d:%02d:%02d"
,
(
int
)((
p_item
->
i_duration
-
p_input
->
i_time
)
/
(
3600000000
)),
(
int
)(((
p_item
->
i_duration
-
p_input
->
i_time
)
/
(
60000000
))
%
60
),
(
int
)(((
p_item
->
i_duration
-
p_input
->
i_time
)
/
1000000
)
%
60
)
);
}
else
{
sprintf
(
buf
,
"--:--:--"
);
}
INSERT_STRING
(
1
,
buf
);
break
;
case
'N'
:
INSERT_STRING
(
p_item
,
p_item
->
psz_name
);
break
;
case
'O'
:
{
char
*
lang
;
if
(
p_input
)
{
lang
=
var_GetString
(
p_input
,
"audio-language"
);
}
else
{
lang
=
strdup
(
"-"
);
}
INSERT_STRING
(
1
,
lang
);
free
(
lang
);
break
;
}
case
'P'
:
if
(
p_input
)
{
snprintf
(
buf
,
10
,
"%2.1lf"
,
var_GetFloat
(
p_input
,
"position"
)
*
100
.
);
}
else
{
sprintf
(
buf
,
"--.-%%"
);
}
INSERT_STRING
(
1
,
buf
);
break
;
case
'R'
:
if
(
p_input
)
{
int
r
=
var_GetInteger
(
p_input
,
"rate"
);
snprintf
(
buf
,
10
,
"%d.%d"
,
r
/
1000
,
r
%
1000
);
}
else
{
sprintf
(
buf
,
"-"
);
}
INSERT_STRING
(
1
,
buf
);
break
;
case
'S'
:
if
(
p_input
)
{
int
r
=
var_GetInteger
(
p_input
,
"sample-rate"
);
snprintf
(
buf
,
10
,
"%d.%d"
,
r
/
1000
,
(
r
/
100
)
%
10
);
}
else
{
sprintf
(
buf
,
"-"
);
}
INSERT_STRING
(
1
,
buf
);
break
;
case
'T'
:
if
(
p_input
)
{
sprintf
(
buf
,
"%02d:%02d:%02d"
,
(
int
)(
p_input
->
i_time
/
(
3600000000
)),
(
int
)((
p_input
->
i_time
/
(
60000000
))
%
60
),
(
int
)((
p_input
->
i_time
/
1000000
)
%
60
)
);
}
else
{
sprintf
(
buf
,
"--:--:--"
);
}
INSERT_STRING
(
1
,
buf
);
break
;
case
'U'
:
INSERT_STRING
(
p_item
&&
p_item
->
p_meta
,
p_item
->
p_meta
->
psz_publisher
);
break
;
case
'V'
:
{
audio_volume_t
volume
;
aout_VolumeGet
(
p_object
,
&
volume
);
snprintf
(
buf
,
10
,
"%d"
,
volume
);
INSERT_STRING
(
1
,
buf
);
break
;
}
case
'_'
:
*
d
=
'\n'
;
d
++
;
break
;
default:
*
d
=
*
s
;
d
++
;
break
;
}
b_is_format
=
0
;
}
else
if
(
*
s
==
'$'
)
{
b_is_format
=
1
;
}
else
{
*
d
=
*
s
;
d
++
;
}
s
++
;
}
*
d
=
'\0'
;
if
(
p_input
)
{
vlc_object_release
(
p_input
);
if
(
p_item
)
vlc_mutex_unlock
(
&
p_item
->
lock
);
}
return
dst
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment