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
98f5cbcb
Commit
98f5cbcb
authored
Jul 30, 2019
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avformat/dsfdec: set packet pts/duration/pos correctly
parent
ef73ccc2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
2 deletions
+15
-2
dsfdec.c
libavformat/dsfdec.c
+15
-2
No files found.
libavformat/dsfdec.c
View file @
98f5cbcb
...
...
@@ -130,6 +130,7 @@ static int dsf_read_header(AVFormatContext *s)
}
st
->
codecpar
->
block_align
*=
st
->
codecpar
->
channels
;
st
->
codecpar
->
bit_rate
=
st
->
codecpar
->
channels
*
st
->
codecpar
->
sample_rate
*
8LL
;
avpriv_set_pts_info
(
st
,
64
,
1
,
st
->
codecpar
->
sample_rate
);
avio_skip
(
pb
,
4
);
/* data chunk */
...
...
@@ -150,11 +151,11 @@ static int dsf_read_packet(AVFormatContext *s, AVPacket *pkt)
AVIOContext
*
pb
=
s
->
pb
;
AVStream
*
st
=
s
->
streams
[
0
];
int64_t
pos
=
avio_tell
(
pb
);
int
ret
;
if
(
pos
>=
dsf
->
data_end
)
return
AVERROR_EOF
;
pkt
->
stream_index
=
0
;
if
(
dsf
->
data_size
>
dsf
->
audio_size
)
{
int
last_packet
=
pos
==
(
dsf
->
data_end
-
st
->
codecpar
->
block_align
);
...
...
@@ -180,10 +181,22 @@ static int dsf_read_packet(AVFormatContext *s, AVPacket *pkt)
avio_skip
(
pb
,
skip_size
/
st
->
codecpar
->
channels
);
}
pkt
->
pos
=
pos
;
pkt
->
stream_index
=
0
;
pkt
->
pts
=
(
pos
-
s
->
internal
->
data_offset
)
/
st
->
codecpar
->
channels
;
pkt
->
duration
=
packet_size
/
st
->
codecpar
->
channels
;
return
0
;
}
}
return
av_get_packet
(
pb
,
pkt
,
FFMIN
(
dsf
->
data_end
-
pos
,
st
->
codecpar
->
block_align
));
ret
=
av_get_packet
(
pb
,
pkt
,
FFMIN
(
dsf
->
data_end
-
pos
,
st
->
codecpar
->
block_align
));
if
(
ret
<
0
)
return
ret
;
pkt
->
stream_index
=
0
;
pkt
->
pts
=
(
pos
-
s
->
internal
->
data_offset
)
/
st
->
codecpar
->
channels
;
pkt
->
duration
=
st
->
codecpar
->
block_align
/
st
->
codecpar
->
channels
;
return
0
;
}
AVInputFormat
ff_dsf_demuxer
=
{
...
...
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