Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
7f80b065
Commit
7f80b065
authored
Sep 07, 2017
by
Marton Balint
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avformat/mxfdec: factorize packet pts setter function
Signed-off-by:
Marton Balint
<
cus@passwd.hu
>
parent
e4fd7b1f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
23 deletions
+29
-23
mxfdec.c
libavformat/mxfdec.c
+29
-23
No files found.
libavformat/mxfdec.c
View file @
7f80b065
...
...
@@ -3060,6 +3060,32 @@ static int mxf_set_audio_pts(MXFContext *mxf, AVCodecParameters *par,
return
0
;
}
static
int
mxf_set_pts
(
MXFContext
*
mxf
,
AVStream
*
st
,
AVPacket
*
pkt
,
int64_t
next_ofs
)
{
AVCodecParameters
*
par
=
st
->
codecpar
;
MXFTrack
*
track
=
st
->
priv_data
;
if
(
par
->
codec_type
==
AVMEDIA_TYPE_VIDEO
&&
next_ofs
>=
0
)
{
/* mxf->current_edit_unit good - see if we have an
* index table to derive timestamps from */
MXFIndexTable
*
t
=
&
mxf
->
index_tables
[
0
];
if
(
mxf
->
nb_index_tables
>=
1
&&
mxf
->
current_edit_unit
<
t
->
nb_ptses
)
{
pkt
->
dts
=
mxf
->
current_edit_unit
+
t
->
first_dts
;
pkt
->
pts
=
t
->
ptses
[
mxf
->
current_edit_unit
];
}
else
if
(
track
&&
track
->
intra_only
)
{
/* intra-only -> PTS = EditUnit.
* let utils.c figure out DTS since it can be < PTS if low_delay = 0 (Sony IMX30) */
pkt
->
pts
=
mxf
->
current_edit_unit
;
}
}
else
if
(
par
->
codec_type
==
AVMEDIA_TYPE_AUDIO
)
{
int
ret
=
mxf_set_audio_pts
(
mxf
,
par
,
pkt
);
if
(
ret
<
0
)
return
ret
;
}
return
0
;
}
static
int
mxf_read_packet_old
(
AVFormatContext
*
s
,
AVPacket
*
pkt
)
{
KLVPacket
klv
;
...
...
@@ -3083,8 +3109,6 @@ static int mxf_read_packet_old(AVFormatContext *s, AVPacket *pkt)
int
index
=
mxf_get_stream_index
(
s
,
&
klv
);
int64_t
next_ofs
,
next_klv
;
AVStream
*
st
;
MXFTrack
*
track
;
AVCodecParameters
*
par
;
if
(
index
<
0
)
{
av_log
(
s
,
AV_LOG_ERROR
,
...
...
@@ -3094,7 +3118,6 @@ static int mxf_read_packet_old(AVFormatContext *s, AVPacket *pkt)
}
st
=
s
->
streams
[
index
];
track
=
st
->
priv_data
;
if
(
s
->
streams
[
index
]
->
discard
==
AVDISCARD_ALL
)
goto
skip
;
...
...
@@ -3129,26 +3152,9 @@ static int mxf_read_packet_old(AVFormatContext *s, AVPacket *pkt)
pkt
->
stream_index
=
index
;
pkt
->
pos
=
klv
.
offset
;
par
=
st
->
codecpar
;
if
(
par
->
codec_type
==
AVMEDIA_TYPE_VIDEO
&&
next_ofs
>=
0
)
{
/* mxf->current_edit_unit good - see if we have an
* index table to derive timestamps from */
MXFIndexTable
*
t
=
&
mxf
->
index_tables
[
0
];
if
(
mxf
->
nb_index_tables
>=
1
&&
mxf
->
current_edit_unit
<
t
->
nb_ptses
)
{
pkt
->
dts
=
mxf
->
current_edit_unit
+
t
->
first_dts
;
pkt
->
pts
=
t
->
ptses
[
mxf
->
current_edit_unit
];
}
else
if
(
track
&&
track
->
intra_only
)
{
/* intra-only -> PTS = EditUnit.
* let utils.c figure out DTS since it can be < PTS if low_delay = 0 (Sony IMX30) */
pkt
->
pts
=
mxf
->
current_edit_unit
;
}
}
else
if
(
par
->
codec_type
==
AVMEDIA_TYPE_AUDIO
)
{
ret
=
mxf_set_audio_pts
(
mxf
,
par
,
pkt
);
if
(
ret
<
0
)
return
ret
;
}
ret
=
mxf_set_pts
(
mxf
,
st
,
pkt
,
next_ofs
);
if
(
ret
<
0
)
return
ret
;
/* seek for truncated packets */
avio_seek
(
s
->
pb
,
next_klv
,
SEEK_SET
);
...
...
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