Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
GSoC
GSoC2018
macOS
vlc
Commits
d63b17d1
Commit
d63b17d1
authored
Jul 07, 2010
by
Rémi Denis-Courmont
Browse files
demux: provide both URL and file path as with access
This commit may eat your domestic pets.
parent
222f800a
Changes
27
Hide whitespace changes
Inline
Side-by-side
include/vlc_demux.h
View file @
d63b17d1
...
...
@@ -48,7 +48,8 @@ struct demux_t
/* eg informative but needed (we can have access+demux) */
char
*
psz_access
;
char
*
psz_demux
;
char
*
psz_path
;
char
*
psz_location
;
char
*
psz_file
;
/* input stream */
stream_t
*
s
;
/* NULL in case of a access+demux in one */
...
...
@@ -169,7 +170,10 @@ VLC_EXPORT( int, demux_vaControlHelper, ( stream_t *, int64_t i_start, int
LIBVLC_USED
static
inline
bool
demux_IsPathExtension
(
demux_t
*
p_demux
,
const
char
*
psz_extension
)
{
const
char
*
psz_ext
=
strrchr
(
p_demux
->
psz_path
,
'.'
);
if
(
!
p_demux
->
psz_file
)
return
false
;
const
char
*
psz_ext
=
strrchr
(
p_demux
->
psz_file
,
'.'
);
if
(
!
psz_ext
||
strcasecmp
(
psz_ext
,
psz_extension
)
)
return
false
;
return
true
;
...
...
modules/access/alsa.c
View file @
d63b17d1
...
...
@@ -255,14 +255,14 @@ static int DemuxOpen( vlc_object_t *p_this )
p_sys
->
i_next_demux_date
=
-
1
;
const
char
*
psz_device
=
NULL
;
if
(
p_demux
->
psz_
path
&&
*
p_demux
->
psz_
path
)
psz_device
=
p_demux
->
psz_
path
;
if
(
p_demux
->
psz_
location
&&
*
p_demux
->
psz_
location
)
psz_device
=
p_demux
->
psz_
location
;
else
ListAvailableDevices
(
p_demux
,
false
);
if
(
FindMainDevice
(
p_demux
,
psz_device
)
!=
VLC_SUCCESS
)
{
if
(
p_demux
->
psz_
path
&&
*
p_demux
->
psz_
path
)
if
(
p_demux
->
psz_
location
&&
*
p_demux
->
psz_
location
)
ListAvailableDevices
(
p_demux
,
false
);
DemuxClose
(
p_this
);
return
VLC_EGENERIC
;
...
...
modules/access/bd/bd.c
View file @
d63b17d1
...
...
@@ -152,6 +152,8 @@ static int Open( vlc_object_t *p_this )
demux_t
*
p_demux
=
(
demux_t
*
)
p_this
;
demux_sys_t
*
p_sys
;
if
(
p_demux
->
psz_file
==
NULL
)
return
VLC_EGENERIC
;
if
(
*
p_demux
->
psz_access
&&
strcmp
(
p_demux
->
psz_access
,
"bd"
)
&&
strcmp
(
p_demux
->
psz_access
,
"file"
)
)
...
...
@@ -159,7 +161,7 @@ static int Open( vlc_object_t *p_this )
/* */
bool
b_shortname
;
char
*
psz_base
=
FindPathBase
(
p_demux
->
psz_
path
,
&
b_shortname
);
char
*
psz_base
=
FindPathBase
(
p_demux
->
psz_
file
,
&
b_shortname
);
if
(
!
psz_base
)
return
VLC_EGENERIC
;
...
...
modules/access/dc1394.c
View file @
d63b17d1
...
...
@@ -232,7 +232,7 @@ static int Open( vlc_object_t *p_this )
{
msg_Err
(
p_demux
,
"Bad MRL, please check the option line "
"(MRL was: %s)"
,
p_demux
->
psz_
path
);
p_demux
->
psz_
location
);
free
(
p_sys
);
return
VLC_EGENERIC
;
}
...
...
@@ -715,7 +715,7 @@ static int process_options( demux_t *p_demux )
const
char
*
in_fmt
=
NULL
;
float
rate_f
;
psz_dup
=
strdup
(
p_demux
->
psz_
path
);
psz_dup
=
strdup
(
p_demux
->
psz_
location
);
psz_parser
=
psz_dup
;
for
(
token
=
strtok_r
(
psz_parser
,
":"
,
&
state
);
token
;
token
=
strtok_r
(
NULL
,
":"
,
&
state
)
)
...
...
modules/access/dvdnav.c
View file @
d63b17d1
...
...
@@ -189,7 +189,7 @@ static int Open( vlc_object_t *p_this )
char
*
psz_name
;
char
*
psz_code
;
if
(
!
p_demux
->
psz_
path
||
!*
p_demux
->
psz_
path
)
if
(
!
p_demux
->
psz_
file
||
!*
p_demux
->
psz_
file
)
{
/* Only when selected */
if
(
!
p_demux
->
psz_access
||
!*
p_demux
->
psz_access
)
...
...
@@ -202,7 +202,7 @@ static int Open( vlc_object_t *p_this )
}
}
else
psz_name
=
ToLocaleDup
(
p_demux
->
psz_
path
);
psz_name
=
ToLocaleDup
(
p_demux
->
psz_
file
);
#ifdef WIN32
/* Remove trailing backslash, otherwise dvdnav_open will fail */
...
...
modules/access/dvdread.c
View file @
d63b17d1
...
...
@@ -176,7 +176,7 @@ static int Open( vlc_object_t *p_this )
dvd_reader_t
*
p_dvdread
;
ifo_handle_t
*
p_vmg_file
;
if
(
!
p_demux
->
psz_
path
||
!*
p_demux
->
psz_
path
)
if
(
!
p_demux
->
psz_
file
||
!*
p_demux
->
psz_
file
)
{
/* Only when selected */
if
(
!
p_demux
->
psz_access
||
!*
p_demux
->
psz_access
)
...
...
@@ -189,7 +189,7 @@ static int Open( vlc_object_t *p_this )
}
}
else
psz_name
=
ToLocaleDup
(
p_demux
->
psz_
path
);
psz_name
=
ToLocaleDup
(
p_demux
->
psz_
file
);
#ifdef WIN32
if
(
psz_name
[
0
]
&&
psz_name
[
1
]
==
':'
&&
...
...
modules/access/imem.c
View file @
d63b17d1
...
...
@@ -404,7 +404,7 @@ static int OpenDemux(vlc_object_t *object)
demux_t
*
demux
=
(
demux_t
*
)
object
;
imem_sys_t
*
sys
;
if
(
OpenCommon
(
object
,
&
sys
,
demux
->
psz_
path
))
if
(
OpenCommon
(
object
,
&
sys
,
demux
->
psz_
location
))
return
VLC_EGENERIC
;
/* ES format */
...
...
modules/access/jack.c
View file @
d63b17d1
...
...
@@ -562,7 +562,7 @@ static void Port_finder( demux_t *p_demux )
static
void
Parse
(
demux_t
*
p_demux
)
{
demux_sys_t
*
p_sys
=
p_demux
->
p_sys
;
char
*
psz_dup
=
strdup
(
p_demux
->
psz_
path
);
char
*
psz_dup
=
strdup
(
p_demux
->
psz_
location
);
char
*
psz_parser
=
psz_dup
;
if
(
!
strncmp
(
psz_parser
,
"channels="
,
strlen
(
"channels="
)
)
)
...
...
modules/access/oss.c
View file @
d63b17d1
...
...
@@ -178,8 +178,8 @@ static int DemuxOpen( vlc_object_t *p_this )
p_sys
->
p_block
=
NULL
;
p_sys
->
i_next_demux_date
=
-
1
;
if
(
p_demux
->
psz_
path
&&
*
p_demux
->
psz_
path
)
p_sys
->
psz_device
=
p_demux
->
psz_
path
;
if
(
p_demux
->
psz_
location
&&
*
p_demux
->
psz_
location
)
p_sys
->
psz_device
=
p_demux
->
psz_
location
;
else
p_sys
->
psz_device
=
OSS_DEFAULT
;
...
...
modules/access/rtp/rtp.c
View file @
d63b17d1
...
...
@@ -165,7 +165,7 @@ static int Open (vlc_object_t *obj)
else
return
VLC_EGENERIC
;
char
*
tmp
=
strdup
(
demux
->
psz_
path
);
char
*
tmp
=
strdup
(
demux
->
psz_
location
);
if
(
tmp
==
NULL
)
return
VLC_ENOMEM
;
...
...
modules/access/screen/xcb.c
View file @
d63b17d1
...
...
@@ -170,10 +170,10 @@ static int Open (vlc_object_t *obj)
if
(
!
strcmp
(
demux
->
psz_access
,
"window"
))
{
char
*
end
;
unsigned
long
ul
=
strtoul
(
demux
->
psz_
path
,
&
end
,
0
);
unsigned
long
ul
=
strtoul
(
demux
->
psz_
location
,
&
end
,
0
);
if
(
*
end
||
ul
>
0xffffffff
)
{
msg_Err
(
obj
,
"bad X11 drawable %s"
,
demux
->
psz_
path
);
msg_Err
(
obj
,
"bad X11 drawable %s"
,
demux
->
psz_
location
);
goto
error
;
}
p_sys
->
window
=
ul
;
...
...
modules/access/v4l.c
View file @
d63b17d1
...
...
@@ -488,7 +488,7 @@ static void ParseMRL( demux_t *p_demux )
{
demux_sys_t
*
p_sys
=
p_demux
->
p_sys
;
char
*
psz_dup
=
strdup
(
p_demux
->
psz_
path
);
char
*
psz_dup
=
strdup
(
p_demux
->
psz_
location
);
char
*
psz_parser
=
psz_dup
;
while
(
*
psz_parser
&&
*
psz_parser
!=
':'
)
...
...
modules/access/v4l2.c
View file @
d63b17d1
...
...
@@ -681,7 +681,7 @@ static int DemuxOpen( vlc_object_t *p_this )
GetV4L2Params
(
p_sys
,
(
vlc_object_t
*
)
p_demux
);
ParseMRL
(
p_sys
,
p_demux
->
psz_
path
,
(
vlc_object_t
*
)
p_demux
);
ParseMRL
(
p_sys
,
p_demux
->
psz_
location
,
(
vlc_object_t
*
)
p_demux
);
#ifdef HAVE_LIBV4L2
if
(
!
var_InheritBool
(
p_this
,
CFG_PREFIX
"use-libv4l2"
)
)
...
...
modules/demux/avformat/demux.c
View file @
d63b17d1
...
...
@@ -119,7 +119,7 @@ int OpenDemux( vlc_object_t *p_this )
bool
b_can_seek
;
/* Init Probe data */
pd
.
filename
=
p_demux
->
psz_
path
;
pd
.
filename
=
p_demux
->
psz_
file
;
if
(
(
pd
.
buf_size
=
stream_Peek
(
p_demux
->
s
,
&
pd
.
buf
,
2048
+
213
)
)
<=
0
)
{
msg_Warn
(
p_demux
,
"cannot peek"
);
...
...
@@ -155,14 +155,14 @@ int OpenDemux( vlc_object_t *p_this )
{
int
i_len
;
if
(
!
p_demux
->
psz_
path
)
return
VLC_EGENERIC
;
if
(
!
p_demux
->
psz_
file
)
return
VLC_EGENERIC
;
i_len
=
strlen
(
p_demux
->
psz_
path
);
i_len
=
strlen
(
p_demux
->
psz_
file
);
if
(
i_len
<
4
)
return
VLC_EGENERIC
;
if
(
strcasecmp
(
&
p_demux
->
psz_
path
[
i_len
-
4
],
".str"
)
&&
strcasecmp
(
&
p_demux
->
psz_
path
[
i_len
-
4
],
".xai"
)
&&
strcasecmp
(
&
p_demux
->
psz_
path
[
i_len
-
3
],
".xa"
)
)
if
(
strcasecmp
(
&
p_demux
->
psz_
file
[
i_len
-
4
],
".str"
)
&&
strcasecmp
(
&
p_demux
->
psz_
file
[
i_len
-
4
],
".xai"
)
&&
strcasecmp
(
&
p_demux
->
psz_
file
[
i_len
-
3
],
".xa"
)
)
{
return
VLC_EGENERIC
;
}
...
...
@@ -214,7 +214,7 @@ int OpenDemux( vlc_object_t *p_this )
/* Open it */
if
(
av_open_input_stream
(
&
p_sys
->
ic
,
&
p_sys
->
io
,
p_demux
->
psz_
path
,
if
(
av_open_input_stream
(
&
p_sys
->
ic
,
&
p_sys
->
io
,
p_demux
->
psz_
file
,
p_sys
->
fmt
,
NULL
)
)
{
msg_Err
(
p_demux
,
"av_open_input_stream failed"
);
...
...
modules/demux/gme.cpp
View file @
d63b17d1
...
...
@@ -121,7 +121,8 @@ static int Open( vlc_object_t *p_this )
/* We accept file based on extention match */
if
(
!
p_demux
->
b_force
)
{
if
(
(
ext
=
strrchr
(
p_demux
->
psz_path
,
'.'
)
)
==
NULL
||
if
(
p_demux
->
psz_file
==
NULL
||
(
ext
=
strrchr
(
p_demux
->
psz_file
,
'.'
)
)
==
NULL
||
stream_Size
(
p_demux
->
s
)
==
0
)
return
VLC_EGENERIC
;
ext
++
;
/* skip . */
...
...
modules/demux/live555.cpp
View file @
d63b17d1
...
...
@@ -297,7 +297,7 @@ static int Open ( vlc_object_t *p_this )
p_sys
->
b_timeout_call
=
false
;
p_sys
->
b_multicast
=
false
;
p_sys
->
b_real
=
false
;
p_sys
->
psz_path
=
strdup
(
p_demux
->
psz_
path
);
p_sys
->
psz_path
=
strdup
(
p_demux
->
psz_
location
);
p_sys
->
b_force_mcast
=
var_CreateGetBool
(
p_demux
,
"rtsp-mcast"
);
p_sys
->
b_get_param
=
false
;
p_sys
->
b_paused
=
false
;
...
...
modules/demux/mkv/mkv.cpp
View file @
d63b17d1
...
...
@@ -141,11 +141,11 @@ static int Open( vlc_object_t * p_this )
if
(
var_InheritBool
(
p_demux
,
"mkv-preload-local-dir"
))
{
/* get the files from the same dir from the same family (based on p_demux->psz_path) */
if
(
p_demux
->
psz_
path
[
0
]
!=
'\0'
&&
!
strcmp
(
p_demux
->
psz_access
,
""
))
if
(
p_demux
->
psz_
file
&&
!
strcmp
(
p_demux
->
psz_access
,
""
))
{
// assume it's a regular file
// get the directory path
s_path
=
p_demux
->
psz_
path
;
s_path
=
p_demux
->
psz_
file
;
if
(
s_path
.
at
(
s_path
.
length
()
-
1
)
==
DIR_SEP_CHAR
)
{
s_path
=
s_path
.
substr
(
0
,
s_path
.
length
()
-
1
);
...
...
@@ -170,9 +170,9 @@ static int Open( vlc_object_t * p_this )
s_filename
=
s_path
+
DIR_SEP_CHAR
+
psz_file
;
#ifdef WIN32
if
(
!
strcasecmp
(
s_filename
.
c_str
(),
p_demux
->
psz_
path
))
if
(
!
strcasecmp
(
s_filename
.
c_str
(),
p_demux
->
psz_
file
))
#else
if
(
!
s_filename
.
compare
(
p_demux
->
psz_
path
))
if
(
!
s_filename
.
compare
(
p_demux
->
psz_
file
))
#endif
{
free
(
psz_file
);
...
...
modules/demux/mod.c
View file @
d63b17d1
...
...
@@ -149,7 +149,9 @@ static int Open( vlc_object_t *p_this )
/* We accept file based on extension match */
if
(
!
p_demux
->
b_force
)
{
const
char
*
psz_ext
=
strrchr
(
p_demux
->
psz_path
,
'.'
);
if
(
!
p_demux
->
psz_file
)
return
VLC_EGENERIC
;
const
char
*
psz_ext
=
strrchr
(
p_demux
->
psz_file
,
'.'
);
int
i
;
if
(
!
psz_ext
)
...
...
modules/demux/mp4/mp4.c
View file @
d63b17d1
...
...
@@ -402,7 +402,7 @@ static int Open( vlc_object_t * p_this )
else
{
char
*
psz_absolute
;
char
*
psz_path
=
strdup
(
p_demux
->
psz_
path
);
char
*
psz_path
=
strdup
(
p_demux
->
psz_
location
);
char
*
end
=
strrchr
(
psz_path
,
'/'
);
if
(
end
)
end
[
1
]
=
'\0'
;
else
*
psz_path
=
'\0'
;
...
...
modules/demux/playlist/ifo.c
View file @
d63b17d1
...
...
@@ -47,9 +47,12 @@ int Import_IFO( vlc_object_t *p_this )
{
demux_t
*
p_demux
=
(
demux_t
*
)
p_this
;
size_t
len
=
strlen
(
p_demux
->
psz_path
);
if
(
!
p_demux
->
psz_file
)
return
VLC_EGENERIC
;
size_t
len
=
strlen
(
p_demux
->
psz_file
);
char
*
psz_file
=
p_demux
->
psz_
path
+
len
-
strlen
(
"VIDEO_TS.IFO"
);
char
*
psz_file
=
p_demux
->
psz_
file
+
len
-
strlen
(
"VIDEO_TS.IFO"
);
/* Valid filenames are :
* - VIDEO_TS.IFO
* - VTS_XX_X.IFO where X are digits
...
...
@@ -69,7 +72,7 @@ int Import_IFO( vlc_object_t *p_this )
p_demux
->
pf_demux
=
Demux
;
}
/* Valid filename for DVD-VR is VR_MANGR.IFO */
else
if
(
len
>=
12
&&
!
strcmp
(
&
p_demux
->
psz_
path
[
len
-
12
],
"VR_MANGR.IFO"
)
)
else
if
(
len
>=
12
&&
!
strcmp
(
&
p_demux
->
psz_
file
[
len
-
12
],
"VR_MANGR.IFO"
)
)
{
int
i_peek
;
const
uint8_t
*
p_peek
;
...
...
@@ -99,14 +102,14 @@ void Close_IFO( vlc_object_t *p_this )
static
int
Demux
(
demux_t
*
p_demux
)
{
size_t
len
=
strlen
(
"dvd://"
)
+
strlen
(
p_demux
->
psz_
path
)
size_t
len
=
strlen
(
"dvd://"
)
+
strlen
(
p_demux
->
psz_
file
)
-
strlen
(
"VIDEO_TS.IFO"
);
char
*
psz_url
;
psz_url
=
malloc
(
len
+
1
);
if
(
!
psz_url
)
return
0
;
snprintf
(
psz_url
,
len
+
1
,
"dvd://%s"
,
p_demux
->
psz_
path
);
snprintf
(
psz_url
,
len
+
1
,
"dvd://%s"
,
p_demux
->
psz_
file
);
input_item_t
*
p_current_input
=
GetCurrentItem
(
p_demux
);
input_item_t
*
p_input
=
input_item_New
(
p_demux
,
psz_url
,
psz_url
);
...
...
@@ -121,7 +124,7 @@ static int Demux( demux_t *p_demux )
static
int
DemuxDVD_VR
(
demux_t
*
p_demux
)
{
char
*
psz_url
=
strdup
(
p_demux
->
psz_
path
);
char
*
psz_url
=
strdup
(
p_demux
->
psz_
file
);
if
(
!
psz_url
)
return
0
;
...
...
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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