Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Releases
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stefan Westerfeld
ffmpeg
Commits
97c95961
Commit
97c95961
authored
Mar 27, 2023
by
James Almer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/libfdk-aaceenc: add a flush callback
Signed-off-by:
James Almer
<
jamrial@gmail.com
>
parent
4c00aa03
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
0 deletions
+40
-0
libfdk-aacenc.c
libavcodec/libfdk-aacenc.c
+40
-0
No files found.
libavcodec/libfdk-aacenc.c
View file @
97c95961
...
@@ -134,6 +134,44 @@ static int aac_encode_close(AVCodecContext *avctx)
...
@@ -134,6 +134,44 @@ static int aac_encode_close(AVCodecContext *avctx)
return
0
;
return
0
;
}
}
static
void
aac_encode_flush
(
AVCodecContext
*
avctx
)
{
AACContext
*
s
=
avctx
->
priv_data
;
AACENC_BufDesc
in_buf
=
{
0
},
out_buf
=
{
0
};
AACENC_InArgs
in_args
=
{
0
};
AACENC_OutArgs
out_args
;
int64_t
pts
,
duration
;
uint8_t
dummy_in
[
1
],
dummy_out
[
1
];
int
in_buffer_identifiers
[]
=
{
IN_AUDIO_DATA
,
IN_METADATA_SETUP
};
int
in_buffer_element_sizes
[]
=
{
2
,
sizeof
(
AACENC_MetaData
)
};
int
in_buffer_sizes
[]
=
{
0
,
sizeof
(
s
->
metaDataSetup
)
};
int
out_buffer_identifier
=
OUT_BITSTREAM_DATA
;
int
out_buffer_size
=
sizeof
(
dummy_out
),
out_buffer_element_size
=
1
;
void
*
inBuffer
[]
=
{
dummy_in
,
&
s
->
metaDataSetup
};
void
*
out_ptr
=
dummy_out
;
AACENC_ERROR
err
;
ff_af_queue_remove
(
&
s
->
afq
,
s
->
afq
.
frame_count
,
&
pts
,
&
duration
);
in_buf
.
bufs
=
(
void
**
)
inBuffer
;
in_buf
.
numBufs
=
s
->
metadata_mode
==
0
?
1
:
2
;
in_buf
.
bufferIdentifiers
=
in_buffer_identifiers
;
in_buf
.
bufSizes
=
in_buffer_sizes
;
in_buf
.
bufElSizes
=
in_buffer_element_sizes
;
out_buf
.
numBufs
=
1
;
out_buf
.
bufs
=
&
out_ptr
;
out_buf
.
bufferIdentifiers
=
&
out_buffer_identifier
;
out_buf
.
bufSizes
=
&
out_buffer_size
;
out_buf
.
bufElSizes
=
&
out_buffer_element_size
;
err
=
aacEncEncode
(
s
->
handle
,
&
in_buf
,
&
out_buf
,
&
in_args
,
&
out_args
);
if
(
err
!=
AACENC_OK
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Unexpected error while flushing: %s
\n
"
,
aac_get_error
(
err
));
}
}
static
av_cold
int
aac_encode_init
(
AVCodecContext
*
avctx
)
static
av_cold
int
aac_encode_init
(
AVCodecContext
*
avctx
)
{
{
AACContext
*
s
=
avctx
->
priv_data
;
AACContext
*
s
=
avctx
->
priv_data
;
...
@@ -572,11 +610,13 @@ const FFCodec ff_libfdk_aac_encoder = {
...
@@ -572,11 +610,13 @@ const FFCodec ff_libfdk_aac_encoder = {
.
p
.
type
=
AVMEDIA_TYPE_AUDIO
,
.
p
.
type
=
AVMEDIA_TYPE_AUDIO
,
.
p
.
id
=
AV_CODEC_ID_AAC
,
.
p
.
id
=
AV_CODEC_ID_AAC
,
.
p
.
capabilities
=
AV_CODEC_CAP_DR1
|
AV_CODEC_CAP_DELAY
|
.
p
.
capabilities
=
AV_CODEC_CAP_DR1
|
AV_CODEC_CAP_DELAY
|
AV_CODEC_CAP_ENCODER_FLUSH
|
AV_CODEC_CAP_SMALL_LAST_FRAME
,
AV_CODEC_CAP_SMALL_LAST_FRAME
,
.
caps_internal
=
FF_CODEC_CAP_NOT_INIT_THREADSAFE
,
.
caps_internal
=
FF_CODEC_CAP_NOT_INIT_THREADSAFE
,
.
priv_data_size
=
sizeof
(
AACContext
),
.
priv_data_size
=
sizeof
(
AACContext
),
.
init
=
aac_encode_init
,
.
init
=
aac_encode_init
,
FF_CODEC_ENCODE_CB
(
aac_encode_frame
),
FF_CODEC_ENCODE_CB
(
aac_encode_frame
),
.
flush
=
aac_encode_flush
,
.
close
=
aac_encode_close
,
.
close
=
aac_encode_close
,
.
p
.
sample_fmts
=
(
const
enum
AVSampleFormat
[]){
AV_SAMPLE_FMT_S16
,
.
p
.
sample_fmts
=
(
const
enum
AVSampleFormat
[]){
AV_SAMPLE_FMT_S16
,
AV_SAMPLE_FMT_NONE
},
AV_SAMPLE_FMT_NONE
},
...
...
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