FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
rawenc.c
Go to the documentation of this file.
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 
27 {
28  avio_write(s->pb, pkt->data, pkt->size);
29  return 0;
30 }
31 
33 {
34  if (s->nb_streams != 1) {
35  av_log(s, AV_LOG_ERROR, "%s files have exactly one stream\n",
36  s->oformat->name);
37  return AVERROR(EINVAL);
38  }
39  return 0;
40 }
41 
42 /* Note: Do not forget to add new entries to the Makefile as well. */
43 
44 #if CONFIG_AC3_MUXER
45 AVOutputFormat ff_ac3_muxer = {
46  .name = "ac3",
47  .long_name = NULL_IF_CONFIG_SMALL("raw AC-3"),
48  .mime_type = "audio/x-ac3",
49  .extensions = "ac3",
50  .audio_codec = AV_CODEC_ID_AC3,
51  .video_codec = AV_CODEC_ID_NONE,
52  .write_header = force_one_stream,
53  .write_packet = ff_raw_write_packet,
54  .flags = AVFMT_NOTIMESTAMPS,
55 };
56 #endif
57 
58 #if CONFIG_ADX_MUXER
59 AVOutputFormat ff_adx_muxer = {
60  .name = "adx",
61  .long_name = NULL_IF_CONFIG_SMALL("CRI ADX"),
62  .extensions = "adx",
63  .audio_codec = AV_CODEC_ID_ADPCM_ADX,
64  .video_codec = AV_CODEC_ID_NONE,
65  .write_header = force_one_stream,
66  .write_packet = ff_raw_write_packet,
67  .flags = AVFMT_NOTIMESTAMPS,
68 };
69 #endif
70 
71 #if CONFIG_CAVSVIDEO_MUXER
72 AVOutputFormat ff_cavsvideo_muxer = {
73  .name = "cavsvideo",
74  .long_name = NULL_IF_CONFIG_SMALL("raw Chinese AVS (Audio Video Standard) video"),
75  .extensions = "cavs",
76  .audio_codec = AV_CODEC_ID_NONE,
77  .video_codec = AV_CODEC_ID_CAVS,
78  .write_header = force_one_stream,
79  .write_packet = ff_raw_write_packet,
80  .flags = AVFMT_NOTIMESTAMPS,
81 };
82 #endif
83 
84 #if CONFIG_DATA_MUXER
85 AVOutputFormat ff_data_muxer = {
86  .name = "data",
87  .long_name = NULL_IF_CONFIG_SMALL("raw data"),
88  .write_header = force_one_stream,
89  .write_packet = ff_raw_write_packet,
90  .flags = AVFMT_NOTIMESTAMPS,
91 };
92 #endif
93 
94 #if CONFIG_DIRAC_MUXER
95 AVOutputFormat ff_dirac_muxer = {
96  .name = "dirac",
97  .long_name = NULL_IF_CONFIG_SMALL("raw Dirac"),
98  .extensions = "drc",
99  .audio_codec = AV_CODEC_ID_NONE,
100  .video_codec = AV_CODEC_ID_DIRAC,
101  .write_header = force_one_stream,
102  .write_packet = ff_raw_write_packet,
103  .flags = AVFMT_NOTIMESTAMPS,
104 };
105 #endif
106 
107 #if CONFIG_DNXHD_MUXER
108 AVOutputFormat ff_dnxhd_muxer = {
109  .name = "dnxhd",
110  .long_name = NULL_IF_CONFIG_SMALL("raw DNxHD (SMPTE VC-3)"),
111  .extensions = "dnxhd",
112  .audio_codec = AV_CODEC_ID_NONE,
113  .video_codec = AV_CODEC_ID_DNXHD,
114  .write_header = force_one_stream,
115  .write_packet = ff_raw_write_packet,
116  .flags = AVFMT_NOTIMESTAMPS,
117 };
118 #endif
119 
120 #if CONFIG_DTS_MUXER
121 AVOutputFormat ff_dts_muxer = {
122  .name = "dts",
123  .long_name = NULL_IF_CONFIG_SMALL("raw DTS"),
124  .mime_type = "audio/x-dca",
125  .extensions = "dts",
126  .audio_codec = AV_CODEC_ID_DTS,
127  .video_codec = AV_CODEC_ID_NONE,
128  .write_header = force_one_stream,
129  .write_packet = ff_raw_write_packet,
130  .flags = AVFMT_NOTIMESTAMPS,
131 };
132 #endif
133 
134 #if CONFIG_EAC3_MUXER
135 AVOutputFormat ff_eac3_muxer = {
136  .name = "eac3",
137  .long_name = NULL_IF_CONFIG_SMALL("raw E-AC-3"),
138  .mime_type = "audio/x-eac3",
139  .extensions = "eac3",
140  .audio_codec = AV_CODEC_ID_EAC3,
141  .video_codec = AV_CODEC_ID_NONE,
142  .write_header = force_one_stream,
143  .write_packet = ff_raw_write_packet,
144  .flags = AVFMT_NOTIMESTAMPS,
145 };
146 #endif
147 
148 #if CONFIG_G722_MUXER
149 AVOutputFormat ff_g722_muxer = {
150  .name = "g722",
151  .long_name = NULL_IF_CONFIG_SMALL("raw G.722"),
152  .mime_type = "audio/G722",
153  .extensions = "g722",
154  .audio_codec = AV_CODEC_ID_ADPCM_G722,
155  .video_codec = AV_CODEC_ID_NONE,
156  .write_header = force_one_stream,
157  .write_packet = ff_raw_write_packet,
158  .flags = AVFMT_NOTIMESTAMPS,
159 };
160 #endif
161 
162 #if CONFIG_G723_1_MUXER
163 AVOutputFormat ff_g723_1_muxer = {
164  .name = "g723_1",
165  .long_name = NULL_IF_CONFIG_SMALL("raw G.723.1"),
166  .mime_type = "audio/g723",
167  .extensions = "tco,rco",
168  .audio_codec = AV_CODEC_ID_G723_1,
169  .video_codec = AV_CODEC_ID_NONE,
170  .write_header = force_one_stream,
171  .write_packet = ff_raw_write_packet,
172  .flags = AVFMT_NOTIMESTAMPS,
173 };
174 #endif
175 
176 #if CONFIG_H261_MUXER
177 AVOutputFormat ff_h261_muxer = {
178  .name = "h261",
179  .long_name = NULL_IF_CONFIG_SMALL("raw H.261"),
180  .mime_type = "video/x-h261",
181  .extensions = "h261",
182  .audio_codec = AV_CODEC_ID_NONE,
183  .video_codec = AV_CODEC_ID_H261,
184  .write_header = force_one_stream,
185  .write_packet = ff_raw_write_packet,
186  .flags = AVFMT_NOTIMESTAMPS,
187 };
188 #endif
189 
190 #if CONFIG_H263_MUXER
191 AVOutputFormat ff_h263_muxer = {
192  .name = "h263",
193  .long_name = NULL_IF_CONFIG_SMALL("raw H.263"),
194  .mime_type = "video/x-h263",
195  .extensions = "h263",
196  .audio_codec = AV_CODEC_ID_NONE,
197  .video_codec = AV_CODEC_ID_H263,
198  .write_header = force_one_stream,
199  .write_packet = ff_raw_write_packet,
200  .flags = AVFMT_NOTIMESTAMPS,
201 };
202 #endif
203 
204 #if CONFIG_H264_MUXER
205 AVOutputFormat ff_h264_muxer = {
206  .name = "h264",
207  .long_name = NULL_IF_CONFIG_SMALL("raw H.264 video"),
208  .extensions = "h264,264",
209  .audio_codec = AV_CODEC_ID_NONE,
210  .video_codec = AV_CODEC_ID_H264,
211  .write_header = force_one_stream,
212  .write_packet = ff_raw_write_packet,
213  .flags = AVFMT_NOTIMESTAMPS,
214 };
215 #endif
216 
217 #if CONFIG_HEVC_MUXER
218 AVOutputFormat ff_hevc_muxer = {
219  .name = "hevc",
220  .long_name = NULL_IF_CONFIG_SMALL("raw HEVC video"),
221  .extensions = "hevc",
222  .audio_codec = AV_CODEC_ID_NONE,
223  .video_codec = AV_CODEC_ID_HEVC,
224  .write_packet = ff_raw_write_packet,
225  .flags = AVFMT_NOTIMESTAMPS,
226 };
227 #endif
228 
229 #if CONFIG_M4V_MUXER
230 AVOutputFormat ff_m4v_muxer = {
231  .name = "m4v",
232  .long_name = NULL_IF_CONFIG_SMALL("raw MPEG-4 video"),
233  .extensions = "m4v",
234  .audio_codec = AV_CODEC_ID_NONE,
235  .video_codec = AV_CODEC_ID_MPEG4,
236  .write_packet = ff_raw_write_packet,
237  .flags = AVFMT_NOTIMESTAMPS,
238 };
239 #endif
240 
241 #if CONFIG_MJPEG_MUXER
242 AVOutputFormat ff_mjpeg_muxer = {
243  .name = "mjpeg",
244  .long_name = NULL_IF_CONFIG_SMALL("raw MJPEG video"),
245  .mime_type = "video/x-mjpeg",
246  .extensions = "mjpg,mjpeg",
247  .audio_codec = AV_CODEC_ID_NONE,
248  .video_codec = AV_CODEC_ID_MJPEG,
249  .write_header = force_one_stream,
250  .write_packet = ff_raw_write_packet,
251  .flags = AVFMT_NOTIMESTAMPS,
252 };
253 #endif
254 
255 #if CONFIG_MLP_MUXER
256 AVOutputFormat ff_mlp_muxer = {
257  .name = "mlp",
258  .long_name = NULL_IF_CONFIG_SMALL("raw MLP"),
259  .extensions = "mlp",
260  .audio_codec = AV_CODEC_ID_MLP,
261  .video_codec = AV_CODEC_ID_NONE,
262  .write_header = force_one_stream,
263  .write_packet = ff_raw_write_packet,
264  .flags = AVFMT_NOTIMESTAMPS,
265 };
266 #endif
267 
268 #if CONFIG_MPEG1VIDEO_MUXER
269 AVOutputFormat ff_mpeg1video_muxer = {
270  .name = "mpeg1video",
271  .long_name = NULL_IF_CONFIG_SMALL("raw MPEG-1 video"),
272  .mime_type = "video/mpeg",
273  .extensions = "mpg,mpeg,m1v",
274  .audio_codec = AV_CODEC_ID_NONE,
275  .video_codec = AV_CODEC_ID_MPEG1VIDEO,
276  .write_header = force_one_stream,
277  .write_packet = ff_raw_write_packet,
278  .flags = AVFMT_NOTIMESTAMPS,
279 };
280 #endif
281 
282 #if CONFIG_MPEG2VIDEO_MUXER
283 AVOutputFormat ff_mpeg2video_muxer = {
284  .name = "mpeg2video",
285  .long_name = NULL_IF_CONFIG_SMALL("raw MPEG-2 video"),
286  .extensions = "m2v",
287  .audio_codec = AV_CODEC_ID_NONE,
288  .video_codec = AV_CODEC_ID_MPEG2VIDEO,
289  .write_header = force_one_stream,
290  .write_packet = ff_raw_write_packet,
291  .flags = AVFMT_NOTIMESTAMPS,
292 };
293 #endif
294 
295 #if CONFIG_RAWVIDEO_MUXER
296 AVOutputFormat ff_rawvideo_muxer = {
297  .name = "rawvideo",
298  .long_name = NULL_IF_CONFIG_SMALL("raw video"),
299  .extensions = "yuv,rgb",
300  .audio_codec = AV_CODEC_ID_NONE,
301  .video_codec = AV_CODEC_ID_RAWVIDEO,
302  .write_packet = ff_raw_write_packet,
303  .flags = AVFMT_NOTIMESTAMPS,
304 };
305 #endif
306 
307 #if CONFIG_TRUEHD_MUXER
308 AVOutputFormat ff_truehd_muxer = {
309  .name = "truehd",
310  .long_name = NULL_IF_CONFIG_SMALL("raw TrueHD"),
311  .extensions = "thd",
312  .audio_codec = AV_CODEC_ID_TRUEHD,
313  .video_codec = AV_CODEC_ID_NONE,
314  .write_header = force_one_stream,
315  .write_packet = ff_raw_write_packet,
316  .flags = AVFMT_NOTIMESTAMPS,
317 };
318 #endif
319 
320 #if CONFIG_VC1_MUXER
321 AVOutputFormat ff_vc1_muxer = {
322  .name = "vc1",
323  .long_name = NULL_IF_CONFIG_SMALL("raw VC-1 video"),
324  .extensions = "vc1",
325  .audio_codec = AV_CODEC_ID_NONE,
326  .video_codec = AV_CODEC_ID_VC1,
327  .write_header = force_one_stream,
328  .write_packet = ff_raw_write_packet,
329  .flags = AVFMT_NOTIMESTAMPS,
330 };
331 #endif