Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
6dc87602
Commit
6dc87602
authored
Mar 10, 2014
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
input: factor if and add error handling to demux_New()
parent
e1c3843f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
83 additions
and
89 deletions
+83
-89
src/input/demux.c
src/input/demux.c
+82
-88
src/libvlc-module.c
src/libvlc-module.c
+1
-1
No files found.
src/input/demux.c
View file @
6dc87602
...
...
@@ -63,26 +63,25 @@ demux_t *demux_New( vlc_object_t *p_obj, input_thread_t *p_parent_input,
stream_t
*
s
,
es_out_t
*
out
,
bool
b_quick
)
{
demux_t
*
p_demux
=
vlc_custom_create
(
p_obj
,
sizeof
(
*
p_demux
),
"demux"
);
const
char
*
psz_module
;
if
(
p_demux
==
NULL
)
return
NULL
;
if
(
unlikely
(
p_demux
==
NULL
)
)
return
NULL
;
p_demux
->
p_input
=
p_parent_input
;
/* Parse URL */
p_demux
->
psz_access
=
strdup
(
psz_access
);
if
(
psz_demux
[
0
]
==
'\0'
)
/* Take into account "demux" to be able to do :demux=dump */
p_demux
->
psz_demux
=
var_InheritString
(
p_obj
,
"demux"
);
else
p_demux
->
psz_demux
=
strdup
(
psz_demux
);
p_demux
->
psz_location
=
strdup
(
psz_location
);
p_demux
->
psz_file
=
get_path
(
psz_location
);
p_demux
->
psz_file
=
get_path
(
psz_location
);
/* parse URL */
/* Take into account "demux" to be able to do :demux=dump */
if
(
*
p_demux
->
psz_demux
==
'\0'
)
{
free
(
p_demux
->
psz_demux
);
p_demux
->
psz_demux
=
var_GetNonEmptyString
(
p_obj
,
"demux"
);
if
(
p_demux
->
psz_demux
==
NULL
)
p_demux
->
psz_demux
=
strdup
(
""
);
}
if
(
unlikely
(
p_demux
->
psz_access
==
NULL
||
p_demux
->
psz_demux
==
NULL
||
p_demux
->
psz_location
==
NULL
)
)
goto
error
;
if
(
!
b_quick
)
msg_Dbg
(
p_obj
,
"creating demux: access='%s' demux='%s' "
...
...
@@ -100,16 +99,7 @@ demux_t *demux_New( vlc_object_t *p_obj, input_thread_t *p_parent_input,
p_demux
->
info
.
i_title
=
0
;
p_demux
->
info
.
i_seekpoint
=
0
;
if
(
s
)
psz_module
=
p_demux
->
psz_demux
;
else
psz_module
=
p_demux
->
psz_access
;
const
char
*
psz_ext
;
if
(
s
&&
*
psz_module
==
'\0'
&&
p_demux
->
psz_file
!=
NULL
&&
(
psz_ext
=
strrchr
(
p_demux
->
psz_file
,
'.'
))
)
{
/* XXX: add only file without any problem here and with strong detection.
/* NOTE: Add only file without any problems here and with strong detection:
* - no .mp3, .a52, ...
* - wav can't be added 'cause of a52 and dts in them as raw audio
*/
...
...
@@ -148,6 +138,14 @@ demux_t *demux_New( vlc_object_t *p_obj, input_thread_t *p_parent_input,
{
""
,
""
}
};
if
(
s
!=
NULL
)
{
const
char
*
psz_ext
;
const
char
*
psz_module
=
p_demux
->
psz_demux
;
if
(
*
psz_module
&&
p_demux
->
psz_file
!=
NULL
&&
(
psz_ext
=
strrchr
(
p_demux
->
psz_file
,
'.'
))
!=
NULL
)
{
psz_ext
++
;
// skip '.'
if
(
!
b_quick
)
...
...
@@ -171,12 +169,9 @@ demux_t *demux_New( vlc_object_t *p_obj, input_thread_t *p_parent_input,
break
;
}
}
}
}
if
(
s
)
{
/* ID3/APE tags will mess-up demuxer probing so we skip it here.
* ID3/APE parsers will called later on in the demuxer to access the
* skipped info. */
...
...
@@ -191,21 +186,20 @@ demux_t *demux_New( vlc_object_t *p_obj, input_thread_t *p_parent_input,
else
{
p_demux
->
p_module
=
module_need
(
p_demux
,
"access_demux"
,
psz_module
,
!
strcmp
(
psz_module
,
p_demux
->
psz_access
)
);
module_need
(
p_demux
,
"access_demux"
,
p_demux
->
psz_access
,
true
);
}
if
(
p_demux
->
p_module
==
NULL
)
{
goto
error
;
return
p_demux
;
error:
free
(
p_demux
->
psz_file
);
free
(
p_demux
->
psz_location
);
free
(
p_demux
->
psz_demux
);
free
(
p_demux
->
psz_access
);
vlc_object_release
(
p_demux
);
return
NULL
;
}
return
p_demux
;
}
/*****************************************************************************
...
...
src/libvlc-module.c
View file @
6dc87602
...
...
@@ -1884,7 +1884,7 @@ vlc_module_begin ()
add_module
(
"access"
,
"access"
,
NULL
,
ACCESS_TEXT
,
ACCESS_LONGTEXT
,
true
)
set_subcategory
(
SUBCAT_INPUT_DEMUX
)
add_module
(
"demux"
,
"demux"
,
NULL
,
DEMUX_TEXT
,
DEMUX_LONGTEXT
,
true
)
add_module
(
"demux"
,
"demux"
,
"any"
,
DEMUX_TEXT
,
DEMUX_LONGTEXT
,
true
)
set_subcategory
(
SUBCAT_INPUT_VCODEC
)
set_subcategory
(
SUBCAT_INPUT_ACODEC
)
set_subcategory
(
SUBCAT_INPUT_SCODEC
)
...
...
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