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
09031b46
Commit
09031b46
authored
Feb 24, 2013
by
Justin Ruggles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vorbisenc: cosmetics: rename variable avccontext to avctx
This is consistent with the rest of libavcodec.
parent
e951b6d9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
30 deletions
+30
-30
vorbisenc.c
libavcodec/vorbisenc.c
+30
-30
No files found.
libavcodec/vorbisenc.c
View file @
09031b46
...
...
@@ -236,15 +236,15 @@ static int ready_residue(vorbis_enc_residue *rc, vorbis_enc_context *venc)
}
static
int
create_vorbis_context
(
vorbis_enc_context
*
venc
,
AVCodecContext
*
avc
context
)
AVCodecContext
*
avc
tx
)
{
vorbis_enc_floor
*
fc
;
vorbis_enc_residue
*
rc
;
vorbis_enc_mapping
*
mc
;
int
i
,
book
,
ret
;
venc
->
channels
=
avc
context
->
channels
;
venc
->
sample_rate
=
avc
context
->
sample_rate
;
venc
->
channels
=
avc
tx
->
channels
;
venc
->
sample_rate
=
avc
tx
->
sample_rate
;
venc
->
log2_blocksize
[
0
]
=
venc
->
log2_blocksize
[
1
]
=
11
;
venc
->
ncodebooks
=
FF_ARRAY_ELEMS
(
cvectors
);
...
...
@@ -340,7 +340,7 @@ static int create_vorbis_context(vorbis_enc_context *venc,
};
fc
->
list
[
i
].
x
=
a
[
i
-
2
];
}
if
(
ff_vorbis_ready_floor1_list
(
avc
context
,
fc
->
list
,
fc
->
values
))
if
(
ff_vorbis_ready_floor1_list
(
avc
tx
,
fc
->
list
,
fc
->
values
))
return
AVERROR_BUG
;
venc
->
nresidues
=
1
;
...
...
@@ -1015,10 +1015,10 @@ static int apply_window_and_mdct(vorbis_enc_context *venc,
}
static
int
vorbis_encode_frame
(
AVCodecContext
*
avc
context
,
AVPacket
*
avpkt
,
static
int
vorbis_encode_frame
(
AVCodecContext
*
avc
tx
,
AVPacket
*
avpkt
,
const
AVFrame
*
frame
,
int
*
got_packet_ptr
)
{
vorbis_enc_context
*
venc
=
avc
context
->
priv_data
;
vorbis_enc_context
*
venc
=
avc
tx
->
priv_data
;
float
**
audio
=
frame
?
(
float
**
)
frame
->
extended_data
:
NULL
;
int
samples
=
frame
?
frame
->
nb_samples
:
0
;
vorbis_enc_mode
*
mode
;
...
...
@@ -1031,14 +1031,14 @@ static int vorbis_encode_frame(AVCodecContext *avccontext, AVPacket *avpkt,
samples
=
1
<<
(
venc
->
log2_blocksize
[
0
]
-
1
);
if
((
ret
=
ff_alloc_packet
(
avpkt
,
8192
)))
{
av_log
(
avc
context
,
AV_LOG_ERROR
,
"Error getting output packet
\n
"
);
av_log
(
avc
tx
,
AV_LOG_ERROR
,
"Error getting output packet
\n
"
);
return
ret
;
}
init_put_bits
(
&
pb
,
avpkt
->
data
,
avpkt
->
size
);
if
(
pb
.
size_in_bits
-
put_bits_count
(
&
pb
)
<
1
+
ilog
(
venc
->
nmodes
-
1
))
{
av_log
(
avc
context
,
AV_LOG_ERROR
,
"output buffer is too small
\n
"
);
av_log
(
avc
tx
,
AV_LOG_ERROR
,
"output buffer is too small
\n
"
);
return
AVERROR
(
EINVAL
);
}
...
...
@@ -1058,7 +1058,7 @@ static int vorbis_encode_frame(AVCodecContext *avccontext, AVPacket *avpkt,
uint16_t
posts
[
MAX_FLOOR_VALUES
];
floor_fit
(
venc
,
fc
,
&
venc
->
coeffs
[
i
*
samples
],
posts
,
samples
);
if
(
floor_encode
(
venc
,
fc
,
&
pb
,
posts
,
&
venc
->
floor
[
i
*
samples
],
samples
))
{
av_log
(
avc
context
,
AV_LOG_ERROR
,
"output buffer is too small
\n
"
);
av_log
(
avc
tx
,
AV_LOG_ERROR
,
"output buffer is too small
\n
"
);
return
AVERROR
(
EINVAL
);
}
}
...
...
@@ -1082,17 +1082,17 @@ static int vorbis_encode_frame(AVCodecContext *avccontext, AVPacket *avpkt,
if
(
residue_encode
(
venc
,
&
venc
->
residues
[
mapping
->
residue
[
mapping
->
mux
[
0
]]],
&
pb
,
venc
->
coeffs
,
samples
,
venc
->
channels
))
{
av_log
(
avc
context
,
AV_LOG_ERROR
,
"output buffer is too small
\n
"
);
av_log
(
avc
tx
,
AV_LOG_ERROR
,
"output buffer is too small
\n
"
);
return
AVERROR
(
EINVAL
);
}
flush_put_bits
(
&
pb
);
avpkt
->
size
=
put_bits_count
(
&
pb
)
>>
3
;
avpkt
->
duration
=
ff_samples_to_time_base
(
avc
context
,
avccontext
->
frame_size
);
avpkt
->
duration
=
ff_samples_to_time_base
(
avc
tx
,
avctx
->
frame_size
);
if
(
frame
)
if
(
frame
->
pts
!=
AV_NOPTS_VALUE
)
avpkt
->
pts
=
ff_samples_to_time_base
(
avc
context
,
frame
->
pts
);
avpkt
->
pts
=
ff_samples_to_time_base
(
avc
tx
,
frame
->
pts
);
else
avpkt
->
pts
=
venc
->
next_pts
;
if
(
avpkt
->
pts
!=
AV_NOPTS_VALUE
)
...
...
@@ -1103,9 +1103,9 @@ static int vorbis_encode_frame(AVCodecContext *avccontext, AVPacket *avpkt,
}
static
av_cold
int
vorbis_encode_close
(
AVCodecContext
*
avc
context
)
static
av_cold
int
vorbis_encode_close
(
AVCodecContext
*
avc
tx
)
{
vorbis_enc_context
*
venc
=
avc
context
->
priv_data
;
vorbis_enc_context
*
venc
=
avc
tx
->
priv_data
;
int
i
;
if
(
venc
->
codebooks
)
...
...
@@ -1158,42 +1158,42 @@ static av_cold int vorbis_encode_close(AVCodecContext *avccontext)
ff_mdct_end
(
&
venc
->
mdct
[
1
]);
#if FF_API_OLD_ENCODE_AUDIO
av_freep
(
&
avc
context
->
coded_frame
);
av_freep
(
&
avc
tx
->
coded_frame
);
#endif
av_freep
(
&
avc
context
->
extradata
);
av_freep
(
&
avc
tx
->
extradata
);
return
0
;
}
static
av_cold
int
vorbis_encode_init
(
AVCodecContext
*
avc
context
)
static
av_cold
int
vorbis_encode_init
(
AVCodecContext
*
avc
tx
)
{
vorbis_enc_context
*
venc
=
avc
context
->
priv_data
;
vorbis_enc_context
*
venc
=
avc
tx
->
priv_data
;
int
ret
;
if
(
avc
context
->
channels
!=
2
)
{
av_log
(
avc
context
,
AV_LOG_ERROR
,
"Current Libav Vorbis encoder only supports 2 channels.
\n
"
);
if
(
avc
tx
->
channels
!=
2
)
{
av_log
(
avc
tx
,
AV_LOG_ERROR
,
"Current Libav Vorbis encoder only supports 2 channels.
\n
"
);
return
-
1
;
}
if
((
ret
=
create_vorbis_context
(
venc
,
avc
context
))
<
0
)
if
((
ret
=
create_vorbis_context
(
venc
,
avc
tx
))
<
0
)
goto
error
;
avc
context
->
bit_rate
=
0
;
if
(
avc
context
->
flags
&
CODEC_FLAG_QSCALE
)
venc
->
quality
=
avc
context
->
global_quality
/
(
float
)
FF_QP2LAMBDA
;
avc
tx
->
bit_rate
=
0
;
if
(
avc
tx
->
flags
&
CODEC_FLAG_QSCALE
)
venc
->
quality
=
avc
tx
->
global_quality
/
(
float
)
FF_QP2LAMBDA
;
else
venc
->
quality
=
3
.
0
;
venc
->
quality
*=
venc
->
quality
;
if
((
ret
=
put_main_header
(
venc
,
(
uint8_t
**
)
&
avc
context
->
extradata
))
<
0
)
if
((
ret
=
put_main_header
(
venc
,
(
uint8_t
**
)
&
avc
tx
->
extradata
))
<
0
)
goto
error
;
avc
context
->
extradata_size
=
ret
;
avc
tx
->
extradata_size
=
ret
;
avc
context
->
frame_size
=
1
<<
(
venc
->
log2_blocksize
[
0
]
-
1
);
avc
tx
->
frame_size
=
1
<<
(
venc
->
log2_blocksize
[
0
]
-
1
);
#if FF_API_OLD_ENCODE_AUDIO
avc
context
->
coded_frame
=
avcodec_alloc_frame
();
if
(
!
avc
context
->
coded_frame
)
{
avc
tx
->
coded_frame
=
avcodec_alloc_frame
();
if
(
!
avc
tx
->
coded_frame
)
{
ret
=
AVERROR
(
ENOMEM
);
goto
error
;
}
...
...
@@ -1201,7 +1201,7 @@ static av_cold int vorbis_encode_init(AVCodecContext *avccontext)
return
0
;
error:
vorbis_encode_close
(
avc
context
);
vorbis_encode_close
(
avc
tx
);
return
ret
;
}
...
...
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