UltraGrid
UltraGrid Low-Latency High-Resolution Transmission System
Loading...
Searching...
No Matches
utils.c
Go to the documentation of this file.
1
6/*
7 * Copyright (c) 2013-2023 CESNET, z. s. p. o.
8 * All rights reserved.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, is permitted provided that the following conditions
12 * are met:
13 *
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 *
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 *
21 * 3. Neither the name of CESNET nor the names of its contributors may be
22 * used to endorse or promote products derived from this software without
23 * specific prior written permission.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS
26 * "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING,
27 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
28 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
29 * EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
30 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
31 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
32 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
35 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
36 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 */
38
39#ifdef HAVE_CONFIG_H
40#include "config.h"
41#include "config_unix.h"
42#include "config_win32.h"
43#endif // HAVE_CONFIG_H
44
45#include "libavcodec/utils.h"
46
49static const struct uv_to_av_pixfmt uv_to_av_pixfmts[] = {
50 {RGBA, AV_PIX_FMT_RGBA},
51 {UYVY, AV_PIX_FMT_UYVY422},
52 {YUYV,AV_PIX_FMT_YUYV422},
53 //R10k,
54 //v210,
55 //DVS10,
56 //DXT1,
57 //DXT1_YUV,
58 //DXT5,
59 {RGB, AV_PIX_FMT_RGB24},
60 //JPEG,
61 //RAW,
62 //H264,
63 //MJPG,
64 //VP8,
65 {BGR, AV_PIX_FMT_BGR24},
66 //J2K,
67 {I420, AV_PIX_FMT_YUVJ420P},
68 {RG48, AV_PIX_FMT_RGB48LE},
69#if XV3X_PRESENT
70 {Y416, AV_PIX_FMT_XV36},
71#endif
72 {0, 0}
73};
74
76 for (unsigned int i = 0; uv_to_av_pixfmts[i].uv_codec != VIDEO_CODEC_NONE; ++i) {
78 return uv_to_av_pixfmts[i].uv_codec;
79 }
80 }
81 return VIDEO_CODEC_NONE;
82}
83
85 for (unsigned int i = 0; uv_to_av_pixfmts[i].uv_codec != VIDEO_CODEC_NONE; ++i) {
88 }
89 }
90 return AV_PIX_FMT_NONE;
91}
92
98 return uv_to_av_pixfmts;
99}
100
101/* vi: set expandtab sw=8: */
enum AVPixelFormat av_pixfmt
enum AVPixelFormat av_pixfmt
Definition utils.h:54
codec_t uv_codec
Definition utils.h:53
codec_t
Definition types.h:65
@ YUYV
YCbCr 422 8-bit - Y0 Cb Y1 Cr.
Definition types.h:72
@ RGB
RGB 8-bit (packed into 24-bit word)
Definition types.h:80
@ UYVY
YCbCr 422 8-bit - Cb Y0 Cr Y1.
Definition types.h:71
@ VIDEO_CODEC_NONE
dummy color spec
Definition types.h:66
@ BGR
8-bit BGR
Definition types.h:88
@ RG48
16-bit RGB little-endian (RlRhGl...)
Definition types.h:95
@ Y416
interleaved little-endian YCbCr 4444 16-bit - UYVA
Definition types.h:99
@ I420
planar YCbCr 4:2:0
Definition types.h:97
@ RGBA
RGBA 8-bit, big-endian.
Definition types.h:70
const struct uv_to_av_pixfmt * get_av_to_ug_pixfmts()
Definition utils.c:97
enum AVPixelFormat get_ug_to_av_pixfmt(codec_t ug_codec)
Definition utils.c:84
static const struct uv_to_av_pixfmt uv_to_av_pixfmts[]
Definition utils.c:49
codec_t get_av_to_ug_pixfmt(enum AVPixelFormat av_pixfmt)
Definition utils.c:75
codec_t ug_codec
Definition v4l2_common.h:68