annotate avienc.c @ 6227:78ee17447ff3 libavformat

In av_find_stream_info, decode at least 4 h.264 frames to be able to guess delay.
author bcoudurier
date Sat, 03 Jul 2010 03:07:33 +0000
parents 563496476a23
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
1 /*
1415
3b00fb8ef8e4 replace coder/decoder file description in libavformat by muxer/demuxer
aurel
parents: 1358
diff changeset
2 * AVI muxer
4251
77e0c7511d41 cosmetics: Remove pointless period after copyright statement non-sentences.
diego
parents: 4250
diff changeset
3 * Copyright (c) 2000 Fabrice Bellard
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
4 *
1358
0899bfe4105c Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 1332
diff changeset
5 * This file is part of FFmpeg.
0899bfe4105c Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 1332
diff changeset
6 *
0899bfe4105c Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 1332
diff changeset
7 * FFmpeg is free software; you can redistribute it and/or
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
8 * modify it under the terms of the GNU Lesser General Public
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
9 * License as published by the Free Software Foundation; either
1358
0899bfe4105c Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 1332
diff changeset
10 * version 2.1 of the License, or (at your option) any later version.
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
11 *
1358
0899bfe4105c Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 1332
diff changeset
12 * FFmpeg is distributed in the hope that it will be useful,
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
15 * Lesser General Public License for more details.
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
16 *
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
17 * You should have received a copy of the GNU Lesser General Public
1358
0899bfe4105c Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 1332
diff changeset
18 * License along with FFmpeg; if not, write to the Free Software
896
edbe5c3717f9 Update licensing information: The FSF changed postal address.
diego
parents: 894
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
20 */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
21 #include "avformat.h"
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
22 #include "avi.h"
1172
6a5e58d2114b move common stuff from avienc.c and wav.c to new file riff.c
mru
parents: 1169
diff changeset
23 #include "riff.h"
5633
5d3ac5652047 Add AVI metadata conversion table.
jai_menon
parents: 5631
diff changeset
24 #include "libavutil/intreadwrite.h"
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
25
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
26 /*
885
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 876
diff changeset
27 * TODO:
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
28 * - fill all fields if non streamed (nb_frames for example)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
29 */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
30
119
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
31 typedef struct AVIIentry {
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
32 unsigned int flags, pos, len;
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
33 } AVIIentry;
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
34
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
35 #define AVI_INDEX_CLUSTER_SIZE 16384
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
36
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
37 typedef struct AVIIndex {
3973
549a09cf23fe Remove offset_t typedef and use int64_t directly instead.
diego
parents: 3872
diff changeset
38 int64_t indx_start;
119
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
39 int entry;
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
40 int ents_allocated;
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
41 AVIIentry** cluster;
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
42 } AVIIndex;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
43
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
44 typedef struct {
3973
549a09cf23fe Remove offset_t typedef and use int64_t directly instead.
diego
parents: 3872
diff changeset
45 int64_t riff_start, movi_list, odml_list;
5597
d7c68046a431 Introduce AVIStream struct and move stream based variables to it.
michael
parents: 5058
diff changeset
46 int64_t frames_hdr_all;
119
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
47 int riff_id;
5597
d7c68046a431 Introduce AVIStream struct and move stream based variables to it.
michael
parents: 5058
diff changeset
48 } AVIContext;
119
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
49
5597
d7c68046a431 Introduce AVIStream struct and move stream based variables to it.
michael
parents: 5058
diff changeset
50 typedef struct {
d7c68046a431 Introduce AVIStream struct and move stream based variables to it.
michael
parents: 5058
diff changeset
51 int64_t frames_hdr_strm;
d7c68046a431 Introduce AVIStream struct and move stream based variables to it.
michael
parents: 5058
diff changeset
52 int audio_strm_length;
d7c68046a431 Introduce AVIStream struct and move stream based variables to it.
michael
parents: 5058
diff changeset
53 int packet_count;
5598
cf1aeb986fd2 Remove last MAX_STREAMS from avienc.c
michael
parents: 5597
diff changeset
54 int entry;
5597
d7c68046a431 Introduce AVIStream struct and move stream based variables to it.
michael
parents: 5058
diff changeset
55
d7c68046a431 Introduce AVIStream struct and move stream based variables to it.
michael
parents: 5058
diff changeset
56 AVIIndex indexes;
d7c68046a431 Introduce AVIStream struct and move stream based variables to it.
michael
parents: 5058
diff changeset
57 } AVIStream ;
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
58
885
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 876
diff changeset
59 static inline AVIIentry* avi_get_ientry(AVIIndex* idx, int ent_id)
119
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
60 {
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
61 int cl = ent_id / AVI_INDEX_CLUSTER_SIZE;
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
62 int id = ent_id % AVI_INDEX_CLUSTER_SIZE;
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
63 return &idx->cluster[cl][id];
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
64 }
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
65
5597
d7c68046a431 Introduce AVIStream struct and move stream based variables to it.
michael
parents: 5058
diff changeset
66 static int64_t avi_start_new_riff(AVFormatContext *s, ByteIOContext *pb,
3973
549a09cf23fe Remove offset_t typedef and use int64_t directly instead.
diego
parents: 3872
diff changeset
67 const char* riff_tag, const char* list_tag)
102
c48108fe538e AVI > 2Gb (OpenDML) generation patch by (Roman Shaposhnick <rvs at sun dot com>)
michaelni
parents: 94
diff changeset
68 {
5597
d7c68046a431 Introduce AVIStream struct and move stream based variables to it.
michael
parents: 5058
diff changeset
69 AVIContext *avi= s->priv_data;
3973
549a09cf23fe Remove offset_t typedef and use int64_t directly instead.
diego
parents: 3872
diff changeset
70 int64_t loff;
119
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
71 int i;
885
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 876
diff changeset
72
119
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
73 avi->riff_id++;
5597
d7c68046a431 Introduce AVIStream struct and move stream based variables to it.
michael
parents: 5058
diff changeset
74 for (i=0; i<s->nb_streams; i++){
d7c68046a431 Introduce AVIStream struct and move stream based variables to it.
michael
parents: 5058
diff changeset
75 AVIStream *avist= s->streams[i]->priv_data;
d7c68046a431 Introduce AVIStream struct and move stream based variables to it.
michael
parents: 5058
diff changeset
76 avist->indexes.entry = 0;
d7c68046a431 Introduce AVIStream struct and move stream based variables to it.
michael
parents: 5058
diff changeset
77 }
885
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 876
diff changeset
78
5058
33a244b7ca65 Add ff_ prefixes to exported symbols in libavformat/riff.h.
diego
parents: 5044
diff changeset
79 avi->riff_start = ff_start_tag(pb, "RIFF");
102
c48108fe538e AVI > 2Gb (OpenDML) generation patch by (Roman Shaposhnick <rvs at sun dot com>)
michaelni
parents: 94
diff changeset
80 put_tag(pb, riff_tag);
5058
33a244b7ca65 Add ff_ prefixes to exported symbols in libavformat/riff.h.
diego
parents: 5044
diff changeset
81 loff = ff_start_tag(pb, "LIST");
102
c48108fe538e AVI > 2Gb (OpenDML) generation patch by (Roman Shaposhnick <rvs at sun dot com>)
michaelni
parents: 94
diff changeset
82 put_tag(pb, list_tag);
c48108fe538e AVI > 2Gb (OpenDML) generation patch by (Roman Shaposhnick <rvs at sun dot com>)
michaelni
parents: 94
diff changeset
83 return loff;
c48108fe538e AVI > 2Gb (OpenDML) generation patch by (Roman Shaposhnick <rvs at sun dot com>)
michaelni
parents: 94
diff changeset
84 }
c48108fe538e AVI > 2Gb (OpenDML) generation patch by (Roman Shaposhnick <rvs at sun dot com>)
michaelni
parents: 94
diff changeset
85
5910
536e5527c1e0 Define AVMediaType enum, and use it instead of enum CodecType, which
stefano
parents: 5661
diff changeset
86 static char* avi_stream2fourcc(char* tag, int index, enum AVMediaType type)
119
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
87 {
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
88 tag[0] = '0';
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
89 tag[1] = '0' + index;
5910
536e5527c1e0 Define AVMediaType enum, and use it instead of enum CodecType, which
stefano
parents: 5661
diff changeset
90 if (type == AVMEDIA_TYPE_VIDEO) {
119
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
91 tag[2] = 'd';
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
92 tag[3] = 'c';
5910
536e5527c1e0 Define AVMediaType enum, and use it instead of enum CodecType, which
stefano
parents: 5661
diff changeset
93 } else if (type == AVMEDIA_TYPE_SUBTITLE) {
5044
2ef633b32f7a Add support for muxing XSUB subtitles to AVI muxer.
reimar
parents: 4816
diff changeset
94 // note: this is not an official code
2ef633b32f7a Add support for muxing XSUB subtitles to AVI muxer.
reimar
parents: 4816
diff changeset
95 tag[2] = 's';
2ef633b32f7a Add support for muxing XSUB subtitles to AVI muxer.
reimar
parents: 4816
diff changeset
96 tag[3] = 'b';
119
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
97 } else {
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
98 tag[2] = 'w';
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
99 tag[3] = 'b';
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
100 }
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
101 tag[4] = '\0';
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
102 return tag;
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
103 }
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
104
1256
2cddf00f92a6 AVI tag reading and writing patch by David Conrad.
banan
parents: 1172
diff changeset
105 static void avi_write_info_tag(ByteIOContext *pb, const char *tag, const char *str)
2cddf00f92a6 AVI tag reading and writing patch by David Conrad.
banan
parents: 1172
diff changeset
106 {
2cddf00f92a6 AVI tag reading and writing patch by David Conrad.
banan
parents: 1172
diff changeset
107 int len = strlen(str);
2cddf00f92a6 AVI tag reading and writing patch by David Conrad.
banan
parents: 1172
diff changeset
108 if (len > 0) {
2cddf00f92a6 AVI tag reading and writing patch by David Conrad.
banan
parents: 1172
diff changeset
109 len++;
2cddf00f92a6 AVI tag reading and writing patch by David Conrad.
banan
parents: 1172
diff changeset
110 put_tag(pb, tag);
2cddf00f92a6 AVI tag reading and writing patch by David Conrad.
banan
parents: 1172
diff changeset
111 put_le32(pb, len);
2cddf00f92a6 AVI tag reading and writing patch by David Conrad.
banan
parents: 1172
diff changeset
112 put_strz(pb, str);
2cddf00f92a6 AVI tag reading and writing patch by David Conrad.
banan
parents: 1172
diff changeset
113 if (len & 1)
2cddf00f92a6 AVI tag reading and writing patch by David Conrad.
banan
parents: 1172
diff changeset
114 put_byte(pb, 0);
2cddf00f92a6 AVI tag reading and writing patch by David Conrad.
banan
parents: 1172
diff changeset
115 }
2cddf00f92a6 AVI tag reading and writing patch by David Conrad.
banan
parents: 1172
diff changeset
116 }
2cddf00f92a6 AVI tag reading and writing patch by David Conrad.
banan
parents: 1172
diff changeset
117
1267
47ade5d414f9 fix ODML AVI Duration for files > 2GB
gpoirier
parents: 1256
diff changeset
118 static int avi_write_counters(AVFormatContext* s, int riff_id)
47ade5d414f9 fix ODML AVI Duration for files > 2GB
gpoirier
parents: 1256
diff changeset
119 {
2771
d52c718e83f9 Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents: 2227
diff changeset
120 ByteIOContext *pb = s->pb;
1267
47ade5d414f9 fix ODML AVI Duration for files > 2GB
gpoirier
parents: 1256
diff changeset
121 AVIContext *avi = s->priv_data;
47ade5d414f9 fix ODML AVI Duration for files > 2GB
gpoirier
parents: 1256
diff changeset
122 int n, au_byterate, au_ssize, au_scale, nb_frames = 0;
3973
549a09cf23fe Remove offset_t typedef and use int64_t directly instead.
diego
parents: 3872
diff changeset
123 int64_t file_size;
1267
47ade5d414f9 fix ODML AVI Duration for files > 2GB
gpoirier
parents: 1256
diff changeset
124 AVCodecContext* stream;
47ade5d414f9 fix ODML AVI Duration for files > 2GB
gpoirier
parents: 1256
diff changeset
125
47ade5d414f9 fix ODML AVI Duration for files > 2GB
gpoirier
parents: 1256
diff changeset
126 file_size = url_ftell(pb);
47ade5d414f9 fix ODML AVI Duration for files > 2GB
gpoirier
parents: 1256
diff changeset
127 for(n = 0; n < s->nb_streams; n++) {
5597
d7c68046a431 Introduce AVIStream struct and move stream based variables to it.
michael
parents: 5058
diff changeset
128 AVIStream *avist= s->streams[n]->priv_data;
d7c68046a431 Introduce AVIStream struct and move stream based variables to it.
michael
parents: 5058
diff changeset
129
d7c68046a431 Introduce AVIStream struct and move stream based variables to it.
michael
parents: 5058
diff changeset
130 assert(avist->frames_hdr_strm);
1267
47ade5d414f9 fix ODML AVI Duration for files > 2GB
gpoirier
parents: 1256
diff changeset
131 stream = s->streams[n]->codec;
5597
d7c68046a431 Introduce AVIStream struct and move stream based variables to it.
michael
parents: 5058
diff changeset
132 url_fseek(pb, avist->frames_hdr_strm, SEEK_SET);
1267
47ade5d414f9 fix ODML AVI Duration for files > 2GB
gpoirier
parents: 1256
diff changeset
133 ff_parse_specific_params(stream, &au_byterate, &au_ssize, &au_scale);
47ade5d414f9 fix ODML AVI Duration for files > 2GB
gpoirier
parents: 1256
diff changeset
134 if(au_ssize == 0) {
5597
d7c68046a431 Introduce AVIStream struct and move stream based variables to it.
michael
parents: 5058
diff changeset
135 put_le32(pb, avist->packet_count);
1267
47ade5d414f9 fix ODML AVI Duration for files > 2GB
gpoirier
parents: 1256
diff changeset
136 } else {
5597
d7c68046a431 Introduce AVIStream struct and move stream based variables to it.
michael
parents: 5058
diff changeset
137 put_le32(pb, avist->audio_strm_length / au_ssize);
1267
47ade5d414f9 fix ODML AVI Duration for files > 2GB
gpoirier
parents: 1256
diff changeset
138 }
5910
536e5527c1e0 Define AVMediaType enum, and use it instead of enum CodecType, which
stefano
parents: 5661
diff changeset
139 if(stream->codec_type == AVMEDIA_TYPE_VIDEO)
5597
d7c68046a431 Introduce AVIStream struct and move stream based variables to it.
michael
parents: 5058
diff changeset
140 nb_frames = FFMAX(nb_frames, avist->packet_count);
1267
47ade5d414f9 fix ODML AVI Duration for files > 2GB
gpoirier
parents: 1256
diff changeset
141 }
47ade5d414f9 fix ODML AVI Duration for files > 2GB
gpoirier
parents: 1256
diff changeset
142 if(riff_id == 1) {
47ade5d414f9 fix ODML AVI Duration for files > 2GB
gpoirier
parents: 1256
diff changeset
143 assert(avi->frames_hdr_all);
47ade5d414f9 fix ODML AVI Duration for files > 2GB
gpoirier
parents: 1256
diff changeset
144 url_fseek(pb, avi->frames_hdr_all, SEEK_SET);
47ade5d414f9 fix ODML AVI Duration for files > 2GB
gpoirier
parents: 1256
diff changeset
145 put_le32(pb, nb_frames);
47ade5d414f9 fix ODML AVI Duration for files > 2GB
gpoirier
parents: 1256
diff changeset
146 }
47ade5d414f9 fix ODML AVI Duration for files > 2GB
gpoirier
parents: 1256
diff changeset
147 url_fseek(pb, file_size, SEEK_SET);
47ade5d414f9 fix ODML AVI Duration for files > 2GB
gpoirier
parents: 1256
diff changeset
148
47ade5d414f9 fix ODML AVI Duration for files > 2GB
gpoirier
parents: 1256
diff changeset
149 return 0;
47ade5d414f9 fix ODML AVI Duration for files > 2GB
gpoirier
parents: 1256
diff changeset
150 }
47ade5d414f9 fix ODML AVI Duration for files > 2GB
gpoirier
parents: 1256
diff changeset
151
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
152 static int avi_write_header(AVFormatContext *s)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
153 {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
154 AVIContext *avi = s->priv_data;
2771
d52c718e83f9 Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents: 2227
diff changeset
155 ByteIOContext *pb = s->pb;
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
156 int bitrate, n, i, nb_frames, au_byterate, au_ssize, au_scale;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
157 AVCodecContext *stream, *video_enc;
3973
549a09cf23fe Remove offset_t typedef and use int64_t directly instead.
diego
parents: 3872
diff changeset
158 int64_t list1, list2, strh, strf;
5633
5d3ac5652047 Add AVI metadata conversion table.
jai_menon
parents: 5631
diff changeset
159 AVMetadataTag *t = NULL;
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
160
5597
d7c68046a431 Introduce AVIStream struct and move stream based variables to it.
michael
parents: 5058
diff changeset
161 for(n=0;n<s->nb_streams;n++) {
d7c68046a431 Introduce AVIStream struct and move stream based variables to it.
michael
parents: 5058
diff changeset
162 s->streams[n]->priv_data= av_mallocz(sizeof(AVIStream));
d7c68046a431 Introduce AVIStream struct and move stream based variables to it.
michael
parents: 5058
diff changeset
163 if(!s->streams[n]->priv_data)
d7c68046a431 Introduce AVIStream struct and move stream based variables to it.
michael
parents: 5058
diff changeset
164 return AVERROR(ENOMEM);
d7c68046a431 Introduce AVIStream struct and move stream based variables to it.
michael
parents: 5058
diff changeset
165 }
d7c68046a431 Introduce AVIStream struct and move stream based variables to it.
michael
parents: 5058
diff changeset
166
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
167 /* header list */
119
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
168 avi->riff_id = 0;
5597
d7c68046a431 Introduce AVIStream struct and move stream based variables to it.
michael
parents: 5058
diff changeset
169 list1 = avi_start_new_riff(s, pb, "AVI ", "hdrl");
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
170
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
171 /* avi header */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
172 put_tag(pb, "avih");
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
173 put_le32(pb, 14 * 4);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
174 bitrate = 0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
175
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
176 video_enc = NULL;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
177 for(n=0;n<s->nb_streams;n++) {
820
feca73904e67 changing AVCodecContext codec -> *codec in AVStream so additions to AVCodecContext dont randomize AVStream and break binary compatibility
michael
parents: 796
diff changeset
178 stream = s->streams[n]->codec;
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
179 bitrate += stream->bit_rate;
5910
536e5527c1e0 Define AVMediaType enum, and use it instead of enum CodecType, which
stefano
parents: 5661
diff changeset
180 if (stream->codec_type == AVMEDIA_TYPE_VIDEO)
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
181 video_enc = stream;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
182 }
885
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 876
diff changeset
183
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
184 nb_frames = 0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
185
36
1188ad85857a audio only avi patch by (Andriy Rysin <arysin at bcsii dot net>)
michaelni
parents: 15
diff changeset
186 if(video_enc){
1556
65b7b3ff4ed7 use the standard INT64_C() macro for 64-bit constants
mru
parents: 1443
diff changeset
187 put_le32(pb, (uint32_t)(INT64_C(1000000) * video_enc->time_base.num / video_enc->time_base.den));
36
1188ad85857a audio only avi patch by (Andriy Rysin <arysin at bcsii dot net>)
michaelni
parents: 15
diff changeset
188 } else {
887
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
189 put_le32(pb, 0);
36
1188ad85857a audio only avi patch by (Andriy Rysin <arysin at bcsii dot net>)
michaelni
parents: 15
diff changeset
190 }
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
191 put_le32(pb, bitrate / 8); /* XXX: not quite exact */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
192 put_le32(pb, 0); /* padding */
873
7af647503b67 Support for streaming: dont write indexes and dont signal HAS_INDEX in header. Also set filesize to max in this case.
alex
parents: 863
diff changeset
193 if (url_is_streamed(pb))
887
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
194 put_le32(pb, AVIF_TRUSTCKTYPE | AVIF_ISINTERLEAVED); /* flags */
873
7af647503b67 Support for streaming: dont write indexes and dont signal HAS_INDEX in header. Also set filesize to max in this case.
alex
parents: 863
diff changeset
195 else
887
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
196 put_le32(pb, AVIF_TRUSTCKTYPE | AVIF_HASINDEX | AVIF_ISINTERLEAVED); /* flags */
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
197 avi->frames_hdr_all = url_ftell(pb); /* remember this offset to fill later */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
198 put_le32(pb, nb_frames); /* nb frames, filled later */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
199 put_le32(pb, 0); /* initial frame */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
200 put_le32(pb, s->nb_streams); /* nb streams */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
201 put_le32(pb, 1024 * 1024); /* suggested buffer size */
885
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 876
diff changeset
202 if(video_enc){
992
d54472fc2d04 indention
michael
parents: 978
diff changeset
203 put_le32(pb, video_enc->width);
d54472fc2d04 indention
michael
parents: 978
diff changeset
204 put_le32(pb, video_enc->height);
36
1188ad85857a audio only avi patch by (Andriy Rysin <arysin at bcsii dot net>)
michaelni
parents: 15
diff changeset
205 } else {
887
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
206 put_le32(pb, 0);
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
207 put_le32(pb, 0);
885
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 876
diff changeset
208 }
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
209 put_le32(pb, 0); /* reserved */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
210 put_le32(pb, 0); /* reserved */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
211 put_le32(pb, 0); /* reserved */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
212 put_le32(pb, 0); /* reserved */
885
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 876
diff changeset
213
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
214 /* stream list */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
215 for(i=0;i<n;i++) {
5597
d7c68046a431 Introduce AVIStream struct and move stream based variables to it.
michael
parents: 5058
diff changeset
216 AVIStream *avist= s->streams[i]->priv_data;
5058
33a244b7ca65 Add ff_ prefixes to exported symbols in libavformat/riff.h.
diego
parents: 5044
diff changeset
217 list2 = ff_start_tag(pb, "LIST");
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
218 put_tag(pb, "strl");
885
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 876
diff changeset
219
820
feca73904e67 changing AVCodecContext codec -> *codec in AVStream so additions to AVCodecContext dont randomize AVStream and break binary compatibility
michael
parents: 796
diff changeset
220 stream = s->streams[i]->codec;
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
221
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
222 /* stream generic header */
5058
33a244b7ca65 Add ff_ prefixes to exported symbols in libavformat/riff.h.
diego
parents: 5044
diff changeset
223 strh = ff_start_tag(pb, "strh");
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
224 switch(stream->codec_type) {
5910
536e5527c1e0 Define AVMediaType enum, and use it instead of enum CodecType, which
stefano
parents: 5661
diff changeset
225 case AVMEDIA_TYPE_SUBTITLE:
5044
2ef633b32f7a Add support for muxing XSUB subtitles to AVI muxer.
reimar
parents: 4816
diff changeset
226 // XSUB subtitles behave like video tracks, other subtitles
2ef633b32f7a Add support for muxing XSUB subtitles to AVI muxer.
reimar
parents: 4816
diff changeset
227 // are not (yet) supported.
6174
563496476a23 avienc : Avoid creating invalid AVI files when muxing subtitle streams
jai_menon
parents: 5913
diff changeset
228 if (stream->codec_id != CODEC_ID_XSUB) {
563496476a23 avienc : Avoid creating invalid AVI files when muxing subtitle streams
jai_menon
parents: 5913
diff changeset
229 av_log(s, AV_LOG_ERROR, "Subtitle streams other than DivX XSUB are not supported by the AVI muxer.\n");
563496476a23 avienc : Avoid creating invalid AVI files when muxing subtitle streams
jai_menon
parents: 5913
diff changeset
230 return AVERROR_PATCHWELCOME;
563496476a23 avienc : Avoid creating invalid AVI files when muxing subtitle streams
jai_menon
parents: 5913
diff changeset
231 }
5910
536e5527c1e0 Define AVMediaType enum, and use it instead of enum CodecType, which
stefano
parents: 5661
diff changeset
232 case AVMEDIA_TYPE_VIDEO: put_tag(pb, "vids"); break;
536e5527c1e0 Define AVMediaType enum, and use it instead of enum CodecType, which
stefano
parents: 5661
diff changeset
233 case AVMEDIA_TYPE_AUDIO: put_tag(pb, "auds"); break;
536e5527c1e0 Define AVMediaType enum, and use it instead of enum CodecType, which
stefano
parents: 5661
diff changeset
234 // case AVMEDIA_TYPE_TEXT : put_tag(pb, "txts"); break;
536e5527c1e0 Define AVMediaType enum, and use it instead of enum CodecType, which
stefano
parents: 5661
diff changeset
235 case AVMEDIA_TYPE_DATA : put_tag(pb, "dats"); break;
781
ba478112ecb1 a step toward CODEC_TYPE_DATA support
michael
parents: 763
diff changeset
236 }
5910
536e5527c1e0 Define AVMediaType enum, and use it instead of enum CodecType, which
stefano
parents: 5661
diff changeset
237 if(stream->codec_type == AVMEDIA_TYPE_VIDEO ||
5044
2ef633b32f7a Add support for muxing XSUB subtitles to AVI muxer.
reimar
parents: 4816
diff changeset
238 stream->codec_id == CODEC_ID_XSUB)
89
8e3cf4e9fc5a rawvideo patch by (Fred Rothganger <rothgang at uiuc dot edu>)
michaelni
parents: 85
diff changeset
239 put_le32(pb, stream->codec_tag);
781
ba478112ecb1 a step toward CODEC_TYPE_DATA support
michael
parents: 763
diff changeset
240 else
ba478112ecb1 a step toward CODEC_TYPE_DATA support
michael
parents: 763
diff changeset
241 put_le32(pb, 1);
ba478112ecb1 a step toward CODEC_TYPE_DATA support
michael
parents: 763
diff changeset
242 put_le32(pb, 0); /* flags */
ba478112ecb1 a step toward CODEC_TYPE_DATA support
michael
parents: 763
diff changeset
243 put_le16(pb, 0); /* priority */
ba478112ecb1 a step toward CODEC_TYPE_DATA support
michael
parents: 763
diff changeset
244 put_le16(pb, 0); /* language */
ba478112ecb1 a step toward CODEC_TYPE_DATA support
michael
parents: 763
diff changeset
245 put_le32(pb, 0); /* initial frame */
ba478112ecb1 a step toward CODEC_TYPE_DATA support
michael
parents: 763
diff changeset
246
ba478112ecb1 a step toward CODEC_TYPE_DATA support
michael
parents: 763
diff changeset
247 ff_parse_specific_params(stream, &au_byterate, &au_ssize, &au_scale);
75
78bec272ce3a read BITMAPINFOHEADER extra stuff (huffyuv decoding fixed)
michaelni
parents: 65
diff changeset
248
781
ba478112ecb1 a step toward CODEC_TYPE_DATA support
michael
parents: 763
diff changeset
249 put_le32(pb, au_scale); /* scale */
ba478112ecb1 a step toward CODEC_TYPE_DATA support
michael
parents: 763
diff changeset
250 put_le32(pb, au_byterate); /* rate */
ba478112ecb1 a step toward CODEC_TYPE_DATA support
michael
parents: 763
diff changeset
251 av_set_pts_info(s->streams[i], 64, au_scale, au_byterate);
ba478112ecb1 a step toward CODEC_TYPE_DATA support
michael
parents: 763
diff changeset
252
ba478112ecb1 a step toward CODEC_TYPE_DATA support
michael
parents: 763
diff changeset
253 put_le32(pb, 0); /* start */
5597
d7c68046a431 Introduce AVIStream struct and move stream based variables to it.
michael
parents: 5058
diff changeset
254 avist->frames_hdr_strm = url_ftell(pb); /* remember this offset to fill later */
887
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
255 if (url_is_streamed(pb))
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
256 put_le32(pb, AVI_MAX_RIFF_SIZE); /* FIXME: this may be broken, but who cares */
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
257 else
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
258 put_le32(pb, 0); /* length, XXX: filled later */
885
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 876
diff changeset
259
781
ba478112ecb1 a step toward CODEC_TYPE_DATA support
michael
parents: 763
diff changeset
260 /* suggested buffer size */ //FIXME set at the end to largest chunk
5910
536e5527c1e0 Define AVMediaType enum, and use it instead of enum CodecType, which
stefano
parents: 5661
diff changeset
261 if(stream->codec_type == AVMEDIA_TYPE_VIDEO)
885
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 876
diff changeset
262 put_le32(pb, 1024 * 1024);
5910
536e5527c1e0 Define AVMediaType enum, and use it instead of enum CodecType, which
stefano
parents: 5661
diff changeset
263 else if(stream->codec_type == AVMEDIA_TYPE_AUDIO)
885
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 876
diff changeset
264 put_le32(pb, 12 * 1024);
781
ba478112ecb1 a step toward CODEC_TYPE_DATA support
michael
parents: 763
diff changeset
265 else
885
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 876
diff changeset
266 put_le32(pb, 0);
781
ba478112ecb1 a step toward CODEC_TYPE_DATA support
michael
parents: 763
diff changeset
267 put_le32(pb, -1); /* quality */
ba478112ecb1 a step toward CODEC_TYPE_DATA support
michael
parents: 763
diff changeset
268 put_le32(pb, au_ssize); /* sample size */
ba478112ecb1 a step toward CODEC_TYPE_DATA support
michael
parents: 763
diff changeset
269 put_le32(pb, 0);
ba478112ecb1 a step toward CODEC_TYPE_DATA support
michael
parents: 763
diff changeset
270 put_le16(pb, stream->width);
ba478112ecb1 a step toward CODEC_TYPE_DATA support
michael
parents: 763
diff changeset
271 put_le16(pb, stream->height);
5058
33a244b7ca65 Add ff_ prefixes to exported symbols in libavformat/riff.h.
diego
parents: 5044
diff changeset
272 ff_end_tag(pb, strh);
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
273
5910
536e5527c1e0 Define AVMediaType enum, and use it instead of enum CodecType, which
stefano
parents: 5661
diff changeset
274 if(stream->codec_type != AVMEDIA_TYPE_DATA){
5058
33a244b7ca65 Add ff_ prefixes to exported symbols in libavformat/riff.h.
diego
parents: 5044
diff changeset
275 strf = ff_start_tag(pb, "strf");
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
276 switch(stream->codec_type) {
5910
536e5527c1e0 Define AVMediaType enum, and use it instead of enum CodecType, which
stefano
parents: 5661
diff changeset
277 case AVMEDIA_TYPE_SUBTITLE:
5044
2ef633b32f7a Add support for muxing XSUB subtitles to AVI muxer.
reimar
parents: 4816
diff changeset
278 // XSUB subtitles behave like video tracks, other subtitles
2ef633b32f7a Add support for muxing XSUB subtitles to AVI muxer.
reimar
parents: 4816
diff changeset
279 // are not (yet) supported.
2ef633b32f7a Add support for muxing XSUB subtitles to AVI muxer.
reimar
parents: 4816
diff changeset
280 if (stream->codec_id != CODEC_ID_XSUB) break;
5910
536e5527c1e0 Define AVMediaType enum, and use it instead of enum CodecType, which
stefano
parents: 5661
diff changeset
281 case AVMEDIA_TYPE_VIDEO:
5058
33a244b7ca65 Add ff_ prefixes to exported symbols in libavformat/riff.h.
diego
parents: 5044
diff changeset
282 ff_put_bmp_header(pb, stream, ff_codec_bmp_tags, 0);
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
283 break;
5910
536e5527c1e0 Define AVMediaType enum, and use it instead of enum CodecType, which
stefano
parents: 5661
diff changeset
284 case AVMEDIA_TYPE_AUDIO:
5058
33a244b7ca65 Add ff_ prefixes to exported symbols in libavformat/riff.h.
diego
parents: 5044
diff changeset
285 if (ff_put_wav_header(pb, stream) < 0) {
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
286 return -1;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
287 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
288 break;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
289 default:
537
558a093b04db do not call (av_)abort()
michael
parents: 521
diff changeset
290 return -1;
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
291 }
5058
33a244b7ca65 Add ff_ prefixes to exported symbols in libavformat/riff.h.
diego
parents: 5044
diff changeset
292 ff_end_tag(pb, strf);
5633
5d3ac5652047 Add AVI metadata conversion table.
jai_menon
parents: 5631
diff changeset
293 if ((t = av_metadata_get(s->streams[i]->metadata, "strn", NULL, 0))) {
5d3ac5652047 Add AVI metadata conversion table.
jai_menon
parents: 5631
diff changeset
294 avi_write_info_tag(s->pb, t->key, t->value);
5d3ac5652047 Add AVI metadata conversion table.
jai_menon
parents: 5631
diff changeset
295 t = NULL;
5d3ac5652047 Add AVI metadata conversion table.
jai_menon
parents: 5631
diff changeset
296 }
5d3ac5652047 Add AVI metadata conversion table.
jai_menon
parents: 5631
diff changeset
297 //FIXME a limitation of metadata conversion system
5d3ac5652047 Add AVI metadata conversion table.
jai_menon
parents: 5631
diff changeset
298 else if ((t = av_metadata_get(s->streams[i]->metadata, "INAM", NULL, 0))) {
5d3ac5652047 Add AVI metadata conversion table.
jai_menon
parents: 5631
diff changeset
299 avi_write_info_tag(s->pb, "strn", t->value);
5d3ac5652047 Add AVI metadata conversion table.
jai_menon
parents: 5631
diff changeset
300 t = NULL;
5d3ac5652047 Add AVI metadata conversion table.
jai_menon
parents: 5631
diff changeset
301 }
781
ba478112ecb1 a step toward CODEC_TYPE_DATA support
michael
parents: 763
diff changeset
302 }
885
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 876
diff changeset
303
887
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
304 if (!url_is_streamed(pb)) {
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
305 unsigned char tag[5];
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
306 int j;
885
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 876
diff changeset
307
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 876
diff changeset
308 /* Starting to lay out AVI OpenDML master index.
887
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
309 * We want to make it JUNK entry for now, since we'd
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
310 * like to get away without making AVI an OpenDML one
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
311 * for compatibility reasons.
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
312 */
5597
d7c68046a431 Introduce AVIStream struct and move stream based variables to it.
michael
parents: 5058
diff changeset
313 avist->indexes.entry = avist->indexes.ents_allocated = 0;
d7c68046a431 Introduce AVIStream struct and move stream based variables to it.
michael
parents: 5058
diff changeset
314 avist->indexes.indx_start = ff_start_tag(pb, "JUNK");
887
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
315 put_le16(pb, 4); /* wLongsPerEntry */
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
316 put_byte(pb, 0); /* bIndexSubType (0 == frame index) */
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
317 put_byte(pb, 0); /* bIndexType (0 == AVI_INDEX_OF_INDEXES) */
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
318 put_le32(pb, 0); /* nEntriesInUse (will fill out later on) */
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
319 put_tag(pb, avi_stream2fourcc(&tag[0], i, stream->codec_type));
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
320 /* dwChunkId */
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
321 put_le64(pb, 0); /* dwReserved[3]
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
322 put_le32(pb, 0); Must be 0. */
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
323 for (j=0; j < AVI_MASTER_INDEX_SIZE * 2; j++)
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
324 put_le64(pb, 0);
5597
d7c68046a431 Introduce AVIStream struct and move stream based variables to it.
michael
parents: 5058
diff changeset
325 ff_end_tag(pb, avist->indexes.indx_start);
887
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
326 }
885
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 876
diff changeset
327
5910
536e5527c1e0 Define AVMediaType enum, and use it instead of enum CodecType, which
stefano
parents: 5661
diff changeset
328 if( stream->codec_type == AVMEDIA_TYPE_VIDEO
3759
27537074f2a9 convert every muxer/demuxer to write/read sample_aspect_ratio from/to
aurel
parents: 3424
diff changeset
329 && s->streams[i]->sample_aspect_ratio.num>0
27537074f2a9 convert every muxer/demuxer to write/read sample_aspect_ratio from/to
aurel
parents: 3424
diff changeset
330 && s->streams[i]->sample_aspect_ratio.den>0){
5058
33a244b7ca65 Add ff_ prefixes to exported symbols in libavformat/riff.h.
diego
parents: 5044
diff changeset
331 int vprp= ff_start_tag(pb, "vprp");
3759
27537074f2a9 convert every muxer/demuxer to write/read sample_aspect_ratio from/to
aurel
parents: 3424
diff changeset
332 AVRational dar = av_mul_q(s->streams[i]->sample_aspect_ratio,
3100
5f769b20cc76 Store aspect ratio in avis.
michael
parents: 2771
diff changeset
333 (AVRational){stream->width, stream->height});
5f769b20cc76 Store aspect ratio in avis.
michael
parents: 2771
diff changeset
334 int num, den;
5f769b20cc76 Store aspect ratio in avis.
michael
parents: 2771
diff changeset
335 av_reduce(&num, &den, dar.num, dar.den, 0xFFFF);
5f769b20cc76 Store aspect ratio in avis.
michael
parents: 2771
diff changeset
336
5f769b20cc76 Store aspect ratio in avis.
michael
parents: 2771
diff changeset
337 put_le32(pb, 0); //video format = unknown
5f769b20cc76 Store aspect ratio in avis.
michael
parents: 2771
diff changeset
338 put_le32(pb, 0); //video standard= unknown
5f769b20cc76 Store aspect ratio in avis.
michael
parents: 2771
diff changeset
339 put_le32(pb, lrintf(1.0/av_q2d(stream->time_base)));
5f769b20cc76 Store aspect ratio in avis.
michael
parents: 2771
diff changeset
340 put_le32(pb, stream->width );
5f769b20cc76 Store aspect ratio in avis.
michael
parents: 2771
diff changeset
341 put_le32(pb, stream->height);
3177
f5ee8f2afc83 Fix aspect ratio.
michael
parents: 3100
diff changeset
342 put_le16(pb, den);
3100
5f769b20cc76 Store aspect ratio in avis.
michael
parents: 2771
diff changeset
343 put_le16(pb, num);
5f769b20cc76 Store aspect ratio in avis.
michael
parents: 2771
diff changeset
344 put_le32(pb, stream->width );
5f769b20cc76 Store aspect ratio in avis.
michael
parents: 2771
diff changeset
345 put_le32(pb, stream->height);
5f769b20cc76 Store aspect ratio in avis.
michael
parents: 2771
diff changeset
346 put_le32(pb, 1); //progressive FIXME
5f769b20cc76 Store aspect ratio in avis.
michael
parents: 2771
diff changeset
347
5f769b20cc76 Store aspect ratio in avis.
michael
parents: 2771
diff changeset
348 put_le32(pb, stream->height);
5f769b20cc76 Store aspect ratio in avis.
michael
parents: 2771
diff changeset
349 put_le32(pb, stream->width );
5f769b20cc76 Store aspect ratio in avis.
michael
parents: 2771
diff changeset
350 put_le32(pb, stream->height);
5f769b20cc76 Store aspect ratio in avis.
michael
parents: 2771
diff changeset
351 put_le32(pb, stream->width );
5f769b20cc76 Store aspect ratio in avis.
michael
parents: 2771
diff changeset
352 put_le32(pb, 0);
5f769b20cc76 Store aspect ratio in avis.
michael
parents: 2771
diff changeset
353 put_le32(pb, 0);
5f769b20cc76 Store aspect ratio in avis.
michael
parents: 2771
diff changeset
354
5f769b20cc76 Store aspect ratio in avis.
michael
parents: 2771
diff changeset
355 put_le32(pb, 0);
5f769b20cc76 Store aspect ratio in avis.
michael
parents: 2771
diff changeset
356 put_le32(pb, 0);
5058
33a244b7ca65 Add ff_ prefixes to exported symbols in libavformat/riff.h.
diego
parents: 5044
diff changeset
357 ff_end_tag(pb, vprp);
3100
5f769b20cc76 Store aspect ratio in avis.
michael
parents: 2771
diff changeset
358 }
5f769b20cc76 Store aspect ratio in avis.
michael
parents: 2771
diff changeset
359
5058
33a244b7ca65 Add ff_ prefixes to exported symbols in libavformat/riff.h.
diego
parents: 5044
diff changeset
360 ff_end_tag(pb, list2);
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
361 }
885
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 876
diff changeset
362
119
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
363 if (!url_is_streamed(pb)) {
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
364 /* AVI could become an OpenDML one, if it grows beyond 2Gb range */
5058
33a244b7ca65 Add ff_ prefixes to exported symbols in libavformat/riff.h.
diego
parents: 5044
diff changeset
365 avi->odml_list = ff_start_tag(pb, "JUNK");
119
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
366 put_tag(pb, "odml");
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
367 put_tag(pb, "dmlh");
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
368 put_le32(pb, 248);
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
369 for (i = 0; i < 248; i+= 4)
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
370 put_le32(pb, 0);
5058
33a244b7ca65 Add ff_ prefixes to exported symbols in libavformat/riff.h.
diego
parents: 5044
diff changeset
371 ff_end_tag(pb, avi->odml_list);
119
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
372 }
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
373
5058
33a244b7ca65 Add ff_ prefixes to exported symbols in libavformat/riff.h.
diego
parents: 5044
diff changeset
374 ff_end_tag(pb, list1);
885
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 876
diff changeset
375
5058
33a244b7ca65 Add ff_ prefixes to exported symbols in libavformat/riff.h.
diego
parents: 5044
diff changeset
376 list2 = ff_start_tag(pb, "LIST");
1256
2cddf00f92a6 AVI tag reading and writing patch by David Conrad.
banan
parents: 1172
diff changeset
377 put_tag(pb, "INFO");
5633
5d3ac5652047 Add AVI metadata conversion table.
jai_menon
parents: 5631
diff changeset
378 for (i = 0; *ff_avi_tags[i]; i++) {
5d3ac5652047 Add AVI metadata conversion table.
jai_menon
parents: 5631
diff changeset
379 if ((t = av_metadata_get(s->metadata, ff_avi_tags[i], NULL, AV_METADATA_MATCH_CASE)))
5d3ac5652047 Add AVI metadata conversion table.
jai_menon
parents: 5631
diff changeset
380 avi_write_info_tag(s->pb, t->key, t->value);
5d3ac5652047 Add AVI metadata conversion table.
jai_menon
parents: 5631
diff changeset
381 }
5058
33a244b7ca65 Add ff_ prefixes to exported symbols in libavformat/riff.h.
diego
parents: 5044
diff changeset
382 ff_end_tag(pb, list2);
1256
2cddf00f92a6 AVI tag reading and writing patch by David Conrad.
banan
parents: 1172
diff changeset
383
2cddf00f92a6 AVI tag reading and writing patch by David Conrad.
banan
parents: 1172
diff changeset
384 /* some padding for easier tag editing */
5058
33a244b7ca65 Add ff_ prefixes to exported symbols in libavformat/riff.h.
diego
parents: 5044
diff changeset
385 list2 = ff_start_tag(pb, "JUNK");
1256
2cddf00f92a6 AVI tag reading and writing patch by David Conrad.
banan
parents: 1172
diff changeset
386 for (i = 0; i < 1016; i += 4)
2cddf00f92a6 AVI tag reading and writing patch by David Conrad.
banan
parents: 1172
diff changeset
387 put_le32(pb, 0);
5058
33a244b7ca65 Add ff_ prefixes to exported symbols in libavformat/riff.h.
diego
parents: 5044
diff changeset
388 ff_end_tag(pb, list2);
1256
2cddf00f92a6 AVI tag reading and writing patch by David Conrad.
banan
parents: 1172
diff changeset
389
5058
33a244b7ca65 Add ff_ prefixes to exported symbols in libavformat/riff.h.
diego
parents: 5044
diff changeset
390 avi->movi_list = ff_start_tag(pb, "LIST");
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
391 put_tag(pb, "movi");
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
392
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
393 put_flush_packet(pb);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
394
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
395 return 0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
396 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
397
119
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
398 static int avi_write_ix(AVFormatContext *s)
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
399 {
2771
d52c718e83f9 Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents: 2227
diff changeset
400 ByteIOContext *pb = s->pb;
119
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
401 AVIContext *avi = s->priv_data;
1332
7474cc6383d4 fix some signedness warnings
mru
parents: 1297
diff changeset
402 char tag[5];
7474cc6383d4 fix some signedness warnings
mru
parents: 1297
diff changeset
403 char ix_tag[] = "ix00";
119
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
404 int i, j;
885
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 876
diff changeset
405
976
c4a67d8fa68f replace if by assert as it should never by true
michael
parents: 969
diff changeset
406 assert(!url_is_streamed(pb));
873
7af647503b67 Support for streaming: dont write indexes and dont signal HAS_INDEX in header. Also set filesize to max in this case.
alex
parents: 863
diff changeset
407
119
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
408 if (avi->riff_id > AVI_MASTER_INDEX_SIZE)
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
409 return -1;
885
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 876
diff changeset
410
119
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
411 for (i=0;i<s->nb_streams;i++) {
5597
d7c68046a431 Introduce AVIStream struct and move stream based variables to it.
michael
parents: 5058
diff changeset
412 AVIStream *avist= s->streams[i]->priv_data;
3973
549a09cf23fe Remove offset_t typedef and use int64_t directly instead.
diego
parents: 3872
diff changeset
413 int64_t ix, pos;
885
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 876
diff changeset
414
887
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
415 avi_stream2fourcc(&tag[0], i, s->streams[i]->codec->codec_type);
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
416 ix_tag[3] = '0' + i;
885
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 876
diff changeset
417
887
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
418 /* Writing AVI OpenDML leaf index chunk */
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
419 ix = url_ftell(pb);
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
420 put_tag(pb, &ix_tag[0]); /* ix?? */
5597
d7c68046a431 Introduce AVIStream struct and move stream based variables to it.
michael
parents: 5058
diff changeset
421 put_le32(pb, avist->indexes.entry * 8 + 24);
887
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
422 /* chunk size */
119
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
423 put_le16(pb, 2); /* wLongsPerEntry */
887
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
424 put_byte(pb, 0); /* bIndexSubType (0 == frame index) */
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
425 put_byte(pb, 1); /* bIndexType (1 == AVI_INDEX_OF_CHUNKS) */
5597
d7c68046a431 Introduce AVIStream struct and move stream based variables to it.
michael
parents: 5058
diff changeset
426 put_le32(pb, avist->indexes.entry);
887
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
427 /* nEntriesInUse */
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
428 put_tag(pb, &tag[0]); /* dwChunkId */
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
429 put_le64(pb, avi->movi_list);/* qwBaseOffset */
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
430 put_le32(pb, 0); /* dwReserved_3 (must be 0) */
119
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
431
5597
d7c68046a431 Introduce AVIStream struct and move stream based variables to it.
michael
parents: 5058
diff changeset
432 for (j=0; j<avist->indexes.entry; j++) {
d7c68046a431 Introduce AVIStream struct and move stream based variables to it.
michael
parents: 5058
diff changeset
433 AVIIentry* ie = avi_get_ientry(&avist->indexes, j);
887
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
434 put_le32(pb, ie->pos + 8);
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
435 put_le32(pb, ((uint32_t)ie->len & ~0x80000000) |
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
436 (ie->flags & 0x10 ? 0 : 0x80000000));
119
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
437 }
887
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
438 put_flush_packet(pb);
119
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
439 pos = url_ftell(pb);
885
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 876
diff changeset
440
887
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
441 /* Updating one entry in the AVI OpenDML master index */
5597
d7c68046a431 Introduce AVIStream struct and move stream based variables to it.
michael
parents: 5058
diff changeset
442 url_fseek(pb, avist->indexes.indx_start - 8, SEEK_SET);
887
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
443 put_tag(pb, "indx"); /* enabling this entry */
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
444 url_fskip(pb, 8);
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
445 put_le32(pb, avi->riff_id); /* nEntriesInUse */
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
446 url_fskip(pb, 16*avi->riff_id);
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
447 put_le64(pb, ix); /* qwOffset */
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
448 put_le32(pb, pos - ix); /* dwSize */
5597
d7c68046a431 Introduce AVIStream struct and move stream based variables to it.
michael
parents: 5058
diff changeset
449 put_le32(pb, avist->indexes.entry); /* dwDuration */
119
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
450
887
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
451 url_fseek(pb, pos, SEEK_SET);
119
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
452 }
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
453 return 0;
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
454 }
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
455
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
456 static int avi_write_idx1(AVFormatContext *s)
102
c48108fe538e AVI > 2Gb (OpenDML) generation patch by (Roman Shaposhnick <rvs at sun dot com>)
michaelni
parents: 94
diff changeset
457 {
2771
d52c718e83f9 Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents: 2227
diff changeset
458 ByteIOContext *pb = s->pb;
102
c48108fe538e AVI > 2Gb (OpenDML) generation patch by (Roman Shaposhnick <rvs at sun dot com>)
michaelni
parents: 94
diff changeset
459 AVIContext *avi = s->priv_data;
3973
549a09cf23fe Remove offset_t typedef and use int64_t directly instead.
diego
parents: 3872
diff changeset
460 int64_t idx_chunk;
1267
47ade5d414f9 fix ODML AVI Duration for files > 2GB
gpoirier
parents: 1256
diff changeset
461 int i;
1332
7474cc6383d4 fix some signedness warnings
mru
parents: 1297
diff changeset
462 char tag[5];
102
c48108fe538e AVI > 2Gb (OpenDML) generation patch by (Roman Shaposhnick <rvs at sun dot com>)
michaelni
parents: 94
diff changeset
463
c48108fe538e AVI > 2Gb (OpenDML) generation patch by (Roman Shaposhnick <rvs at sun dot com>)
michaelni
parents: 94
diff changeset
464 if (!url_is_streamed(pb)) {
5598
cf1aeb986fd2 Remove last MAX_STREAMS from avienc.c
michael
parents: 5597
diff changeset
465 AVIStream *avist;
887
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
466 AVIIentry* ie = 0, *tie;
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
467 int empty, stream_id = -1;
102
c48108fe538e AVI > 2Gb (OpenDML) generation patch by (Roman Shaposhnick <rvs at sun dot com>)
michaelni
parents: 94
diff changeset
468
5058
33a244b7ca65 Add ff_ prefixes to exported symbols in libavformat/riff.h.
diego
parents: 5044
diff changeset
469 idx_chunk = ff_start_tag(pb, "idx1");
5598
cf1aeb986fd2 Remove last MAX_STREAMS from avienc.c
michael
parents: 5597
diff changeset
470 for(i=0; i<s->nb_streams; i++){
cf1aeb986fd2 Remove last MAX_STREAMS from avienc.c
michael
parents: 5597
diff changeset
471 avist= s->streams[i]->priv_data;
cf1aeb986fd2 Remove last MAX_STREAMS from avienc.c
michael
parents: 5597
diff changeset
472 avist->entry=0;
cf1aeb986fd2 Remove last MAX_STREAMS from avienc.c
michael
parents: 5597
diff changeset
473 }
cf1aeb986fd2 Remove last MAX_STREAMS from avienc.c
michael
parents: 5597
diff changeset
474
887
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
475 do {
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
476 empty = 1;
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
477 for (i=0; i<s->nb_streams; i++) {
5598
cf1aeb986fd2 Remove last MAX_STREAMS from avienc.c
michael
parents: 5597
diff changeset
478 avist= s->streams[i]->priv_data;
cf1aeb986fd2 Remove last MAX_STREAMS from avienc.c
michael
parents: 5597
diff changeset
479 if (avist->indexes.entry <= avist->entry)
887
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
480 continue;
885
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 876
diff changeset
481
5598
cf1aeb986fd2 Remove last MAX_STREAMS from avienc.c
michael
parents: 5597
diff changeset
482 tie = avi_get_ientry(&avist->indexes, avist->entry);
887
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
483 if (empty || tie->pos < ie->pos) {
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
484 ie = tie;
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
485 stream_id = i;
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
486 }
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
487 empty = 0;
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
488 }
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
489 if (!empty) {
5598
cf1aeb986fd2 Remove last MAX_STREAMS from avienc.c
michael
parents: 5597
diff changeset
490 avist= s->streams[stream_id]->priv_data;
887
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
491 avi_stream2fourcc(&tag[0], stream_id,
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
492 s->streams[stream_id]->codec->codec_type);
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
493 put_tag(pb, &tag[0]);
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
494 put_le32(pb, ie->flags);
119
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
495 put_le32(pb, ie->pos);
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
496 put_le32(pb, ie->len);
5598
cf1aeb986fd2 Remove last MAX_STREAMS from avienc.c
michael
parents: 5597
diff changeset
497 avist->entry++;
887
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
498 }
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
499 } while (!empty);
5058
33a244b7ca65 Add ff_ prefixes to exported symbols in libavformat/riff.h.
diego
parents: 5044
diff changeset
500 ff_end_tag(pb, idx_chunk);
102
c48108fe538e AVI > 2Gb (OpenDML) generation patch by (Roman Shaposhnick <rvs at sun dot com>)
michaelni
parents: 94
diff changeset
501
1267
47ade5d414f9 fix ODML AVI Duration for files > 2GB
gpoirier
parents: 1256
diff changeset
502 avi_write_counters(s, avi->riff_id);
102
c48108fe538e AVI > 2Gb (OpenDML) generation patch by (Roman Shaposhnick <rvs at sun dot com>)
michaelni
parents: 94
diff changeset
503 }
c48108fe538e AVI > 2Gb (OpenDML) generation patch by (Roman Shaposhnick <rvs at sun dot com>)
michaelni
parents: 94
diff changeset
504 return 0;
c48108fe538e AVI > 2Gb (OpenDML) generation patch by (Roman Shaposhnick <rvs at sun dot com>)
michaelni
parents: 94
diff changeset
505 }
c48108fe538e AVI > 2Gb (OpenDML) generation patch by (Roman Shaposhnick <rvs at sun dot com>)
michaelni
parents: 94
diff changeset
506
468
60f897e8dd2d pass AVPacket into av_write_frame()
michael
parents: 458
diff changeset
507 static int avi_write_packet(AVFormatContext *s, AVPacket *pkt)
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
508 {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
509 AVIContext *avi = s->priv_data;
2771
d52c718e83f9 Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents: 2227
diff changeset
510 ByteIOContext *pb = s->pb;
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
511 unsigned char tag[5];
468
60f897e8dd2d pass AVPacket into av_write_frame()
michael
parents: 458
diff changeset
512 unsigned int flags=0;
60f897e8dd2d pass AVPacket into av_write_frame()
michael
parents: 458
diff changeset
513 const int stream_index= pkt->stream_index;
5597
d7c68046a431 Introduce AVIStream struct and move stream based variables to it.
michael
parents: 5058
diff changeset
514 AVIStream *avist= s->streams[stream_index]->priv_data;
820
feca73904e67 changing AVCodecContext codec -> *codec in AVStream so additions to AVCodecContext dont randomize AVStream and break binary compatibility
michael
parents: 796
diff changeset
515 AVCodecContext *enc= s->streams[stream_index]->codec;
468
60f897e8dd2d pass AVPacket into av_write_frame()
michael
parents: 458
diff changeset
516 int size= pkt->size;
102
c48108fe538e AVI > 2Gb (OpenDML) generation patch by (Roman Shaposhnick <rvs at sun dot com>)
michaelni
parents: 94
diff changeset
517
1443
404048ea11bc Replace most of the %lld and %llx by their (cleaner) PRI*64 counterparts.
diego
parents: 1415
diff changeset
518 // av_log(s, AV_LOG_DEBUG, "%"PRId64" %d %d\n", pkt->dts, avi->packet_count[stream_index], stream_index);
5597
d7c68046a431 Introduce AVIStream struct and move stream based variables to it.
michael
parents: 5058
diff changeset
519 while(enc->block_align==0 && pkt->dts != AV_NOPTS_VALUE && pkt->dts > avist->packet_count){
479
d84d9d8bb0a4 pass timestamps correctly for -sync 0
michael
parents: 476
diff changeset
520 AVPacket empty_packet;
d84d9d8bb0a4 pass timestamps correctly for -sync 0
michael
parents: 476
diff changeset
521
d84d9d8bb0a4 pass timestamps correctly for -sync 0
michael
parents: 476
diff changeset
522 av_init_packet(&empty_packet);
d84d9d8bb0a4 pass timestamps correctly for -sync 0
michael
parents: 476
diff changeset
523 empty_packet.size= 0;
d84d9d8bb0a4 pass timestamps correctly for -sync 0
michael
parents: 476
diff changeset
524 empty_packet.data= NULL;
d84d9d8bb0a4 pass timestamps correctly for -sync 0
michael
parents: 476
diff changeset
525 empty_packet.stream_index= stream_index;
d84d9d8bb0a4 pass timestamps correctly for -sync 0
michael
parents: 476
diff changeset
526 avi_write_packet(s, &empty_packet);
1443
404048ea11bc Replace most of the %lld and %llx by their (cleaner) PRI*64 counterparts.
diego
parents: 1415
diff changeset
527 // av_log(s, AV_LOG_DEBUG, "dup %"PRId64" %d\n", pkt->dts, avi->packet_count[stream_index]);
479
d84d9d8bb0a4 pass timestamps correctly for -sync 0
michael
parents: 476
diff changeset
528 }
5597
d7c68046a431 Introduce AVIStream struct and move stream based variables to it.
michael
parents: 5058
diff changeset
529 avist->packet_count++;
479
d84d9d8bb0a4 pass timestamps correctly for -sync 0
michael
parents: 476
diff changeset
530
873
7af647503b67 Support for streaming: dont write indexes and dont signal HAS_INDEX in header. Also set filesize to max in this case.
alex
parents: 863
diff changeset
531 // Make sure to put an OpenDML chunk when the file size exceeds the limits
885
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 876
diff changeset
532 if (!url_is_streamed(pb) &&
887
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
533 (url_ftell(pb) - avi->riff_start > AVI_MAX_RIFF_SIZE)) {
885
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 876
diff changeset
534
119
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
535 avi_write_ix(s);
5058
33a244b7ca65 Add ff_ prefixes to exported symbols in libavformat/riff.h.
diego
parents: 5044
diff changeset
536 ff_end_tag(pb, avi->movi_list);
885
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 876
diff changeset
537
887
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
538 if (avi->riff_id == 1)
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
539 avi_write_idx1(s);
119
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
540
5058
33a244b7ca65 Add ff_ prefixes to exported symbols in libavformat/riff.h.
diego
parents: 5044
diff changeset
541 ff_end_tag(pb, avi->riff_start);
5597
d7c68046a431 Introduce AVIStream struct and move stream based variables to it.
michael
parents: 5058
diff changeset
542 avi->movi_list = avi_start_new_riff(s, pb, "AVIX", "movi");
102
c48108fe538e AVI > 2Gb (OpenDML) generation patch by (Roman Shaposhnick <rvs at sun dot com>)
michaelni
parents: 94
diff changeset
543 }
885
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 876
diff changeset
544
119
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
545 avi_stream2fourcc(&tag[0], stream_index, enc->codec_type);
5913
11bb10c37225 Replace all occurences of PKT_FLAG_KEY with AV_PKT_FLAG_KEY.
cehoyos
parents: 5910
diff changeset
546 if(pkt->flags&AV_PKT_FLAG_KEY)
468
60f897e8dd2d pass AVPacket into av_write_frame()
michael
parents: 458
diff changeset
547 flags = 0x10;
5910
536e5527c1e0 Define AVMediaType enum, and use it instead of enum CodecType, which
stefano
parents: 5661
diff changeset
548 if (enc->codec_type == AVMEDIA_TYPE_AUDIO) {
5597
d7c68046a431 Introduce AVIStream struct and move stream based variables to it.
michael
parents: 5058
diff changeset
549 avist->audio_strm_length += size;
468
60f897e8dd2d pass AVPacket into av_write_frame()
michael
parents: 458
diff changeset
550 }
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
551
2771
d52c718e83f9 Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents: 2227
diff changeset
552 if (!url_is_streamed(s->pb)) {
5597
d7c68046a431 Introduce AVIStream struct and move stream based variables to it.
michael
parents: 5058
diff changeset
553 AVIIndex* idx = &avist->indexes;
887
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
554 int cl = idx->entry / AVI_INDEX_CLUSTER_SIZE;
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
555 int id = idx->entry % AVI_INDEX_CLUSTER_SIZE;
119
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
556 if (idx->ents_allocated <= idx->entry) {
887
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
557 idx->cluster = av_realloc(idx->cluster, (cl+1)*sizeof(void*));
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
558 if (!idx->cluster)
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
559 return -1;
119
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
560 idx->cluster[cl] = av_malloc(AVI_INDEX_CLUSTER_SIZE*sizeof(AVIIentry));
887
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
561 if (!idx->cluster[cl])
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
562 return -1;
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
563 idx->ents_allocated += AVI_INDEX_CLUSTER_SIZE;
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
564 }
885
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 876
diff changeset
565
887
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
566 idx->cluster[cl][id].flags = flags;
119
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
567 idx->cluster[cl][id].pos = url_ftell(pb) - avi->movi_list;
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
568 idx->cluster[cl][id].len = size;
887
d70e50f1495f COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 885
diff changeset
569 idx->entry++;
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
570 }
885
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 876
diff changeset
571
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
572 put_buffer(pb, tag, 4);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
573 put_le32(pb, size);
468
60f897e8dd2d pass AVPacket into av_write_frame()
michael
parents: 458
diff changeset
574 put_buffer(pb, pkt->data, size);
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
575 if (size & 1)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
576 put_byte(pb, 0);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
577
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
578 put_flush_packet(pb);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
579 return 0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
580 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
581
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
582 static int avi_write_trailer(AVFormatContext *s)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
583 {
102
c48108fe538e AVI > 2Gb (OpenDML) generation patch by (Roman Shaposhnick <rvs at sun dot com>)
michaelni
parents: 94
diff changeset
584 AVIContext *avi = s->priv_data;
2771
d52c718e83f9 Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents: 2227
diff changeset
585 ByteIOContext *pb = s->pb;
102
c48108fe538e AVI > 2Gb (OpenDML) generation patch by (Roman Shaposhnick <rvs at sun dot com>)
michaelni
parents: 94
diff changeset
586 int res = 0;
119
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
587 int i, j, n, nb_frames;
3973
549a09cf23fe Remove offset_t typedef and use int64_t directly instead.
diego
parents: 3872
diff changeset
588 int64_t file_size;
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
589
1676
507177b7444c fix indention (dunno why it was messed up ...)
michael
parents: 1556
diff changeset
590 if (!url_is_streamed(pb)){
507177b7444c fix indention (dunno why it was messed up ...)
michael
parents: 1556
diff changeset
591 if (avi->riff_id == 1) {
5058
33a244b7ca65 Add ff_ prefixes to exported symbols in libavformat/riff.h.
diego
parents: 5044
diff changeset
592 ff_end_tag(pb, avi->movi_list);
1676
507177b7444c fix indention (dunno why it was messed up ...)
michael
parents: 1556
diff changeset
593 res = avi_write_idx1(s);
5058
33a244b7ca65 Add ff_ prefixes to exported symbols in libavformat/riff.h.
diego
parents: 5044
diff changeset
594 ff_end_tag(pb, avi->riff_start);
1676
507177b7444c fix indention (dunno why it was messed up ...)
michael
parents: 1556
diff changeset
595 } else {
507177b7444c fix indention (dunno why it was messed up ...)
michael
parents: 1556
diff changeset
596 avi_write_ix(s);
5058
33a244b7ca65 Add ff_ prefixes to exported symbols in libavformat/riff.h.
diego
parents: 5044
diff changeset
597 ff_end_tag(pb, avi->movi_list);
33a244b7ca65 Add ff_ prefixes to exported symbols in libavformat/riff.h.
diego
parents: 5044
diff changeset
598 ff_end_tag(pb, avi->riff_start);
119
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
599
1676
507177b7444c fix indention (dunno why it was messed up ...)
michael
parents: 1556
diff changeset
600 file_size = url_ftell(pb);
507177b7444c fix indention (dunno why it was messed up ...)
michael
parents: 1556
diff changeset
601 url_fseek(pb, avi->odml_list - 8, SEEK_SET);
507177b7444c fix indention (dunno why it was messed up ...)
michael
parents: 1556
diff changeset
602 put_tag(pb, "LIST"); /* Making this AVI OpenDML one */
507177b7444c fix indention (dunno why it was messed up ...)
michael
parents: 1556
diff changeset
603 url_fskip(pb, 16);
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
604
1676
507177b7444c fix indention (dunno why it was messed up ...)
michael
parents: 1556
diff changeset
605 for (n=nb_frames=0;n<s->nb_streams;n++) {
507177b7444c fix indention (dunno why it was messed up ...)
michael
parents: 1556
diff changeset
606 AVCodecContext *stream = s->streams[n]->codec;
5597
d7c68046a431 Introduce AVIStream struct and move stream based variables to it.
michael
parents: 5058
diff changeset
607 AVIStream *avist= s->streams[n]->priv_data;
d7c68046a431 Introduce AVIStream struct and move stream based variables to it.
michael
parents: 5058
diff changeset
608
5910
536e5527c1e0 Define AVMediaType enum, and use it instead of enum CodecType, which
stefano
parents: 5661
diff changeset
609 if (stream->codec_type == AVMEDIA_TYPE_VIDEO) {
5597
d7c68046a431 Introduce AVIStream struct and move stream based variables to it.
michael
parents: 5058
diff changeset
610 if (nb_frames < avist->packet_count)
d7c68046a431 Introduce AVIStream struct and move stream based variables to it.
michael
parents: 5058
diff changeset
611 nb_frames = avist->packet_count;
1676
507177b7444c fix indention (dunno why it was messed up ...)
michael
parents: 1556
diff changeset
612 } else {
507177b7444c fix indention (dunno why it was messed up ...)
michael
parents: 1556
diff changeset
613 if (stream->codec_id == CODEC_ID_MP2 || stream->codec_id == CODEC_ID_MP3) {
5597
d7c68046a431 Introduce AVIStream struct and move stream based variables to it.
michael
parents: 5058
diff changeset
614 nb_frames += avist->packet_count;
1676
507177b7444c fix indention (dunno why it was messed up ...)
michael
parents: 1556
diff changeset
615 }
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
616 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
617 }
1676
507177b7444c fix indention (dunno why it was messed up ...)
michael
parents: 1556
diff changeset
618 put_le32(pb, nb_frames);
507177b7444c fix indention (dunno why it was messed up ...)
michael
parents: 1556
diff changeset
619 url_fseek(pb, file_size, SEEK_SET);
507177b7444c fix indention (dunno why it was messed up ...)
michael
parents: 1556
diff changeset
620
507177b7444c fix indention (dunno why it was messed up ...)
michael
parents: 1556
diff changeset
621 avi_write_counters(s, avi->riff_id);
102
c48108fe538e AVI > 2Gb (OpenDML) generation patch by (Roman Shaposhnick <rvs at sun dot com>)
michaelni
parents: 94
diff changeset
622 }
873
7af647503b67 Support for streaming: dont write indexes and dont signal HAS_INDEX in header. Also set filesize to max in this case.
alex
parents: 863
diff changeset
623 }
119
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
624 put_flush_packet(pb);
102
c48108fe538e AVI > 2Gb (OpenDML) generation patch by (Roman Shaposhnick <rvs at sun dot com>)
michaelni
parents: 94
diff changeset
625
5597
d7c68046a431 Introduce AVIStream struct and move stream based variables to it.
michael
parents: 5058
diff changeset
626 for (i=0; i<s->nb_streams; i++) {
d7c68046a431 Introduce AVIStream struct and move stream based variables to it.
michael
parents: 5058
diff changeset
627 AVIStream *avist= s->streams[i]->priv_data;
d7c68046a431 Introduce AVIStream struct and move stream based variables to it.
michael
parents: 5058
diff changeset
628 for (j=0; j<avist->indexes.ents_allocated/AVI_INDEX_CLUSTER_SIZE; j++)
d7c68046a431 Introduce AVIStream struct and move stream based variables to it.
michael
parents: 5058
diff changeset
629 av_free(avist->indexes.cluster[j]);
d7c68046a431 Introduce AVIStream struct and move stream based variables to it.
michael
parents: 5058
diff changeset
630 av_freep(&avist->indexes.cluster);
d7c68046a431 Introduce AVIStream struct and move stream based variables to it.
michael
parents: 5058
diff changeset
631 avist->indexes.ents_allocated = avist->indexes.entry = 0;
119
602546f3cbea Complete support for OpenDML AVIs and AVIs > 2Gb.
romansh
parents: 106
diff changeset
632 }
885
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 876
diff changeset
633
102
c48108fe538e AVI > 2Gb (OpenDML) generation patch by (Roman Shaposhnick <rvs at sun dot com>)
michaelni
parents: 94
diff changeset
634 return res;
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
635 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
636
1169
d18cc9a1fd02 allow individual selection of muxers and demuxers
mru
parents: 1167
diff changeset
637 AVOutputFormat avi_muxer = {
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
638 "avi",
3424
7a0230981402 Make long_names in lavf/lavdev optional depending on CONFIG_SMALL.
diego
parents: 3177
diff changeset
639 NULL_IF_CONFIG_SMALL("AVI format"),
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
640 "video/x-msvideo",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
641 "avi",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
642 sizeof(AVIContext),
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
643 CODEC_ID_MP2,
106
4da5d55b3690 we really shouldnt use M$* as default codec -> use MPEG4 as default
michaelni
parents: 105
diff changeset
644 CODEC_ID_MPEG4,
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
645 avi_write_header,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
646 avi_write_packet,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
647 avi_write_trailer,
5058
33a244b7ca65 Add ff_ prefixes to exported symbols in libavformat/riff.h.
diego
parents: 5044
diff changeset
648 .codec_tag= (const AVCodecTag* const []){ff_codec_bmp_tags, ff_codec_wav_tags, 0},
4567
963e3b76c7a6 Add AVFMT_VARIABLE_FPS to specify which muxers do not need duplicated frames.
michael
parents: 4477
diff changeset
649 .flags= AVFMT_VARIABLE_FPS,
5633
5d3ac5652047 Add AVI metadata conversion table.
jai_menon
parents: 5631
diff changeset
650 .metadata_conv = ff_avi_metadata_conv,
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
651 };