Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
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-1.1
Commits
520a764b
Commit
520a764b
authored
Jun 22, 2004
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* all: rework of the input.
parent
07aadc39
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
123 additions
and
74 deletions
+123
-74
modules/misc/dummy/dummy.c
modules/misc/dummy/dummy.c
+3
-3
modules/misc/dummy/input.c
modules/misc/dummy/input.c
+120
-71
No files found.
modules/misc/dummy/dummy.c
View file @
520a764b
...
...
@@ -2,7 +2,7 @@
* dummy.c : dummy plugin for vlc
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id
: dummy.c,v 1.13 2004/01/25 17:20:19 kuehne Exp
$
* $Id$
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
...
...
@@ -65,11 +65,11 @@ vlc_module_begin();
#endif
add_submodule
();
set_description
(
_
(
"Dummy access function"
)
);
set_capability
(
"access"
,
0
);
set_capability
(
"access
2
"
,
0
);
set_callbacks
(
E_
(
OpenAccess
),
NULL
);
add_submodule
();
set_description
(
_
(
"Dummy demux function"
)
);
set_capability
(
"demux"
,
0
);
set_capability
(
"demux
2
"
,
0
);
set_callbacks
(
E_
(
OpenDemux
),
E_
(
CloseDemux
)
);
add_submodule
();
set_description
(
_
(
"Dummy decoder function"
)
);
...
...
modules/misc/dummy/input.c
View file @
520a764b
...
...
@@ -2,7 +2,7 @@
* input_dummy.c: dummy input plugin, to manage "vlc:***" special options
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id
: input.c,v 1.6 2003/12/16 12:54:29 gbazin Exp
$
* $Id$
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
...
...
@@ -10,7 +10,7 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
...
...
@@ -32,12 +32,81 @@
#include <vlc/input.h>
/*****************************************************************************
*
Local prototypes
*
Access functions.
*****************************************************************************/
static
int
Demux
(
input_thread_t
*
);
static
int
AccessRead
(
access_t
*
p_access
,
uint8_t
*
p
,
int
i_size
)
{
memset
(
p
,
0
,
i_size
);
return
i_size
;
}
static
int
AccessControl
(
access_t
*
p_access
,
int
i_query
,
va_list
args
)
{
vlc_bool_t
*
pb_bool
;
int
*
pi_int
;
int64_t
*
pi_64
;
switch
(
i_query
)
{
/* */
case
ACCESS_CAN_SEEK
:
case
ACCESS_CAN_FASTSEEK
:
case
ACCESS_CAN_PAUSE
:
case
ACCESS_CAN_CONTROL_PACE
:
pb_bool
=
(
vlc_bool_t
*
)
va_arg
(
args
,
vlc_bool_t
*
);
*
pb_bool
=
VLC_FALSE
;
break
;
/* */
case
ACCESS_GET_MTU
:
pi_int
=
(
int
*
)
va_arg
(
args
,
int
*
);
*
pi_int
=
0
;
break
;
case
ACCESS_GET_PTS_DELAY
:
pi_64
=
(
int64_t
*
)
va_arg
(
args
,
int64_t
*
);
*
pi_64
=
DEFAULT_PTS_DELAY
*
1000
;
break
;
/* */
case
ACCESS_SET_PAUSE_STATE
:
case
ACCESS_GET_TITLE_INFO
:
case
ACCESS_SET_TITLE
:
case
ACCESS_SET_SEEKPOINT
:
return
VLC_EGENERIC
;
default:
msg_Err
(
p_access
,
"unimplemented query in control"
);
return
VLC_EGENERIC
;
}
return
VLC_SUCCESS
;
}
int
E_
(
OpenAccess
)(
vlc_object_t
*
p_this
)
{
access_t
*
p_access
=
(
access_t
*
)
p_this
;
/* Init p_access */
p_access
->
pf_read
=
AccessRead
;
p_access
->
pf_block
=
NULL
;
p_access
->
pf_seek
=
NULL
;
p_access
->
pf_control
=
AccessControl
;
p_access
->
info
.
i_update
=
0
;
p_access
->
info
.
i_size
=
0
;
p_access
->
info
.
i_pos
=
0
;
p_access
->
info
.
b_eof
=
VLC_FALSE
;
p_access
->
info
.
i_title
=
0
;
p_access
->
info
.
i_seekpoint
=
0
;
p_access
->
p_sys
=
NULL
;
/* Force dummy demux plug-in */
p_access
->
psz_demux
=
strdup
(
"vlc"
);
return
VLC_SUCCESS
;
}
/*****************************************************************************
*
access_sys_t: private input data
*
Demux
*****************************************************************************/
struct
demux_sys_t
{
...
...
@@ -47,74 +116,55 @@ struct demux_sys_t
/* Used for the pause command */
mtime_t
expiration
;
};
#define COMMAND_NOP 0
#define COMMAND_QUIT 1
#define COMMAND_LOOP 2
#define COMMAND_PAUSE 3
/*****************************************************************************
* OpenAccess: open the target, ie. do nothing
*****************************************************************************/
int
E_
(
OpenAccess
)
(
vlc_object_t
*
p_this
)
enum
{
input_thread_t
*
p_input
=
(
input_thread_t
*
)
p_this
;
p_input
->
stream
.
i_method
=
INPUT_METHOD_NONE
;
COMMAND_NOP
=
0
,
COMMAND_QUIT
=
1
,
COMMAND_LOOP
=
2
,
COMMAND_PAUSE
=
3
,
};
/* Force dummy demux plug-in */
p_input
->
psz_demux
=
"vlc,none"
;
static
int
Demux
(
demux_t
*
);
static
int
DemuxControl
(
demux_t
*
,
int
,
va_list
)
;
return
VLC_SUCCESS
;
}
/*****************************************************************************
* OpenDemux: initialize the target, ie. parse the command
*****************************************************************************/
int
E_
(
OpenDemux
)
(
vlc_object_t
*
p_this
)
{
input_thread_t
*
p_input
=
(
input_thread_t
*
)
p_this
;
char
*
psz_name
=
p_input
->
psz_name
;
demux_t
*
p_demux
=
(
demux_t
*
)
p_this
;
char
*
psz_name
=
p_demux
->
psz_path
;
int
i_len
=
strlen
(
psz_name
);
struct
demux_sys_t
*
p_method
;
demux_sys_t
*
p_sys
;
int
i_arg
;
p_input
->
stream
.
b_seekable
=
0
;
p_input
->
pf_demux
=
Demux
;
p_input
->
pf_rewind
=
NULL
;
p_input
->
pf_demux_control
=
demux_vaControlDefault
;
p_method
=
malloc
(
sizeof
(
struct
demux_sys_t
)
);
if
(
p_method
==
NULL
)
{
msg_Err
(
p_input
,
"out of memory"
);
return
VLC_EGENERIC
;
}
p_input
->
p_demux_data
=
p_method
;
p_input
->
stream
.
p_demux_data
=
NULL
;
p_demux
->
pf_demux
=
Demux
;
p_demux
->
pf_control
=
DemuxControl
;
p_demux
->
p_sys
=
p_sys
=
malloc
(
sizeof
(
demux_sys_t
)
);
/* Check for a "vlc:nop" command */
if
(
i_len
==
3
&&
!
strncasecmp
(
psz_name
,
"nop"
,
3
)
)
{
msg_Info
(
p_
input
,
"command `nop'"
);
p_
method
->
i_command
=
COMMAND_NOP
;
msg_Info
(
p_
demux
,
"command `nop'"
);
p_
sys
->
i_command
=
COMMAND_NOP
;
return
VLC_SUCCESS
;
}
/* Check for a "vlc:quit" command */
if
(
i_len
==
4
&&
!
strncasecmp
(
psz_name
,
"quit"
,
4
)
)
{
msg_Info
(
p_
input
,
"command `quit'"
);
p_
method
->
i_command
=
COMMAND_QUIT
;
msg_Info
(
p_
demux
,
"command `quit'"
);
p_
sys
->
i_command
=
COMMAND_QUIT
;
return
VLC_SUCCESS
;
}
/* Check for a "vlc:loop" command */
if
(
i_len
==
4
&&
!
strncasecmp
(
psz_name
,
"loop"
,
4
)
)
{
msg_Info
(
p_
input
,
"command `loop'"
);
p_
method
->
i_command
=
COMMAND_LOOP
;
msg_Info
(
p_
demux
,
"command `loop'"
);
p_
sys
->
i_command
=
COMMAND_LOOP
;
return
VLC_SUCCESS
;
}
...
...
@@ -122,16 +172,15 @@ int E_(OpenDemux) ( vlc_object_t *p_this )
if
(
i_len
>
6
&&
!
strncasecmp
(
psz_name
,
"pause:"
,
6
)
)
{
i_arg
=
atoi
(
psz_name
+
6
);
msg_Info
(
p_
input
,
"command `pause %i'"
,
i_arg
);
p_
method
->
i_command
=
COMMAND_PAUSE
;
p_
method
->
expiration
=
mdate
()
+
(
mtime_t
)
i_arg
*
(
mtime_t
)
1000000
;
msg_Info
(
p_
demux
,
"command `pause %i'"
,
i_arg
);
p_
sys
->
i_command
=
COMMAND_PAUSE
;
p_
sys
->
expiration
=
mdate
()
+
(
mtime_t
)
i_arg
*
(
mtime_t
)
1000000
;
return
VLC_SUCCESS
;
}
msg_Err
(
p_input
,
"unknown command `%s'"
,
psz_name
);
free
(
p_input
->
p_demux_data
);
p_input
->
b_error
=
1
;
msg_Err
(
p_demux
,
"unknown command `%s'"
,
psz_name
);
free
(
p_sys
);
return
VLC_EGENERIC
;
}
...
...
@@ -140,54 +189,48 @@ int E_(OpenDemux) ( vlc_object_t *p_this )
*****************************************************************************/
void
E_
(
CloseDemux
)
(
vlc_object_t
*
p_this
)
{
input_thread_t
*
p_input
=
(
input_thread_t
*
)
p_this
;
demux_t
*
p_demux
=
(
demux_t
*
)
p_this
;
free
(
p_
input
->
p_demux_data
);
free
(
p_
demux
->
p_sys
);
}
/*****************************************************************************
* Demux: do what the command says
*****************************************************************************/
static
int
Demux
(
input_thread_t
*
p_input
)
static
int
Demux
(
demux_t
*
p_demux
)
{
struct
demux_sys_t
*
p_method
=
p_input
->
p_demux_data
;
demux_sys_t
*
p_sys
=
p_demux
->
p_sys
;
playlist_t
*
p_playlist
;
p_playlist
=
vlc_object_find
(
p_
input
,
VLC_OBJECT_PLAYLIST
,
FIND_PARENT
);
p_playlist
=
vlc_object_find
(
p_
demux
,
VLC_OBJECT_PLAYLIST
,
FIND_PARENT
);
if
(
p_playlist
==
NULL
)
{
msg_Err
(
p_input
,
"we are not attached to a playlist"
);
p_input
->
b_error
=
1
;
return
1
;
msg_Err
(
p_demux
,
"we are not attached to a playlist"
);
return
-
1
;
}
switch
(
p_
method
->
i_command
)
switch
(
p_
sys
->
i_command
)
{
case
COMMAND_QUIT
:
p_input
->
p_vlc
->
b_die
=
1
;
p_input
->
b_eof
=
1
;
break
;
p_demux
->
p_vlc
->
b_die
=
1
;
return
0
;
case
COMMAND_LOOP
:
playlist_Goto
(
p_playlist
,
0
);
break
;
case
COMMAND_PAUSE
:
if
(
mdate
()
<
p_method
->
expiration
)
if
(
mdate
()
>=
p_sys
->
expiration
)
{
msleep
(
10000
);
}
else
{
p_input
->
b_eof
=
1
;
return
0
;
}
msleep
(
10000
);
break
;
case
COMMAND_NOP
:
default:
p_input
->
b_eof
=
1
;
break
;
return
0
;
}
vlc_object_release
(
p_playlist
);
...
...
@@ -195,3 +238,9 @@ static int Demux( input_thread_t *p_input )
return
1
;
}
static
int
DemuxControl
(
demux_t
*
p_demux
,
int
i_query
,
va_list
args
)
{
return
demux2_vaControlHelper
(
p_demux
->
s
,
0
,
0
,
0
,
1
,
i_query
,
args
);
}
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