Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
7ad0c654
Commit
7ad0c654
authored
Sep 29, 2011
by
Tobias Güntner
Committed by
Jean-Baptiste Kempf
Sep 29, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Skip redundant chapters
Signed-off-by:
Jean-Baptiste Kempf
<
jb@videolan.org
>
parent
2a6d0536
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
4 deletions
+31
-4
modules/access/vdr.c
modules/access/vdr.c
+31
-4
No files found.
modules/access/vdr.c
View file @
7ad0c654
...
@@ -116,6 +116,9 @@ vlc_module_end ()
...
@@ -116,6 +116,9 @@ vlc_module_end ()
* Local prototypes, constants, structures
* Local prototypes, constants, structures
*****************************************************************************/
*****************************************************************************/
/* minimum chapter size in seconds */
#define MIN_CHAPTER_SIZE 5
TYPEDEF_ARRAY
(
uint64_t
,
size_array_t
);
TYPEDEF_ARRAY
(
uint64_t
,
size_array_t
);
struct
access_sys_t
struct
access_sys_t
...
@@ -831,6 +834,16 @@ static void ImportMarks( access_t *p_access )
...
@@ -831,6 +834,16 @@ static void ImportMarks( access_t *p_access )
return
;
return
;
}
}
/* get the length of this recording (index stores 8 bytes per frame) */
struct
stat
st
;
if
(
fstat
(
fileno
(
indexfile
),
&
st
)
)
{
fclose
(
marksfile
);
fclose
(
indexfile
);
return
;
}
int64_t
i_frame_count
=
st
.
st_size
/
8
;
/* Put all cut marks in a "dummy" title */
/* Put all cut marks in a "dummy" title */
input_title_t
*
p_marks
=
vlc_input_title_New
();
input_title_t
*
p_marks
=
vlc_input_title_New
();
if
(
!
p_marks
)
if
(
!
p_marks
)
...
@@ -845,6 +858,13 @@ static void ImportMarks( access_t *p_access )
...
@@ -845,6 +858,13 @@ static void ImportMarks( access_t *p_access )
int
i_chapter_offset
=
p_sys
->
fps
/
1000
*
int
i_chapter_offset
=
p_sys
->
fps
/
1000
*
var_InheritInteger
(
p_access
,
"vdr-chapter-offset"
);
var_InheritInteger
(
p_access
,
"vdr-chapter-offset"
);
/* minimum chapter size in frames */
int
i_min_chapter_size
=
p_sys
->
fps
*
MIN_CHAPTER_SIZE
;
/* the last chapter started at this frame (init to 0 so
* we skip useless chapters near the beginning as well) */
int64_t
i_prev_chapter
=
0
;
/* parse lines of the form "0:00:00.00 foobar" */
/* parse lines of the form "0:00:00.00 foobar" */
char
*
line
=
NULL
;
char
*
line
=
NULL
;
size_t
line_len
;
size_t
line_len
;
...
@@ -852,6 +872,12 @@ static void ImportMarks( access_t *p_access )
...
@@ -852,6 +872,12 @@ static void ImportMarks( access_t *p_access )
{
{
int64_t
i_frame
=
ParseFrameNumber
(
line
,
p_sys
->
fps
);
int64_t
i_frame
=
ParseFrameNumber
(
line
,
p_sys
->
fps
);
/* skip chapters which are near the end or too close to each other */
if
(
i_frame
-
i_prev_chapter
<
i_min_chapter_size
||
i_frame
>=
i_frame_count
-
i_min_chapter_size
)
continue
;
i_prev_chapter
=
i_frame
;
/* move chapters (simple workaround for inaccurate cut marks) */
/* move chapters (simple workaround for inaccurate cut marks) */
if
(
i_frame
>
-
i_chapter_offset
)
if
(
i_frame
>
-
i_chapter_offset
)
i_frame
+=
i_chapter_offset
;
i_frame
+=
i_chapter_offset
;
...
@@ -879,7 +905,8 @@ static void ImportMarks( access_t *p_access )
...
@@ -879,7 +905,8 @@ static void ImportMarks( access_t *p_access )
TAB_APPEND
(
p_marks
->
i_seekpoint
,
p_marks
->
seekpoint
,
sp
);
TAB_APPEND
(
p_marks
->
i_seekpoint
,
p_marks
->
seekpoint
,
sp
);
}
}
if
(
p_marks
->
i_seekpoint
>
0
)
/* add a chapter at the beginning if missing */
if
(
p_marks
->
i_seekpoint
>
0
&&
p_marks
->
seekpoint
[
0
]
->
i_byte_offset
>
0
)
{
{
seekpoint_t
*
sp
=
vlc_seekpoint_New
();
seekpoint_t
*
sp
=
vlc_seekpoint_New
();
if
(
sp
)
if
(
sp
)
...
@@ -889,12 +916,12 @@ static void ImportMarks( access_t *p_access )
...
@@ -889,12 +916,12 @@ static void ImportMarks( access_t *p_access )
sp
->
psz_name
=
strdup
(
_
(
"Start"
)
);
sp
->
psz_name
=
strdup
(
_
(
"Start"
)
);
TAB_INSERT
(
p_marks
->
i_seekpoint
,
p_marks
->
seekpoint
,
sp
,
0
);
TAB_INSERT
(
p_marks
->
i_seekpoint
,
p_marks
->
seekpoint
,
sp
,
0
);
}
}
p_sys
->
p_marks
=
p_marks
;
}
}
if
(
p_marks
->
i_seekpoint
>
0
)
p_sys
->
p_marks
=
p_marks
;
else
else
{
vlc_input_title_Delete
(
p_marks
);
vlc_input_title_Delete
(
p_marks
);
}
fclose
(
marksfile
);
fclose
(
marksfile
);
fclose
(
indexfile
);
fclose
(
indexfile
);
...
...
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