FFmpeg
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
Examples
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
libavdevice
fbdev_common.c
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2011 Stefano Sabatini
3
* Copyright (c) 2009 Giliard B. de Freitas <giliarde@gmail.com>
4
* Copyright (C) 2002 Gunnar Monell <gmo@linux.nu>
5
*
6
* This file is part of FFmpeg.
7
*
8
* FFmpeg is free software; you can redistribute it and/or
9
* modify it under the terms of the GNU Lesser General Public
10
* License as published by the Free Software Foundation; either
11
* version 2.1 of the License, or (at your option) any later version.
12
*
13
* FFmpeg is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
* Lesser General Public License for more details.
17
*
18
* You should have received a copy of the GNU Lesser General Public
19
* License along with FFmpeg; if not, write to the Free Software
20
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21
*/
22
23
#include "
fbdev_common.h
"
24
#include "
libavutil/common.h
"
25
26
struct
rgb_pixfmt_map_entry
{
27
int
bits_per_pixel
;
28
int
red_offset
,
green_offset
,
blue_offset
,
alpha_offset
;
29
enum
AVPixelFormat
pixfmt
;
30
};
31
32
static
const
struct
rgb_pixfmt_map_entry
rgb_pixfmt_map
[] = {
33
// bpp, red_offset, green_offset, blue_offset, alpha_offset, pixfmt
34
{ 32, 0, 8, 16, 24,
AV_PIX_FMT_RGBA
},
35
{ 32, 16, 8, 0, 24,
AV_PIX_FMT_BGRA
},
36
{ 32, 8, 16, 24, 0,
AV_PIX_FMT_ARGB
},
37
{ 32, 3, 2, 8, 0,
AV_PIX_FMT_ABGR
},
38
{ 24, 0, 8, 16, 0,
AV_PIX_FMT_RGB24
},
39
{ 24, 16, 8, 0, 0,
AV_PIX_FMT_BGR24
},
40
{ 16, 11, 5, 0, 16,
AV_PIX_FMT_RGB565
},
41
};
42
43
enum
AVPixelFormat
ff_get_pixfmt_from_fb_varinfo
(
struct
fb_var_screeninfo *varinfo)
44
{
45
int
i;
46
47
for
(i = 0; i <
FF_ARRAY_ELEMS
(rgb_pixfmt_map); i++) {
48
const
struct
rgb_pixfmt_map_entry
*entry = &rgb_pixfmt_map[i];
49
if
(entry->
bits_per_pixel
== varinfo->bits_per_pixel &&
50
entry->
red_offset
== varinfo->red.offset &&
51
entry->
green_offset
== varinfo->green.offset &&
52
entry->
blue_offset
== varinfo->blue.offset)
53
return
entry->
pixfmt
;
54
}
55
56
return
AV_PIX_FMT_NONE
;
57
}
Generated on Sat Jan 25 2014 19:51:58 for FFmpeg by
1.8.2