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
f1cdb745
Commit
f1cdb745
authored
Oct 21, 2015
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
input: move stream/stream filter initialization
parent
8826c29c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
154 additions
and
144 deletions
+154
-144
src/input/demux.c
src/input/demux.c
+91
-0
src/input/demux.h
src/input/demux.h
+4
-0
src/input/input.c
src/input/input.c
+59
-144
No files found.
src/input/demux.c
View file @
f1cdb745
...
...
@@ -240,6 +240,97 @@ error:
return
NULL
;
}
demux_t
*
input_DemuxNew
(
vlc_object_t
*
obj
,
const
char
*
access_name
,
const
char
*
demux_name
,
const
char
*
path
,
es_out_t
*
out
,
bool
quick
,
input_thread_t
*
input
)
{
char
*
demux_var
=
NULL
;
assert
(
access_name
!=
NULL
);
assert
(
demux_name
!=
NULL
);
assert
(
path
!=
NULL
);
if
(
demux_name
[
0
]
==
'\0'
)
{
/* special hack for forcing a demuxer with --demux=module
* (and do nothing with a list) */
demux_var
=
var_InheritString
(
obj
,
"demux"
);
if
(
demux_var
!=
NULL
)
{
demux_name
=
demux_var
;
msg_Dbg
(
obj
,
"specified demux: %s"
,
demux_name
);
}
else
demux_name
=
"any"
;
}
demux_t
*
demux
=
NULL
;
if
(
quick
)
{
if
(
strcasecmp
(
demux_name
,
"any"
)
)
goto
out
;
msg_Dbg
(
obj
,
"preparsing %s://%s"
,
access_name
,
path
);
}
else
/* Try access_demux first */
demux
=
demux_NewAdvanced
(
obj
,
input
,
access_name
,
demux_name
,
path
,
NULL
,
out
,
false
);
if
(
demux
==
NULL
)
{
/* Then try a real access,stream,demux chain */
/* Create the stream_t */
stream_t
*
stream
=
NULL
;
char
*
url
;
if
(
likely
(
asprintf
(
&
url
,
"%s://%s"
,
access_name
,
path
)
>=
0
)
)
{
stream
=
stream_AccessNew
(
obj
,
input
,
url
);
free
(
url
);
}
if
(
stream
==
NULL
)
{
msg_Err
(
obj
,
"cannot access %s://%s"
,
access_name
,
path
);
goto
out
;
}
/* Add stream filters */
stream
=
stream_FilterAutoNew
(
stream
);
char
*
filters
=
var_InheritString
(
obj
,
"stream-filter"
);
if
(
filters
!=
NULL
)
{
stream
=
stream_FilterChainNew
(
stream
,
filters
);
free
(
filters
);
}
if
(
var_InheritBool
(
obj
,
"input-record-native"
)
)
stream
=
stream_FilterChainNew
(
stream
,
"record"
);
/* FIXME: Hysterical raisins. Access is not updated according to any
* redirect but path is. This does not make much sense. Probably the
* URL should be passed as a whole and demux_t.psz_access removed. */
if
(
stream
->
psz_url
!=
NULL
)
{
path
=
strstr
(
stream
->
psz_url
,
"://"
);
if
(
path
!=
NULL
)
path
+=
3
;
}
demux
=
demux_NewAdvanced
(
obj
,
input
,
access_name
,
demux_name
,
path
,
stream
,
out
,
quick
);
if
(
demux
==
NULL
)
{
msg_Err
(
obj
,
"cannot parse %s://%s"
,
access_name
,
path
);
stream_Delete
(
stream
);
}
}
out:
free
(
demux_var
);
return
demux
;
}
/*****************************************************************************
* demux_Delete:
*****************************************************************************/
...
...
src/input/demux.h
View file @
f1cdb745
...
...
@@ -35,4 +35,8 @@ demux_t *demux_NewAdvanced( vlc_object_t *p_obj, input_thread_t *p_parent_input,
const
char
*
psz_access
,
const
char
*
psz_demux
,
const
char
*
psz_path
,
stream_t
*
s
,
es_out_t
*
out
,
bool
);
#define demux_NewAdvanced( a, b, c, d, e, f, g, h ) demux_NewAdvanced(VLC_OBJECT(a),b,c,d,e,f,g,h)
demux_t
*
input_DemuxNew
(
vlc_object_t
*
,
const
char
*
access
,
const
char
*
demux
,
const
char
*
path
,
es_out_t
*
out
,
bool
quick
,
input_thread_t
*
);
#endif
src/input/input.c
View file @
f1cdb745
...
...
@@ -33,7 +33,6 @@
#include <limits.h>
#include <assert.h>
#include <errno.h>
#include <math.h>
#include <sys/stat.h>
...
...
@@ -42,7 +41,6 @@
#include "es_out.h"
#include "es_out_timeshift.h"
#include "demux.h"
#include "stream.h"
#include "item.h"
#include "resource.h"
...
...
@@ -2123,54 +2121,27 @@ static int InputSourceInit( input_thread_t *p_input,
const
char
*
psz_forced_demux
,
bool
b_in_can_fail
)
{
const
char
*
psz_access
,
*
psz_demux
,
*
psz_path
,
*
psz_anchor
=
NULL
;
char
*
psz_var_demux
=
NULL
;
double
f_fps
;
assert
(
psz_mrl
);
char
*
psz_dup
=
strdup
(
psz_mrl
);
if
(
psz_dup
==
NULL
)
goto
error
;
return
VLC_ENOMEM
;
/* Split uri */
input_SplitMRL
(
&
psz_access
,
&
psz_demux
,
&
psz_path
,
&
psz_anchor
,
psz_dup
);
if
(
psz_forced_demux
!=
NULL
)
psz_demux
=
psz_forced_demux
;
msg_Dbg
(
p_input
,
"`%s' gives access `%s' demux `%s' path `%s'"
,
psz_mrl
,
psz_access
,
psz_demux
,
psz_path
);
if
(
!
p_input
->
b_preparsing
)
{
/* Find optional titles and seekpoints */
MRLSections
(
psz_anchor
,
&
in
->
i_title_start
,
&
in
->
i_title_end
,
&
in
->
i_seekpoint_start
,
&
in
->
i_seekpoint_end
);
if
(
psz_forced_demux
&&
*
psz_forced_demux
)
{
psz_demux
=
psz_forced_demux
;
}
else
if
(
*
psz_demux
==
'\0'
)
{
/* special hack for forcing a demuxer with --demux=module
* (and do nothing with a list) */
psz_var_demux
=
var_GetNonEmptyString
(
p_input
,
"demux"
);
psz_demux
=
(
psz_var_demux
!=
NULL
)
?
psz_var_demux
:
"any"
;
msg_Dbg
(
p_input
,
"specified demux `%s'"
,
psz_demux
);
}
/* Try access_demux first */
in
->
p_demux
=
demux_NewAdvanced
(
p_input
,
p_input
,
psz_access
,
psz_demux
,
psz_path
,
NULL
,
p_input
->
p
->
p_es_out
,
false
);
}
else
{
if
(
*
psz_demux
)
goto
error
;
msg_Dbg
(
p_input
,
"trying to pre-parse %s"
,
psz_path
);
}
if
(
in
->
p_demux
)
{
}
else
{
/* Now try a real access */
if
(
&
p_input
->
p
->
input
==
in
)
{
/* On master stream only, use input-list */
char
*
str
=
var_InheritString
(
p_input
,
"input-list"
);
...
...
@@ -2224,67 +2195,20 @@ static int InputSourceInit( input_thread_t *p_input,
TAB_CLEAN
(
count
,
tab
);
}
/* Create the stream_t */
stream_t
*
p_stream
=
NULL
;
char
*
url
;
in
->
p_demux
=
input_DemuxNew
(
VLC_OBJECT
(
p_input
),
psz_access
,
psz_demux
,
psz_path
,
p_input
->
p
->
p_es_out
,
p_input
->
b_preparsing
,
p_input
);
free
(
psz_dup
);
if
(
likely
(
asprintf
(
&
url
,
"%s://%s"
,
psz_access
,
psz_path
)
>=
0
)
)
{
p_stream
=
stream_AccessNew
(
VLC_OBJECT
(
p_input
),
p_input
,
url
);
free
(
url
);
}
if
(
p_stream
==
NULL
)
if
(
in
->
p_demux
==
NULL
)
{
msg_Err
(
p_input
,
"open of `%s' failed"
,
psz_mrl
);
if
(
!
b_in_can_fail
&&
!
input_Stopped
(
p_input
)
)
dialog_Fatal
(
p_input
,
_
(
"Your input can't be opened"
),
_
(
"VLC is unable to open the MRL '%s'."
" Check the log for details."
),
psz_mrl
);
goto
error
;
}
/* Add stream filters */
p_stream
=
stream_FilterAutoNew
(
p_stream
);
char
*
filters
=
var_GetNonEmptyString
(
p_input
,
"stream-filter"
);
if
(
filters
!=
NULL
)
{
p_stream
=
stream_FilterChainNew
(
p_stream
,
filters
);
free
(
filters
);
}
if
(
var_GetBool
(
p_input
,
"input-record-native"
)
)
p_stream
=
stream_FilterChainNew
(
p_stream
,
"record"
);
if
(
p_stream
->
psz_url
!=
NULL
)
/* Take access/stream redirections into account: */
psz_path
=
strstr
(
p_stream
->
psz_url
,
"://"
);
if
(
psz_path
==
NULL
)
psz_path
=
""
;
in
->
p_demux
=
demux_NewAdvanced
(
p_input
,
p_input
,
psz_access
,
psz_demux
,
psz_path
,
p_stream
,
p_input
->
p
->
p_es_out
,
p_input
->
b_preparsing
);
if
(
in
->
p_demux
==
NULL
)
{
msg_Err
(
p_input
,
"no suitable demux module for `%s/%s://%s'"
,
psz_access
,
psz_demux
,
psz_path
);
if
(
!
b_in_can_fail
&&
!
input_Stopped
(
p_input
)
)
dialog_Fatal
(
VLC_OBJECT
(
p_input
),
_
(
"VLC can't recognize the input's format"
),
_
(
"The format of '%s' cannot be detected. "
"Have a look at the log for details."
),
psz_mrl
);
stream_Delete
(
p_stream
);
goto
error
;
}
assert
(
in
->
p_demux
->
pf_demux
!=
NULL
);
return
VLC_EGENERIC
;
}
free
(
psz_var_demux
);
free
(
psz_dup
);
/* Get infos from (access_)demux */
bool
b_can_seek
;
if
(
demux_Control
(
in
->
p_demux
,
DEMUX_CAN_SEEK
,
&
b_can_seek
)
)
...
...
@@ -2381,15 +2305,6 @@ static int InputSourceInit( input_thread_t *p_input,
in
->
b_can_pace_control
=
!
var_GetInteger
(
p_input
,
"clock-synchro"
);
return
VLC_SUCCESS
;
error:
if
(
in
->
p_demux
)
demux_Delete
(
in
->
p_demux
);
free
(
psz_var_demux
);
free
(
psz_dup
);
return
VLC_EGENERIC
;
}
/*****************************************************************************
...
...
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