UltraGrid
UltraGrid Low-Latency High-Resolution Transmission System
Loading...
Searching...
No Matches
video_pattern_generator.h File Reference
#include "types.h"
Include dependency graph for video_pattern_generator.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef struct video_pattern_generator * video_pattern_generator_t
 

Functions

video_pattern_generator_t video_pattern_generator_create (const char *config, int width, int height, codec_t color_spec, int offset)
 
void video_pattern_generator_destroy (video_pattern_generator_t)
 
void video_pattern_generator_fill_data (video_pattern_generator_t, const char *data)
 
char * video_pattern_generator_next_frame (video_pattern_generator_t)
 

Detailed Description

Typedef Documentation

◆ video_pattern_generator_t

Function Documentation

◆ video_pattern_generator_create()

video_pattern_generator_t video_pattern_generator_create ( const char * config,
int width,
int height,
codec_t color_spec,
int offset )
Parameters
offsetoffset between still image frames (in bytes)

Definition at line 830 of file video_pattern_generator.cpp.

831{
832
833 if (string(config) == "help") {
834 col() << "Pattern to use, one of: \n";
835 for (const auto *p :
836 {
837 "bars",
839 "diagonal*",
840 "ebu_bars",
841 "gradient[=0x<AABBGGRR>]",
842 "gradient2*",
843 "gray",
844 "interlaced",
845 "noise",
846 "raw=0xXX[YYZZ..]",
847 "smpte_bars",
848 "strips*",
849 "uv_plane[=<y_lvl>]",
850 }) {
851 col() << "\t- " << SBOLD(p) << "\n";
852 }
853
854 col() << "\nNotes:\n";
855
856 col() << "\t- patterns " SBOLD("'gradient'") ", "
857 SBOLD("'gradient2'") ", " SBOLD("'noise'") " and "
858 SBOLD("'uv_plane'") " generate higher bit-depth "
859 "patterns with";
861 c = static_cast<codec_t>(static_cast<int>(c) + 1)) {
862 if (get_decoder_from_to(RG48, c) != NULL && get_bits_per_component(c) > 8) {
863 col() << " " << SBOLD(get_codec_name(c));
864 }
865 }
866 col() << "\n";
867 col() << "\t- pattern "
868 << SBOLD("'raw'") " generates repeating sequence of given "
869 "bytes without any color conversion\n";
870 col() << "\t- patterns marked with "
871 << SBOLD("'*'") " provide help as its option\n";
872 return nullptr;
873 }
874 assert(width > 0 && height > 0);
875 try {
876 string pattern = config;
877 string params;
878 if (string::size_type delim = pattern.find('='); delim != string::npos) {
879 params = pattern.substr(delim + 1);
880 pattern = pattern.substr(0, delim);
881 }
882 if (pattern == "gray" || pattern == "grey") {
883 return new gray_video_pattern_generator{width, height, color_spec, params};
884 }
885 if (pattern == "interlaced") {
886 return new interlaced_video_pattern_generator{width, height, color_spec};
887 }
888 return new still_image_video_pattern_generator{pattern, params, width, height, color_spec, offset};
889 } catch (exception const &e) {
890 LOG(LOG_LEVEL_ERROR) << MOD_NAME << e.what() << "\n";
891 return nullptr;
892 } catch (...) {
893 return nullptr;
894 }
895}
const char * get_codec_name(codec_t codec)
pattern
Definition testcard.c:94
#define SBOLD(x)
Definition color_out.h:80
static __device__ const float offset
Definition cuda_dxt.cu:139
#define LOG_LEVEL_ERROR
general errors
Definition debug.h:59
#define LOG(level)
Definition debug.h:313
static struct @19 params[100]
decoder_t get_decoder_from_to(codec_t in, codec_t out)
codec_t
Definition types.h:65
@ VIDEO_CODEC_FIRST
Definition types.h:68
@ RG48
16-bit RGB little-endian (RlRhGl...)
Definition types.h:95
@ VIDEO_CODEC_COUNT
count of known video codecs (including VIDEO_CODEC_NONE)
Definition types.h:108
int get_bits_per_component(codec_t codec)
#define BLANK_USAGE
#define MOD_NAME

References BLANK_USAGE, get_bits_per_component(), get_codec_name(), get_decoder_from_to(), LOG, LOG_LEVEL_ERROR, MOD_NAME, offset, params, RG48, SBOLD, VIDEO_CODEC_COUNT, and VIDEO_CODEC_FIRST.

Referenced by vidcap_testcard_init().

Here is the call graph for this function:

◆ video_pattern_generator_destroy()

void video_pattern_generator_destroy ( video_pattern_generator_t s)

Definition at line 909 of file video_pattern_generator.cpp.

910{
911 delete s;
912}

Referenced by vidcap_testcard_done().

◆ video_pattern_generator_fill_data()

void video_pattern_generator_fill_data ( video_pattern_generator_t s,
const char * data )

Definition at line 902 of file video_pattern_generator.cpp.

903{
904 auto &state = dynamic_cast<still_image_video_pattern_generator &>(*s);
905 memcpy(state.data.data(), data, state.data_len);
906 memcpy(state.data.data() + state.data_len, data, state.data_len);
907}
void ** state

References state.

Referenced by vidcap_testcard_init().

◆ video_pattern_generator_next_frame()

char * video_pattern_generator_next_frame ( video_pattern_generator_t s)

Definition at line 897 of file video_pattern_generator.cpp.

898{
899 return s->get_next();
900}
virtual char * get_next()=0

References video_pattern_generator::get_next().

Referenced by vidcap_testcard_grab().

Here is the call graph for this function: