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
db602ee3
Commit
db602ee3
authored
Oct 29, 2006
by
Jean-Paul Saman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Forward port of [17351]. Report input error condition to JavaScript
parent
7cc05363
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
15 deletions
+35
-15
include/vlc_input.h
include/vlc_input.h
+2
-1
src/control/input.c
src/control/input.c
+2
-2
src/input/input.c
src/input/input.c
+31
-12
No files found.
include/vlc_input.h
View file @
db602ee3
...
@@ -314,7 +314,8 @@ enum input_state_e
...
@@ -314,7 +314,8 @@ enum input_state_e
BUFFERING_S
,
BUFFERING_S
,
PLAYING_S
,
PLAYING_S
,
PAUSE_S
,
PAUSE_S
,
END_S
END_S
,
ERROR_S
};
};
/* "rate" default, min/max
/* "rate" default, min/max
...
...
src/control/input.c
View file @
db602ee3
...
@@ -215,9 +215,9 @@ int libvlc_input_get_state( libvlc_input_t *p_input,
...
@@ -215,9 +215,9 @@ int libvlc_input_get_state( libvlc_input_t *p_input,
input_thread_t
*
p_input_thread
;
input_thread_t
*
p_input_thread
;
vlc_value_t
val
;
vlc_value_t
val
;
p_input_thread
=
libvlc_get_input_thread
(
p_input
,
p_e
);
p_input_thread
=
libvlc_get_input_thread
(
p_input
,
p_e
);
if
(
libvlc_exception_raised
(
p_e
)
)
if
(
libvlc_exception_raised
(
p_e
)
)
return
0
;
return
6
;
/* Return ERROR_S (see include/vlc_input.c) */
var_Get
(
p_input_thread
,
"state"
,
&
val
);
var_Get
(
p_input_thread
,
"state"
,
&
val
);
vlc_object_release
(
p_input_thread
);
vlc_object_release
(
p_input_thread
);
...
...
src/input/input.c
View file @
db602ee3
...
@@ -270,7 +270,6 @@ input_thread_t *__input_CreateThread( vlc_object_t *p_parent,
...
@@ -270,7 +270,6 @@ input_thread_t *__input_CreateThread( vlc_object_t *p_parent,
return
__input_CreateThread2
(
p_parent
,
p_item
,
NULL
);
return
__input_CreateThread2
(
p_parent
,
p_item
,
NULL
);
}
}
/* Gruik ! */
/* Gruik ! */
input_thread_t
*
__input_CreateThread2
(
vlc_object_t
*
p_parent
,
input_thread_t
*
__input_CreateThread2
(
vlc_object_t
*
p_parent
,
input_item_t
*
p_item
,
input_item_t
*
p_item
,
...
@@ -279,6 +278,9 @@ input_thread_t *__input_CreateThread2( vlc_object_t *p_parent,
...
@@ -279,6 +278,9 @@ input_thread_t *__input_CreateThread2( vlc_object_t *p_parent,
input_thread_t
*
p_input
=
NULL
;
/* thread descriptor */
input_thread_t
*
p_input
=
NULL
;
/* thread descriptor */
p_input
=
Create
(
p_parent
,
p_item
,
psz_header
,
VLC_FALSE
);
p_input
=
Create
(
p_parent
,
p_item
,
psz_header
,
VLC_FALSE
);
if
(
!
p_input
)
return
NULL
;
/* Now we can attach our new input */
/* Now we can attach our new input */
vlc_object_attach
(
p_input
,
p_parent
);
vlc_object_attach
(
p_input
,
p_parent
);
...
@@ -286,6 +288,7 @@ input_thread_t *__input_CreateThread2( vlc_object_t *p_parent,
...
@@ -286,6 +288,7 @@ input_thread_t *__input_CreateThread2( vlc_object_t *p_parent,
if
(
vlc_thread_create
(
p_input
,
"input"
,
Run
,
if
(
vlc_thread_create
(
p_input
,
"input"
,
Run
,
VLC_THREAD_PRIORITY_INPUT
,
VLC_TRUE
)
)
VLC_THREAD_PRIORITY_INPUT
,
VLC_TRUE
)
)
{
{
input_ChangeState
(
p_input
,
ERROR_S
);
msg_Err
(
p_input
,
"cannot create input thread"
);
msg_Err
(
p_input
,
"cannot create input thread"
);
vlc_object_detach
(
p_input
);
vlc_object_detach
(
p_input
);
vlc_object_destroy
(
p_input
);
vlc_object_destroy
(
p_input
);
...
@@ -295,7 +298,6 @@ input_thread_t *__input_CreateThread2( vlc_object_t *p_parent,
...
@@ -295,7 +298,6 @@ input_thread_t *__input_CreateThread2( vlc_object_t *p_parent,
return
p_input
;
return
p_input
;
}
}
/**
/**
* Initialize an input thread and run it. This thread will clean after himself,
* Initialize an input thread and run it. This thread will clean after himself,
* you can forget about it. It can work either in blocking or non-blocking mode
* you can forget about it. It can work either in blocking or non-blocking mode
...
@@ -311,6 +313,9 @@ int __input_Read( vlc_object_t *p_parent, input_item_t *p_item,
...
@@ -311,6 +313,9 @@ int __input_Read( vlc_object_t *p_parent, input_item_t *p_item,
input_thread_t
*
p_input
=
NULL
;
/* thread descriptor */
input_thread_t
*
p_input
=
NULL
;
/* thread descriptor */
p_input
=
Create
(
p_parent
,
p_item
,
NULL
,
VLC_FALSE
);
p_input
=
Create
(
p_parent
,
p_item
,
NULL
,
VLC_FALSE
);
if
(
!
p_input
)
return
VLC_EGENERIC
;
/* Now we can attach our new input */
/* Now we can attach our new input */
vlc_object_attach
(
p_input
,
p_parent
);
vlc_object_attach
(
p_input
,
p_parent
);
...
@@ -324,6 +329,7 @@ int __input_Read( vlc_object_t *p_parent, input_item_t *p_item,
...
@@ -324,6 +329,7 @@ int __input_Read( vlc_object_t *p_parent, input_item_t *p_item,
if
(
vlc_thread_create
(
p_input
,
"input"
,
RunAndClean
,
if
(
vlc_thread_create
(
p_input
,
"input"
,
RunAndClean
,
VLC_THREAD_PRIORITY_INPUT
,
VLC_TRUE
)
)
VLC_THREAD_PRIORITY_INPUT
,
VLC_TRUE
)
)
{
{
input_ChangeState
(
p_input
,
ERROR_S
);
msg_Err
(
p_input
,
"cannot create input thread"
);
msg_Err
(
p_input
,
"cannot create input thread"
);
vlc_object_detach
(
p_input
);
vlc_object_detach
(
p_input
);
vlc_object_destroy
(
p_input
);
vlc_object_destroy
(
p_input
);
...
@@ -347,6 +353,9 @@ int __input_Preparse( vlc_object_t *p_parent, input_item_t *p_item )
...
@@ -347,6 +353,9 @@ int __input_Preparse( vlc_object_t *p_parent, input_item_t *p_item )
/* Allocate descriptor */
/* Allocate descriptor */
p_input
=
Create
(
p_parent
,
p_item
,
NULL
,
VLC_TRUE
);
p_input
=
Create
(
p_parent
,
p_item
,
NULL
,
VLC_TRUE
);
if
(
!
p_input
)
return
VLC_EGENERIC
;
p_input
->
i_flags
|=
OBJECT_FLAGS_QUIET
;
p_input
->
i_flags
|=
OBJECT_FLAGS_QUIET
;
p_input
->
i_flags
|=
OBJECT_FLAGS_NOINTERACT
;
p_input
->
i_flags
|=
OBJECT_FLAGS_NOINTERACT
;
...
@@ -529,7 +538,6 @@ static int RunAndClean( input_thread_t *p_input )
...
@@ -529,7 +538,6 @@ static int RunAndClean( input_thread_t *p_input )
return
0
;
return
0
;
}
}
/*****************************************************************************
/*****************************************************************************
* Main loop: Fill buffers from access, and demux
* Main loop: Fill buffers from access, and demux
*****************************************************************************/
*****************************************************************************/
...
@@ -579,6 +587,7 @@ static void MainLoop( input_thread_t *p_input )
...
@@ -579,6 +587,7 @@ static void MainLoop( input_thread_t *p_input )
{
{
/* End of file - we do not set b_die because only the
/* End of file - we do not set b_die because only the
* playlist is allowed to do so. */
* playlist is allowed to do so. */
input_ChangeState
(
p_input
,
END_S
);
msg_Dbg
(
p_input
,
"EOF reached"
);
msg_Dbg
(
p_input
,
"EOF reached"
);
p_input
->
input
.
b_eof
=
VLC_TRUE
;
p_input
->
input
.
b_eof
=
VLC_TRUE
;
}
}
...
@@ -698,7 +707,6 @@ static void MainLoop( input_thread_t *p_input )
...
@@ -698,7 +707,6 @@ static void MainLoop( input_thread_t *p_input )
}
}
}
}
static
int
Init
(
input_thread_t
*
p_input
)
static
int
Init
(
input_thread_t
*
p_input
)
{
{
char
*
psz
;
char
*
psz
;
...
@@ -754,6 +762,7 @@ static int Init( input_thread_t * p_input )
...
@@ -754,6 +762,7 @@ static int Init( input_thread_t * p_input )
p_input
->
p_sout
=
sout_NewInstance
(
p_input
,
psz
);
p_input
->
p_sout
=
sout_NewInstance
(
p_input
,
psz
);
if
(
p_input
->
p_sout
==
NULL
)
if
(
p_input
->
p_sout
==
NULL
)
{
{
input_ChangeState
(
p_input
,
ERROR_S
);
msg_Err
(
p_input
,
"cannot start stream output instance, "
\
msg_Err
(
p_input
,
"cannot start stream output instance, "
\
"aborting"
);
"aborting"
);
free
(
psz
);
free
(
psz
);
...
@@ -871,7 +880,6 @@ static int Init( input_thread_t * p_input )
...
@@ -871,7 +880,6 @@ static int Init( input_thread_t * p_input )
p_input
->
i_stop
=
0
;
p_input
->
i_stop
=
0
;
}
}
/* Load subtitles */
/* Load subtitles */
/* Get fps and set it if not already set */
/* Get fps and set it if not already set */
if
(
!
demux2_Control
(
p_input
->
input
.
p_demux
,
DEMUX_GET_FPS
,
&
f_fps
)
&&
if
(
!
demux2_Control
(
p_input
->
input
.
p_demux
,
DEMUX_GET_FPS
,
&
f_fps
)
&&
...
@@ -897,7 +905,6 @@ static int Init( input_thread_t * p_input )
...
@@ -897,7 +905,6 @@ static int Init( input_thread_t * p_input )
var_SetTime
(
p_input
,
"spu-delay"
,
(
mtime_t
)
i_delay
*
100000
);
var_SetTime
(
p_input
,
"spu-delay"
,
(
mtime_t
)
i_delay
*
100000
);
}
}
/* Look for and add subtitle files */
/* Look for and add subtitle files */
psz_subtitle
=
var_GetString
(
p_input
,
"sub-file"
);
psz_subtitle
=
var_GetString
(
p_input
,
"sub-file"
);
if
(
*
psz_subtitle
)
if
(
*
psz_subtitle
)
...
@@ -913,7 +920,6 @@ static int Init( input_thread_t * p_input )
...
@@ -913,7 +920,6 @@ static int Init( input_thread_t * p_input )
char
**
subs
=
subtitles_Detect
(
p_input
,
psz_autopath
,
char
**
subs
=
subtitles_Detect
(
p_input
,
psz_autopath
,
p_input
->
input
.
p_item
->
psz_uri
);
p_input
->
input
.
p_item
->
psz_uri
);
input_source_t
*
sub
;
input_source_t
*
sub
;
i
=
0
;
i
=
0
;
/* Try to autoselect the first autodetected subtitles file
/* Try to autoselect the first autodetected subtitles file
...
@@ -1087,11 +1093,13 @@ static int Init( input_thread_t * p_input )
...
@@ -1087,11 +1093,13 @@ static int Init( input_thread_t * p_input )
}
}
/* initialization is complete */
/* initialization is complete */
input_ChangeState
(
p_input
,
PLAYING_S
);
input_ChangeState
(
p_input
,
PLAYING_S
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
error:
error:
input_ChangeState
(
p_input
,
ERROR_S
);
if
(
p_input
->
p_es_out
)
if
(
p_input
->
p_es_out
)
input_EsOutDelete
(
p_input
->
p_es_out
);
input_EsOutDelete
(
p_input
->
p_es_out
);
...
@@ -1118,6 +1126,7 @@ static void Error( input_thread_t *p_input )
...
@@ -1118,6 +1126,7 @@ static void Error( input_thread_t *p_input )
while
(
!
p_input
->
b_die
)
while
(
!
p_input
->
b_die
)
{
{
/* Sleep a while */
/* Sleep a while */
input_ChangeState
(
p_input
,
ERROR_S
);
msleep
(
INPUT_IDLE_SLEEP
);
msleep
(
INPUT_IDLE_SLEEP
);
}
}
}
}
...
@@ -1132,7 +1141,7 @@ static void End( input_thread_t * p_input )
...
@@ -1132,7 +1141,7 @@ static void End( input_thread_t * p_input )
msg_Dbg
(
p_input
,
"closing input"
);
msg_Dbg
(
p_input
,
"closing input"
);
/* We are at the end */
/* We are at the end */
input_ChangeState
(
p_input
,
END_S
);
input_ChangeState
(
p_input
,
END_S
);
/* Clean control variables */
/* Clean control variables */
input_ControlVarClean
(
p_input
);
input_ControlVarClean
(
p_input
);
...
@@ -1239,6 +1248,10 @@ static inline int ControlPopNoLock( input_thread_t *p_input,
...
@@ -1239,6 +1248,10 @@ static inline int ControlPopNoLock( input_thread_t *p_input,
static
void
ControlReduce
(
input_thread_t
*
p_input
)
static
void
ControlReduce
(
input_thread_t
*
p_input
)
{
{
int
i
;
int
i
;
if
(
!
p_input
)
return
;
for
(
i
=
1
;
i
<
p_input
->
i_control
;
i
++
)
for
(
i
=
1
;
i
<
p_input
->
i_control
;
i
++
)
{
{
const
int
i_lt
=
p_input
->
control
[
i
-
1
].
i_type
;
const
int
i_lt
=
p_input
->
control
[
i
-
1
].
i_type
;
...
@@ -1920,6 +1933,7 @@ static int InputSourceInit( input_thread_t *p_input,
...
@@ -1920,6 +1933,7 @@ static int InputSourceInit( input_thread_t *p_input,
vlc_value_t
val
;
vlc_value_t
val
;
if
(
!
in
)
return
VLC_EGENERIC
;
if
(
!
in
)
return
VLC_EGENERIC
;
if
(
!
p_input
)
return
VLC_EGENERIC
;
/* Split uri */
/* Split uri */
if
(
!
p_input
->
b_preparsing
)
if
(
!
p_input
->
b_preparsing
)
...
@@ -2009,7 +2023,7 @@ static int InputSourceInit( input_thread_t *p_input,
...
@@ -2009,7 +2023,7 @@ static int InputSourceInit( input_thread_t *p_input,
{
{
int64_t
i_pts_delay
;
int64_t
i_pts_delay
;
input_ChangeState
(
p_input
,
OPENING_S
);
input_ChangeState
(
p_input
,
OPENING_S
);
/* Now try a real access */
/* Now try a real access */
in
->
p_access
=
access2_New
(
p_input
,
psz_access
,
psz_demux
,
psz_path
,
in
->
p_access
=
access2_New
(
p_input
,
psz_access
,
psz_demux
,
psz_path
,
...
@@ -2107,7 +2121,7 @@ static int InputSourceInit( input_thread_t *p_input,
...
@@ -2107,7 +2121,7 @@ static int InputSourceInit( input_thread_t *p_input,
var_Set
(
p_input
,
"seekable"
,
val
);
var_Set
(
p_input
,
"seekable"
,
val
);
}
}
input_ChangeState
(
p_input
,
BUFFERING_S
);
input_ChangeState
(
p_input
,
BUFFERING_S
);
/* Create the stream_t */
/* Create the stream_t */
in
->
p_stream
=
stream_AccessNew
(
in
->
p_access
,
p_input
->
b_preparsing
);
in
->
p_stream
=
stream_AccessNew
(
in
->
p_access
,
p_input
->
b_preparsing
);
...
@@ -2160,6 +2174,8 @@ static int InputSourceInit( input_thread_t *p_input,
...
@@ -2160,6 +2174,8 @@ static int InputSourceInit( input_thread_t *p_input,
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
error:
error:
input_ChangeState
(
p_input
,
ERROR_S
);
if
(
in
->
p_demux
)
if
(
in
->
p_demux
)
demux2_Delete
(
in
->
p_demux
);
demux2_Delete
(
in
->
p_demux
);
...
@@ -2255,6 +2271,8 @@ static void SlaveSeek( input_thread_t *p_input )
...
@@ -2255,6 +2271,8 @@ static void SlaveSeek( input_thread_t *p_input )
int64_t
i_time
;
int64_t
i_time
;
int
i
;
int
i
;
if
(
!
p_input
)
return
;
if
(
demux2_Control
(
p_input
->
input
.
p_demux
,
DEMUX_GET_TIME
,
&
i_time
)
)
if
(
demux2_Control
(
p_input
->
input
.
p_demux
,
DEMUX_GET_TIME
,
&
i_time
)
)
{
{
msg_Err
(
p_input
,
"demux doesn't like DEMUX_GET_TIME"
);
msg_Err
(
p_input
,
"demux doesn't like DEMUX_GET_TIME"
);
...
@@ -2272,6 +2290,7 @@ static void SlaveSeek( input_thread_t *p_input )
...
@@ -2272,6 +2290,7 @@ static void SlaveSeek( input_thread_t *p_input )
}
}
}
}
}
}
/*****************************************************************************
/*****************************************************************************
* InputMetaUser:
* InputMetaUser:
*****************************************************************************/
*****************************************************************************/
...
@@ -2301,7 +2320,6 @@ static void InputMetaUser( input_thread_t *p_input )
...
@@ -2301,7 +2320,6 @@ static void InputMetaUser( input_thread_t *p_input )
#undef GET_META
#undef GET_META
}
}
/*****************************************************************************
/*****************************************************************************
* MRLSplit: parse the access, demux and url part of the
* MRLSplit: parse the access, demux and url part of the
* Media Resource Locator.
* Media Resource Locator.
...
@@ -2492,3 +2510,4 @@ vlc_bool_t input_AddSubtitles( input_thread_t *p_input, char *psz_subtitle,
...
@@ -2492,3 +2510,4 @@ vlc_bool_t input_AddSubtitles( input_thread_t *p_input, char *psz_subtitle,
return
VLC_TRUE
;
return
VLC_TRUE
;
}
}
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