FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavformat/rawenc.c
Date: 2024-11-20 23:03:26
Exec Total Coverage
Lines: 27 36 75.0%
Functions: 5 7 71.4%
Branches: 12 24 50.0%

Line Branch Exec Source
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 "config_components.h"
24
25 #include "libavutil/intreadwrite.h"
26
27 #include "avformat.h"
28 #include "rawenc.h"
29 #include "mux.h"
30
31 246433 int ff_raw_write_packet(AVFormatContext *s, AVPacket *pkt)
32 {
33 246433 avio_write(s->pb, pkt->data, pkt->size);
34 246433 return 0;
35 }
36
37 /* Note: Do not forget to add new entries to the Makefile as well. */
38
39 #if CONFIG_AC3_MUXER
40 const FFOutputFormat ff_ac3_muxer = {
41 .p.name = "ac3",
42 .p.long_name = NULL_IF_CONFIG_SMALL("raw AC-3"),
43 .p.mime_type = "audio/x-ac3",
44 .p.extensions = "ac3",
45 .p.audio_codec = AV_CODEC_ID_AC3,
46 .p.video_codec = AV_CODEC_ID_NONE,
47 .p.subtitle_codec = AV_CODEC_ID_NONE,
48 .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
49 FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
50 .write_packet = ff_raw_write_packet,
51 .p.flags = AVFMT_NOTIMESTAMPS,
52 };
53 #endif
54
55 #if CONFIG_ADX_MUXER
56
57 1 static int adx_write_trailer(AVFormatContext *s)
58 {
59 1 AVIOContext *pb = s->pb;
60 1 AVCodecParameters *par = s->streams[0]->codecpar;
61
62
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 if (pb->seekable & AVIO_SEEKABLE_NORMAL) {
63 1 int64_t file_size = avio_tell(pb);
64 1 uint64_t sample_count = (file_size - 36) / par->ch_layout.nb_channels / 18 * 32;
65
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 if (sample_count <= UINT32_MAX) {
66 1 avio_seek(pb, 12, SEEK_SET);
67 1 avio_wb32(pb, sample_count);
68 1 avio_seek(pb, file_size, SEEK_SET);
69 }
70 }
71
72 1 return 0;
73 }
74
75 const FFOutputFormat ff_adx_muxer = {
76 .p.name = "adx",
77 .p.long_name = NULL_IF_CONFIG_SMALL("CRI ADX"),
78 .p.extensions = "adx",
79 .p.audio_codec = AV_CODEC_ID_ADPCM_ADX,
80 .p.video_codec = AV_CODEC_ID_NONE,
81 .p.subtitle_codec = AV_CODEC_ID_NONE,
82 .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
83 FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
84 .write_packet = ff_raw_write_packet,
85 .write_trailer = adx_write_trailer,
86 .p.flags = AVFMT_NOTIMESTAMPS,
87 };
88 #endif
89
90 #if CONFIG_APTX_MUXER
91 const FFOutputFormat ff_aptx_muxer = {
92 .p.name = "aptx",
93 .p.long_name = NULL_IF_CONFIG_SMALL("raw aptX (Audio Processing Technology for Bluetooth)"),
94 .p.extensions = "aptx",
95 .p.audio_codec = AV_CODEC_ID_APTX,
96 .p.video_codec = AV_CODEC_ID_NONE,
97 .p.subtitle_codec = AV_CODEC_ID_NONE,
98 .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
99 FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
100 .write_packet = ff_raw_write_packet,
101 .p.flags = AVFMT_NOTIMESTAMPS,
102 };
103 #endif
104
105 #if CONFIG_APTX_HD_MUXER
106 const FFOutputFormat ff_aptx_hd_muxer = {
107 .p.name = "aptx_hd",
108 .p.long_name = NULL_IF_CONFIG_SMALL("raw aptX HD (Audio Processing Technology for Bluetooth)"),
109 .p.extensions = "aptxhd",
110 .p.audio_codec = AV_CODEC_ID_APTX_HD,
111 .p.video_codec = AV_CODEC_ID_NONE,
112 .p.subtitle_codec = AV_CODEC_ID_NONE,
113 .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
114 FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
115 .write_packet = ff_raw_write_packet,
116 .p.flags = AVFMT_NOTIMESTAMPS,
117 };
118 #endif
119
120 #if CONFIG_AVS2_MUXER
121 const FFOutputFormat ff_avs2_muxer = {
122 .p.name = "avs2",
123 .p.long_name = NULL_IF_CONFIG_SMALL("raw AVS2-P2/IEEE1857.4 video"),
124 .p.extensions = "avs,avs2",
125 .p.audio_codec = AV_CODEC_ID_NONE,
126 .p.video_codec = AV_CODEC_ID_AVS2,
127 .p.subtitle_codec = AV_CODEC_ID_NONE,
128 .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
129 FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
130 .write_packet = ff_raw_write_packet,
131 .p.flags = AVFMT_NOTIMESTAMPS,
132 };
133 #endif
134
135 #if CONFIG_AVS3_MUXER
136 const FFOutputFormat ff_avs3_muxer = {
137 .p.name = "avs3",
138 .p.long_name = NULL_IF_CONFIG_SMALL("AVS3-P2/IEEE1857.10"),
139 .p.extensions = "avs3",
140 .p.audio_codec = AV_CODEC_ID_NONE,
141 .p.video_codec = AV_CODEC_ID_AVS3,
142 .p.subtitle_codec = AV_CODEC_ID_NONE,
143 .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
144 FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
145 .write_packet = ff_raw_write_packet,
146 .p.flags = AVFMT_NOTIMESTAMPS,
147 };
148 #endif
149
150
151 #if CONFIG_CAVSVIDEO_MUXER
152 const FFOutputFormat ff_cavsvideo_muxer = {
153 .p.name = "cavsvideo",
154 .p.long_name = NULL_IF_CONFIG_SMALL("raw Chinese AVS (Audio Video Standard) video"),
155 .p.extensions = "cavs",
156 .p.audio_codec = AV_CODEC_ID_NONE,
157 .p.video_codec = AV_CODEC_ID_CAVS,
158 .p.subtitle_codec = AV_CODEC_ID_NONE,
159 .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
160 FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
161 .write_packet = ff_raw_write_packet,
162 .p.flags = AVFMT_NOTIMESTAMPS,
163 };
164 #endif
165
166 #if CONFIG_CODEC2RAW_MUXER
167 const FFOutputFormat ff_codec2raw_muxer = {
168 .p.name = "codec2raw",
169 .p.long_name = NULL_IF_CONFIG_SMALL("raw codec2 muxer"),
170 .p.audio_codec = AV_CODEC_ID_CODEC2,
171 .p.video_codec = AV_CODEC_ID_NONE,
172 .p.subtitle_codec = AV_CODEC_ID_NONE,
173 .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
174 FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
175 .write_packet = ff_raw_write_packet,
176 .p.flags = AVFMT_NOTIMESTAMPS,
177 };
178 #endif
179
180
181 #if CONFIG_DATA_MUXER
182 static av_cold int force_one_stream(AVFormatContext *s)
183 {
184 if (s->nb_streams != 1) {
185 av_log(s, AV_LOG_ERROR, "This muxer supports only one stream.\n");
186 return AVERROR(EINVAL);
187 }
188 return 0;
189 }
190
191 const FFOutputFormat ff_data_muxer = {
192 .p.name = "data",
193 .p.long_name = NULL_IF_CONFIG_SMALL("raw data"),
194 .init = force_one_stream,
195 .write_packet = ff_raw_write_packet,
196 .p.flags = AVFMT_NOTIMESTAMPS,
197 };
198 #endif
199
200 #if CONFIG_DFPWM_MUXER
201 const FFOutputFormat ff_dfpwm_muxer = {
202 .p.name = "dfpwm",
203 .p.long_name = NULL_IF_CONFIG_SMALL("raw DFPWM1a"),
204 .p.extensions = "dfpwm",
205 .p.audio_codec = AV_CODEC_ID_DFPWM,
206 .p.video_codec = AV_CODEC_ID_NONE,
207 .p.subtitle_codec = AV_CODEC_ID_NONE,
208 .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
209 FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
210 .write_packet = ff_raw_write_packet,
211 .p.flags = AVFMT_NOTIMESTAMPS,
212 };
213 #endif
214
215 #if CONFIG_DIRAC_MUXER
216 const FFOutputFormat ff_dirac_muxer = {
217 .p.name = "dirac",
218 .p.long_name = NULL_IF_CONFIG_SMALL("raw Dirac"),
219 .p.extensions = "drc,vc2",
220 .p.audio_codec = AV_CODEC_ID_NONE,
221 .p.video_codec = AV_CODEC_ID_DIRAC,
222 .p.subtitle_codec = AV_CODEC_ID_NONE,
223 .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
224 FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
225 .write_packet = ff_raw_write_packet,
226 .p.flags = AVFMT_NOTIMESTAMPS,
227 };
228 #endif
229
230 #if CONFIG_DNXHD_MUXER
231 const FFOutputFormat ff_dnxhd_muxer = {
232 .p.name = "dnxhd",
233 .p.long_name = NULL_IF_CONFIG_SMALL("raw DNxHD (SMPTE VC-3)"),
234 .p.extensions = "dnxhd,dnxhr",
235 .p.audio_codec = AV_CODEC_ID_NONE,
236 .p.video_codec = AV_CODEC_ID_DNXHD,
237 .p.subtitle_codec = AV_CODEC_ID_NONE,
238 .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
239 FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
240 .write_packet = ff_raw_write_packet,
241 .p.flags = AVFMT_NOTIMESTAMPS,
242 };
243 #endif
244
245 #if CONFIG_DTS_MUXER
246 const FFOutputFormat ff_dts_muxer = {
247 .p.name = "dts",
248 .p.long_name = NULL_IF_CONFIG_SMALL("raw DTS"),
249 .p.mime_type = "audio/x-dca",
250 .p.extensions = "dts",
251 .p.audio_codec = AV_CODEC_ID_DTS,
252 .p.video_codec = AV_CODEC_ID_NONE,
253 .p.subtitle_codec = AV_CODEC_ID_NONE,
254 .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
255 FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
256 .write_packet = ff_raw_write_packet,
257 .p.flags = AVFMT_NOTIMESTAMPS,
258 };
259 #endif
260
261 #if CONFIG_EAC3_MUXER
262 const FFOutputFormat ff_eac3_muxer = {
263 .p.name = "eac3",
264 .p.long_name = NULL_IF_CONFIG_SMALL("raw E-AC-3"),
265 .p.mime_type = "audio/x-eac3",
266 .p.extensions = "eac3,ec3",
267 .p.audio_codec = AV_CODEC_ID_EAC3,
268 .p.video_codec = AV_CODEC_ID_NONE,
269 .p.subtitle_codec = AV_CODEC_ID_NONE,
270 .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
271 FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
272 .write_packet = ff_raw_write_packet,
273 .p.flags = AVFMT_NOTIMESTAMPS,
274 };
275 #endif
276
277 #if CONFIG_G722_MUXER
278 const FFOutputFormat ff_g722_muxer = {
279 .p.name = "g722",
280 .p.long_name = NULL_IF_CONFIG_SMALL("raw G.722"),
281 .p.mime_type = "audio/G722",
282 .p.extensions = "g722",
283 .p.audio_codec = AV_CODEC_ID_ADPCM_G722,
284 .p.video_codec = AV_CODEC_ID_NONE,
285 .p.subtitle_codec = AV_CODEC_ID_NONE,
286 .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
287 FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
288 .write_packet = ff_raw_write_packet,
289 .p.flags = AVFMT_NOTIMESTAMPS,
290 };
291 #endif
292
293 #if CONFIG_G723_1_MUXER
294 const FFOutputFormat ff_g723_1_muxer = {
295 .p.name = "g723_1",
296 .p.long_name = NULL_IF_CONFIG_SMALL("raw G.723.1"),
297 .p.mime_type = "audio/g723",
298 .p.extensions = "tco,rco",
299 .p.audio_codec = AV_CODEC_ID_G723_1,
300 .p.video_codec = AV_CODEC_ID_NONE,
301 .p.subtitle_codec = AV_CODEC_ID_NONE,
302 .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
303 FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
304 .write_packet = ff_raw_write_packet,
305 .p.flags = AVFMT_NOTIMESTAMPS,
306 };
307 #endif
308
309 #if CONFIG_G726_MUXER
310 const FFOutputFormat ff_g726_muxer = {
311 .p.name = "g726",
312 .p.long_name = NULL_IF_CONFIG_SMALL("raw big-endian G.726 (\"left-justified\")"),
313 .p.audio_codec = AV_CODEC_ID_ADPCM_G726,
314 .p.video_codec = AV_CODEC_ID_NONE,
315 .p.subtitle_codec = AV_CODEC_ID_NONE,
316 .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
317 FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
318 .write_packet = ff_raw_write_packet,
319 .p.flags = AVFMT_NOTIMESTAMPS,
320 };
321 #endif
322
323 #if CONFIG_G726LE_MUXER
324 const FFOutputFormat ff_g726le_muxer = {
325 .p.name = "g726le",
326 .p.long_name = NULL_IF_CONFIG_SMALL("raw little-endian G.726 (\"right-justified\")"),
327 .p.audio_codec = AV_CODEC_ID_ADPCM_G726LE,
328 .p.video_codec = AV_CODEC_ID_NONE,
329 .p.subtitle_codec = AV_CODEC_ID_NONE,
330 .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
331 FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
332 .write_packet = ff_raw_write_packet,
333 .p.flags = AVFMT_NOTIMESTAMPS,
334 };
335 #endif
336
337 #if CONFIG_GSM_MUXER
338 const FFOutputFormat ff_gsm_muxer = {
339 .p.name = "gsm",
340 .p.long_name = NULL_IF_CONFIG_SMALL("raw GSM"),
341 .p.mime_type = "audio/x-gsm",
342 .p.extensions = "gsm",
343 .p.audio_codec = AV_CODEC_ID_GSM,
344 .p.video_codec = AV_CODEC_ID_NONE,
345 .p.subtitle_codec = AV_CODEC_ID_NONE,
346 .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
347 FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
348 .write_packet = ff_raw_write_packet,
349 .p.flags = AVFMT_NOTIMESTAMPS,
350 };
351 #endif
352
353 #if CONFIG_H261_MUXER
354 const FFOutputFormat ff_h261_muxer = {
355 .p.name = "h261",
356 .p.long_name = NULL_IF_CONFIG_SMALL("raw H.261"),
357 .p.mime_type = "video/x-h261",
358 .p.extensions = "h261",
359 .p.audio_codec = AV_CODEC_ID_NONE,
360 .p.video_codec = AV_CODEC_ID_H261,
361 .p.subtitle_codec = AV_CODEC_ID_NONE,
362 .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
363 FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
364 .write_packet = ff_raw_write_packet,
365 .p.flags = AVFMT_NOTIMESTAMPS,
366 };
367 #endif
368
369 #if CONFIG_H263_MUXER
370 const FFOutputFormat ff_h263_muxer = {
371 .p.name = "h263",
372 .p.long_name = NULL_IF_CONFIG_SMALL("raw H.263"),
373 .p.mime_type = "video/x-h263",
374 .p.extensions = "h263",
375 .p.audio_codec = AV_CODEC_ID_NONE,
376 .p.video_codec = AV_CODEC_ID_H263,
377 .p.subtitle_codec = AV_CODEC_ID_NONE,
378 .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
379 FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
380 .write_packet = ff_raw_write_packet,
381 .p.flags = AVFMT_NOTIMESTAMPS,
382 };
383 #endif
384
385 #if CONFIG_H264_MUXER
386 27 static int h264_check_bitstream(AVFormatContext *s, AVStream *st,
387 const AVPacket *pkt)
388 {
389
3/4
✓ Branch 0 taken 27 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 23 times.
27 if (pkt->size >= 5 && AV_RB32(pkt->data) != 0x0000001 &&
390
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 AV_RB24(pkt->data) != 0x000001)
391 4 return ff_stream_add_bitstream_filter(st, "h264_mp4toannexb", NULL);
392 23 return 1;
393 }
394
395 const FFOutputFormat ff_h264_muxer = {
396 .p.name = "h264",
397 .p.long_name = NULL_IF_CONFIG_SMALL("raw H.264 video"),
398 .p.extensions = "h264,264",
399 .p.audio_codec = AV_CODEC_ID_NONE,
400 .p.video_codec = AV_CODEC_ID_H264,
401 .p.subtitle_codec = AV_CODEC_ID_NONE,
402 .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
403 FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
404 .write_packet = ff_raw_write_packet,
405 .check_bitstream = h264_check_bitstream,
406 .p.flags = AVFMT_NOTIMESTAMPS,
407 };
408 #endif
409
410 #if CONFIG_VVC_MUXER
411 26 static int vvc_check_bitstream(AVFormatContext *s, AVStream *st,
412 const AVPacket *pkt)
413 {
414
2/4
✓ Branch 0 taken 26 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 26 times.
26 if (pkt->size >= 5 && AV_RB32(pkt->data) != 0x0000001 &&
415 AV_RB24(pkt->data) != 0x000001)
416 return ff_stream_add_bitstream_filter(st, "vvc_mp4toannexb", NULL);
417 26 return 1;
418 }
419
420 const FFOutputFormat ff_vvc_muxer = {
421 .p.name = "vvc",
422 .p.long_name = NULL_IF_CONFIG_SMALL("raw H.266/VVC video"),
423 .p.extensions = "vvc,h266,266",
424 .p.audio_codec = AV_CODEC_ID_NONE,
425 .p.video_codec = AV_CODEC_ID_VVC,
426 .p.subtitle_codec = AV_CODEC_ID_NONE,
427 .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
428 FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
429 .write_packet = ff_raw_write_packet,
430 .check_bitstream = vvc_check_bitstream,
431 .p.flags = AVFMT_NOTIMESTAMPS,
432 };
433 #endif
434
435 #if CONFIG_HEVC_MUXER
436 25 static int hevc_check_bitstream(AVFormatContext *s, AVStream *st,
437 const AVPacket *pkt)
438 {
439
3/4
✓ Branch 0 taken 25 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 24 times.
25 if (pkt->size >= 5 && AV_RB32(pkt->data) != 0x0000001 &&
440
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 AV_RB24(pkt->data) != 0x000001)
441 1 return ff_stream_add_bitstream_filter(st, "hevc_mp4toannexb", NULL);
442 24 return 1;
443 }
444
445 const FFOutputFormat ff_hevc_muxer = {
446 .p.name = "hevc",
447 .p.long_name = NULL_IF_CONFIG_SMALL("raw HEVC video"),
448 .p.extensions = "hevc,h265,265",
449 .p.audio_codec = AV_CODEC_ID_NONE,
450 .p.video_codec = AV_CODEC_ID_HEVC,
451 .p.subtitle_codec = AV_CODEC_ID_NONE,
452 .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
453 FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
454 .write_packet = ff_raw_write_packet,
455 .check_bitstream = hevc_check_bitstream,
456 .p.flags = AVFMT_NOTIMESTAMPS,
457 };
458 #endif
459
460 #if CONFIG_EVC_MUXER
461 const FFOutputFormat ff_evc_muxer = {
462 .p.name = "evc",
463 .p.long_name = NULL_IF_CONFIG_SMALL("raw EVC video"),
464 .p.extensions = "evc",
465 .p.audio_codec = AV_CODEC_ID_NONE,
466 .p.video_codec = AV_CODEC_ID_EVC,
467 .p.subtitle_codec = AV_CODEC_ID_NONE,
468 .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
469 FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
470 .write_packet = ff_raw_write_packet,
471 .p.flags = AVFMT_NOTIMESTAMPS,
472 };
473 #endif
474
475 #if CONFIG_M4V_MUXER
476 const FFOutputFormat ff_m4v_muxer = {
477 .p.name = "m4v",
478 .p.long_name = NULL_IF_CONFIG_SMALL("raw MPEG-4 video"),
479 .p.extensions = "m4v",
480 .p.audio_codec = AV_CODEC_ID_NONE,
481 .p.video_codec = AV_CODEC_ID_MPEG4,
482 .p.subtitle_codec = AV_CODEC_ID_NONE,
483 .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
484 FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
485 .write_packet = ff_raw_write_packet,
486 .p.flags = AVFMT_NOTIMESTAMPS,
487 };
488 #endif
489
490 #if CONFIG_MJPEG_MUXER
491 const FFOutputFormat ff_mjpeg_muxer = {
492 .p.name = "mjpeg",
493 .p.long_name = NULL_IF_CONFIG_SMALL("raw MJPEG video"),
494 .p.mime_type = "video/x-mjpeg",
495 .p.extensions = "mjpg,mjpeg",
496 .p.audio_codec = AV_CODEC_ID_NONE,
497 .p.video_codec = AV_CODEC_ID_MJPEG,
498 .p.subtitle_codec = AV_CODEC_ID_NONE,
499 .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
500 FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
501 .write_packet = ff_raw_write_packet,
502 .p.flags = AVFMT_NOTIMESTAMPS,
503 };
504 #endif
505
506 #if CONFIG_MLP_MUXER
507 const FFOutputFormat ff_mlp_muxer = {
508 .p.name = "mlp",
509 .p.long_name = NULL_IF_CONFIG_SMALL("raw MLP"),
510 .p.extensions = "mlp",
511 .p.audio_codec = AV_CODEC_ID_MLP,
512 .p.video_codec = AV_CODEC_ID_NONE,
513 .p.subtitle_codec = AV_CODEC_ID_NONE,
514 .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
515 FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
516 .write_packet = ff_raw_write_packet,
517 .p.flags = AVFMT_NOTIMESTAMPS,
518 };
519 #endif
520
521 #if CONFIG_MP2_MUXER
522 const FFOutputFormat ff_mp2_muxer = {
523 .p.name = "mp2",
524 .p.long_name = NULL_IF_CONFIG_SMALL("MP2 (MPEG audio layer 2)"),
525 .p.mime_type = "audio/mpeg",
526 .p.extensions = "mp2,m2a,mpa",
527 .p.audio_codec = AV_CODEC_ID_MP2,
528 .p.video_codec = AV_CODEC_ID_NONE,
529 .p.subtitle_codec = AV_CODEC_ID_NONE,
530 .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
531 FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
532 .write_packet = ff_raw_write_packet,
533 .p.flags = AVFMT_NOTIMESTAMPS,
534 };
535 #endif
536
537 #if CONFIG_MPEG1VIDEO_MUXER
538 const FFOutputFormat ff_mpeg1video_muxer = {
539 .p.name = "mpeg1video",
540 .p.long_name = NULL_IF_CONFIG_SMALL("raw MPEG-1 video"),
541 .p.mime_type = "video/mpeg",
542 .p.extensions = "mpg,mpeg,m1v",
543 .p.audio_codec = AV_CODEC_ID_NONE,
544 .p.video_codec = AV_CODEC_ID_MPEG1VIDEO,
545 .p.subtitle_codec = AV_CODEC_ID_NONE,
546 .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
547 FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
548 .write_packet = ff_raw_write_packet,
549 .p.flags = AVFMT_NOTIMESTAMPS,
550 };
551 #endif
552
553 #if CONFIG_MPEG2VIDEO_MUXER
554 const FFOutputFormat ff_mpeg2video_muxer = {
555 .p.name = "mpeg2video",
556 .p.long_name = NULL_IF_CONFIG_SMALL("raw MPEG-2 video"),
557 .p.extensions = "m2v",
558 .p.audio_codec = AV_CODEC_ID_NONE,
559 .p.video_codec = AV_CODEC_ID_MPEG2VIDEO,
560 .p.subtitle_codec = AV_CODEC_ID_NONE,
561 .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
562 FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
563 .write_packet = ff_raw_write_packet,
564 .p.flags = AVFMT_NOTIMESTAMPS,
565 };
566 #endif
567
568 #if CONFIG_OBU_MUXER
569 static int obu_check_bitstream(AVFormatContext *s, AVStream *st,
570 const AVPacket *pkt)
571 {
572 return ff_stream_add_bitstream_filter(st, "av1_metadata", "td=insert");
573 }
574
575 const FFOutputFormat ff_obu_muxer = {
576 .p.name = "obu",
577 .p.long_name = NULL_IF_CONFIG_SMALL("AV1 low overhead OBU"),
578 .p.extensions = "obu",
579 .p.audio_codec = AV_CODEC_ID_NONE,
580 .p.video_codec = AV_CODEC_ID_AV1,
581 .p.subtitle_codec = AV_CODEC_ID_NONE,
582 .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
583 FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
584 .write_packet = ff_raw_write_packet,
585 .check_bitstream = obu_check_bitstream,
586 .p.flags = AVFMT_NOTIMESTAMPS,
587 };
588 #endif
589
590 #if CONFIG_RAWVIDEO_MUXER
591 const FFOutputFormat ff_rawvideo_muxer = {
592 .p.name = "rawvideo",
593 .p.long_name = NULL_IF_CONFIG_SMALL("raw video"),
594 .p.extensions = "yuv,rgb",
595 .p.audio_codec = AV_CODEC_ID_NONE,
596 .p.video_codec = AV_CODEC_ID_RAWVIDEO,
597 .p.subtitle_codec = AV_CODEC_ID_NONE,
598 .write_packet = ff_raw_write_packet,
599 .p.flags = AVFMT_NOTIMESTAMPS,
600 };
601 #endif
602
603 #if CONFIG_SBC_MUXER
604 const FFOutputFormat ff_sbc_muxer = {
605 .p.name = "sbc",
606 .p.long_name = NULL_IF_CONFIG_SMALL("raw SBC"),
607 .p.mime_type = "audio/x-sbc",
608 .p.extensions = "sbc,msbc",
609 .p.audio_codec = AV_CODEC_ID_SBC,
610 .p.video_codec = AV_CODEC_ID_NONE,
611 .p.subtitle_codec = AV_CODEC_ID_NONE,
612 .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
613 FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
614 .write_packet = ff_raw_write_packet,
615 .p.flags = AVFMT_NOTIMESTAMPS,
616 };
617 #endif
618
619 #if CONFIG_TRUEHD_MUXER
620 const FFOutputFormat ff_truehd_muxer = {
621 .p.name = "truehd",
622 .p.long_name = NULL_IF_CONFIG_SMALL("raw TrueHD"),
623 .p.extensions = "thd",
624 .p.audio_codec = AV_CODEC_ID_TRUEHD,
625 .p.video_codec = AV_CODEC_ID_NONE,
626 .p.subtitle_codec = AV_CODEC_ID_NONE,
627 .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
628 FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
629 .write_packet = ff_raw_write_packet,
630 .p.flags = AVFMT_NOTIMESTAMPS,
631 };
632 #endif
633
634 #if CONFIG_VC1_MUXER
635 const FFOutputFormat ff_vc1_muxer = {
636 .p.name = "vc1",
637 .p.long_name = NULL_IF_CONFIG_SMALL("raw VC-1 video"),
638 .p.extensions = "vc1",
639 .p.audio_codec = AV_CODEC_ID_NONE,
640 .p.video_codec = AV_CODEC_ID_VC1,
641 .p.subtitle_codec = AV_CODEC_ID_NONE,
642 .flags_internal = FF_OFMT_FLAG_MAX_ONE_OF_EACH |
643 FF_OFMT_FLAG_ONLY_DEFAULT_CODECS,
644 .write_packet = ff_raw_write_packet,
645 .p.flags = AVFMT_NOTIMESTAMPS,
646 };
647 #endif
648