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
2fa57c9d
Commit
2fa57c9d
authored
Aug 06, 2012
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mpc8: set packet duration and stream start time instead of tracking frames
Fixes mpc8 timestamps.
parent
cf22705e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
4 deletions
+3
-4
mpc8.c
libavformat/mpc8.c
+3
-4
No files found.
libavformat/mpc8.c
View file @
2fa57c9d
...
@@ -49,7 +49,6 @@ static const int mpc8_rate[8] = { 44100, 48000, 37800, 32000, -1, -1, -1, -1 };
...
@@ -49,7 +49,6 @@ static const int mpc8_rate[8] = { 44100, 48000, 37800, 32000, -1, -1, -1, -1 };
typedef
struct
{
typedef
struct
{
int
ver
;
int
ver
;
int
frame
;
int64_t
header_pos
;
int64_t
header_pos
;
int64_t
samples
;
int64_t
samples
;
...
@@ -240,6 +239,7 @@ static int mpc8_read_header(AVFormatContext *s)
...
@@ -240,6 +239,7 @@ static int mpc8_read_header(AVFormatContext *s)
st
->
codec
->
channels
=
(
st
->
codec
->
extradata
[
1
]
>>
4
)
+
1
;
st
->
codec
->
channels
=
(
st
->
codec
->
extradata
[
1
]
>>
4
)
+
1
;
st
->
codec
->
sample_rate
=
mpc8_rate
[
st
->
codec
->
extradata
[
0
]
>>
5
];
st
->
codec
->
sample_rate
=
mpc8_rate
[
st
->
codec
->
extradata
[
0
]
>>
5
];
avpriv_set_pts_info
(
st
,
32
,
1152
<<
(
st
->
codec
->
extradata
[
1
]
&
3
)
*
2
,
st
->
codec
->
sample_rate
);
avpriv_set_pts_info
(
st
,
32
,
1152
<<
(
st
->
codec
->
extradata
[
1
]
&
3
)
*
2
,
st
->
codec
->
sample_rate
);
st
->
start_time
=
0
;
st
->
duration
=
c
->
samples
/
(
1152
<<
(
st
->
codec
->
extradata
[
1
]
&
3
)
*
2
);
st
->
duration
=
c
->
samples
/
(
1152
<<
(
st
->
codec
->
extradata
[
1
]
&
3
)
*
2
);
size
-=
avio_tell
(
pb
)
-
pos
;
size
-=
avio_tell
(
pb
)
-
pos
;
...
@@ -272,7 +272,7 @@ static int mpc8_read_packet(AVFormatContext *s, AVPacket *pkt)
...
@@ -272,7 +272,7 @@ static int mpc8_read_packet(AVFormatContext *s, AVPacket *pkt)
if
(
av_get_packet
(
s
->
pb
,
pkt
,
size
)
<
0
)
if
(
av_get_packet
(
s
->
pb
,
pkt
,
size
)
<
0
)
return
AVERROR
(
ENOMEM
);
return
AVERROR
(
ENOMEM
);
pkt
->
stream_index
=
0
;
pkt
->
stream_index
=
0
;
pkt
->
pts
=
c
->
frame
;
pkt
->
duration
=
1
;
return
0
;
return
0
;
}
}
if
(
tag
==
TAG_STREAMEND
)
if
(
tag
==
TAG_STREAMEND
)
...
@@ -285,13 +285,12 @@ static int mpc8_read_packet(AVFormatContext *s, AVPacket *pkt)
...
@@ -285,13 +285,12 @@ static int mpc8_read_packet(AVFormatContext *s, AVPacket *pkt)
static
int
mpc8_read_seek
(
AVFormatContext
*
s
,
int
stream_index
,
int64_t
timestamp
,
int
flags
)
static
int
mpc8_read_seek
(
AVFormatContext
*
s
,
int
stream_index
,
int64_t
timestamp
,
int
flags
)
{
{
AVStream
*
st
=
s
->
streams
[
stream_index
];
AVStream
*
st
=
s
->
streams
[
stream_index
];
MPCContext
*
c
=
s
->
priv_data
;
int
index
=
av_index_search_timestamp
(
st
,
timestamp
,
flags
);
int
index
=
av_index_search_timestamp
(
st
,
timestamp
,
flags
);
if
(
index
<
0
)
return
-
1
;
if
(
index
<
0
)
return
-
1
;
if
(
avio_seek
(
s
->
pb
,
st
->
index_entries
[
index
].
pos
,
SEEK_SET
)
<
0
)
if
(
avio_seek
(
s
->
pb
,
st
->
index_entries
[
index
].
pos
,
SEEK_SET
)
<
0
)
return
-
1
;
return
-
1
;
c
->
frame
=
st
->
index_entries
[
index
].
timestamp
;
ff_update_cur_dts
(
s
,
st
,
st
->
index_entries
[
index
].
timestamp
)
;
return
0
;
return
0
;
}
}
...
...
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