[FFmpeg-cvslog] avutil/pixfmt: Document chroma plane size for odd resolutions
ffmpeg | branch: master | Michael Niedermayer | Wed Jul 18 22:22:35 2018 +0200| [be0b77e6e83b61c2da338201b5ddfae1c9acedc5] | committer: Michael Niedermayer avutil/pixfmt: Document chroma plane size for odd resolutions Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=be0b77e6e83b61c2da338201b5ddfae1c9acedc5 --- libavutil/pixfmt.h | 4 1 file changed, 4 insertions(+) diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h index aea008bbdc..2b3307845e 100644 --- a/libavutil/pixfmt.h +++ b/libavutil/pixfmt.h @@ -42,6 +42,10 @@ * This is stored as BGRA on little-endian CPU architectures and ARGB on * big-endian CPUs. * + * @note + * If the resolution is not a multiple of the chroma subsampling factor + * then the chroma plane resolution must be rounded up. + * * @par * When the pixel format is palettized RGB32 (AV_PIX_FMT_PAL8), the palettized * image data is stored in AVFrame.data[0]. The palette is transported in ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/libaomenc: export Sequence Header and Metadata OBUs as extradata
ffmpeg | branch: master | James Almer | Sat Jul 7 16:33:16 2018 -0300| [a754af942a6ab0e98eac0da36fcf41ffca77c952] | committer: James Almer avcodec/libaomenc: export Sequence Header and Metadata OBUs as extradata aom_codec_get_global_headers() is not implemented as of libaom 1.0.0 for AV1, so we're forced to extract the relevant header OBUs from the first packet and propagate them as packet side data. Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a754af942a6ab0e98eac0da36fcf41ffca77c952 --- configure | 1 + libavcodec/libaomenc.c | 41 + 2 files changed, 42 insertions(+) diff --git a/configure b/configure index 5783407bdc..534c62ed98 100755 --- a/configure +++ b/configure @@ -3048,6 +3048,7 @@ hevc_videotoolbox_encoder_deps="pthreads" hevc_videotoolbox_encoder_select="videotoolbox_encoder" libaom_av1_decoder_deps="libaom" libaom_av1_encoder_deps="libaom" +libaom_av1_encoder_select="extract_extradata_bsf" libcelt_decoder_deps="libcelt" libcodec2_decoder_deps="libcodec2" libcodec2_encoder_deps="libcodec2" diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c index 41b05dc1c0..0b75dc139c 100644 --- a/libavcodec/libaomenc.c +++ b/libavcodec/libaomenc.c @@ -55,6 +55,7 @@ struct FrameListData { typedef struct AOMEncoderContext { AVClass *class; +AVBSFContext *bsf; struct aom_codec_ctx encoder; struct aom_image rawimg; struct aom_fixed_buf twopass_stats; @@ -202,6 +203,7 @@ static av_cold int aom_free(AVCodecContext *avctx) av_freep(&ctx->twopass_stats.buf); av_freep(&avctx->stats_out); free_frame_list(ctx->coded_frame_list); +av_bsf_free(&ctx->bsf); return 0; } @@ -463,6 +465,28 @@ static av_cold int aom_init(AVCodecContext *avctx, if (!cpb_props) return AVERROR(ENOMEM); +if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) { +const AVBitStreamFilter *filter = av_bsf_get_by_name("extract_extradata"); +int ret; + +if (!filter) { +av_log(avctx, AV_LOG_ERROR, "extract_extradata bitstream filter " + "not found. This is a bug, please report it.\n"); +return AVERROR_BUG; +} +ret = av_bsf_alloc(filter, &ctx->bsf); +if (ret < 0) +return ret; + +ret = avcodec_parameters_from_context(ctx->bsf->par_in, avctx); +if (ret < 0) + return ret; + +ret = av_bsf_init(ctx->bsf); +if (ret < 0) + return ret; +} + if (enccfg.rc_end_usage == AOM_CBR || enccfg.g_pass != AOM_RC_ONE_PASS) { cpb_props->max_bitrate = avctx->rc_max_rate; @@ -494,6 +518,7 @@ static inline void cx_pktcpy(struct FrameListData *dst, static int storeframe(AVCodecContext *avctx, struct FrameListData *cx_frame, AVPacket *pkt) { +AOMContext *ctx = avctx->priv_data; int ret = ff_alloc_packet2(avctx, pkt, cx_frame->sz, 0); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, @@ -505,6 +530,22 @@ static int storeframe(AVCodecContext *avctx, struct FrameListData *cx_frame, if (!!(cx_frame->flags & AOM_FRAME_IS_KEY)) pkt->flags |= AV_PKT_FLAG_KEY; + +if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) { +ret = av_bsf_send_packet(ctx->bsf, pkt); +if (ret < 0) { +av_log(avctx, AV_LOG_ERROR, "extract_extradata filter " + "failed to send input packet\n"); +return ret; +} +ret = av_bsf_receive_packet(ctx->bsf, pkt); + +if (ret < 0) { +av_log(avctx, AV_LOG_ERROR, "extract_extradata filter " + "failed to receive output packet\n"); +return ret; +} +} return pkt->size; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec: add AV1 packet split API
ffmpeg | branch: master | James Almer | Sat Apr 14 17:29:31 2018 -0300| [45f52d19b98fed72682ee5ad3a0f93c71c7c4944] | committer: James Almer avcodec: add AV1 packet split API Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=45f52d19b98fed72682ee5ad3a0f93c71c7c4944 --- libavcodec/av1_parse.c | 103 libavcodec/av1_parse.h | 126 + 2 files changed, 229 insertions(+) diff --git a/libavcodec/av1_parse.c b/libavcodec/av1_parse.c new file mode 100644 index 00..48feb9fb8a --- /dev/null +++ b/libavcodec/av1_parse.c @@ -0,0 +1,103 @@ +/* + * AV1 common parsing code + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" + +#include "libavutil/mem.h" + +#include "av1_parse.h" +#include "bytestream.h" + +int ff_av1_extract_obu(AV1OBU *obu, const uint8_t *buf, int length, void *logctx) +{ +int64_t obu_size; +int start_pos, type, temporal_id, spatial_id; + +int ret = parse_obu_header(buf, length, &obu_size, &start_pos, + &type, &temporal_id, &spatial_id); +if (ret < 0) +return ret; + +if (obu_size > INT_MAX / 8 || obu_size < 0) +return AVERROR(ERANGE); + +obu->type= type; +obu->temporal_id = temporal_id; +obu->spatial_id = spatial_id; + +length = obu_size + start_pos; + +obu->data = buf + start_pos; +obu->size = obu_size; +obu->raw_data = buf; +obu->raw_size = length; + +ret = init_get_bits(&obu->gb, obu->data, obu->size * 8); +if (ret < 0) +return ret; + +av_log(logctx, AV_LOG_DEBUG, + "obu_type: %d, temporal_id: %d, spatial_id: %d, payload size: %d\n", + obu->type, obu->temporal_id, obu->spatial_id, obu->size); + +return length; +} + +int ff_av1_packet_split(AV1Packet *pkt, const uint8_t *buf, int length, void *logctx) +{ +GetByteContext bc; +int consumed; + +bytestream2_init(&bc, buf, length); +pkt->nb_obus = 0; + +while (bytestream2_get_bytes_left(&bc) > 0) { +AV1OBU *obu; + +if (pkt->obus_allocated < pkt->nb_obus + 1) { +int new_size = pkt->obus_allocated + 1; +AV1OBU *tmp = av_realloc_array(pkt->obus, new_size, sizeof(*tmp)); +if (!tmp) +return AVERROR(ENOMEM); + +pkt->obus = tmp; +memset(pkt->obus + pkt->obus_allocated, 0, + (new_size - pkt->obus_allocated) * sizeof(*tmp)); +pkt->obus_allocated = new_size; +} +obu = &pkt->obus[pkt->nb_obus]; + +consumed = ff_av1_extract_obu(obu, bc.buffer, bytestream2_get_bytes_left(&bc), logctx); +if (consumed < 0) +return consumed; + +pkt->nb_obus++; + +bytestream2_skip(&bc, consumed); +} + +return 0; +} + +void ff_av1_packet_uninit(AV1Packet *pkt) +{ +av_freep(&pkt->obus); +pkt->obus_allocated = 0; +} diff --git a/libavcodec/av1_parse.h b/libavcodec/av1_parse.h new file mode 100644 index 00..84fc71c925 --- /dev/null +++ b/libavcodec/av1_parse.h @@ -0,0 +1,126 @@ +/* + * AV1 common parsing code + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_AV1_PARSE_H +#define AVCODEC_AV1_PARSE_H + +#include + +#include "avcodec.h" +#include "get_bits.h" + +typedef struct AV1OBU { +/** Size of payload */ +int size; +const uint8_t *data; + +/** Size of entire OBU, including header */ +
[FFmpeg-cvslog] avformat/mov: add support for AV1 streams
ffmpeg | branch: master | James Almer | Sat Jul 7 16:33:41 2018 -0300| [9ca7ad246d536a78245b0d12dab4590004ec775d] | committer: James Almer avformat/mov: add support for AV1 streams Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9ca7ad246d536a78245b0d12dab4590004ec775d --- libavformat/isom.c | 1 + libavformat/mov.c | 31 +++ 2 files changed, 32 insertions(+) diff --git a/libavformat/isom.c b/libavformat/isom.c index 2792371c25..ce66d1bcd4 100644 --- a/libavformat/isom.c +++ b/libavformat/isom.c @@ -188,6 +188,7 @@ const AVCodecTag ff_codec_movvideo_tags[] = { { AV_CODEC_ID_VP8, MKTAG('v', 'p', '0', '8') }, /* VP8 */ { AV_CODEC_ID_VP9, MKTAG('v', 'p', '0', '9') }, /* VP9 */ +{ AV_CODEC_ID_AV1, MKTAG('a', 'v', '0', '1') }, /* AV1 */ { AV_CODEC_ID_MPEG1VIDEO, MKTAG('m', '1', 'v', ' ') }, { AV_CODEC_ID_MPEG1VIDEO, MKTAG('m', '1', 'v', '1') }, /* Apple MPEG-1 Camcorder */ diff --git a/libavformat/mov.c b/libavformat/mov.c index eda3fff6d5..870c603f0b 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -5185,6 +5185,36 @@ static int mov_read_tmcd(MOVContext *c, AVIOContext *pb, MOVAtom atom) return 0; } +static int mov_read_av1c(MOVContext *c, AVIOContext *pb, MOVAtom atom) +{ +AVStream *st; +int ret, version; + +if (c->fc->nb_streams < 1) +return 0; +st = c->fc->streams[c->fc->nb_streams - 1]; + +if (atom.size < 5) { +av_log(c->fc, AV_LOG_ERROR, "Empty AV1 Codec Configuration Box\n"); +return AVERROR_INVALIDDATA; +} + +version = avio_r8(pb); +if (version != 0) { +av_log(c->fc, AV_LOG_WARNING, "Unknown AV1 Codec Configuration Box version %d\n", version); +return 0; +} +avio_skip(pb, 3); /* flags */ + +avio_skip(pb, 1); /* reserved, initial_presentation_delay_present, initial_presentation_delay_minus_one */ + +ret = ff_get_extradata(c->fc, st->codecpar, pb, atom.size - 5); +if (ret < 0) +return ret; + +return 0; +} + static int mov_read_vpcc(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; @@ -6622,6 +6652,7 @@ static const MOVParseTableEntry mov_default_parse_table[] = { { MKTAG('A','A','L','P'), mov_read_avid }, { MKTAG('A','R','E','S'), mov_read_ares }, { MKTAG('a','v','s','s'), mov_read_avss }, +{ MKTAG('a','v','1','C'), mov_read_av1c }, { MKTAG('c','h','p','l'), mov_read_chpl }, { MKTAG('c','o','6','4'), mov_read_stco }, { MKTAG('c','o','l','r'), mov_read_colr }, ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avformat/movenc: add support for AV1 streams
ffmpeg | branch: master | James Almer | Sat Jul 7 16:35:32 2018 -0300| [9888a19db477cb8cc217321468c12a2ebe521d32] | committer: James Almer avformat/movenc: add support for AV1 streams Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9888a19db477cb8cc217321468c12a2ebe521d32 --- libavformat/Makefile | 2 +- libavformat/av1.c| 108 +++ libavformat/av1.h| 70 + libavformat/movenc.c | 42 +--- 4 files changed, 215 insertions(+), 7 deletions(-) diff --git a/libavformat/Makefile b/libavformat/Makefile index 8fb075f06f..f2f3aabdc2 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -302,7 +302,7 @@ OBJS-$(CONFIG_MM_DEMUXER)+= mm.o OBJS-$(CONFIG_MMF_DEMUXER) += mmf.o OBJS-$(CONFIG_MMF_MUXER) += mmf.o rawenc.o OBJS-$(CONFIG_MOV_DEMUXER) += mov.o mov_chan.o mov_esds.o replaygain.o -OBJS-$(CONFIG_MOV_MUXER) += movenc.o avc.o hevc.o vpcc.o \ +OBJS-$(CONFIG_MOV_MUXER) += movenc.o av1.o avc.o hevc.o vpcc.o \ movenchint.o mov_chan.o rtp.o \ movenccenc.o rawutils.o OBJS-$(CONFIG_MP2_MUXER) += rawenc.o diff --git a/libavformat/av1.c b/libavformat/av1.c new file mode 100644 index 00..7db29c8d76 --- /dev/null +++ b/libavformat/av1.c @@ -0,0 +1,108 @@ +/* + * AV1 helper functions for muxers + * Copyright (c) 2018 James Almer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavutil/mem.h" +#include "libavcodec/av1.h" +#include "libavcodec/av1_parse.h" +#include "av1.h" +#include "avio.h" + +int ff_av1_filter_obus(AVIOContext *pb, const uint8_t *buf, int size) +{ +const uint8_t *end = buf + size; +int64_t obu_size; +int start_pos, type, temporal_id, spatial_id; + +size = 0; +while (buf < end) { +int ret = parse_obu_header(buf, end - buf, &obu_size, &start_pos, + &type, &temporal_id, &spatial_id); +if (ret < 0) +return ret; + +obu_size += start_pos; +if (obu_size > INT_MAX) +return AVERROR_INVALIDDATA; + +switch (type) { +case AV1_OBU_TEMPORAL_DELIMITER: +case AV1_OBU_REDUNDANT_FRAME_HEADER: +case AV1_OBU_PADDING: +break; +default: +avio_write(pb, buf, obu_size); +size += obu_size; +break; +} +buf += obu_size; +} + +return size; +} + +int ff_av1_filter_obus_buf(const uint8_t *buf, uint8_t **out, int *size) +{ +AVIOContext *pb; +int ret; + +ret = avio_open_dyn_buf(&pb); +if (ret < 0) +return ret; + +ret = ff_av1_filter_obus(pb, buf, *size); +if (ret < 0) +return ret; + +av_freep(out); +*size = avio_close_dyn_buf(pb, out); + +return ret; +} + +int ff_isom_write_av1c(AVIOContext *pb, const uint8_t *buf, int size) +{ +int64_t obu_size; +int start_pos, type, temporal_id, spatial_id; + +while (size > 0) { +int ret = parse_obu_header(buf, size, &obu_size, &start_pos, + &type, &temporal_id, &spatial_id); +if (ret < 0) +return ret; + +obu_size += start_pos; +if (obu_size > INT_MAX) +return AVERROR_INVALIDDATA; + +switch (type) { +case AV1_OBU_SEQUENCE_HEADER: +case AV1_OBU_METADATA: +avio_write(pb, buf, obu_size); +break; +default: +break; +} +size -= obu_size; +buf += obu_size; +} + +return 0; +} diff --git a/libavformat/av1.h b/libavformat/av1.h new file mode 100644 index 00..9f2a71f353 --- /dev/null +++ b/libavformat/av1.h @@ -0,0 +1,70 @@ +/* + * AV1 helper functions for muxers + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option)
[FFmpeg-cvslog] avcodec/extract_extradata: add support for AV1
ffmpeg | branch: master | James Almer | Sat Jul 7 16:32:52 2018 -0300| [f9af3929c0df82799b4074c1ef372713ef1a64ce] | committer: James Almer avcodec/extract_extradata: add support for AV1 Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f9af3929c0df82799b4074c1ef372713ef1a64ce --- libavcodec/Makefile| 2 +- libavcodec/av1.h | 42 libavcodec/extract_extradata_bsf.c | 80 ++ 3 files changed, 123 insertions(+), 1 deletion(-) diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 67b2626fc0..2d4bc48dab 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -1046,7 +1046,7 @@ OBJS-$(CONFIG_DUMP_EXTRADATA_BSF) += dump_extradata_bsf.o OBJS-$(CONFIG_DCA_CORE_BSF) += dca_core_bsf.o OBJS-$(CONFIG_EAC3_CORE_BSF) += eac3_core_bsf.o OBJS-$(CONFIG_EXTRACT_EXTRADATA_BSF) += extract_extradata_bsf.o\ - h2645_parse.o + av1_parse.o h2645_parse.o OBJS-$(CONFIG_FILTER_UNITS_BSF) += filter_units_bsf.o OBJS-$(CONFIG_H264_METADATA_BSF) += h264_metadata_bsf.o OBJS-$(CONFIG_H264_MP4TOANNEXB_BSF) += h264_mp4toannexb_bsf.o diff --git a/libavcodec/av1.h b/libavcodec/av1.h new file mode 100644 index 00..c989b69974 --- /dev/null +++ b/libavcodec/av1.h @@ -0,0 +1,42 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * AV1 common definitions + */ + +#ifndef AVCODEC_AV1_H +#define AVCODEC_AV1_H + +// OBU types (section 6.2.2). +typedef enum { +// 0 reserved. +AV1_OBU_SEQUENCE_HEADER= 1, +AV1_OBU_TEMPORAL_DELIMITER = 2, +AV1_OBU_FRAME_HEADER = 3, +AV1_OBU_TILE_GROUP = 4, +AV1_OBU_METADATA = 5, +AV1_OBU_FRAME = 6, +AV1_OBU_REDUNDANT_FRAME_HEADER = 7, +AV1_OBU_TILE_LIST = 8, +// 9-14 reserved. +AV1_OBU_PADDING= 15, +} AV1_OBU_Type; + +#endif /* AVCODEC_AV1_H */ diff --git a/libavcodec/extract_extradata_bsf.c b/libavcodec/extract_extradata_bsf.c index 082b3e749b..1184ef2a04 100644 --- a/libavcodec/extract_extradata_bsf.c +++ b/libavcodec/extract_extradata_bsf.c @@ -24,6 +24,8 @@ #include "libavutil/opt.h" #include "avcodec.h" +#include "av1.h" +#include "av1_parse.h" #include "bsf.h" #include "h2645_parse.h" #include "h264.h" @@ -36,6 +38,9 @@ typedef struct ExtractExtradataContext { int (*extract)(AVBSFContext *ctx, AVPacket *pkt, uint8_t **data, int *size); +/* AV1 specifc fields */ +AV1Packet av1_pkt; + /* H264/HEVC specifc fields */ H2645Packet h2645_pkt; @@ -52,6 +57,78 @@ static int val_in_array(const int *arr, int len, int val) return 0; } +static int extract_extradata_av1(AVBSFContext *ctx, AVPacket *pkt, + uint8_t **data, int *size) +{ +static const int extradata_obu_types[] = { +AV1_OBU_SEQUENCE_HEADER, AV1_OBU_METADATA, +}; +ExtractExtradataContext *s = ctx->priv_data; + +int extradata_size = 0, filtered_size = 0; +int nb_extradata_obu_types = FF_ARRAY_ELEMS(extradata_obu_types); +int i, ret = 0; + +ret = ff_av1_packet_split(&s->av1_pkt, pkt->data, pkt->size, ctx); +if (ret < 0) +return ret; + +for (i = 0; i < s->av1_pkt.nb_obus; i++) { +AV1OBU *obu = &s->av1_pkt.obus[i]; +if (val_in_array(extradata_obu_types, nb_extradata_obu_types, obu->type)) { +extradata_size += obu->raw_size; +} else if (s->remove) { +filtered_size += obu->raw_size; +} +} + +if (extradata_size) { +AVBufferRef *filtered_buf; +uint8_t *extradata, *filtered_data; + +if (s->remove) { +filtered_buf = av_buffer_alloc(filtered_size + AV_INPUT_BUFFER_PADDING_SIZE); +if (!filtered_buf) { +return AVERROR(ENOMEM); +} +memset(filtered_buf->data + filtered_size, 0, AV_INPUT_BUFFER_PADDING_SIZE); + +filtered_data = filtered_buf->data; +} + +extradata = av_malloc(
[FFmpeg-cvslog] avcodec: bump micro version after previous changes
ffmpeg | branch: master | James Almer | Fri Jul 20 15:49:13 2018 -0300| [5abbb1430d3e40eae159c2e38f929f99cdd458ae] | committer: James Almer avcodec: bump micro version after previous changes Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5abbb1430d3e40eae159c2e38f929f99cdd458ae --- libavcodec/version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/version.h b/libavcodec/version.h index 7139c1f557..72e70945f7 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -29,7 +29,7 @@ #define LIBAVCODEC_VERSION_MAJOR 58 #define LIBAVCODEC_VERSION_MINOR 21 -#define LIBAVCODEC_VERSION_MICRO 105 +#define LIBAVCODEC_VERSION_MICRO 106 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \ ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/extract_extradata_bsf: make sure a Sequence Header was found for av1
ffmpeg | branch: master | James Almer | Fri Jul 20 20:43:40 2018 -0300| [3870ed7ab3e60d6f5da8cc4dc395be5374fedc96] | committer: James Almer avcodec/extract_extradata_bsf: make sure a Sequence Header was found for av1 A packet may have Metadata OBUs but no Sequence Header OBU, which is useless as extradata. Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3870ed7ab3e60d6f5da8cc4dc395be5374fedc96 --- libavcodec/extract_extradata_bsf.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libavcodec/extract_extradata_bsf.c b/libavcodec/extract_extradata_bsf.c index 1184ef2a04..6deb6634f3 100644 --- a/libavcodec/extract_extradata_bsf.c +++ b/libavcodec/extract_extradata_bsf.c @@ -67,7 +67,7 @@ static int extract_extradata_av1(AVBSFContext *ctx, AVPacket *pkt, int extradata_size = 0, filtered_size = 0; int nb_extradata_obu_types = FF_ARRAY_ELEMS(extradata_obu_types); -int i, ret = 0; +int i, has_seq = 0, ret = 0; ret = ff_av1_packet_split(&s->av1_pkt, pkt->data, pkt->size, ctx); if (ret < 0) @@ -77,12 +77,14 @@ static int extract_extradata_av1(AVBSFContext *ctx, AVPacket *pkt, AV1OBU *obu = &s->av1_pkt.obus[i]; if (val_in_array(extradata_obu_types, nb_extradata_obu_types, obu->type)) { extradata_size += obu->raw_size; +if (obu->type == AV1_OBU_SEQUENCE_HEADER) +has_seq = 1; } else if (s->remove) { filtered_size += obu->raw_size; } } -if (extradata_size) { +if (extradata_size && has_seq) { AVBufferRef *filtered_buf; uint8_t *extradata, *filtered_data; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog