1 /*****************************************************************************
2 * chroma.h: libavutil <-> libvlc conversion routines
3 *****************************************************************************
4 * Copyright (C) 1999-2008 the VideoLAN team
7 * Authors: Laurent Aimar <fenrir@via.ecp.fr>
8 * Gildas Bazin <gbazin@videolan.org>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23 *****************************************************************************/
25 /*****************************************************************************
26 * Chroma fourcc -> ffmpeg_id mapping
27 *****************************************************************************/
30 vlc_fourcc_t i_chroma;
35 /* Planar YUV formats */
36 { VLC_FOURCC('Y','U','V','A'), PIX_FMT_YUV444P }, /* Hack */
37 { VLC_FOURCC('I','4','4','4'), PIX_FMT_YUV444P },
38 { VLC_FOURCC('J','4','4','4'), PIX_FMT_YUVJ444P },
39 { VLC_FOURCC('I','4','2','2'), PIX_FMT_YUV422P },
40 { VLC_FOURCC('J','4','2','2'), PIX_FMT_YUVJ422P },
41 { VLC_FOURCC('I','4','2','0'), PIX_FMT_YUV420P },
42 { VLC_FOURCC('Y','V','1','2'), PIX_FMT_YUV420P },
43 { VLC_FOURCC('I','Y','U','V'), PIX_FMT_YUV420P },
44 { VLC_FOURCC('J','4','2','0'), PIX_FMT_YUVJ420P },
45 { VLC_FOURCC('I','4','1','1'), PIX_FMT_YUV411P },
46 { VLC_FOURCC('I','4','1','0'), PIX_FMT_YUV410P },
47 { VLC_FOURCC('Y','V','U','9'), PIX_FMT_YUV410P },
49 /* Packed YUV formats */
50 { VLC_FOURCC('Y','U','Y','2'), PIX_FMT_YUV422 },
51 { VLC_FOURCC('Y','U','Y','V'), PIX_FMT_YUV422 },
52 { VLC_FOURCC('U','Y','V','Y'), PIX_FMT_UYVY422 },
54 /* Packed RGB formats */
55 #if defined(WORDS_BIGENDIAN)
56 { VLC_FOURCC('R','G','B','8'), PIX_FMT_BGR8 },
57 { VLC_FOURCC('R','V','1','5'), PIX_FMT_BGR555 },
58 { VLC_FOURCC('R','V','1','6'), PIX_FMT_BGR565 },
59 { VLC_FOURCC('R','V','2','4'), PIX_FMT_BGR24 },
61 #if defined(PIX_FMT_RGB8)
62 { VLC_FOURCC('R','G','B','8'), PIX_FMT_RGB8 },
64 { VLC_FOURCC('R','V','1','5'), PIX_FMT_RGB555 },
65 { VLC_FOURCC('R','V','1','6'), PIX_FMT_RGB565 },
66 { VLC_FOURCC('R','V','2','4'), PIX_FMT_RGB24 },
68 { VLC_FOURCC('R','V','3','2'), PIX_FMT_RGBA32 },
69 #if defined(PIX_FMT_RGBA)
70 { VLC_FOURCC('R','G','B','A'), PIX_FMT_RGBA },
72 { VLC_FOURCC('G','R','E','Y'), PIX_FMT_GRAY8 },
77 static int GetFfmpegChroma( vlc_fourcc_t i_chroma )
81 for( i = 0; chroma_table[i].i_chroma != 0; i++ )
83 if( chroma_table[i].i_chroma == i_chroma )
84 return chroma_table[i].i_chroma_id;
89 static vlc_fourcc_t GetVlcChroma( int i_ffmpeg_chroma )
93 for( i = 0; chroma_table[i].i_chroma != 0; i++ )
95 if( chroma_table[i].i_chroma_id == i_ffmpeg_chroma )
96 return chroma_table[i].i_chroma;