lavu/bprint: add append buffer function
[ffmpeg.git] / libavformat / rawenc.c
1 /*
2  * RAW muxers
3  * Copyright (c) 2001 Fabrice Bellard
4  * Copyright (c) 2005 Alex Beregszaszi
5  *
6  * This file is part of FFmpeg.
7  *
8  * FFmpeg is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * FFmpeg is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with FFmpeg; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22
23 #include "avformat.h"
24 #include "rawenc.h"
25
26 int ff_raw_write_packet(AVFormatContext *s, AVPacket *pkt)
27 {
28     avio_write(s->pb, pkt->data, pkt->size);
29     return 0;
30 }
31
32 /* Note: Do not forget to add new entries to the Makefile as well. */
33
34 #if CONFIG_AC3_MUXER
35 AVOutputFormat ff_ac3_muxer = {
36     .name              = "ac3",
37     .long_name         = NULL_IF_CONFIG_SMALL("raw AC-3"),
38     .mime_type         = "audio/x-ac3",
39     .extensions        = "ac3",
40     .audio_codec       = AV_CODEC_ID_AC3,
41     .video_codec       = AV_CODEC_ID_NONE,
42     .write_packet      = ff_raw_write_packet,
43     .flags             = AVFMT_NOTIMESTAMPS,
44 };
45 #endif
46
47 #if CONFIG_ADX_MUXER
48 AVOutputFormat ff_adx_muxer = {
49     .name              = "adx",
50     .long_name         = NULL_IF_CONFIG_SMALL("CRI ADX"),
51     .extensions        = "adx",
52     .audio_codec       = AV_CODEC_ID_ADPCM_ADX,
53     .video_codec       = AV_CODEC_ID_NONE,
54     .write_packet      = ff_raw_write_packet,
55     .flags             = AVFMT_NOTIMESTAMPS,
56 };
57 #endif
58
59 #if CONFIG_CAVSVIDEO_MUXER
60 AVOutputFormat ff_cavsvideo_muxer = {
61     .name              = "cavsvideo",
62     .long_name         = NULL_IF_CONFIG_SMALL("raw Chinese AVS (Audio Video Standard) video"),
63     .extensions        = "cavs",
64     .audio_codec       = AV_CODEC_ID_NONE,
65     .video_codec       = AV_CODEC_ID_CAVS,
66     .write_packet      = ff_raw_write_packet,
67     .flags             = AVFMT_NOTIMESTAMPS,
68 };
69 #endif
70
71 #if CONFIG_DATA_MUXER
72 AVOutputFormat ff_data_muxer = {
73     .name              = "data",
74     .long_name         = NULL_IF_CONFIG_SMALL("raw data"),
75     .write_packet      = ff_raw_write_packet,
76     .flags             = AVFMT_NOTIMESTAMPS,
77 };
78 #endif
79
80 #if CONFIG_DIRAC_MUXER
81 AVOutputFormat ff_dirac_muxer = {
82     .name              = "dirac",
83     .long_name         = NULL_IF_CONFIG_SMALL("raw Dirac"),
84     .extensions        = "drc",
85     .audio_codec       = AV_CODEC_ID_NONE,
86     .video_codec       = AV_CODEC_ID_DIRAC,
87     .write_packet      = ff_raw_write_packet,
88     .flags             = AVFMT_NOTIMESTAMPS,
89 };
90 #endif
91
92 #if CONFIG_DNXHD_MUXER
93 AVOutputFormat ff_dnxhd_muxer = {
94     .name              = "dnxhd",
95     .long_name         = NULL_IF_CONFIG_SMALL("raw DNxHD (SMPTE VC-3)"),
96     .extensions        = "dnxhd",
97     .audio_codec       = AV_CODEC_ID_NONE,
98     .video_codec       = AV_CODEC_ID_DNXHD,
99     .write_packet      = ff_raw_write_packet,
100     .flags             = AVFMT_NOTIMESTAMPS,
101 };
102 #endif
103
104 #if CONFIG_DTS_MUXER
105 AVOutputFormat ff_dts_muxer = {
106     .name              = "dts",
107     .long_name         = NULL_IF_CONFIG_SMALL("raw DTS"),
108     .mime_type         = "audio/x-dca",
109     .extensions        = "dts",
110     .audio_codec       = AV_CODEC_ID_DTS,
111     .video_codec       = AV_CODEC_ID_NONE,
112     .write_packet      = ff_raw_write_packet,
113     .flags             = AVFMT_NOTIMESTAMPS,
114 };
115 #endif
116
117 #if CONFIG_EAC3_MUXER
118 AVOutputFormat ff_eac3_muxer = {
119     .name              = "eac3",
120     .long_name         = NULL_IF_CONFIG_SMALL("raw E-AC-3"),
121     .mime_type         = "audio/x-eac3",
122     .extensions        = "eac3",
123     .audio_codec       = AV_CODEC_ID_EAC3,
124     .video_codec       = AV_CODEC_ID_NONE,
125     .write_packet      = ff_raw_write_packet,
126     .flags             = AVFMT_NOTIMESTAMPS,
127 };
128 #endif
129
130 #if CONFIG_G722_MUXER
131 AVOutputFormat ff_g722_muxer = {
132     .name              = "g722",
133     .long_name         = NULL_IF_CONFIG_SMALL("raw G.722"),
134     .mime_type         = "audio/G722",
135     .extensions        = "g722",
136     .audio_codec       = AV_CODEC_ID_ADPCM_G722,
137     .video_codec       = AV_CODEC_ID_NONE,
138     .write_packet      = ff_raw_write_packet,
139     .flags             = AVFMT_NOTIMESTAMPS,
140 };
141 #endif
142
143 #if CONFIG_G723_1_MUXER
144 AVOutputFormat ff_g723_1_muxer = {
145     .name              = "g723_1",
146     .long_name         = NULL_IF_CONFIG_SMALL("raw G.723.1"),
147     .mime_type         = "audio/g723",
148     .extensions        = "tco,rco",
149     .audio_codec       = AV_CODEC_ID_G723_1,
150     .video_codec       = AV_CODEC_ID_NONE,
151     .write_packet      = ff_raw_write_packet,
152     .flags             = AVFMT_NOTIMESTAMPS,
153 };
154 #endif
155
156 #if CONFIG_H261_MUXER
157 AVOutputFormat ff_h261_muxer = {
158     .name              = "h261",
159     .long_name         = NULL_IF_CONFIG_SMALL("raw H.261"),
160     .mime_type         = "video/x-h261",
161     .extensions        = "h261",
162     .audio_codec       = AV_CODEC_ID_NONE,
163     .video_codec       = AV_CODEC_ID_H261,
164     .write_packet      = ff_raw_write_packet,
165     .flags             = AVFMT_NOTIMESTAMPS,
166 };
167 #endif
168
169 #if CONFIG_H263_MUXER
170 AVOutputFormat ff_h263_muxer = {
171     .name              = "h263",
172     .long_name         = NULL_IF_CONFIG_SMALL("raw H.263"),
173     .mime_type         = "video/x-h263",
174     .extensions        = "h263",
175     .audio_codec       = AV_CODEC_ID_NONE,
176     .video_codec       = AV_CODEC_ID_H263,
177     .write_packet      = ff_raw_write_packet,
178     .flags             = AVFMT_NOTIMESTAMPS,
179 };
180 #endif
181
182 #if CONFIG_H264_MUXER
183 AVOutputFormat ff_h264_muxer = {
184     .name              = "h264",
185     .long_name         = NULL_IF_CONFIG_SMALL("raw H.264 video"),
186     .extensions        = "h264",
187     .audio_codec       = AV_CODEC_ID_NONE,
188     .video_codec       = AV_CODEC_ID_H264,
189     .write_packet      = ff_raw_write_packet,
190     .flags             = AVFMT_NOTIMESTAMPS,
191 };
192 #endif
193
194 #if CONFIG_M4V_MUXER
195 AVOutputFormat ff_m4v_muxer = {
196     .name              = "m4v",
197     .long_name         = NULL_IF_CONFIG_SMALL("raw MPEG-4 video"),
198     .extensions        = "m4v",
199     .audio_codec       = AV_CODEC_ID_NONE,
200     .video_codec       = AV_CODEC_ID_MPEG4,
201     .write_packet      = ff_raw_write_packet,
202     .flags             = AVFMT_NOTIMESTAMPS,
203 };
204 #endif
205
206 #if CONFIG_MJPEG_MUXER
207 AVOutputFormat ff_mjpeg_muxer = {
208     .name              = "mjpeg",
209     .long_name         = NULL_IF_CONFIG_SMALL("raw MJPEG video"),
210     .mime_type         = "video/x-mjpeg",
211     .extensions        = "mjpg,mjpeg",
212     .audio_codec       = AV_CODEC_ID_NONE,
213     .video_codec       = AV_CODEC_ID_MJPEG,
214     .write_packet      = ff_raw_write_packet,
215     .flags             = AVFMT_NOTIMESTAMPS,
216 };
217 #endif
218
219 #if CONFIG_MLP_MUXER
220 AVOutputFormat ff_mlp_muxer = {
221     .name              = "mlp",
222     .long_name         = NULL_IF_CONFIG_SMALL("raw MLP"),
223     .extensions        = "mlp",
224     .audio_codec       = AV_CODEC_ID_MLP,
225     .video_codec       = AV_CODEC_ID_NONE,
226     .write_packet      = ff_raw_write_packet,
227     .flags             = AVFMT_NOTIMESTAMPS,
228 };
229 #endif
230
231 #if CONFIG_MPEG1VIDEO_MUXER
232 AVOutputFormat ff_mpeg1video_muxer = {
233     .name              = "mpeg1video",
234     .long_name         = NULL_IF_CONFIG_SMALL("raw MPEG-1 video"),
235     .mime_type         = "video/x-mpeg",
236     .extensions        = "mpg,mpeg,m1v",
237     .audio_codec       = AV_CODEC_ID_NONE,
238     .video_codec       = AV_CODEC_ID_MPEG1VIDEO,
239     .write_packet      = ff_raw_write_packet,
240     .flags             = AVFMT_NOTIMESTAMPS,
241 };
242 #endif
243
244 #if CONFIG_MPEG2VIDEO_MUXER
245 AVOutputFormat ff_mpeg2video_muxer = {
246     .name              = "mpeg2video",
247     .long_name         = NULL_IF_CONFIG_SMALL("raw MPEG-2 video"),
248     .extensions        = "m2v",
249     .audio_codec       = AV_CODEC_ID_NONE,
250     .video_codec       = AV_CODEC_ID_MPEG2VIDEO,
251     .write_packet      = ff_raw_write_packet,
252     .flags             = AVFMT_NOTIMESTAMPS,
253 };
254 #endif
255
256 #if CONFIG_RAWVIDEO_MUXER
257 AVOutputFormat ff_rawvideo_muxer = {
258     .name              = "rawvideo",
259     .long_name         = NULL_IF_CONFIG_SMALL("raw video"),
260     .extensions        = "yuv,rgb",
261     .audio_codec       = AV_CODEC_ID_NONE,
262     .video_codec       = AV_CODEC_ID_RAWVIDEO,
263     .write_packet      = ff_raw_write_packet,
264     .flags             = AVFMT_NOTIMESTAMPS,
265 };
266 #endif
267
268 #if CONFIG_TRUEHD_MUXER
269 AVOutputFormat ff_truehd_muxer = {
270     .name              = "truehd",
271     .long_name         = NULL_IF_CONFIG_SMALL("raw TrueHD"),
272     .extensions        = "thd",
273     .audio_codec       = AV_CODEC_ID_TRUEHD,
274     .video_codec       = AV_CODEC_ID_NONE,
275     .write_packet      = ff_raw_write_packet,
276     .flags             = AVFMT_NOTIMESTAMPS,
277 };
278 #endif
279
280 #if CONFIG_VC1_MUXER
281 AVOutputFormat ff_vc1_muxer = {
282     .name              = "vc1",
283     .long_name         = NULL_IF_CONFIG_SMALL("raw VC-1 video"),
284     .extensions        = "vc1",
285     .audio_codec       = AV_CODEC_ID_NONE,
286     .video_codec       = AV_CODEC_ID_VC1,
287     .write_packet      = ff_raw_write_packet,
288     .flags             = AVFMT_NOTIMESTAMPS,
289 };
290 #endif