avformat/matroskaenc: filter and reorder AV1 OBUs

Make sure to not write forbidden OBUs to CodecPrivate, and do the same with
unnecessary OBUs for packets.

Signed-off-by: James Almer <jamrial@gmail.com>
pull/293/merge
James Almer 7 years ago
parent ded339fb3c
commit 2de5209d91
  1. 6
      libavformat/matroskaenc.c

@ -21,6 +21,7 @@
#include <stdint.h> #include <stdint.h>
#include "av1.h"
#include "avc.h" #include "avc.h"
#include "hevc.h" #include "hevc.h"
#include "avformat.h" #include "avformat.h"
@ -769,6 +770,9 @@ static int mkv_write_native_codecprivate(AVFormatContext *s, AVIOContext *pb,
ff_isom_write_hvcc(dyn_cp, par->extradata, ff_isom_write_hvcc(dyn_cp, par->extradata,
par->extradata_size, 0); par->extradata_size, 0);
return 0; return 0;
case AV_CODEC_ID_AV1:
return ff_isom_write_av1c(dyn_cp, par->extradata,
par->extradata_size);
case AV_CODEC_ID_ALAC: case AV_CODEC_ID_ALAC:
if (par->extradata_size < 36) { if (par->extradata_size < 36) {
av_log(s, AV_LOG_ERROR, av_log(s, AV_LOG_ERROR,
@ -2120,6 +2124,8 @@ static void mkv_write_block(AVFormatContext *s, AVIOContext *pb,
(AV_RB24(par->extradata) == 1 || AV_RB32(par->extradata) == 1)) (AV_RB24(par->extradata) == 1 || AV_RB32(par->extradata) == 1))
/* extradata is Annex B, assume the bitstream is too and convert it */ /* extradata is Annex B, assume the bitstream is too and convert it */
ff_hevc_annexb2mp4_buf(pkt->data, &data, &size, 0, NULL); ff_hevc_annexb2mp4_buf(pkt->data, &data, &size, 0, NULL);
else if (par->codec_id == AV_CODEC_ID_AV1)
ff_av1_filter_obus_buf(pkt->data, &data, &size);
else if (par->codec_id == AV_CODEC_ID_WAVPACK) { else if (par->codec_id == AV_CODEC_ID_WAVPACK) {
int ret = mkv_strip_wavpack(pkt->data, &data, &size); int ret = mkv_strip_wavpack(pkt->data, &data, &size);
if (ret < 0) { if (ret < 0) {

Loading…
Cancel
Save