mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-03-21 11:40:22 +00:00
DeckLink capture: keep codec bit depth during format change
This commit is contained in:
@@ -119,6 +119,7 @@ struct vidcap_decklink_state {
|
||||
struct timeval t0;
|
||||
|
||||
bool detect_format;
|
||||
bool is_10b;
|
||||
};
|
||||
|
||||
static HRESULT set_display_mode_properties(struct vidcap_decklink_state *s, struct tile *tile, IDeckLinkDisplayMode* displayMode, /* out */ BMDPixelFormat *pf);
|
||||
@@ -170,10 +171,10 @@ public:
|
||||
unique_lock<mutex> lk(s->lock);
|
||||
switch(flags) {
|
||||
case bmdDetectedVideoInputYCbCr422:
|
||||
s->codec = UYVY;
|
||||
s->codec = s->is_10b ? v210 : UYVY;
|
||||
break;
|
||||
case bmdDetectedVideoInputRGB444:
|
||||
s->codec = RGBA;
|
||||
s->codec = s->is_10b ? R10k : RGBA;
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "[Decklink] Unhandled color spec!\n");
|
||||
@@ -817,6 +818,8 @@ vidcap_decklink_init(const struct vidcap_params *params, void **state)
|
||||
return VIDCAP_INIT_NOERR;
|
||||
}
|
||||
|
||||
s->is_10b = get_bits_per_component(s->codec) == 10;
|
||||
|
||||
if(vidcap_params_get_flags(params) & (VIDCAP_FLAG_AUDIO_EMBEDDED | VIDCAP_FLAG_AUDIO_AESEBU | VIDCAP_FLAG_AUDIO_ANALOG)) {
|
||||
s->grab_audio = TRUE;
|
||||
switch(vidcap_params_get_flags(params) & (VIDCAP_FLAG_AUDIO_EMBEDDED | VIDCAP_FLAG_AUDIO_AESEBU | VIDCAP_FLAG_AUDIO_ANALOG)) {
|
||||
|
||||
@@ -217,6 +217,17 @@ void show_codec_help(const char *module, const codec_t *codecs8, const codec_t *
|
||||
}
|
||||
}
|
||||
|
||||
int get_bits_per_component(codec_t codec)
|
||||
{
|
||||
unsigned int i = (unsigned int) codec;
|
||||
|
||||
if (i < sizeof codec_info / sizeof(struct codec_info_t)) {
|
||||
return codec_info[i].bits_per_channel;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
double get_bpp(codec_t codec)
|
||||
{
|
||||
unsigned int i = (unsigned int) codec;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
* @author Dalibor Matura <255899@mail.muni.cz>
|
||||
* @author Ian Wesley-Smith <iwsmith@cct.lsu.edu>
|
||||
*/
|
||||
/* Copyright (c) 2005-2013 CESNET z.s.p.o.
|
||||
/* Copyright (c) 2005-2017 CESNET z.s.p.o.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, is permitted provided that the following conditions
|
||||
@@ -65,9 +65,11 @@ extern "C" {
|
||||
typedef void (*decoder_t)(unsigned char *dst, const unsigned char *src, int dst_len,
|
||||
int rshift, int gshift, int bshift);
|
||||
|
||||
/** Prints list of suppored codecs for video module
|
||||
*/
|
||||
/// Prints list of suppored codecs for video module
|
||||
void show_codec_help(const char *module, const codec_t *codecs8, const codec_t *codecs10);
|
||||
/// @returns number of bits per color component
|
||||
int get_bits_per_component(codec_t codec) __attribute__((pure));
|
||||
/// @returns number of bytes per pixel
|
||||
double get_bpp(codec_t codec) __attribute__((pure));
|
||||
uint32_t get_fourcc(codec_t codec) __attribute__((pure));
|
||||
int get_halign(codec_t codec) __attribute__((pure));
|
||||
|
||||
Reference in New Issue
Block a user