58#define DEFAULT_DUMP_LEN 32
59#define MOD_NAME "[dummy] "
98 while ((tok = strtok_r(str,
",", &sptr))) {
112 char *save_ptr = NULL;
113 while ((
item = strtok_r(
fmt,
":", &save_ptr)) != NULL) {
115 if (strstr(
item,
"codec=") != NULL) {
119 }
else if (strstr(
item,
"dump") != NULL) {
121 }
else if (strstr(
item,
"hexdump") != NULL) {
122 if (strstr(
item,
"hexdump=") != NULL) {
127 }
else if (strstr(
item,
"rgb_shift=") != NULL) {
128 item += strlen(
"rgb_shift=");
134 }
else if (strstr(
item,
"skip=") != NULL) {
136 }
else if (strcmp(
item,
"oneshot") == 0) {
138 }
else if (strcmp(
item,
"raw") == 0) {
154 if (strcmp(cfg,
"help") == 0) {
155 char desc[] =
"Display " TBOLD(
"dummy")
" only consumes the video without displaying it. A difference to avoiding "
156 "display specification is that it forces decoding (otherwise it will be skipped altogether).\n\n"
157 "Additionally, options " TBOLD(
"hexdump")
" and " TBOLD(
"dump")
" are available for debugging.\n\n";
160 {
"codec=<codec>[,<codec2>] | codec=<setlist>",
"force the use of a codec instead of default set; special set list also possible (see below)" },
162 {
"dump[:skip=<n>][:oneshot][:raw]",
"dump first frame to file dummy.<ext> (optionally skip <n> first frames); 'oneshot' - exit after dumping the picture; 'raw' - dump raw data" },
163 {
"hexdump[=<n>]",
"dump first n (default " TOSTRING(
DEFAULT_DUMP_LEN)
") bytes of every frame in hexadecimal format" },
177 char *ccpy = alloca(strlen(cfg) + 1);
185 memcpy(ret, &s,
sizeof s);
203static void dump_buf(
unsigned char *buf,
size_t len,
int block_size) {
204 printf(
"Frame content: ");
205 for (
size_t i = 0; i <
len; ++i) {
206 printf(
"%02hhx ", *buf++);
207 if (block_size > 0 && (i + 1) % block_size == 0) {
249 if (req_len > *
len) {
280 *available_cards = NULL;
struct video_frame * frame
const char unsigned int flags
int void(** deleter)(void *))
void vf_free(struct video_frame *buf)
Frees video_frame structure.
struct video_frame * vf_alloc_desc_data(struct video_desc desc)
codec_t get_codec_from_name(const char *name)
int color_printf(const char *format,...)
void log_msg(int level, const char *format,...)
#define LOG_LEVEL_NOTICE
information that may be interesting
#define LOG_LEVEL_ERROR
general errors
#define LOG_LEVEL_WARNING
less severe errors
#define VIDEO_DISPLAY_ABI_VERSION
@ DISPLAY_PROPERTY_RGB_SHIFT
red,green,blue shift - int[3] (bits)
@ DISPLAY_PROPERTY_CODECS
list of natively supported codecs - codec_t[]
@ LIBRARY_CLASS_VIDEO_DISPLAY
#define REGISTER_MODULE(name, info, lclass, abi)
Registers module to global modules' registry.
void print_module_usage(const char *module_name, const struct key_val *options, const struct key_val *options_full, bool print_full_help)
#define DEFAULT_RGB_SHIFT_INIT
int dump_to_file_skip_frames
codec_t codecs[VIDEO_CODEC_COUNT]
char * data
Raw tile data. Pointer must be at least 4B aligned.
unsigned int data_len
length of the data
Struct video_frame represents a video frame and contains video description.
struct tile tiles[FLEXIBLE_ARRAY_MEMBER]
@ YUYV
YCbCr 422 8-bit - Y0 Cb Y1 Cr.
@ DXT1
S3 Texture Compression DXT1.
@ R10k
RGB 10-bit packed - RGBX, big-endian (2 bit padding)
@ RGB
RGB 8-bit (packed into 24-bit word)
@ UYVY
YCbCr 422 8-bit - Cb Y0 Cr Y1.
@ VIDEO_CODEC_NONE
dummy color spec
@ RG48
16-bit RGB little-endian (RlRhGl...)
@ Y416
interleaved little-endian YCbCr 4444 16-bit - UYVA
@ VIDEO_CODEC_COUNT
count of known video codecs (including VIDEO_CODEC_NONE)
@ R12L
RGB 12-bit packed, little-endian.
@ DXT5
S3 Texture Compression DXT5.
@ DXT1_YUV
Structure same as DXT1, instead of RGB, YCbCr values are stored.
@ RGBA
RGBA 8-bit, big-endian.
@ v210
YCbCr 422 10-bit - xVY0U|xY2UY1|xUY3V|xY5VY4, little-endian (2 bit padding /'x'/),...
char * wrap_paragraph(char *text)
This is an umbrella header for video functions.
int get_pf_block_bytes(codec_t codec)
returns codec_info_t::block_size_bytes
static void dump_buf(unsigned char *buf, size_t len, int block_size)
static const codec_t codecs_decklink[]
const struct codec_profile_t codec_profiles[]
static bool display_dummy_reconfigure(void *state, struct video_desc desc)
static void display_dummy_done(void *state)
static const codec_t codecs_gl[]
static void display_dummy_probe(struct device_info **available_cards, int *count, void(**deleter)(void *))
static void * display_dummy_init(struct module *parent, const char *cfg, unsigned int flags)
static bool display_dummy_putf(void *state, struct video_frame *frame, long long flags)
static struct video_frame * display_dummy_getf(void *state)
static _Bool parse_codecs(char *str, codec_t *codecs, size_t *codec_count)
static _Bool dummy_parse_opts(struct dummy_display_state *s, char *fmt)
static const struct video_display_info display_dummy_info
static bool display_dummy_get_property(void *state, int property, void *val, size_t *len)
static const codec_t default_codecs[]
const char * save_video_frame(struct video_frame *frame, const char *name, bool raw)