Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
f768ca3a
Commit
f768ca3a
authored
Jun 19, 2015
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/ffmpeg: move code to StreamRelativePts()
parent
947e9022
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
6 deletions
+20
-6
FfmpegDecoderPlugin.cxx
src/decoder/plugins/FfmpegDecoderPlugin.cxx
+20
-6
No files found.
src/decoder/plugins/FfmpegDecoderPlugin.cxx
View file @
f768ca3a
...
...
@@ -305,6 +305,22 @@ copy_interleave_frame(const AVCodecContext *codec_context,
return
data_size
;
}
/**
* Convert AVPacket::pts to a stream-relative time stamp (still in
* AVStream::time_base units). Returns a negative value on error.
*/
gcc_pure
static
int64_t
StreamRelativePts
(
const
AVPacket
&
packet
,
const
AVStream
&
stream
)
{
auto
pts
=
packet
.
pts
;
if
(
pts
<
0
||
pts
==
int64_t
(
AV_NOPTS_VALUE
))
return
-
1
;
auto
start
=
start_time_fallback
(
stream
);
return
pts
-
start
;
}
static
DecoderCommand
ffmpeg_send_packet
(
Decoder
&
decoder
,
InputStream
&
is
,
const
AVPacket
*
packet
,
...
...
@@ -313,12 +329,10 @@ ffmpeg_send_packet(Decoder &decoder, InputStream &is,
AVFrame
*
frame
,
uint8_t
**
buffer
,
int
*
buffer_size
)
{
if
(
packet
->
pts
>=
0
&&
packet
->
pts
!=
(
int64_t
)
AV_NOPTS_VALUE
)
{
auto
start
=
start_time_fallback
(
*
stream
);
if
(
packet
->
pts
>=
start
)
decoder_timestamp
(
decoder
,
time_from_ffmpeg
(
packet
->
pts
-
start
,
stream
->
time_base
));
const
auto
pts
=
StreamRelativePts
(
*
packet
,
*
stream
);
if
(
pts
>=
0
)
{
decoder_timestamp
(
decoder
,
time_from_ffmpeg
(
pts
,
stream
->
time_base
));
}
AVPacket
packet2
=
*
packet
;
...
...
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