You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

823 lines
19KB

  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. #ifdef CONFIG_MUXERS
  22. /* simple formats */
  23. static int raw_write_header(struct AVFormatContext *s)
  24. {
  25. return 0;
  26. }
  27. static int raw_write_packet(struct AVFormatContext *s, AVPacket *pkt)
  28. {
  29. put_buffer(&s->pb, pkt->data, pkt->size);
  30. put_flush_packet(&s->pb);
  31. return 0;
  32. }
  33. static int raw_write_trailer(struct AVFormatContext *s)
  34. {
  35. return 0;
  36. }
  37. #endif //CONFIG_MUXERS
  38. /* raw input */
  39. static int raw_read_header(AVFormatContext *s, AVFormatParameters *ap)
  40. {
  41. AVStream *st;
  42. int id;
  43. st = av_new_stream(s, 0);
  44. if (!st)
  45. return AVERROR_NOMEM;
  46. if (ap) {
  47. id = s->iformat->value;
  48. if (id == CODEC_ID_RAWVIDEO) {
  49. st->codec->codec_type = CODEC_TYPE_VIDEO;
  50. } else {
  51. st->codec->codec_type = CODEC_TYPE_AUDIO;
  52. }
  53. st->codec->codec_id = id;
  54. switch(st->codec->codec_type) {
  55. case CODEC_TYPE_AUDIO:
  56. st->codec->sample_rate = ap->sample_rate;
  57. st->codec->channels = ap->channels;
  58. av_set_pts_info(st, 64, 1, st->codec->sample_rate);
  59. break;
  60. case CODEC_TYPE_VIDEO:
  61. av_set_pts_info(st, 64, ap->time_base.num, ap->time_base.den);
  62. st->codec->width = ap->width;
  63. st->codec->height = ap->height;
  64. st->codec->pix_fmt = ap->pix_fmt;
  65. if(st->codec->pix_fmt == PIX_FMT_NONE)
  66. st->codec->pix_fmt= PIX_FMT_YUV420P;
  67. break;
  68. default:
  69. return -1;
  70. }
  71. } else {
  72. return -1;
  73. }
  74. return 0;
  75. }
  76. #define RAW_PACKET_SIZE 1024
  77. static int raw_read_packet(AVFormatContext *s, AVPacket *pkt)
  78. {
  79. int ret, size;
  80. // AVStream *st = s->streams[0];
  81. size= RAW_PACKET_SIZE;
  82. ret= av_get_packet(&s->pb, pkt, size);
  83. pkt->stream_index = 0;
  84. if (ret <= 0) {
  85. return AVERROR_IO;
  86. }
  87. /* note: we need to modify the packet size here to handle the last
  88. packet */
  89. pkt->size = ret;
  90. return ret;
  91. }
  92. static int raw_read_partial_packet(AVFormatContext *s, AVPacket *pkt)
  93. {
  94. int ret, size;
  95. size = RAW_PACKET_SIZE;
  96. if (av_new_packet(pkt, size) < 0)
  97. return AVERROR_IO;
  98. pkt->pos= url_ftell(&s->pb);
  99. pkt->stream_index = 0;
  100. ret = get_partial_buffer(&s->pb, pkt->data, size);
  101. if (ret <= 0) {
  102. av_free_packet(pkt);
  103. return AVERROR_IO;
  104. }
  105. pkt->size = ret;
  106. return ret;
  107. }
  108. // http://www.artificis.hu/files/texts/ingenient.txt
  109. static int ingenient_read_packet(AVFormatContext *s, AVPacket *pkt)
  110. {
  111. int ret, size, w, h, unk1, unk2;
  112. if (get_le32(&s->pb) != MKTAG('M', 'J', 'P', 'G'))
  113. return AVERROR_IO; // FIXME
  114. size = get_le32(&s->pb);
  115. w = get_le16(&s->pb);
  116. h = get_le16(&s->pb);
  117. url_fskip(&s->pb, 8); // zero + size (padded?)
  118. url_fskip(&s->pb, 2);
  119. unk1 = get_le16(&s->pb);
  120. unk2 = get_le16(&s->pb);
  121. url_fskip(&s->pb, 22); // ascii timestamp
  122. av_log(NULL, AV_LOG_DEBUG, "Ingenient packet: size=%d, width=%d, height=%d, unk1=%d unk2=%d\n",
  123. size, w, h, unk1, unk2);
  124. if (av_new_packet(pkt, size) < 0)
  125. return AVERROR_IO;
  126. pkt->pos = url_ftell(&s->pb);
  127. pkt->stream_index = 0;
  128. ret = get_buffer(&s->pb, pkt->data, size);
  129. if (ret <= 0) {
  130. av_free_packet(pkt);
  131. return AVERROR_IO;
  132. }
  133. pkt->size = ret;
  134. return ret;
  135. }
  136. static int raw_read_close(AVFormatContext *s)
  137. {
  138. return 0;
  139. }
  140. int pcm_read_seek(AVFormatContext *s,
  141. int stream_index, int64_t timestamp, int flags)
  142. {
  143. AVStream *st;
  144. int block_align, byte_rate;
  145. int64_t pos;
  146. st = s->streams[0];
  147. switch(st->codec->codec_id) {
  148. case CODEC_ID_PCM_S16LE:
  149. case CODEC_ID_PCM_S16BE:
  150. case CODEC_ID_PCM_U16LE:
  151. case CODEC_ID_PCM_U16BE:
  152. block_align = 2 * st->codec->channels;
  153. byte_rate = block_align * st->codec->sample_rate;
  154. break;
  155. case CODEC_ID_PCM_S8:
  156. case CODEC_ID_PCM_U8:
  157. case CODEC_ID_PCM_MULAW:
  158. case CODEC_ID_PCM_ALAW:
  159. block_align = st->codec->channels;
  160. byte_rate = block_align * st->codec->sample_rate;
  161. break;
  162. default:
  163. block_align = st->codec->block_align;
  164. byte_rate = st->codec->bit_rate / 8;
  165. break;
  166. }
  167. if (block_align <= 0 || byte_rate <= 0)
  168. return -1;
  169. /* compute the position by aligning it to block_align */
  170. pos = av_rescale_rnd(timestamp * byte_rate,
  171. st->time_base.num,
  172. st->time_base.den * (int64_t)block_align,
  173. (flags & AVSEEK_FLAG_BACKWARD) ? AV_ROUND_DOWN : AV_ROUND_UP);
  174. pos *= block_align;
  175. /* recompute exact position */
  176. st->cur_dts = av_rescale(pos, st->time_base.den, byte_rate * (int64_t)st->time_base.num);
  177. url_fseek(&s->pb, pos + s->data_offset, SEEK_SET);
  178. return 0;
  179. }
  180. /* ac3 read */
  181. static int ac3_read_header(AVFormatContext *s,
  182. AVFormatParameters *ap)
  183. {
  184. AVStream *st;
  185. st = av_new_stream(s, 0);
  186. if (!st)
  187. return AVERROR_NOMEM;
  188. st->codec->codec_type = CODEC_TYPE_AUDIO;
  189. st->codec->codec_id = CODEC_ID_AC3;
  190. st->need_parsing = 1;
  191. /* the parameters will be extracted from the compressed bitstream */
  192. return 0;
  193. }
  194. static int shorten_read_header(AVFormatContext *s,
  195. AVFormatParameters *ap)
  196. {
  197. AVStream *st;
  198. st = av_new_stream(s, 0);
  199. if (!st)
  200. return AVERROR_NOMEM;
  201. st->codec->codec_type = CODEC_TYPE_AUDIO;
  202. st->codec->codec_id = CODEC_ID_SHORTEN;
  203. st->need_parsing = 1;
  204. /* the parameters will be extracted from the compressed bitstream */
  205. return 0;
  206. }
  207. /* dts read */
  208. static int dts_read_header(AVFormatContext *s,
  209. AVFormatParameters *ap)
  210. {
  211. AVStream *st;
  212. st = av_new_stream(s, 0);
  213. if (!st)
  214. return AVERROR_NOMEM;
  215. st->codec->codec_type = CODEC_TYPE_AUDIO;
  216. st->codec->codec_id = CODEC_ID_DTS;
  217. st->need_parsing = 1;
  218. /* the parameters will be extracted from the compressed bitstream */
  219. return 0;
  220. }
  221. /* aac read */
  222. static int aac_read_header(AVFormatContext *s,
  223. AVFormatParameters *ap)
  224. {
  225. AVStream *st;
  226. st = av_new_stream(s, 0);
  227. if (!st)
  228. return AVERROR_NOMEM;
  229. st->codec->codec_type = CODEC_TYPE_AUDIO;
  230. st->codec->codec_id = CODEC_ID_AAC;
  231. st->need_parsing = 1;
  232. /* the parameters will be extracted from the compressed bitstream */
  233. return 0;
  234. }
  235. /* mpeg1/h263 input */
  236. static int video_read_header(AVFormatContext *s,
  237. AVFormatParameters *ap)
  238. {
  239. AVStream *st;
  240. st = av_new_stream(s, 0);
  241. if (!st)
  242. return AVERROR_NOMEM;
  243. st->codec->codec_type = CODEC_TYPE_VIDEO;
  244. st->codec->codec_id = s->iformat->value;
  245. st->need_parsing = 1;
  246. /* for mjpeg, specify frame rate */
  247. /* for mpeg4 specify it too (most mpeg4 streams dont have the fixed_vop_rate set ...)*/
  248. if (ap && ap->time_base.num) {
  249. av_set_pts_info(st, 64, ap->time_base.num, ap->time_base.den);
  250. } else if ( st->codec->codec_id == CODEC_ID_MJPEG ||
  251. st->codec->codec_id == CODEC_ID_MPEG4 ||
  252. st->codec->codec_id == CODEC_ID_H264) {
  253. av_set_pts_info(st, 64, 1, 25);
  254. }
  255. return 0;
  256. }
  257. #define SEQ_START_CODE 0x000001b3
  258. #define GOP_START_CODE 0x000001b8
  259. #define PICTURE_START_CODE 0x00000100
  260. #define SLICE_START_CODE 0x00000101
  261. #define PACK_START_CODE 0x000001ba
  262. #define VIDEO_ID 0x000001e0
  263. #define AUDIO_ID 0x000001c0
  264. static int mpegvideo_probe(AVProbeData *p)
  265. {
  266. uint32_t code= -1;
  267. int pic=0, seq=0, slice=0, pspack=0, pes=0;
  268. int i;
  269. for(i=0; i<p->buf_size; i++){
  270. code = (code<<8) + p->buf[i];
  271. if ((code & 0xffffff00) == 0x100) {
  272. switch(code){
  273. case SEQ_START_CODE: seq++; break;
  274. case PICTURE_START_CODE: pic++; break;
  275. case SLICE_START_CODE: slice++; break;
  276. case PACK_START_CODE: pspack++; break;
  277. case VIDEO_ID:
  278. case AUDIO_ID: pes++; break;
  279. }
  280. }
  281. }
  282. if(seq && seq*9<=pic*10 && pic*9<=slice*10 && !pspack && !pes)
  283. return AVPROBE_SCORE_MAX/2+1; // +1 for .mpg
  284. return 0;
  285. }
  286. static int h263_probe(AVProbeData *p)
  287. {
  288. int code;
  289. const uint8_t *d;
  290. if (p->buf_size < 6)
  291. return 0;
  292. d = p->buf;
  293. code = (d[0] << 14) | (d[1] << 6) | (d[2] >> 2);
  294. if (code == 0x20) {
  295. return 50;
  296. }
  297. return 0;
  298. }
  299. static int h261_probe(AVProbeData *p)
  300. {
  301. int code;
  302. const uint8_t *d;
  303. if (p->buf_size < 6)
  304. return 0;
  305. d = p->buf;
  306. code = (d[0] << 12) | (d[1] << 4) | (d[2] >> 4);
  307. if (code == 0x10) {
  308. return 50;
  309. }
  310. return 0;
  311. }
  312. AVInputFormat shorten_iformat = {
  313. "shn",
  314. "raw shorten",
  315. 0,
  316. NULL,
  317. shorten_read_header,
  318. raw_read_partial_packet,
  319. raw_read_close,
  320. .extensions = "shn",
  321. };
  322. AVInputFormat ac3_iformat = {
  323. "ac3",
  324. "raw ac3",
  325. 0,
  326. NULL,
  327. ac3_read_header,
  328. raw_read_partial_packet,
  329. raw_read_close,
  330. .extensions = "ac3",
  331. };
  332. #ifdef CONFIG_MUXERS
  333. AVOutputFormat ac3_oformat = {
  334. "ac3",
  335. "raw ac3",
  336. "audio/x-ac3",
  337. "ac3",
  338. 0,
  339. CODEC_ID_AC3,
  340. 0,
  341. raw_write_header,
  342. raw_write_packet,
  343. raw_write_trailer,
  344. };
  345. #endif //CONFIG_MUXERS
  346. AVInputFormat dts_iformat = {
  347. "dts",
  348. "raw dts",
  349. 0,
  350. NULL,
  351. dts_read_header,
  352. raw_read_partial_packet,
  353. raw_read_close,
  354. .extensions = "dts",
  355. };
  356. AVInputFormat aac_iformat = {
  357. "aac",
  358. "ADTS AAC",
  359. 0,
  360. NULL,
  361. aac_read_header,
  362. raw_read_partial_packet,
  363. raw_read_close,
  364. .extensions = "aac",
  365. };
  366. AVInputFormat h261_iformat = {
  367. "h261",
  368. "raw h261",
  369. 0,
  370. h261_probe,
  371. video_read_header,
  372. raw_read_partial_packet,
  373. raw_read_close,
  374. .extensions = "h261",
  375. .value = CODEC_ID_H261,
  376. };
  377. #ifdef CONFIG_MUXERS
  378. AVOutputFormat h261_oformat = {
  379. "h261",
  380. "raw h261",
  381. "video/x-h261",
  382. "h261",
  383. 0,
  384. 0,
  385. CODEC_ID_H261,
  386. raw_write_header,
  387. raw_write_packet,
  388. raw_write_trailer,
  389. };
  390. #endif //CONFIG_MUXERS
  391. AVInputFormat h263_iformat = {
  392. "h263",
  393. "raw h263",
  394. 0,
  395. h263_probe,
  396. video_read_header,
  397. raw_read_partial_packet,
  398. raw_read_close,
  399. // .extensions = "h263", //FIXME remove after writing mpeg4_probe
  400. .value = CODEC_ID_H263,
  401. };
  402. #ifdef CONFIG_MUXERS
  403. AVOutputFormat h263_oformat = {
  404. "h263",
  405. "raw h263",
  406. "video/x-h263",
  407. "h263",
  408. 0,
  409. 0,
  410. CODEC_ID_H263,
  411. raw_write_header,
  412. raw_write_packet,
  413. raw_write_trailer,
  414. };
  415. #endif //CONFIG_MUXERS
  416. AVInputFormat m4v_iformat = {
  417. "m4v",
  418. "raw MPEG4 video format",
  419. 0,
  420. NULL /*mpegvideo_probe*/,
  421. video_read_header,
  422. raw_read_partial_packet,
  423. raw_read_close,
  424. .extensions = "m4v", //FIXME remove after writing mpeg4_probe
  425. .value = CODEC_ID_MPEG4,
  426. };
  427. #ifdef CONFIG_MUXERS
  428. AVOutputFormat m4v_oformat = {
  429. "m4v",
  430. "raw MPEG4 video format",
  431. NULL,
  432. "m4v",
  433. 0,
  434. CODEC_ID_NONE,
  435. CODEC_ID_MPEG4,
  436. raw_write_header,
  437. raw_write_packet,
  438. raw_write_trailer,
  439. };
  440. #endif //CONFIG_MUXERS
  441. AVInputFormat h264_iformat = {
  442. "h264",
  443. "raw H264 video format",
  444. 0,
  445. NULL /*mpegvideo_probe*/,
  446. video_read_header,
  447. raw_read_partial_packet,
  448. raw_read_close,
  449. .extensions = "h26l,h264,264", //FIXME remove after writing mpeg4_probe
  450. .value = CODEC_ID_H264,
  451. };
  452. #ifdef CONFIG_MUXERS
  453. AVOutputFormat h264_oformat = {
  454. "h264",
  455. "raw H264 video format",
  456. NULL,
  457. "h264",
  458. 0,
  459. CODEC_ID_NONE,
  460. CODEC_ID_H264,
  461. raw_write_header,
  462. raw_write_packet,
  463. raw_write_trailer,
  464. };
  465. #endif //CONFIG_MUXERS
  466. AVInputFormat mpegvideo_iformat = {
  467. "mpegvideo",
  468. "MPEG video",
  469. 0,
  470. mpegvideo_probe,
  471. video_read_header,
  472. raw_read_partial_packet,
  473. raw_read_close,
  474. .value = CODEC_ID_MPEG1VIDEO,
  475. };
  476. #ifdef CONFIG_MUXERS
  477. AVOutputFormat mpeg1video_oformat = {
  478. "mpeg1video",
  479. "MPEG video",
  480. "video/x-mpeg",
  481. "mpg,mpeg,m1v",
  482. 0,
  483. 0,
  484. CODEC_ID_MPEG1VIDEO,
  485. raw_write_header,
  486. raw_write_packet,
  487. raw_write_trailer,
  488. };
  489. #endif //CONFIG_MUXERS
  490. #ifdef CONFIG_MUXERS
  491. AVOutputFormat mpeg2video_oformat = {
  492. "mpeg2video",
  493. "MPEG2 video",
  494. NULL,
  495. "m2v",
  496. 0,
  497. 0,
  498. CODEC_ID_MPEG2VIDEO,
  499. raw_write_header,
  500. raw_write_packet,
  501. raw_write_trailer,
  502. };
  503. #endif //CONFIG_MUXERS
  504. AVInputFormat mjpeg_iformat = {
  505. "mjpeg",
  506. "MJPEG video",
  507. 0,
  508. NULL,
  509. video_read_header,
  510. raw_read_partial_packet,
  511. raw_read_close,
  512. .extensions = "mjpg,mjpeg",
  513. .value = CODEC_ID_MJPEG,
  514. };
  515. AVInputFormat ingenient_iformat = {
  516. "ingenient",
  517. "Ingenient MJPEG",
  518. 0,
  519. NULL,
  520. video_read_header,
  521. ingenient_read_packet,
  522. raw_read_close,
  523. .extensions = "cgi", // FIXME
  524. .value = CODEC_ID_MJPEG,
  525. };
  526. #ifdef CONFIG_MUXERS
  527. AVOutputFormat mjpeg_oformat = {
  528. "mjpeg",
  529. "MJPEG video",
  530. "video/x-mjpeg",
  531. "mjpg,mjpeg",
  532. 0,
  533. 0,
  534. CODEC_ID_MJPEG,
  535. raw_write_header,
  536. raw_write_packet,
  537. raw_write_trailer,
  538. };
  539. #endif //CONFIG_MUXERS
  540. /* pcm formats */
  541. #define PCMINPUTDEF(name, long_name, ext, codec) \
  542. AVInputFormat pcm_ ## name ## _iformat = {\
  543. #name,\
  544. long_name,\
  545. 0,\
  546. NULL,\
  547. raw_read_header,\
  548. raw_read_packet,\
  549. raw_read_close,\
  550. pcm_read_seek,\
  551. .extensions = ext,\
  552. .value = codec,\
  553. };
  554. #if !defined(CONFIG_MUXERS) && defined(CONFIG_DEMUXERS)
  555. #define PCMDEF(name, long_name, ext, codec) \
  556. PCMINPUTDEF(name, long_name, ext, codec)
  557. #else
  558. #define PCMDEF(name, long_name, ext, codec) \
  559. PCMINPUTDEF(name, long_name, ext, codec)\
  560. \
  561. AVOutputFormat pcm_ ## name ## _oformat = {\
  562. #name,\
  563. long_name,\
  564. NULL,\
  565. ext,\
  566. 0,\
  567. codec,\
  568. 0,\
  569. raw_write_header,\
  570. raw_write_packet,\
  571. raw_write_trailer,\
  572. };
  573. #endif //CONFIG_MUXERS
  574. #ifdef WORDS_BIGENDIAN
  575. #define BE_DEF(s) s
  576. #define LE_DEF(s) NULL
  577. #else
  578. #define BE_DEF(s) NULL
  579. #define LE_DEF(s) s
  580. #endif
  581. PCMDEF(s16le, "pcm signed 16 bit little endian format",
  582. LE_DEF("sw"), CODEC_ID_PCM_S16LE)
  583. PCMDEF(s16be, "pcm signed 16 bit big endian format",
  584. BE_DEF("sw"), CODEC_ID_PCM_S16BE)
  585. PCMDEF(u16le, "pcm unsigned 16 bit little endian format",
  586. LE_DEF("uw"), CODEC_ID_PCM_U16LE)
  587. PCMDEF(u16be, "pcm unsigned 16 bit big endian format",
  588. BE_DEF("uw"), CODEC_ID_PCM_U16BE)
  589. PCMDEF(s8, "pcm signed 8 bit format",
  590. "sb", CODEC_ID_PCM_S8)
  591. PCMDEF(u8, "pcm unsigned 8 bit format",
  592. "ub", CODEC_ID_PCM_U8)
  593. PCMDEF(mulaw, "pcm mu law format",
  594. "ul", CODEC_ID_PCM_MULAW)
  595. PCMDEF(alaw, "pcm A law format",
  596. "al", CODEC_ID_PCM_ALAW)
  597. static int rawvideo_read_packet(AVFormatContext *s, AVPacket *pkt)
  598. {
  599. int packet_size, ret, width, height;
  600. AVStream *st = s->streams[0];
  601. width = st->codec->width;
  602. height = st->codec->height;
  603. packet_size = avpicture_get_size(st->codec->pix_fmt, width, height);
  604. if (packet_size < 0)
  605. return -1;
  606. ret= av_get_packet(&s->pb, pkt, packet_size);
  607. pkt->stream_index = 0;
  608. if (ret != packet_size) {
  609. return AVERROR_IO;
  610. } else {
  611. return 0;
  612. }
  613. }
  614. AVInputFormat rawvideo_iformat = {
  615. "rawvideo",
  616. "raw video format",
  617. 0,
  618. NULL,
  619. raw_read_header,
  620. rawvideo_read_packet,
  621. raw_read_close,
  622. .extensions = "yuv,cif,qcif",
  623. .value = CODEC_ID_RAWVIDEO,
  624. };
  625. #ifdef CONFIG_MUXERS
  626. AVOutputFormat rawvideo_oformat = {
  627. "rawvideo",
  628. "raw video format",
  629. NULL,
  630. "yuv",
  631. 0,
  632. CODEC_ID_NONE,
  633. CODEC_ID_RAWVIDEO,
  634. raw_write_header,
  635. raw_write_packet,
  636. raw_write_trailer,
  637. };
  638. #endif //CONFIG_MUXERS
  639. #ifdef CONFIG_MUXERS
  640. static int null_write_packet(struct AVFormatContext *s, AVPacket *pkt)
  641. {
  642. return 0;
  643. }
  644. AVOutputFormat null_oformat = {
  645. "null",
  646. "null video format",
  647. NULL,
  648. NULL,
  649. 0,
  650. #ifdef WORDS_BIGENDIAN
  651. CODEC_ID_PCM_S16BE,
  652. #else
  653. CODEC_ID_PCM_S16LE,
  654. #endif
  655. CODEC_ID_RAWVIDEO,
  656. raw_write_header,
  657. null_write_packet,
  658. raw_write_trailer,
  659. .flags = AVFMT_NOFILE | AVFMT_RAWPICTURE,
  660. };
  661. #endif //CONFIG_MUXERS
  662. #ifndef CONFIG_MUXERS
  663. #define av_register_output_format(format)
  664. #endif
  665. #ifndef CONFIG_DEMUXERS
  666. #define av_register_input_format(format)
  667. #endif
  668. int raw_init(void)
  669. {
  670. av_register_input_format(&shorten_iformat);
  671. av_register_input_format(&ac3_iformat);
  672. av_register_output_format(&ac3_oformat);
  673. av_register_input_format(&aac_iformat);
  674. av_register_input_format(&dts_iformat);
  675. av_register_input_format(&h261_iformat);
  676. av_register_output_format(&h261_oformat);
  677. av_register_input_format(&h263_iformat);
  678. av_register_output_format(&h263_oformat);
  679. av_register_input_format(&m4v_iformat);
  680. av_register_output_format(&m4v_oformat);
  681. av_register_input_format(&h264_iformat);
  682. av_register_output_format(&h264_oformat);
  683. av_register_input_format(&mpegvideo_iformat);
  684. av_register_output_format(&mpeg1video_oformat);
  685. av_register_output_format(&mpeg2video_oformat);
  686. av_register_input_format(&mjpeg_iformat);
  687. av_register_output_format(&mjpeg_oformat);
  688. av_register_input_format(&ingenient_iformat);
  689. av_register_input_format(&pcm_s16le_iformat);
  690. av_register_output_format(&pcm_s16le_oformat);
  691. av_register_input_format(&pcm_s16be_iformat);
  692. av_register_output_format(&pcm_s16be_oformat);
  693. av_register_input_format(&pcm_u16le_iformat);
  694. av_register_output_format(&pcm_u16le_oformat);
  695. av_register_input_format(&pcm_u16be_iformat);
  696. av_register_output_format(&pcm_u16be_oformat);
  697. av_register_input_format(&pcm_s8_iformat);
  698. av_register_output_format(&pcm_s8_oformat);
  699. av_register_input_format(&pcm_u8_iformat);
  700. av_register_output_format(&pcm_u8_oformat);
  701. av_register_input_format(&pcm_mulaw_iformat);
  702. av_register_output_format(&pcm_mulaw_oformat);
  703. av_register_input_format(&pcm_alaw_iformat);
  704. av_register_output_format(&pcm_alaw_oformat);
  705. av_register_input_format(&rawvideo_iformat);
  706. av_register_output_format(&rawvideo_oformat);
  707. av_register_output_format(&null_oformat);
  708. return 0;
  709. }