diff --git a/src/write.c b/src/write.c index cf4e1c7932..528292080b 100644 --- a/src/write.c +++ b/src/write.c @@ -3134,6 +3134,7 @@ avifResult avifEncoderFinish(avifEncoder * encoder, avifRWData * output) // ----------------------------------------------------------------------- // Harvest configuration properties from sequence headers + avifBool isMA1B = AVIF_TRUE; for (uint32_t itemIndex = 0; itemIndex < encoder->data->items.count; ++itemIndex) { avifEncoderItem * item = &encoder->data->items.item[itemIndex]; if (item->encodeOutput->samples.count > 0) { @@ -3142,6 +3143,11 @@ avifResult avifEncoderFinish(avifEncoder * encoder, avifRWData * output) AVIF_CHECKERR(avifSequenceHeaderParse(&sequenceHeader, (const avifROData *)&firstSample->data, codecType), avifGetErrorForItemCategory(item->itemCategory)); item->av1C = sequenceHeader.av1C; + // The MA1B brand: The AV1 profile shall be the Main Profile and + // the level shall be 5.1 or lower. + if (item->av1C.seqProfile != 0 || item->av1C.seqLevelIdx0 > 13) { + isMA1B = AVIF_FALSE; + } } } @@ -3239,10 +3245,11 @@ avifResult avifEncoderFinish(avifEncoder * encoder, avifRWData * output) } // AVIF_CHECKRES(avifRWStreamWriteChars(&s, "mif1", 4)); // ... compatible_brands[] AVIF_CHECKRES(avifRWStreamWriteChars(&s, "miaf", 4)); // ... compatible_brands[] + if (isMA1B) { // + AVIF_CHECKRES(avifRWStreamWriteChars(&s, "MA1B", 4)); // ... compatible_brands[] + } // if ((imageMetadata->depth == 8) || (imageMetadata->depth == 10)) { // - if (imageMetadata->yuvFormat == AVIF_PIXEL_FORMAT_YUV420) { // - AVIF_CHECKRES(avifRWStreamWriteChars(&s, "MA1B", 4)); // ... compatible_brands[] - } else if (imageMetadata->yuvFormat == AVIF_PIXEL_FORMAT_YUV444) { // + if (imageMetadata->yuvFormat == AVIF_PIXEL_FORMAT_YUV444) { // AVIF_CHECKRES(avifRWStreamWriteChars(&s, "MA1A", 4)); // ... compatible_brands[] } }