27 #define MAX_YUV4_HEADER 80 
   28 #define MAX_FRAME_HEADER 80 
   34     char *tokstart, *tokend, *header_end;
 
   38         rated =  0, aspectn =  0, aspectd = 0;
 
   46         if (header[i] == 
'\n') {
 
   53     if (i == MAX_YUV4_HEADER)
 
   58     header_end = &header[i + 1]; 
 
   59     for (tokstart = &header[strlen(
Y4M_MAGIC) + 1];
 
   60          tokstart < header_end; tokstart++) {
 
   61         if (*tokstart == 0x20)
 
   63         switch (*tokstart++) {
 
   65             width    = strtol(tokstart, &tokend, 10);
 
   69             height   = strtol(tokstart, &tokend, 10);
 
   73             if (strncmp(
"420jpeg", tokstart, 7) == 0) {
 
   76             } 
else if (strncmp(
"420mpeg2", tokstart, 8) == 0) {
 
   79             } 
else if (strncmp(
"420paldv", tokstart, 8) == 0) {
 
   82             } 
else if (strncmp(
"420p16", tokstart, 6) == 0) {
 
   84             } 
else if (strncmp(
"422p16", tokstart, 6) == 0) {
 
   86             } 
else if (strncmp(
"444p16", tokstart, 6) == 0) {
 
   88             } 
else if (strncmp(
"420p14", tokstart, 6) == 0) {
 
   90             } 
else if (strncmp(
"422p14", tokstart, 6) == 0) {
 
   92             } 
else if (strncmp(
"444p14", tokstart, 6) == 0) {
 
   94             } 
else if (strncmp(
"420p12", tokstart, 6) == 0) {
 
   96             } 
else if (strncmp(
"422p12", tokstart, 6) == 0) {
 
   98             } 
else if (strncmp(
"444p12", tokstart, 6) == 0) {
 
  100             } 
else if (strncmp(
"420p10", tokstart, 6) == 0) {
 
  102             } 
else if (strncmp(
"422p10", tokstart, 6) == 0) {
 
  104             } 
else if (strncmp(
"444p10", tokstart, 6) == 0) {
 
  106             } 
else if (strncmp(
"420p9", tokstart, 5) == 0) {
 
  108             } 
else if (strncmp(
"422p9", tokstart, 5) == 0) {
 
  110             } 
else if (strncmp(
"444p9", tokstart, 5) == 0) {
 
  112             } 
else if (strncmp(
"420", tokstart, 3) == 0) {
 
  115             } 
else if (strncmp(
"411", tokstart, 3) == 0) {
 
  117             } 
else if (strncmp(
"422", tokstart, 3) == 0) {
 
  119             } 
else if (strncmp(
"444alpha", tokstart, 8) == 0 ) {
 
  121                        "YUV4MPEG stream.\n");
 
  123             } 
else if (strncmp(
"444", tokstart, 3) == 0) {
 
  125             } 
else if (strncmp(
"mono16", tokstart, 6) == 0) {
 
  127             } 
else if (strncmp(
"mono", tokstart, 4) == 0) {
 
  134             while (tokstart < header_end && *tokstart != 0x20)
 
  138             switch (*tokstart++){
 
  153                        "interlaced and non-interlaced frames.\n");
 
  160             sscanf(tokstart, 
"%d:%d", &raten, &rated); 
 
  161             while (tokstart < header_end && *tokstart != 0x20)
 
  165             sscanf(tokstart, 
"%d:%d", &aspectn, &aspectd); 
 
  166             while (tokstart < header_end && *tokstart != 0x20)
 
  170             if (strncmp(
"YSCSS=", tokstart, 6) == 0) {
 
  173                 if (strncmp(
"420JPEG", tokstart, 7) == 0)
 
  175                 else if (strncmp(
"420MPEG2", tokstart, 8) == 0)
 
  177                 else if (strncmp(
"420PALDV", tokstart, 8) == 0)
 
  179                 else if (strncmp(
"420P9", tokstart, 5) == 0)
 
  181                 else if (strncmp(
"422P9", tokstart, 5) == 0)
 
  183                 else if (strncmp(
"444P9", tokstart, 5) == 0)
 
  185                 else if (strncmp(
"420P10", tokstart, 6) == 0)
 
  187                 else if (strncmp(
"422P10", tokstart, 6) == 0)
 
  189                 else if (strncmp(
"444P10", tokstart, 6) == 0)
 
  191                 else if (strncmp(
"420P12", tokstart, 6) == 0)
 
  193                 else if (strncmp(
"422P12", tokstart, 6) == 0)
 
  195                 else if (strncmp(
"444P12", tokstart, 6) == 0)
 
  197                 else if (strncmp(
"420P14", tokstart, 6) == 0)
 
  199                 else if (strncmp(
"422P14", tokstart, 6) == 0)
 
  201                 else if (strncmp(
"444P14", tokstart, 6) == 0)
 
  203                 else if (strncmp(
"420P16", tokstart, 6) == 0)
 
  205                 else if (strncmp(
"422P16", tokstart, 6) == 0)
 
  207                 else if (strncmp(
"444P16", tokstart, 6) == 0)
 
  209                 else if (strncmp(
"411", tokstart, 3) == 0)
 
  211                 else if (strncmp(
"422", tokstart, 3) == 0)
 
  213                 else if (strncmp(
"444", tokstart, 3) == 0)
 
  216             while (tokstart < header_end && *tokstart != 0x20)
 
  222     if (width == -1 || 
height == -1) {
 
  231             pix_fmt = alt_pix_fmt;
 
  234     if (raten <= 0 || rated <= 0) {
 
  240     if (aspectn == 0 && aspectd == 0) {
 
  250     av_reduce(&raten, &rated, raten, rated, (1UL << 31) - 1);
 
  272         if (header[i] == 
'\n') {
 
  281     else if (i == MAX_FRAME_HEADER)
 
  297     else if (ret != packet_size)
 
  314     .
name           = 
"yuv4mpegpipe",