FFmpeg
Loading...
Searching...
No Matches
raw.c
Go to the documentation of this file.
1/*
2 * Raw Video Codec
3 * Copyright (c) 2001 Fabrice Bellard
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22/**
23 * @file
24 * Raw Video Codec
25 */
26
27#include "avcodec.h"
28#include "raw.h"
29#include "raw_pix_fmt_tags.h"
30
32{
33 const PixelFormatTag *tags = raw_pix_fmt_tags;
34 while (tags->pix_fmt >= 0) {
35 if (tags->pix_fmt == fmt)
36 return tags->fourcc;
37 tags++;
38 }
39 return 0;
40}
41
43 { AV_PIX_FMT_PAL8, 1 },
44 { AV_PIX_FMT_PAL8, 2 },
45 { AV_PIX_FMT_PAL8, 4 },
46 { AV_PIX_FMT_PAL8, 8 },
47 { AV_PIX_FMT_RGB444LE, 12 },
48 { AV_PIX_FMT_RGB555LE, 15 },
49 { AV_PIX_FMT_RGB555LE, 16 },
50 { AV_PIX_FMT_BGR24, 24 },
51 { AV_PIX_FMT_BGRA, 32 },
52 { AV_PIX_FMT_NONE, 0 },
53};
54
56 { AV_PIX_FMT_PAL8, 1 },
57 { AV_PIX_FMT_PAL8, 2 },
58 { AV_PIX_FMT_PAL8, 4 },
59 { AV_PIX_FMT_PAL8, 8 },
60 { AV_PIX_FMT_RGB555BE, 16 },
61 { AV_PIX_FMT_RGB24, 24 },
62 { AV_PIX_FMT_ARGB, 32 },
63 { AV_PIX_FMT_PAL8, 33 },
64 { AV_PIX_FMT_NONE, 0 },
65};
66
68 unsigned int fourcc)
69{
70 while (tags->pix_fmt != AV_PIX_FMT_NONE) {
71 if (tags->fourcc == fourcc)
72 return tags->pix_fmt;
73 tags++;
74 }
75 return AV_PIX_FMT_NONE;
76}
77
79 unsigned fourcc)
80{
81 const PixelFormatTag *tags;
82
83 switch (list) {
85 tags = raw_pix_fmt_tags;
86 break;
88 tags = pix_fmt_bps_avi;
89 break;
91 tags = pix_fmt_bps_mov;
92 break;
93 }
94 return find_pix_fmt(tags, fourcc);
95}
Libavcodec external API header.
unsigned int avcodec_pix_fmt_to_codec_tag(enum AVPixelFormat fmt)
Return a value representing the fourCC code associated to the pixel format pix_fmt,...
Definition raw.c:31
AVPixelFormat
Pixel format.
Definition pixfmt.h:71
@ AV_PIX_FMT_NONE
Definition pixfmt.h:72
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
Definition pixfmt.h:75
@ AV_PIX_FMT_ARGB
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
Definition pixfmt.h:99
@ AV_PIX_FMT_RGB555BE
packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), big-endian , X=unused/undefined
Definition pixfmt.h:114
@ AV_PIX_FMT_BGRA
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
Definition pixfmt.h:102
@ AV_PIX_FMT_RGB444LE
packed RGB 4:4:4, 16bpp, (msb)4X 4R 4G 4B(lsb), little-endian, X=unused/undefined
Definition pixfmt.h:136
@ AV_PIX_FMT_RGB555LE
packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), little-endian, X=unused/undefined
Definition pixfmt.h:115
@ AV_PIX_FMT_PAL8
8 bits with AV_PIX_FMT_RGB32 palette
Definition pixfmt.h:84
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
Definition pixfmt.h:76
static enum AVPixelFormat find_pix_fmt(const PixelFormatTag *tags, unsigned int fourcc)
Definition raw.c:67
static const PixelFormatTag pix_fmt_bps_mov[]
Definition raw.c:55
enum AVPixelFormat avpriv_pix_fmt_find(enum PixelFormatTagLists list, unsigned fourcc)
Definition raw.c:78
static const PixelFormatTag pix_fmt_bps_avi[]
Definition raw.c:42
Raw Video Codec.
PixelFormatTagLists
Definition raw.h:37
@ PIX_FMT_LIST_MOV
Definition raw.h:40
@ PIX_FMT_LIST_AVI
Definition raw.h:39
@ PIX_FMT_LIST_RAW
Definition raw.h:38
static const PixelFormatTag raw_pix_fmt_tags[]
enum AVPixelFormat pix_fmt
Definition raw.h:33
unsigned int fourcc
Definition raw.h:34
uint32_t fourcc