mirror of
https://github.com/videolan/vlc.git
synced 2024-12-04 07:15:24 +08:00
aom: encoder: set extradata from sequence header and config record
Fixes #21234
This commit is contained in:
parent
6f04965a23
commit
80fd99dd02
@ -576,7 +576,8 @@ endif
|
||||
codec_LTLIBRARIES += libvpx_alpha_plugin.la
|
||||
|
||||
libaom_plugin_la_SOURCES = codec/aom.c \
|
||||
packetizer/iso_color_tables.h
|
||||
packetizer/iso_color_tables.h \
|
||||
packetizer/av1_obu.c packetizer/av1_obu.h
|
||||
libaom_plugin_la_CPPFLAGS = $(AM_CPPFLAGS)
|
||||
libaom_plugin_la_CFLAGS = $(AM_CFLAGS) $(AOM_CFLAGS) $(CPPFLAGS_aom)
|
||||
libaom_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(codecdir)'
|
||||
|
@ -43,6 +43,7 @@
|
||||
#endif
|
||||
|
||||
#include "../packetizer/iso_color_tables.h"
|
||||
#include "../packetizer/av1_obu.h"
|
||||
|
||||
#ifndef AOM_USAGE_GOOD_QUALITY
|
||||
# define AOM_USAGE_GOOD_QUALITY 0
|
||||
@ -586,6 +587,41 @@ static int OpenEncoder(vlc_object_t *p_this)
|
||||
};
|
||||
p_enc->ops = &ops;
|
||||
|
||||
/* "The caller owns the memory associated with this buffer, and must free the
|
||||
'buf' member of the aom_fixed_buf_t as well as the aom_fixed_buf_t pointer.
|
||||
Memory returned must be freed via call to free()." */
|
||||
aom_fixed_buf_t *p_headers = aom_codec_get_global_headers(ctx);
|
||||
|
||||
if (p_headers) {
|
||||
|
||||
av1_OBU_sequence_header_t *p_sequence_header = AV1_OBU_parse_sequence_header(p_headers->buf, p_headers->sz);
|
||||
if (!p_sequence_header) {
|
||||
free(p_headers->buf);
|
||||
free(p_headers);
|
||||
goto error;
|
||||
}
|
||||
|
||||
p_enc->fmt_out.i_extra =
|
||||
AV1_create_DecoderConfigurationRecord((uint8_t **)&p_enc->fmt_out.p_extra,
|
||||
p_sequence_header,
|
||||
1,
|
||||
(const uint8_t **)&p_headers->buf,
|
||||
&p_headers->sz);
|
||||
|
||||
/* Free everything regardless of whether or not the config record parsing succeeded. */
|
||||
free(p_headers->buf);
|
||||
free(p_headers);
|
||||
AV1_release_sequence_header(p_sequence_header);
|
||||
|
||||
if (!p_enc->fmt_out.i_extra) {
|
||||
msg_Err(p_enc, "Could not create decoder configuration record");
|
||||
goto error;
|
||||
}
|
||||
|
||||
} else {
|
||||
goto error;
|
||||
}
|
||||
|
||||
return VLC_SUCCESS;
|
||||
|
||||
error:
|
||||
|
@ -840,7 +840,7 @@ vlc_modules += {
|
||||
aom_dep = dependency('aom', required: get_option('aom'))
|
||||
vlc_modules += {
|
||||
'name' : 'aom',
|
||||
'sources' : files('aom.c'),
|
||||
'sources' : files('aom.c', '../packetizer/av1_obu.c'),
|
||||
'dependencies' : [aom_dep],
|
||||
'enabled' : aom_dep.found(),
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user