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
a066d5a9
Commit
a066d5a9
authored
Aug 01, 2005
by
Christophe Massiot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* modules/access/fake.c: New --fake-duration option ; useful to do a
slide-show.
parent
1b788606
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
76 additions
and
13 deletions
+76
-13
modules/access/fake.c
modules/access/fake.c
+76
-13
No files found.
modules/access/fake.c
View file @
a066d5a9
...
...
@@ -48,7 +48,10 @@ static void Close( vlc_object_t * );
#define ID_LONGTEXT N_( \
"Allows you to set the ID of the fake elementary stream for use in " \
"#duplicate{} constructs (default 0).")
#define DURATION_TEXT N_("Duration in ms")
#define DURATION_LONGTEXT N_( \
"Specifies the duration of the fake streaming before faking an " \
"end-of-file (default 0 means the stream is unlimited).")
vlc_module_begin
();
set_shortname
(
_
(
"Fake"
)
);
...
...
@@ -60,6 +63,8 @@ vlc_module_begin();
CACHING_TEXT
,
CACHING_LONGTEXT
,
VLC_TRUE
);
add_float
(
"fake-fps"
,
25
.
0
,
NULL
,
FPS_TEXT
,
FPS_LONGTEXT
,
VLC_TRUE
);
add_integer
(
"fake-id"
,
0
,
NULL
,
ID_TEXT
,
ID_LONGTEXT
,
VLC_TRUE
);
add_integer
(
"fake-duration"
,
0
,
NULL
,
DURATION_TEXT
,
DURATION_LONGTEXT
,
VLC_TRUE
);
add_shortcut
(
"fake"
);
set_capability
(
"access_demux"
,
0
);
...
...
@@ -75,7 +80,7 @@ static int Control( demux_t *, int, va_list );
struct
demux_sys_t
{
float
f_fps
;
mtime_t
i_last_pts
;
/* only used when f_fps > 0 */
mtime_t
i_last_pts
,
i_duration
,
i_first_pts
,
i_end_pts
,
i_pause_pts
;
es_out_id_t
*
p_es_video
;
};
...
...
@@ -103,15 +108,18 @@ static int Open( vlc_object_t *p_this )
p_demux
->
p_sys
=
p_sys
=
malloc
(
sizeof
(
demux_sys_t
)
);
memset
(
p_sys
,
0
,
sizeof
(
demux_sys_t
)
);
var_Create
(
p_demux
,
"fake-duration"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
var_Get
(
p_demux
,
"fake-duration"
,
&
val
);
p_sys
->
i_duration
=
val
.
i_int
*
1000
;
var_Create
(
p_demux
,
"fake-fps"
,
VLC_VAR_FLOAT
|
VLC_VAR_DOINHERIT
);
var_Get
(
p_demux
,
"fake-fps"
,
&
val
);
p_sys
->
f_fps
=
val
.
f_float
;
p_sys
->
i_last_pts
=
0
;
/* Declare elementary stream */
/* Declare the elementary stream */
es_format_Init
(
&
fmt
,
VIDEO_ES
,
VLC_FOURCC
(
'f'
,
'a'
,
'k'
,
'e'
)
);
var_Create
(
p_demux
,
"fake-id"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
var_Get
(
p_demux
,
"fake-id"
,
&
val
);
es_format_Init
(
&
fmt
,
VIDEO_ES
,
VLC_FOURCC
(
'f'
,
'a'
,
'k'
,
'e'
)
);
fmt
.
i_id
=
val
.
i_int
;
p_sys
->
p_es_video
=
es_out_Add
(
p_demux
->
out
,
&
fmt
);
...
...
@@ -138,27 +146,78 @@ static void Close( vlc_object_t *p_this )
static
int
Control
(
demux_t
*
p_demux
,
int
i_query
,
va_list
args
)
{
demux_sys_t
*
p_sys
=
p_demux
->
p_sys
;
vlc_bool_t
*
pb
;
int64_t
*
pi64
;
vlc_bool_t
*
pb
,
b
;
int64_t
*
pi64
,
i64
;
double
*
pf
,
f
;
switch
(
i_query
)
{
/* Special for access_demux */
case
DEMUX_CAN_PAUSE
:
case
DEMUX_SET_PAUSE_STATE
:
case
DEMUX_CAN_CONTROL_PACE
:
pb
=
(
vlc_bool_t
*
)
va_arg
(
args
,
vlc_bool_t
*
);
*
pb
=
VLC_FALSE
;
pb
=
(
vlc_bool_t
*
)
va_arg
(
args
,
vlc_bool_t
*
);
*
pb
=
VLC_TRUE
;
return
VLC_SUCCESS
;
case
DEMUX_SET_PAUSE_STATE
:
b
=
(
vlc_bool_t
)
va_arg
(
args
,
vlc_bool_t
);
if
(
b
)
{
p_sys
->
i_pause_pts
=
mdate
();
}
else
if
(
p_sys
->
i_pause_pts
)
{
mtime_t
i_pause_duration
=
mdate
()
-
p_sys
->
i_pause_pts
;
p_sys
->
i_first_pts
+=
i_pause_duration
;
p_sys
->
i_last_pts
+=
i_pause_duration
;
if
(
p_sys
->
i_duration
)
p_sys
->
i_end_pts
+=
i_pause_duration
;
p_sys
->
i_pause_pts
=
0
;
}
return
VLC_SUCCESS
;
case
DEMUX_GET_PTS_DELAY
:
pi64
=
(
int64_t
*
)
va_arg
(
args
,
int64_t
*
);
pi64
=
(
int64_t
*
)
va_arg
(
args
,
int64_t
*
);
*
pi64
=
(
int64_t
)
var_GetInteger
(
p_demux
,
"fake-caching"
)
*
1000
;
return
VLC_SUCCESS
;
case
DEMUX_GET_POSITION
:
pf
=
(
double
*
)
va_arg
(
args
,
double
*
);
if
(
p_sys
->
i_duration
>
0
)
{
*
pf
=
(
double
)(
p_sys
->
i_last_pts
-
p_sys
->
i_first_pts
)
/
(
double
)(
p_sys
->
i_duration
);
}
else
{
*
pf
=
0
;
}
return
VLC_SUCCESS
;
case
DEMUX_SET_POSITION
:
f
=
(
double
)
va_arg
(
args
,
double
);
i64
=
f
*
(
double
)
p_sys
->
i_duration
;
p_sys
->
i_first_pts
=
p_sys
->
i_last_pts
-
i64
;
p_sys
->
i_end_pts
=
p_sys
->
i_first_pts
+
p_sys
->
i_duration
;
return
VLC_SUCCESS
;
case
DEMUX_GET_TIME
:
pi64
=
(
int64_t
*
)
va_arg
(
args
,
int64_t
*
);
if
(
p_sys
->
i_duration
)
*
pi64
=
p_sys
->
i_last_pts
-
p_sys
->
i_first_pts
;
else
*
pi64
=
p_sys
->
i_last_pts
;
return
VLC_SUCCESS
;
case
DEMUX_GET_LENGTH
:
pi64
=
(
int64_t
*
)
va_arg
(
args
,
int64_t
*
);
*
pi64
=
p_sys
->
i_last_pts
;
*
pi64
=
p_sys
->
i_duration
;
return
VLC_SUCCESS
;
case
DEMUX_SET_TIME
:
i64
=
(
int64_t
)
va_arg
(
args
,
int64_t
);
p_sys
->
i_first_pts
=
p_sys
->
i_last_pts
-
i64
;
p_sys
->
i_end_pts
=
p_sys
->
i_first_pts
+
p_sys
->
i_duration
;
return
VLC_SUCCESS
;
/* TODO implement others */
...
...
@@ -179,11 +238,15 @@ static int Demux( demux_t *p_demux )
if
(
!
p_sys
->
i_last_pts
)
{
p_sys
->
i_last_pts
=
mdate
();
p_sys
->
i_last_pts
=
p_sys
->
i_first_pts
=
mdate
();
if
(
p_sys
->
i_duration
)
p_sys
->
i_end_pts
=
p_sys
->
i_first_pts
+
p_sys
->
i_duration
;
}
else
{
p_sys
->
i_last_pts
+=
(
mtime_t
)(
1000000
.
0
/
p_sys
->
f_fps
);
if
(
p_sys
->
i_duration
&&
p_sys
->
i_last_pts
>
p_sys
->
i_end_pts
)
return
0
;
mwait
(
p_sys
->
i_last_pts
);
}
...
...
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