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
ec9a5deb
Commit
ec9a5deb
authored
13 years ago
by
Michael Niedermayer
Browse files
Options
Downloads
Patches
Plain Diff
mp3enc: drop sum and count bytes instead of bitrates from decoded headers.
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
7d624756
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libavformat/mp3enc.c
+5
-9
5 additions, 9 deletions
libavformat/mp3enc.c
with
5 additions
and
9 deletions
libavformat/mp3enc.c
+
5
−
9
View file @
ec9a5deb
...
@@ -172,7 +172,6 @@ typedef struct MP3Context {
...
@@ -172,7 +172,6 @@ typedef struct MP3Context {
uint32_t
want
;
uint32_t
want
;
uint32_t
seen
;
uint32_t
seen
;
uint32_t
pos
;
uint32_t
pos
;
uint64_t
sum
;
uint64_t
bag
[
VBR_NUM_BAGS
];
uint64_t
bag
[
VBR_NUM_BAGS
];
}
toc
;
}
toc
;
}
xing_header
;
}
xing_header
;
...
@@ -277,7 +276,6 @@ static int mp3_write_xing(AVFormatContext *s)
...
@@ -277,7 +276,6 @@ static int mp3_write_xing(AVFormatContext *s)
mp3
->
xing_header
.
toc
.
want
=
1
;
mp3
->
xing_header
.
toc
.
want
=
1
;
mp3
->
xing_header
.
toc
.
seen
=
0
;
mp3
->
xing_header
.
toc
.
seen
=
0
;
mp3
->
xing_header
.
toc
.
pos
=
0
;
mp3
->
xing_header
.
toc
.
pos
=
0
;
mp3
->
xing_header
.
toc
.
sum
=
0
;
avio_wb32
(
s
->
pb
,
0
);
// frames
avio_wb32
(
s
->
pb
,
0
);
// frames
avio_wb32
(
s
->
pb
,
0
);
// size
avio_wb32
(
s
->
pb
,
0
);
// size
...
@@ -296,7 +294,7 @@ static int mp3_write_xing(AVFormatContext *s)
...
@@ -296,7 +294,7 @@ static int mp3_write_xing(AVFormatContext *s)
* Add a frame to XING data.
* Add a frame to XING data.
* Following lame's "VbrTag.c".
* Following lame's "VbrTag.c".
*/
*/
static
void
mp3_xing_add_frame
(
AVFormatContext
*
s
,
AVPacket
*
pkt
,
MPADecodeHeader
*
c
)
static
void
mp3_xing_add_frame
(
AVFormatContext
*
s
,
AVPacket
*
pkt
)
{
{
MP3Context
*
mp3
=
s
->
priv_data
;
MP3Context
*
mp3
=
s
->
priv_data
;
struct
xing_header
*
xing_header
=
&
mp3
->
xing_header
;
struct
xing_header
*
xing_header
=
&
mp3
->
xing_header
;
...
@@ -305,10 +303,9 @@ static void mp3_xing_add_frame(AVFormatContext *s, AVPacket *pkt, MPADecodeHeade
...
@@ -305,10 +303,9 @@ static void mp3_xing_add_frame(AVFormatContext *s, AVPacket *pkt, MPADecodeHeade
++
xing_header
->
frames
;
++
xing_header
->
frames
;
xing_header
->
size
+=
pkt
->
size
;
xing_header
->
size
+=
pkt
->
size
;
toc
->
sum
+=
c
->
bit_rate
/
1000
;
if
(
toc
->
want
==
++
toc
->
seen
)
{
if
(
toc
->
want
==
++
toc
->
seen
)
{
toc
->
bag
[
toc
->
pos
]
=
toc
->
sum
;
toc
->
bag
[
toc
->
pos
]
=
xing_header
->
size
;
if
(
VBR_NUM_BAGS
==
++
toc
->
pos
)
{
if
(
VBR_NUM_BAGS
==
++
toc
->
pos
)
{
/* shrink table to half size by throwing away each second bag. */
/* shrink table to half size by throwing away each second bag. */
...
@@ -342,8 +339,7 @@ static void mp3_fix_xing(AVFormatContext *s)
...
@@ -342,8 +339,7 @@ static void mp3_fix_xing(AVFormatContext *s)
for
(
i
=
1
;
i
<
VBR_TOC_SIZE
;
++
i
)
{
for
(
i
=
1
;
i
<
VBR_TOC_SIZE
;
++
i
)
{
int
j
=
(
int
)
floor
(
scale
*
i
);
int
j
=
(
int
)
floor
(
scale
*
i
);
int
seek_point
=
(
int
)
floor
(
256
.
0
*
toc
->
bag
[
j
]
/
toc
->
sum
);
int
seek_point
=
(
int
)
floor
(
256
.
0
*
toc
->
bag
[
j
]
/
xing_header
->
size
);
avio_w8
(
s
->
pb
,
(
uint8_t
)(
seek_point
<
256
?
seek_point
:
255
));
avio_w8
(
s
->
pb
,
(
uint8_t
)(
seek_point
<
256
?
seek_point
:
255
));
}
}
...
@@ -414,9 +410,9 @@ static int mp3_write_packet(AVFormatContext *s, AVPacket *pkt)
...
@@ -414,9 +410,9 @@ static int mp3_write_packet(AVFormatContext *s, AVPacket *pkt)
MPADecodeHeader
c
;
MPADecodeHeader
c
;
int
base
;
int
base
;
#ifdef FILTER_VBR_HEADERS
ff_mpegaudio_decode_header
(
&
c
,
AV_RB32
(
pkt
->
data
));
ff_mpegaudio_decode_header
(
&
c
,
AV_RB32
(
pkt
->
data
));
#ifdef FILTER_VBR_HEADERS
/* filter out XING and INFO headers. */
/* filter out XING and INFO headers. */
base
=
4
+
xing_offtbl
[
c
.
lsf
==
1
][
c
.
nb_channels
==
1
];
base
=
4
+
xing_offtbl
[
c
.
lsf
==
1
][
c
.
nb_channels
==
1
];
...
@@ -435,7 +431,7 @@ static int mp3_write_packet(AVFormatContext *s, AVPacket *pkt)
...
@@ -435,7 +431,7 @@ static int mp3_write_packet(AVFormatContext *s, AVPacket *pkt)
#endif
#endif
if
(
0
<
mp3
->
xing_header
.
offset
)
if
(
0
<
mp3
->
xing_header
.
offset
)
mp3_xing_add_frame
(
s
,
pkt
,
&
c
);
mp3_xing_add_frame
(
s
,
pkt
);
return
ff_raw_write_packet
(
s
,
pkt
);
return
ff_raw_write_packet
(
s
,
pkt
);
}
}
...
...
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