]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/grab.c
Cosmetics
[ffmpeg] / libavformat / grab.c
index df30daefe458bdb62936296c09046a1dca2ce53f..c5ca12bac60f1dbe717f8878f5b04a62ca9b96de 100644 (file)
@@ -19,6 +19,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include "avformat.h"
+#include "dsputil.h"
 #include <unistd.h>
 #include <fcntl.h>
 #include <sys/ioctl.h>
@@ -60,8 +61,11 @@ struct {
 } video_formats [] = {
     {.palette = VIDEO_PALETTE_YUV420P, .depth = 12, .pix_fmt = PIX_FMT_YUV420P },
     {.palette = VIDEO_PALETTE_YUV422,  .depth = 16, .pix_fmt = PIX_FMT_YUYV422 },
+    {.palette = VIDEO_PALETTE_UYVY,    .depth = 16, .pix_fmt = PIX_FMT_UYVY422 },
+    {.palette = VIDEO_PALETTE_YUYV,    .depth = 16, .pix_fmt = PIX_FMT_YUYV422 },
     /* NOTE: v4l uses BGR24, not RGB24 */
     {.palette = VIDEO_PALETTE_RGB24,   .depth = 24, .pix_fmt = PIX_FMT_BGR24   },
+    {.palette = VIDEO_PALETTE_RGB565,  .depth = 16, .pix_fmt = PIX_FMT_BGR565  },
     {.palette = VIDEO_PALETTE_GREY,    .depth = 8,  .pix_fmt = PIX_FMT_GRAY8   },
 };
 
@@ -208,7 +212,7 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
             if (aiw_init(s) < 0)
                 goto fail;
             s->aiw_enabled = 1;
-            /* force 420P format because convertion from YUV422 to YUV420P
+            /* force 420P format because conversion from YUV422 to YUV420P
                is done in this driver (ugly) */
             s->frame_format = VIDEO_PALETTE_YUV420P;
         }
@@ -275,7 +279,7 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
     if (video_fd >= 0)
         close(video_fd);
     av_free(st);
-    return AVERROR_IO;
+    return AVERROR(EIO);
 }
 
 static int v4l_mm_read_picture(VideoData *s, uint8_t *buf)
@@ -295,7 +299,7 @@ static int v4l_mm_read_picture(VideoData *s, uint8_t *buf)
             av_log(NULL, AV_LOG_ERROR, "Cannot Sync\n");
         else
             perror("VIDIOCMCAPTURE");
-        return AVERROR_IO;
+        return AVERROR(EIO);
     }
 
     /* This is now the grabbing frame */
@@ -330,7 +334,7 @@ static int grab_read_packet(AVFormatContext *s1, AVPacket *pkt)
     }
 
     if (av_new_packet(pkt, s->frame_size) < 0)
-        return AVERROR_IO;
+        return AVERROR(EIO);
 
     pkt->pts = curtime;
 
@@ -341,7 +345,7 @@ static int grab_read_packet(AVFormatContext *s1, AVPacket *pkt)
         return v4l_mm_read_picture(s, pkt->data);
     } else {
         if (read(s->fd, pkt->data, pkt->size) != pkt->size)
-            return AVERROR_IO;
+            return AVERROR(EIO);
         return s->frame_size;
     }
 }
@@ -836,9 +840,7 @@ static int aiw_read_picture(VideoData *s, uint8_t *data)
                 DEINT_LINE_LUM(12)
                 }
     }
-#ifdef HAVE_MMX
-    emms();
-#endif
+    emms_c();
     return s->frame_size;
 }