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.

803 lines
18KB

  1. /*
  2. * Image format
  3. * Copyright (c) 2000, 2001, 2002 Gerard Lantau.
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18. */
  19. #include "avformat.h"
  20. extern AVInputFormat pgm_iformat;
  21. extern AVOutputFormat pgm_oformat;
  22. extern AVInputFormat pgmyuv_iformat;
  23. extern AVOutputFormat pgmyuv_oformat;
  24. extern AVInputFormat ppm_iformat;
  25. extern AVOutputFormat ppm_oformat;
  26. extern AVInputFormat imgyuv_iformat;
  27. extern AVOutputFormat imgyuv_oformat;
  28. extern AVInputFormat pgmpipe_iformat;
  29. extern AVOutputFormat pgmpipe_oformat;
  30. extern AVInputFormat pgmyuvpipe_iformat;
  31. extern AVOutputFormat pgmyuvpipe_oformat;
  32. extern AVInputFormat ppmpipe_iformat;
  33. extern AVOutputFormat ppmpipe_oformat;
  34. #define IMGFMT_YUV 1
  35. #define IMGFMT_PGMYUV 2
  36. #define IMGFMT_PGM 3
  37. #define IMGFMT_PPM 4
  38. typedef struct {
  39. int width;
  40. int height;
  41. int img_number;
  42. int img_size;
  43. int img_fmt;
  44. int is_pipe;
  45. char path[1024];
  46. } VideoData;
  47. static inline int pnm_space(int c)
  48. {
  49. return (c==' ' || c=='\n' || c=='\r' || c=='\t');
  50. }
  51. static void pnm_get(ByteIOContext *f, char *str, int buf_size)
  52. {
  53. char *s;
  54. int c;
  55. do {
  56. c=get_byte(f);
  57. if (c=='#') {
  58. do {
  59. c=get_byte(f);
  60. } while (c!='\n');
  61. c=get_byte(f);
  62. }
  63. } while (pnm_space(c));
  64. s=str;
  65. do {
  66. if (url_feof(f))
  67. break;
  68. if ((s - str) < buf_size - 1)
  69. *s++=c;
  70. c=get_byte(f);
  71. } while (!pnm_space(c));
  72. *s = '\0';
  73. }
  74. static int pgm_read(VideoData *s, ByteIOContext *f, UINT8 *buf, int size, int is_yuv)
  75. {
  76. int width, height, i;
  77. char buf1[32];
  78. UINT8 *picture[3];
  79. width = s->width;
  80. height = s->height;
  81. pnm_get(f, buf1, sizeof(buf1));
  82. if (strcmp(buf1, "P5")) {
  83. return -EIO;
  84. }
  85. pnm_get(f, buf1, sizeof(buf1));
  86. pnm_get(f, buf1, sizeof(buf1));
  87. pnm_get(f, buf1, sizeof(buf1));
  88. picture[0] = buf;
  89. picture[1] = buf + width * height;
  90. picture[2] = buf + width * height + (width * height / 4);
  91. get_buffer(f, picture[0], width * height);
  92. height>>=1;
  93. width>>=1;
  94. if (is_yuv) {
  95. for(i=0;i<height;i++) {
  96. get_buffer(f, picture[1] + i * width, width);
  97. get_buffer(f, picture[2] + i * width, width);
  98. }
  99. } else {
  100. for(i=0;i<height;i++) {
  101. memset(picture[1] + i * width, 128, width);
  102. memset(picture[2] + i * width, 128, width);
  103. }
  104. }
  105. return 0;
  106. }
  107. static int ppm_read(VideoData *s, ByteIOContext *f, UINT8 *buf, int size)
  108. {
  109. int width, height;
  110. char buf1[32];
  111. UINT8 *picture[3];
  112. width = s->width;
  113. height = s->height;
  114. pnm_get(f, buf1, sizeof(buf1));
  115. if (strcmp(buf1, "P6")) {
  116. return -EIO;
  117. }
  118. pnm_get(f, buf1, sizeof(buf1));
  119. pnm_get(f, buf1, sizeof(buf1));
  120. pnm_get(f, buf1, sizeof(buf1));
  121. picture[0] = buf;
  122. get_buffer(f, picture[0], width * height*3);
  123. return 0;
  124. }
  125. static int yuv_read(VideoData *s, const char *filename, UINT8 *buf, int size1)
  126. {
  127. ByteIOContext pb1, *pb = &pb1;
  128. char fname[1024], *p;
  129. int size;
  130. size = s->width * s->height;
  131. strcpy(fname, filename);
  132. p = strrchr(fname, '.');
  133. if (!p || p[1] != 'Y')
  134. return -EIO;
  135. if (url_fopen(pb, fname, URL_RDONLY) < 0)
  136. return -EIO;
  137. get_buffer(pb, buf, size);
  138. url_fclose(pb);
  139. p[1] = 'U';
  140. if (url_fopen(pb, fname, URL_RDONLY) < 0)
  141. return -EIO;
  142. get_buffer(pb, buf + size, size / 4);
  143. url_fclose(pb);
  144. p[1] = 'V';
  145. if (url_fopen(pb, fname, URL_RDONLY) < 0)
  146. return -EIO;
  147. get_buffer(pb, buf + size + (size / 4), size / 4);
  148. url_fclose(pb);
  149. return 0;
  150. }
  151. static int img_read_packet(AVFormatContext *s1, AVPacket *pkt)
  152. {
  153. VideoData *s = s1->priv_data;
  154. char filename[1024];
  155. int ret;
  156. ByteIOContext f1, *f;
  157. /*
  158. This if-statement destroys pipes - I do not see why it is necessary
  159. if (get_frame_filename(filename, sizeof(filename),
  160. s->path, s->img_number) < 0)
  161. return -EIO;
  162. */
  163. get_frame_filename(filename, sizeof(filename),
  164. s->path, s->img_number);
  165. if (!s->is_pipe) {
  166. f = &f1;
  167. if (url_fopen(f, filename, URL_RDONLY) < 0)
  168. return -EIO;
  169. } else {
  170. f = &s1->pb;
  171. if (url_feof(f))
  172. return -EIO;
  173. }
  174. av_new_packet(pkt, s->img_size);
  175. pkt->stream_index = 0;
  176. switch(s->img_fmt) {
  177. case IMGFMT_PGMYUV:
  178. ret = pgm_read(s, f, pkt->data, pkt->size, 1);
  179. break;
  180. case IMGFMT_PGM:
  181. ret = pgm_read(s, f, pkt->data, pkt->size, 0);
  182. break;
  183. case IMGFMT_YUV:
  184. ret = yuv_read(s, filename, pkt->data, pkt->size);
  185. break;
  186. case IMGFMT_PPM:
  187. ret = ppm_read(s, f, pkt->data, pkt->size);
  188. break;
  189. default:
  190. return -EIO;
  191. }
  192. if (!s->is_pipe) {
  193. url_fclose(f);
  194. }
  195. if (ret < 0) {
  196. av_free_packet(pkt);
  197. return -EIO; /* signal EOF */
  198. } else {
  199. s->img_number++;
  200. return 0;
  201. }
  202. }
  203. static int sizes[][2] = {
  204. { 640, 480 },
  205. { 720, 480 },
  206. { 720, 576 },
  207. { 352, 288 },
  208. { 352, 240 },
  209. { 160, 128 },
  210. { 512, 384 },
  211. { 640, 352 },
  212. { 640, 240 },
  213. };
  214. static int infer_size(int *width_ptr, int *height_ptr, int size)
  215. {
  216. int i;
  217. for(i=0;i<sizeof(sizes)/sizeof(sizes[0]);i++) {
  218. if ((sizes[i][0] * sizes[i][1]) == size) {
  219. *width_ptr = sizes[i][0];
  220. *height_ptr = sizes[i][1];
  221. return 0;
  222. }
  223. }
  224. return -1;
  225. }
  226. static int img_read_header(AVFormatContext *s1, AVFormatParameters *ap)
  227. {
  228. VideoData *s = s1->priv_data;
  229. int i, h;
  230. char buf[1024];
  231. char buf1[32];
  232. ByteIOContext pb1, *f = &pb1;
  233. AVStream *st;
  234. st = av_new_stream(s1, 0);
  235. if (!st) {
  236. av_free(s);
  237. return -ENOMEM;
  238. }
  239. strcpy(s->path, s1->filename);
  240. s->img_number = 0;
  241. /* find format */
  242. if (s1->iformat->flags & AVFMT_NOFILE)
  243. s->is_pipe = 0;
  244. else
  245. s->is_pipe = 1;
  246. if (s1->iformat == &pgmyuvpipe_iformat ||
  247. s1->iformat == &pgmyuv_iformat)
  248. s->img_fmt = IMGFMT_PGMYUV;
  249. else if (s1->iformat == &pgmpipe_iformat ||
  250. s1->iformat == &pgm_iformat)
  251. s->img_fmt = IMGFMT_PGM;
  252. else if (s1->iformat == &imgyuv_iformat)
  253. s->img_fmt = IMGFMT_YUV;
  254. else if (s1->iformat == &ppmpipe_iformat ||
  255. s1->iformat == &ppm_iformat)
  256. s->img_fmt = IMGFMT_PPM;
  257. else
  258. goto fail;
  259. if (!s->is_pipe) {
  260. /* try to find the first image */
  261. for(i=0;i<5;i++) {
  262. if (get_frame_filename(buf, sizeof(buf), s->path, s->img_number) < 0)
  263. goto fail;
  264. if (url_fopen(f, buf, URL_RDONLY) >= 0)
  265. break;
  266. s->img_number++;
  267. }
  268. if (i == 5)
  269. goto fail;
  270. } else {
  271. f = &s1->pb;
  272. }
  273. /* find the image size */
  274. /* XXX: use generic file format guessing, as mpeg */
  275. switch(s->img_fmt) {
  276. case IMGFMT_PGM:
  277. case IMGFMT_PGMYUV:
  278. case IMGFMT_PPM:
  279. pnm_get(f, buf1, sizeof(buf1));
  280. pnm_get(f, buf1, sizeof(buf1));
  281. s->width = atoi(buf1);
  282. pnm_get(f, buf1, sizeof(buf1));
  283. h = atoi(buf1);
  284. if (s->img_fmt == IMGFMT_PGMYUV)
  285. h = (h * 2) / 3;
  286. s->height = h;
  287. if (s->width <= 0 ||
  288. s->height <= 0 ||
  289. (s->width % 2) != 0 ||
  290. (s->height % 2) != 0) {
  291. goto fail1;
  292. }
  293. break;
  294. case IMGFMT_YUV:
  295. /* infer size by using the file size. */
  296. {
  297. int img_size;
  298. URLContext *h;
  299. /* XXX: hack hack */
  300. h = url_fileno(f);
  301. img_size = url_seek(h, 0, SEEK_END);
  302. if (infer_size(&s->width, &s->height, img_size) < 0) {
  303. goto fail1;
  304. }
  305. }
  306. break;
  307. }
  308. if (!s->is_pipe) {
  309. url_fclose(f);
  310. } else {
  311. url_fseek(f, 0, SEEK_SET);
  312. }
  313. st->codec.codec_type = CODEC_TYPE_VIDEO;
  314. st->codec.codec_id = CODEC_ID_RAWVIDEO;
  315. st->codec.width = s->width;
  316. st->codec.height = s->height;
  317. if (s->img_fmt == IMGFMT_PPM) {
  318. st->codec.pix_fmt = PIX_FMT_RGB24;
  319. s->img_size = (s->width * s->height * 3);
  320. } else {
  321. st->codec.pix_fmt = PIX_FMT_YUV420P;
  322. s->img_size = (s->width * s->height * 3) / 2;
  323. }
  324. if (!ap || !ap->frame_rate)
  325. st->codec.frame_rate = 25 * FRAME_RATE_BASE;
  326. else
  327. st->codec.frame_rate = ap->frame_rate;
  328. return 0;
  329. fail1:
  330. if (!s->is_pipe)
  331. url_fclose(f);
  332. fail:
  333. av_free(s);
  334. return -EIO;
  335. }
  336. static int img_read_close(AVFormatContext *s1)
  337. {
  338. return 0;
  339. }
  340. /******************************************************/
  341. /* image output */
  342. static int pgm_save(AVPicture *picture, int width, int height, ByteIOContext *pb, int is_yuv)
  343. {
  344. int i, h;
  345. char buf[100];
  346. UINT8 *ptr, *ptr1, *ptr2;
  347. h = height;
  348. if (is_yuv)
  349. h = (height * 3) / 2;
  350. snprintf(buf, sizeof(buf),
  351. "P5\n%d %d\n%d\n",
  352. width, h, 255);
  353. put_buffer(pb, buf, strlen(buf));
  354. ptr = picture->data[0];
  355. for(i=0;i<height;i++) {
  356. put_buffer(pb, ptr, width);
  357. ptr += picture->linesize[0];
  358. }
  359. if (is_yuv) {
  360. height >>= 1;
  361. width >>= 1;
  362. ptr1 = picture->data[1];
  363. ptr2 = picture->data[2];
  364. for(i=0;i<height;i++) {
  365. put_buffer(pb, ptr1, width);
  366. put_buffer(pb, ptr2, width);
  367. ptr1 += picture->linesize[1];
  368. ptr2 += picture->linesize[2];
  369. }
  370. }
  371. put_flush_packet(pb);
  372. return 0;
  373. }
  374. static int ppm_save(AVPicture *picture, int width, int height, ByteIOContext *pb)
  375. {
  376. int i;
  377. char buf[100];
  378. UINT8 *ptr;
  379. snprintf(buf, sizeof(buf),
  380. "P6\n%d %d\n%d\n",
  381. width, height, 255);
  382. put_buffer(pb, buf, strlen(buf));
  383. ptr = picture->data[0];
  384. for(i=0;i<height;i++) {
  385. put_buffer(pb, ptr, width * 3);
  386. ptr += picture->linesize[0];
  387. }
  388. put_flush_packet(pb);
  389. return 0;
  390. }
  391. static int yuv_save(AVPicture *picture, int width, int height, const char *filename)
  392. {
  393. ByteIOContext pb1, *pb = &pb1;
  394. char fname[1024], *p;
  395. int i, j;
  396. UINT8 *ptr;
  397. static char *ext = "YUV";
  398. strcpy(fname, filename);
  399. p = strrchr(fname, '.');
  400. if (!p || p[1] != 'Y')
  401. return -EIO;
  402. for(i=0;i<3;i++) {
  403. if (i == 1) {
  404. width >>= 1;
  405. height >>= 1;
  406. }
  407. p[1] = ext[i];
  408. if (url_fopen(pb, fname, URL_WRONLY) < 0)
  409. return -EIO;
  410. ptr = picture->data[i];
  411. for(j=0;j<height;j++) {
  412. put_buffer(pb, ptr, width);
  413. ptr += picture->linesize[i];
  414. }
  415. put_flush_packet(pb);
  416. url_fclose(pb);
  417. }
  418. return 0;
  419. }
  420. static int img_write_header(AVFormatContext *s)
  421. {
  422. VideoData *img = s->priv_data;
  423. img->img_number = 1;
  424. strcpy(img->path, s->filename);
  425. /* find format */
  426. if (s->oformat->flags & AVFMT_NOFILE)
  427. img->is_pipe = 0;
  428. else
  429. img->is_pipe = 1;
  430. if (s->oformat == &pgmyuvpipe_oformat ||
  431. s->oformat == &pgmyuv_oformat) {
  432. img->img_fmt = IMGFMT_PGMYUV;
  433. } else if (s->oformat == &pgmpipe_oformat ||
  434. s->oformat == &pgm_oformat) {
  435. img->img_fmt = IMGFMT_PGM;
  436. } else if (s->oformat == &imgyuv_oformat) {
  437. img->img_fmt = IMGFMT_YUV;
  438. } else if (s->oformat == &ppmpipe_oformat ||
  439. s->oformat == &ppm_oformat) {
  440. img->img_fmt = IMGFMT_PPM;
  441. } else {
  442. goto fail;
  443. }
  444. return 0;
  445. fail:
  446. av_free(img);
  447. return -EIO;
  448. }
  449. static int img_write_packet(AVFormatContext *s, int stream_index,
  450. UINT8 *buf, int size, int force_pts)
  451. {
  452. VideoData *img = s->priv_data;
  453. AVStream *st = s->streams[stream_index];
  454. ByteIOContext pb1, *pb;
  455. AVPicture picture;
  456. int width, height, ret, size1;
  457. char filename[1024];
  458. width = st->codec.width;
  459. height = st->codec.height;
  460. switch(st->codec.pix_fmt) {
  461. case PIX_FMT_YUV420P:
  462. size1 = (width * height * 3) / 2;
  463. if (size != size1)
  464. return -EIO;
  465. picture.data[0] = buf;
  466. picture.data[1] = picture.data[0] + width * height;
  467. picture.data[2] = picture.data[1] + (width * height) / 4;
  468. picture.linesize[0] = width;
  469. picture.linesize[1] = width >> 1;
  470. picture.linesize[2] = width >> 1;
  471. break;
  472. case PIX_FMT_RGB24:
  473. size1 = (width * height * 3);
  474. if (size != size1)
  475. return -EIO;
  476. picture.data[0] = buf;
  477. picture.linesize[0] = width * 3;
  478. break;
  479. default:
  480. return -EIO;
  481. }
  482. /*
  483. This if-statement destroys pipes - I do not see why it is necessary
  484. if (get_frame_filename(filename, sizeof(filename),
  485. img->path, img->img_number) < 0)
  486. return -EIO;
  487. */
  488. get_frame_filename(filename, sizeof(filename),
  489. img->path, img->img_number);
  490. if (!img->is_pipe) {
  491. pb = &pb1;
  492. if (url_fopen(pb, filename, URL_WRONLY) < 0)
  493. return -EIO;
  494. } else {
  495. pb = &s->pb;
  496. }
  497. switch(img->img_fmt) {
  498. case IMGFMT_PGMYUV:
  499. ret = pgm_save(&picture, width, height, pb, 1);
  500. break;
  501. case IMGFMT_PGM:
  502. ret = pgm_save(&picture, width, height, pb, 0);
  503. break;
  504. case IMGFMT_YUV:
  505. ret = yuv_save(&picture, width, height, filename);
  506. break;
  507. case IMGFMT_PPM:
  508. ret = ppm_save(&picture, width, height, pb);
  509. break;
  510. }
  511. if (!img->is_pipe) {
  512. url_fclose(pb);
  513. }
  514. img->img_number++;
  515. return 0;
  516. }
  517. static int img_write_trailer(AVFormatContext *s)
  518. {
  519. return 0;
  520. }
  521. AVInputFormat pgm_iformat = {
  522. "pgm",
  523. "pgm image format",
  524. sizeof(VideoData),
  525. NULL,
  526. img_read_header,
  527. img_read_packet,
  528. img_read_close,
  529. NULL,
  530. AVFMT_NOFILE | AVFMT_NEEDNUMBER,
  531. extensions: "pgm",
  532. };
  533. AVOutputFormat pgm_oformat = {
  534. "pgm",
  535. "pgm image format",
  536. "",
  537. "pgm",
  538. sizeof(VideoData),
  539. CODEC_ID_NONE,
  540. CODEC_ID_RAWVIDEO,
  541. img_write_header,
  542. img_write_packet,
  543. img_write_trailer,
  544. AVFMT_NOFILE | AVFMT_NEEDNUMBER,
  545. };
  546. AVInputFormat pgmyuv_iformat = {
  547. "pgmyuv",
  548. "pgm with YUV content image format",
  549. sizeof(VideoData),
  550. NULL, /* no probe */
  551. img_read_header,
  552. img_read_packet,
  553. img_read_close,
  554. NULL,
  555. AVFMT_NOFILE | AVFMT_NEEDNUMBER,
  556. };
  557. AVOutputFormat pgmyuv_oformat = {
  558. "pgmyuv",
  559. "pgm with YUV content image format",
  560. "",
  561. "pgm",
  562. sizeof(VideoData),
  563. CODEC_ID_NONE,
  564. CODEC_ID_RAWVIDEO,
  565. img_write_header,
  566. img_write_packet,
  567. img_write_trailer,
  568. AVFMT_NOFILE | AVFMT_NEEDNUMBER,
  569. };
  570. AVInputFormat ppm_iformat = {
  571. "ppm",
  572. "ppm image format",
  573. sizeof(VideoData),
  574. NULL,
  575. img_read_header,
  576. img_read_packet,
  577. img_read_close,
  578. NULL,
  579. AVFMT_NOFILE | AVFMT_NEEDNUMBER | AVFMT_RGB24,
  580. extensions: "ppm",
  581. };
  582. AVOutputFormat ppm_oformat = {
  583. "ppm",
  584. "ppm image format",
  585. "",
  586. "ppm",
  587. sizeof(VideoData),
  588. CODEC_ID_NONE,
  589. CODEC_ID_RAWVIDEO,
  590. img_write_header,
  591. img_write_packet,
  592. img_write_trailer,
  593. AVFMT_NOFILE | AVFMT_NEEDNUMBER | AVFMT_RGB24,
  594. };
  595. AVInputFormat imgyuv_iformat = {
  596. ".Y.U.V",
  597. ".Y.U.V format",
  598. sizeof(VideoData),
  599. NULL,
  600. img_read_header,
  601. img_read_packet,
  602. img_read_close,
  603. NULL,
  604. AVFMT_NOFILE | AVFMT_NEEDNUMBER,
  605. extensions: "Y",
  606. };
  607. AVOutputFormat imgyuv_oformat = {
  608. ".Y.U.V",
  609. ".Y.U.V format",
  610. "",
  611. "Y",
  612. sizeof(VideoData),
  613. CODEC_ID_NONE,
  614. CODEC_ID_RAWVIDEO,
  615. img_write_header,
  616. img_write_packet,
  617. img_write_trailer,
  618. AVFMT_NOFILE | AVFMT_NEEDNUMBER,
  619. };
  620. AVInputFormat pgmpipe_iformat = {
  621. "pgmpipe",
  622. "PGM pipe format",
  623. sizeof(VideoData),
  624. NULL, /* no probe */
  625. img_read_header,
  626. img_read_packet,
  627. img_read_close,
  628. NULL,
  629. };
  630. AVOutputFormat pgmpipe_oformat = {
  631. "pgmpipe",
  632. "PGM pipe format",
  633. "",
  634. "pgm",
  635. sizeof(VideoData),
  636. CODEC_ID_NONE,
  637. CODEC_ID_RAWVIDEO,
  638. img_write_header,
  639. img_write_packet,
  640. img_write_trailer,
  641. };
  642. AVInputFormat pgmyuvpipe_iformat = {
  643. "pgmyuvpipe",
  644. "PGM YUV pipe format",
  645. sizeof(VideoData),
  646. NULL, /* no probe */
  647. img_read_header,
  648. img_read_packet,
  649. img_read_close,
  650. NULL,
  651. };
  652. AVOutputFormat pgmyuvpipe_oformat = {
  653. "pgmyuvpipe",
  654. "PGM YUV pipe format",
  655. "",
  656. "pgm",
  657. sizeof(VideoData),
  658. CODEC_ID_NONE,
  659. CODEC_ID_RAWVIDEO,
  660. img_write_header,
  661. img_write_packet,
  662. img_write_trailer,
  663. };
  664. AVInputFormat ppmpipe_iformat = {
  665. "ppmpipe",
  666. "PPM pipe format",
  667. sizeof(VideoData),
  668. NULL, /* no probe */
  669. img_read_header,
  670. img_read_packet,
  671. img_read_close,
  672. NULL,
  673. flags: AVFMT_RGB24,
  674. };
  675. AVOutputFormat ppmpipe_oformat = {
  676. "ppmpipe",
  677. "PPM pipe format",
  678. "",
  679. "ppm",
  680. sizeof(VideoData),
  681. CODEC_ID_NONE,
  682. CODEC_ID_RAWVIDEO,
  683. img_write_header,
  684. img_write_packet,
  685. img_write_trailer,
  686. flags: AVFMT_RGB24,
  687. };
  688. int img_init(void)
  689. {
  690. av_register_input_format(&pgm_iformat);
  691. av_register_output_format(&pgm_oformat);
  692. av_register_input_format(&pgmyuv_iformat);
  693. av_register_output_format(&pgmyuv_oformat);
  694. av_register_input_format(&ppm_iformat);
  695. av_register_output_format(&ppm_oformat);
  696. av_register_input_format(&imgyuv_iformat);
  697. av_register_output_format(&imgyuv_oformat);
  698. av_register_input_format(&pgmpipe_iformat);
  699. av_register_output_format(&pgmpipe_oformat);
  700. av_register_input_format(&pgmyuvpipe_iformat);
  701. av_register_output_format(&pgmyuvpipe_oformat);
  702. av_register_input_format(&ppmpipe_iformat);
  703. av_register_output_format(&ppmpipe_oformat);
  704. return 0;
  705. }