split raw.c into rawdec.c and rawenc.c
[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     put_buffer(s->pb, pkt->data, pkt->size);
29     put_flush_packet(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 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 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 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 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 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_H261_MUXER
111 AVOutputFormat h261_muxer = {
112     "h261",
113     NULL_IF_CONFIG_SMALL("raw H.261"),
114     "video/x-h261",
115     "h261",
116     0,
117     CODEC_ID_NONE,
118     CODEC_ID_H261,
119     NULL,
120     ff_raw_write_packet,
121     .flags= AVFMT_NOTIMESTAMPS,
122 };
123 #endif
124
125 #if CONFIG_H263_MUXER
126 AVOutputFormat h263_muxer = {
127     "h263",
128     NULL_IF_CONFIG_SMALL("raw H.263"),
129     "video/x-h263",
130     "h263",
131     0,
132     CODEC_ID_NONE,
133     CODEC_ID_H263,
134     NULL,
135     ff_raw_write_packet,
136     .flags= AVFMT_NOTIMESTAMPS,
137 };
138 #endif
139
140 #if CONFIG_H264_MUXER
141 AVOutputFormat h264_muxer = {
142     "h264",
143     NULL_IF_CONFIG_SMALL("raw H.264 video format"),
144     NULL,
145     "h264",
146     0,
147     CODEC_ID_NONE,
148     CODEC_ID_H264,
149     NULL,
150     ff_raw_write_packet,
151     .flags= AVFMT_NOTIMESTAMPS,
152 };
153 #endif
154
155 #if CONFIG_CAVSVIDEO_MUXER
156 AVOutputFormat cavsvideo_muxer = {
157     "cavsvideo",
158     NULL_IF_CONFIG_SMALL("raw Chinese AVS video"),
159     NULL,
160     "cavs",
161     0,
162     CODEC_ID_NONE,
163     CODEC_ID_CAVS,
164     NULL,
165     ff_raw_write_packet,
166     .flags= AVFMT_NOTIMESTAMPS,
167 };
168 #endif
169
170 #if CONFIG_M4V_MUXER
171 AVOutputFormat m4v_muxer = {
172     "m4v",
173     NULL_IF_CONFIG_SMALL("raw MPEG-4 video format"),
174     NULL,
175     "m4v",
176     0,
177     CODEC_ID_NONE,
178     CODEC_ID_MPEG4,
179     NULL,
180     ff_raw_write_packet,
181     .flags= AVFMT_NOTIMESTAMPS,
182 };
183 #endif
184
185 #if CONFIG_MJPEG_MUXER
186 AVOutputFormat mjpeg_muxer = {
187     "mjpeg",
188     NULL_IF_CONFIG_SMALL("raw MJPEG video"),
189     "video/x-mjpeg",
190     "mjpg,mjpeg",
191     0,
192     CODEC_ID_NONE,
193     CODEC_ID_MJPEG,
194     NULL,
195     ff_raw_write_packet,
196     .flags= AVFMT_NOTIMESTAMPS,
197 };
198 #endif
199
200 #if CONFIG_MLP_MUXER
201 AVOutputFormat mlp_muxer = {
202     "mlp",
203     NULL_IF_CONFIG_SMALL("raw MLP"),
204     NULL,
205     "mlp",
206     0,
207     CODEC_ID_MLP,
208     CODEC_ID_NONE,
209     NULL,
210     ff_raw_write_packet,
211     .flags= AVFMT_NOTIMESTAMPS,
212 };
213 #endif
214
215 #if CONFIG_SRT_MUXER
216 AVOutputFormat srt_muxer = {
217     .name           = "srt",
218     .long_name      = NULL_IF_CONFIG_SMALL("SubRip subtitle format"),
219     .mime_type      = "application/x-subrip",
220     .extensions     = "srt",
221     .write_packet   = ff_raw_write_packet,
222     .flags          = AVFMT_NOTIMESTAMPS,
223     .subtitle_codec = CODEC_ID_SRT,
224 };
225 #endif
226
227 #if CONFIG_TRUEHD_MUXER
228 AVOutputFormat truehd_muxer = {
229     "truehd",
230     NULL_IF_CONFIG_SMALL("raw TrueHD"),
231     NULL,
232     "thd",
233     0,
234     CODEC_ID_TRUEHD,
235     CODEC_ID_NONE,
236     NULL,
237     ff_raw_write_packet,
238     .flags= AVFMT_NOTIMESTAMPS,
239 };
240 #endif
241
242 #if CONFIG_MPEG1VIDEO_MUXER
243 AVOutputFormat mpeg1video_muxer = {
244     "mpeg1video",
245     NULL_IF_CONFIG_SMALL("raw MPEG-1 video"),
246     "video/x-mpeg",
247     "mpg,mpeg,m1v",
248     0,
249     CODEC_ID_NONE,
250     CODEC_ID_MPEG1VIDEO,
251     NULL,
252     ff_raw_write_packet,
253     .flags= AVFMT_NOTIMESTAMPS,
254 };
255 #endif
256
257 #if CONFIG_MPEG2VIDEO_MUXER
258 AVOutputFormat mpeg2video_muxer = {
259     "mpeg2video",
260     NULL_IF_CONFIG_SMALL("raw MPEG-2 video"),
261     NULL,
262     "m2v",
263     0,
264     CODEC_ID_NONE,
265     CODEC_ID_MPEG2VIDEO,
266     NULL,
267     ff_raw_write_packet,
268     .flags= AVFMT_NOTIMESTAMPS,
269 };
270 #endif
271
272 #if CONFIG_RAWVIDEO_MUXER
273 AVOutputFormat rawvideo_muxer = {
274     "rawvideo",
275     NULL_IF_CONFIG_SMALL("raw video format"),
276     NULL,
277     "yuv,rgb",
278     0,
279     CODEC_ID_NONE,
280     CODEC_ID_RAWVIDEO,
281     NULL,
282     ff_raw_write_packet,
283     .flags= AVFMT_NOTIMESTAMPS,
284 };
285 #endif