Revision 0abdb293
libavformat/aiffenc.c | ||
---|---|---|
21 | 21 |
|
22 | 22 |
#include "avformat.h" |
23 | 23 |
#include "aiff.h" |
24 |
#include "avio_internal.h" |
|
24 | 25 |
|
25 | 26 |
typedef struct { |
26 | 27 |
int64_t form; |
... | ... | |
43 | 44 |
aifc = 1; |
44 | 45 |
|
45 | 46 |
/* FORM AIFF header */ |
46 |
put_tag(pb, "FORM");
|
|
47 |
ffio_wfourcc(pb, "FORM");
|
|
47 | 48 |
aiff->form = url_ftell(pb); |
48 | 49 |
avio_wb32(pb, 0); /* file length */ |
49 |
put_tag(pb, aifc ? "AIFC" : "AIFF");
|
|
50 |
ffio_wfourcc(pb, aifc ? "AIFC" : "AIFF");
|
|
50 | 51 |
|
51 | 52 |
if (aifc) { // compressed audio |
52 | 53 |
enc->bits_per_coded_sample = 16; |
... | ... | |
55 | 56 |
return -1; |
56 | 57 |
} |
57 | 58 |
/* Version chunk */ |
58 |
put_tag(pb, "FVER");
|
|
59 |
ffio_wfourcc(pb, "FVER");
|
|
59 | 60 |
avio_wb32(pb, 4); |
60 | 61 |
avio_wb32(pb, 0xA2805140); |
61 | 62 |
} |
62 | 63 |
|
63 | 64 |
/* Common chunk */ |
64 |
put_tag(pb, "COMM");
|
|
65 |
ffio_wfourcc(pb, "COMM");
|
|
65 | 66 |
avio_wb32(pb, aifc ? 24 : 18); /* size */ |
66 | 67 |
avio_wb16(pb, enc->channels); /* Number of channels */ |
67 | 68 |
|
... | ... | |
88 | 89 |
} |
89 | 90 |
|
90 | 91 |
/* Sound data chunk */ |
91 |
put_tag(pb, "SSND");
|
|
92 |
ffio_wfourcc(pb, "SSND");
|
|
92 | 93 |
aiff->ssnd = url_ftell(pb); /* Sound chunk size */ |
93 | 94 |
avio_wb32(pb, 0); /* Sound samples data size */ |
94 | 95 |
avio_wb32(pb, 0); /* Data offset */ |
libavformat/au.c | ||
---|---|---|
28 | 28 |
*/ |
29 | 29 |
|
30 | 30 |
#include "avformat.h" |
31 |
#include "avio_internal.h" |
|
31 | 32 |
#include "pcm.h" |
32 | 33 |
#include "riff.h" |
33 | 34 |
|
... | ... | |
53 | 54 |
{ |
54 | 55 |
if(!enc->codec_tag) |
55 | 56 |
return -1; |
56 |
put_tag(pb, ".snd"); /* magic number */
|
|
57 |
ffio_wfourcc(pb, ".snd"); /* magic number */
|
|
57 | 58 |
avio_wb32(pb, 24); /* header size */ |
58 | 59 |
avio_wb32(pb, AU_UNKNOWN_SIZE); /* data size */ |
59 | 60 |
avio_wb32(pb, (uint32_t)enc->codec_tag); /* codec ID */ |
libavformat/avienc.c | ||
---|---|---|
20 | 20 |
*/ |
21 | 21 |
#include "avformat.h" |
22 | 22 |
#include "avi.h" |
23 |
#include "avio_internal.h" |
|
23 | 24 |
#include "riff.h" |
24 | 25 |
#include "libavutil/intreadwrite.h" |
25 | 26 |
|
... | ... | |
77 | 78 |
} |
78 | 79 |
|
79 | 80 |
avi->riff_start = ff_start_tag(pb, "RIFF"); |
80 |
put_tag(pb, riff_tag);
|
|
81 |
ffio_wfourcc(pb, riff_tag);
|
|
81 | 82 |
loff = ff_start_tag(pb, "LIST"); |
82 |
put_tag(pb, list_tag);
|
|
83 |
ffio_wfourcc(pb, list_tag);
|
|
83 | 84 |
return loff; |
84 | 85 |
} |
85 | 86 |
|
... | ... | |
107 | 108 |
int len = strlen(str); |
108 | 109 |
if (len > 0) { |
109 | 110 |
len++; |
110 |
put_tag(pb, tag);
|
|
111 |
ffio_wfourcc(pb, tag);
|
|
111 | 112 |
avio_wl32(pb, len); |
112 | 113 |
avio_put_str(pb, str); |
113 | 114 |
if (len & 1) |
... | ... | |
175 | 176 |
list1 = avi_start_new_riff(s, pb, "AVI ", "hdrl"); |
176 | 177 |
|
177 | 178 |
/* avi header */ |
178 |
put_tag(pb, "avih");
|
|
179 |
ffio_wfourcc(pb, "avih");
|
|
179 | 180 |
avio_wl32(pb, 14 * 4); |
180 | 181 |
bitrate = 0; |
181 | 182 |
|
... | ... | |
221 | 222 |
for(i=0;i<n;i++) { |
222 | 223 |
AVIStream *avist= s->streams[i]->priv_data; |
223 | 224 |
list2 = ff_start_tag(pb, "LIST"); |
224 |
put_tag(pb, "strl");
|
|
225 |
ffio_wfourcc(pb, "strl");
|
|
225 | 226 |
|
226 | 227 |
stream = s->streams[i]->codec; |
227 | 228 |
|
... | ... | |
235 | 236 |
av_log(s, AV_LOG_ERROR, "Subtitle streams other than DivX XSUB are not supported by the AVI muxer.\n"); |
236 | 237 |
return AVERROR_PATCHWELCOME; |
237 | 238 |
} |
238 |
case AVMEDIA_TYPE_VIDEO: put_tag(pb, "vids"); break;
|
|
239 |
case AVMEDIA_TYPE_AUDIO: put_tag(pb, "auds"); break;
|
|
240 |
// case AVMEDIA_TYPE_TEXT : put_tag(pb, "txts"); break;
|
|
241 |
case AVMEDIA_TYPE_DATA : put_tag(pb, "dats"); break;
|
|
239 |
case AVMEDIA_TYPE_VIDEO: ffio_wfourcc(pb, "vids"); break;
|
|
240 |
case AVMEDIA_TYPE_AUDIO: ffio_wfourcc(pb, "auds"); break;
|
|
241 |
// case AVMEDIA_TYPE_TEXT : ffio_wfourcc(pb, "txts"); break;
|
|
242 |
case AVMEDIA_TYPE_DATA : ffio_wfourcc(pb, "dats"); break;
|
|
242 | 243 |
} |
243 | 244 |
if(stream->codec_type == AVMEDIA_TYPE_VIDEO || |
244 | 245 |
stream->codec_id == CODEC_ID_XSUB) |
... | ... | |
317 | 318 |
avio_w8(pb, 0); /* bIndexSubType (0 == frame index) */ |
318 | 319 |
avio_w8(pb, 0); /* bIndexType (0 == AVI_INDEX_OF_INDEXES) */ |
319 | 320 |
avio_wl32(pb, 0); /* nEntriesInUse (will fill out later on) */ |
320 |
put_tag(pb, avi_stream2fourcc(&tag[0], i, stream->codec_type));
|
|
321 |
ffio_wfourcc(pb, avi_stream2fourcc(&tag[0], i, stream->codec_type));
|
|
321 | 322 |
/* dwChunkId */ |
322 | 323 |
avio_wl64(pb, 0); /* dwReserved[3] |
323 | 324 |
avio_wl32(pb, 0); Must be 0. */ |
... | ... | |
364 | 365 |
if (!url_is_streamed(pb)) { |
365 | 366 |
/* AVI could become an OpenDML one, if it grows beyond 2Gb range */ |
366 | 367 |
avi->odml_list = ff_start_tag(pb, "JUNK"); |
367 |
put_tag(pb, "odml");
|
|
368 |
put_tag(pb, "dmlh");
|
|
368 |
ffio_wfourcc(pb, "odml");
|
|
369 |
ffio_wfourcc(pb, "dmlh");
|
|
369 | 370 |
avio_wl32(pb, 248); |
370 | 371 |
for (i = 0; i < 248; i+= 4) |
371 | 372 |
avio_wl32(pb, 0); |
... | ... | |
375 | 376 |
ff_end_tag(pb, list1); |
376 | 377 |
|
377 | 378 |
list2 = ff_start_tag(pb, "LIST"); |
378 |
put_tag(pb, "INFO");
|
|
379 |
ffio_wfourcc(pb, "INFO");
|
|
379 | 380 |
ff_metadata_conv(&s->metadata, ff_avi_metadata_conv, NULL); |
380 | 381 |
for (i = 0; *ff_avi_tags[i]; i++) { |
381 | 382 |
if ((t = av_metadata_get(s->metadata, ff_avi_tags[i], NULL, AV_METADATA_MATCH_CASE))) |
... | ... | |
390 | 391 |
ff_end_tag(pb, list2); |
391 | 392 |
|
392 | 393 |
avi->movi_list = ff_start_tag(pb, "LIST"); |
393 |
put_tag(pb, "movi");
|
|
394 |
ffio_wfourcc(pb, "movi");
|
|
394 | 395 |
|
395 | 396 |
put_flush_packet(pb); |
396 | 397 |
|
... | ... | |
419 | 420 |
|
420 | 421 |
/* Writing AVI OpenDML leaf index chunk */ |
421 | 422 |
ix = url_ftell(pb); |
422 |
put_tag(pb, &ix_tag[0]); /* ix?? */
|
|
423 |
ffio_wfourcc(pb, &ix_tag[0]); /* ix?? */
|
|
423 | 424 |
avio_wl32(pb, avist->indexes.entry * 8 + 24); |
424 | 425 |
/* chunk size */ |
425 | 426 |
avio_wl16(pb, 2); /* wLongsPerEntry */ |
... | ... | |
427 | 428 |
avio_w8(pb, 1); /* bIndexType (1 == AVI_INDEX_OF_CHUNKS) */ |
428 | 429 |
avio_wl32(pb, avist->indexes.entry); |
429 | 430 |
/* nEntriesInUse */ |
430 |
put_tag(pb, &tag[0]); /* dwChunkId */
|
|
431 |
ffio_wfourcc(pb, &tag[0]); /* dwChunkId */
|
|
431 | 432 |
avio_wl64(pb, avi->movi_list);/* qwBaseOffset */ |
432 | 433 |
avio_wl32(pb, 0); /* dwReserved_3 (must be 0) */ |
433 | 434 |
|
... | ... | |
442 | 443 |
|
443 | 444 |
/* Updating one entry in the AVI OpenDML master index */ |
444 | 445 |
url_fseek(pb, avist->indexes.indx_start - 8, SEEK_SET); |
445 |
put_tag(pb, "indx"); /* enabling this entry */
|
|
446 |
ffio_wfourcc(pb, "indx"); /* enabling this entry */
|
|
446 | 447 |
url_fskip(pb, 8); |
447 | 448 |
avio_wl32(pb, avi->riff_id); /* nEntriesInUse */ |
448 | 449 |
url_fskip(pb, 16*avi->riff_id); |
... | ... | |
492 | 493 |
avist= s->streams[stream_id]->priv_data; |
493 | 494 |
avi_stream2fourcc(&tag[0], stream_id, |
494 | 495 |
s->streams[stream_id]->codec->codec_type); |
495 |
put_tag(pb, &tag[0]);
|
|
496 |
ffio_wfourcc(pb, &tag[0]);
|
|
496 | 497 |
avio_wl32(pb, ie->flags); |
497 | 498 |
avio_wl32(pb, ie->pos); |
498 | 499 |
avio_wl32(pb, ie->len); |
... | ... | |
601 | 602 |
|
602 | 603 |
file_size = url_ftell(pb); |
603 | 604 |
url_fseek(pb, avi->odml_list - 8, SEEK_SET); |
604 |
put_tag(pb, "LIST"); /* Making this AVI OpenDML one */
|
|
605 |
ffio_wfourcc(pb, "LIST"); /* Making this AVI OpenDML one */
|
|
605 | 606 |
url_fskip(pb, 16); |
606 | 607 |
|
607 | 608 |
for (n=nb_frames=0;n<s->nb_streams;n++) { |
libavformat/avio_internal.h | ||
---|---|---|
42 | 42 |
|
43 | 43 |
void ffio_fill(AVIOContext *s, int b, int count); |
44 | 44 |
|
45 |
#define ffio_wfourcc(pb, str) avio_wl32(pb, MKTAG((str)[0], (str)[1], (str)[2], (str)[3])) |
|
46 |
|
|
45 | 47 |
#endif // AVFORMAT_AVIO_INTERNAL_H |
libavformat/img2.c | ||
---|---|---|
23 | 23 |
#include "libavutil/intreadwrite.h" |
24 | 24 |
#include "libavutil/avstring.h" |
25 | 25 |
#include "avformat.h" |
26 |
#include "avio_internal.h" |
|
26 | 27 |
#include <strings.h> |
27 | 28 |
|
28 | 29 |
typedef struct { |
... | ... | |
383 | 384 |
if(pkt->size < 8 || AV_RL32(pkt->data+4) != MKTAG('j','p','2','c')) |
384 | 385 |
goto error; |
385 | 386 |
avio_wb32(pb[0], 12); |
386 |
put_tag (pb[0], "jP ");
|
|
387 |
ffio_wfourcc(pb[0], "jP ");
|
|
387 | 388 |
avio_wb32(pb[0], 0x0D0A870A); // signature |
388 | 389 |
avio_wb32(pb[0], 20); |
389 |
put_tag (pb[0], "ftyp");
|
|
390 |
put_tag (pb[0], "jp2 ");
|
|
390 |
ffio_wfourcc(pb[0], "ftyp");
|
|
391 |
ffio_wfourcc(pb[0], "jp2 ");
|
|
391 | 392 |
avio_wb32(pb[0], 0); |
392 |
put_tag (pb[0], "jp2 ");
|
|
393 |
ffio_wfourcc(pb[0], "jp2 ");
|
|
393 | 394 |
avio_write(pb[0], st->codec->extradata, st->codec->extradata_size); |
394 | 395 |
}else if(pkt->size < 8 || |
395 | 396 |
(!st->codec->extradata_size && |
libavformat/mmf.c | ||
---|---|---|
19 | 19 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
20 | 20 |
*/ |
21 | 21 |
#include "avformat.h" |
22 |
#include "avio_internal.h" |
|
22 | 23 |
#include "pcm.h" |
23 | 24 |
#include "riff.h" |
24 | 25 |
|
... | ... | |
70 | 71 |
return -1; |
71 | 72 |
} |
72 | 73 |
|
73 |
put_tag(pb, "MMMD");
|
|
74 |
ffio_wfourcc(pb, "MMMD");
|
|
74 | 75 |
avio_wb32(pb, 0); |
75 | 76 |
pos = ff_start_tag(pb, "CNTI"); |
76 | 77 |
avio_w8(pb, 0); /* class */ |
... | ... | |
91 | 92 |
avio_w8(pb, 2); /* time base d */ |
92 | 93 |
avio_w8(pb, 2); /* time base g */ |
93 | 94 |
|
94 |
put_tag(pb, "Atsq");
|
|
95 |
ffio_wfourcc(pb, "Atsq");
|
|
95 | 96 |
avio_wb32(pb, 16); |
96 | 97 |
mmf->atsqpos = url_ftell(pb); |
97 | 98 |
/* Will be filled on close */ |
libavformat/movenc.c | ||
---|---|---|
23 | 23 |
|
24 | 24 |
#include "movenc.h" |
25 | 25 |
#include "avformat.h" |
26 |
#include "avio_internal.h" |
|
26 | 27 |
#include "riff.h" |
27 | 28 |
#include "avio.h" |
28 | 29 |
#include "isom.h" |
... | ... | |
55 | 56 |
avio_wb32(pb, 0); /* size */ |
56 | 57 |
if (pos > UINT32_MAX) { |
57 | 58 |
mode64 = 1; |
58 |
put_tag(pb, "co64");
|
|
59 |
ffio_wfourcc(pb, "co64");
|
|
59 | 60 |
} else |
60 |
put_tag(pb, "stco");
|
|
61 |
ffio_wfourcc(pb, "stco");
|
|
61 | 62 |
avio_wb32(pb, 0); /* version & flags */ |
62 | 63 |
avio_wb32(pb, track->entry); /* entry count */ |
63 | 64 |
for (i=0; i<track->entry; i++) { |
... | ... | |
77 | 78 |
|
78 | 79 |
int64_t pos = url_ftell(pb); |
79 | 80 |
avio_wb32(pb, 0); /* size */ |
80 |
put_tag(pb, "stsz");
|
|
81 |
ffio_wfourcc(pb, "stsz");
|
|
81 | 82 |
avio_wb32(pb, 0); /* version & flags */ |
82 | 83 |
|
83 | 84 |
for (i=0; i<track->entry; i++) { |
... | ... | |
114 | 115 |
|
115 | 116 |
int64_t pos = url_ftell(pb); |
116 | 117 |
avio_wb32(pb, 0); /* size */ |
117 |
put_tag(pb, "stsc");
|
|
118 |
ffio_wfourcc(pb, "stsc");
|
|
118 | 119 |
avio_wb32(pb, 0); // version & flags |
119 | 120 |
entryPos = url_ftell(pb); |
120 | 121 |
avio_wb32(pb, track->entry); // entry count |
... | ... | |
143 | 144 |
int i, index = 0; |
144 | 145 |
int64_t pos = url_ftell(pb); |
145 | 146 |
avio_wb32(pb, 0); // size |
146 |
put_tag(pb, flag == MOV_SYNC_SAMPLE ? "stss" : "stps");
|
|
147 |
ffio_wfourcc(pb, flag == MOV_SYNC_SAMPLE ? "stss" : "stps");
|
|
147 | 148 |
avio_wb32(pb, 0); // version & flags |
148 | 149 |
entryPos = url_ftell(pb); |
149 | 150 |
avio_wb32(pb, track->entry); // entry count |
... | ... | |
163 | 164 |
static int mov_write_amr_tag(AVIOContext *pb, MOVTrack *track) |
164 | 165 |
{ |
165 | 166 |
avio_wb32(pb, 0x11); /* size */ |
166 |
if (track->mode == MODE_MOV) put_tag(pb, "samr");
|
|
167 |
else put_tag(pb, "damr");
|
|
168 |
put_tag(pb, "FFMP");
|
|
167 |
if (track->mode == MODE_MOV) ffio_wfourcc(pb, "samr");
|
|
168 |
else ffio_wfourcc(pb, "damr");
|
|
169 |
ffio_wfourcc(pb, "FFMP");
|
|
169 | 170 |
avio_w8(pb, 0); /* decoder version */ |
170 | 171 |
|
171 | 172 |
avio_wb16(pb, 0x81FF); /* Mode set (all modes for AMR_NB) */ |
... | ... | |
185 | 186 |
return -1; |
186 | 187 |
|
187 | 188 |
avio_wb32(pb, 11); |
188 |
put_tag(pb, "dac3");
|
|
189 |
ffio_wfourcc(pb, "dac3");
|
|
189 | 190 |
|
190 | 191 |
init_get_bits(&gbc, track->vosData+4, track->vosLen-4); |
191 | 192 |
fscod = get_bits(&gbc, 2); |
... | ... | |
231 | 232 |
static int mov_write_enda_tag(AVIOContext *pb) |
232 | 233 |
{ |
233 | 234 |
avio_wb32(pb, 10); |
234 |
put_tag(pb, "enda");
|
|
235 |
ffio_wfourcc(pb, "enda");
|
|
235 | 236 |
avio_wb16(pb, 1); /* little endian */ |
236 | 237 |
return 10; |
237 | 238 |
} |
... | ... | |
258 | 259 |
int decoderSpecificInfoLen = track->vosLen ? descrLength(track->vosLen):0; |
259 | 260 |
|
260 | 261 |
avio_wb32(pb, 0); // size |
261 |
put_tag(pb, "esds");
|
|
262 |
ffio_wfourcc(pb, "esds");
|
|
262 | 263 |
avio_wb32(pb, 0); // Version |
263 | 264 |
|
264 | 265 |
// ES descriptor |
... | ... | |
329 | 330 |
int64_t pos = url_ftell(pb); |
330 | 331 |
|
331 | 332 |
avio_wb32(pb, 0); /* size */ |
332 |
put_tag(pb, "wave");
|
|
333 |
ffio_wfourcc(pb, "wave");
|
|
333 | 334 |
|
334 | 335 |
avio_wb32(pb, 12); /* size */ |
335 |
put_tag(pb, "frma");
|
|
336 |
ffio_wfourcc(pb, "frma");
|
|
336 | 337 |
avio_wl32(pb, track->tag); |
337 | 338 |
|
338 | 339 |
if (track->enc->codec_id == CODEC_ID_AAC) { |
339 | 340 |
/* useless atom needed by mplayer, ipod, not needed by quicktime */ |
340 | 341 |
avio_wb32(pb, 12); /* size */ |
341 |
put_tag(pb, "mp4a");
|
|
342 |
ffio_wfourcc(pb, "mp4a");
|
|
342 | 343 |
avio_wb32(pb, 0); |
343 | 344 |
mov_write_esds_tag(pb, track); |
344 | 345 |
} else if (mov_pcm_le_gt16(track->enc->codec_id)) { |
... | ... | |
363 | 364 |
static int mov_write_glbl_tag(AVIOContext *pb, MOVTrack *track) |
364 | 365 |
{ |
365 | 366 |
avio_wb32(pb, track->vosLen+8); |
366 |
put_tag(pb, "glbl");
|
|
367 |
ffio_wfourcc(pb, "glbl");
|
|
367 | 368 |
avio_write(pb, track->vosData, track->vosLen); |
368 | 369 |
return 8+track->vosLen; |
369 | 370 |
} |
... | ... | |
493 | 494 |
static int mov_write_d263_tag(AVIOContext *pb) |
494 | 495 |
{ |
495 | 496 |
avio_wb32(pb, 0xf); /* size */ |
496 |
put_tag(pb, "d263");
|
|
497 |
put_tag(pb, "FFMP");
|
|
497 |
ffio_wfourcc(pb, "d263");
|
|
498 |
ffio_wfourcc(pb, "FFMP");
|
|
498 | 499 |
avio_w8(pb, 0); /* decoder version */ |
499 | 500 |
/* FIXME use AVCodecContext level/profile, when encoder will set values */ |
500 | 501 |
avio_w8(pb, 0xa); /* level */ |
... | ... | |
506 | 507 |
static int mov_write_svq3_tag(AVIOContext *pb) |
507 | 508 |
{ |
508 | 509 |
avio_wb32(pb, 0x15); |
509 |
put_tag(pb, "SMI ");
|
|
510 |
put_tag(pb, "SEQH");
|
|
510 |
ffio_wfourcc(pb, "SMI ");
|
|
511 |
ffio_wfourcc(pb, "SEQH");
|
|
511 | 512 |
avio_wb32(pb, 0x5); |
512 | 513 |
avio_wb32(pb, 0xe2c0211d); |
513 | 514 |
avio_wb32(pb, 0xc0000000); |
... | ... | |
520 | 521 |
int64_t pos = url_ftell(pb); |
521 | 522 |
|
522 | 523 |
avio_wb32(pb, 0); |
523 |
put_tag(pb, "avcC");
|
|
524 |
ffio_wfourcc(pb, "avcC");
|
|
524 | 525 |
ff_isom_write_avcc(pb, track->vosData, track->vosLen); |
525 | 526 |
return updateSize(pb, pos); |
526 | 527 |
} |
... | ... | |
530 | 531 |
{ |
531 | 532 |
int i; |
532 | 533 |
avio_wb32(pb, 24); /* size */ |
533 |
put_tag(pb, "ACLR");
|
|
534 |
put_tag(pb, "ACLR");
|
|
535 |
put_tag(pb, "0001");
|
|
534 |
ffio_wfourcc(pb, "ACLR");
|
|
535 |
ffio_wfourcc(pb, "ACLR");
|
|
536 |
ffio_wfourcc(pb, "0001");
|
|
536 | 537 |
avio_wb32(pb, 1); /* yuv 1 / rgb 2 ? */ |
537 | 538 |
avio_wb32(pb, 0); /* unknown */ |
538 | 539 |
|
539 | 540 |
avio_wb32(pb, 24); /* size */ |
540 |
put_tag(pb, "APRG");
|
|
541 |
put_tag(pb, "APRG");
|
|
542 |
put_tag(pb, "0001");
|
|
541 |
ffio_wfourcc(pb, "APRG");
|
|
542 |
ffio_wfourcc(pb, "APRG");
|
|
543 |
ffio_wfourcc(pb, "0001");
|
|
543 | 544 |
avio_wb32(pb, 1); /* unknown */ |
544 | 545 |
avio_wb32(pb, 0); /* unknown */ |
545 | 546 |
|
546 | 547 |
avio_wb32(pb, 120); /* size */ |
547 |
put_tag(pb, "ARES");
|
|
548 |
put_tag(pb, "ARES");
|
|
549 |
put_tag(pb, "0001");
|
|
548 |
ffio_wfourcc(pb, "ARES");
|
|
549 |
ffio_wfourcc(pb, "ARES");
|
|
550 |
ffio_wfourcc(pb, "0001");
|
|
550 | 551 |
avio_wb32(pb, AV_RB32(track->vosData + 0x28)); /* dnxhd cid, some id ? */ |
551 | 552 |
avio_wb32(pb, track->enc->width); |
552 | 553 |
/* values below are based on samples created with quicktime and avid codecs */ |
... | ... | |
741 | 742 |
static int mov_write_uuid_tag_ipod(AVIOContext *pb) |
742 | 743 |
{ |
743 | 744 |
avio_wb32(pb, 28); |
744 |
put_tag(pb, "uuid");
|
|
745 |
ffio_wfourcc(pb, "uuid");
|
|
745 | 746 |
avio_wb32(pb, 0x6b6840f2); |
746 | 747 |
avio_wb32(pb, 0x5f244fc5); |
747 | 748 |
avio_wb32(pb, 0xba39a51b); |
... | ... | |
772 | 773 |
track->enc->sample_aspect_ratio.den, INT_MAX); |
773 | 774 |
|
774 | 775 |
avio_wb32(pb, 16); |
775 |
put_tag(pb, "pasp");
|
|
776 |
ffio_wfourcc(pb, "pasp");
|
|
776 | 777 |
avio_wb32(pb, sar.num); |
777 | 778 |
avio_wb32(pb, sar.den); |
778 | 779 |
return 16; |
... | ... | |
792 | 793 |
avio_wb16(pb, 0); /* Codec stream version */ |
793 | 794 |
avio_wb16(pb, 0); /* Codec stream revision (=0) */ |
794 | 795 |
if (track->mode == MODE_MOV) { |
795 |
put_tag(pb, "FFMP"); /* Vendor */
|
|
796 |
ffio_wfourcc(pb, "FFMP"); /* Vendor */
|
|
796 | 797 |
if(track->enc->codec_id == CODEC_ID_RAWVIDEO) { |
797 | 798 |
avio_wb32(pb, 0); /* Temporal Quality */ |
798 | 799 |
avio_wb32(pb, 0x400); /* Spatial Quality = lossless*/ |
... | ... | |
852 | 853 |
{ |
853 | 854 |
int64_t pos = url_ftell(pb); |
854 | 855 |
avio_wb32(pb, 0); /* size */ |
855 |
put_tag(pb, "rtp ");
|
|
856 |
ffio_wfourcc(pb, "rtp ");
|
|
856 | 857 |
avio_wb32(pb, 0); /* Reserved */ |
857 | 858 |
avio_wb16(pb, 0); /* Reserved */ |
858 | 859 |
avio_wb16(pb, 1); /* Data-reference index */ |
... | ... | |
862 | 863 |
avio_wb32(pb, track->max_packet_size); /* Max packet size */ |
863 | 864 |
|
864 | 865 |
avio_wb32(pb, 12); /* size */ |
865 |
put_tag(pb, "tims");
|
|
866 |
ffio_wfourcc(pb, "tims");
|
|
866 | 867 |
avio_wb32(pb, track->timescale); |
867 | 868 |
|
868 | 869 |
return updateSize(pb, pos); |
... | ... | |
872 | 873 |
{ |
873 | 874 |
int64_t pos = url_ftell(pb); |
874 | 875 |
avio_wb32(pb, 0); /* size */ |
875 |
put_tag(pb, "stsd");
|
|
876 |
ffio_wfourcc(pb, "stsd");
|
|
876 | 877 |
avio_wb32(pb, 0); /* version & flags */ |
877 | 878 |
avio_wb32(pb, 1); /* entry count */ |
878 | 879 |
if (track->enc->codec_type == AVMEDIA_TYPE_VIDEO) |
... | ... | |
908 | 909 |
entries++; /* last one */ |
909 | 910 |
atom_size = 16 + (entries * 8); |
910 | 911 |
avio_wb32(pb, atom_size); /* size */ |
911 |
put_tag(pb, "ctts");
|
|
912 |
ffio_wfourcc(pb, "ctts");
|
|
912 | 913 |
avio_wb32(pb, 0); /* version & flags */ |
913 | 914 |
avio_wb32(pb, entries); /* entry count */ |
914 | 915 |
for (i=0; i<entries; i++) { |
... | ... | |
950 | 951 |
} |
951 | 952 |
atom_size = 16 + (entries * 8); |
952 | 953 |
avio_wb32(pb, atom_size); /* size */ |
953 |
put_tag(pb, "stts");
|
|
954 |
ffio_wfourcc(pb, "stts");
|
|
954 | 955 |
avio_wb32(pb, 0); /* version & flags */ |
955 | 956 |
avio_wb32(pb, entries); /* entry count */ |
956 | 957 |
for (i=0; i<entries; i++) { |
... | ... | |
964 | 965 |
static int mov_write_dref_tag(AVIOContext *pb) |
965 | 966 |
{ |
966 | 967 |
avio_wb32(pb, 28); /* size */ |
967 |
put_tag(pb, "dref");
|
|
968 |
ffio_wfourcc(pb, "dref");
|
|
968 | 969 |
avio_wb32(pb, 0); /* version & flags */ |
969 | 970 |
avio_wb32(pb, 1); /* entry count */ |
970 | 971 |
|
971 | 972 |
avio_wb32(pb, 0xc); /* size */ |
972 |
put_tag(pb, "url ");
|
|
973 |
ffio_wfourcc(pb, "url ");
|
|
973 | 974 |
avio_wb32(pb, 1); /* version & flags */ |
974 | 975 |
|
975 | 976 |
return 28; |
... | ... | |
979 | 980 |
{ |
980 | 981 |
int64_t pos = url_ftell(pb); |
981 | 982 |
avio_wb32(pb, 0); /* size */ |
982 |
put_tag(pb, "stbl");
|
|
983 |
ffio_wfourcc(pb, "stbl");
|
|
983 | 984 |
mov_write_stsd_tag(pb, track); |
984 | 985 |
mov_write_stts_tag(pb, track); |
985 | 986 |
if ((track->enc->codec_type == AVMEDIA_TYPE_VIDEO || |
... | ... | |
1001 | 1002 |
{ |
1002 | 1003 |
int64_t pos = url_ftell(pb); |
1003 | 1004 |
avio_wb32(pb, 0); /* size */ |
1004 |
put_tag(pb, "dinf");
|
|
1005 |
ffio_wfourcc(pb, "dinf");
|
|
1005 | 1006 |
mov_write_dref_tag(pb); |
1006 | 1007 |
return updateSize(pb, pos); |
1007 | 1008 |
} |
... | ... | |
1009 | 1010 |
static int mov_write_nmhd_tag(AVIOContext *pb) |
1010 | 1011 |
{ |
1011 | 1012 |
avio_wb32(pb, 12); |
1012 |
put_tag(pb, "nmhd");
|
|
1013 |
ffio_wfourcc(pb, "nmhd");
|
|
1013 | 1014 |
avio_wb32(pb, 0); |
1014 | 1015 |
return 12; |
1015 | 1016 |
} |
... | ... | |
1017 | 1018 |
static int mov_write_gmhd_tag(AVIOContext *pb) |
1018 | 1019 |
{ |
1019 | 1020 |
avio_wb32(pb, 0x20); /* size */ |
1020 |
put_tag(pb, "gmhd");
|
|
1021 |
ffio_wfourcc(pb, "gmhd");
|
|
1021 | 1022 |
avio_wb32(pb, 0x18); /* gmin size */ |
1022 |
put_tag(pb, "gmin"); /* generic media info */
|
|
1023 |
ffio_wfourcc(pb, "gmin");/* generic media info */
|
|
1023 | 1024 |
avio_wb32(pb, 0); /* version & flags */ |
1024 | 1025 |
avio_wb16(pb, 0x40); /* graphics mode = */ |
1025 | 1026 |
avio_wb16(pb, 0x8000); /* opColor (r?) */ |
... | ... | |
1033 | 1034 |
static int mov_write_smhd_tag(AVIOContext *pb) |
1034 | 1035 |
{ |
1035 | 1036 |
avio_wb32(pb, 16); /* size */ |
1036 |
put_tag(pb, "smhd");
|
|
1037 |
ffio_wfourcc(pb, "smhd");
|
|
1037 | 1038 |
avio_wb32(pb, 0); /* version & flags */ |
1038 | 1039 |
avio_wb16(pb, 0); /* reserved (balance, normally = 0) */ |
1039 | 1040 |
avio_wb16(pb, 0); /* reserved */ |
... | ... | |
1043 | 1044 |
static int mov_write_vmhd_tag(AVIOContext *pb) |
1044 | 1045 |
{ |
1045 | 1046 |
avio_wb32(pb, 0x14); /* size (always 0x14) */ |
1046 |
put_tag(pb, "vmhd");
|
|
1047 |
ffio_wfourcc(pb, "vmhd");
|
|
1047 | 1048 |
avio_wb32(pb, 0x01); /* version & flags */ |
1048 | 1049 |
avio_wb64(pb, 0); /* reserved (graphics mode = copy) */ |
1049 | 1050 |
return 0x14; |
... | ... | |
1077 | 1078 |
} |
1078 | 1079 |
|
1079 | 1080 |
avio_wb32(pb, 0); /* size */ |
1080 |
put_tag(pb, "hdlr");
|
|
1081 |
ffio_wfourcc(pb, "hdlr");
|
|
1081 | 1082 |
avio_wb32(pb, 0); /* Version & flags */ |
1082 | 1083 |
avio_write(pb, hdlr, 4); /* handler */ |
1083 |
put_tag(pb, hdlr_type); /* handler type */
|
|
1084 |
ffio_wfourcc(pb, hdlr_type); /* handler type */
|
|
1084 | 1085 |
avio_wb32(pb ,0); /* reserved */ |
1085 | 1086 |
avio_wb32(pb ,0); /* reserved */ |
1086 | 1087 |
avio_wb32(pb ,0); /* reserved */ |
... | ... | |
1097 | 1098 |
/* This atom must be present, but leaving the values at zero |
1098 | 1099 |
* seems harmless. */ |
1099 | 1100 |
avio_wb32(pb, 28); /* size */ |
1100 |
put_tag(pb, "hmhd");
|
|
1101 |
ffio_wfourcc(pb, "hmhd");
|
|
1101 | 1102 |
avio_wb32(pb, 0); /* version, flags */ |
1102 | 1103 |
avio_wb16(pb, 0); /* maxPDUsize */ |
1103 | 1104 |
avio_wb16(pb, 0); /* avgPDUsize */ |
... | ... | |
1111 | 1112 |
{ |
1112 | 1113 |
int64_t pos = url_ftell(pb); |
1113 | 1114 |
avio_wb32(pb, 0); /* size */ |
1114 |
put_tag(pb, "minf");
|
|
1115 |
ffio_wfourcc(pb, "minf");
|
|
1115 | 1116 |
if(track->enc->codec_type == AVMEDIA_TYPE_VIDEO) |
1116 | 1117 |
mov_write_vmhd_tag(pb); |
1117 | 1118 |
else if (track->enc->codec_type == AVMEDIA_TYPE_AUDIO) |
... | ... | |
1134 | 1135 |
int version = track->trackDuration < INT32_MAX ? 0 : 1; |
1135 | 1136 |
|
1136 | 1137 |
(version == 1) ? avio_wb32(pb, 44) : avio_wb32(pb, 32); /* size */ |
1137 |
put_tag(pb, "mdhd");
|
|
1138 |
ffio_wfourcc(pb, "mdhd");
|
|
1138 | 1139 |
avio_w8(pb, version); |
1139 | 1140 |
avio_wb24(pb, 0); /* flags */ |
1140 | 1141 |
if (version == 1) { |
... | ... | |
1163 | 1164 |
{ |
1164 | 1165 |
int64_t pos = url_ftell(pb); |
1165 | 1166 |
avio_wb32(pb, 0); /* size */ |
1166 |
put_tag(pb, "mdia");
|
|
1167 |
ffio_wfourcc(pb, "mdia");
|
|
1167 | 1168 |
mov_write_mdhd_tag(pb, track); |
1168 | 1169 |
mov_write_hdlr_tag(pb, track); |
1169 | 1170 |
mov_write_minf_tag(pb, track); |
... | ... | |
1177 | 1178 |
int version = duration < INT32_MAX ? 0 : 1; |
1178 | 1179 |
|
1179 | 1180 |
(version == 1) ? avio_wb32(pb, 104) : avio_wb32(pb, 92); /* size */ |
1180 |
put_tag(pb, "tkhd");
|
|
1181 |
ffio_wfourcc(pb, "tkhd");
|
|
1181 | 1182 |
avio_w8(pb, version); |
1182 | 1183 |
avio_wb24(pb, 0xf); /* flags (track enabled) */ |
1183 | 1184 |
if (version == 1) { |
... | ... | |
1232 | 1233 |
static int mov_write_edts_tag(AVIOContext *pb, MOVTrack *track) |
1233 | 1234 |
{ |
1234 | 1235 |
avio_wb32(pb, 0x24); /* size */ |
1235 |
put_tag(pb, "edts");
|
|
1236 |
ffio_wfourcc(pb, "edts");
|
|
1236 | 1237 |
avio_wb32(pb, 0x1c); /* size */ |
1237 |
put_tag(pb, "elst");
|
|
1238 |
ffio_wfourcc(pb, "elst");
|
|
1238 | 1239 |
avio_wb32(pb, 0x0); |
1239 | 1240 |
avio_wb32(pb, 0x1); |
1240 | 1241 |
|
... | ... | |
1250 | 1251 |
static int mov_write_tref_tag(AVIOContext *pb, MOVTrack *track) |
1251 | 1252 |
{ |
1252 | 1253 |
avio_wb32(pb, 20); // size |
1253 |
put_tag(pb, "tref");
|
|
1254 |
ffio_wfourcc(pb, "tref");
|
|
1254 | 1255 |
avio_wb32(pb, 12); // size (subatom) |
1255 | 1256 |
avio_wl32(pb, track->tref_tag); |
1256 | 1257 |
avio_wb32(pb, track->tref_id); |
... | ... | |
1261 | 1262 |
static int mov_write_uuid_tag_psp(AVIOContext *pb, MOVTrack *mov) |
1262 | 1263 |
{ |
1263 | 1264 |
avio_wb32(pb, 0x34); /* size ... reports as 28 in mp4box! */ |
1264 |
put_tag(pb, "uuid");
|
|
1265 |
put_tag(pb, "USMT");
|
|
1265 |
ffio_wfourcc(pb, "uuid");
|
|
1266 |
ffio_wfourcc(pb, "USMT");
|
|
1266 | 1267 |
avio_wb32(pb, 0x21d24fce); |
1267 | 1268 |
avio_wb32(pb, 0xbb88695c); |
1268 | 1269 |
avio_wb32(pb, 0xfac9c740); |
1269 | 1270 |
avio_wb32(pb, 0x1c); // another size here! |
1270 |
put_tag(pb, "MTDT");
|
|
1271 |
ffio_wfourcc(pb, "MTDT");
|
|
1271 | 1272 |
avio_wb32(pb, 0x00010012); |
1272 | 1273 |
avio_wb32(pb, 0x0a); |
1273 | 1274 |
avio_wb32(pb, 0x55c40000); |
... | ... | |
1286 | 1287 |
len = strlen(buf); |
1287 | 1288 |
|
1288 | 1289 |
avio_wb32(pb, len + 24); |
1289 |
put_tag (pb, "udta");
|
|
1290 |
ffio_wfourcc(pb, "udta");
|
|
1290 | 1291 |
avio_wb32(pb, len + 16); |
1291 |
put_tag (pb, "hnti");
|
|
1292 |
ffio_wfourcc(pb, "hnti");
|
|
1292 | 1293 |
avio_wb32(pb, len + 8); |
1293 |
put_tag (pb, "sdp ");
|
|
1294 |
ffio_wfourcc(pb, "sdp ");
|
|
1294 | 1295 |
avio_write(pb, buf, len); |
1295 | 1296 |
return len + 24; |
1296 | 1297 |
} |
... | ... | |
1299 | 1300 |
{ |
1300 | 1301 |
int64_t pos = url_ftell(pb); |
1301 | 1302 |
avio_wb32(pb, 0); /* size */ |
1302 |
put_tag(pb, "trak");
|
|
1303 |
ffio_wfourcc(pb, "trak");
|
|
1303 | 1304 |
mov_write_tkhd_tag(pb, track, st); |
1304 | 1305 |
if (track->mode == MODE_PSP || track->flags & MOV_TRACK_CTTS) |
1305 | 1306 |
mov_write_edts_tag(pb, track); // PSP Movies require edts box |
... | ... | |
1318 | 1319 |
static int mov_write_iods_tag(AVIOContext *pb, MOVMuxContext *mov) |
1319 | 1320 |
{ |
1320 | 1321 |
avio_wb32(pb, 0x15); /* size */ |
1321 |
put_tag(pb, "iods");
|
|
1322 |
ffio_wfourcc(pb, "iods");
|
|
1322 | 1323 |
avio_wb32(pb, 0); /* version & flags */ |
1323 | 1324 |
avio_wb16(pb, 0x1007); |
1324 | 1325 |
avio_w8(pb, 0); |
... | ... | |
1350 | 1351 |
|
1351 | 1352 |
version = maxTrackLen < UINT32_MAX ? 0 : 1; |
1352 | 1353 |
(version == 1) ? avio_wb32(pb, 120) : avio_wb32(pb, 108); /* size */ |
1353 |
put_tag(pb, "mvhd");
|
|
1354 |
ffio_wfourcc(pb, "mvhd");
|
|
1354 | 1355 |
avio_w8(pb, version); |
1355 | 1356 |
avio_wb24(pb, 0); /* flags */ |
1356 | 1357 |
if (version == 1) { |
... | ... | |
1394 | 1395 |
AVFormatContext *s) |
1395 | 1396 |
{ |
1396 | 1397 |
avio_wb32(pb, 33); /* size */ |
1397 |
put_tag(pb, "hdlr");
|
|
1398 |
ffio_wfourcc(pb, "hdlr");
|
|
1398 | 1399 |
avio_wb32(pb, 0); |
1399 | 1400 |
avio_wb32(pb, 0); |
1400 |
put_tag(pb, "mdir");
|
|
1401 |
put_tag(pb, "appl");
|
|
1401 |
ffio_wfourcc(pb, "mdir");
|
|
1402 |
ffio_wfourcc(pb, "appl");
|
|
1402 | 1403 |
avio_wb32(pb, 0); |
1403 | 1404 |
avio_wb32(pb, 0); |
1404 | 1405 |
avio_w8(pb, 0); |
... | ... | |
1411 | 1412 |
if(long_style){ |
1412 | 1413 |
int size = 16 + strlen(data); |
1413 | 1414 |
avio_wb32(pb, size); /* size */ |
1414 |
put_tag(pb, "data");
|
|
1415 |
ffio_wfourcc(pb, "data");
|
|
1415 | 1416 |
avio_wb32(pb, 1); |
1416 | 1417 |
avio_wb32(pb, 0); |
1417 | 1418 |
avio_write(pb, data, strlen(data)); |
... | ... | |
1431 | 1432 |
if (value && value[0]) { |
1432 | 1433 |
int64_t pos = url_ftell(pb); |
1433 | 1434 |
avio_wb32(pb, 0); /* size */ |
1434 |
put_tag(pb, name);
|
|
1435 |
ffio_wfourcc(pb, name);
|
|
1435 | 1436 |
mov_write_string_data_tag(pb, value, lang, long_style); |
1436 | 1437 |
size= updateSize(pb, pos); |
1437 | 1438 |
} |
... | ... | |
1470 | 1471 |
int size = 0, track = t ? atoi(t->value) : 0; |
1471 | 1472 |
if (track) { |
1472 | 1473 |
avio_wb32(pb, 32); /* size */ |
1473 |
put_tag(pb, "trkn");
|
|
1474 |
ffio_wfourcc(pb, "trkn");
|
|
1474 | 1475 |
avio_wb32(pb, 24); /* size */ |
1475 |
put_tag(pb, "data");
|
|
1476 |
ffio_wfourcc(pb, "data");
|
|
1476 | 1477 |
avio_wb32(pb, 0); // 8 bytes empty |
1477 | 1478 |
avio_wb32(pb, 0); |
1478 | 1479 |
avio_wb16(pb, 0); // empty |
... | ... | |
1490 | 1491 |
{ |
1491 | 1492 |
int64_t pos = url_ftell(pb); |
1492 | 1493 |
avio_wb32(pb, 0); /* size */ |
1493 |
put_tag(pb, "ilst");
|
|
1494 |
ffio_wfourcc(pb, "ilst");
|
|
1494 | 1495 |
mov_write_string_metadata(s, pb, "\251nam", "title" , 1); |
1495 | 1496 |
mov_write_string_metadata(s, pb, "\251ART", "artist" , 1); |
1496 | 1497 |
mov_write_string_metadata(s, pb, "aART", "album_artist", 1); |
... | ... | |
1519 | 1520 |
int size = 0; |
1520 | 1521 |
int64_t pos = url_ftell(pb); |
1521 | 1522 |
avio_wb32(pb, 0); /* size */ |
1522 |
put_tag(pb, "meta");
|
|
1523 |
ffio_wfourcc(pb, "meta");
|
|
1523 | 1524 |
avio_wb32(pb, 0); |
1524 | 1525 |
mov_write_itunes_hdlr_tag(pb, mov, s); |
1525 | 1526 |
mov_write_ilst_tag(pb, mov, s); |
... | ... | |
1562 | 1563 |
if (!t || !utf8len(t->value)) |
1563 | 1564 |
return 0; |
1564 | 1565 |
avio_wb32(pb, 0); /* size */ |
1565 |
put_tag (pb, tag); /* type */
|
|
1566 |
ffio_wfourcc(pb, tag); /* type */
|
|
1566 | 1567 |
avio_wb32(pb, 0); /* version + flags */ |
1567 | 1568 |
if (!strcmp(tag, "yrrc")) |
1568 | 1569 |
avio_wb16(pb, atoi(t->value)); |
... | ... | |
1582 | 1583 |
int i, nb_chapters = FFMIN(s->nb_chapters, 255); |
1583 | 1584 |
|
1584 | 1585 |
avio_wb32(pb, 0); // size |
1585 |
put_tag (pb, "chpl");
|
|
1586 |
ffio_wfourcc(pb, "chpl");
|
|
1586 | 1587 |
avio_wb32(pb, 0x01000000); // version + flags |
1587 | 1588 |
avio_wb32(pb, 0); // unknown |
1588 | 1589 |
avio_w8(pb, nb_chapters); |
... | ... | |
1647 | 1648 |
|
1648 | 1649 |
if ((size = url_close_dyn_buf(pb_buf, &buf)) > 0) { |
1649 | 1650 |
avio_wb32(pb, size+8); |
1650 |
put_tag(pb, "udta");
|
|
1651 |
ffio_wfourcc(pb, "udta");
|
|
1651 | 1652 |
avio_write(pb, buf, size); |
1652 | 1653 |
} |
1653 | 1654 |
av_free(buf); |
... | ... | |
1676 | 1677 |
if (title) { |
1677 | 1678 |
pos = url_ftell(pb); |
1678 | 1679 |
avio_wb32(pb, 0); /* size placeholder*/ |
1679 |
put_tag(pb, "uuid");
|
|
1680 |
put_tag(pb, "USMT");
|
|
1680 |
ffio_wfourcc(pb, "uuid");
|
|
1681 |
ffio_wfourcc(pb, "USMT");
|
|
1681 | 1682 |
avio_wb32(pb, 0x21d24fce); /* 96 bit UUID */ |
1682 | 1683 |
avio_wb32(pb, 0xbb88695c); |
1683 | 1684 |
avio_wb32(pb, 0xfac9c740); |
1684 | 1685 |
|
1685 | 1686 |
pos2 = url_ftell(pb); |
1686 | 1687 |
avio_wb32(pb, 0); /* size placeholder*/ |
1687 |
put_tag(pb, "MTDT");
|
|
1688 |
ffio_wfourcc(pb, "MTDT");
|
|
1688 | 1689 |
avio_wb16(pb, 4); |
1689 | 1690 |
|
1690 | 1691 |
// ? |
... | ... | |
1712 | 1713 |
int i; |
1713 | 1714 |
int64_t pos = url_ftell(pb); |
1714 | 1715 |
avio_wb32(pb, 0); /* size placeholder*/ |
1715 |
put_tag(pb, "moov");
|
|
1716 |
ffio_wfourcc(pb, "moov");
|
|
1716 | 1717 |
|
1717 | 1718 |
for (i=0; i<mov->nb_streams; i++) { |
1718 | 1719 |
if(mov->tracks[i].entry <= 0) continue; |
... | ... | |
1753 | 1754 |
static int mov_write_mdat_tag(AVIOContext *pb, MOVMuxContext *mov) |
1754 | 1755 |
{ |
1755 | 1756 |
avio_wb32(pb, 8); // placeholder for extended size field (64 bit) |
1756 |
put_tag(pb, mov->mode == MODE_MOV ? "wide" : "free");
|
|
1757 |
ffio_wfourcc(pb, mov->mode == MODE_MOV ? "wide" : "free");
|
|
1757 | 1758 |
|
1758 | 1759 |
mov->mdat_pos = url_ftell(pb); |
1759 | 1760 |
avio_wb32(pb, 0); /* size placeholder*/ |
1760 |
put_tag(pb, "mdat");
|
|
1761 |
ffio_wfourcc(pb, "mdat");
|
|
1761 | 1762 |
return 0; |
1762 | 1763 |
} |
1763 | 1764 |
|
... | ... | |
1779 | 1780 |
} |
1780 | 1781 |
|
1781 | 1782 |
avio_wb32(pb, 0); /* size */ |
1782 |
put_tag(pb, "ftyp");
|
|
1783 |
ffio_wfourcc(pb, "ftyp");
|
|
1783 | 1784 |
|
1784 | 1785 |
if (mov->mode == MODE_3GP) { |
1785 |
put_tag(pb, has_h264 ? "3gp6" : "3gp4");
|
|
1786 |
ffio_wfourcc(pb, has_h264 ? "3gp6" : "3gp4");
|
|
1786 | 1787 |
minor = has_h264 ? 0x100 : 0x200; |
1787 | 1788 |
} else if (mov->mode & MODE_3G2) { |
1788 |
put_tag(pb, has_h264 ? "3g2b" : "3g2a");
|
|
1789 |
ffio_wfourcc(pb, has_h264 ? "3g2b" : "3g2a");
|
|
1789 | 1790 |
minor = has_h264 ? 0x20000 : 0x10000; |
1790 | 1791 |
}else if (mov->mode == MODE_PSP) |
1791 |
put_tag(pb, "MSNV");
|
|
1792 |
ffio_wfourcc(pb, "MSNV");
|
|
1792 | 1793 |
else if (mov->mode == MODE_MP4) |
1793 |
put_tag(pb, "isom");
|
|
1794 |
ffio_wfourcc(pb, "isom");
|
|
1794 | 1795 |
else if (mov->mode == MODE_IPOD) |
1795 |
put_tag(pb, has_video ? "M4V ":"M4A ");
|
|
1796 |
ffio_wfourcc(pb, has_video ? "M4V ":"M4A ");
|
|
1796 | 1797 |
else |
1797 |
put_tag(pb, "qt ");
|
|
1798 |
ffio_wfourcc(pb, "qt ");
|
|
1798 | 1799 |
|
1799 | 1800 |
avio_wb32(pb, minor); |
1800 | 1801 |
|
1801 | 1802 |
if(mov->mode == MODE_MOV) |
1802 |
put_tag(pb, "qt ");
|
|
1803 |
ffio_wfourcc(pb, "qt ");
|
|
1803 | 1804 |
else{ |
1804 |
put_tag(pb, "isom");
|
|
1805 |
put_tag(pb, "iso2");
|
|
1805 |
ffio_wfourcc(pb, "isom");
|
|
1806 |
ffio_wfourcc(pb, "iso2");
|
|
1806 | 1807 |
if(has_h264) |
1807 |
put_tag(pb, "avc1");
|
|
1808 |
ffio_wfourcc(pb, "avc1");
|
|
1808 | 1809 |
} |
1809 | 1810 |
|
1810 | 1811 |
if (mov->mode == MODE_3GP) |
1811 |
put_tag(pb, has_h264 ? "3gp6":"3gp4");
|
|
1812 |
ffio_wfourcc(pb, has_h264 ? "3gp6":"3gp4");
|
|
1812 | 1813 |
else if (mov->mode & MODE_3G2) |
1813 |
put_tag(pb, has_h264 ? "3g2b":"3g2a");
|
|
1814 |
ffio_wfourcc(pb, has_h264 ? "3g2b":"3g2a");
|
|
1814 | 1815 |
else if (mov->mode == MODE_PSP) |
1815 |
put_tag(pb, "MSNV");
|
|
1816 |
ffio_wfourcc(pb, "MSNV");
|
|
1816 | 1817 |
else if (mov->mode == MODE_MP4) |
1817 |
put_tag(pb, "mp41");
|
|
1818 |
ffio_wfourcc(pb, "mp41");
|
|
1818 | 1819 |
return updateSize(pb, pos); |
1819 | 1820 |
} |
1820 | 1821 |
|
... | ... | |
1828 | 1829 |
int video_kbitrate= FFMIN(VideoCodec->bit_rate / 1000, 800 - audio_kbitrate); |
1829 | 1830 |
|
1830 | 1831 |
avio_wb32(pb, 0x94); /* size */ |
1831 |
put_tag(pb, "uuid");
|
|
1832 |
put_tag(pb, "PROF");
|
|
1832 |
ffio_wfourcc(pb, "uuid");
|
|
1833 |
ffio_wfourcc(pb, "PROF");
|
|
1833 | 1834 |
|
1834 | 1835 |
avio_wb32(pb, 0x21d24fce); /* 96 bit UUID */ |
1835 | 1836 |
avio_wb32(pb, 0xbb88695c); |
... | ... | |
1839 | 1840 |
avio_wb32(pb, 0x3); /* 3 sections ? */ |
1840 | 1841 |
|
1841 | 1842 |
avio_wb32(pb, 0x14); /* size */ |
1842 |
put_tag(pb, "FPRF");
|
|
1843 |
ffio_wfourcc(pb, "FPRF");
|
|
1843 | 1844 |
avio_wb32(pb, 0x0); /* ? */ |
1844 | 1845 |
avio_wb32(pb, 0x0); /* ? */ |
1845 | 1846 |
avio_wb32(pb, 0x0); /* ? */ |
1846 | 1847 |
|
1847 | 1848 |
avio_wb32(pb, 0x2c); /* size */ |
1848 |
put_tag(pb, "APRF"); /* audio */
|
|
1849 |
ffio_wfourcc(pb, "APRF");/* audio */
|
|
1849 | 1850 |
avio_wb32(pb, 0x0); |
1850 | 1851 |
avio_wb32(pb, 0x2); /* TrackID */ |
1851 |
put_tag(pb, "mp4a");
|
|
1852 |
ffio_wfourcc(pb, "mp4a");
|
|
1852 | 1853 |
avio_wb32(pb, 0x20f); |
1853 | 1854 |
avio_wb32(pb, 0x0); |
1854 | 1855 |
avio_wb32(pb, audio_kbitrate); |
... | ... | |
1857 | 1858 |
avio_wb32(pb, AudioCodec->channels); |
1858 | 1859 |
|
1859 | 1860 |
avio_wb32(pb, 0x34); /* size */ |
1860 |
put_tag(pb, "VPRF"); /* video */
|
|
1861 |
ffio_wfourcc(pb, "VPRF"); /* video */
|
|
1861 | 1862 |
avio_wb32(pb, 0x0); |
1862 | 1863 |
avio_wb32(pb, 0x1); /* TrackID */ |
1863 | 1864 |
if (VideoCodec->codec_id == CODEC_ID_H264) { |
1864 |
put_tag(pb, "avc1");
|
|
1865 |
ffio_wfourcc(pb, "avc1");
|
|
1865 | 1866 |
avio_wb16(pb, 0x014D); |
1866 | 1867 |
avio_wb16(pb, 0x0015); |
1867 | 1868 |
} else { |
1868 |
put_tag(pb, "mp4v");
|
|
1869 |
ffio_wfourcc(pb, "mp4v");
|
|
1869 | 1870 |
avio_wb16(pb, 0x0000); |
1870 | 1871 |
avio_wb16(pb, 0x0103); |
1871 | 1872 |
} |
... | ... | |
2206 | 2207 |
/* overwrite 'wide' placeholder atom */ |
2207 | 2208 |
url_fseek(pb, mov->mdat_pos - 8, SEEK_SET); |
2208 | 2209 |
avio_wb32(pb, 1); /* special value: real atom size will be 64 bit value after tag field */ |
2209 |
put_tag(pb, "mdat");
|
|
2210 |
ffio_wfourcc(pb, "mdat");
|
|
2210 | 2211 |
avio_wb64(pb, mov->mdat_size+16); |
2211 | 2212 |
} |
2212 | 2213 |
url_fseek(pb, moov_pos, SEEK_SET); |
libavformat/oggenc.c | ||
---|---|---|
25 | 25 |
#include "libavcodec/bytestream.h" |
26 | 26 |
#include "libavcodec/flac.h" |
27 | 27 |
#include "avformat.h" |
28 |
#include "avio_internal.h" |
|
28 | 29 |
#include "internal.h" |
29 | 30 |
#include "vorbiscomment.h" |
30 | 31 |
|
... | ... | |
85 | 86 |
if (ret < 0) |
86 | 87 |
return ret; |
87 | 88 |
init_checksum(pb, ff_crc04C11DB7_update, 0); |
88 |
put_tag(pb, "OggS");
|
|
89 |
ffio_wfourcc(pb, "OggS");
|
|
89 | 90 |
avio_w8(pb, 0); |
90 | 91 |
avio_w8(pb, page->flags | extra_flags); |
91 | 92 |
avio_wl64(pb, page->granule); |
libavformat/riff.c | ||
---|---|---|
21 | 21 |
|
22 | 22 |
#include "libavcodec/avcodec.h" |
23 | 23 |
#include "avformat.h" |
24 |
#include "avio_internal.h" |
|
24 | 25 |
#include "riff.h" |
25 | 26 |
#include "libavcodec/bytestream.h" |
26 | 27 |
|
... | ... | |
321 | 322 |
#if CONFIG_MUXERS |
322 | 323 |
int64_t ff_start_tag(AVIOContext *pb, const char *tag) |
323 | 324 |
{ |
324 |
put_tag(pb, tag);
|
|
325 |
ffio_wfourcc(pb, tag);
|
|
325 | 326 |
avio_wl32(pb, 0); |
326 | 327 |
return url_ftell(pb); |
327 | 328 |
} |
libavformat/rmenc.c | ||
---|---|---|
19 | 19 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
20 | 20 |
*/ |
21 | 21 |
#include "avformat.h" |
22 |
#include "avio_internal.h" |
|
22 | 23 |
#include "rm.h" |
23 | 24 |
|
24 | 25 |
typedef struct { |
... | ... | |
74 | 75 |
|
75 | 76 |
start_ptr = s->buf_ptr; |
76 | 77 |
|
77 |
put_tag(s, ".RMF");
|
|
78 |
ffio_wfourcc(s, ".RMF");
|
|
78 | 79 |
avio_wb32(s,18); /* header size */ |
79 | 80 |
avio_wb16(s,0); |
80 | 81 |
avio_wb32(s,0); |
81 | 82 |
avio_wb32(s,4 + ctx->nb_streams); /* num headers */ |
82 | 83 |
|
83 |
put_tag(s,"PROP");
|
|
84 |
ffio_wfourcc(s,"PROP");
|
|
84 | 85 |
avio_wb32(s, 50); |
85 | 86 |
avio_wb16(s, 0); |
86 | 87 |
packet_max_size = 0; |
... | ... | |
123 | 124 |
|
124 | 125 |
/* comments */ |
125 | 126 |
|
126 |
put_tag(s,"CONT");
|
|
127 |
ffio_wfourcc(s,"CONT");
|
|
127 | 128 |
size = 4 * 2 + 10; |
128 | 129 |
for(i=0; i<FF_ARRAY_ELEMS(ff_rm_metadata); i++) { |
129 | 130 |
tag = av_metadata_get(ctx->metadata, ff_rm_metadata[i], NULL, 0); |
... | ... | |
151 | 152 |
codec_data_size = 34; |
152 | 153 |
} |
153 | 154 |
|
154 |
put_tag(s,"MDPR");
|
|
155 |
ffio_wfourcc(s,"MDPR");
|
|
155 | 156 |
size = 10 + 9 * 4 + strlen(desc) + strlen(mimetype) + codec_data_size; |
156 | 157 |
avio_wb32(s, size); |
157 | 158 |
avio_wb16(s, 0); |
... | ... | |
186 | 187 |
put_tag(s, ".ra"); |
187 | 188 |
avio_w8(s, 0xfd); |
188 | 189 |
avio_wb32(s, 0x00040000); /* version */ |
189 |
put_tag(s, ".ra4");
|
|
190 |
ffio_wfourcc(s, ".ra4");
|
|
190 | 191 |
avio_wb32(s, 0x01b53530); /* stream length */ |
191 | 192 |
avio_wb16(s, 4); /* unknown */ |
192 | 193 |
avio_wb32(s, 0x39); /* header size */ |
... | ... | |
239 | 240 |
} else { |
240 | 241 |
/* video codec info */ |
241 | 242 |
avio_wb32(s,34); /* size */ |
243 |
ffio_wfourcc(s, "VIDO"); |
|
242 | 244 |
if(stream->enc->codec_id == CODEC_ID_RV10) |
243 |
put_tag(s,"VIDORV10");
|
|
245 |
ffio_wfourcc(s,"RV10");
|
|
244 | 246 |
else |
245 |
put_tag(s,"VIDORV20");
|
|
247 |
ffio_wfourcc(s,"RV20");
|
|
246 | 248 |
avio_wb16(s, stream->enc->width); |
247 | 249 |
avio_wb16(s, stream->enc->height); |
248 | 250 |
avio_wb16(s, (int) stream->frame_rate); /* frames per seconds ? */ |
... | ... | |
270 | 272 |
data_offset_ptr[3] = data_pos; |
271 | 273 |
|
272 | 274 |
/* data stream */ |
273 |
put_tag(s,"DATA");
|
|
275 |
ffio_wfourcc(s, "DATA");
|
|
274 | 276 |
avio_wb32(s,data_size + 10 + 8); |
275 | 277 |
avio_wb16(s,0); |
276 | 278 |
|
libavformat/soxenc.c | ||
---|---|---|
31 | 31 |
|
32 | 32 |
#include "libavutil/intreadwrite.h" |
33 | 33 |
#include "avformat.h" |
34 |
#include "avio_internal.h" |
|
34 | 35 |
#include "sox.h" |
35 | 36 |
|
36 | 37 |
typedef struct { |
... | ... | |
53 | 54 |
sox->header_size = SOX_FIXED_HDR + comment_size; |
54 | 55 |
|
55 | 56 |
if (enc->codec_id == CODEC_ID_PCM_S32LE) { |
56 |
put_tag(pb, ".SoX");
|
|
57 |
ffio_wfourcc(pb, ".SoX");
|
|
57 | 58 |
avio_wl32(pb, sox->header_size); |
58 | 59 |
avio_wl64(pb, 0); /* number of samples */ |
59 | 60 |
avio_wl64(pb, av_dbl2int(enc->sample_rate)); |
60 | 61 |
avio_wl32(pb, enc->channels); |
61 | 62 |
avio_wl32(pb, comment_size); |
62 | 63 |
} else if (enc->codec_id == CODEC_ID_PCM_S32BE) { |
63 |
put_tag(pb, "XoS.");
|
|
64 |
ffio_wfourcc(pb, "XoS.");
|
|
64 | 65 |
avio_wb32(pb, sox->header_size); |
65 | 66 |
avio_wb64(pb, 0); /* number of samples */ |
66 | 67 |
avio_wb64(pb, av_dbl2int(enc->sample_rate)); |
libavformat/wav.c | ||
---|---|---|
23 | 23 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
24 | 24 |
*/ |
25 | 25 |
#include "avformat.h" |
26 |
#include "avio_internal.h" |
|
26 | 27 |
#include "pcm.h" |
27 | 28 |
#include "riff.h" |
28 | 29 |
|
... | ... | |
42 | 43 |
AVIOContext *pb = s->pb; |
43 | 44 |
int64_t fmt, fact; |
44 | 45 |
|
45 |
put_tag(pb, "RIFF");
|
|
46 |
ffio_wfourcc(pb, "RIFF");
|
|
46 | 47 |
avio_wl32(pb, 0); /* file length */ |
47 |
put_tag(pb, "WAVE");
|
|
48 |
ffio_wfourcc(pb, "WAVE");
|
|
48 | 49 |
|
49 | 50 |
/* format header */ |
50 | 51 |
fmt = ff_start_tag(pb, "fmt "); |
Also available in: Unified diff