You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

612 lines
19KB

  1. /*
  2. * AVI muxer
  3. * Copyright (c) 2000 Fabrice Bellard
  4. *
  5. * This file is part of FFmpeg.
  6. *
  7. * FFmpeg is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2.1 of the License, or (at your option) any later version.
  11. *
  12. * FFmpeg is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with FFmpeg; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. */
  21. #include "avformat.h"
  22. #include "avi.h"
  23. #include "riff.h"
  24. /*
  25. * TODO:
  26. * - fill all fields if non streamed (nb_frames for example)
  27. */
  28. #if CONFIG_AVI_MUXER
  29. typedef struct AVIIentry {
  30. unsigned int flags, pos, len;
  31. } AVIIentry;
  32. #define AVI_INDEX_CLUSTER_SIZE 16384
  33. typedef struct AVIIndex {
  34. int64_t indx_start;
  35. int entry;
  36. int ents_allocated;
  37. AVIIentry** cluster;
  38. } AVIIndex;
  39. typedef struct {
  40. int64_t riff_start, movi_list, odml_list;
  41. int64_t frames_hdr_all, frames_hdr_strm[MAX_STREAMS];
  42. int audio_strm_length[MAX_STREAMS];
  43. int riff_id;
  44. int packet_count[MAX_STREAMS];
  45. AVIIndex indexes[MAX_STREAMS];
  46. } AVIContext;
  47. static inline AVIIentry* avi_get_ientry(AVIIndex* idx, int ent_id)
  48. {
  49. int cl = ent_id / AVI_INDEX_CLUSTER_SIZE;
  50. int id = ent_id % AVI_INDEX_CLUSTER_SIZE;
  51. return &idx->cluster[cl][id];
  52. }
  53. static int64_t avi_start_new_riff(AVIContext *avi, ByteIOContext *pb,
  54. const char* riff_tag, const char* list_tag)
  55. {
  56. int64_t loff;
  57. int i;
  58. avi->riff_id++;
  59. for (i=0; i<MAX_STREAMS; i++)
  60. avi->indexes[i].entry = 0;
  61. avi->riff_start = start_tag(pb, "RIFF");
  62. put_tag(pb, riff_tag);
  63. loff = start_tag(pb, "LIST");
  64. put_tag(pb, list_tag);
  65. return loff;
  66. }
  67. static char* avi_stream2fourcc(char* tag, int index, enum CodecType type)
  68. {
  69. tag[0] = '0';
  70. tag[1] = '0' + index;
  71. if (type == CODEC_TYPE_VIDEO) {
  72. tag[2] = 'd';
  73. tag[3] = 'c';
  74. } else {
  75. tag[2] = 'w';
  76. tag[3] = 'b';
  77. }
  78. tag[4] = '\0';
  79. return tag;
  80. }
  81. static void avi_write_info_tag(ByteIOContext *pb, const char *tag, const char *str)
  82. {
  83. int len = strlen(str);
  84. if (len > 0) {
  85. len++;
  86. put_tag(pb, tag);
  87. put_le32(pb, len);
  88. put_strz(pb, str);
  89. if (len & 1)
  90. put_byte(pb, 0);
  91. }
  92. }
  93. static void avi_write_info_tag2(AVFormatContext *s, const char *fourcc, const char *key1, const char *key2)
  94. {
  95. AVMetadataTag *tag= av_metadata_get(s->metadata, key1, NULL, 0);
  96. if(!tag && key2)
  97. tag= av_metadata_get(s->metadata, key2, NULL, 0);
  98. if(tag)
  99. avi_write_info_tag(s->pb, fourcc, tag->value);
  100. }
  101. static int avi_write_counters(AVFormatContext* s, int riff_id)
  102. {
  103. ByteIOContext *pb = s->pb;
  104. AVIContext *avi = s->priv_data;
  105. int n, au_byterate, au_ssize, au_scale, nb_frames = 0;
  106. int64_t file_size;
  107. AVCodecContext* stream;
  108. file_size = url_ftell(pb);
  109. for(n = 0; n < s->nb_streams; n++) {
  110. assert(avi->frames_hdr_strm[n]);
  111. stream = s->streams[n]->codec;
  112. url_fseek(pb, avi->frames_hdr_strm[n], SEEK_SET);
  113. ff_parse_specific_params(stream, &au_byterate, &au_ssize, &au_scale);
  114. if(au_ssize == 0) {
  115. put_le32(pb, avi->packet_count[n]);
  116. } else {
  117. put_le32(pb, avi->audio_strm_length[n] / au_ssize);
  118. }
  119. if(stream->codec_type == CODEC_TYPE_VIDEO)
  120. nb_frames = FFMAX(nb_frames, avi->packet_count[n]);
  121. }
  122. if(riff_id == 1) {
  123. assert(avi->frames_hdr_all);
  124. url_fseek(pb, avi->frames_hdr_all, SEEK_SET);
  125. put_le32(pb, nb_frames);
  126. }
  127. url_fseek(pb, file_size, SEEK_SET);
  128. return 0;
  129. }
  130. static int avi_write_header(AVFormatContext *s)
  131. {
  132. AVIContext *avi = s->priv_data;
  133. ByteIOContext *pb = s->pb;
  134. int bitrate, n, i, nb_frames, au_byterate, au_ssize, au_scale;
  135. AVCodecContext *stream, *video_enc;
  136. int64_t list1, list2, strh, strf;
  137. /* header list */
  138. avi->riff_id = 0;
  139. list1 = avi_start_new_riff(avi, pb, "AVI ", "hdrl");
  140. /* avi header */
  141. put_tag(pb, "avih");
  142. put_le32(pb, 14 * 4);
  143. bitrate = 0;
  144. video_enc = NULL;
  145. for(n=0;n<s->nb_streams;n++) {
  146. stream = s->streams[n]->codec;
  147. bitrate += stream->bit_rate;
  148. if (stream->codec_type == CODEC_TYPE_VIDEO)
  149. video_enc = stream;
  150. }
  151. nb_frames = 0;
  152. if(video_enc){
  153. put_le32(pb, (uint32_t)(INT64_C(1000000) * video_enc->time_base.num / video_enc->time_base.den));
  154. } else {
  155. put_le32(pb, 0);
  156. }
  157. put_le32(pb, bitrate / 8); /* XXX: not quite exact */
  158. put_le32(pb, 0); /* padding */
  159. if (url_is_streamed(pb))
  160. put_le32(pb, AVIF_TRUSTCKTYPE | AVIF_ISINTERLEAVED); /* flags */
  161. else
  162. put_le32(pb, AVIF_TRUSTCKTYPE | AVIF_HASINDEX | AVIF_ISINTERLEAVED); /* flags */
  163. avi->frames_hdr_all = url_ftell(pb); /* remember this offset to fill later */
  164. put_le32(pb, nb_frames); /* nb frames, filled later */
  165. put_le32(pb, 0); /* initial frame */
  166. put_le32(pb, s->nb_streams); /* nb streams */
  167. put_le32(pb, 1024 * 1024); /* suggested buffer size */
  168. if(video_enc){
  169. put_le32(pb, video_enc->width);
  170. put_le32(pb, video_enc->height);
  171. } else {
  172. put_le32(pb, 0);
  173. put_le32(pb, 0);
  174. }
  175. put_le32(pb, 0); /* reserved */
  176. put_le32(pb, 0); /* reserved */
  177. put_le32(pb, 0); /* reserved */
  178. put_le32(pb, 0); /* reserved */
  179. /* stream list */
  180. for(i=0;i<n;i++) {
  181. list2 = start_tag(pb, "LIST");
  182. put_tag(pb, "strl");
  183. stream = s->streams[i]->codec;
  184. /* stream generic header */
  185. strh = start_tag(pb, "strh");
  186. switch(stream->codec_type) {
  187. case CODEC_TYPE_VIDEO: put_tag(pb, "vids"); break;
  188. case CODEC_TYPE_AUDIO: put_tag(pb, "auds"); break;
  189. // case CODEC_TYPE_TEXT : put_tag(pb, "txts"); break;
  190. case CODEC_TYPE_DATA : put_tag(pb, "dats"); break;
  191. }
  192. if(stream->codec_type == CODEC_TYPE_VIDEO)
  193. put_le32(pb, stream->codec_tag);
  194. else
  195. put_le32(pb, 1);
  196. put_le32(pb, 0); /* flags */
  197. put_le16(pb, 0); /* priority */
  198. put_le16(pb, 0); /* language */
  199. put_le32(pb, 0); /* initial frame */
  200. ff_parse_specific_params(stream, &au_byterate, &au_ssize, &au_scale);
  201. put_le32(pb, au_scale); /* scale */
  202. put_le32(pb, au_byterate); /* rate */
  203. av_set_pts_info(s->streams[i], 64, au_scale, au_byterate);
  204. put_le32(pb, 0); /* start */
  205. avi->frames_hdr_strm[i] = url_ftell(pb); /* remember this offset to fill later */
  206. if (url_is_streamed(pb))
  207. put_le32(pb, AVI_MAX_RIFF_SIZE); /* FIXME: this may be broken, but who cares */
  208. else
  209. put_le32(pb, 0); /* length, XXX: filled later */
  210. /* suggested buffer size */ //FIXME set at the end to largest chunk
  211. if(stream->codec_type == CODEC_TYPE_VIDEO)
  212. put_le32(pb, 1024 * 1024);
  213. else if(stream->codec_type == CODEC_TYPE_AUDIO)
  214. put_le32(pb, 12 * 1024);
  215. else
  216. put_le32(pb, 0);
  217. put_le32(pb, -1); /* quality */
  218. put_le32(pb, au_ssize); /* sample size */
  219. put_le32(pb, 0);
  220. put_le16(pb, stream->width);
  221. put_le16(pb, stream->height);
  222. end_tag(pb, strh);
  223. if(stream->codec_type != CODEC_TYPE_DATA){
  224. strf = start_tag(pb, "strf");
  225. switch(stream->codec_type) {
  226. case CODEC_TYPE_VIDEO:
  227. put_bmp_header(pb, stream, codec_bmp_tags, 0);
  228. break;
  229. case CODEC_TYPE_AUDIO:
  230. if (put_wav_header(pb, stream) < 0) {
  231. return -1;
  232. }
  233. break;
  234. default:
  235. return -1;
  236. }
  237. end_tag(pb, strf);
  238. }
  239. if (!url_is_streamed(pb)) {
  240. unsigned char tag[5];
  241. int j;
  242. /* Starting to lay out AVI OpenDML master index.
  243. * We want to make it JUNK entry for now, since we'd
  244. * like to get away without making AVI an OpenDML one
  245. * for compatibility reasons.
  246. */
  247. avi->indexes[i].entry = avi->indexes[i].ents_allocated = 0;
  248. avi->indexes[i].indx_start = start_tag(pb, "JUNK");
  249. put_le16(pb, 4); /* wLongsPerEntry */
  250. put_byte(pb, 0); /* bIndexSubType (0 == frame index) */
  251. put_byte(pb, 0); /* bIndexType (0 == AVI_INDEX_OF_INDEXES) */
  252. put_le32(pb, 0); /* nEntriesInUse (will fill out later on) */
  253. put_tag(pb, avi_stream2fourcc(&tag[0], i, stream->codec_type));
  254. /* dwChunkId */
  255. put_le64(pb, 0); /* dwReserved[3]
  256. put_le32(pb, 0); Must be 0. */
  257. for (j=0; j < AVI_MASTER_INDEX_SIZE * 2; j++)
  258. put_le64(pb, 0);
  259. end_tag(pb, avi->indexes[i].indx_start);
  260. }
  261. if( stream->codec_type == CODEC_TYPE_VIDEO
  262. && s->streams[i]->sample_aspect_ratio.num>0
  263. && s->streams[i]->sample_aspect_ratio.den>0){
  264. int vprp= start_tag(pb, "vprp");
  265. AVRational dar = av_mul_q(s->streams[i]->sample_aspect_ratio,
  266. (AVRational){stream->width, stream->height});
  267. int num, den;
  268. av_reduce(&num, &den, dar.num, dar.den, 0xFFFF);
  269. put_le32(pb, 0); //video format = unknown
  270. put_le32(pb, 0); //video standard= unknown
  271. put_le32(pb, lrintf(1.0/av_q2d(stream->time_base)));
  272. put_le32(pb, stream->width );
  273. put_le32(pb, stream->height);
  274. put_le16(pb, den);
  275. put_le16(pb, num);
  276. put_le32(pb, stream->width );
  277. put_le32(pb, stream->height);
  278. put_le32(pb, 1); //progressive FIXME
  279. put_le32(pb, stream->height);
  280. put_le32(pb, stream->width );
  281. put_le32(pb, stream->height);
  282. put_le32(pb, stream->width );
  283. put_le32(pb, 0);
  284. put_le32(pb, 0);
  285. put_le32(pb, 0);
  286. put_le32(pb, 0);
  287. end_tag(pb, vprp);
  288. }
  289. end_tag(pb, list2);
  290. }
  291. if (!url_is_streamed(pb)) {
  292. /* AVI could become an OpenDML one, if it grows beyond 2Gb range */
  293. avi->odml_list = start_tag(pb, "JUNK");
  294. put_tag(pb, "odml");
  295. put_tag(pb, "dmlh");
  296. put_le32(pb, 248);
  297. for (i = 0; i < 248; i+= 4)
  298. put_le32(pb, 0);
  299. end_tag(pb, avi->odml_list);
  300. }
  301. end_tag(pb, list1);
  302. list2 = start_tag(pb, "LIST");
  303. put_tag(pb, "INFO");
  304. avi_write_info_tag2(s, "INAM", "Title", NULL);
  305. avi_write_info_tag2(s, "IART", "Artist", "Author");
  306. avi_write_info_tag2(s, "ICOP", "Copyright", NULL);
  307. avi_write_info_tag2(s, "ICMT", "Comment", NULL);
  308. avi_write_info_tag2(s, "IPRD", "Album", NULL);
  309. avi_write_info_tag2(s, "IGNR", "Genre", NULL);
  310. avi_write_info_tag2(s, "IPRT", "Track", NULL);
  311. if(!(s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT))
  312. avi_write_info_tag(pb, "ISFT", LIBAVFORMAT_IDENT);
  313. end_tag(pb, list2);
  314. /* some padding for easier tag editing */
  315. list2 = start_tag(pb, "JUNK");
  316. for (i = 0; i < 1016; i += 4)
  317. put_le32(pb, 0);
  318. end_tag(pb, list2);
  319. avi->movi_list = start_tag(pb, "LIST");
  320. put_tag(pb, "movi");
  321. put_flush_packet(pb);
  322. return 0;
  323. }
  324. static int avi_write_ix(AVFormatContext *s)
  325. {
  326. ByteIOContext *pb = s->pb;
  327. AVIContext *avi = s->priv_data;
  328. char tag[5];
  329. char ix_tag[] = "ix00";
  330. int i, j;
  331. assert(!url_is_streamed(pb));
  332. if (avi->riff_id > AVI_MASTER_INDEX_SIZE)
  333. return -1;
  334. for (i=0;i<s->nb_streams;i++) {
  335. int64_t ix, pos;
  336. avi_stream2fourcc(&tag[0], i, s->streams[i]->codec->codec_type);
  337. ix_tag[3] = '0' + i;
  338. /* Writing AVI OpenDML leaf index chunk */
  339. ix = url_ftell(pb);
  340. put_tag(pb, &ix_tag[0]); /* ix?? */
  341. put_le32(pb, avi->indexes[i].entry * 8 + 24);
  342. /* chunk size */
  343. put_le16(pb, 2); /* wLongsPerEntry */
  344. put_byte(pb, 0); /* bIndexSubType (0 == frame index) */
  345. put_byte(pb, 1); /* bIndexType (1 == AVI_INDEX_OF_CHUNKS) */
  346. put_le32(pb, avi->indexes[i].entry);
  347. /* nEntriesInUse */
  348. put_tag(pb, &tag[0]); /* dwChunkId */
  349. put_le64(pb, avi->movi_list);/* qwBaseOffset */
  350. put_le32(pb, 0); /* dwReserved_3 (must be 0) */
  351. for (j=0; j<avi->indexes[i].entry; j++) {
  352. AVIIentry* ie = avi_get_ientry(&avi->indexes[i], j);
  353. put_le32(pb, ie->pos + 8);
  354. put_le32(pb, ((uint32_t)ie->len & ~0x80000000) |
  355. (ie->flags & 0x10 ? 0 : 0x80000000));
  356. }
  357. put_flush_packet(pb);
  358. pos = url_ftell(pb);
  359. /* Updating one entry in the AVI OpenDML master index */
  360. url_fseek(pb, avi->indexes[i].indx_start - 8, SEEK_SET);
  361. put_tag(pb, "indx"); /* enabling this entry */
  362. url_fskip(pb, 8);
  363. put_le32(pb, avi->riff_id); /* nEntriesInUse */
  364. url_fskip(pb, 16*avi->riff_id);
  365. put_le64(pb, ix); /* qwOffset */
  366. put_le32(pb, pos - ix); /* dwSize */
  367. put_le32(pb, avi->indexes[i].entry); /* dwDuration */
  368. url_fseek(pb, pos, SEEK_SET);
  369. }
  370. return 0;
  371. }
  372. static int avi_write_idx1(AVFormatContext *s)
  373. {
  374. ByteIOContext *pb = s->pb;
  375. AVIContext *avi = s->priv_data;
  376. int64_t idx_chunk;
  377. int i;
  378. char tag[5];
  379. if (!url_is_streamed(pb)) {
  380. AVIIentry* ie = 0, *tie;
  381. int entry[MAX_STREAMS];
  382. int empty, stream_id = -1;
  383. idx_chunk = start_tag(pb, "idx1");
  384. memset(&entry[0], 0, sizeof(entry));
  385. do {
  386. empty = 1;
  387. for (i=0; i<s->nb_streams; i++) {
  388. if (avi->indexes[i].entry <= entry[i])
  389. continue;
  390. tie = avi_get_ientry(&avi->indexes[i], entry[i]);
  391. if (empty || tie->pos < ie->pos) {
  392. ie = tie;
  393. stream_id = i;
  394. }
  395. empty = 0;
  396. }
  397. if (!empty) {
  398. avi_stream2fourcc(&tag[0], stream_id,
  399. s->streams[stream_id]->codec->codec_type);
  400. put_tag(pb, &tag[0]);
  401. put_le32(pb, ie->flags);
  402. put_le32(pb, ie->pos);
  403. put_le32(pb, ie->len);
  404. entry[stream_id]++;
  405. }
  406. } while (!empty);
  407. end_tag(pb, idx_chunk);
  408. avi_write_counters(s, avi->riff_id);
  409. }
  410. return 0;
  411. }
  412. static int avi_write_packet(AVFormatContext *s, AVPacket *pkt)
  413. {
  414. AVIContext *avi = s->priv_data;
  415. ByteIOContext *pb = s->pb;
  416. unsigned char tag[5];
  417. unsigned int flags=0;
  418. const int stream_index= pkt->stream_index;
  419. AVCodecContext *enc= s->streams[stream_index]->codec;
  420. int size= pkt->size;
  421. // av_log(s, AV_LOG_DEBUG, "%"PRId64" %d %d\n", pkt->dts, avi->packet_count[stream_index], stream_index);
  422. while(enc->block_align==0 && pkt->dts != AV_NOPTS_VALUE && pkt->dts > avi->packet_count[stream_index]){
  423. AVPacket empty_packet;
  424. av_init_packet(&empty_packet);
  425. empty_packet.size= 0;
  426. empty_packet.data= NULL;
  427. empty_packet.stream_index= stream_index;
  428. avi_write_packet(s, &empty_packet);
  429. // av_log(s, AV_LOG_DEBUG, "dup %"PRId64" %d\n", pkt->dts, avi->packet_count[stream_index]);
  430. }
  431. avi->packet_count[stream_index]++;
  432. // Make sure to put an OpenDML chunk when the file size exceeds the limits
  433. if (!url_is_streamed(pb) &&
  434. (url_ftell(pb) - avi->riff_start > AVI_MAX_RIFF_SIZE)) {
  435. avi_write_ix(s);
  436. end_tag(pb, avi->movi_list);
  437. if (avi->riff_id == 1)
  438. avi_write_idx1(s);
  439. end_tag(pb, avi->riff_start);
  440. avi->movi_list = avi_start_new_riff(avi, pb, "AVIX", "movi");
  441. }
  442. avi_stream2fourcc(&tag[0], stream_index, enc->codec_type);
  443. if(pkt->flags&PKT_FLAG_KEY)
  444. flags = 0x10;
  445. if (enc->codec_type == CODEC_TYPE_AUDIO) {
  446. avi->audio_strm_length[stream_index] += size;
  447. }
  448. if (!url_is_streamed(s->pb)) {
  449. AVIIndex* idx = &avi->indexes[stream_index];
  450. int cl = idx->entry / AVI_INDEX_CLUSTER_SIZE;
  451. int id = idx->entry % AVI_INDEX_CLUSTER_SIZE;
  452. if (idx->ents_allocated <= idx->entry) {
  453. idx->cluster = av_realloc(idx->cluster, (cl+1)*sizeof(void*));
  454. if (!idx->cluster)
  455. return -1;
  456. idx->cluster[cl] = av_malloc(AVI_INDEX_CLUSTER_SIZE*sizeof(AVIIentry));
  457. if (!idx->cluster[cl])
  458. return -1;
  459. idx->ents_allocated += AVI_INDEX_CLUSTER_SIZE;
  460. }
  461. idx->cluster[cl][id].flags = flags;
  462. idx->cluster[cl][id].pos = url_ftell(pb) - avi->movi_list;
  463. idx->cluster[cl][id].len = size;
  464. idx->entry++;
  465. }
  466. put_buffer(pb, tag, 4);
  467. put_le32(pb, size);
  468. put_buffer(pb, pkt->data, size);
  469. if (size & 1)
  470. put_byte(pb, 0);
  471. put_flush_packet(pb);
  472. return 0;
  473. }
  474. static int avi_write_trailer(AVFormatContext *s)
  475. {
  476. AVIContext *avi = s->priv_data;
  477. ByteIOContext *pb = s->pb;
  478. int res = 0;
  479. int i, j, n, nb_frames;
  480. int64_t file_size;
  481. if (!url_is_streamed(pb)){
  482. if (avi->riff_id == 1) {
  483. end_tag(pb, avi->movi_list);
  484. res = avi_write_idx1(s);
  485. end_tag(pb, avi->riff_start);
  486. } else {
  487. avi_write_ix(s);
  488. end_tag(pb, avi->movi_list);
  489. end_tag(pb, avi->riff_start);
  490. file_size = url_ftell(pb);
  491. url_fseek(pb, avi->odml_list - 8, SEEK_SET);
  492. put_tag(pb, "LIST"); /* Making this AVI OpenDML one */
  493. url_fskip(pb, 16);
  494. for (n=nb_frames=0;n<s->nb_streams;n++) {
  495. AVCodecContext *stream = s->streams[n]->codec;
  496. if (stream->codec_type == CODEC_TYPE_VIDEO) {
  497. if (nb_frames < avi->packet_count[n])
  498. nb_frames = avi->packet_count[n];
  499. } else {
  500. if (stream->codec_id == CODEC_ID_MP2 || stream->codec_id == CODEC_ID_MP3) {
  501. nb_frames += avi->packet_count[n];
  502. }
  503. }
  504. }
  505. put_le32(pb, nb_frames);
  506. url_fseek(pb, file_size, SEEK_SET);
  507. avi_write_counters(s, avi->riff_id);
  508. }
  509. }
  510. put_flush_packet(pb);
  511. for (i=0; i<MAX_STREAMS; i++) {
  512. for (j=0; j<avi->indexes[i].ents_allocated/AVI_INDEX_CLUSTER_SIZE; j++)
  513. av_free(avi->indexes[i].cluster[j]);
  514. av_free(avi->indexes[i].cluster);
  515. avi->indexes[i].cluster = NULL;
  516. avi->indexes[i].ents_allocated = avi->indexes[i].entry = 0;
  517. }
  518. return res;
  519. }
  520. AVOutputFormat avi_muxer = {
  521. "avi",
  522. NULL_IF_CONFIG_SMALL("AVI format"),
  523. "video/x-msvideo",
  524. "avi",
  525. sizeof(AVIContext),
  526. CODEC_ID_MP2,
  527. CODEC_ID_MPEG4,
  528. avi_write_header,
  529. avi_write_packet,
  530. avi_write_trailer,
  531. .codec_tag= (const AVCodecTag* const []){codec_bmp_tags, codec_wav_tags, 0},
  532. };
  533. #endif //CONFIG_AVI_MUXER