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.

562 lines
19KB

  1. /*
  2. * YUV4MPEG format
  3. * Copyright (c) 2001, 2002, 2003 Fabrice Bellard
  4. *
  5. * This file is part of FFmpeg.
  6. *
  7. * FFmpeg is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2.1 of the License, or (at your option) any later version.
  11. *
  12. * FFmpeg is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with FFmpeg; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. */
  21. #include "avformat.h"
  22. #include "internal.h"
  23. #include "libavutil/pixdesc.h"
  24. #define Y4M_MAGIC "YUV4MPEG2"
  25. #define Y4M_FRAME_MAGIC "FRAME"
  26. #define Y4M_LINE_MAX 256
  27. struct frame_attributes {
  28. int interlaced_frame;
  29. int top_field_first;
  30. };
  31. #if CONFIG_YUV4MPEGPIPE_MUXER
  32. static int yuv4_generate_header(AVFormatContext *s, char* buf)
  33. {
  34. AVStream *st;
  35. int width, height;
  36. int raten, rated, aspectn, aspectd, n;
  37. char inter;
  38. const char *colorspace = "";
  39. st = s->streams[0];
  40. width = st->codec->width;
  41. height = st->codec->height;
  42. av_reduce(&raten, &rated, st->codec->time_base.den,
  43. st->codec->time_base.num, (1UL << 31) - 1);
  44. aspectn = st->sample_aspect_ratio.num;
  45. aspectd = st->sample_aspect_ratio.den;
  46. if (aspectn == 0 && aspectd == 1)
  47. aspectd = 0; // 0:0 means unknown
  48. inter = 'p'; /* progressive is the default */
  49. if (st->codec->coded_frame && st->codec->coded_frame->interlaced_frame)
  50. inter = st->codec->coded_frame->top_field_first ? 't' : 'b';
  51. switch (st->codec->pix_fmt) {
  52. case AV_PIX_FMT_GRAY8:
  53. colorspace = " Cmono";
  54. break;
  55. case AV_PIX_FMT_GRAY16:
  56. colorspace = " Cmono16";
  57. break;
  58. case AV_PIX_FMT_YUV411P:
  59. colorspace = " C411 XYSCSS=411";
  60. break;
  61. case AV_PIX_FMT_YUV420P:
  62. switch (st->codec->chroma_sample_location) {
  63. case AVCHROMA_LOC_TOPLEFT: colorspace = " C420paldv XYSCSS=420PALDV"; break;
  64. case AVCHROMA_LOC_LEFT: colorspace = " C420mpeg2 XYSCSS=420MPEG2"; break;
  65. default: colorspace = " C420jpeg XYSCSS=420JPEG"; break;
  66. }
  67. break;
  68. case AV_PIX_FMT_YUV422P:
  69. colorspace = " C422 XYSCSS=422";
  70. break;
  71. case AV_PIX_FMT_YUV444P:
  72. colorspace = " C444 XYSCSS=444";
  73. break;
  74. case AV_PIX_FMT_YUV420P9:
  75. colorspace = " C420p9 XYSCSS=420P9";
  76. break;
  77. case AV_PIX_FMT_YUV422P9:
  78. colorspace = " C422p9 XYSCSS=422P9";
  79. break;
  80. case AV_PIX_FMT_YUV444P9:
  81. colorspace = " C444p9 XYSCSS=444P9";
  82. break;
  83. case AV_PIX_FMT_YUV420P10:
  84. colorspace = " C420p10 XYSCSS=420P10";
  85. break;
  86. case AV_PIX_FMT_YUV422P10:
  87. colorspace = " C422p10 XYSCSS=422P10";
  88. break;
  89. case AV_PIX_FMT_YUV444P10:
  90. colorspace = " C444p10 XYSCSS=444P10";
  91. break;
  92. case AV_PIX_FMT_YUV420P16:
  93. colorspace = " C420p16 XYSCSS=420P16";
  94. break;
  95. case AV_PIX_FMT_YUV422P16:
  96. colorspace = " C422p16 XYSCSS=422P16";
  97. break;
  98. case AV_PIX_FMT_YUV444P16:
  99. colorspace = " C444p16 XYSCSS=444P16";
  100. break;
  101. }
  102. /* construct stream header, if this is the first frame */
  103. n = snprintf(buf, Y4M_LINE_MAX, "%s W%d H%d F%d:%d I%c A%d:%d%s\n",
  104. Y4M_MAGIC, width, height, raten, rated, inter,
  105. aspectn, aspectd, colorspace);
  106. return n;
  107. }
  108. static int yuv4_write_packet(AVFormatContext *s, AVPacket *pkt)
  109. {
  110. AVStream *st = s->streams[pkt->stream_index];
  111. AVIOContext *pb = s->pb;
  112. AVPicture *picture, picture_tmp;
  113. int* first_pkt = s->priv_data;
  114. int width, height, h_chroma_shift, v_chroma_shift;
  115. int i;
  116. char buf2[Y4M_LINE_MAX + 1];
  117. char buf1[20];
  118. uint8_t *ptr, *ptr1, *ptr2;
  119. memcpy(&picture_tmp, pkt->data, sizeof(AVPicture));
  120. picture = &picture_tmp;
  121. /* for the first packet we have to output the header as well */
  122. if (*first_pkt) {
  123. *first_pkt = 0;
  124. if (yuv4_generate_header(s, buf2) < 0) {
  125. av_log(s, AV_LOG_ERROR,
  126. "Error. YUV4MPEG stream header write failed.\n");
  127. return AVERROR(EIO);
  128. } else {
  129. avio_write(pb, buf2, strlen(buf2));
  130. }
  131. }
  132. /* construct frame header */
  133. snprintf(buf1, sizeof(buf1), "%s\n", Y4M_FRAME_MAGIC);
  134. avio_write(pb, buf1, strlen(buf1));
  135. width = st->codec->width;
  136. height = st->codec->height;
  137. ptr = picture->data[0];
  138. switch (st->codec->pix_fmt) {
  139. case AV_PIX_FMT_GRAY8:
  140. case AV_PIX_FMT_YUV411P:
  141. case AV_PIX_FMT_YUV420P:
  142. case AV_PIX_FMT_YUV422P:
  143. case AV_PIX_FMT_YUV444P:
  144. break;
  145. case AV_PIX_FMT_GRAY16:
  146. case AV_PIX_FMT_YUV420P9:
  147. case AV_PIX_FMT_YUV422P9:
  148. case AV_PIX_FMT_YUV444P9:
  149. case AV_PIX_FMT_YUV420P10:
  150. case AV_PIX_FMT_YUV422P10:
  151. case AV_PIX_FMT_YUV444P10:
  152. case AV_PIX_FMT_YUV420P16:
  153. case AV_PIX_FMT_YUV422P16:
  154. case AV_PIX_FMT_YUV444P16:
  155. width *= 2;
  156. break;
  157. default:
  158. av_log(s, AV_LOG_ERROR, "The pixel format '%s' is not supported.\n",
  159. av_get_pix_fmt_name(st->codec->pix_fmt));
  160. return AVERROR(EINVAL);
  161. }
  162. for (i = 0; i < height; i++) {
  163. avio_write(pb, ptr, width);
  164. ptr += picture->linesize[0];
  165. }
  166. if (st->codec->pix_fmt != AV_PIX_FMT_GRAY8 &&
  167. st->codec->pix_fmt != AV_PIX_FMT_GRAY16) {
  168. // Adjust for smaller Cb and Cr planes
  169. avcodec_get_chroma_sub_sample(st->codec->pix_fmt, &h_chroma_shift,
  170. &v_chroma_shift);
  171. width >>= h_chroma_shift;
  172. height >>= v_chroma_shift;
  173. ptr1 = picture->data[1];
  174. ptr2 = picture->data[2];
  175. for (i = 0; i < height; i++) { /* Cb */
  176. avio_write(pb, ptr1, width);
  177. ptr1 += picture->linesize[1];
  178. }
  179. for (i = 0; i < height; i++) { /* Cr */
  180. avio_write(pb, ptr2, width);
  181. ptr2 += picture->linesize[2];
  182. }
  183. }
  184. avio_flush(pb);
  185. return 0;
  186. }
  187. static int yuv4_write_header(AVFormatContext *s)
  188. {
  189. int *first_pkt = s->priv_data;
  190. if (s->nb_streams != 1)
  191. return AVERROR(EIO);
  192. if (s->streams[0]->codec->codec_id != AV_CODEC_ID_RAWVIDEO) {
  193. av_log(s, AV_LOG_ERROR, "ERROR: Only rawvideo supported.\n");
  194. return AVERROR_INVALIDDATA;
  195. }
  196. switch (s->streams[0]->codec->pix_fmt) {
  197. case AV_PIX_FMT_YUV411P:
  198. av_log(s, AV_LOG_WARNING, "Warning: generating rarely used 4:1:1 YUV "
  199. "stream, some mjpegtools might not work.\n");
  200. break;
  201. case AV_PIX_FMT_GRAY8:
  202. case AV_PIX_FMT_GRAY16:
  203. case AV_PIX_FMT_YUV420P:
  204. case AV_PIX_FMT_YUV422P:
  205. case AV_PIX_FMT_YUV444P:
  206. break;
  207. case AV_PIX_FMT_YUV420P9:
  208. case AV_PIX_FMT_YUV422P9:
  209. case AV_PIX_FMT_YUV444P9:
  210. case AV_PIX_FMT_YUV420P10:
  211. case AV_PIX_FMT_YUV422P10:
  212. case AV_PIX_FMT_YUV444P10:
  213. case AV_PIX_FMT_YUV420P16:
  214. case AV_PIX_FMT_YUV422P16:
  215. case AV_PIX_FMT_YUV444P16:
  216. if (s->streams[0]->codec->strict_std_compliance >= FF_COMPLIANCE_NORMAL) {
  217. av_log(s, AV_LOG_ERROR, "'%s' is not a official yuv4mpegpipe pixel format. "
  218. "Use '-strict -1' to encode to this pixel format.\n",
  219. av_get_pix_fmt_name(s->streams[0]->codec->pix_fmt));
  220. return AVERROR(EINVAL);
  221. }
  222. av_log(s, AV_LOG_WARNING, "Warning: generating non standart YUV stream. "
  223. "Mjpegtools will not work.\n");
  224. break;
  225. default:
  226. av_log(s, AV_LOG_ERROR, "ERROR: yuv4mpeg can only handle "
  227. "yuv444p, yuv422p, yuv420p, yuv411p and gray8 pixel formats. "
  228. "And using 'strict -1' also yuv444p9, yuv422p9, yuv420p9, "
  229. "yuv444p10, yuv422p10, yuv420p10, "
  230. "yuv444p16, yuv422p16, yuv420p16 "
  231. "and gray16 pixel formats. "
  232. "Use -pix_fmt to select one.\n");
  233. return AVERROR(EIO);
  234. }
  235. *first_pkt = 1;
  236. return 0;
  237. }
  238. AVOutputFormat ff_yuv4mpegpipe_muxer = {
  239. .name = "yuv4mpegpipe",
  240. .long_name = NULL_IF_CONFIG_SMALL("YUV4MPEG pipe"),
  241. .extensions = "y4m",
  242. .priv_data_size = sizeof(int),
  243. .audio_codec = AV_CODEC_ID_NONE,
  244. .video_codec = AV_CODEC_ID_RAWVIDEO,
  245. .write_header = yuv4_write_header,
  246. .write_packet = yuv4_write_packet,
  247. .flags = AVFMT_RAWPICTURE,
  248. };
  249. #endif
  250. /* Header size increased to allow room for optional flags */
  251. #define MAX_YUV4_HEADER 80
  252. #define MAX_FRAME_HEADER 80
  253. static int yuv4_read_header(AVFormatContext *s)
  254. {
  255. char header[MAX_YUV4_HEADER + 10]; // Include headroom for
  256. // the longest option
  257. char *tokstart, *tokend, *header_end;
  258. int i;
  259. AVIOContext *pb = s->pb;
  260. int width = -1, height = -1, raten = 0,
  261. rated = 0, aspectn = 0, aspectd = 0;
  262. enum AVPixelFormat pix_fmt = AV_PIX_FMT_NONE, alt_pix_fmt = AV_PIX_FMT_NONE;
  263. enum AVChromaLocation chroma_sample_location = AVCHROMA_LOC_UNSPECIFIED;
  264. AVStream *st;
  265. struct frame_attributes *s1 = s->priv_data;
  266. for (i = 0; i < MAX_YUV4_HEADER; i++) {
  267. header[i] = avio_r8(pb);
  268. if (header[i] == '\n') {
  269. header[i + 1] = 0x20; // Add a space after last option.
  270. // Makes parsing "444" vs "444alpha" easier.
  271. header[i + 2] = 0;
  272. break;
  273. }
  274. }
  275. if (i == MAX_YUV4_HEADER)
  276. return -1;
  277. if (strncmp(header, Y4M_MAGIC, strlen(Y4M_MAGIC)))
  278. return -1;
  279. s1->interlaced_frame = 0;
  280. s1->top_field_first = 0;
  281. header_end = &header[i + 1]; // Include space
  282. for (tokstart = &header[strlen(Y4M_MAGIC) + 1];
  283. tokstart < header_end; tokstart++) {
  284. if (*tokstart == 0x20)
  285. continue;
  286. switch (*tokstart++) {
  287. case 'W': // Width. Required.
  288. width = strtol(tokstart, &tokend, 10);
  289. tokstart = tokend;
  290. break;
  291. case 'H': // Height. Required.
  292. height = strtol(tokstart, &tokend, 10);
  293. tokstart = tokend;
  294. break;
  295. case 'C': // Color space
  296. if (strncmp("420jpeg", tokstart, 7) == 0) {
  297. pix_fmt = AV_PIX_FMT_YUV420P;
  298. chroma_sample_location = AVCHROMA_LOC_CENTER;
  299. } else if (strncmp("420mpeg2", tokstart, 8) == 0) {
  300. pix_fmt = AV_PIX_FMT_YUV420P;
  301. chroma_sample_location = AVCHROMA_LOC_LEFT;
  302. } else if (strncmp("420paldv", tokstart, 8) == 0) {
  303. pix_fmt = AV_PIX_FMT_YUV420P;
  304. chroma_sample_location = AVCHROMA_LOC_TOPLEFT;
  305. } else if (strncmp("420p16", tokstart, 6) == 0) {
  306. pix_fmt = AV_PIX_FMT_YUV420P16;
  307. } else if (strncmp("422p16", tokstart, 6) == 0) {
  308. pix_fmt = AV_PIX_FMT_YUV422P16;
  309. } else if (strncmp("444p16", tokstart, 6) == 0) {
  310. pix_fmt = AV_PIX_FMT_YUV444P16;
  311. } else if (strncmp("420p10", tokstart, 6) == 0) {
  312. pix_fmt = AV_PIX_FMT_YUV420P10;
  313. } else if (strncmp("422p10", tokstart, 6) == 0) {
  314. pix_fmt = AV_PIX_FMT_YUV422P10;
  315. } else if (strncmp("444p10", tokstart, 6) == 0) {
  316. pix_fmt = AV_PIX_FMT_YUV444P10;
  317. } else if (strncmp("420p9", tokstart, 5) == 0) {
  318. pix_fmt = AV_PIX_FMT_YUV420P9;
  319. } else if (strncmp("422p9", tokstart, 5) == 0) {
  320. pix_fmt = AV_PIX_FMT_YUV422P9;
  321. } else if (strncmp("444p9", tokstart, 5) == 0) {
  322. pix_fmt = AV_PIX_FMT_YUV444P9;
  323. } else if (strncmp("420", tokstart, 3) == 0) {
  324. pix_fmt = AV_PIX_FMT_YUV420P;
  325. chroma_sample_location = AVCHROMA_LOC_CENTER;
  326. } else if (strncmp("411", tokstart, 3) == 0) {
  327. pix_fmt = AV_PIX_FMT_YUV411P;
  328. } else if (strncmp("422", tokstart, 3) == 0) {
  329. pix_fmt = AV_PIX_FMT_YUV422P;
  330. } else if (strncmp("444alpha", tokstart, 8) == 0 ) {
  331. av_log(s, AV_LOG_ERROR, "Cannot handle 4:4:4:4 "
  332. "YUV4MPEG stream.\n");
  333. return -1;
  334. } else if (strncmp("444", tokstart, 3) == 0) {
  335. pix_fmt = AV_PIX_FMT_YUV444P;
  336. } else if (strncmp("mono16", tokstart, 6) == 0) {
  337. pix_fmt = AV_PIX_FMT_GRAY16;
  338. } else if (strncmp("mono", tokstart, 4) == 0) {
  339. pix_fmt = AV_PIX_FMT_GRAY8;
  340. } else {
  341. av_log(s, AV_LOG_ERROR, "YUV4MPEG stream contains an unknown "
  342. "pixel format.\n");
  343. return -1;
  344. }
  345. while (tokstart < header_end && *tokstart != 0x20)
  346. tokstart++;
  347. break;
  348. case 'I': // Interlace type
  349. switch (*tokstart++){
  350. case '?':
  351. break;
  352. case 'p':
  353. s1->interlaced_frame = 0;
  354. break;
  355. case 't':
  356. s1->interlaced_frame = 1;
  357. s1->top_field_first = 1;
  358. break;
  359. case 'b':
  360. s1->interlaced_frame = 1;
  361. s1->top_field_first = 0;
  362. break;
  363. case 'm':
  364. av_log(s, AV_LOG_ERROR, "YUV4MPEG stream contains mixed "
  365. "interlaced and non-interlaced frames.\n");
  366. return -1;
  367. default:
  368. av_log(s, AV_LOG_ERROR, "YUV4MPEG has invalid header.\n");
  369. return -1;
  370. }
  371. break;
  372. case 'F': // Frame rate
  373. sscanf(tokstart, "%d:%d", &raten, &rated); // 0:0 if unknown
  374. while (tokstart < header_end && *tokstart != 0x20)
  375. tokstart++;
  376. break;
  377. case 'A': // Pixel aspect
  378. sscanf(tokstart, "%d:%d", &aspectn, &aspectd); // 0:0 if unknown
  379. while (tokstart < header_end && *tokstart != 0x20)
  380. tokstart++;
  381. break;
  382. case 'X': // Vendor extensions
  383. if (strncmp("YSCSS=", tokstart, 6) == 0) {
  384. // Older nonstandard pixel format representation
  385. tokstart += 6;
  386. if (strncmp("420JPEG", tokstart, 7) == 0)
  387. alt_pix_fmt = AV_PIX_FMT_YUV420P;
  388. else if (strncmp("420MPEG2", tokstart, 8) == 0)
  389. alt_pix_fmt = AV_PIX_FMT_YUV420P;
  390. else if (strncmp("420PALDV", tokstart, 8) == 0)
  391. alt_pix_fmt = AV_PIX_FMT_YUV420P;
  392. else if (strncmp("420P9", tokstart, 5) == 0)
  393. alt_pix_fmt = AV_PIX_FMT_YUV420P9;
  394. else if (strncmp("422P9", tokstart, 5) == 0)
  395. alt_pix_fmt = AV_PIX_FMT_YUV422P9;
  396. else if (strncmp("444P9", tokstart, 5) == 0)
  397. alt_pix_fmt = AV_PIX_FMT_YUV444P9;
  398. else if (strncmp("420P10", tokstart, 6) == 0)
  399. alt_pix_fmt = AV_PIX_FMT_YUV420P10;
  400. else if (strncmp("422P10", tokstart, 6) == 0)
  401. alt_pix_fmt = AV_PIX_FMT_YUV422P10;
  402. else if (strncmp("444P10", tokstart, 6) == 0)
  403. alt_pix_fmt = AV_PIX_FMT_YUV444P10;
  404. else if (strncmp("420P16", tokstart, 6) == 0)
  405. alt_pix_fmt = AV_PIX_FMT_YUV420P16;
  406. else if (strncmp("422P16", tokstart, 6) == 0)
  407. alt_pix_fmt = AV_PIX_FMT_YUV422P16;
  408. else if (strncmp("444P16", tokstart, 6) == 0)
  409. alt_pix_fmt = AV_PIX_FMT_YUV444P16;
  410. else if (strncmp("411", tokstart, 3) == 0)
  411. alt_pix_fmt = AV_PIX_FMT_YUV411P;
  412. else if (strncmp("422", tokstart, 3) == 0)
  413. alt_pix_fmt = AV_PIX_FMT_YUV422P;
  414. else if (strncmp("444", tokstart, 3) == 0)
  415. alt_pix_fmt = AV_PIX_FMT_YUV444P;
  416. }
  417. while (tokstart < header_end && *tokstart != 0x20)
  418. tokstart++;
  419. break;
  420. }
  421. }
  422. if (width == -1 || height == -1) {
  423. av_log(s, AV_LOG_ERROR, "YUV4MPEG has invalid header.\n");
  424. return -1;
  425. }
  426. if (pix_fmt == AV_PIX_FMT_NONE) {
  427. if (alt_pix_fmt == AV_PIX_FMT_NONE)
  428. pix_fmt = AV_PIX_FMT_YUV420P;
  429. else
  430. pix_fmt = alt_pix_fmt;
  431. }
  432. if (raten <= 0 || rated <= 0) {
  433. // Frame rate unknown
  434. raten = 25;
  435. rated = 1;
  436. }
  437. if (aspectn == 0 && aspectd == 0) {
  438. // Pixel aspect unknown
  439. aspectd = 1;
  440. }
  441. st = avformat_new_stream(s, NULL);
  442. if (!st)
  443. return AVERROR(ENOMEM);
  444. st->codec->width = width;
  445. st->codec->height = height;
  446. av_reduce(&raten, &rated, raten, rated, (1UL << 31) - 1);
  447. avpriv_set_pts_info(st, 64, rated, raten);
  448. st->codec->pix_fmt = pix_fmt;
  449. st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
  450. st->codec->codec_id = AV_CODEC_ID_RAWVIDEO;
  451. st->sample_aspect_ratio = (AVRational){ aspectn, aspectd };
  452. st->codec->chroma_sample_location = chroma_sample_location;
  453. return 0;
  454. }
  455. static int yuv4_read_packet(AVFormatContext *s, AVPacket *pkt)
  456. {
  457. int i;
  458. char header[MAX_FRAME_HEADER+1];
  459. int packet_size, width, height, ret;
  460. AVStream *st = s->streams[0];
  461. struct frame_attributes *s1 = s->priv_data;
  462. for (i = 0; i < MAX_FRAME_HEADER; i++) {
  463. header[i] = avio_r8(s->pb);
  464. if (header[i] == '\n') {
  465. header[i + 1] = 0;
  466. break;
  467. }
  468. }
  469. if (s->pb->error)
  470. return s->pb->error;
  471. else if (s->pb->eof_reached)
  472. return AVERROR_EOF;
  473. else if (i == MAX_FRAME_HEADER)
  474. return AVERROR_INVALIDDATA;
  475. if (strncmp(header, Y4M_FRAME_MAGIC, strlen(Y4M_FRAME_MAGIC)))
  476. return AVERROR_INVALIDDATA;
  477. width = st->codec->width;
  478. height = st->codec->height;
  479. packet_size = avpicture_get_size(st->codec->pix_fmt, width, height);
  480. if (packet_size < 0)
  481. return packet_size;
  482. ret = av_get_packet(s->pb, pkt, packet_size);
  483. if (ret < 0)
  484. return ret;
  485. else if (ret != packet_size)
  486. return s->pb->eof_reached ? AVERROR_EOF : AVERROR(EIO);
  487. if (st->codec->coded_frame) {
  488. st->codec->coded_frame->interlaced_frame = s1->interlaced_frame;
  489. st->codec->coded_frame->top_field_first = s1->top_field_first;
  490. }
  491. pkt->stream_index = 0;
  492. return 0;
  493. }
  494. static int yuv4_probe(AVProbeData *pd)
  495. {
  496. /* check file header */
  497. if (strncmp(pd->buf, Y4M_MAGIC, sizeof(Y4M_MAGIC) - 1) == 0)
  498. return AVPROBE_SCORE_MAX;
  499. else
  500. return 0;
  501. }
  502. #if CONFIG_YUV4MPEGPIPE_DEMUXER
  503. AVInputFormat ff_yuv4mpegpipe_demuxer = {
  504. .name = "yuv4mpegpipe",
  505. .long_name = NULL_IF_CONFIG_SMALL("YUV4MPEG pipe"),
  506. .priv_data_size = sizeof(struct frame_attributes),
  507. .read_probe = yuv4_probe,
  508. .read_header = yuv4_read_header,
  509. .read_packet = yuv4_read_packet,
  510. .extensions = "y4m",
  511. };
  512. #endif