Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
libbluray
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
2
Issues
2
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
VideoLAN
libbluray
Commits
6f45b11b
Commit
6f45b11b
authored
Aug 06, 2010
by
hpi1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Splitted _seek_stream() from _seek_internal()
parent
34ddbd21
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
34 deletions
+48
-34
src/libbluray/bluray.c
src/libbluray/bluray.c
+48
-34
No files found.
src/libbluray/bluray.c
View file @
6f45b11b
...
@@ -193,7 +193,7 @@ static int _queue_event(BLURAY *bd, BD_EVENT ev)
...
@@ -193,7 +193,7 @@ static int _queue_event(BLURAY *bd, BD_EVENT ev)
}
}
/*
/*
* clip access
* clip access
(BD_STREAM)
*/
*/
static
void
_close_m2ts
(
BD_STREAM
*
st
)
static
void
_close_m2ts
(
BD_STREAM
*
st
)
...
@@ -308,6 +308,30 @@ static int _read_block(BLURAY *bd, BD_STREAM *st, uint8_t *buf)
...
@@ -308,6 +308,30 @@ static int _read_block(BLURAY *bd, BD_STREAM *st, uint8_t *buf)
return
0
;
return
0
;
}
}
static
int64_t
_seek_stream
(
BLURAY
*
bd
,
BD_STREAM
*
st
,
NAV_CLIP
*
clip
,
uint32_t
clip_pkt
)
{
if
(
!
clip
)
return
-
1
;
if
(
!
st
->
fp
||
clip
->
ref
!=
st
->
clip
->
ref
)
{
// The position is in a new clip
st
->
clip
=
clip
;
if
(
!
_open_m2ts
(
bd
,
st
))
{
return
-
1
;
}
}
st
->
clip_pos
=
(
uint64_t
)
clip_pkt
*
192
;
st
->
clip_block_pos
=
(
st
->
clip_pos
/
6144
)
*
6144
;
file_seek
(
st
->
fp
,
st
->
clip_block_pos
,
SEEK_SET
);
st
->
int_buf_off
=
6144
;
return
st
->
clip_pos
;
}
/*
/*
* open / close
* open / close
*/
*/
...
@@ -511,26 +535,13 @@ void bd_close(BLURAY *bd)
...
@@ -511,26 +535,13 @@ void bd_close(BLURAY *bd)
* seeking and current position
* seeking and current position
*/
*/
static
int64_t
_seek_internal
(
BLURAY
*
bd
,
BD_STREAM
*
st
,
static
int64_t
_seek_internal
(
BLURAY
*
bd
,
NAV_CLIP
*
clip
,
uint32_t
title_pkt
,
uint32_t
clip_pkt
)
NAV_CLIP
*
clip
,
uint32_t
title_pkt
,
uint32_t
clip_pkt
)
{
{
if
(
!
clip
)
if
(
_seek_stream
(
bd
,
&
bd
->
st0
,
clip
,
clip_pkt
)
>=
0
)
{
return
-
1
;
if
(
!
st
->
fp
||
clip
->
ref
!=
st
->
clip
->
ref
)
{
/* update title position */
// The position is in a new clip
st
->
clip
=
clip
;
if
(
!
_open_m2ts
(
bd
,
st
))
{
return
-
1
;
}
}
bd
->
s_pos
=
(
uint64_t
)
title_pkt
*
192
;
bd
->
s_pos
=
(
uint64_t
)
title_pkt
*
192
;
st
->
clip_pos
=
(
uint64_t
)
clip_pkt
*
192
;
st
->
clip_block_pos
=
(
st
->
clip_pos
/
6144
)
*
6144
;
file_seek
(
st
->
fp
,
st
->
clip_block_pos
,
SEEK_SET
);
st
->
int_buf_off
=
6144
;
/* chapter tracking */
/* chapter tracking */
uint32_t
current_chapter
=
bd_get_current_chapter
(
bd
);
uint32_t
current_chapter
=
bd_get_current_chapter
(
bd
);
...
@@ -539,8 +550,11 @@ static int64_t _seek_internal(BLURAY *bd, BD_STREAM *st,
...
@@ -539,8 +550,11 @@ static int64_t _seek_internal(BLURAY *bd, BD_STREAM *st,
DEBUG
(
DBG_BLURAY
,
"Seek to %"
PRIu64
" (%p)
\n
"
,
DEBUG
(
DBG_BLURAY
,
"Seek to %"
PRIu64
" (%p)
\n
"
,
bd
->
s_pos
,
bd
);
bd
->
s_pos
,
bd
);
if
(
bd
->
bdplus_seek
&&
bd
->
bdplus
)
bd
->
bdplus_seek
(
bd
->
bdplus
,
st
->
clip_block_pos
);
if
(
bd
->
bdplus_seek
&&
bd
->
bdplus
)
{
bd
->
bdplus_seek
(
bd
->
bdplus
,
bd
->
st0
.
clip_block_pos
);
}
}
return
bd
->
s_pos
;
return
bd
->
s_pos
;
}
}
...
@@ -572,7 +586,7 @@ int64_t bd_seek_time(BLURAY *bd, uint64_t tick)
...
@@ -572,7 +586,7 @@ int64_t bd_seek_time(BLURAY *bd, uint64_t tick)
// Find the closest access unit to the requested position
// Find the closest access unit to the requested position
clip
=
nav_time_search
(
bd
->
title
,
tick
,
&
clip_pkt
,
&
out_pkt
);
clip
=
nav_time_search
(
bd
->
title
,
tick
,
&
clip_pkt
,
&
out_pkt
);
return
_seek_internal
(
bd
,
&
bd
->
st0
,
clip
,
out_pkt
,
clip_pkt
);
return
_seek_internal
(
bd
,
clip
,
out_pkt
,
clip_pkt
);
}
}
return
bd
->
s_pos
;
return
bd
->
s_pos
;
...
@@ -601,7 +615,7 @@ int64_t bd_seek_chapter(BLURAY *bd, unsigned chapter)
...
@@ -601,7 +615,7 @@ int64_t bd_seek_chapter(BLURAY *bd, unsigned chapter)
// Find the closest access unit to the requested position
// Find the closest access unit to the requested position
clip
=
nav_chapter_search
(
bd
->
title
,
chapter
,
&
clip_pkt
,
&
out_pkt
);
clip
=
nav_chapter_search
(
bd
->
title
,
chapter
,
&
clip_pkt
,
&
out_pkt
);
return
_seek_internal
(
bd
,
&
bd
->
st0
,
clip
,
out_pkt
,
clip_pkt
);
return
_seek_internal
(
bd
,
clip
,
out_pkt
,
clip_pkt
);
}
}
return
bd
->
s_pos
;
return
bd
->
s_pos
;
...
@@ -637,7 +651,7 @@ int64_t bd_seek_mark(BLURAY *bd, unsigned mark)
...
@@ -637,7 +651,7 @@ int64_t bd_seek_mark(BLURAY *bd, unsigned mark)
// Find the closest access unit to the requested position
// Find the closest access unit to the requested position
clip
=
nav_mark_search
(
bd
->
title
,
mark
,
&
clip_pkt
,
&
out_pkt
);
clip
=
nav_mark_search
(
bd
->
title
,
mark
,
&
clip_pkt
,
&
out_pkt
);
return
_seek_internal
(
bd
,
&
bd
->
st0
,
clip
,
out_pkt
,
clip_pkt
);
return
_seek_internal
(
bd
,
clip
,
out_pkt
,
clip_pkt
);
}
}
return
bd
->
s_pos
;
return
bd
->
s_pos
;
...
@@ -656,7 +670,7 @@ int64_t bd_seek(BLURAY *bd, uint64_t pos)
...
@@ -656,7 +670,7 @@ int64_t bd_seek(BLURAY *bd, uint64_t pos)
// Find the closest access unit to the requested position
// Find the closest access unit to the requested position
clip
=
nav_packet_search
(
bd
->
title
,
pkt
,
&
clip_pkt
,
&
out_pkt
,
&
out_time
);
clip
=
nav_packet_search
(
bd
->
title
,
pkt
,
&
clip_pkt
,
&
out_pkt
,
&
out_time
);
return
_seek_internal
(
bd
,
&
bd
->
st0
,
clip
,
out_pkt
,
clip_pkt
);
return
_seek_internal
(
bd
,
clip
,
out_pkt
,
clip_pkt
);
}
}
return
bd
->
s_pos
;
return
bd
->
s_pos
;
...
@@ -679,16 +693,16 @@ uint64_t bd_tell(BLURAY *bd)
...
@@ -679,16 +693,16 @@ uint64_t bd_tell(BLURAY *bd)
* read
* read
*/
*/
static
int64_t
_clip_seek_time
(
BLURAY
*
bd
,
BD_STREAM
*
st
,
uint64_t
tick
)
static
int64_t
_clip_seek_time
(
BLURAY
*
bd
,
uint64_t
tick
)
{
{
uint32_t
clip_pkt
,
out_pkt
;
uint32_t
clip_pkt
,
out_pkt
;
if
(
tick
<
st
->
clip
->
out_time
)
{
if
(
tick
<
bd
->
st0
.
clip
->
out_time
)
{
// Find the closest access unit to the requested position
// Find the closest access unit to the requested position
nav_clip_time_search
(
st
->
clip
,
tick
,
&
clip_pkt
,
&
out_pkt
);
nav_clip_time_search
(
bd
->
st0
.
clip
,
tick
,
&
clip_pkt
,
&
out_pkt
);
return
_seek_internal
(
bd
,
st
,
st
->
clip
,
out_pkt
,
clip_pkt
);
return
_seek_internal
(
bd
,
bd
->
st0
.
clip
,
out_pkt
,
clip_pkt
);
}
}
return
bd
->
s_pos
;
return
bd
->
s_pos
;
...
@@ -720,7 +734,7 @@ int bd_read(BLURAY *bd, unsigned char *buf, int len)
...
@@ -720,7 +734,7 @@ int bd_read(BLURAY *bd, unsigned char *buf, int len)
}
else
{
}
else
{
st
->
clip
=
nav_set_angle
(
bd
->
title
,
st
->
clip
,
bd
->
request_angle
);
st
->
clip
=
nav_set_angle
(
bd
->
title
,
st
->
clip
,
bd
->
request_angle
);
bd_psr_write
(
bd
->
regs
,
PSR_ANGLE_NUMBER
,
bd
->
title
->
angle
+
1
);
bd_psr_write
(
bd
->
regs
,
PSR_ANGLE_NUMBER
,
bd
->
title
->
angle
+
1
);
_clip_seek_time
(
bd
,
st
,
bd
->
angle_change_time
);
_clip_seek_time
(
bd
,
bd
->
angle_change_time
);
}
}
bd
->
seamless_angle_change
=
0
;
bd
->
seamless_angle_change
=
0
;
}
else
{
}
else
{
...
...
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