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.

792 lines
18KB

  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. /* mpeg1/h263 input */
  222. static int video_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_VIDEO;
  230. st->codec->codec_id = s->iformat->value;
  231. st->need_parsing = 1;
  232. /* for mjpeg, specify frame rate */
  233. /* for mpeg4 specify it too (most mpeg4 streams dont have the fixed_vop_rate set ...)*/
  234. if (ap && ap->time_base.num) {
  235. av_set_pts_info(st, 64, ap->time_base.num, ap->time_base.den);
  236. } else if ( st->codec->codec_id == CODEC_ID_MJPEG ||
  237. st->codec->codec_id == CODEC_ID_MPEG4 ||
  238. st->codec->codec_id == CODEC_ID_H264) {
  239. av_set_pts_info(st, 64, 1, 25);
  240. }
  241. return 0;
  242. }
  243. #define SEQ_START_CODE 0x000001b3
  244. #define GOP_START_CODE 0x000001b8
  245. #define PICTURE_START_CODE 0x00000100
  246. /* XXX: improve that by looking at several start codes */
  247. static int mpegvideo_probe(AVProbeData *p)
  248. {
  249. int code;
  250. const uint8_t *d;
  251. /* we search the first start code. If it is a sequence, gop or
  252. picture start code then we decide it is an mpeg video
  253. stream. We do not send highest value to give a chance to mpegts */
  254. /* NOTE: the search range was restricted to avoid too many false
  255. detections */
  256. if (p->buf_size < 6)
  257. return 0;
  258. d = p->buf;
  259. code = (d[0] << 24) | (d[1] << 16) | (d[2] << 8) | (d[3]);
  260. if ((code & 0xffffff00) == 0x100) {
  261. if (code == SEQ_START_CODE ||
  262. code == GOP_START_CODE ||
  263. code == PICTURE_START_CODE)
  264. return 50 - 1;
  265. else
  266. return 0;
  267. }
  268. return 0;
  269. }
  270. static int h263_probe(AVProbeData *p)
  271. {
  272. int code;
  273. const uint8_t *d;
  274. if (p->buf_size < 6)
  275. return 0;
  276. d = p->buf;
  277. code = (d[0] << 14) | (d[1] << 6) | (d[2] >> 2);
  278. if (code == 0x20) {
  279. return 50;
  280. }
  281. return 0;
  282. }
  283. static int h261_probe(AVProbeData *p)
  284. {
  285. int code;
  286. const uint8_t *d;
  287. if (p->buf_size < 6)
  288. return 0;
  289. d = p->buf;
  290. code = (d[0] << 12) | (d[1] << 4) | (d[2] >> 4);
  291. if (code == 0x10) {
  292. return 50;
  293. }
  294. return 0;
  295. }
  296. AVInputFormat shorten_iformat = {
  297. "shn",
  298. "raw shorten",
  299. 0,
  300. NULL,
  301. shorten_read_header,
  302. raw_read_partial_packet,
  303. raw_read_close,
  304. .extensions = "shn",
  305. };
  306. AVInputFormat ac3_iformat = {
  307. "ac3",
  308. "raw ac3",
  309. 0,
  310. NULL,
  311. ac3_read_header,
  312. raw_read_partial_packet,
  313. raw_read_close,
  314. .extensions = "ac3",
  315. };
  316. #ifdef CONFIG_MUXERS
  317. AVOutputFormat ac3_oformat = {
  318. "ac3",
  319. "raw ac3",
  320. "audio/x-ac3",
  321. "ac3",
  322. 0,
  323. CODEC_ID_AC3,
  324. 0,
  325. raw_write_header,
  326. raw_write_packet,
  327. raw_write_trailer,
  328. };
  329. #endif //CONFIG_MUXERS
  330. AVInputFormat dts_iformat = {
  331. "dts",
  332. "raw dts",
  333. 0,
  334. NULL,
  335. dts_read_header,
  336. raw_read_partial_packet,
  337. raw_read_close,
  338. .extensions = "dts",
  339. };
  340. AVInputFormat h261_iformat = {
  341. "h261",
  342. "raw h261",
  343. 0,
  344. h261_probe,
  345. video_read_header,
  346. raw_read_partial_packet,
  347. raw_read_close,
  348. .extensions = "h261",
  349. .value = CODEC_ID_H261,
  350. };
  351. #ifdef CONFIG_MUXERS
  352. AVOutputFormat h261_oformat = {
  353. "h261",
  354. "raw h261",
  355. "video/x-h261",
  356. "h261",
  357. 0,
  358. 0,
  359. CODEC_ID_H261,
  360. raw_write_header,
  361. raw_write_packet,
  362. raw_write_trailer,
  363. };
  364. #endif //CONFIG_MUXERS
  365. AVInputFormat h263_iformat = {
  366. "h263",
  367. "raw h263",
  368. 0,
  369. h263_probe,
  370. video_read_header,
  371. raw_read_partial_packet,
  372. raw_read_close,
  373. // .extensions = "h263", //FIXME remove after writing mpeg4_probe
  374. .value = CODEC_ID_H263,
  375. };
  376. #ifdef CONFIG_MUXERS
  377. AVOutputFormat h263_oformat = {
  378. "h263",
  379. "raw h263",
  380. "video/x-h263",
  381. "h263",
  382. 0,
  383. 0,
  384. CODEC_ID_H263,
  385. raw_write_header,
  386. raw_write_packet,
  387. raw_write_trailer,
  388. };
  389. #endif //CONFIG_MUXERS
  390. AVInputFormat m4v_iformat = {
  391. "m4v",
  392. "raw MPEG4 video format",
  393. 0,
  394. NULL /*mpegvideo_probe*/,
  395. video_read_header,
  396. raw_read_partial_packet,
  397. raw_read_close,
  398. .extensions = "m4v", //FIXME remove after writing mpeg4_probe
  399. .value = CODEC_ID_MPEG4,
  400. };
  401. #ifdef CONFIG_MUXERS
  402. AVOutputFormat 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. };
  414. #endif //CONFIG_MUXERS
  415. AVInputFormat h264_iformat = {
  416. "h264",
  417. "raw H264 video format",
  418. 0,
  419. NULL /*mpegvideo_probe*/,
  420. video_read_header,
  421. raw_read_partial_packet,
  422. raw_read_close,
  423. .extensions = "h26l,h264,264", //FIXME remove after writing mpeg4_probe
  424. .value = CODEC_ID_H264,
  425. };
  426. #ifdef CONFIG_MUXERS
  427. AVOutputFormat h264_oformat = {
  428. "h264",
  429. "raw H264 video format",
  430. NULL,
  431. "h264",
  432. 0,
  433. CODEC_ID_NONE,
  434. CODEC_ID_H264,
  435. raw_write_header,
  436. raw_write_packet,
  437. raw_write_trailer,
  438. };
  439. #endif //CONFIG_MUXERS
  440. AVInputFormat mpegvideo_iformat = {
  441. "mpegvideo",
  442. "MPEG video",
  443. 0,
  444. mpegvideo_probe,
  445. video_read_header,
  446. raw_read_partial_packet,
  447. raw_read_close,
  448. .value = CODEC_ID_MPEG1VIDEO,
  449. };
  450. #ifdef CONFIG_MUXERS
  451. AVOutputFormat mpeg1video_oformat = {
  452. "mpeg1video",
  453. "MPEG video",
  454. "video/x-mpeg",
  455. "mpg,mpeg,m1v",
  456. 0,
  457. 0,
  458. CODEC_ID_MPEG1VIDEO,
  459. raw_write_header,
  460. raw_write_packet,
  461. raw_write_trailer,
  462. };
  463. #endif //CONFIG_MUXERS
  464. #ifdef CONFIG_MUXERS
  465. AVOutputFormat mpeg2video_oformat = {
  466. "mpeg2video",
  467. "MPEG2 video",
  468. NULL,
  469. "m2v",
  470. 0,
  471. 0,
  472. CODEC_ID_MPEG2VIDEO,
  473. raw_write_header,
  474. raw_write_packet,
  475. raw_write_trailer,
  476. };
  477. #endif //CONFIG_MUXERS
  478. AVInputFormat mjpeg_iformat = {
  479. "mjpeg",
  480. "MJPEG video",
  481. 0,
  482. NULL,
  483. video_read_header,
  484. raw_read_partial_packet,
  485. raw_read_close,
  486. .extensions = "mjpg,mjpeg",
  487. .value = CODEC_ID_MJPEG,
  488. };
  489. AVInputFormat ingenient_iformat = {
  490. "ingenient",
  491. "Ingenient MJPEG",
  492. 0,
  493. NULL,
  494. video_read_header,
  495. ingenient_read_packet,
  496. raw_read_close,
  497. .extensions = "cgi", // FIXME
  498. .value = CODEC_ID_MJPEG,
  499. };
  500. #ifdef CONFIG_MUXERS
  501. AVOutputFormat mjpeg_oformat = {
  502. "mjpeg",
  503. "MJPEG video",
  504. "video/x-mjpeg",
  505. "mjpg,mjpeg",
  506. 0,
  507. 0,
  508. CODEC_ID_MJPEG,
  509. raw_write_header,
  510. raw_write_packet,
  511. raw_write_trailer,
  512. };
  513. #endif //CONFIG_MUXERS
  514. /* pcm formats */
  515. #define PCMINPUTDEF(name, long_name, ext, codec) \
  516. AVInputFormat pcm_ ## name ## _iformat = {\
  517. #name,\
  518. long_name,\
  519. 0,\
  520. NULL,\
  521. raw_read_header,\
  522. raw_read_packet,\
  523. raw_read_close,\
  524. pcm_read_seek,\
  525. .extensions = ext,\
  526. .value = codec,\
  527. };
  528. #if !defined(CONFIG_MUXERS) && defined(CONFIG_DEMUXERS)
  529. #define PCMDEF(name, long_name, ext, codec) \
  530. PCMINPUTDEF(name, long_name, ext, codec)
  531. #else
  532. #define PCMDEF(name, long_name, ext, codec) \
  533. PCMINPUTDEF(name, long_name, ext, codec)\
  534. \
  535. AVOutputFormat pcm_ ## name ## _oformat = {\
  536. #name,\
  537. long_name,\
  538. NULL,\
  539. ext,\
  540. 0,\
  541. codec,\
  542. 0,\
  543. raw_write_header,\
  544. raw_write_packet,\
  545. raw_write_trailer,\
  546. };
  547. #endif //CONFIG_MUXERS
  548. #ifdef WORDS_BIGENDIAN
  549. #define BE_DEF(s) s
  550. #define LE_DEF(s) NULL
  551. #else
  552. #define BE_DEF(s) NULL
  553. #define LE_DEF(s) s
  554. #endif
  555. PCMDEF(s16le, "pcm signed 16 bit little endian format",
  556. LE_DEF("sw"), CODEC_ID_PCM_S16LE)
  557. PCMDEF(s16be, "pcm signed 16 bit big endian format",
  558. BE_DEF("sw"), CODEC_ID_PCM_S16BE)
  559. PCMDEF(u16le, "pcm unsigned 16 bit little endian format",
  560. LE_DEF("uw"), CODEC_ID_PCM_U16LE)
  561. PCMDEF(u16be, "pcm unsigned 16 bit big endian format",
  562. BE_DEF("uw"), CODEC_ID_PCM_U16BE)
  563. PCMDEF(s8, "pcm signed 8 bit format",
  564. "sb", CODEC_ID_PCM_S8)
  565. PCMDEF(u8, "pcm unsigned 8 bit format",
  566. "ub", CODEC_ID_PCM_U8)
  567. PCMDEF(mulaw, "pcm mu law format",
  568. "ul", CODEC_ID_PCM_MULAW)
  569. PCMDEF(alaw, "pcm A law format",
  570. "al", CODEC_ID_PCM_ALAW)
  571. static int rawvideo_read_packet(AVFormatContext *s, AVPacket *pkt)
  572. {
  573. int packet_size, ret, width, height;
  574. AVStream *st = s->streams[0];
  575. width = st->codec->width;
  576. height = st->codec->height;
  577. packet_size = avpicture_get_size(st->codec->pix_fmt, width, height);
  578. if (packet_size < 0)
  579. return -1;
  580. ret= av_get_packet(&s->pb, pkt, packet_size);
  581. pkt->stream_index = 0;
  582. if (ret != packet_size) {
  583. return AVERROR_IO;
  584. } else {
  585. return 0;
  586. }
  587. }
  588. AVInputFormat rawvideo_iformat = {
  589. "rawvideo",
  590. "raw video format",
  591. 0,
  592. NULL,
  593. raw_read_header,
  594. rawvideo_read_packet,
  595. raw_read_close,
  596. .extensions = "yuv,cif,qcif",
  597. .value = CODEC_ID_RAWVIDEO,
  598. };
  599. #ifdef CONFIG_MUXERS
  600. AVOutputFormat rawvideo_oformat = {
  601. "rawvideo",
  602. "raw video format",
  603. NULL,
  604. "yuv",
  605. 0,
  606. CODEC_ID_NONE,
  607. CODEC_ID_RAWVIDEO,
  608. raw_write_header,
  609. raw_write_packet,
  610. raw_write_trailer,
  611. };
  612. #endif //CONFIG_MUXERS
  613. #ifdef CONFIG_MUXERS
  614. static int null_write_packet(struct AVFormatContext *s, AVPacket *pkt)
  615. {
  616. return 0;
  617. }
  618. AVOutputFormat null_oformat = {
  619. "null",
  620. "null video format",
  621. NULL,
  622. NULL,
  623. 0,
  624. #ifdef WORDS_BIGENDIAN
  625. CODEC_ID_PCM_S16BE,
  626. #else
  627. CODEC_ID_PCM_S16LE,
  628. #endif
  629. CODEC_ID_RAWVIDEO,
  630. raw_write_header,
  631. null_write_packet,
  632. raw_write_trailer,
  633. .flags = AVFMT_NOFILE | AVFMT_RAWPICTURE,
  634. };
  635. #endif //CONFIG_MUXERS
  636. #ifndef CONFIG_MUXERS
  637. #define av_register_output_format(format)
  638. #endif
  639. #ifndef CONFIG_DEMUXERS
  640. #define av_register_input_format(format)
  641. #endif
  642. int raw_init(void)
  643. {
  644. av_register_input_format(&shorten_iformat);
  645. av_register_input_format(&ac3_iformat);
  646. av_register_output_format(&ac3_oformat);
  647. av_register_input_format(&dts_iformat);
  648. av_register_input_format(&h261_iformat);
  649. av_register_output_format(&h261_oformat);
  650. av_register_input_format(&h263_iformat);
  651. av_register_output_format(&h263_oformat);
  652. av_register_input_format(&m4v_iformat);
  653. av_register_output_format(&m4v_oformat);
  654. av_register_input_format(&h264_iformat);
  655. av_register_output_format(&h264_oformat);
  656. av_register_input_format(&mpegvideo_iformat);
  657. av_register_output_format(&mpeg1video_oformat);
  658. av_register_output_format(&mpeg2video_oformat);
  659. av_register_input_format(&mjpeg_iformat);
  660. av_register_output_format(&mjpeg_oformat);
  661. av_register_input_format(&ingenient_iformat);
  662. av_register_input_format(&pcm_s16le_iformat);
  663. av_register_output_format(&pcm_s16le_oformat);
  664. av_register_input_format(&pcm_s16be_iformat);
  665. av_register_output_format(&pcm_s16be_oformat);
  666. av_register_input_format(&pcm_u16le_iformat);
  667. av_register_output_format(&pcm_u16le_oformat);
  668. av_register_input_format(&pcm_u16be_iformat);
  669. av_register_output_format(&pcm_u16be_oformat);
  670. av_register_input_format(&pcm_s8_iformat);
  671. av_register_output_format(&pcm_s8_oformat);
  672. av_register_input_format(&pcm_u8_iformat);
  673. av_register_output_format(&pcm_u8_oformat);
  674. av_register_input_format(&pcm_mulaw_iformat);
  675. av_register_output_format(&pcm_mulaw_oformat);
  676. av_register_input_format(&pcm_alaw_iformat);
  677. av_register_output_format(&pcm_alaw_oformat);
  678. av_register_input_format(&rawvideo_iformat);
  679. av_register_output_format(&rawvideo_oformat);
  680. av_register_output_format(&null_oformat);
  681. return 0;
  682. }