yuv4mpeg.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553
  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 PIX_FMT_GRAY8:
  53. colorspace = " Cmono";
  54. break;
  55. case PIX_FMT_GRAY16:
  56. colorspace = " Cmono16";
  57. break;
  58. case PIX_FMT_YUV411P:
  59. colorspace = " C411 XYSCSS=411";
  60. break;
  61. case 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 PIX_FMT_YUV422P:
  69. colorspace = " C422 XYSCSS=422";
  70. break;
  71. case PIX_FMT_YUV444P:
  72. colorspace = " C444 XYSCSS=444";
  73. break;
  74. case PIX_FMT_YUV420P9:
  75. colorspace = " C420p9 XYSCSS=420P9";
  76. break;
  77. case PIX_FMT_YUV422P9:
  78. colorspace = " C422p9 XYSCSS=422P9";
  79. break;
  80. case PIX_FMT_YUV444P9:
  81. colorspace = " C444p9 XYSCSS=444P9";
  82. break;
  83. case PIX_FMT_YUV420P10:
  84. colorspace = " C420p10 XYSCSS=420P10";
  85. break;
  86. case PIX_FMT_YUV422P10:
  87. colorspace = " C422p10 XYSCSS=422P10";
  88. break;
  89. case PIX_FMT_YUV444P10:
  90. colorspace = " C444p10 XYSCSS=444P10";
  91. break;
  92. case PIX_FMT_YUV420P16:
  93. colorspace = " C420p16 XYSCSS=420P16";
  94. break;
  95. case PIX_FMT_YUV422P16:
  96. colorspace = " C422p16 XYSCSS=422P16";
  97. break;
  98. case 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;
  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. picture = (AVPicture *)pkt->data;
  120. /* for the first packet we have to output the header as well */
  121. if (*first_pkt) {
  122. *first_pkt = 0;
  123. if (yuv4_generate_header(s, buf2) < 0) {
  124. av_log(s, AV_LOG_ERROR,
  125. "Error. YUV4MPEG stream header write failed.\n");
  126. return AVERROR(EIO);
  127. } else {
  128. avio_write(pb, buf2, strlen(buf2));
  129. }
  130. }
  131. /* construct frame header */
  132. snprintf(buf1, sizeof(buf1), "%s\n", Y4M_FRAME_MAGIC);
  133. avio_write(pb, buf1, strlen(buf1));
  134. width = st->codec->width;
  135. height = st->codec->height;
  136. ptr = picture->data[0];
  137. switch (st->codec->pix_fmt) {
  138. case PIX_FMT_GRAY8:
  139. case PIX_FMT_YUV411P:
  140. case PIX_FMT_YUV420P:
  141. case PIX_FMT_YUV422P:
  142. case PIX_FMT_YUV444P:
  143. break;
  144. case PIX_FMT_GRAY16:
  145. case PIX_FMT_YUV420P9:
  146. case PIX_FMT_YUV422P9:
  147. case PIX_FMT_YUV444P9:
  148. case PIX_FMT_YUV420P10:
  149. case PIX_FMT_YUV422P10:
  150. case PIX_FMT_YUV444P10:
  151. case PIX_FMT_YUV420P16:
  152. case PIX_FMT_YUV422P16:
  153. case PIX_FMT_YUV444P16:
  154. width *= 2;
  155. break;
  156. default:
  157. av_log(s, AV_LOG_ERROR, "The pixel format '%s' is not supported.\n",
  158. av_get_pix_fmt_name(st->codec->pix_fmt));
  159. return AVERROR(EINVAL);
  160. }
  161. for (i = 0; i < height; i++) {
  162. avio_write(pb, ptr, width);
  163. ptr += picture->linesize[0];
  164. }
  165. if (st->codec->pix_fmt != PIX_FMT_GRAY8 &&
  166. st->codec->pix_fmt != PIX_FMT_GRAY16) {
  167. // Adjust for smaller Cb and Cr planes
  168. avcodec_get_chroma_sub_sample(st->codec->pix_fmt, &h_chroma_shift,
  169. &v_chroma_shift);
  170. width >>= h_chroma_shift;
  171. height >>= v_chroma_shift;
  172. ptr1 = picture->data[1];
  173. ptr2 = picture->data[2];
  174. for (i = 0; i < height; i++) { /* Cb */
  175. avio_write(pb, ptr1, width);
  176. ptr1 += picture->linesize[1];
  177. }
  178. for (i = 0; i < height; i++) { /* Cr */
  179. avio_write(pb, ptr2, width);
  180. ptr2 += picture->linesize[2];
  181. }
  182. }
  183. avio_flush(pb);
  184. return 0;
  185. }
  186. static int yuv4_write_header(AVFormatContext *s)
  187. {
  188. int *first_pkt = s->priv_data;
  189. if (s->nb_streams != 1)
  190. return AVERROR(EIO);
  191. if (s->streams[0]->codec->codec_id != CODEC_ID_RAWVIDEO) {
  192. av_log(s, AV_LOG_ERROR,
  193. "A non-rawvideo stream was selected, but yuv4mpeg only handles rawvideo streams\n");
  194. return AVERROR(EINVAL);
  195. }
  196. switch (s->streams[0]->codec->pix_fmt) {
  197. case 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 PIX_FMT_GRAY8:
  202. case PIX_FMT_GRAY16:
  203. case PIX_FMT_YUV420P:
  204. case PIX_FMT_YUV422P:
  205. case PIX_FMT_YUV444P:
  206. break;
  207. case PIX_FMT_YUV420P9:
  208. case PIX_FMT_YUV422P9:
  209. case PIX_FMT_YUV444P9:
  210. case PIX_FMT_YUV420P10:
  211. case PIX_FMT_YUV422P10:
  212. case PIX_FMT_YUV444P10:
  213. case PIX_FMT_YUV420P16:
  214. case PIX_FMT_YUV422P16:
  215. case 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 format"),
  241. .extensions = "y4m",
  242. .priv_data_size = sizeof(int),
  243. .audio_codec = CODEC_ID_NONE,
  244. .video_codec = 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 PixelFormat pix_fmt = PIX_FMT_NONE, alt_pix_fmt = 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 = PIX_FMT_YUV420P;
  298. chroma_sample_location = AVCHROMA_LOC_CENTER;
  299. } else if (strncmp("420mpeg2", tokstart, 8) == 0) {
  300. pix_fmt = PIX_FMT_YUV420P;
  301. chroma_sample_location = AVCHROMA_LOC_LEFT;
  302. } else if (strncmp("420paldv", tokstart, 8) == 0) {
  303. pix_fmt = PIX_FMT_YUV420P;
  304. chroma_sample_location = AVCHROMA_LOC_TOPLEFT;
  305. } else if (strncmp("420p16", tokstart, 6) == 0) {
  306. pix_fmt = PIX_FMT_YUV420P16;
  307. } else if (strncmp("422p16", tokstart, 6) == 0) {
  308. pix_fmt = PIX_FMT_YUV422P16;
  309. } else if (strncmp("444p16", tokstart, 6) == 0) {
  310. pix_fmt = PIX_FMT_YUV444P16;
  311. } else if (strncmp("420p10", tokstart, 6) == 0) {
  312. pix_fmt = PIX_FMT_YUV420P10;
  313. } else if (strncmp("422p10", tokstart, 6) == 0) {
  314. pix_fmt = PIX_FMT_YUV422P10;
  315. } else if (strncmp("444p10", tokstart, 6) == 0) {
  316. pix_fmt = PIX_FMT_YUV444P10;
  317. } else if (strncmp("420p9", tokstart, 5) == 0) {
  318. pix_fmt = PIX_FMT_YUV420P9;
  319. } else if (strncmp("422p9", tokstart, 5) == 0) {
  320. pix_fmt = PIX_FMT_YUV422P9;
  321. } else if (strncmp("444p9", tokstart, 5) == 0) {
  322. pix_fmt = PIX_FMT_YUV444P9;
  323. } else if (strncmp("420", tokstart, 3) == 0) {
  324. pix_fmt = PIX_FMT_YUV420P;
  325. chroma_sample_location = AVCHROMA_LOC_CENTER;
  326. } else if (strncmp("411", tokstart, 3) == 0) {
  327. pix_fmt = PIX_FMT_YUV411P;
  328. } else if (strncmp("422", tokstart, 3) == 0) {
  329. pix_fmt = 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 = PIX_FMT_YUV444P;
  336. } else if (strncmp("mono", tokstart, 4) == 0) {
  337. pix_fmt = PIX_FMT_GRAY8;
  338. } else if (strncmp("mono16", tokstart, 6) == 0) {
  339. pix_fmt = PIX_FMT_GRAY16;
  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 = PIX_FMT_YUV420P;
  388. else if (strncmp("420MPEG2", tokstart, 8) == 0)
  389. alt_pix_fmt = PIX_FMT_YUV420P;
  390. else if (strncmp("420PALDV", tokstart, 8) == 0)
  391. alt_pix_fmt = PIX_FMT_YUV420P;
  392. else if (strncmp("420P9", tokstart, 5) == 0)
  393. alt_pix_fmt = PIX_FMT_YUV420P9;
  394. else if (strncmp("422P9", tokstart, 5) == 0)
  395. alt_pix_fmt = PIX_FMT_YUV422P9;
  396. else if (strncmp("444P9", tokstart, 5) == 0)
  397. alt_pix_fmt = PIX_FMT_YUV444P9;
  398. else if (strncmp("420P10", tokstart, 6) == 0)
  399. alt_pix_fmt = PIX_FMT_YUV420P10;
  400. else if (strncmp("422P10", tokstart, 6) == 0)
  401. alt_pix_fmt = PIX_FMT_YUV422P10;
  402. else if (strncmp("444P10", tokstart, 6) == 0)
  403. alt_pix_fmt = PIX_FMT_YUV444P10;
  404. else if (strncmp("420P16", tokstart, 6) == 0)
  405. alt_pix_fmt = PIX_FMT_YUV420P16;
  406. else if (strncmp("422P16", tokstart, 6) == 0)
  407. alt_pix_fmt = PIX_FMT_YUV422P16;
  408. else if (strncmp("444P16", tokstart, 6) == 0)
  409. alt_pix_fmt = PIX_FMT_YUV444P16;
  410. else if (strncmp("411", tokstart, 3) == 0)
  411. alt_pix_fmt = PIX_FMT_YUV411P;
  412. else if (strncmp("422", tokstart, 3) == 0)
  413. alt_pix_fmt = PIX_FMT_YUV422P;
  414. else if (strncmp("444", tokstart, 3) == 0)
  415. alt_pix_fmt = 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 == PIX_FMT_NONE) {
  427. if (alt_pix_fmt == PIX_FMT_NONE)
  428. pix_fmt = 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 = 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;
  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 (i == MAX_FRAME_HEADER)
  470. return -1;
  471. if (strncmp(header, Y4M_FRAME_MAGIC, strlen(Y4M_FRAME_MAGIC)))
  472. return -1;
  473. width = st->codec->width;
  474. height = st->codec->height;
  475. packet_size = avpicture_get_size(st->codec->pix_fmt, width, height);
  476. if (packet_size < 0)
  477. return -1;
  478. if (av_get_packet(s->pb, pkt, packet_size) != packet_size)
  479. return AVERROR(EIO);
  480. if (st->codec->coded_frame) {
  481. st->codec->coded_frame->interlaced_frame = s1->interlaced_frame;
  482. st->codec->coded_frame->top_field_first = s1->top_field_first;
  483. }
  484. pkt->stream_index = 0;
  485. return 0;
  486. }
  487. static int yuv4_probe(AVProbeData *pd)
  488. {
  489. /* check file header */
  490. if (strncmp(pd->buf, Y4M_MAGIC, sizeof(Y4M_MAGIC) - 1) == 0)
  491. return AVPROBE_SCORE_MAX;
  492. else
  493. return 0;
  494. }
  495. #if CONFIG_YUV4MPEGPIPE_DEMUXER
  496. AVInputFormat ff_yuv4mpegpipe_demuxer = {
  497. .name = "yuv4mpegpipe",
  498. .long_name = NULL_IF_CONFIG_SMALL("YUV4MPEG pipe format"),
  499. .priv_data_size = sizeof(struct frame_attributes),
  500. .read_probe = yuv4_probe,
  501. .read_header = yuv4_read_header,
  502. .read_packet = yuv4_read_packet,
  503. .extensions = "y4m",
  504. };
  505. #endif