From 716d413c13981da15323c7a3821860536eefdbbb Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sat, 6 Oct 2012 12:10:34 +0200 Subject: Replace PIX_FMT_* -> AV_PIX_FMT_*, PixelFormat -> AVPixelFormat --- libavdevice/bktr.c | 2 +- libavdevice/fbdev.c | 22 +++++++++++----------- libavdevice/libdc1394.c | 12 ++++++------ libavdevice/v4l2.c | 50 ++++++++++++++++++++++++------------------------- libavdevice/vfwcap.c | 24 ++++++++++++------------ libavdevice/x11grab.c | 14 +++++++------- 6 files changed, 62 insertions(+), 62 deletions(-) (limited to 'libavdevice') diff --git a/libavdevice/bktr.c b/libavdevice/bktr.c index 98205e7476..d0122d38d6 100644 --- a/libavdevice/bktr.c +++ b/libavdevice/bktr.c @@ -282,7 +282,7 @@ static int grab_read_header(AVFormatContext *s1) s->per_frame = ((uint64_t)1000000 * framerate.den) / framerate.num; st->codec->codec_type = AVMEDIA_TYPE_VIDEO; - st->codec->pix_fmt = PIX_FMT_YUV420P; + st->codec->pix_fmt = AV_PIX_FMT_YUV420P; st->codec->codec_id = AV_CODEC_ID_RAWVIDEO; st->codec->width = width; st->codec->height = height; diff --git a/libavdevice/fbdev.c b/libavdevice/fbdev.c index 376d104e07..fffe655ab5 100644 --- a/libavdevice/fbdev.c +++ b/libavdevice/fbdev.c @@ -48,20 +48,20 @@ struct rgb_pixfmt_map_entry { int bits_per_pixel; int red_offset, green_offset, blue_offset, alpha_offset; - enum PixelFormat pixfmt; + enum AVPixelFormat pixfmt; }; static struct rgb_pixfmt_map_entry rgb_pixfmt_map[] = { // bpp, red_offset, green_offset, blue_offset, alpha_offset, pixfmt - { 32, 0, 8, 16, 24, PIX_FMT_RGBA }, - { 32, 16, 8, 0, 24, PIX_FMT_BGRA }, - { 32, 8, 16, 24, 0, PIX_FMT_ARGB }, - { 32, 3, 2, 8, 0, PIX_FMT_ABGR }, - { 24, 0, 8, 16, 0, PIX_FMT_RGB24 }, - { 24, 16, 8, 0, 0, PIX_FMT_BGR24 }, + { 32, 0, 8, 16, 24, AV_PIX_FMT_RGBA }, + { 32, 16, 8, 0, 24, AV_PIX_FMT_BGRA }, + { 32, 8, 16, 24, 0, AV_PIX_FMT_ARGB }, + { 32, 3, 2, 8, 0, AV_PIX_FMT_ABGR }, + { 24, 0, 8, 16, 0, AV_PIX_FMT_RGB24 }, + { 24, 16, 8, 0, 0, AV_PIX_FMT_BGR24 }, }; -static enum PixelFormat get_pixfmt_from_fb_varinfo(struct fb_var_screeninfo *varinfo) +static enum AVPixelFormat get_pixfmt_from_fb_varinfo(struct fb_var_screeninfo *varinfo) { int i; @@ -74,7 +74,7 @@ static enum PixelFormat get_pixfmt_from_fb_varinfo(struct fb_var_screeninfo *var return entry->pixfmt; } - return PIX_FMT_NONE; + return AV_PIX_FMT_NONE; } typedef struct { @@ -99,7 +99,7 @@ static av_cold int fbdev_read_header(AVFormatContext *avctx) { FBDevContext *fbdev = avctx->priv_data; AVStream *st = NULL; - enum PixelFormat pix_fmt; + enum AVPixelFormat pix_fmt; int ret, flags = O_RDONLY; ret = av_parse_video_rate(&fbdev->framerate_q, fbdev->framerate); @@ -139,7 +139,7 @@ static av_cold int fbdev_read_header(AVFormatContext *avctx) } pix_fmt = get_pixfmt_from_fb_varinfo(&fbdev->varinfo); - if (pix_fmt == PIX_FMT_NONE) { + if (pix_fmt == AV_PIX_FMT_NONE) { ret = AVERROR(EINVAL); av_log(avctx, AV_LOG_ERROR, "Framebuffer pixel format not supported.\n"); diff --git a/libavdevice/libdc1394.c b/libavdevice/libdc1394.c index 97e5bfe650..d953e12cbe 100644 --- a/libavdevice/libdc1394.c +++ b/libavdevice/libdc1394.c @@ -73,12 +73,12 @@ typedef struct dc1394_data { struct dc1394_frame_format { int width; int height; - enum PixelFormat pix_fmt; + enum AVPixelFormat pix_fmt; int frame_size_id; } dc1394_frame_formats[] = { - { 320, 240, PIX_FMT_UYVY422, DC1394_VIDEO_MODE_320x240_YUV422 }, - { 640, 480, PIX_FMT_UYYVYY411, DC1394_VIDEO_MODE_640x480_YUV411 }, - { 640, 480, PIX_FMT_UYVY422, DC1394_VIDEO_MODE_640x480_YUV422 }, + { 320, 240, AV_PIX_FMT_UYVY422, DC1394_VIDEO_MODE_320x240_YUV422 }, + { 640, 480, AV_PIX_FMT_UYYVYY411, DC1394_VIDEO_MODE_640x480_YUV411 }, + { 640, 480, AV_PIX_FMT_UYVY422, DC1394_VIDEO_MODE_640x480_YUV422 }, { 0, 0, 0, 0 } /* gotta be the last one */ }; @@ -124,12 +124,12 @@ static inline int dc1394_read_common(AVFormatContext *c, AVStream* vst; struct dc1394_frame_format *fmt; struct dc1394_frame_rate *fps; - enum PixelFormat pix_fmt; + enum AVPixelFormat pix_fmt; int width, height; AVRational framerate; int ret = 0; - if ((pix_fmt = av_get_pix_fmt(dc1394->pixel_format)) == PIX_FMT_NONE) { + if ((pix_fmt = av_get_pix_fmt(dc1394->pixel_format)) == AV_PIX_FMT_NONE) { av_log(c, AV_LOG_ERROR, "No such pixel format: %s.\n", dc1394->pixel_format); ret = AVERROR(EINVAL); goto out; diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c index 142e026546..9e71f1d8c8 100644 --- a/libavdevice/v4l2.c +++ b/libavdevice/v4l2.c @@ -7,7 +7,7 @@ * (http://v4l2spec.bytesex.org/v4l2spec/capture.c) * * Thanks to Michael Niedermayer for providing the mapping between - * V4L2_PIX_FMT_* and PIX_FMT_* + * V4L2_PIX_FMT_* and AV_PIX_FMT_* * * * This file is part of Libav. @@ -84,28 +84,28 @@ struct buff_data { }; struct fmt_map { - enum PixelFormat ff_fmt; + enum AVPixelFormat ff_fmt; enum AVCodecID codec_id; uint32_t v4l2_fmt; }; static struct fmt_map fmt_conversion_table[] = { //ff_fmt codec_id v4l2_fmt - { PIX_FMT_YUV420P, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_YUV420 }, - { PIX_FMT_YUV422P, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_YUV422P }, - { PIX_FMT_YUYV422, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_YUYV }, - { PIX_FMT_UYVY422, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_UYVY }, - { PIX_FMT_YUV411P, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_YUV411P }, - { PIX_FMT_YUV410P, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_YUV410 }, - { PIX_FMT_RGB555, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_RGB555 }, - { PIX_FMT_RGB565, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_RGB565 }, - { PIX_FMT_BGR24, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_BGR24 }, - { PIX_FMT_RGB24, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_RGB24 }, - { PIX_FMT_BGRA, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_BGR32 }, - { PIX_FMT_GRAY8, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_GREY }, - { PIX_FMT_NV12, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_NV12 }, - { PIX_FMT_NONE, AV_CODEC_ID_MJPEG, V4L2_PIX_FMT_MJPEG }, - { PIX_FMT_NONE, AV_CODEC_ID_MJPEG, V4L2_PIX_FMT_JPEG }, + { AV_PIX_FMT_YUV420P, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_YUV420 }, + { AV_PIX_FMT_YUV422P, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_YUV422P }, + { AV_PIX_FMT_YUYV422, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_YUYV }, + { AV_PIX_FMT_UYVY422, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_UYVY }, + { AV_PIX_FMT_YUV411P, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_YUV411P }, + { AV_PIX_FMT_YUV410P, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_YUV410 }, + { AV_PIX_FMT_RGB555, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_RGB555 }, + { AV_PIX_FMT_RGB565, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_RGB565 }, + { AV_PIX_FMT_BGR24, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_BGR24 }, + { AV_PIX_FMT_RGB24, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_RGB24 }, + { AV_PIX_FMT_BGRA, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_BGR32 }, + { AV_PIX_FMT_GRAY8, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_GREY }, + { AV_PIX_FMT_NV12, AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_NV12 }, + { AV_PIX_FMT_NONE, AV_CODEC_ID_MJPEG, V4L2_PIX_FMT_MJPEG }, + { AV_PIX_FMT_NONE, AV_CODEC_ID_MJPEG, V4L2_PIX_FMT_JPEG }, }; static int device_open(AVFormatContext *ctx) @@ -220,14 +220,14 @@ static int first_field(int fd) return 1; } -static uint32_t fmt_ff2v4l(enum PixelFormat pix_fmt, enum AVCodecID codec_id) +static uint32_t fmt_ff2v4l(enum AVPixelFormat pix_fmt, enum AVCodecID codec_id) { int i; for (i = 0; i < FF_ARRAY_ELEMS(fmt_conversion_table); i++) { if ((codec_id == AV_CODEC_ID_NONE || fmt_conversion_table[i].codec_id == codec_id) && - (pix_fmt == PIX_FMT_NONE || + (pix_fmt == AV_PIX_FMT_NONE || fmt_conversion_table[i].ff_fmt == pix_fmt)) { return fmt_conversion_table[i].v4l2_fmt; } @@ -236,7 +236,7 @@ static uint32_t fmt_ff2v4l(enum PixelFormat pix_fmt, enum AVCodecID codec_id) return 0; } -static enum PixelFormat fmt_v4l2ff(uint32_t v4l2_fmt, enum AVCodecID codec_id) +static enum AVPixelFormat fmt_v4l2ff(uint32_t v4l2_fmt, enum AVCodecID codec_id) { int i; @@ -247,7 +247,7 @@ static enum PixelFormat fmt_v4l2ff(uint32_t v4l2_fmt, enum AVCodecID codec_id) } } - return PIX_FMT_NONE; + return AV_PIX_FMT_NONE; } static enum AVCodecID fmt_v4l2codec(uint32_t v4l2_fmt) @@ -295,7 +295,7 @@ static void list_formats(AVFormatContext *ctx, int fd, int type) while(!ioctl(fd, VIDIOC_ENUM_FMT, &vfd)) { enum AVCodecID codec_id = fmt_v4l2codec(vfd.pixelformat); - enum PixelFormat pix_fmt = fmt_v4l2ff(vfd.pixelformat, codec_id); + enum AVPixelFormat pix_fmt = fmt_v4l2ff(vfd.pixelformat, codec_id); vfd.index++; @@ -645,7 +645,7 @@ static int v4l2_set_parameters(AVFormatContext *s1) } static uint32_t device_try_init(AVFormatContext *s1, - enum PixelFormat pix_fmt, + enum AVPixelFormat pix_fmt, int *width, int *height, enum AVCodecID *codec_id) @@ -684,7 +684,7 @@ static int v4l2_read_header(AVFormatContext *s1) int res = 0; uint32_t desired_format; enum AVCodecID codec_id; - enum PixelFormat pix_fmt = PIX_FMT_NONE; + enum AVPixelFormat pix_fmt = AV_PIX_FMT_NONE; st = avformat_new_stream(s1, NULL); if (!st) { @@ -721,7 +721,7 @@ static int v4l2_read_header(AVFormatContext *s1) pix_fmt = av_get_pix_fmt(s->pixel_format); - if (pix_fmt == PIX_FMT_NONE && !codec) { + if (pix_fmt == AV_PIX_FMT_NONE && !codec) { av_log(s1, AV_LOG_ERROR, "No such input format: %s.\n", s->pixel_format); diff --git a/libavdevice/vfwcap.c b/libavdevice/vfwcap.c index cead0ec972..fea85fc5ae 100644 --- a/libavdevice/vfwcap.c +++ b/libavdevice/vfwcap.c @@ -47,32 +47,32 @@ struct vfw_ctx { char *framerate; /**< Set by a private option. */ }; -static enum PixelFormat vfw_pixfmt(DWORD biCompression, WORD biBitCount) +static enum AVPixelFormat vfw_pixfmt(DWORD biCompression, WORD biBitCount) { switch(biCompression) { case MKTAG('U', 'Y', 'V', 'Y'): - return PIX_FMT_UYVY422; + return AV_PIX_FMT_UYVY422; case MKTAG('Y', 'U', 'Y', '2'): - return PIX_FMT_YUYV422; + return AV_PIX_FMT_YUYV422; case MKTAG('I', '4', '2', '0'): - return PIX_FMT_YUV420P; + return AV_PIX_FMT_YUV420P; case BI_RGB: switch(biBitCount) { /* 1-8 are untested */ case 1: - return PIX_FMT_MONOWHITE; + return AV_PIX_FMT_MONOWHITE; case 4: - return PIX_FMT_RGB4; + return AV_PIX_FMT_RGB4; case 8: - return PIX_FMT_RGB8; + return AV_PIX_FMT_RGB8; case 16: - return PIX_FMT_RGB555; + return AV_PIX_FMT_RGB555; case 24: - return PIX_FMT_BGR24; + return AV_PIX_FMT_BGR24; case 32: - return PIX_FMT_RGB32; + return AV_PIX_FMT_RGB32; } } - return PIX_FMT_NONE; + return AV_PIX_FMT_NONE; } static enum AVCodecID vfw_codecid(DWORD biCompression) @@ -376,7 +376,7 @@ static int vfw_read_header(AVFormatContext *s) codec->width = bi->bmiHeader.biWidth; codec->height = bi->bmiHeader.biHeight; codec->pix_fmt = vfw_pixfmt(biCompression, biBitCount); - if(codec->pix_fmt == PIX_FMT_NONE) { + if(codec->pix_fmt == AV_PIX_FMT_NONE) { codec->codec_id = vfw_codecid(biCompression); if(codec->codec_id == AV_CODEC_ID_NONE) { av_log(s, AV_LOG_ERROR, "Unknown compression type. " diff --git a/libavdevice/x11grab.c b/libavdevice/x11grab.c index ab5362d282..8edbf7bf2b 100644 --- a/libavdevice/x11grab.c +++ b/libavdevice/x11grab.c @@ -158,7 +158,7 @@ x11grab_read_header(AVFormatContext *s1) struct x11grab *x11grab = s1->priv_data; Display *dpy; AVStream *st = NULL; - enum PixelFormat input_pixfmt; + enum AVPixelFormat input_pixfmt; XImage *image; int x_off = 0; int y_off = 0; @@ -259,19 +259,19 @@ x11grab_read_header(AVFormatContext *s1) switch (image->bits_per_pixel) { case 8: av_log (s1, AV_LOG_DEBUG, "8 bit palette\n"); - input_pixfmt = PIX_FMT_PAL8; + input_pixfmt = AV_PIX_FMT_PAL8; break; case 16: if ( image->red_mask == 0xf800 && image->green_mask == 0x07e0 && image->blue_mask == 0x001f ) { av_log (s1, AV_LOG_DEBUG, "16 bit RGB565\n"); - input_pixfmt = PIX_FMT_RGB565; + input_pixfmt = AV_PIX_FMT_RGB565; } else if (image->red_mask == 0x7c00 && image->green_mask == 0x03e0 && image->blue_mask == 0x001f ) { av_log(s1, AV_LOG_DEBUG, "16 bit RGB555\n"); - input_pixfmt = PIX_FMT_RGB555; + input_pixfmt = AV_PIX_FMT_RGB555; } else { av_log(s1, AV_LOG_ERROR, "RGB ordering at image depth %i not supported ... aborting\n", image->bits_per_pixel); av_log(s1, AV_LOG_ERROR, "color masks: r 0x%.6lx g 0x%.6lx b 0x%.6lx\n", image->red_mask, image->green_mask, image->blue_mask); @@ -283,11 +283,11 @@ x11grab_read_header(AVFormatContext *s1) if ( image->red_mask == 0xff0000 && image->green_mask == 0x00ff00 && image->blue_mask == 0x0000ff ) { - input_pixfmt = PIX_FMT_BGR24; + input_pixfmt = AV_PIX_FMT_BGR24; } else if ( image->red_mask == 0x0000ff && image->green_mask == 0x00ff00 && image->blue_mask == 0xff0000 ) { - input_pixfmt = PIX_FMT_RGB24; + input_pixfmt = AV_PIX_FMT_RGB24; } else { av_log(s1, AV_LOG_ERROR,"rgb ordering at image depth %i not supported ... aborting\n", image->bits_per_pixel); av_log(s1, AV_LOG_ERROR, "color masks: r 0x%.6lx g 0x%.6lx b 0x%.6lx\n", image->red_mask, image->green_mask, image->blue_mask); @@ -296,7 +296,7 @@ x11grab_read_header(AVFormatContext *s1) } break; case 32: - input_pixfmt = PIX_FMT_RGB32; + input_pixfmt = AV_PIX_FMT_RGB32; break; default: av_log(s1, AV_LOG_ERROR, "image depth %i not supported ... aborting\n", image->bits_per_pixel); -- cgit v1.2.3