Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
7158665d
Commit
7158665d
authored
Jan 23, 2005
by
Yoann Peronneau
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* src/misc/vlm.c: start exporting some VLM control functions
parent
fd474910
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
132 additions
and
92 deletions
+132
-92
include/vlc_common.h
include/vlc_common.h
+6
-3
include/vlc_vlm.h
include/vlc_vlm.h
+15
-5
src/misc/vlm.c
src/misc/vlm.c
+111
-84
No files found.
include/vlc_common.h
View file @
7158665d
...
...
@@ -390,11 +390,14 @@ typedef struct vod_media_t vod_media_t;
typedef
struct
opengl_t
opengl_t
;
typedef
struct
opengl_sys_t
opengl_sys_t
;
/* divers */
typedef
struct
vlc_meta_t
vlc_meta_t
;
/* VLM */
typedef
struct
vlm_t
vlm_t
;
typedef
struct
vlm_message_t
vlm_message_t
;
typedef
struct
vlm_media_t
vlm_media_t
;
typedef
struct
vlm_schedule_t
vlm_schedule_t
;
/* divers */
typedef
struct
vlc_meta_t
vlc_meta_t
;
/*****************************************************************************
...
...
include/vlc_vlm.h
View file @
7158665d
...
...
@@ -46,7 +46,7 @@ typedef struct
}
vlm_media_instance_t
;
typedef
struc
t
struct
vlm_media_
t
{
vlc_bool_t
b_enabled
;
int
i_type
;
...
...
@@ -76,10 +76,10 @@ typedef struct
int
i_instance
;
vlm_media_instance_t
**
instance
;
}
vlm_media_t
;
};
typedef
struc
t
struct
vlm_schedule_
t
{
/* names "schedule" is reserved */
char
*
psz_name
;
...
...
@@ -97,7 +97,7 @@ typedef struct
i_repeat < 0 : endless repeat */
int
i_repeat
;
}
vlm_schedule_t
;
};
/* ok, here is the structure of a vlm_message:
The parent node is ( name_of_the_command , NULL ), or
...
...
@@ -134,6 +134,16 @@ struct vlm_t
VLC_EXPORT
(
vlm_t
*
,
__vlm_New
,
(
vlc_object_t
*
)
);
VLC_EXPORT
(
void
,
vlm_Delete
,
(
vlm_t
*
)
);
VLC_EXPORT
(
int
,
vlm_ExecuteCommand
,
(
vlm_t
*
,
char
*
,
vlm_message_t
**
)
);
VLC_EXPORT
(
void
,
vlm_MessageDelete
,
(
vlm_message_t
*
)
);
VLC_EXPORT
(
void
,
vlm_MessageDelete
,
(
vlm_message_t
*
)
);
VLC_EXPORT
(
vlm_media_t
*
,
vlm_MediaNew
,
(
vlm_t
*
,
char
*
,
int
)
);
VLC_EXPORT
(
void
,
vlm_MediaDelete
,
(
vlm_t
*
,
vlm_media_t
*
,
char
*
)
);
VLC_EXPORT
(
int
,
vlm_MediaSetup
,
(
vlm_t
*
,
vlm_media_t
*
,
char
*
,
char
*
)
);
VLC_EXPORT
(
int
,
vlm_MediaControl
,
(
vlm_t
*
,
vlm_media_t
*
,
char
*
,
char
*
,
char
*
)
);
VLC_EXPORT
(
vlm_schedule_t
*
,
vlm_ScheduleNew
,
(
vlm_t
*
,
char
*
)
);
VLC_EXPORT
(
void
,
vlm_ScheduleDelete
,
(
vlm_t
*
,
vlm_schedule_t
*
,
char
*
)
);
VLC_EXPORT
(
int
,
vlm_ScheduleSetup
,
(
vlm_schedule_t
*
,
char
*
,
char
*
)
);
VLC_EXPORT
(
int
,
vlm_MediaVodControl
,
(
void
*
,
vod_media_t
*
,
char
*
,
int
,
va_list
)
);
VLC_EXPORT
(
int
,
vlm_Save
,
(
vlm_t
*
,
char
*
)
);
VLC_EXPORT
(
int
,
vlm_Load
,
(
vlm_t
*
,
char
*
)
);
#endif
src/misc/vlm.c
View file @
7158665d
...
...
@@ -49,30 +49,21 @@
/*****************************************************************************
* Local prototypes.
*****************************************************************************/
static
char
*
vlm_Save
(
vlm_t
*
);
static
int
vlm_Load
(
vlm_t
*
,
char
*
);
static
vlm_message_t
*
vlm_Show
(
vlm_t
*
,
vlm_media_t
*
,
vlm_schedule_t
*
,
char
*
);
static
vlm_message_t
*
vlm_Help
(
vlm_t
*
,
char
*
);
static
vlm_media_t
*
vlm_MediaNew
(
vlm_t
*
,
char
*
,
int
);
static
void
vlm_MediaDelete
(
vlm_t
*
,
vlm_media_t
*
,
char
*
);
static
vlm_media_t
*
vlm_MediaSearch
(
vlm_t
*
,
char
*
);
static
int
vlm_MediaSetup
(
vlm_t
*
,
vlm_media_t
*
,
char
*
,
char
*
);
static
int
vlm_MediaControl
(
vlm_t
*
,
vlm_media_t
*
,
char
*
,
char
*
,
char
*
);
static
vlm_media_instance_t
*
vlm_MediaInstanceSearch
(
vlm_t
*
,
vlm_media_t
*
,
char
*
);
static
vlm_message_t
*
vlm_MessageNew
(
char
*
,
const
char
*
,
...
);
static
vlm_message_t
*
vlm_MessageAdd
(
vlm_message_t
*
,
vlm_message_t
*
);
static
vlm_message_t
*
vlm_MessageAdd
(
vlm_message_t
*
,
vlm_message_t
*
);
static
vlm_schedule_t
*
vlm_ScheduleNew
(
vlm_t
*
,
char
*
);
static
void
vlm_ScheduleDelete
(
vlm_t
*
,
vlm_schedule_t
*
,
char
*
);
static
int
vlm_ScheduleSetup
(
vlm_schedule_t
*
,
char
*
,
char
*
);
static
vlm_schedule_t
*
vlm_ScheduleSearch
(
vlm_t
*
,
char
*
);
static
vlm_schedule_t
*
vlm_ScheduleSearch
(
vlm_t
*
,
char
*
);
static
int
vlm_MediaVodControl
(
void
*
,
vod_media_t
*
,
char
*
,
int
,
va_list
);
static
int
ExecuteCommand
(
vlm_t
*
,
char
*
,
vlm_message_t
**
);
static
int
Manage
(
vlc_object_t
*
);
static
char
*
Save
(
vlm_t
*
);
static
int
Load
(
vlm_t
*
,
char
*
);
static
int
ExecuteCommand
(
vlm_t
*
,
char
*
,
vlm_message_t
**
);
static
int
Manage
(
vlc_object_t
*
);
/*****************************************************************************
* vlm_New:
...
...
@@ -192,6 +183,70 @@ int vlm_ExecuteCommand( vlm_t *p_vlm, char *psz_command,
return
i_result
;
}
/*****************************************************************************
* vlm_Save:
*****************************************************************************/
int
vlm_Save
(
vlm_t
*
p_vlm
,
char
*
psz_file
)
{
FILE
*
file
;
char
*
psz_save
;
if
(
!
p_vlm
||
!
psz_file
)
return
1
;
file
=
fopen
(
psz_file
,
"w"
);
if
(
file
==
NULL
)
return
1
;
psz_save
=
Save
(
p_vlm
);
if
(
psz_save
==
NULL
)
{
fclose
(
file
);
return
1
;
}
fwrite
(
psz_save
,
strlen
(
psz_save
),
1
,
file
);
fclose
(
file
);
free
(
psz_save
);
return
0
;
}
/*****************************************************************************
* vlm_Load:
*****************************************************************************/
int
vlm_Load
(
vlm_t
*
p_vlm
,
char
*
psz_file
)
{
FILE
*
file
;
int64_t
i_size
;
char
*
psz_buffer
;
if
(
!
p_vlm
||
!
psz_file
)
return
1
;
file
=
fopen
(
psz_file
,
"r"
);
if
(
file
==
NULL
)
return
1
;
if
(
fseek
(
file
,
0
,
SEEK_END
)
!=
0
)
return
2
;
i_size
=
ftell
(
file
);
fseek
(
file
,
0
,
SEEK_SET
);
psz_buffer
=
malloc
(
i_size
+
1
);
if
(
!
psz_buffer
)
{
fclose
(
file
);
return
2
;
}
fread
(
psz_buffer
,
1
,
i_size
,
file
);
psz_buffer
[
i_size
]
=
'\0'
;
if
(
Load
(
p_vlm
,
psz_buffer
)
)
{
free
(
psz_buffer
);
return
3
;
}
free
(
psz_buffer
);
fclose
(
file
);
return
0
;
}
/*****************************************************************************
* FindEndCommand
*****************************************************************************/
...
...
@@ -539,27 +594,15 @@ static int ExecuteCommand( vlm_t *p_vlm, char *psz_command,
else
if
(
!
strcmp
(
ppsz_command
[
0
],
"save"
)
)
{
FILE
*
file
;
if
(
i_command
!=
2
)
goto
syntax_error
;
file
=
fopen
(
ppsz_command
[
1
],
"w"
);
if
(
file
==
NULL
)
if
(
vlm_Save
(
p_vlm
,
ppsz_command
[
1
]
)
)
{
p_message
=
vlm_MessageNew
(
"save"
,
"Unable to save to file"
);
goto
error
;
}
else
{
char
*
psz_save
=
vlm_Save
(
p_vlm
);
if
(
psz_save
==
NULL
)
{
fclose
(
file
);
goto
error
;
}
fwrite
(
psz_save
,
strlen
(
psz_save
),
1
,
file
);
fclose
(
file
);
free
(
psz_save
);
p_message
=
vlm_MessageNew
(
"save"
,
NULL
);
goto
success
;
}
...
...
@@ -567,52 +610,24 @@ static int ExecuteCommand( vlm_t *p_vlm, char *psz_command,
else
if
(
!
strcmp
(
ppsz_command
[
0
],
"load"
)
)
{
FILE
*
file
;
if
(
i_command
!=
2
)
goto
syntax_error
;
file
=
fopen
(
ppsz_command
[
1
],
"r"
);
if
(
file
==
NULL
)
switch
(
vlm_Load
(
p_vlm
,
ppsz_command
[
1
]
)
)
{
p_message
=
vlm_MessageNew
(
"load"
,
"Unable to load from file"
);
goto
error
;
}
else
{
int64_t
i_size
;
char
*
psz_buffer
;
if
(
fseek
(
file
,
0
,
SEEK_END
)
==
0
)
{
i_size
=
ftell
(
file
);
fseek
(
file
,
0
,
SEEK_SET
);
psz_buffer
=
malloc
(
i_size
+
1
);
if
(
!
psz_buffer
)
{
fclose
(
file
);
goto
error
;
}
fread
(
psz_buffer
,
1
,
i_size
,
file
);
psz_buffer
[
i_size
]
=
'\0'
;
if
(
vlm_Load
(
p_vlm
,
psz_buffer
)
)
{
free
(
psz_buffer
);
p_message
=
vlm_MessageNew
(
"load"
,
"error while loading "
"file"
);
goto
error
;
}
free
(
psz_buffer
);
}
else
{
case
0
:
p_message
=
vlm_MessageNew
(
"load"
,
NULL
);
goto
success
;
case
2
:
p_message
=
vlm_MessageNew
(
"load"
,
"read file error"
);
goto
error
;
}
fclose
(
file
);
p_message
=
vlm_MessageNew
(
"load"
,
NULL
);
goto
success
;
case
3
:
p_message
=
vlm_MessageNew
(
"load"
,
"error while loading file"
);
goto
error
;
default:
p_message
=
vlm_MessageNew
(
"load"
,
"Unable to load from file"
);
goto
error
;
}
}
...
...
@@ -817,7 +832,7 @@ vlm_MediaInstanceSearch( vlm_t *vlm, vlm_media_t *media, char *psz_name )
return
NULL
;
}
static
vlm_media_t
*
vlm_MediaNew
(
vlm_t
*
vlm
,
char
*
psz_name
,
int
i_type
)
vlm_media_t
*
vlm_MediaNew
(
vlm_t
*
vlm
,
char
*
psz_name
,
int
i_type
)
{
vlm_media_t
*
media
=
malloc
(
sizeof
(
vlm_media_t
)
);
...
...
@@ -873,7 +888,7 @@ static vlm_media_t *vlm_MediaNew( vlm_t *vlm, char *psz_name, int i_type )
}
/* for now, simple delete. After, del with options (last arg) */
static
void
vlm_MediaDelete
(
vlm_t
*
vlm
,
vlm_media_t
*
media
,
char
*
psz_name
)
void
vlm_MediaDelete
(
vlm_t
*
vlm
,
vlm_media_t
*
media
,
char
*
psz_name
)
{
if
(
media
==
NULL
)
return
;
...
...
@@ -918,8 +933,8 @@ static void vlm_MediaDelete( vlm_t *vlm, vlm_media_t *media, char *psz_name )
free
(
media
);
}
static
int
vlm_MediaSetup
(
vlm_t
*
vlm
,
vlm_media_t
*
media
,
char
*
psz_cmd
,
char
*
psz_value
)
int
vlm_MediaSetup
(
vlm_t
*
vlm
,
vlm_media_t
*
media
,
char
*
psz_cmd
,
char
*
psz_value
)
{
if
(
!
psz_cmd
)
return
VLC_EGENERIC
;
...
...
@@ -1063,8 +1078,8 @@ static int vlm_MediaSetup( vlm_t *vlm, vlm_media_t *media, char *psz_cmd,
return
VLC_SUCCESS
;
}
static
int
vlm_MediaControl
(
vlm_t
*
vlm
,
vlm_media_t
*
media
,
char
*
psz_id
,
char
*
psz_command
,
char
*
psz_args
)
int
vlm_MediaControl
(
vlm_t
*
vlm
,
vlm_media_t
*
media
,
char
*
psz_id
,
char
*
psz_command
,
char
*
psz_args
)
{
vlm_media_instance_t
*
p_instance
;
int
i
;
...
...
@@ -1189,7 +1204,7 @@ static int vlm_MediaControl( vlm_t *vlm, vlm_media_t *media, char *psz_id,
/*****************************************************************************
* Schedule handling
*****************************************************************************/
static
vlm_schedule_t
*
vlm_ScheduleNew
(
vlm_t
*
vlm
,
char
*
psz_name
)
vlm_schedule_t
*
vlm_ScheduleNew
(
vlm_t
*
vlm
,
char
*
psz_name
)
{
vlm_schedule_t
*
p_sched
=
malloc
(
sizeof
(
vlm_schedule_t
)
);
...
...
@@ -1217,8 +1232,8 @@ static vlm_schedule_t *vlm_ScheduleNew( vlm_t *vlm, char *psz_name )
}
/* for now, simple delete. After, del with options (last arg) */
static
void
vlm_ScheduleDelete
(
vlm_t
*
vlm
,
vlm_schedule_t
*
sched
,
char
*
psz_name
)
void
vlm_ScheduleDelete
(
vlm_t
*
vlm
,
vlm_schedule_t
*
sched
,
char
*
psz_name
)
{
if
(
sched
==
NULL
)
return
;
...
...
@@ -1246,8 +1261,8 @@ static vlm_schedule_t *vlm_ScheduleSearch( vlm_t *vlm, char *psz_name )
}
/* Ok, setup schedule command will be able to support only one (argument value) at a time */
static
int
vlm_ScheduleSetup
(
vlm_schedule_t
*
schedule
,
char
*
psz_cmd
,
char
*
psz_value
)
int
vlm_ScheduleSetup
(
vlm_schedule_t
*
schedule
,
char
*
psz_cmd
,
char
*
psz_value
)
{
if
(
!
strcmp
(
psz_cmd
,
"enabled"
)
)
{
...
...
@@ -1852,7 +1867,7 @@ static vlm_message_t *vlm_Help( vlm_t *vlm, char *psz_filter )
/*****************************************************************************
* Config handling functions
*****************************************************************************/
static
int
vlm_
Load
(
vlm_t
*
vlm
,
char
*
file
)
static
int
Load
(
vlm_t
*
vlm
,
char
*
file
)
{
char
*
pf
=
file
;
...
...
@@ -1890,7 +1905,7 @@ static int vlm_Load( vlm_t *vlm, char *file )
return
0
;
}
static
char
*
vlm_
Save
(
vlm_t
*
vlm
)
static
char
*
Save
(
vlm_t
*
vlm
)
{
char
*
save
=
NULL
;
char
*
p
;
...
...
@@ -2127,8 +2142,8 @@ static char *vlm_Save( vlm_t *vlm )
/*****************************************************************************
* Manage:
*****************************************************************************/
static
int
vlm_MediaVodControl
(
void
*
p_private
,
vod_media_t
*
p_vod_media
,
char
*
psz_id
,
int
i_query
,
va_list
args
)
int
vlm_MediaVodControl
(
void
*
p_private
,
vod_media_t
*
p_vod_media
,
char
*
psz_id
,
int
i_query
,
va_list
args
)
{
vlm_t
*
vlm
=
(
vlm_t
*
)
p_private
;
int
i
,
i_ret
=
VLC_EGENERIC
;
...
...
@@ -2306,5 +2321,17 @@ vlm_t *__vlm_New( vlc_object_t *a )
void
vlm_Delete
(
vlm_t
*
a
){}
int
vlm_ExecuteCommand
(
vlm_t
*
a
,
char
*
b
,
vlm_message_t
**
c
){
return
-
1
;
}
void
vlm_MessageDelete
(
vlm_message_t
*
a
){}
vlm_media_t
*
vlm_MediaNew
(
vlm_t
*
a
,
char
*
b
,
int
c
){
return
NULL
}
void
vlm_MediaDelete
(
vlm_t
*
a
,
vlm_media_t
*
b
,
char
*
c
){}
int
vlm_MediaSetup
(
vlm_t
*
a
,
vlm_media_t
*
b
,
char
*
c
,
char
*
d
){
return
-
1
;
}
int
vlm_MediaControl
(
vlm_t
*
a
,
vlm_media_t
*
b
,
char
*
c
,
char
*
d
,
char
*
e
)
{
return
-
1
;
}
vlm_schedule_t
*
vlm_ScheduleNew
(
vlm_t
*
a
,
char
*
b
){
return
NULL
;
}
void
vlm_ScheduleDelete
(
vlm_t
*
a
,
vlm_schedule_t
*
b
,
char
*
c
){}
int
vlm_ScheduleSetup
(
vlm_schedule_t
*
a
,
char
*
b
,
char
*
c
){
return
-
1
;
}
int
vlm_MediaVodControl
(
void
*
a
,
vod_media_t
*
b
,
char
*
c
,
int
,
va_list
d
)
{
return
-
1
;
}
int
vlm_Save
(
vlm_t
*
a
,
char
*
b
){
return
-
1
;
}
int
vlm_Load
(
vlm_t
*
a
,
char
*
b
){
return
-
1
;
}
#endif
/* ENABLE_VLM */
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