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 <stdlib.h>
24
#include "
fbdev_common.h
"
25
#include "
libavutil/common.h
"
26
27
struct
rgb_pixfmt_map_entry
{
28
int
bits_per_pixel
;
29
int
red_offset
,
green_offset
,
blue_offset
,
alpha_offset
;
30
enum
AVPixelFormat
pixfmt
;
31
};
32
33
static
const
struct
rgb_pixfmt_map_entry
rgb_pixfmt_map
[] = {
34
// bpp, red_offset, green_offset, blue_offset, alpha_offset, pixfmt
35
{ 32, 0, 8, 16, 24,
AV_PIX_FMT_RGBA
},
36
{ 32, 16, 8, 0, 24,
AV_PIX_FMT_BGRA
},
37
{ 32, 8, 16, 24, 0,
AV_PIX_FMT_ARGB
},
38
{ 32, 3, 2, 8, 0,
AV_PIX_FMT_ABGR
},
39
{ 24, 0, 8, 16, 0,
AV_PIX_FMT_RGB24
},
40
{ 24, 16, 8, 0, 0,
AV_PIX_FMT_BGR24
},
41
{ 16, 11, 5, 0, 16,
AV_PIX_FMT_RGB565
},
42
};
43
44
enum
AVPixelFormat
ff_get_pixfmt_from_fb_varinfo
(
struct
fb_var_screeninfo *varinfo)
45
{
46
int
i;
47
48
for
(i = 0; i <
FF_ARRAY_ELEMS
(rgb_pixfmt_map); i++) {
49
const
struct
rgb_pixfmt_map_entry
*entry = &rgb_pixfmt_map[i];
50
if
(entry->
bits_per_pixel
== varinfo->bits_per_pixel &&
51
entry->
red_offset
== varinfo->red.offset &&
52
entry->
green_offset
== varinfo->green.offset &&
53
entry->
blue_offset
== varinfo->blue.offset)
54
return
entry->
pixfmt
;
55
}
56
57
return
AV_PIX_FMT_NONE
;
58
}
59
60
const
char
*
ff_fbdev_default_device
()
61
{
62
const
char
*dev = getenv(
"FRAMEBUFFER"
);
63
if
(!dev)
64
dev =
"/dev/fb0"
;
65
return
dev;
66
}
67
Generated on Sun Mar 23 2014 23:50:06 for FFmpeg by
1.8.2