Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
5673af6f
Commit
5673af6f
authored
Jan 29, 2008
by
Rafaël Carré
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vlm: kludge to avoid well-handled NULL format string warnings, and factorize ExecuteHelp()
parent
733a686e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
83 additions
and
91 deletions
+83
-91
src/input/vlm.c
src/input/vlm.c
+83
-91
No files found.
src/input/vlm.c
View file @
5673af6f
...
@@ -61,12 +61,16 @@
...
@@ -61,12 +61,16 @@
/*****************************************************************************
/*****************************************************************************
* Local prototypes.
* Local prototypes.
*****************************************************************************/
*****************************************************************************/
/* ugly kludge to avoid "null format string" warnings,
* even if we handle NULL format string in vlm_MessageNew() */
static
const
char
*
vlm_NULL
=
NULL
;
/* */
/* */
static
int
vlm_ControlInternal
(
vlm_t
*
,
int
,
...
);
static
int
vlm_ControlInternal
(
vlm_t
*
,
int
,
...
);
/* */
/* */
static
vlm_message_t
*
vlm_Show
(
vlm_t
*
,
vlm_media_sys_t
*
,
vlm_schedule_sys_t
*
,
const
char
*
);
static
vlm_message_t
*
vlm_Show
(
vlm_t
*
,
vlm_media_sys_t
*
,
vlm_schedule_sys_t
*
,
const
char
*
);
static
vlm_message_t
*
vlm_Help
(
vlm_t
*
,
char
*
);
static
vlm_schedule_sys_t
*
vlm_ScheduleSearch
(
vlm_t
*
,
const
char
*
);
static
vlm_schedule_sys_t
*
vlm_ScheduleSearch
(
vlm_t
*
,
const
char
*
);
...
@@ -78,7 +82,7 @@ static int ExecuteCommand( vlm_t *, const char *, vlm_message_t ** );
...
@@ -78,7 +82,7 @@ static int ExecuteCommand( vlm_t *, const char *, vlm_message_t ** );
static
int
Manage
(
vlc_object_t
*
);
static
int
Manage
(
vlc_object_t
*
);
static
vlm_schedule_sys_t
*
vlm_ScheduleNew
(
vlm_t
*
vlm
,
const
char
*
psz_name
);
static
vlm_schedule_sys_t
*
vlm_ScheduleNew
(
vlm_t
*
vlm
,
const
char
*
psz_name
);
static
void
vlm_ScheduleDelete
(
vlm_t
*
vlm
,
vlm_schedule_sys_t
*
sched
,
const
char
*
psz_name
);
static
void
vlm_ScheduleDelete
(
vlm_t
*
vlm
,
vlm_schedule_sys_t
*
sched
);
static
int
vlm_ScheduleSetup
(
vlm_schedule_sys_t
*
schedule
,
const
char
*
psz_cmd
,
static
int
vlm_ScheduleSetup
(
vlm_schedule_sys_t
*
schedule
,
const
char
*
psz_cmd
,
const
char
*
psz_value
);
const
char
*
psz_value
);
...
@@ -371,7 +375,7 @@ static int ExecuteDel( vlm_t *p_vlm, const char *psz_name, vlm_message_t **pp_st
...
@@ -371,7 +375,7 @@ static int ExecuteDel( vlm_t *p_vlm, const char *psz_name, vlm_message_t **pp_st
if
(
p_schedule
!=
NULL
)
if
(
p_schedule
!=
NULL
)
{
{
vlm_ScheduleDelete
(
p_vlm
,
p_schedule
,
NULL
);
vlm_ScheduleDelete
(
p_vlm
,
p_schedule
);
}
}
else
if
(
p_media
!=
NULL
)
else
if
(
p_media
!=
NULL
)
{
{
...
@@ -396,7 +400,7 @@ static int ExecuteDel( vlm_t *p_vlm, const char *psz_name, vlm_message_t **pp_st
...
@@ -396,7 +400,7 @@ static int ExecuteDel( vlm_t *p_vlm, const char *psz_name, vlm_message_t **pp_st
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
*
pp_status
=
vlm_MessageNew
(
"del"
,
NULL
);
*
pp_status
=
vlm_MessageNew
(
"del"
,
vlm_
NULL
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
...
@@ -424,9 +428,52 @@ static int ExecuteShow( vlm_t *p_vlm, const char *psz_name, vlm_message_t **pp_s
...
@@ -424,9 +428,52 @@ static int ExecuteShow( vlm_t *p_vlm, const char *psz_name, vlm_message_t **pp_s
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
static
int
ExecuteHelp
(
vlm_
t
*
p_vlm
,
vlm_message_t
**
p
p_status
)
static
int
ExecuteHelp
(
vlm_
message_t
*
p_status
)
{
{
*
pp_status
=
vlm_Help
(
p_vlm
,
NULL
);
vlm_message_t
*
message_child
;
#define MessageAdd( a ) \
vlm_MessageAdd( p_status, vlm_MessageNew( a, vlm_NULL ) );
#define MessageAddChild( a ) \
vlm_MessageAdd( message_child, vlm_MessageNew( a, vlm_NULL ) );
p_status
=
vlm_MessageNew
(
"help"
,
vlm_NULL
);
message_child
=
MessageAdd
(
"Commands Syntax:"
);
MessageAddChild
(
"new (name) vod|broadcast|schedule [properties]"
);
MessageAddChild
(
"setup (name) (properties)"
);
MessageAddChild
(
"show [(name)|media|schedule]"
);
MessageAddChild
(
"del (name)|all|media|schedule"
);
MessageAddChild
(
"control (name) [instance_name] (command)"
);
MessageAddChild
(
"save (config_file)"
);
MessageAddChild
(
"export"
);
MessageAddChild
(
"load (config_file)"
);
message_child
=
MessageAdd
(
"Media Proprieties Syntax:"
);
MessageAddChild
(
"input (input_name)"
);
MessageAddChild
(
"inputdel (input_name)|all"
);
MessageAddChild
(
"inputdeln input_number"
);
MessageAddChild
(
"output (output_name)"
);
MessageAddChild
(
"option (option_name)[=value]"
);
MessageAddChild
(
"enabled|disabled"
);
MessageAddChild
(
"loop|unloop (broadcast only)"
);
MessageAddChild
(
"mux (mux_name)"
);
message_child
=
MessageAdd
(
"Schedule Proprieties Syntax:"
);
MessageAddChild
(
"enabled|disabled"
);
MessageAddChild
(
"append (command_until_rest_of_the_line)"
);
MessageAddChild
(
"date (year)/(month)/(day)-(hour):(minutes):"
"(seconds)|now"
);
MessageAddChild
(
"period (years_aka_12_months)/(months_aka_30_days)/"
"(days)-(hours):(minutes):(seconds)"
);
MessageAddChild
(
"repeat (number_of_repetitions)"
);
message_child
=
MessageAdd
(
"Control Commands Syntax:"
);
MessageAddChild
(
"play [input_number]"
);
MessageAddChild
(
"pause"
);
MessageAddChild
(
"stop"
);
MessageAddChild
(
"seek [+-](percentage) | [+-](seconds)s | [+-](miliseconds)ms"
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
...
@@ -603,7 +650,7 @@ static int ExecuteControl( vlm_t *p_vlm, const char *psz_name, const int i_arg,
...
@@ -603,7 +650,7 @@ static int ExecuteControl( vlm_t *p_vlm, const char *psz_name, const int i_arg,
*
pp_status
=
vlm_MessageNew
(
"control"
,
"unknown error"
);
*
pp_status
=
vlm_MessageNew
(
"control"
,
"unknown error"
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
*
pp_status
=
vlm_MessageNew
(
"control"
,
NULL
);
*
pp_status
=
vlm_MessageNew
(
"control"
,
vlm_
NULL
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
...
@@ -634,7 +681,7 @@ static int ExecuteSave( vlm_t *p_vlm, const char *psz_file, vlm_message_t **pp_s
...
@@ -634,7 +681,7 @@ static int ExecuteSave( vlm_t *p_vlm, const char *psz_file, vlm_message_t **pp_s
free
(
psz_save
);
free
(
psz_save
);
fclose
(
f
);
fclose
(
f
);
*
pp_status
=
vlm_MessageNew
(
"save"
,
NULL
);
*
pp_status
=
vlm_MessageNew
(
"save"
,
vlm_
NULL
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
error:
error:
...
@@ -689,7 +736,7 @@ static int ExecuteLoad( vlm_t *p_vlm, const char *psz_url, vlm_message_t **pp_st
...
@@ -689,7 +736,7 @@ static int ExecuteLoad( vlm_t *p_vlm, const char *psz_url, vlm_message_t **pp_st
free
(
psz_buffer
);
free
(
psz_buffer
);
*
pp_status
=
vlm_MessageNew
(
"load"
,
NULL
);
*
pp_status
=
vlm_MessageNew
(
"load"
,
vlm_
NULL
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
...
@@ -732,7 +779,7 @@ static int ExecuteScheduleProperty( vlm_t *p_vlm, vlm_schedule_sys_t *p_schedule
...
@@ -732,7 +779,7 @@ static int ExecuteScheduleProperty( vlm_t *p_vlm, vlm_schedule_sys_t *p_schedule
if
(
i
+
1
>=
i_property
)
if
(
i
+
1
>=
i_property
)
{
{
if
(
b_new
)
if
(
b_new
)
vlm_ScheduleDelete
(
p_vlm
,
p_schedule
,
NULL
);
vlm_ScheduleDelete
(
p_vlm
,
p_schedule
);
return
ExecuteSyntaxError
(
psz_cmd
,
pp_status
);
return
ExecuteSyntaxError
(
psz_cmd
,
pp_status
);
}
}
...
@@ -740,7 +787,7 @@ static int ExecuteScheduleProperty( vlm_t *p_vlm, vlm_schedule_sys_t *p_schedule
...
@@ -740,7 +787,7 @@ static int ExecuteScheduleProperty( vlm_t *p_vlm, vlm_schedule_sys_t *p_schedule
i
++
;
i
++
;
}
}
}
}
*
pp_status
=
vlm_MessageNew
(
psz_cmd
,
NULL
);
*
pp_status
=
vlm_MessageNew
(
psz_cmd
,
vlm_
NULL
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
...
@@ -863,7 +910,7 @@ static int ExecuteMediaProperty( vlm_t *p_vlm, int64_t id, vlc_bool_t b_new,
...
@@ -863,7 +910,7 @@ static int ExecuteMediaProperty( vlm_t *p_vlm, int64_t id, vlc_bool_t b_new,
i_result
=
vlm_ControlInternal
(
p_vlm
,
VLM_CHANGE_MEDIA
,
p_cfg
);
i_result
=
vlm_ControlInternal
(
p_vlm
,
VLM_CHANGE_MEDIA
,
p_cfg
);
vlm_media_Delete
(
p_cfg
);
vlm_media_Delete
(
p_cfg
);
*
pp_status
=
vlm_MessageNew
(
psz_cmd
,
NULL
);
*
pp_status
=
vlm_MessageNew
(
psz_cmd
,
vlm_
NULL
);
return
i_result
;
return
i_result
;
error:
error:
...
@@ -967,7 +1014,7 @@ static int ExecuteCommand( vlm_t *p_vlm, const char *psz_command,
...
@@ -967,7 +1014,7 @@ static int ExecuteCommand( vlm_t *p_vlm, const char *psz_command,
/* support for comments */
/* support for comments */
if
(
i_command
==
0
&&
*
psz_command
==
'#'
)
if
(
i_command
==
0
&&
*
psz_command
==
'#'
)
{
{
p_message
=
vlm_MessageNew
(
""
,
NULL
);
p_message
=
vlm_MessageNew
(
""
,
vlm_
NULL
);
goto
success
;
goto
success
;
}
}
...
@@ -1001,12 +1048,12 @@ static int ExecuteCommand( vlm_t *p_vlm, const char *psz_command,
...
@@ -1001,12 +1048,12 @@ static int ExecuteCommand( vlm_t *p_vlm, const char *psz_command,
#define IF_EXECUTE( name, check, cmd ) if( !strcmp(ppsz_command[0], name ) ) { if( (check) ) goto syntax_error; if( (cmd) ) goto error; goto success; }
#define IF_EXECUTE( name, check, cmd ) if( !strcmp(ppsz_command[0], name ) ) { if( (check) ) goto syntax_error; if( (cmd) ) goto error; goto success; }
if
(
i_command
==
0
)
if
(
i_command
==
0
)
{
{
p_message
=
vlm_MessageNew
(
""
,
NULL
);
p_message
=
vlm_MessageNew
(
""
,
vlm_
NULL
);
goto
success
;
goto
success
;
}
}
else
IF_EXECUTE
(
"del"
,
(
i_command
!=
2
),
ExecuteDel
(
p_vlm
,
ppsz_command
[
1
],
&
p_message
)
)
else
IF_EXECUTE
(
"del"
,
(
i_command
!=
2
),
ExecuteDel
(
p_vlm
,
ppsz_command
[
1
],
&
p_message
)
)
else
IF_EXECUTE
(
"show"
,
(
i_command
>
2
),
ExecuteShow
(
p_vlm
,
i_command
>
1
?
ppsz_command
[
1
]
:
NULL
,
&
p_message
)
)
else
IF_EXECUTE
(
"show"
,
(
i_command
>
2
),
ExecuteShow
(
p_vlm
,
i_command
>
1
?
ppsz_command
[
1
]
:
NULL
,
&
p_message
)
)
else
IF_EXECUTE
(
"help"
,
(
i_command
!=
1
),
ExecuteHelp
(
p_vlm
,
&
p_message
)
)
else
IF_EXECUTE
(
"help"
,
(
i_command
!=
1
),
ExecuteHelp
(
p_message
)
)
else
IF_EXECUTE
(
"control"
,
(
i_command
<
3
),
ExecuteControl
(
p_vlm
,
ppsz_command
[
1
],
i_command
-
2
,
&
ppsz_command
[
2
],
&
p_message
)
)
else
IF_EXECUTE
(
"control"
,
(
i_command
<
3
),
ExecuteControl
(
p_vlm
,
ppsz_command
[
1
],
i_command
-
2
,
&
ppsz_command
[
2
],
&
p_message
)
)
else
IF_EXECUTE
(
"save"
,
(
i_command
!=
2
),
ExecuteSave
(
p_vlm
,
ppsz_command
[
1
],
&
p_message
)
)
else
IF_EXECUTE
(
"save"
,
(
i_command
!=
2
),
ExecuteSave
(
p_vlm
,
ppsz_command
[
1
],
&
p_message
)
)
else
IF_EXECUTE
(
"export"
,
(
i_command
!=
1
),
ExecuteExport
(
p_vlm
,
&
p_message
)
)
else
IF_EXECUTE
(
"export"
,
(
i_command
!=
1
),
ExecuteExport
(
p_vlm
,
&
p_message
)
)
...
@@ -1094,8 +1141,7 @@ static vlm_schedule_sys_t *vlm_ScheduleNew( vlm_t *vlm, const char *psz_name )
...
@@ -1094,8 +1141,7 @@ static vlm_schedule_sys_t *vlm_ScheduleNew( vlm_t *vlm, const char *psz_name )
}
}
/* for now, simple delete. After, del with options (last arg) */
/* for now, simple delete. After, del with options (last arg) */
static
void
vlm_ScheduleDelete
(
vlm_t
*
vlm
,
vlm_schedule_sys_t
*
sched
,
static
void
vlm_ScheduleDelete
(
vlm_t
*
vlm
,
vlm_schedule_sys_t
*
sched
)
const
char
*
psz_name
)
{
{
if
(
sched
==
NULL
)
return
;
if
(
sched
==
NULL
)
return
;
...
@@ -1380,14 +1426,14 @@ vlm_message_t *vlm_MessageAdd( vlm_message_t *p_message,
...
@@ -1380,14 +1426,14 @@ vlm_message_t *vlm_MessageAdd( vlm_message_t *p_message,
/*****************************************************************************
/*****************************************************************************
* Misc utility functions
* Misc utility functions
*****************************************************************************/
*****************************************************************************/
static
vlm_message_t
*
vlm_ShowMedia
(
vlm_
t
*
p_vlm
,
vlm_
media_sys_t
*
p_media
)
static
vlm_message_t
*
vlm_ShowMedia
(
vlm_media_sys_t
*
p_media
)
{
{
vlm_media_t
*
p_cfg
=
&
p_media
->
cfg
;
vlm_media_t
*
p_cfg
=
&
p_media
->
cfg
;
vlm_message_t
*
p_msg
;
vlm_message_t
*
p_msg
;
vlm_message_t
*
p_msg_sub
;
vlm_message_t
*
p_msg_sub
;
int
i
;
int
i
;
p_msg
=
vlm_MessageNew
(
p_cfg
->
psz_name
,
0
);
p_msg
=
vlm_MessageNew
(
p_cfg
->
psz_name
,
vlm_NULL
);
vlm_MessageAdd
(
p_msg
,
vlm_MessageAdd
(
p_msg
,
vlm_MessageNew
(
"type"
,
p_cfg
->
b_vod
?
"vod"
:
"broadcast"
)
);
vlm_MessageNew
(
"type"
,
p_cfg
->
b_vod
?
"vod"
:
"broadcast"
)
);
vlm_MessageAdd
(
p_msg
,
vlm_MessageAdd
(
p_msg
,
...
@@ -1400,7 +1446,7 @@ static vlm_message_t *vlm_ShowMedia( vlm_t *p_vlm, vlm_media_sys_t *p_media )
...
@@ -1400,7 +1446,7 @@ static vlm_message_t *vlm_ShowMedia( vlm_t *p_vlm, vlm_media_sys_t *p_media )
vlm_MessageAdd
(
p_msg
,
vlm_MessageAdd
(
p_msg
,
vlm_MessageNew
(
"loop"
,
p_cfg
->
broadcast
.
b_loop
?
"yes"
:
"no"
)
);
vlm_MessageNew
(
"loop"
,
p_cfg
->
broadcast
.
b_loop
?
"yes"
:
"no"
)
);
p_msg_sub
=
vlm_MessageAdd
(
p_msg
,
vlm_MessageNew
(
"inputs"
,
NULL
)
);
p_msg_sub
=
vlm_MessageAdd
(
p_msg
,
vlm_MessageNew
(
"inputs"
,
vlm_
NULL
)
);
for
(
i
=
0
;
i
<
p_cfg
->
i_input
;
i
++
)
for
(
i
=
0
;
i
<
p_cfg
->
i_input
;
i
++
)
{
{
char
*
psz_tmp
;
char
*
psz_tmp
;
...
@@ -1413,11 +1459,11 @@ static vlm_message_t *vlm_ShowMedia( vlm_t *p_vlm, vlm_media_sys_t *p_media )
...
@@ -1413,11 +1459,11 @@ static vlm_message_t *vlm_ShowMedia( vlm_t *p_vlm, vlm_media_sys_t *p_media )
vlm_MessageAdd
(
p_msg
,
vlm_MessageAdd
(
p_msg
,
vlm_MessageNew
(
"output"
,
p_cfg
->
psz_output
?
p_cfg
->
psz_output
:
""
)
);
vlm_MessageNew
(
"output"
,
p_cfg
->
psz_output
?
p_cfg
->
psz_output
:
""
)
);
p_msg_sub
=
vlm_MessageAdd
(
p_msg
,
vlm_MessageNew
(
"options"
,
0
)
);
p_msg_sub
=
vlm_MessageAdd
(
p_msg
,
vlm_MessageNew
(
"options"
,
vlm_NULL
)
);
for
(
i
=
0
;
i
<
p_cfg
->
i_option
;
i
++
)
for
(
i
=
0
;
i
<
p_cfg
->
i_option
;
i
++
)
vlm_MessageAdd
(
p_msg_sub
,
vlm_MessageNew
(
p_cfg
->
ppsz_option
[
i
],
0
)
);
vlm_MessageAdd
(
p_msg_sub
,
vlm_MessageNew
(
p_cfg
->
ppsz_option
[
i
],
vlm_NULL
)
);
p_msg_sub
=
vlm_MessageAdd
(
p_msg
,
vlm_MessageNew
(
"instances"
,
NULL
)
);
p_msg_sub
=
vlm_MessageAdd
(
p_msg
,
vlm_MessageNew
(
"instances"
,
vlm_
NULL
)
);
for
(
i
=
0
;
i
<
p_media
->
i_instance
;
i
++
)
for
(
i
=
0
;
i
<
p_media
->
i_instance
;
i
++
)
{
{
vlm_media_instance_sys_t
*
p_instance
=
p_media
->
instance
[
i
];
vlm_media_instance_sys_t
*
p_instance
=
p_media
->
instance
[
i
];
...
@@ -1429,7 +1475,7 @@ static vlm_message_t *vlm_ShowMedia( vlm_t *p_vlm, vlm_media_sys_t *p_media )
...
@@ -1429,7 +1475,7 @@ static vlm_message_t *vlm_ShowMedia( vlm_t *p_vlm, vlm_media_sys_t *p_media )
if
(
p_instance
->
p_input
)
if
(
p_instance
->
p_input
)
var_Get
(
p_instance
->
p_input
,
"state"
,
&
val
);
var_Get
(
p_instance
->
p_input
,
"state"
,
&
val
);
p_msg_instance
=
vlm_MessageAdd
(
p_msg_sub
,
vlm_MessageNew
(
"instance"
,
NULL
)
);
p_msg_instance
=
vlm_MessageAdd
(
p_msg_sub
,
vlm_MessageNew
(
"instance"
,
vlm_
NULL
)
);
vlm_MessageAdd
(
p_msg_instance
,
vlm_MessageAdd
(
p_msg_instance
,
vlm_MessageNew
(
"name"
,
p_instance
->
psz_name
?
p_instance
->
psz_name
:
"default"
)
);
vlm_MessageNew
(
"name"
,
p_instance
->
psz_name
?
p_instance
->
psz_name
:
"default"
)
);
...
@@ -1469,9 +1515,9 @@ static vlm_message_t *vlm_Show( vlm_t *vlm, vlm_media_sys_t *media,
...
@@ -1469,9 +1515,9 @@ static vlm_message_t *vlm_Show( vlm_t *vlm, vlm_media_sys_t *media,
{
{
if
(
media
!=
NULL
)
if
(
media
!=
NULL
)
{
{
vlm_message_t
*
p_msg
=
vlm_MessageNew
(
"show"
,
NULL
);
vlm_message_t
*
p_msg
=
vlm_MessageNew
(
"show"
,
vlm_
NULL
);
if
(
p_msg
)
if
(
p_msg
)
vlm_MessageAdd
(
p_msg
,
vlm_ShowMedia
(
vlm
,
media
)
);
vlm_MessageAdd
(
p_msg
,
vlm_ShowMedia
(
media
)
);
return
p_msg
;
return
p_msg
;
}
}
...
@@ -1483,9 +1529,9 @@ static vlm_message_t *vlm_Show( vlm_t *vlm, vlm_media_sys_t *media,
...
@@ -1483,9 +1529,9 @@ static vlm_message_t *vlm_Show( vlm_t *vlm, vlm_media_sys_t *media,
vlm_message_t
*
msg_child
;
vlm_message_t
*
msg_child
;
char
buffer
[
100
];
char
buffer
[
100
];
msg
=
vlm_MessageNew
(
"show"
,
NULL
);
msg
=
vlm_MessageNew
(
"show"
,
vlm_
NULL
);
msg_schedule
=
msg_schedule
=
vlm_MessageAdd
(
msg
,
vlm_MessageNew
(
schedule
->
psz_name
,
0
)
);
vlm_MessageAdd
(
msg
,
vlm_MessageNew
(
schedule
->
psz_name
,
vlm_NULL
)
);
vlm_MessageAdd
(
msg_schedule
,
vlm_MessageNew
(
"type"
,
"schedule"
)
);
vlm_MessageAdd
(
msg_schedule
,
vlm_MessageNew
(
"type"
,
"schedule"
)
);
...
@@ -1553,12 +1599,12 @@ static vlm_message_t *vlm_Show( vlm_t *vlm, vlm_media_sys_t *media,
...
@@ -1553,12 +1599,12 @@ static vlm_message_t *vlm_Show( vlm_t *vlm, vlm_media_sys_t *media,
vlm_MessageAdd
(
msg_schedule
,
vlm_MessageNew
(
"repeat"
,
buffer
)
);
vlm_MessageAdd
(
msg_schedule
,
vlm_MessageNew
(
"repeat"
,
buffer
)
);
msg_child
=
msg_child
=
vlm_MessageAdd
(
msg_schedule
,
vlm_MessageNew
(
"commands"
,
0
)
);
vlm_MessageAdd
(
msg_schedule
,
vlm_MessageNew
(
"commands"
,
vlm_NULL
)
);
for
(
i
=
0
;
i
<
schedule
->
i_command
;
i
++
)
for
(
i
=
0
;
i
<
schedule
->
i_command
;
i
++
)
{
{
vlm_MessageAdd
(
msg_child
,
vlm_MessageAdd
(
msg_child
,
vlm_MessageNew
(
schedule
->
command
[
i
],
NULL
)
);
vlm_MessageNew
(
schedule
->
command
[
i
],
vlm_
NULL
)
);
}
}
return
msg
;
return
msg
;
...
@@ -1583,12 +1629,12 @@ static vlm_message_t *vlm_Show( vlm_t *vlm, vlm_media_sys_t *media,
...
@@ -1583,12 +1629,12 @@ static vlm_message_t *vlm_Show( vlm_t *vlm, vlm_media_sys_t *media,
asprintf
(
&
psz_count
,
"( %d broadcast - %d vod )"
,
i_broadcast
,
i_vod
);
asprintf
(
&
psz_count
,
"( %d broadcast - %d vod )"
,
i_broadcast
,
i_vod
);
p_msg
=
vlm_MessageNew
(
"show"
,
NULL
);
p_msg
=
vlm_MessageNew
(
"show"
,
vlm_
NULL
);
p_msg_child
=
vlm_MessageAdd
(
p_msg
,
vlm_MessageNew
(
"media"
,
psz_count
)
);
p_msg_child
=
vlm_MessageAdd
(
p_msg
,
vlm_MessageNew
(
"media"
,
psz_count
)
);
free
(
psz_count
);
free
(
psz_count
);
for
(
i
=
0
;
i
<
vlm
->
i_media
;
i
++
)
for
(
i
=
0
;
i
<
vlm
->
i_media
;
i
++
)
vlm_MessageAdd
(
p_msg_child
,
vlm_ShowMedia
(
vlm
,
vlm
->
media
[
i
]
)
);
vlm_MessageAdd
(
p_msg_child
,
vlm_ShowMedia
(
vlm
->
media
[
i
]
)
);
return
p_msg
;
return
p_msg
;
}
}
...
@@ -1599,8 +1645,8 @@ static vlm_message_t *vlm_Show( vlm_t *vlm, vlm_media_sys_t *media,
...
@@ -1599,8 +1645,8 @@ static vlm_message_t *vlm_Show( vlm_t *vlm, vlm_media_sys_t *media,
vlm_message_t
*
msg
;
vlm_message_t
*
msg
;
vlm_message_t
*
msg_child
;
vlm_message_t
*
msg_child
;
msg
=
vlm_MessageNew
(
"show"
,
NULL
);
msg
=
vlm_MessageNew
(
"show"
,
vlm_
NULL
);
msg_child
=
vlm_MessageAdd
(
msg
,
vlm_MessageNew
(
"schedule"
,
NULL
)
);
msg_child
=
vlm_MessageAdd
(
msg
,
vlm_MessageNew
(
"schedule"
,
vlm_
NULL
)
);
for
(
i
=
0
;
i
<
vlm
->
i_schedule
;
i
++
)
for
(
i
=
0
;
i
<
vlm
->
i_schedule
;
i
++
)
{
{
...
@@ -1609,7 +1655,7 @@ static vlm_message_t *vlm_Show( vlm_t *vlm, vlm_media_sys_t *media,
...
@@ -1609,7 +1655,7 @@ static vlm_message_t *vlm_Show( vlm_t *vlm, vlm_media_sys_t *media,
mtime_t
i_time
,
i_next_date
;
mtime_t
i_time
,
i_next_date
;
msg_schedule
=
vlm_MessageAdd
(
msg_child
,
msg_schedule
=
vlm_MessageAdd
(
msg_child
,
vlm_MessageNew
(
s
->
psz_name
,
0
)
);
vlm_MessageNew
(
s
->
psz_name
,
vlm_NULL
)
);
vlm_MessageAdd
(
msg_schedule
,
vlm_MessageAdd
(
msg_schedule
,
vlm_MessageNew
(
"enabled"
,
s
->
b_enabled
?
vlm_MessageNew
(
"enabled"
,
s
->
b_enabled
?
"yes"
:
"no"
)
);
"yes"
:
"no"
)
);
...
@@ -1668,64 +1714,10 @@ static vlm_message_t *vlm_Show( vlm_t *vlm, vlm_media_sys_t *media,
...
@@ -1668,64 +1714,10 @@ static vlm_message_t *vlm_Show( vlm_t *vlm, vlm_media_sys_t *media,
else
else
{
{
return
vlm_MessageNew
(
"show"
,
NULL
);
return
vlm_MessageNew
(
"show"
,
vlm_
NULL
);
}
}
}
}
static
vlm_message_t
*
vlm_Help
(
vlm_t
*
vlm
,
char
*
psz_filter
)
{
vlm_message_t
*
message
,
*
message_child
;
#define MessageAdd( a ) \
vlm_MessageAdd( message, vlm_MessageNew( a, NULL ) );
#define MessageAddChild( a ) \
vlm_MessageAdd( message_child, vlm_MessageNew( a, NULL ) );
if
(
psz_filter
==
NULL
)
{
message
=
vlm_MessageNew
(
"help"
,
NULL
);
message_child
=
MessageAdd
(
"Commands Syntax:"
);
MessageAddChild
(
"new (name) vod|broadcast|schedule [properties]"
);
MessageAddChild
(
"setup (name) (properties)"
);
MessageAddChild
(
"show [(name)|media|schedule]"
);
MessageAddChild
(
"del (name)|all|media|schedule"
);
MessageAddChild
(
"control (name) [instance_name] (command)"
);
MessageAddChild
(
"save (config_file)"
);
MessageAddChild
(
"export"
);
MessageAddChild
(
"load (config_file)"
);
message_child
=
MessageAdd
(
"Media Proprieties Syntax:"
);
MessageAddChild
(
"input (input_name)"
);
MessageAddChild
(
"inputdel (input_name)|all"
);
MessageAddChild
(
"inputdeln input_number"
);
MessageAddChild
(
"output (output_name)"
);
MessageAddChild
(
"option (option_name)[=value]"
);
MessageAddChild
(
"enabled|disabled"
);
MessageAddChild
(
"loop|unloop (broadcast only)"
);
MessageAddChild
(
"mux (mux_name)"
);
message_child
=
MessageAdd
(
"Schedule Proprieties Syntax:"
);
MessageAddChild
(
"enabled|disabled"
);
MessageAddChild
(
"append (command_until_rest_of_the_line)"
);
MessageAddChild
(
"date (year)/(month)/(day)-(hour):(minutes):"
"(seconds)|now"
);
MessageAddChild
(
"period (years_aka_12_months)/(months_aka_30_days)/"
"(days)-(hours):(minutes):(seconds)"
);
MessageAddChild
(
"repeat (number_of_repetitions)"
);
message_child
=
MessageAdd
(
"Control Commands Syntax:"
);
MessageAddChild
(
"play [input_number]"
);
MessageAddChild
(
"pause"
);
MessageAddChild
(
"stop"
);
MessageAddChild
(
"seek [+-](percentage) | [+-](seconds)s | [+-](miliseconds)ms"
);
return
message
;
}
return
vlm_MessageNew
(
"help"
,
NULL
);
}
/*****************************************************************************
/*****************************************************************************
* Config handling functions
* Config handling functions
*****************************************************************************/
*****************************************************************************/
...
@@ -2767,7 +2759,7 @@ static int vlm_ControlMediaInstanceClear( vlm_t *p_vlm, int64_t id )
...
@@ -2767,7 +2759,7 @@ static int vlm_ControlMediaInstanceClear( vlm_t *p_vlm, int64_t id )
static
int
vlm_ControlScheduleClear
(
vlm_t
*
p_vlm
)
static
int
vlm_ControlScheduleClear
(
vlm_t
*
p_vlm
)
{
{
while
(
p_vlm
->
i_schedule
>
0
)
while
(
p_vlm
->
i_schedule
>
0
)
vlm_ScheduleDelete
(
p_vlm
,
p_vlm
->
schedule
[
0
]
,
NULL
);
vlm_ScheduleDelete
(
p_vlm
,
p_vlm
->
schedule
[
0
]
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
...
...
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