VirtualBox

source: vbox/trunk/src/libs/ffmpeg-20060710/libavformat/raw.c@ 8998

最後變更 在這個檔案從8998是 5776,由 vboxsync 提交於 17 年 前

ffmpeg: exported to OSE

檔案大小: 20.2 KB
 
1/*
2 * RAW encoder and decoder
3 * Copyright (c) 2001 Fabrice Bellard.
4 * Copyright (c) 2005 Alex Beregszaszi
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20#include "avformat.h"
21
22#ifdef CONFIG_MUXERS
23/* simple formats */
24static int raw_write_header(struct AVFormatContext *s)
25{
26 return 0;
27}
28
29static int flac_write_header(struct AVFormatContext *s)
30{
31 static const uint8_t header[8] = {
32 0x66, 0x4C, 0x61, 0x43, 0x80, 0x00, 0x00, 0x22
33 };
34 uint8_t *streaminfo = s->streams[0]->codec->extradata;
35 int len = s->streams[0]->codec->extradata_size;
36 if(streaminfo != NULL && len > 0) {
37 put_buffer(&s->pb, header, 8);
38 put_buffer(&s->pb, streaminfo, len);
39 }
40 return 0;
41}
42
43static int raw_write_packet(struct AVFormatContext *s, AVPacket *pkt)
44{
45 put_buffer(&s->pb, pkt->data, pkt->size);
46 put_flush_packet(&s->pb);
47 return 0;
48}
49
50static int raw_write_trailer(struct AVFormatContext *s)
51{
52 return 0;
53}
54#endif //CONFIG_MUXERS
55
56/* raw input */
57static int raw_read_header(AVFormatContext *s, AVFormatParameters *ap)
58{
59 AVStream *st;
60 int id;
61
62 st = av_new_stream(s, 0);
63 if (!st)
64 return AVERROR_NOMEM;
65
66 id = s->iformat->value;
67 if (id == CODEC_ID_RAWVIDEO) {
68 st->codec->codec_type = CODEC_TYPE_VIDEO;
69 } else {
70 st->codec->codec_type = CODEC_TYPE_AUDIO;
71 }
72 st->codec->codec_id = id;
73
74 switch(st->codec->codec_type) {
75 case CODEC_TYPE_AUDIO:
76 st->codec->sample_rate = ap->sample_rate;
77 st->codec->channels = ap->channels;
78 av_set_pts_info(st, 64, 1, st->codec->sample_rate);
79 break;
80 case CODEC_TYPE_VIDEO:
81 av_set_pts_info(st, 64, ap->time_base.num, ap->time_base.den);
82 st->codec->width = ap->width;
83 st->codec->height = ap->height;
84 st->codec->pix_fmt = ap->pix_fmt;
85 if(st->codec->pix_fmt == PIX_FMT_NONE)
86 st->codec->pix_fmt= PIX_FMT_YUV420P;
87 break;
88 default:
89 return -1;
90 }
91 return 0;
92}
93
94#define RAW_PACKET_SIZE 1024
95
96static int raw_read_packet(AVFormatContext *s, AVPacket *pkt)
97{
98 int ret, size;
99 // AVStream *st = s->streams[0];
100
101 size= RAW_PACKET_SIZE;
102
103 ret= av_get_packet(&s->pb, pkt, size);
104
105 pkt->stream_index = 0;
106 if (ret <= 0) {
107 return AVERROR_IO;
108 }
109 /* note: we need to modify the packet size here to handle the last
110 packet */
111 pkt->size = ret;
112 return ret;
113}
114
115static int raw_read_partial_packet(AVFormatContext *s, AVPacket *pkt)
116{
117 int ret, size;
118
119 size = RAW_PACKET_SIZE;
120
121 if (av_new_packet(pkt, size) < 0)
122 return AVERROR_IO;
123
124 pkt->pos= url_ftell(&s->pb);
125 pkt->stream_index = 0;
126 ret = get_partial_buffer(&s->pb, pkt->data, size);
127 if (ret <= 0) {
128 av_free_packet(pkt);
129 return AVERROR_IO;
130 }
131 pkt->size = ret;
132 return ret;
133}
134
135// http://www.artificis.hu/files/texts/ingenient.txt
136static int ingenient_read_packet(AVFormatContext *s, AVPacket *pkt)
137{
138 int ret, size, w, h, unk1, unk2;
139
140 if (get_le32(&s->pb) != MKTAG('M', 'J', 'P', 'G'))
141 return AVERROR_IO; // FIXME
142
143 size = get_le32(&s->pb);
144
145 w = get_le16(&s->pb);
146 h = get_le16(&s->pb);
147
148 url_fskip(&s->pb, 8); // zero + size (padded?)
149 url_fskip(&s->pb, 2);
150 unk1 = get_le16(&s->pb);
151 unk2 = get_le16(&s->pb);
152 url_fskip(&s->pb, 22); // ascii timestamp
153
154 av_log(NULL, AV_LOG_DEBUG, "Ingenient packet: size=%d, width=%d, height=%d, unk1=%d unk2=%d\n",
155 size, w, h, unk1, unk2);
156
157 if (av_new_packet(pkt, size) < 0)
158 return AVERROR_IO;
159
160 pkt->pos = url_ftell(&s->pb);
161 pkt->stream_index = 0;
162 ret = get_buffer(&s->pb, pkt->data, size);
163 if (ret <= 0) {
164 av_free_packet(pkt);
165 return AVERROR_IO;
166 }
167 pkt->size = ret;
168 return ret;
169}
170
171static int raw_read_close(AVFormatContext *s)
172{
173 return 0;
174}
175
176int pcm_read_seek(AVFormatContext *s,
177 int stream_index, int64_t timestamp, int flags)
178{
179 AVStream *st;
180 int block_align, byte_rate;
181 int64_t pos;
182
183 st = s->streams[0];
184 switch(st->codec->codec_id) {
185 case CODEC_ID_PCM_S16LE:
186 case CODEC_ID_PCM_S16BE:
187 case CODEC_ID_PCM_U16LE:
188 case CODEC_ID_PCM_U16BE:
189 block_align = 2 * st->codec->channels;
190 byte_rate = block_align * st->codec->sample_rate;
191 break;
192 case CODEC_ID_PCM_S8:
193 case CODEC_ID_PCM_U8:
194 case CODEC_ID_PCM_MULAW:
195 case CODEC_ID_PCM_ALAW:
196 block_align = st->codec->channels;
197 byte_rate = block_align * st->codec->sample_rate;
198 break;
199 default:
200 block_align = st->codec->block_align;
201 byte_rate = st->codec->bit_rate / 8;
202 break;
203 }
204
205 if (block_align <= 0 || byte_rate <= 0)
206 return -1;
207
208 /* compute the position by aligning it to block_align */
209 pos = av_rescale_rnd(timestamp * byte_rate,
210 st->time_base.num,
211 st->time_base.den * (int64_t)block_align,
212 (flags & AVSEEK_FLAG_BACKWARD) ? AV_ROUND_DOWN : AV_ROUND_UP);
213 pos *= block_align;
214
215 /* recompute exact position */
216 st->cur_dts = av_rescale(pos, st->time_base.den, byte_rate * (int64_t)st->time_base.num);
217 url_fseek(&s->pb, pos + s->data_offset, SEEK_SET);
218 return 0;
219}
220
221/* ac3 read */
222static int ac3_read_header(AVFormatContext *s,
223 AVFormatParameters *ap)
224{
225 AVStream *st;
226
227 st = av_new_stream(s, 0);
228 if (!st)
229 return AVERROR_NOMEM;
230
231 st->codec->codec_type = CODEC_TYPE_AUDIO;
232 st->codec->codec_id = CODEC_ID_AC3;
233 st->need_parsing = 1;
234 /* the parameters will be extracted from the compressed bitstream */
235 return 0;
236}
237
238static int shorten_read_header(AVFormatContext *s,
239 AVFormatParameters *ap)
240{
241 AVStream *st;
242
243 st = av_new_stream(s, 0);
244 if (!st)
245 return AVERROR_NOMEM;
246 st->codec->codec_type = CODEC_TYPE_AUDIO;
247 st->codec->codec_id = CODEC_ID_SHORTEN;
248 st->need_parsing = 1;
249 /* the parameters will be extracted from the compressed bitstream */
250 return 0;
251}
252
253/* flac read */
254static int flac_read_header(AVFormatContext *s,
255 AVFormatParameters *ap)
256{
257 AVStream *st;
258
259 st = av_new_stream(s, 0);
260 if (!st)
261 return AVERROR_NOMEM;
262 st->codec->codec_type = CODEC_TYPE_AUDIO;
263 st->codec->codec_id = CODEC_ID_FLAC;
264 st->need_parsing = 1;
265 /* the parameters will be extracted from the compressed bitstream */
266 return 0;
267}
268
269/* dts read */
270static int dts_read_header(AVFormatContext *s,
271 AVFormatParameters *ap)
272{
273 AVStream *st;
274
275 st = av_new_stream(s, 0);
276 if (!st)
277 return AVERROR_NOMEM;
278
279 st->codec->codec_type = CODEC_TYPE_AUDIO;
280 st->codec->codec_id = CODEC_ID_DTS;
281 st->need_parsing = 1;
282 /* the parameters will be extracted from the compressed bitstream */
283 return 0;
284}
285
286/* aac read */
287static int aac_read_header(AVFormatContext *s,
288 AVFormatParameters *ap)
289{
290 AVStream *st;
291
292 st = av_new_stream(s, 0);
293 if (!st)
294 return AVERROR_NOMEM;
295
296 st->codec->codec_type = CODEC_TYPE_AUDIO;
297 st->codec->codec_id = CODEC_ID_AAC;
298 st->need_parsing = 1;
299 /* the parameters will be extracted from the compressed bitstream */
300 return 0;
301}
302
303/* mpeg1/h263 input */
304static int video_read_header(AVFormatContext *s,
305 AVFormatParameters *ap)
306{
307 AVStream *st;
308
309 st = av_new_stream(s, 0);
310 if (!st)
311 return AVERROR_NOMEM;
312
313 st->codec->codec_type = CODEC_TYPE_VIDEO;
314 st->codec->codec_id = s->iformat->value;
315 st->need_parsing = 1;
316
317 /* for mjpeg, specify frame rate */
318 /* for mpeg4 specify it too (most mpeg4 streams dont have the fixed_vop_rate set ...)*/
319 if (ap->time_base.num) {
320 av_set_pts_info(st, 64, ap->time_base.num, ap->time_base.den);
321 } else if ( st->codec->codec_id == CODEC_ID_MJPEG ||
322 st->codec->codec_id == CODEC_ID_MPEG4 ||
323 st->codec->codec_id == CODEC_ID_H264) {
324 av_set_pts_info(st, 64, 1, 25);
325 }
326
327 return 0;
328}
329
330#define SEQ_START_CODE 0x000001b3
331#define GOP_START_CODE 0x000001b8
332#define PICTURE_START_CODE 0x00000100
333#define SLICE_START_CODE 0x00000101
334#define PACK_START_CODE 0x000001ba
335#define VIDEO_ID 0x000001e0
336#define AUDIO_ID 0x000001c0
337
338static int mpegvideo_probe(AVProbeData *p)
339{
340 uint32_t code= -1;
341 int pic=0, seq=0, slice=0, pspack=0, pes=0;
342 int i;
343
344 for(i=0; i<p->buf_size; i++){
345 code = (code<<8) + p->buf[i];
346 if ((code & 0xffffff00) == 0x100) {
347 switch(code){
348 case SEQ_START_CODE: seq++; break;
349 case PICTURE_START_CODE: pic++; break;
350 case SLICE_START_CODE: slice++; break;
351 case PACK_START_CODE: pspack++; break;
352 case VIDEO_ID:
353 case AUDIO_ID: pes++; break;
354 }
355 }
356 }
357 if(seq && seq*9<=pic*10 && pic*9<=slice*10 && !pspack && !pes)
358 return AVPROBE_SCORE_MAX/2+1; // +1 for .mpg
359 return 0;
360}
361
362static int h263_probe(AVProbeData *p)
363{
364 int code;
365 const uint8_t *d;
366
367 if (p->buf_size < 6)
368 return 0;
369 d = p->buf;
370 code = (d[0] << 14) | (d[1] << 6) | (d[2] >> 2);
371 if (code == 0x20) {
372 return 50;
373 }
374 return 0;
375}
376
377static int h261_probe(AVProbeData *p)
378{
379 int code;
380 const uint8_t *d;
381
382 if (p->buf_size < 6)
383 return 0;
384 d = p->buf;
385 code = (d[0] << 12) | (d[1] << 4) | (d[2] >> 4);
386 if (code == 0x10) {
387 return 50;
388 }
389 return 0;
390}
391
392AVInputFormat shorten_demuxer = {
393 "shn",
394 "raw shorten",
395 0,
396 NULL,
397 shorten_read_header,
398 raw_read_partial_packet,
399 raw_read_close,
400 .extensions = "shn",
401};
402
403AVInputFormat flac_demuxer = {
404 "flac",
405 "raw flac",
406 0,
407 NULL,
408 flac_read_header,
409 raw_read_partial_packet,
410 raw_read_close,
411 .extensions = "flac",
412};
413
414#ifdef CONFIG_MUXERS
415AVOutputFormat flac_muxer = {
416 "flac",
417 "raw flac",
418 "audio/x-flac",
419 "flac",
420 0,
421 CODEC_ID_FLAC,
422 0,
423 flac_write_header,
424 raw_write_packet,
425 raw_write_trailer,
426};
427#endif //CONFIG_MUXERS
428
429AVInputFormat ac3_demuxer = {
430 "ac3",
431 "raw ac3",
432 0,
433 NULL,
434 ac3_read_header,
435 raw_read_partial_packet,
436 raw_read_close,
437 .extensions = "ac3",
438};
439
440#ifdef CONFIG_MUXERS
441AVOutputFormat ac3_muxer = {
442 "ac3",
443 "raw ac3",
444 "audio/x-ac3",
445 "ac3",
446 0,
447 CODEC_ID_AC3,
448 0,
449 raw_write_header,
450 raw_write_packet,
451 raw_write_trailer,
452};
453#endif //CONFIG_MUXERS
454
455AVInputFormat dts_demuxer = {
456 "dts",
457 "raw dts",
458 0,
459 NULL,
460 dts_read_header,
461 raw_read_partial_packet,
462 raw_read_close,
463 .extensions = "dts",
464};
465
466AVInputFormat aac_demuxer = {
467 "aac",
468 "ADTS AAC",
469 0,
470 NULL,
471 aac_read_header,
472 raw_read_partial_packet,
473 raw_read_close,
474 .extensions = "aac",
475};
476
477AVInputFormat h261_demuxer = {
478 "h261",
479 "raw h261",
480 0,
481 h261_probe,
482 video_read_header,
483 raw_read_partial_packet,
484 raw_read_close,
485 .extensions = "h261",
486 .value = CODEC_ID_H261,
487};
488
489#ifdef CONFIG_MUXERS
490AVOutputFormat h261_muxer = {
491 "h261",
492 "raw h261",
493 "video/x-h261",
494 "h261",
495 0,
496 0,
497 CODEC_ID_H261,
498 raw_write_header,
499 raw_write_packet,
500 raw_write_trailer,
501};
502#endif //CONFIG_MUXERS
503
504AVInputFormat h263_demuxer = {
505 "h263",
506 "raw h263",
507 0,
508 h263_probe,
509 video_read_header,
510 raw_read_partial_packet,
511 raw_read_close,
512// .extensions = "h263", //FIXME remove after writing mpeg4_probe
513 .value = CODEC_ID_H263,
514};
515
516#ifdef CONFIG_MUXERS
517AVOutputFormat h263_muxer = {
518 "h263",
519 "raw h263",
520 "video/x-h263",
521 "h263",
522 0,
523 0,
524 CODEC_ID_H263,
525 raw_write_header,
526 raw_write_packet,
527 raw_write_trailer,
528};
529#endif //CONFIG_MUXERS
530
531AVInputFormat m4v_demuxer = {
532 "m4v",
533 "raw MPEG4 video format",
534 0,
535 NULL /*mpegvideo_probe*/,
536 video_read_header,
537 raw_read_partial_packet,
538 raw_read_close,
539 .extensions = "m4v", //FIXME remove after writing mpeg4_probe
540 .value = CODEC_ID_MPEG4,
541};
542
543#ifdef CONFIG_MUXERS
544AVOutputFormat m4v_muxer = {
545 "m4v",
546 "raw MPEG4 video format",
547 NULL,
548 "m4v",
549 0,
550 CODEC_ID_NONE,
551 CODEC_ID_MPEG4,
552 raw_write_header,
553 raw_write_packet,
554 raw_write_trailer,
555};
556#endif //CONFIG_MUXERS
557
558AVInputFormat h264_demuxer = {
559 "h264",
560 "raw H264 video format",
561 0,
562 NULL /*mpegvideo_probe*/,
563 video_read_header,
564 raw_read_partial_packet,
565 raw_read_close,
566 .extensions = "h26l,h264,264", //FIXME remove after writing mpeg4_probe
567 .value = CODEC_ID_H264,
568};
569
570#ifdef CONFIG_MUXERS
571AVOutputFormat h264_muxer = {
572 "h264",
573 "raw H264 video format",
574 NULL,
575 "h264",
576 0,
577 CODEC_ID_NONE,
578 CODEC_ID_H264,
579 raw_write_header,
580 raw_write_packet,
581 raw_write_trailer,
582};
583#endif //CONFIG_MUXERS
584
585AVInputFormat mpegvideo_demuxer = {
586 "mpegvideo",
587 "MPEG video",
588 0,
589 mpegvideo_probe,
590 video_read_header,
591 raw_read_partial_packet,
592 raw_read_close,
593 .value = CODEC_ID_MPEG1VIDEO,
594};
595
596#ifdef CONFIG_MUXERS
597AVOutputFormat mpeg1video_muxer = {
598 "mpeg1video",
599 "MPEG video",
600 "video/x-mpeg",
601 "mpg,mpeg,m1v",
602 0,
603 0,
604 CODEC_ID_MPEG1VIDEO,
605 raw_write_header,
606 raw_write_packet,
607 raw_write_trailer,
608};
609#endif //CONFIG_MUXERS
610
611#ifdef CONFIG_MUXERS
612AVOutputFormat mpeg2video_muxer = {
613 "mpeg2video",
614 "MPEG2 video",
615 NULL,
616 "m2v",
617 0,
618 0,
619 CODEC_ID_MPEG2VIDEO,
620 raw_write_header,
621 raw_write_packet,
622 raw_write_trailer,
623};
624#endif //CONFIG_MUXERS
625
626AVInputFormat mjpeg_demuxer = {
627 "mjpeg",
628 "MJPEG video",
629 0,
630 NULL,
631 video_read_header,
632 raw_read_partial_packet,
633 raw_read_close,
634 .extensions = "mjpg,mjpeg",
635 .value = CODEC_ID_MJPEG,
636};
637
638AVInputFormat ingenient_demuxer = {
639 "ingenient",
640 "Ingenient MJPEG",
641 0,
642 NULL,
643 video_read_header,
644 ingenient_read_packet,
645 raw_read_close,
646 .extensions = "cgi", // FIXME
647 .value = CODEC_ID_MJPEG,
648};
649
650#ifdef CONFIG_MUXERS
651AVOutputFormat mjpeg_muxer = {
652 "mjpeg",
653 "MJPEG video",
654 "video/x-mjpeg",
655 "mjpg,mjpeg",
656 0,
657 0,
658 CODEC_ID_MJPEG,
659 raw_write_header,
660 raw_write_packet,
661 raw_write_trailer,
662};
663#endif //CONFIG_MUXERS
664
665/* pcm formats */
666
667#define PCMINPUTDEF(name, long_name, ext, codec) \
668AVInputFormat pcm_ ## name ## _demuxer = {\
669 #name,\
670 long_name,\
671 0,\
672 NULL,\
673 raw_read_header,\
674 raw_read_packet,\
675 raw_read_close,\
676 pcm_read_seek,\
677 .extensions = ext,\
678 .value = codec,\
679};
680
681#define PCMOUTPUTDEF(name, long_name, ext, codec) \
682AVOutputFormat pcm_ ## name ## _muxer = {\
683 #name,\
684 long_name,\
685 NULL,\
686 ext,\
687 0,\
688 codec,\
689 0,\
690 raw_write_header,\
691 raw_write_packet,\
692 raw_write_trailer,\
693};
694
695
696#if !defined(CONFIG_MUXERS) && defined(CONFIG_DEMUXERS)
697#define PCMDEF(name, long_name, ext, codec) \
698 PCMINPUTDEF(name, long_name, ext, codec)
699#elif defined(CONFIG_MUXERS) && !defined(CONFIG_DEMUXERS)
700#define PCMDEF(name, long_name, ext, codec) \
701 PCMOUTPUTDEF(name, long_name, ext, codec)
702#elif defined(CONFIG_MUXERS) && defined(CONFIG_DEMUXERS)
703#define PCMDEF(name, long_name, ext, codec) \
704 PCMINPUTDEF(name, long_name, ext, codec)\
705 PCMOUTPUTDEF(name, long_name, ext, codec)
706#else
707#define PCMDEF(name, long_name, ext, codec)
708#endif
709
710#ifdef WORDS_BIGENDIAN
711#define BE_DEF(s) s
712#define LE_DEF(s) NULL
713#else
714#define BE_DEF(s) NULL
715#define LE_DEF(s) s
716#endif
717
718
719PCMDEF(s16le, "pcm signed 16 bit little endian format",
720 LE_DEF("sw"), CODEC_ID_PCM_S16LE)
721
722PCMDEF(s16be, "pcm signed 16 bit big endian format",
723 BE_DEF("sw"), CODEC_ID_PCM_S16BE)
724
725PCMDEF(u16le, "pcm unsigned 16 bit little endian format",
726 LE_DEF("uw"), CODEC_ID_PCM_U16LE)
727
728PCMDEF(u16be, "pcm unsigned 16 bit big endian format",
729 BE_DEF("uw"), CODEC_ID_PCM_U16BE)
730
731PCMDEF(s8, "pcm signed 8 bit format",
732 "sb", CODEC_ID_PCM_S8)
733
734PCMDEF(u8, "pcm unsigned 8 bit format",
735 "ub", CODEC_ID_PCM_U8)
736
737PCMDEF(mulaw, "pcm mu law format",
738 "ul", CODEC_ID_PCM_MULAW)
739
740PCMDEF(alaw, "pcm A law format",
741 "al", CODEC_ID_PCM_ALAW)
742
743static int rawvideo_read_packet(AVFormatContext *s, AVPacket *pkt)
744{
745 int packet_size, ret, width, height;
746 AVStream *st = s->streams[0];
747
748 width = st->codec->width;
749 height = st->codec->height;
750
751 packet_size = avpicture_get_size(st->codec->pix_fmt, width, height);
752 if (packet_size < 0)
753 return -1;
754
755 ret= av_get_packet(&s->pb, pkt, packet_size);
756
757 pkt->stream_index = 0;
758 if (ret != packet_size) {
759 return AVERROR_IO;
760 } else {
761 return 0;
762 }
763}
764
765AVInputFormat rawvideo_demuxer = {
766 "rawvideo",
767 "raw video format",
768 0,
769 NULL,
770 raw_read_header,
771 rawvideo_read_packet,
772 raw_read_close,
773 .extensions = "yuv,cif,qcif",
774 .value = CODEC_ID_RAWVIDEO,
775};
776
777#ifdef CONFIG_MUXERS
778AVOutputFormat rawvideo_muxer = {
779 "rawvideo",
780 "raw video format",
781 NULL,
782 "yuv",
783 0,
784 CODEC_ID_NONE,
785 CODEC_ID_RAWVIDEO,
786 raw_write_header,
787 raw_write_packet,
788 raw_write_trailer,
789};
790#endif //CONFIG_MUXERS
791
792#ifdef CONFIG_MUXERS
793static int null_write_packet(struct AVFormatContext *s, AVPacket *pkt)
794{
795 return 0;
796}
797
798AVOutputFormat null_muxer = {
799 "null",
800 "null video format",
801 NULL,
802 NULL,
803 0,
804#ifdef WORDS_BIGENDIAN
805 CODEC_ID_PCM_S16BE,
806#else
807 CODEC_ID_PCM_S16LE,
808#endif
809 CODEC_ID_RAWVIDEO,
810 raw_write_header,
811 null_write_packet,
812 raw_write_trailer,
813 .flags = AVFMT_NOFILE | AVFMT_RAWPICTURE,
814};
815#endif //CONFIG_MUXERS
816
817#ifndef CONFIG_MUXERS
818#define av_register_output_format(format)
819#endif
820#ifndef CONFIG_DEMUXERS
821#define av_register_input_format(format)
822#endif
823
824int raw_init(void)
825{
826
827 av_register_input_format(&shorten_demuxer);
828 av_register_input_format(&flac_demuxer);
829 av_register_output_format(&flac_muxer);
830
831 av_register_input_format(&ac3_demuxer);
832 av_register_output_format(&ac3_muxer);
833
834 av_register_input_format(&aac_demuxer);
835
836 av_register_input_format(&dts_demuxer);
837
838 av_register_input_format(&h261_demuxer);
839 av_register_output_format(&h261_muxer);
840
841 av_register_input_format(&h263_demuxer);
842 av_register_output_format(&h263_muxer);
843
844 av_register_input_format(&m4v_demuxer);
845 av_register_output_format(&m4v_muxer);
846
847 av_register_input_format(&h264_demuxer);
848 av_register_output_format(&h264_muxer);
849
850 av_register_input_format(&mpegvideo_demuxer);
851 av_register_output_format(&mpeg1video_muxer);
852
853 av_register_output_format(&mpeg2video_muxer);
854
855 av_register_input_format(&mjpeg_demuxer);
856 av_register_output_format(&mjpeg_muxer);
857
858 av_register_input_format(&ingenient_demuxer);
859
860 av_register_input_format(&pcm_s16le_demuxer);
861 av_register_output_format(&pcm_s16le_muxer);
862 av_register_input_format(&pcm_s16be_demuxer);
863 av_register_output_format(&pcm_s16be_muxer);
864 av_register_input_format(&pcm_u16le_demuxer);
865 av_register_output_format(&pcm_u16le_muxer);
866 av_register_input_format(&pcm_u16be_demuxer);
867 av_register_output_format(&pcm_u16be_muxer);
868 av_register_input_format(&pcm_s8_demuxer);
869 av_register_output_format(&pcm_s8_muxer);
870 av_register_input_format(&pcm_u8_demuxer);
871 av_register_output_format(&pcm_u8_muxer);
872 av_register_input_format(&pcm_mulaw_demuxer);
873 av_register_output_format(&pcm_mulaw_muxer);
874 av_register_input_format(&pcm_alaw_demuxer);
875 av_register_output_format(&pcm_alaw_muxer);
876
877 av_register_input_format(&rawvideo_demuxer);
878 av_register_output_format(&rawvideo_muxer);
879
880 av_register_output_format(&null_muxer);
881 return 0;
882}
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette