| 76 | 76 | { "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" }, |
| 77 | 77 | { "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" }, |
| 78 | 78 | { "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" }, |
| 79 | 80 | { "write_colr", "Write colr atom (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" }, |
| 80 | 81 | { "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" }, |
| 81 | 82 | { "use_metadata_tags", "Use mdta atom for metadata.", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_USE_MDTA}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" }, |
| | 3122 | static int mov_write_pixeldensity_meta_tag(AVIOContext *pb, MOVMuxContext *mov, MOVTrack *track, AVFormatContext *s) |
| | 3123 | { |
| | 3124 | int size = 0; |
| | 3125 | int64_t pos = avio_tell(pb); |
| | 3126 | avio_wb32(pb, 0); /* meta atom size */ |
| | 3127 | ffio_wfourcc(pb, "meta"); |
| | 3128 | |
| | 3129 | /* Metadata atom information as described in |
| | 3130 | * https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/Metadata/Metadata.html#//apple_ref/doc/uid/TP40000939-CH1-SW9 |
| | 3131 | */ |
| | 3132 | avio_wb32(pb, 33); /* hdlr atom size: size (4) + 'hdlr' (4) + version/flags (4) + predefined (4) + 'mdta' (4) + |
| | 3133 | reserved (3*4) + name (1) = 33 */ |
| | 3134 | ffio_wfourcc(pb, "hdlr"); |
| | 3135 | avio_wb32(pb, 0); /* version (1 Byte) and flags (3 Bytes), must be zero */ |
| | 3136 | avio_wb32(pb, 0); /* "predefined", must be zero */ |
| | 3137 | ffio_wfourcc(pb, "mdta"); |
| | 3138 | avio_wb32(pb, 0); /* Reseverved, uint32_t[3] */ |
| | 3139 | avio_wb32(pb, 0); |
| | 3140 | avio_wb32(pb, 0); |
| | 3141 | avio_w8(pb, 0); /* Empty name (NULL-terminated) */ |
| | 3142 | |
| | 3143 | avio_wb32(pb, 56); /* keys atom size: size (4) + 'keys' (4) + version/flasgs (4) + entry_count (4) + |
| | 3144 | keys (32+8) = 56 */ |
| | 3145 | ffio_wfourcc(pb, "keys"); |
| | 3146 | avio_wb32(pb, 0); /* version (1 Byte) and flags (3 Bytes), must be zero */ |
| | 3147 | avio_wb32(pb, 1); /* entry count */ |
| | 3148 | avio_wb32(pb, 32 + 8); /* key size: size (4) + 'mdta' (4) + strlen(key) */ |
| | 3149 | ffio_wfourcc(pb, "mdta"); |
| | 3150 | avio_write(pb, "com.apple.quicktime.pixeldensity", 32); |
| | 3151 | |
| | 3152 | avio_wb32(pb, 48); /* ilst atom size: size (4) + 'ilst' (4) + value atom size (40) = 48 */ |
| | 3153 | ffio_wfourcc(pb, "ilst"); |
| | 3154 | avio_wb32(pb, 40); /* value atom size: size (4) + key (4) + data atom (32) = 40 */ |
| | 3155 | avio_wb32(pb, 1); /* metadata key index */ |
| | 3156 | |
| | 3157 | avio_wb32(pb, 32); /* data atom size: size (4) + 'data' (4) + data_type (4) + locale (4) + value (4 * 4) = 32 */ |
| | 3158 | ffio_wfourcc(pb, "data"); |
| | 3159 | avio_wb32(pb, 0x1e); /* data type */ |
| | 3160 | avio_wb32(pb, 0); /* locale */ |
| | 3161 | |
| | 3162 | /* actual data (value): consisting of 4 uint32_t: pixel width, pixel height, display width, display height */ |
| | 3163 | avio_wb32(pb, track->par->width); |
| | 3164 | avio_wb32(pb, track->par->height); |
| | 3165 | avio_wb32(pb, track->par->width / 2); |
| | 3166 | avio_wb32(pb, track->par->height / 2); |
| | 3167 | |
| | 3168 | size = update_size(pb, pos); |
| | 3169 | return size; |
| | 3170 | } |
| | 3171 | |