watermark filter by (Marcus Engene <ffmpeg engene se>)
[libav.git] / libavformat / raw.c
CommitLineData
de6d9b64
FB
1/*
2 * RAW encoder and decoder
19720f15 3 * Copyright (c) 2001 Fabrice Bellard.
de6d9b64 4 *
19720f15
FB
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
de6d9b64 9 *
19720f15 10 * This library is distributed in the hope that it will be useful,
de6d9b64 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19720f15
FB
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
de6d9b64 14 *
19720f15
FB
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
de6d9b64 18 */
de6d9b64
FB
19#include "avformat.h"
20
764ef400 21#ifdef CONFIG_ENCODERS
de6d9b64 22/* simple formats */
5c91a675 23static int raw_write_header(struct AVFormatContext *s)
de6d9b64
FB
24{
25 return 0;
26}
27
e928649b 28static int raw_write_packet(struct AVFormatContext *s, AVPacket *pkt)
de6d9b64 29{
e928649b 30 put_buffer(&s->pb, pkt->data, pkt->size);
de6d9b64
FB
31 put_flush_packet(&s->pb);
32 return 0;
33}
34
5c91a675 35static int raw_write_trailer(struct AVFormatContext *s)
de6d9b64
FB
36{
37 return 0;
38}
764ef400 39#endif //CONFIG_ENCODERS
de6d9b64
FB
40
41/* raw input */
0c1a9eda 42static int raw_read_header(AVFormatContext *s, AVFormatParameters *ap)
de6d9b64
FB
43{
44 AVStream *st;
c9a65ca8 45 int id;
de6d9b64 46
c9a65ca8 47 st = av_new_stream(s, 0);
de6d9b64 48 if (!st)
c9a65ca8 49 return AVERROR_NOMEM;
de6d9b64 50 if (ap) {
c9a65ca8
FB
51 id = s->iformat->value;
52 if (id == CODEC_ID_RAWVIDEO) {
de6d9b64 53 st->codec.codec_type = CODEC_TYPE_VIDEO;
de6d9b64 54 } else {
c9a65ca8 55 st->codec.codec_type = CODEC_TYPE_AUDIO;
de6d9b64 56 }
c9a65ca8
FB
57 st->codec.codec_id = id;
58
de6d9b64
FB
59 switch(st->codec.codec_type) {
60 case CODEC_TYPE_AUDIO:
61 st->codec.sample_rate = ap->sample_rate;
62 st->codec.channels = ap->channels;
595bf4ef 63 av_set_pts_info(st, 64, 1, st->codec.sample_rate);
de6d9b64
FB
64 break;
65 case CODEC_TYPE_VIDEO:
14bea432
MN
66 st->codec.frame_rate = ap->frame_rate;
67 st->codec.frame_rate_base = ap->frame_rate_base;
de6d9b64
FB
68 st->codec.width = ap->width;
69 st->codec.height = ap->height;
63167088 70 st->codec.pix_fmt = ap->pix_fmt;
de6d9b64
FB
71 break;
72 default:
27e084bd 73 return -1;
de6d9b64
FB
74 }
75 } else {
27e084bd 76 return -1;
de6d9b64
FB
77 }
78 return 0;
79}
80
2e93e3aa 81#define RAW_PACKET_SIZE 1024
de6d9b64 82
5c91a675 83static int raw_read_packet(AVFormatContext *s, AVPacket *pkt)
de6d9b64 84{
7866eeff 85 int ret, size;
2a6874fd 86 // AVStream *st = s->streams[0];
7866eeff 87
231dd3f3 88 size= RAW_PACKET_SIZE;
de6d9b64 89
7866eeff 90 if (av_new_packet(pkt, size) < 0)
0bd586c5 91 return AVERROR_IO;
de6d9b64
FB
92
93 pkt->stream_index = 0;
7866eeff 94 ret = get_buffer(&s->pb, pkt->data, size);
2e93e3aa 95 if (ret <= 0) {
de6d9b64 96 av_free_packet(pkt);
0bd586c5 97 return AVERROR_IO;
2e93e3aa
FB
98 }
99 /* note: we need to modify the packet size here to handle the last
100 packet */
101 pkt->size = ret;
de6d9b64
FB
102 return ret;
103}
104
e15dec10
LS
105static int raw_read_partial_packet(AVFormatContext *s, AVPacket *pkt)
106{
107 int ret, size;
108
109 size = RAW_PACKET_SIZE;
110
111 if (av_new_packet(pkt, size) < 0)
0bd586c5 112 return AVERROR_IO;
e15dec10
LS
113
114 pkt->stream_index = 0;
115 ret = get_partial_buffer(&s->pb, pkt->data, size);
116 if (ret <= 0) {
117 av_free_packet(pkt);
0bd586c5 118 return AVERROR_IO;
e15dec10
LS
119 }
120 pkt->size = ret;
121 return ret;
122}
123
5c91a675 124static int raw_read_close(AVFormatContext *s)
de6d9b64
FB
125{
126 return 0;
127}
128
4986a429 129int pcm_read_seek(AVFormatContext *s,
7b3c1382 130 int stream_index, int64_t timestamp, int flags)
4986a429
FB
131{
132 AVStream *st;
133 int block_align, byte_rate;
134 int64_t pos;
135
136 st = s->streams[0];
137 switch(st->codec.codec_id) {
138 case CODEC_ID_PCM_S16LE:
139 case CODEC_ID_PCM_S16BE:
140 case CODEC_ID_PCM_U16LE:
141 case CODEC_ID_PCM_U16BE:
142 block_align = 2 * st->codec.channels;
143 byte_rate = block_align * st->codec.sample_rate;
144 break;
145 case CODEC_ID_PCM_S8:
146 case CODEC_ID_PCM_U8:
147 case CODEC_ID_PCM_MULAW:
148 case CODEC_ID_PCM_ALAW:
149 block_align = st->codec.channels;
150 byte_rate = block_align * st->codec.sample_rate;
151 break;
152 default:
153 block_align = st->codec.block_align;
154 byte_rate = st->codec.bit_rate / 8;
155 break;
156 }
157
158 if (block_align <= 0 || byte_rate <= 0)
159 return -1;
160
161 /* compute the position by aligning it to block_align */
7b3c1382
MN
162 pos = av_rescale_rnd(timestamp * byte_rate,
163 st->time_base.num,
164 st->time_base.den * (int64_t)block_align,
165 (flags & AVSEEK_FLAG_BACKWARD) ? AV_ROUND_DOWN : AV_ROUND_UP);
166 pos *= block_align;
4986a429
FB
167
168 /* recompute exact position */
77405fc8 169 st->cur_dts = av_rescale(pos, st->time_base.den, byte_rate * (int64_t)st->time_base.num);
4986a429
FB
170 url_fseek(&s->pb, pos + s->data_offset, SEEK_SET);
171 return 0;
172}
173
cd66005d
FB
174/* ac3 read */
175static int ac3_read_header(AVFormatContext *s,
176 AVFormatParameters *ap)
177{
178 AVStream *st;
179
180 st = av_new_stream(s, 0);
181 if (!st)
182 return AVERROR_NOMEM;
183
184 st->codec.codec_type = CODEC_TYPE_AUDIO;
185 st->codec.codec_id = CODEC_ID_AC3;
4986a429 186 st->need_parsing = 1;
cd66005d
FB
187 /* the parameters will be extracted from the compressed bitstream */
188 return 0;
189}
190
23c99253
MN
191/* dts read */
192static int dts_read_header(AVFormatContext *s,
193 AVFormatParameters *ap)
194{
195 AVStream *st;
196
197 st = av_new_stream(s, 0);
198 if (!st)
199 return AVERROR_NOMEM;
200
201 st->codec.codec_type = CODEC_TYPE_AUDIO;
202 st->codec.codec_id = CODEC_ID_DTS;
203 st->need_parsing = 1;
204 /* the parameters will be extracted from the compressed bitstream */
205 return 0;
206}
207
de6d9b64
FB
208/* mpeg1/h263 input */
209static int video_read_header(AVFormatContext *s,
210 AVFormatParameters *ap)
211{
212 AVStream *st;
213
c9a65ca8 214 st = av_new_stream(s, 0);
de6d9b64 215 if (!st)
c9a65ca8 216 return AVERROR_NOMEM;
de6d9b64
FB
217
218 st->codec.codec_type = CODEC_TYPE_VIDEO;
c9a65ca8 219 st->codec.codec_id = s->iformat->value;
4986a429
FB
220 st->need_parsing = 1;
221
27e084bd 222 /* for mjpeg, specify frame rate */
7866eeff 223 /* for mpeg4 specify it too (most mpeg4 streams dont have the fixed_vop_rate set ...)*/
4986a429
FB
224 if (st->codec.codec_id == CODEC_ID_MJPEG ||
225 st->codec.codec_id == CODEC_ID_MPEG4) {
226 if (ap && ap->frame_rate) {
14bea432
MN
227 st->codec.frame_rate = ap->frame_rate;
228 st->codec.frame_rate_base = ap->frame_rate_base;
27e084bd 229 } else {
14bea432
MN
230 st->codec.frame_rate = 25;
231 st->codec.frame_rate_base = 1;
27e084bd
FB
232 }
233 }
de6d9b64
FB
234 return 0;
235}
236
c9a65ca8
FB
237#define SEQ_START_CODE 0x000001b3
238#define GOP_START_CODE 0x000001b8
239#define PICTURE_START_CODE 0x00000100
240
241/* XXX: improve that by looking at several start codes */
242static int mpegvideo_probe(AVProbeData *p)
243{
fa777321
FB
244 int code;
245 const uint8_t *d;
c9a65ca8
FB
246
247 /* we search the first start code. If it is a sequence, gop or
248 picture start code then we decide it is an mpeg video
249 stream. We do not send highest value to give a chance to mpegts */
fa777321
FB
250 /* NOTE: the search range was restricted to avoid too many false
251 detections */
252
253 if (p->buf_size < 6)
254 return 0;
255 d = p->buf;
256 code = (d[0] << 24) | (d[1] << 16) | (d[2] << 8) | (d[3]);
257 if ((code & 0xffffff00) == 0x100) {
258 if (code == SEQ_START_CODE ||
259 code == GOP_START_CODE ||
260 code == PICTURE_START_CODE)
261 return 50 - 1;
262 else
263 return 0;
c9a65ca8
FB
264 }
265 return 0;
266}
267
d07f9043
MN
268static int h263_probe(AVProbeData *p)
269{
270 int code;
271 const uint8_t *d;
272
273 if (p->buf_size < 6)
274 return 0;
275 d = p->buf;
276 code = (d[0] << 14) | (d[1] << 6) | (d[2] >> 2);
277 if (code == 0x20) {
278 return 50;
279 }
280 return 0;
281}
282
c6148de2
MN
283static int h261_probe(AVProbeData *p)
284{
285 int code;
286 const uint8_t *d;
287
288 if (p->buf_size < 6)
289 return 0;
290 d = p->buf;
291 code = (d[0] << 12) | (d[1] << 4) | (d[2] >> 4);
292 if (code == 0x10) {
293 return 50;
294 }
295 return 0;
296}
297
c9a65ca8
FB
298AVInputFormat ac3_iformat = {
299 "ac3",
300 "raw ac3",
301 0,
302 NULL,
cd66005d 303 ac3_read_header,
e15dec10 304 raw_read_partial_packet,
de6d9b64 305 raw_read_close,
bb76a117 306 .extensions = "ac3",
de6d9b64
FB
307};
308
764ef400 309#ifdef CONFIG_ENCODERS
c9a65ca8 310AVOutputFormat ac3_oformat = {
de6d9b64
FB
311 "ac3",
312 "raw ac3",
313 "audio/x-ac3",
314 "ac3",
c9a65ca8 315 0,
de6d9b64
FB
316 CODEC_ID_AC3,
317 0,
318 raw_write_header,
319 raw_write_packet,
320 raw_write_trailer,
321};
764ef400 322#endif //CONFIG_ENCODERS
de6d9b64 323
23c99253
MN
324AVInputFormat dts_iformat = {
325 "dts",
326 "raw dts",
327 0,
328 NULL,
329 dts_read_header,
330 raw_read_partial_packet,
331 raw_read_close,
332 .extensions = "dts",
333};
334
c6148de2
MN
335AVInputFormat h261_iformat = {
336 "h261",
337 "raw h261",
338 0,
339 h261_probe,
340 video_read_header,
341 raw_read_partial_packet,
342 raw_read_close,
343 .extensions = "h261",
344 .value = CODEC_ID_H261,
345};
346
1c3990db
MN
347#ifdef CONFIG_ENCODERS
348AVOutputFormat h261_oformat = {
349 "h261",
350 "raw h261",
351 "video/x-h261",
352 "h261",
353 0,
354 0,
355 CODEC_ID_H261,
356 raw_write_header,
357 raw_write_packet,
358 raw_write_trailer,
359};
360#endif //CONFIG_ENCODERS
361
d07f9043
MN
362AVInputFormat h263_iformat = {
363 "h263",
364 "raw h263",
365 0,
366 h263_probe,
367 video_read_header,
e15dec10 368 raw_read_partial_packet,
d07f9043
MN
369 raw_read_close,
370// .extensions = "h263", //FIXME remove after writing mpeg4_probe
371 .value = CODEC_ID_H263,
372};
373
764ef400 374#ifdef CONFIG_ENCODERS
c9a65ca8 375AVOutputFormat h263_oformat = {
de6d9b64
FB
376 "h263",
377 "raw h263",
378 "video/x-h263",
379 "h263",
380 0,
c9a65ca8 381 0,
de6d9b64
FB
382 CODEC_ID_H263,
383 raw_write_header,
384 raw_write_packet,
385 raw_write_trailer,
c9a65ca8 386};
764ef400 387#endif //CONFIG_ENCODERS
c9a65ca8 388
7866eeff
MN
389AVInputFormat m4v_iformat = {
390 "m4v",
391 "raw MPEG4 video format",
392 0,
2f0f5b20 393 NULL /*mpegvideo_probe*/,
7866eeff 394 video_read_header,
e15dec10 395 raw_read_partial_packet,
7866eeff 396 raw_read_close,
bb76a117
MR
397 .extensions = "m4v", //FIXME remove after writing mpeg4_probe
398 .value = CODEC_ID_MPEG4,
7866eeff
MN
399};
400
764ef400 401#ifdef CONFIG_ENCODERS
89b3d7c9
MK
402AVOutputFormat m4v_oformat = {
403 "m4v",
404 "raw MPEG4 video format",
405 NULL,
406 "m4v",
407 0,
408 CODEC_ID_NONE,
409 CODEC_ID_MPEG4,
410 raw_write_header,
411 raw_write_packet,
412 raw_write_trailer,
413};
764ef400 414#endif //CONFIG_ENCODERS
89b3d7c9 415
0da71265
MN
416AVInputFormat h264_iformat = {
417 "h264",
418 "raw H264 video format",
419 0,
420 NULL /*mpegvideo_probe*/,
421 video_read_header,
e15dec10 422 raw_read_partial_packet,
0da71265
MN
423 raw_read_close,
424 .extensions = "h26l,h264", //FIXME remove after writing mpeg4_probe
425 .value = CODEC_ID_H264,
426};
427
764ef400 428#ifdef CONFIG_ENCODERS
0da71265
MN
429AVOutputFormat h264_oformat = {
430 "h264",
431 "raw H264 video format",
432 NULL,
433 "h264",
434 0,
435 CODEC_ID_NONE,
436 CODEC_ID_H264,
437 raw_write_header,
438 raw_write_packet,
439 raw_write_trailer,
440};
764ef400 441#endif //CONFIG_ENCODERS
0da71265 442
c9a65ca8
FB
443AVInputFormat mpegvideo_iformat = {
444 "mpegvideo",
445 "MPEG video",
446 0,
447 mpegvideo_probe,
de6d9b64 448 video_read_header,
e15dec10 449 raw_read_partial_packet,
de6d9b64 450 raw_read_close,
bb76a117 451 .value = CODEC_ID_MPEG1VIDEO,
de6d9b64
FB
452};
453
764ef400 454#ifdef CONFIG_ENCODERS
c9a65ca8
FB
455AVOutputFormat mpeg1video_oformat = {
456 "mpeg1video",
de6d9b64
FB
457 "MPEG video",
458 "video/x-mpeg",
459 "mpg,mpeg",
460 0,
c9a65ca8 461 0,
de6d9b64
FB
462 CODEC_ID_MPEG1VIDEO,
463 raw_write_header,
464 raw_write_packet,
465 raw_write_trailer,
de6d9b64 466};
764ef400 467#endif //CONFIG_ENCODERS
de6d9b64 468
6ec864da
MN
469#ifdef CONFIG_ENCODERS
470AVOutputFormat mpeg2video_oformat = {
471 "mpeg2video",
472 "MPEG2 video",
473 NULL,
474 "m2v",
475 0,
476 0,
477 CODEC_ID_MPEG2VIDEO,
478 raw_write_header,
479 raw_write_packet,
480 raw_write_trailer,
481};
482#endif //CONFIG_ENCODERS
483
c9a65ca8 484AVInputFormat mjpeg_iformat = {
27e084bd
FB
485 "mjpeg",
486 "MJPEG video",
27e084bd 487 0,
c9a65ca8 488 NULL,
27e084bd 489 video_read_header,
e15dec10 490 raw_read_partial_packet,
27e084bd 491 raw_read_close,
bb76a117
MR
492 .extensions = "mjpg,mjpeg",
493 .value = CODEC_ID_MJPEG,
27e084bd
FB
494};
495
764ef400 496#ifdef CONFIG_ENCODERS
c9a65ca8
FB
497AVOutputFormat mjpeg_oformat = {
498 "mjpeg",
499 "MJPEG video",
500 "video/x-mjpeg",
501 "mjpg,mjpeg",
5ed8fafc 502 0,
5ed8fafc 503 0,
c9a65ca8 504 CODEC_ID_MJPEG,
5ed8fafc
FB
505 raw_write_header,
506 raw_write_packet,
507 raw_write_trailer,
5ed8fafc 508};
764ef400 509#endif //CONFIG_ENCODERS
5ed8fafc 510
c9a65ca8 511/* pcm formats */
764ef400 512
4986a429 513#define PCMINPUTDEF(name, long_name, ext, codec) \
764ef400
MM
514AVInputFormat pcm_ ## name ## _iformat = {\
515 #name,\
516 long_name,\
517 0,\
518 NULL,\
519 raw_read_header,\
520 raw_read_packet,\
521 raw_read_close,\
4986a429 522 pcm_read_seek,\
764ef400
MM
523 .extensions = ext,\
524 .value = codec,\
525};
526
4986a429
FB
527#if !defined(CONFIG_ENCODERS) && defined(CONFIG_DECODERS)
528
529#define PCMDEF(name, long_name, ext, codec) \
530 PCMINPUTDEF(name, long_name, ext, codec)
531
764ef400 532#else
5ed8fafc 533
c9a65ca8 534#define PCMDEF(name, long_name, ext, codec) \
4986a429 535 PCMINPUTDEF(name, long_name, ext, codec)\
c9a65ca8
FB
536\
537AVOutputFormat pcm_ ## name ## _oformat = {\
538 #name,\
539 long_name,\
540 NULL,\
541 ext,\
542 0,\
543 codec,\
544 0,\
545 raw_write_header,\
546 raw_write_packet,\
547 raw_write_trailer,\
5ed8fafc 548};
764ef400 549#endif //CONFIG_ENCODERS
5ed8fafc 550
5ed8fafc 551#ifdef WORDS_BIGENDIAN
c9a65ca8
FB
552#define BE_DEF(s) s
553#define LE_DEF(s) NULL
5ed8fafc 554#else
c9a65ca8
FB
555#define BE_DEF(s) NULL
556#define LE_DEF(s) s
5ed8fafc 557#endif
5ed8fafc 558
5ed8fafc 559
c9a65ca8
FB
560PCMDEF(s16le, "pcm signed 16 bit little endian format",
561 LE_DEF("sw"), CODEC_ID_PCM_S16LE)
5ed8fafc 562
c9a65ca8
FB
563PCMDEF(s16be, "pcm signed 16 bit big endian format",
564 BE_DEF("sw"), CODEC_ID_PCM_S16BE)
5ed8fafc 565
c9a65ca8
FB
566PCMDEF(u16le, "pcm unsigned 16 bit little endian format",
567 LE_DEF("uw"), CODEC_ID_PCM_U16LE)
5ed8fafc 568
c9a65ca8
FB
569PCMDEF(u16be, "pcm unsigned 16 bit big endian format",
570 BE_DEF("uw"), CODEC_ID_PCM_U16BE)
5ed8fafc 571
c9a65ca8
FB
572PCMDEF(s8, "pcm signed 8 bit format",
573 "sb", CODEC_ID_PCM_S8)
5ed8fafc 574
c9a65ca8
FB
575PCMDEF(u8, "pcm unsigned 8 bit format",
576 "ub", CODEC_ID_PCM_U8)
5ed8fafc 577
c9a65ca8
FB
578PCMDEF(mulaw, "pcm mu law format",
579 "ul", CODEC_ID_PCM_MULAW)
de6d9b64 580
c9a65ca8
FB
581PCMDEF(alaw, "pcm A law format",
582 "al", CODEC_ID_PCM_ALAW)
de6d9b64 583
5c91a675 584static int rawvideo_read_packet(AVFormatContext *s, AVPacket *pkt)
de6d9b64
FB
585{
586 int packet_size, ret, width, height;
587 AVStream *st = s->streams[0];
588
589 width = st->codec.width;
590 height = st->codec.height;
591
63167088
RS
592 packet_size = avpicture_get_size(st->codec.pix_fmt, width, height);
593 if (packet_size < 0)
71c32f19 594 return -1;
de6d9b64
FB
595
596 if (av_new_packet(pkt, packet_size) < 0)
0bd586c5 597 return AVERROR_IO;
de6d9b64
FB
598
599 pkt->stream_index = 0;
c2c2cd2d 600#if 0
de6d9b64
FB
601 /* bypass buffered I/O */
602 ret = url_read(url_fileno(&s->pb), pkt->data, pkt->size);
c2c2cd2d
MN
603#else
604 ret = get_buffer(&s->pb, pkt->data, pkt->size);
605#endif
de6d9b64
FB
606 if (ret != pkt->size) {
607 av_free_packet(pkt);
0bd586c5 608 return AVERROR_IO;
de6d9b64
FB
609 } else {
610 return 0;
611 }
612}
613
c9a65ca8
FB
614AVInputFormat rawvideo_iformat = {
615 "rawvideo",
616 "raw video format",
617 0,
618 NULL,
619 raw_read_header,
620 rawvideo_read_packet,
621 raw_read_close,
bb76a117
MR
622 .extensions = "yuv",
623 .value = CODEC_ID_RAWVIDEO,
c9a65ca8
FB
624};
625
764ef400 626#ifdef CONFIG_ENCODERS
c9a65ca8 627AVOutputFormat rawvideo_oformat = {
de6d9b64
FB
628 "rawvideo",
629 "raw video format",
630 NULL,
631 "yuv",
c9a65ca8 632 0,
de6d9b64
FB
633 CODEC_ID_NONE,
634 CODEC_ID_RAWVIDEO,
635 raw_write_header,
636 raw_write_packet,
637 raw_write_trailer,
de6d9b64 638};
764ef400 639#endif //CONFIG_ENCODERS
c9a65ca8 640
764ef400 641#ifdef CONFIG_ENCODERS
e928649b 642static int null_write_packet(struct AVFormatContext *s, AVPacket *pkt)
87bdd3e5
FB
643{
644 return 0;
645}
646
647AVOutputFormat null_oformat = {
648 "null",
649 "null video format",
650 NULL,
651 NULL,
652 0,
653#ifdef WORDS_BIGENDIAN
654 CODEC_ID_PCM_S16BE,
655#else
656 CODEC_ID_PCM_S16LE,
657#endif
658 CODEC_ID_RAWVIDEO,
659 raw_write_header,
660 null_write_packet,
661 raw_write_trailer,
b1d89f82 662 .flags = AVFMT_NOFILE | AVFMT_RAWPICTURE,
87bdd3e5 663};
764ef400
MM
664#endif //CONFIG_ENCODERS
665
666#ifndef CONFIG_ENCODERS
667#define av_register_output_format(format)
668#endif
669#ifndef CONFIG_DECODERS
670#define av_register_input_format(format)
671#endif
87bdd3e5 672
c9a65ca8
FB
673int raw_init(void)
674{
c9a65ca8
FB
675 av_register_input_format(&ac3_iformat);
676 av_register_output_format(&ac3_oformat);
677
23c99253
MN
678 av_register_input_format(&dts_iformat);
679
c6148de2 680 av_register_input_format(&h261_iformat);
1c3990db 681 av_register_output_format(&h261_oformat);
c6148de2 682
d07f9043 683 av_register_input_format(&h263_iformat);
c9a65ca8 684 av_register_output_format(&h263_oformat);
89b3d7c9 685
7866eeff 686 av_register_input_format(&m4v_iformat);
89b3d7c9 687 av_register_output_format(&m4v_oformat);
0da71265
MN
688
689 av_register_input_format(&h264_iformat);
690 av_register_output_format(&h264_oformat);
c9a65ca8
FB
691
692 av_register_input_format(&mpegvideo_iformat);
693 av_register_output_format(&mpeg1video_oformat);
694
6ec864da
MN
695 av_register_output_format(&mpeg2video_oformat);
696
c9a65ca8
FB
697 av_register_input_format(&mjpeg_iformat);
698 av_register_output_format(&mjpeg_oformat);
699
700 av_register_input_format(&pcm_s16le_iformat);
701 av_register_output_format(&pcm_s16le_oformat);
702 av_register_input_format(&pcm_s16be_iformat);
703 av_register_output_format(&pcm_s16be_oformat);
704 av_register_input_format(&pcm_u16le_iformat);
705 av_register_output_format(&pcm_u16le_oformat);
706 av_register_input_format(&pcm_u16be_iformat);
707 av_register_output_format(&pcm_u16be_oformat);
708 av_register_input_format(&pcm_s8_iformat);
709 av_register_output_format(&pcm_s8_oformat);
710 av_register_input_format(&pcm_u8_iformat);
711 av_register_output_format(&pcm_u8_oformat);
712 av_register_input_format(&pcm_mulaw_iformat);
713 av_register_output_format(&pcm_mulaw_oformat);
714 av_register_input_format(&pcm_alaw_iformat);
715 av_register_output_format(&pcm_alaw_oformat);
716
717 av_register_input_format(&rawvideo_iformat);
718 av_register_output_format(&rawvideo_oformat);
87bdd3e5
FB
719
720 av_register_output_format(&null_oformat);
c9a65ca8
FB
721 return 0;
722}