Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFmpeg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
libremedia
Tethys
FFmpeg
Commits
1fa3d65d
Commit
1fa3d65d
authored
20 years ago
by
Michael Niedermayer
Browse files
Options
Downloads
Patches
Plain Diff
vbr audio fix
Originally committed as revision 3111 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
dd17409c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libavformat/avidec.c
+11
-7
11 additions, 7 deletions
libavformat/avidec.c
with
11 additions
and
7 deletions
libavformat/avidec.c
+
11
−
7
View file @
1fa3d65d
...
...
@@ -38,6 +38,7 @@ typedef struct AVIStream {
int
scale
;
int
rate
;
int
sample_size
;
/* audio only data */
int
start
;
int
new_frame_offset
;
/* temporary storage (used during seek) */
int
cum_len
;
/* temporary storage (used during seek) */
...
...
@@ -232,11 +233,12 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
get_le32
(
pb
);
/* initial frame */
ast
->
scale
=
get_le32
(
pb
);
/* scale */
ast
->
rate
=
get_le32
(
pb
);
get_le32
(
pb
);
/* start */
ast
->
start
=
get_le32
(
pb
);
/* start */
length
=
get_le32
(
pb
);
/* length, in samples or bytes */
get_le32
(
pb
);
/* buffer size */
get_le32
(
pb
);
/* quality */
ast
->
sample_size
=
get_le32
(
pb
);
/* sample ssize */
//av_log(NULL, AV_LOG_DEBUG, "%d %d %d %d\n", ast->scale, ast->rate, ast->sample_size, ast->start);
st
->
start_time
=
0
;
if
(
ast
->
rate
!=
0
)
st
->
duration
=
(
int64_t
)
length
*
AV_TIME_BASE
/
ast
->
rate
;
...
...
@@ -419,10 +421,10 @@ static int avi_read_packet(AVFormatContext *s, AVPacket *pkt)
ast
=
st
->
priv_data
;
/* XXX: how to handle B frames in avi ? */
if
(
st
->
codec
.
codec_type
==
CODEC_TYPE_VIDEO
)
if
(
ast
->
sample_size
)
pkt
->
pts
=
((
int64_t
)
ast
->
frame_offset
*
ast
->
scale
*
AV_TIME_BASE
)
/
(
ast
->
rate
*
ast
->
sample_size
);
else
pkt
->
pts
=
((
int64_t
)
ast
->
frame_offset
*
ast
->
scale
*
AV_TIME_BASE
)
/
ast
->
rate
;
else
//FIXME this is proably not correct for all weird avis
pkt
->
pts
=
((
int64_t
)
ast
->
frame_offset
*
ast
->
scale
*
AV_TIME_BASE
)
/
(
ast
->
rate
*
st
->
codec
.
block_align
);
//printf("%Ld %d %d %d %d\n", pkt->pts, ast->frame_offset, ast->scale, AV_TIME_BASE, ast->rate);
pkt
->
stream_index
=
n
;
/* FIXME: We really should read index for that */
...
...
@@ -435,11 +437,13 @@ static int avi_read_packet(AVFormatContext *s, AVPacket *pkt)
are key frames */
pkt
->
flags
|=
PKT_FLAG_KEY
;
}
ast
->
frame_offset
++
;
}
else
{
ast
->
frame_offset
+=
pkt
->
size
;
pkt
->
flags
|=
PKT_FLAG_KEY
;
}
if
(
ast
->
sample_size
)
ast
->
frame_offset
+=
pkt
->
size
;
else
ast
->
frame_offset
++
;
}
return
size
;
}
...
...
@@ -634,7 +638,7 @@ static int avi_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp
if
((
j
+
1
)
<
ast
->
nb_index_entries
)
j
++
;
/* extract the current frame number */
if
(
st
->
codec
.
codec_type
==
CODEC_TYPE_VIDEO
)
if
(
a
st
->
sample_size
==
0
)
ast
->
new_frame_offset
=
j
;
else
ast
->
new_frame_offset
=
ast
->
index_entries
[
j
].
cum_len
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment