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
a430cde7
Commit
a430cde7
authored
Feb 10, 2009
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added support for shortname in bd access (avchd ?)
parent
1463e7cb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
25 deletions
+56
-25
modules/access/bd/bd.c
modules/access/bd/bd.c
+56
-25
No files found.
modules/access/bd/bd.c
View file @
a430cde7
...
...
@@ -83,6 +83,7 @@ vlc_module_end ()
struct
demux_sys_t
{
char
*
psz_base
;
bool
b_shortname
;
/* */
int
i_mpls
;
...
...
@@ -118,7 +119,7 @@ struct demux_sys_t
static
int
Control
(
demux_t
*
,
int
,
va_list
);
static
int
Demux
(
demux_t
*
);
static
char
*
FindPathBase
(
const
char
*
);
static
char
*
FindPathBase
(
const
char
*
,
bool
*
pb_shortname
);
static
int
LoadPlaylist
(
demux_t
*
);
static
int
LoadClip
(
demux_t
*
);
...
...
@@ -155,7 +156,8 @@ static int Open( vlc_object_t *p_this )
return
VLC_EGENERIC
;
/* */
char
*
psz_base
=
FindPathBase
(
p_demux
->
psz_path
);
bool
b_shortname
;
char
*
psz_base
=
FindPathBase
(
p_demux
->
psz_path
,
&
b_shortname
);
if
(
!
psz_base
)
return
VLC_EGENERIC
;
...
...
@@ -166,6 +168,7 @@ static int Open( vlc_object_t *p_this )
if
(
!
p_sys
)
return
VLC_EGENERIC
;
p_sys
->
psz_base
=
psz_base
;
p_sys
->
b_shortname
=
b_shortname
;
TAB_INIT
(
p_sys
->
i_mpls
,
p_sys
->
pp_mpls
);
TAB_INIT
(
p_sys
->
i_clpi
,
p_sys
->
pp_clpi
);
TAB_INIT
(
p_sys
->
i_title
,
p_sys
->
pp_title
);
...
...
@@ -616,7 +619,8 @@ static int SetPlayItem( demux_t *p_demux, int i_mpls, int i_play_item )
if
(
!
b_same_clpi
)
{
char
*
psz_m2ts
;
if
(
asprintf
(
&
psz_m2ts
,
"%s/STREAM/%05d.m2ts"
,
p_sys
->
psz_base
,
p_mpls_clpi
->
i_id
)
<
0
)
if
(
asprintf
(
&
psz_m2ts
,
"%s/STREAM/%05d.%s"
,
p_sys
->
psz_base
,
p_mpls_clpi
->
i_id
,
p_sys
->
b_shortname
?
"MTS"
:
"m2ts"
)
<
0
)
return
VLC_EGENERIC
;
p_m2ts
=
stream_UrlNew
(
p_demux
,
psz_m2ts
);
...
...
@@ -927,8 +931,26 @@ static void ReorderPlaylist( demux_t *p_demux )
/*****************************************************************************
* Helpers:
*****************************************************************************/
static
int
CheckFileList
(
const
char
*
psz_base
,
const
char
*
ppsz_name
[]
)
{
for
(
int
i
=
0
;
ppsz_name
[
i
]
!=
NULL
;
i
++
)
{
struct
stat
s
;
char
*
psz_tmp
;
if
(
asprintf
(
&
psz_tmp
,
"%s/%s"
,
psz_base
,
ppsz_name
[
i
]
)
<
0
)
return
VLC_EGENERIC
;
bool
b_ok
=
utf8_stat
(
psz_tmp
,
&
s
)
==
0
&&
S_ISREG
(
s
.
st_mode
);
free
(
psz_tmp
);
if
(
!
b_ok
)
return
VLC_EGENERIC
;
}
return
VLC_SUCCESS
;
}
/* */
static
char
*
FindPathBase
(
const
char
*
psz_path
)
static
char
*
FindPathBase
(
const
char
*
psz_path
,
bool
*
pb_shortname
)
{
struct
stat
s
;
char
*
psz_tmp
;
...
...
@@ -960,26 +982,23 @@ static char *FindPathBase( const char *psz_path )
}
/* Check presence of mandatory files */
for
(
int
i
=
0
;;
i
++
)
static
const
char
*
ppsz_name_long
[]
=
{
"index.bdmv"
,
"MovieObject.bdmv"
,
NULL
};
static
const
char
*
ppsz_name_short
[]
=
{
"INDEX.BDM"
,
"MOVIEOBJ.BDM"
,
NULL
};
*
pb_shortname
=
false
;
if
(
CheckFileList
(
psz_base
,
ppsz_name_long
)
)
{
static
const
char
*
ppsz_name
[]
=
{
"index.bdmv"
,
"MovieObject.bdmv"
,
NULL
};
if
(
!
ppsz_name
[
i
]
)
break
;
if
(
asprintf
(
&
psz_tmp
,
"%s/%s"
,
psz_base
,
ppsz_name
[
i
]
)
<
0
)
goto
error
;
bool
b_ok
=
utf8_stat
(
psz_tmp
,
&
s
)
==
0
&&
S_ISREG
(
s
.
st_mode
);
free
(
psz_tmp
);
if
(
!
b_ok
)
if
(
CheckFileList
(
psz_base
,
ppsz_name_short
)
)
goto
error
;
*
pb_shortname
=
true
;
}
return
psz_base
;
error:
...
...
@@ -1006,11 +1025,16 @@ static block_t *LoadBlock( demux_t *p_demux, const char *psz_name )
}
/* */
static
int
FilterMpls
(
const
char
*
psz_name
)
static
int
FilterMpls
Long
(
const
char
*
psz_name
)
{
return
strlen
(
psz_name
)
==
strlen
(
"xxxxx.mpls"
)
&&
!
strcmp
(
&
psz_name
[
5
],
".mpls"
);
}
static
int
FilterMplsShort
(
const
char
*
psz_name
)
{
return
strlen
(
psz_name
)
==
strlen
(
"xxxxx.MPL"
)
&&
!
strcmp
(
&
psz_name
[
5
],
".MPL"
);
}
static
void
LoadMpls
(
demux_t
*
p_demux
,
const
char
*
psz_name
,
int
i_id
)
{
...
...
@@ -1095,11 +1119,16 @@ error:
}
/* */
static
int
FilterClpi
(
const
char
*
psz_name
)
static
int
FilterClpi
Long
(
const
char
*
psz_name
)
{
return
strlen
(
psz_name
)
==
strlen
(
"xxxxx.clpi"
)
&&
!
strcmp
(
&
psz_name
[
5
],
".clpi"
);
}
static
int
FilterClpiShort
(
const
char
*
psz_name
)
{
return
strlen
(
psz_name
)
==
strlen
(
"xxxxx.CPI"
)
&&
!
strcmp
(
&
psz_name
[
5
],
".CPI"
);
}
static
void
LoadClpi
(
demux_t
*
p_demux
,
const
char
*
psz_name
,
int
i_id
)
{
...
...
@@ -1205,11 +1234,13 @@ static int Load( demux_t *p_demux,
static
int
LoadPlaylist
(
demux_t
*
p_demux
)
{
return
Load
(
p_demux
,
"PLAYLIST"
,
FilterMpls
,
LoadMpls
);
return
Load
(
p_demux
,
"PLAYLIST"
,
p_demux
->
p_sys
->
b_shortname
?
FilterMplsShort
:
FilterMplsLong
,
LoadMpls
);
}
static
int
LoadClip
(
demux_t
*
p_demux
)
{
return
Load
(
p_demux
,
"CLIPINF"
,
FilterClpi
,
LoadClpi
);
return
Load
(
p_demux
,
"CLIPINF"
,
p_demux
->
p_sys
->
b_shortname
?
FilterClpiShort
:
FilterClpiLong
,
LoadClpi
);
}
/* */
...
...
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