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.

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