Merge "Add Dolby Vision branding info into MPEG-4 ftyp box" into main
diff --git a/media/libstagefright/MPEG4Writer.cpp b/media/libstagefright/MPEG4Writer.cpp
index e399cbe..a0a2891 100644
--- a/media/libstagefright/MPEG4Writer.cpp
+++ b/media/libstagefright/MPEG4Writer.cpp
@@ -567,6 +567,7 @@
mDone = false;
mThread = 0;
mDriftTimeUs = 0;
+ mHasDolbyVision = false;
// Following variables only need to be set for the first recording session.
// And they will stay the same for all the recording sessions.
@@ -714,6 +715,7 @@
// So we let the creation of the new track now and
// assign FourCC codes later using getDoviFourCC()
ALOGV("Add source mime '%s'", mime);
+ mHasDolbyVision = true;
} else if (Track::getFourCCForMime(mime) == NULL) {
ALOGE("Unsupported mime '%s'", mime);
return ERROR_UNSUPPORTED;
@@ -1576,6 +1578,13 @@
break;
}
}
+ // The brand ‘dby1’ should be used in the compatible_brands field to indicate that the file
+ // is compliant with all Dolby Extensions. For details, refer to
+ // https://professional.dolby.com/siteassets/content-creation/dolby-vision-for-content-creators/dolby_vision_bitstreams_within_the_iso_base_media_file_format_dec2017.pdf
+ // Chapter 7, Dolby Vision Files.
+ if (fileType == OUTPUT_FORMAT_MPEG_4 && mHasDolbyVision) {
+ writeFourcc("dby1");
+ }
}
endBox();
diff --git a/media/libstagefright/include/media/stagefright/MPEG4Writer.h b/media/libstagefright/include/media/stagefright/MPEG4Writer.h
index cf76606..054a4b8 100644
--- a/media/libstagefright/include/media/stagefright/MPEG4Writer.h
+++ b/media/libstagefright/include/media/stagefright/MPEG4Writer.h
@@ -241,6 +241,8 @@
std::map<uint32_t, ItemInfo> mItems;
Vector<ItemProperty> mProperties;
+ bool mHasDolbyVision;
+
// Writer thread handling
status_t startWriterThread();
status_t stopWriterThread();