avio: rename put_flush_packet -> avio_flush
[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     avio_flush(s->pb);
30     return 0;
31 }
32
33 /* Note: Do not forget to add new entries to the Makefile as well. */
34
35 #if CONFIG_AC3_MUXER
36 AVOutputFormat ff_ac3_muxer = {
37     "ac3",
38     NULL_IF_CONFIG_SMALL("raw AC-3"),
39     "audio/x-ac3",
40     "ac3",
41     0,
42     CODEC_ID_AC3,
43     CODEC_ID_NONE,
44     NULL,
45     ff_raw_write_packet,
46     .flags= AVFMT_NOTIMESTAMPS,
47 };
48 #endif
49
50 #if CONFIG_DIRAC_MUXER
51 AVOutputFormat ff_dirac_muxer = {
52     "dirac",
53     NULL_IF_CONFIG_SMALL("raw Dirac"),
54     NULL,
55     "drc",
56     0,
57     CODEC_ID_NONE,
58     CODEC_ID_DIRAC,
59     NULL,
60     ff_raw_write_packet,
61     .flags= AVFMT_NOTIMESTAMPS,
62 };
63 #endif
64
65 #if CONFIG_DNXHD_MUXER
66 AVOutputFormat ff_dnxhd_muxer = {
67     "dnxhd",
68     NULL_IF_CONFIG_SMALL("raw DNxHD (SMPTE VC-3)"),
69     NULL,
70     "dnxhd",
71     0,
72     CODEC_ID_NONE,
73     CODEC_ID_DNXHD,
74     NULL,
75     ff_raw_write_packet,
76     .flags= AVFMT_NOTIMESTAMPS,
77 };
78 #endif
79
80 #if CONFIG_DTS_MUXER
81 AVOutputFormat ff_dts_muxer = {
82     "dts",
83     NULL_IF_CONFIG_SMALL("raw DTS"),
84     "audio/x-dca",
85     "dts",
86     0,
87     CODEC_ID_DTS,
88     CODEC_ID_NONE,
89     NULL,
90     ff_raw_write_packet,
91     .flags= AVFMT_NOTIMESTAMPS,
92 };
93 #endif
94
95 #if CONFIG_EAC3_MUXER
96 AVOutputFormat ff_eac3_muxer = {
97     "eac3",
98     NULL_IF_CONFIG_SMALL("raw E-AC-3"),
99     "audio/x-eac3",
100     "eac3",
101     0,
102     CODEC_ID_EAC3,
103     CODEC_ID_NONE,
104     NULL,
105     ff_raw_write_packet,
106     .flags= AVFMT_NOTIMESTAMPS,
107 };
108 #endif
109
110 #if CONFIG_G722_MUXER
111 AVOutputFormat ff_g722_muxer = {
112     "g722",
113     NULL_IF_CONFIG_SMALL("raw G.722"),
114     "audio/G722",
115     "g722",
116     0,
117     CODEC_ID_ADPCM_G722,
118     CODEC_ID_NONE,
119     NULL,
120     ff_raw_write_packet,
121     .flags= AVFMT_NOTIMESTAMPS,
122 };
123 #endif
124
125 #if CONFIG_H261_MUXER
126 AVOutputFormat ff_h261_muxer = {
127     "h261",
128     NULL_IF_CONFIG_SMALL("raw H.261"),
129     "video/x-h261",
130     "h261",
131     0,
132     CODEC_ID_NONE,
133     CODEC_ID_H261,
134     NULL,
135     ff_raw_write_packet,
136     .flags= AVFMT_NOTIMESTAMPS,
137 };
138 #endif
139
140 #if CONFIG_H263_MUXER
141 AVOutputFormat ff_h263_muxer = {
142     "h263",
143     NULL_IF_CONFIG_SMALL("raw H.263"),
144     "video/x-h263",
145     "h263",
146     0,
147     CODEC_ID_NONE,
148     CODEC_ID_H263,
149     NULL,
150     ff_raw_write_packet,
151     .flags= AVFMT_NOTIMESTAMPS,
152 };
153 #endif
154
155 #if CONFIG_H264_MUXER
156 AVOutputFormat ff_h264_muxer = {
157     "h264",
158     NULL_IF_CONFIG_SMALL("raw H.264 video format"),
159     NULL,
160     "h264",
161     0,
162     CODEC_ID_NONE,
163     CODEC_ID_H264,
164     NULL,
165     ff_raw_write_packet,
166     .flags= AVFMT_NOTIMESTAMPS,
167 };
168 #endif
169
170 #if CONFIG_CAVSVIDEO_MUXER
171 AVOutputFormat ff_cavsvideo_muxer = {
172     "cavsvideo",
173     NULL_IF_CONFIG_SMALL("raw Chinese AVS video"),
174     NULL,
175     "cavs",
176     0,
177     CODEC_ID_NONE,
178     CODEC_ID_CAVS,
179     NULL,
180     ff_raw_write_packet,
181     .flags= AVFMT_NOTIMESTAMPS,
182 };
183 #endif
184
185 #if CONFIG_M4V_MUXER
186 AVOutputFormat ff_m4v_muxer = {
187     "m4v",
188     NULL_IF_CONFIG_SMALL("raw MPEG-4 video format"),
189     NULL,
190     "m4v",
191     0,
192     CODEC_ID_NONE,
193     CODEC_ID_MPEG4,
194     NULL,
195     ff_raw_write_packet,
196     .flags= AVFMT_NOTIMESTAMPS,
197 };
198 #endif
199
200 #if CONFIG_MJPEG_MUXER
201 AVOutputFormat ff_mjpeg_muxer = {
202     "mjpeg",
203     NULL_IF_CONFIG_SMALL("raw MJPEG video"),
204     "video/x-mjpeg",
205     "mjpg,mjpeg",
206     0,
207     CODEC_ID_NONE,
208     CODEC_ID_MJPEG,
209     NULL,
210     ff_raw_write_packet,
211     .flags= AVFMT_NOTIMESTAMPS,
212 };
213 #endif
214
215 #if CONFIG_MLP_MUXER
216 AVOutputFormat ff_mlp_muxer = {
217     "mlp",
218     NULL_IF_CONFIG_SMALL("raw MLP"),
219     NULL,
220     "mlp",
221     0,
222     CODEC_ID_MLP,
223     CODEC_ID_NONE,
224     NULL,
225     ff_raw_write_packet,
226     .flags= AVFMT_NOTIMESTAMPS,
227 };
228 #endif
229
230 #if CONFIG_SRT_MUXER
231 AVOutputFormat ff_srt_muxer = {
232     .name           = "srt",
233     .long_name      = NULL_IF_CONFIG_SMALL("SubRip subtitle format"),
234     .mime_type      = "application/x-subrip",
235     .extensions     = "srt",
236     .write_packet   = ff_raw_write_packet,
237     .flags          = AVFMT_NOTIMESTAMPS,
238     .subtitle_codec = CODEC_ID_SRT,
239 };
240 #endif
241
242 #if CONFIG_TRUEHD_MUXER
243 AVOutputFormat ff_truehd_muxer = {
244     "truehd",
245     NULL_IF_CONFIG_SMALL("raw TrueHD"),
246     NULL,
247     "thd",
248     0,
249     CODEC_ID_TRUEHD,
250     CODEC_ID_NONE,
251     NULL,
252     ff_raw_write_packet,
253     .flags= AVFMT_NOTIMESTAMPS,
254 };
255 #endif
256
257 #if CONFIG_MPEG1VIDEO_MUXER
258 AVOutputFormat ff_mpeg1video_muxer = {
259     "mpeg1video",
260     NULL_IF_CONFIG_SMALL("raw MPEG-1 video"),
261     "video/x-mpeg",
262     "mpg,mpeg,m1v",
263     0,
264     CODEC_ID_NONE,
265     CODEC_ID_MPEG1VIDEO,
266     NULL,
267     ff_raw_write_packet,
268     .flags= AVFMT_NOTIMESTAMPS,
269 };
270 #endif
271
272 #if CONFIG_MPEG2VIDEO_MUXER
273 AVOutputFormat ff_mpeg2video_muxer = {
274     "mpeg2video",
275     NULL_IF_CONFIG_SMALL("raw MPEG-2 video"),
276     NULL,
277     "m2v",
278     0,
279     CODEC_ID_NONE,
280     CODEC_ID_MPEG2VIDEO,
281     NULL,
282     ff_raw_write_packet,
283     .flags= AVFMT_NOTIMESTAMPS,
284 };
285 #endif
286
287 #if CONFIG_RAWVIDEO_MUXER
288 AVOutputFormat ff_rawvideo_muxer = {
289     "rawvideo",
290     NULL_IF_CONFIG_SMALL("raw video format"),
291     NULL,
292     "yuv,rgb",
293     0,
294     CODEC_ID_NONE,
295     CODEC_ID_RAWVIDEO,
296     NULL,
297     ff_raw_write_packet,
298     .flags= AVFMT_NOTIMESTAMPS,
299 };
300 #endif