| 78 | 78 | { "delay_moov", "Delay writing the initial moov until the first fragment is cut, or until the first fragment flush", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_DELAY_MOOV}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" }, |
| 79 | 79 | { "global_sidx", "Write a global sidx index at the start of the file", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_GLOBAL_SIDX}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" }, |
| 80 | 80 | { "skip_sidx", "Skip writing of sidx atom", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_SKIP_SIDX}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" }, |
| 81 | 82 | { "write_colr", "Write colr atom even if the color info is unspecified (Experimental, may be renamed or changed, do not use from scripts)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_WRITE_COLR}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" }, |
| 82 | 83 | { "prefer_icc", "If writing colr atom prioritise usage of ICC profile if it exists in stream packet side data", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_PREFER_ICC}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" }, |
| 83 | 84 | { "write_gama", "Write deprecated gama atom", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_WRITE_GAMA}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" }, |
| | 3417 | static int mov_write_pixeldensity_meta_tag(AVIOContext *pb, MOVMuxContext *mov, MOVTrack *track, AVFormatContext *s) |
| | 3418 | { |
| | 3419 | int size = 0; |
| | 3420 | int64_t pos = avio_tell(pb); |
| | 3421 | avio_wb32(pb, 0); /* meta atom size */ |
| | 3422 | ffio_wfourcc(pb, "meta"); |
| | 3423 | |
| | 3424 | /* Metadata atom information as described in |
| | 3425 | * https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/Metadata/Metadata.html#//apple_ref/doc/uid/TP40000939-CH1-SW9 |
| | 3426 | */ |
| | 3427 | avio_wb32(pb, 33); /* hdlr atom size: size (4) + 'hdlr' (4) + version/flags (4) + predefined (4) + 'mdta' (4) + |
| | 3428 | reserved (3*4) + name (1) = 33 */ |
| | 3429 | ffio_wfourcc(pb, "hdlr"); |
| | 3430 | avio_wb32(pb, 0); /* version (1 Byte) and flags (3 Bytes), must be zero */ |
| | 3431 | avio_wb32(pb, 0); /* "predefined", must be zero */ |
| | 3432 | ffio_wfourcc(pb, "mdta"); |
| | 3433 | avio_wb32(pb, 0); /* Reseverved, uint32_t[3] */ |
| | 3434 | avio_wb32(pb, 0); |
| | 3435 | avio_wb32(pb, 0); |
| | 3436 | avio_w8(pb, 0); /* Empty name (NULL-terminated) */ |
| | 3437 | |
| | 3438 | avio_wb32(pb, 56); /* keys atom size: size (4) + 'keys' (4) + version/flasgs (4) + entry_count (4) + |
| | 3439 | keys (32+8) = 56 */ |
| | 3440 | ffio_wfourcc(pb, "keys"); |
| | 3441 | avio_wb32(pb, 0); /* version (1 Byte) and flags (3 Bytes), must be zero */ |
| | 3442 | avio_wb32(pb, 1); /* entry count */ |
| | 3443 | avio_wb32(pb, 32 + 8); /* key size: size (4) + 'mdta' (4) + strlen(key) */ |
| | 3444 | ffio_wfourcc(pb, "mdta"); |
| | 3445 | avio_write(pb, "com.apple.quicktime.pixeldensity", 32); |
| | 3446 | |
| | 3447 | avio_wb32(pb, 48); /* ilst atom size: size (4) + 'ilst' (4) + value atom size (40) = 48 */ |
| | 3448 | ffio_wfourcc(pb, "ilst"); |
| | 3449 | avio_wb32(pb, 40); /* value atom size: size (4) + key (4) + data atom (32) = 40 */ |
| | 3450 | avio_wb32(pb, 1); /* metadata key index */ |
| | 3451 | |
| | 3452 | avio_wb32(pb, 32); /* data atom size: size (4) + 'data' (4) + data_type (4) + locale (4) + value (4 * 4) = 32 */ |
| | 3453 | ffio_wfourcc(pb, "data"); |
| | 3454 | avio_wb32(pb, 0x1e); /* data type */ |
| | 3455 | avio_wb32(pb, 0); /* locale */ |
| | 3456 | |
| | 3457 | /* actual data (value): consisting of 4 uint32_t: pixel width, pixel height, display width, display height */ |
| | 3458 | avio_wb32(pb, track->par->width); |
| | 3459 | avio_wb32(pb, track->par->height); |
| | 3460 | avio_wb32(pb, track->par->width / 2); |
| | 3461 | avio_wb32(pb, track->par->height / 2); |
| | 3462 | |
| | 3463 | size = update_size(pb, pos); |
| | 3464 | return size; |
| | 3465 | } |
| | 3466 | |