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
d7ba3f3f
Commit
d7ba3f3f
authored
Jul 25, 2009
by
ogg.k.ogg.k
Committed by
Laurent Aimar
Jul 29, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reconstruct Theora granpos
Signed-off-by:
Laurent Aimar
<
fenrir@videolan.org
>
parent
b1f6efeb
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
17 deletions
+28
-17
modules/codec/theora.c
modules/codec/theora.c
+5
-0
modules/demux/ogg.c
modules/demux/ogg.c
+6
-0
modules/mux/ogg.c
modules/mux/ogg.c
+17
-17
No files found.
modules/codec/theora.c
View file @
d7ba3f3f
...
...
@@ -818,6 +818,11 @@ static block_t *Encode( encoder_t *p_enc, picture_t *p_pict )
memcpy
(
p_block
->
p_buffer
,
oggpacket
.
packet
,
oggpacket
.
bytes
);
p_block
->
i_dts
=
p_block
->
i_pts
=
p_pict
->
date
;
if
(
theora_packet_iskeyframe
(
&
oggpacket
)
)
{
p_block
->
i_flags
|=
BLOCK_FLAG_TYPE_I
;
}
return
p_block
;
}
...
...
modules/demux/ogg.c
View file @
d7ba3f3f
...
...
@@ -806,7 +806,13 @@ static void Ogg_DecodePacket( demux_t *p_demux,
p_block
->
i_length
=
0
;
}
else
if
(
p_stream
->
fmt
.
i_codec
==
VLC_CODEC_THEORA
)
{
p_block
->
i_dts
=
p_block
->
i_pts
=
i_pts
;
if
(
(
p_oggpacket
->
granulepos
&
((
1
<<
p_stream
->
i_granule_shift
)
-
1
))
==
0
)
{
p_block
->
i_flags
|=
BLOCK_FLAG_TYPE_I
;
}
}
else
if
(
p_stream
->
fmt
.
i_codec
==
VLC_CODEC_DIRAC
)
{
ogg_int64_t
dts
=
p_oggpacket
->
granulepos
>>
31
;
...
...
modules/mux/ogg.c
View file @
d7ba3f3f
...
...
@@ -179,8 +179,10 @@ typedef struct
int
i_packet_no
;
int
i_serial_no
;
int
i_keyframe_granule_shift
;
/* Theora only */
int
i_last_keyframe
;
/* dirac and eventually theora */
int
i_last_keyframe
;
/* dirac and theora */
int
i_num_frames
;
/* Theora only */
uint64_t
u_last_granulepos
;
/* Used for correct EOS page */
int64_t
i_num_keyframes
;
ogg_stream_state
os
;
oggds_header_t
*
p_oggds_header
;
...
...
@@ -326,6 +328,9 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
p_stream
->
i_fourcc
=
p_input
->
p_fmt
->
i_codec
;
p_stream
->
i_serial_no
=
p_sys
->
i_next_serial_no
++
;
p_stream
->
i_packet_no
=
0
;
p_stream
->
i_last_keyframe
=
0
;
p_stream
->
i_num_keyframes
=
0
;
p_stream
->
i_num_frames
=
0
;
p_stream
->
p_oggds_header
=
0
;
...
...
@@ -654,17 +659,8 @@ static block_t *OggCreateHeader( sout_mux_t *p_mux )
/* Get keyframe_granule_shift for theora granulepos calculation */
if
(
p_stream
->
i_fourcc
==
VLC_CODEC_THEORA
)
{
int
i_keyframe_frequency_force
=
1
<<
((
op
.
packet
[
40
]
<<
6
>>
3
)
|
(
op
.
packet
[
41
]
>>
5
));
/* granule_shift = i_log( frequency_force -1 ) */
p_stream
->
i_keyframe_granule_shift
=
0
;
i_keyframe_frequency_force
--
;
while
(
i_keyframe_frequency_force
)
{
p_stream
->
i_keyframe_granule_shift
++
;
i_keyframe_frequency_force
>>=
1
;
}
p_stream
->
i_keyframe_granule_shift
=
(
(
op
.
packet
[
40
]
&
0x03
)
<<
3
)
|
(
(
op
.
packet
[
41
]
&
0xe0
)
>>
5
);
}
}
else
if
(
p_stream
->
i_fourcc
==
VLC_CODEC_DIRAC
)
...
...
@@ -1002,11 +998,15 @@ static int MuxBlock( sout_mux_t *p_mux, sout_input_t *p_input )
{
if
(
p_stream
->
i_fourcc
==
VLC_CODEC_THEORA
)
{
/* FIXME, we assume only keyframes */
op
.
granulepos
=
(
(
p_data
->
i_dts
-
p_sys
->
i_start_dts
)
*
p_input
->
p_fmt
->
video
.
i_frame_rate
/
p_input
->
p_fmt
->
video
.
i_frame_rate_base
/
INT64_C
(
1000000
)
)
<<
p_stream
->
i_keyframe_granule_shift
;
p_stream
->
i_num_frames
++
;
if
(
p_data
->
i_flags
&
BLOCK_FLAG_TYPE_I
)
{
p_stream
->
i_num_keyframes
++
;
p_stream
->
i_last_keyframe
=
p_stream
->
i_num_frames
;
}
op
.
granulepos
=
(
p_stream
->
i_last_keyframe
<<
p_stream
->
i_keyframe_granule_shift
)
|
(
p_stream
->
i_num_frames
-
p_stream
->
i_last_keyframe
);
}
else
if
(
p_stream
->
i_fourcc
==
VLC_CODEC_DIRAC
)
{
...
...
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