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
Hide 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,
...
@@ -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
)
stream_t
*
s
,
es_out_t
*
out
,
bool
b_quick
)
{
{
demux_t
*
p_demux
=
vlc_custom_create
(
p_obj
,
sizeof
(
*
p_demux
),
"demux"
);
demux_t
*
p_demux
=
vlc_custom_create
(
p_obj
,
sizeof
(
*
p_demux
),
"demux"
);
const
char
*
psz_module
;
if
(
unlikely
(
p_demux
==
NULL
)
)
return
NULL
;
if
(
p_demux
==
NULL
)
return
NULL
;
p_demux
->
p_input
=
p_parent_input
;
p_demux
->
p_input
=
p_parent_input
;
/* Parse URL */
p_demux
->
psz_access
=
strdup
(
psz_access
);
p_demux
->
psz_access
=
strdup
(
psz_access
);
p_demux
->
psz_demux
=
strdup
(
psz_demux
);
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_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
(
unlikely
(
p_demux
->
psz_access
==
NULL
if
(
*
p_demux
->
psz_demux
==
'\0'
)
||
p_demux
->
psz_demux
==
NULL
{
||
p_demux
->
psz_location
==
NULL
)
)
free
(
p_demux
->
psz_demux
);
goto
error
;
p_demux
->
psz_demux
=
var_GetNonEmptyString
(
p_obj
,
"demux"
);
if
(
p_demux
->
psz_demux
==
NULL
)
p_demux
->
psz_demux
=
strdup
(
""
);
}
if
(
!
b_quick
)
if
(
!
b_quick
)
msg_Dbg
(
p_obj
,
"creating demux: access='%s' demux='%s' "
msg_Dbg
(
p_obj
,
"creating demux: access='%s' demux='%s' "
...
@@ -100,83 +99,79 @@ demux_t *demux_New( vlc_object_t *p_obj, input_thread_t *p_parent_input,
...
@@ -100,83 +99,79 @@ 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_title
=
0
;
p_demux
->
info
.
i_seekpoint
=
0
;
p_demux
->
info
.
i_seekpoint
=
0
;
if
(
s
)
psz_module
=
p_demux
->
psz_demux
;
/* NOTE: Add only file without any problems here and with strong detection:
else
psz_module
=
p_demux
->
psz_access
;
* - no .mp3, .a52, ...
* - wav can't be added 'cause of a52 and dts in them as raw audio
const
char
*
psz_ext
;
*/
static
const
struct
{
char
ext
[
5
];
char
demux
[
9
];
}
exttodemux
[]
=
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.
{
"aiff"
,
"aiff"
},
* - no .mp3, .a52, ...
{
"asf"
,
"asf"
},
{
"wmv"
,
"asf"
},
{
"wma"
,
"asf"
},
* - wav can't be added 'cause of a52 and dts in them as raw audio
{
"avi"
,
"avi"
},
*/
{
"au"
,
"au"
},
static
const
struct
{
char
ext
[
5
];
char
demux
[
9
];
}
exttodemux
[]
=
{
"flac"
,
"flac"
},
{
{
"dv"
,
"dv"
},
{
"aiff"
,
"aiff"
},
{
"drc"
,
"dirac"
},
{
"asf"
,
"asf"
},
{
"wmv"
,
"asf"
},
{
"wma"
,
"asf"
},
{
"m3u"
,
"m3u"
},
{
"avi"
,
"avi"
},
{
"m3u8"
,
"m3u8"
},
{
"au"
,
"au"
},
{
"mkv"
,
"mkv"
},
{
"mka"
,
"mkv"
},
{
"mks"
,
"mkv"
},
{
"flac"
,
"flac"
},
{
"mp4"
,
"mp4"
},
{
"m4a"
,
"mp4"
},
{
"mov"
,
"mp4"
},
{
"moov"
,
"mp4"
},
{
"dv"
,
"dv"
},
{
"nsv"
,
"nsv"
},
{
"drc"
,
"dirac"
},
{
"ogg"
,
"ogg"
},
{
"ogm"
,
"ogg"
},
/* legacy Ogg */
{
"m3u"
,
"m3u"
},
{
"oga"
,
"ogg"
},
{
"spx"
,
"ogg"
},
{
"ogv"
,
"ogg"
},
{
"m3u8"
,
"m3u8"
},
{
"ogx"
,
"ogg"
},
/*RFC5334*/
{
"mkv"
,
"mkv"
},
{
"mka"
,
"mkv"
},
{
"mks"
,
"mkv"
},
{
"opus"
,
"ogg"
},
/*draft-terriberry-oggopus-01*/
{
"mp4"
,
"mp4"
},
{
"m4a"
,
"mp4"
},
{
"mov"
,
"mp4"
},
{
"moov"
,
"mp4"
},
{
"pva"
,
"pva"
},
{
"nsv"
,
"nsv"
},
{
"rm"
,
"avformat"
},
{
"ogg"
,
"ogg"
},
{
"ogm"
,
"ogg"
},
/* legacy Ogg */
{
"m4v"
,
"m4v"
},
{
"oga"
,
"ogg"
},
{
"spx"
,
"ogg"
},
{
"ogv"
,
"ogg"
},
{
"h264"
,
"h264"
},
{
"ogx"
,
"ogg"
},
/*RFC5334*/
{
"voc"
,
"voc"
},
{
"opus"
,
"ogg"
},
/*draft-terriberry-oggopus-01*/
{
"mid"
,
"smf"
},
{
"rmi"
,
"smf"
},
{
"kar"
,
"smf"
},
{
"pva"
,
"pva"
},
{
""
,
""
},
{
"rm"
,
"avformat"
},
};
{
"m4v"
,
"m4v"
},
/* Here, we don't mind if it does not work, it must be quick */
{
"h264"
,
"h264"
},
static
const
struct
{
char
ext
[
4
];
char
demux
[
5
];
}
exttodemux_quick
[]
=
{
"voc"
,
"voc"
},
{
{
"mid"
,
"smf"
},
{
"rmi"
,
"smf"
},
{
"kar"
,
"smf"
},
{
"mp3"
,
"mpga"
},
{
""
,
""
},
{
"ogg"
,
"ogg"
},
};
{
"wma"
,
"asf"
},
/* Here, we don't mind if it does not work, it must be quick */
{
""
,
""
}
static
const
struct
{
char
ext
[
4
];
char
demux
[
5
];
}
exttodemux_quick
[]
=
};
{
{
"mp3"
,
"mpga"
},
{
"ogg"
,
"ogg"
},
{
"wma"
,
"asf"
},
{
""
,
""
}
};
psz_ext
++
;
// skip '.'
if
(
s
!=
NULL
)
{
const
char
*
psz_ext
;
const
char
*
psz_module
=
p_demux
->
psz_demux
;
if
(
!
b_quick
)
if
(
*
psz_module
&&
p_demux
->
psz_file
!=
NULL
&&
(
psz_ext
=
strrchr
(
p_demux
->
psz_file
,
'.'
))
!=
NULL
)
{
{
for
(
unsigned
i
=
0
;
exttodemux
[
i
].
ext
[
0
];
i
++
)
psz_ext
++
;
// skip '.'
if
(
!
b_quick
)
{
{
if
(
!
strcasecmp
(
psz_ext
,
exttodemux
[
i
].
ext
)
)
for
(
unsigned
i
=
0
;
exttodemux
[
i
].
ext
[
0
];
i
++
)
{
{
psz_module
=
exttodemux
[
i
].
demux
;
if
(
!
strcasecmp
(
psz_ext
,
exttodemux
[
i
].
ext
)
)
break
;
{
psz_module
=
exttodemux
[
i
].
demux
;
break
;
}
}
}
}
}
}
else
else
{
for
(
unsigned
i
=
0
;
exttodemux_quick
[
i
].
ext
[
0
];
i
++
)
{
{
if
(
!
strcasecmp
(
psz_ext
,
exttodemux_quick
[
i
].
ext
)
)
for
(
unsigned
i
=
0
;
exttodemux_quick
[
i
].
ext
[
0
];
i
++
)
{
{
psz_module
=
exttodemux_quick
[
i
].
demux
;
if
(
!
strcasecmp
(
psz_ext
,
exttodemux_quick
[
i
].
ext
)
)
break
;
{
psz_module
=
exttodemux_quick
[
i
].
demux
;
break
;
}
}
}
}
}
}
}
}
if
(
s
)
{
/* ID3/APE tags will mess-up demuxer probing so we skip it here.
/* 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
* ID3/APE parsers will called later on in the demuxer to access the
* skipped info. */
* skipped info. */
...
@@ -191,21 +186,20 @@ demux_t *demux_New( vlc_object_t *p_obj, input_thread_t *p_parent_input,
...
@@ -191,21 +186,20 @@ demux_t *demux_New( vlc_object_t *p_obj, input_thread_t *p_parent_input,
else
else
{
{
p_demux
->
p_module
=
p_demux
->
p_module
=
module_need
(
p_demux
,
"access_demux"
,
psz_module
,
module_need
(
p_demux
,
"access_demux"
,
p_demux
->
psz_access
,
true
);
!
strcmp
(
psz_module
,
p_demux
->
psz_access
)
);
}
}
if
(
p_demux
->
p_module
==
NULL
)
if
(
p_demux
->
p_module
==
NULL
)
{
goto
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
;
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
;
}
}
/*****************************************************************************
/*****************************************************************************
...
...
src/libvlc-module.c
View file @
6dc87602
...
@@ -1884,7 +1884,7 @@ vlc_module_begin ()
...
@@ -1884,7 +1884,7 @@ vlc_module_begin ()
add_module
(
"access"
,
"access"
,
NULL
,
ACCESS_TEXT
,
ACCESS_LONGTEXT
,
true
)
add_module
(
"access"
,
"access"
,
NULL
,
ACCESS_TEXT
,
ACCESS_LONGTEXT
,
true
)
set_subcategory
(
SUBCAT_INPUT_DEMUX
)
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_VCODEC
)
set_subcategory
(
SUBCAT_INPUT_ACODEC
)
set_subcategory
(
SUBCAT_INPUT_ACODEC
)
set_subcategory
(
SUBCAT_INPUT_SCODEC
)
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