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
c9546b0c
Commit
c9546b0c
authored
Jul 13, 2009
by
JP Dinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor a bit in dvdnav.c
parent
9e5f6762
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
74 deletions
+47
-74
modules/access/dvdnav.c
modules/access/dvdnav.c
+47
-74
No files found.
modules/access/dvdnav.c
View file @
c9546b0c
...
@@ -16,9 +16,9 @@
...
@@ -16,9 +16,9 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* You should have received a copy of the GNU General Public License
along
*
along with this program; if not, write to the Free Software
*
with this program; if not, write to the Free Software Foundation, Inc.,
*
Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
*****************************************************************************/
/*****************************************************************************
/*****************************************************************************
...
@@ -419,11 +419,7 @@ static void Close( vlc_object_t *p_this )
...
@@ -419,11 +419,7 @@ static void Close( vlc_object_t *p_this )
static
int
Control
(
demux_t
*
p_demux
,
int
i_query
,
va_list
args
)
static
int
Control
(
demux_t
*
p_demux
,
int
i_query
,
va_list
args
)
{
{
demux_sys_t
*
p_sys
=
p_demux
->
p_sys
;
demux_sys_t
*
p_sys
=
p_demux
->
p_sys
;
double
f
,
*
pf
;
bool
*
pb
;
int64_t
*
pi64
;
input_title_t
***
ppp_title
;
input_title_t
***
ppp_title
;
int
*
pi_int
;
int
i
;
int
i
;
switch
(
i_query
)
switch
(
i_query
)
...
@@ -440,41 +436,37 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
...
@@ -440,41 +436,37 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
if
(
i_query
==
DEMUX_GET_POSITION
)
switch
(
i_query
)
{
{
pf
=
(
double
*
)
va_arg
(
args
,
double
*
);
case
DEMUX_GET_POSITION
:
*
pf
=
(
double
)
pos
/
(
double
)
len
;
*
va_arg
(
args
,
double
*
)
=
(
double
)
pos
/
(
double
)
len
;
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
else
if
(
i_query
==
DEMUX_SET_POSITION
)
case
DEMUX_SET_POSITION
:
{
pos
=
va_arg
(
args
,
double
)
*
len
;
f
=
(
double
)
va_arg
(
args
,
double
);
pos
=
f
*
len
;
if
(
dvdnav_sector_search
(
p_sys
->
dvdnav
,
pos
,
SEEK_SET
)
==
if
(
dvdnav_sector_search
(
p_sys
->
dvdnav
,
pos
,
SEEK_SET
)
==
DVDNAV_STATUS_OK
)
DVDNAV_STATUS_OK
)
{
{
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
}
break
;
else
if
(
i_query
==
DEMUX_GET_TIME
)
{
case
DEMUX_GET_TIME
:
pi64
=
(
int64_t
*
)
va_arg
(
args
,
int64_t
*
);
if
(
p_sys
->
i_pgc_length
>
0
)
if
(
p_sys
->
i_pgc_length
>
0
)
{
{
*
pi64
=
p_sys
->
i_pgc_length
*
pos
/
len
;
*
va_arg
(
args
,
int64_t
*
)
=
p_sys
->
i_pgc_length
*
pos
/
len
;
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
}
break
;
else
if
(
i_query
==
DEMUX_GET_LENGTH
)
{
case
DEMUX_GET_LENGTH
:
pi64
=
(
int64_t
*
)
va_arg
(
args
,
int64_t
*
);
if
(
p_sys
->
i_pgc_length
>
0
)
if
(
p_sys
->
i_pgc_length
>
0
)
{
{
*
pi64
=
(
int64_t
)
p_sys
->
i_pgc_length
;
*
va_arg
(
args
,
int64_t
*
)
=
(
int64_t
)
p_sys
->
i_pgc_length
;
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
break
;
}
}
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
...
@@ -483,21 +475,19 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
...
@@ -483,21 +475,19 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
case
DEMUX_CAN_SEEK
:
case
DEMUX_CAN_SEEK
:
case
DEMUX_CAN_CONTROL_PACE
:
case
DEMUX_CAN_CONTROL_PACE
:
/* TODO */
/* TODO */
pb
=
(
bool
*
)
va_arg
(
args
,
bool
*
);
*
va_arg
(
args
,
bool
*
)
=
true
;
*
pb
=
true
;
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
case
DEMUX_SET_PAUSE_STATE
:
case
DEMUX_SET_PAUSE_STATE
:
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
case
DEMUX_GET_TITLE_INFO
:
case
DEMUX_GET_TITLE_INFO
:
ppp_title
=
(
input_title_t
***
)
va_arg
(
args
,
input_title_t
***
);
ppp_title
=
va_arg
(
args
,
input_title_t
***
);
pi_int
=
(
int
*
)
va_arg
(
args
,
int
*
)
;
*
va_arg
(
args
,
int
*
)
=
p_sys
->
i_title
;
*
((
int
*
)
va_arg
(
args
,
int
*
)
)
=
0
;
/* Title offset */
*
va_arg
(
args
,
int
*
)
=
0
;
/* Title offset */
*
((
int
*
)
va_arg
(
args
,
int
*
)
)
=
1
;
/* Chapter offset */
*
va_arg
(
args
,
int
*
)
=
1
;
/* Chapter offset */
/* Duplicate title infos */
/* Duplicate title infos */
*
pi_int
=
p_sys
->
i_title
;
*
ppp_title
=
malloc
(
sizeof
(
input_title_t
**
)
*
p_sys
->
i_title
);
*
ppp_title
=
malloc
(
sizeof
(
input_title_t
**
)
*
p_sys
->
i_title
);
for
(
i
=
0
;
i
<
p_sys
->
i_title
;
i
++
)
for
(
i
=
0
;
i
<
p_sys
->
i_title
;
i
++
)
{
{
...
@@ -522,40 +512,21 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
...
@@ -522,40 +512,21 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
case
DEMUX_SET_SEEKPOINT
:
case
DEMUX_SET_SEEKPOINT
:
i
=
(
int
)
va_arg
(
args
,
int
);
i
=
va_arg
(
args
,
int
);
if
(
p_demux
->
info
.
i_title
==
0
)
if
(
p_demux
->
info
.
i_title
==
0
)
{
{
int
i_ret
;
static
const
int
argtab
[]
=
{
/* Special case */
DVD_MENU_Escape
,
switch
(
i
)
DVD_MENU_Root
,
{
DVD_MENU_Title
,
case
0
:
DVD_MENU_Part
,
i_ret
=
dvdnav_menu_call
(
p_sys
->
dvdnav
,
DVD_MENU_Escape
);
DVD_MENU_Subpicture
,
break
;
DVD_MENU_Audio
,
case
1
:
DVD_MENU_Angle
i_ret
=
dvdnav_menu_call
(
p_sys
->
dvdnav
,
DVD_MENU_Root
);
};
break
;
enum
{
numargs
=
sizeof
(
argtab
)
/
sizeof
(
int
)
};
case
2
:
if
(
(
unsigned
)
i
>=
numargs
||
DVDNAV_STATUS_OK
!=
i_ret
=
dvdnav_menu_call
(
p_sys
->
dvdnav
,
DVD_MENU_Title
);
dvdnav_menu_call
(
p_sys
->
dvdnav
,
argtab
[
i
])
)
break
;
case
3
:
i_ret
=
dvdnav_menu_call
(
p_sys
->
dvdnav
,
DVD_MENU_Part
);
break
;
case
4
:
i_ret
=
dvdnav_menu_call
(
p_sys
->
dvdnav
,
DVD_MENU_Subpicture
);
break
;
case
5
:
i_ret
=
dvdnav_menu_call
(
p_sys
->
dvdnav
,
DVD_MENU_Audio
);
break
;
case
6
:
i_ret
=
dvdnav_menu_call
(
p_sys
->
dvdnav
,
DVD_MENU_Angle
);
break
;
default:
return
VLC_EGENERIC
;
}
if
(
i_ret
!=
DVDNAV_STATUS_OK
)
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
else
if
(
dvdnav_part_play
(
p_sys
->
dvdnav
,
p_demux
->
info
.
i_title
,
else
if
(
dvdnav_part_play
(
p_sys
->
dvdnav
,
p_demux
->
info
.
i_title
,
...
@@ -569,8 +540,8 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
...
@@ -569,8 +540,8 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
case
DEMUX_GET_PTS_DELAY
:
case
DEMUX_GET_PTS_DELAY
:
pi64
=
(
int64_t
*
)
va_arg
(
args
,
int64_t
*
);
*
va_arg
(
args
,
int64_t
*
)
*
pi64
=
(
int64_t
)
var_GetInteger
(
p_demux
,
"dvdnav-caching"
)
*
1000
;
=
(
int64_t
)
var_GetInteger
(
p_demux
,
"dvdnav-caching"
)
*
1000
;
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
case
DEMUX_GET_META
:
case
DEMUX_GET_META
:
...
@@ -1024,8 +995,10 @@ static void ButtonUpdate( demux_t *p_demux, bool b_mode )
...
@@ -1024,8 +995,10 @@ static void ButtonUpdate( demux_t *p_demux, bool b_mode )
{
{
pci_t
*
pci
=
dvdnav_get_current_nav_pci
(
p_sys
->
dvdnav
);
pci_t
*
pci
=
dvdnav_get_current_nav_pci
(
p_sys
->
dvdnav
);
b_button_ok
=
dvdnav_get_highlight_area
(
pci
,
i_button
,
b_mode
,
&
hl
)
==
DVDNAV_STATUS_OK
;
b_button_ok
=
DVDNAV_STATUS_OK
==
dvdnav_get_highlight_area
(
pci
,
i_button
,
b_mode
,
&
hl
);
}
}
if
(
b_button_ok
)
if
(
b_button_ok
)
{
{
int
i
;
int
i
;
...
@@ -1422,22 +1395,22 @@ static int ProbeDVD( demux_t *p_demux, char *psz_name )
...
@@ -1422,22 +1395,22 @@ static int ProbeDVD( demux_t *p_demux, char *psz_name )
return
VLC_SUCCESS
;
/* Let dvdnav_open() do the probing */
return
VLC_SUCCESS
;
/* Let dvdnav_open() do the probing */
}
}
i_ret
=
VLC_EGENERIC
;
if
(
fstat
(
i_fd
,
&
stat_info
)
||
!
S_ISREG
(
stat_info
.
st_mode
)
)
if
(
fstat
(
i_fd
,
&
stat_info
)
||
!
S_ISREG
(
stat_info
.
st_mode
)
)
{
{
close
(
i_fd
);
if
(
!
S_ISFIFO
(
stat_info
.
st_mode
)
)
i_ret
=
VLC_SUCCESS
;
/* Let dvdnav_open() do the probing */
if
(
S_ISFIFO
(
stat_info
.
st_mode
)
)
goto
bailout
;
return
VLC_EGENERIC
;
return
VLC_SUCCESS
;
/* Let dvdnav_open() do the probing */
}
}
/* Try to find the anchor (2 bytes at LBA 256) */
/* Try to find the anchor (2 bytes at LBA 256) */
i_ret
=
VLC_EGENERIC
;
if
(
lseek
(
i_fd
,
256
*
DVD_VIDEO_LB_LEN
,
SEEK_SET
)
!=
-
1
if
(
lseek
(
i_fd
,
256
*
DVD_VIDEO_LB_LEN
,
SEEK_SET
)
!=
-
1
&&
read
(
i_fd
,
pi_anchor
,
2
)
==
2
&&
read
(
i_fd
,
pi_anchor
,
2
)
==
2
&&
GetWLE
(
pi_anchor
)
==
2
)
&&
GetWLE
(
pi_anchor
)
==
2
)
i_ret
=
VLC_SUCCESS
;
/* Found a potential anchor */
i_ret
=
VLC_SUCCESS
;
/* Found a potential anchor */
bailout:
close
(
i_fd
);
close
(
i_fd
);
return
i_ret
;
return
i_ret
;
...
...
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