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,
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
);
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_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,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_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
,
'.'
))
)
/* 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
*/
static
const
struct
{
char
ext
[
5
];
char
demux
[
9
];
}
exttodemux
[]
=
{
/* XXX: add only file without any problem here and with strong detection.
* - no .mp3, .a52, ...
* - wav can't be added 'cause of a52 and dts in them as raw audio
*/
static
const
struct
{
char
ext
[
5
];
char
demux
[
9
];
}
exttodemux
[]
=
{
{
"aiff"
,
"aiff"
},
{
"asf"
,
"asf"
},
{
"wmv"
,
"asf"
},
{
"wma"
,
"asf"
},
{
"avi"
,
"avi"
},
{
"au"
,
"au"
},
{
"flac"
,
"flac"
},
{
"dv"
,
"dv"
},
{
"drc"
,
"dirac"
},
{
"m3u"
,
"m3u"
},
{
"m3u8"
,
"m3u8"
},
{
"mkv"
,
"mkv"
},
{
"mka"
,
"mkv"
},
{
"mks"
,
"mkv"
},
{
"mp4"
,
"mp4"
},
{
"m4a"
,
"mp4"
},
{
"mov"
,
"mp4"
},
{
"moov"
,
"mp4"
},
{
"nsv"
,
"nsv"
},
{
"ogg"
,
"ogg"
},
{
"ogm"
,
"ogg"
},
/* legacy Ogg */
{
"oga"
,
"ogg"
},
{
"spx"
,
"ogg"
},
{
"ogv"
,
"ogg"
},
{
"ogx"
,
"ogg"
},
/*RFC5334*/
{
"opus"
,
"ogg"
},
/*draft-terriberry-oggopus-01*/
{
"pva"
,
"pva"
},
{
"rm"
,
"avformat"
},
{
"m4v"
,
"m4v"
},
{
"h264"
,
"h264"
},
{
"voc"
,
"voc"
},
{
"mid"
,
"smf"
},
{
"rmi"
,
"smf"
},
{
"kar"
,
"smf"
},
{
""
,
""
},
};
/* 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"
},
{
""
,
""
}
};
{
"aiff"
,
"aiff"
},
{
"asf"
,
"asf"
},
{
"wmv"
,
"asf"
},
{
"wma"
,
"asf"
},
{
"avi"
,
"avi"
},
{
"au"
,
"au"
},
{
"flac"
,
"flac"
},
{
"dv"
,
"dv"
},
{
"drc"
,
"dirac"
},
{
"m3u"
,
"m3u"
},
{
"m3u8"
,
"m3u8"
},
{
"mkv"
,
"mkv"
},
{
"mka"
,
"mkv"
},
{
"mks"
,
"mkv"
},
{
"mp4"
,
"mp4"
},
{
"m4a"
,
"mp4"
},
{
"mov"
,
"mp4"
},
{
"moov"
,
"mp4"
},
{
"nsv"
,
"nsv"
},
{
"ogg"
,
"ogg"
},
{
"ogm"
,
"ogg"
},
/* legacy Ogg */
{
"oga"
,
"ogg"
},
{
"spx"
,
"ogg"
},
{
"ogv"
,
"ogg"
},
{
"ogx"
,
"ogg"
},
/*RFC5334*/
{
"opus"
,
"ogg"
},
/*draft-terriberry-oggopus-01*/
{
"pva"
,
"pva"
},
{
"rm"
,
"avformat"
},
{
"m4v"
,
"m4v"
},
{
"h264"
,
"h264"
},
{
"voc"
,
"voc"
},
{
"mid"
,
"smf"
},
{
"rmi"
,
"smf"
},
{
"kar"
,
"smf"
},
{
""
,
""
},
};
/* 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
;
break
;
if
(
!
strcasecmp
(
psz_ext
,
exttodemux
[
i
].
ext
)
)
{
psz_module
=
exttodemux
[
i
].
demux
;
break
;
}
}
}
}
else
{
for
(
unsigned
i
=
0
;
exttodemux_quick
[
i
].
ext
[
0
];
i
++
)
else
{
if
(
!
strcasecmp
(
psz_ext
,
exttodemux_quick
[
i
].
ext
)
)
for
(
unsigned
i
=
0
;
exttodemux_quick
[
i
].
ext
[
0
];
i
++
)
{
psz_module
=
exttodemux_quick
[
i
].
demux
;
break
;
if
(
!
strcasecmp
(
psz_ext
,
exttodemux_quick
[
i
].
ext
)
)
{
psz_module
=
exttodemux_quick
[
i
].
demux
;
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
)
{
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
;
}
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
;
}
/*****************************************************************************
...
...
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