New upstream version 21.0.2+dfsg1

This commit is contained in:
Sebastian Ramacher 2018-02-19 20:54:37 +01:00
parent 1f1bbb3518
commit baafb6325b
706 changed files with 49633 additions and 5044 deletions

View file

@ -21,52 +21,64 @@ int check_buffer(struct audio_repack *repack,
}
/*
Swap channel between LFE and FC, and
squash data array
| FL | FR |LFE | FC | BL | BR |emp |emp |
| | x | |
| FL | FR | FC |LFE | BL | BR |
* Swap channel 3 & 4, 5 & 7, 6 & 8 and squash arrays
* 2.1:
*
* | FL | FR | LFE | emp | emp | emp |emp |emp |
* | | |
* | FL | FR | LFE |
* 4.0 (quad):
*
* | FL | FR | BR | BL | emp | emp |emp |emp |
* | | x |
* | FL | FR | BL | BC |
*
* 4.1:
*
* | FL | FR |LFE | FC | BC | emp |emp |emp |
* | | x | |
* | FL | FR | FC |LFE | BC |
*
* 5.1:
*
* | FL | FR |LFE | FC |(emp|emp)|(BL|BR)|
* | | x x
* | FL | FR | FC |LFE | BL | BR |
*
* 7.1:
*
* | FL | FR |LFE | FC |( SL | SR )|(BL |BR )|
* | | x X
* | FL | FR | FC |LFE |( BL | BR )|(SL |SR )|
*/
int repack_8to6ch_swap23(struct audio_repack *repack,
int repack_squash_swap(struct audio_repack *repack,
const uint8_t *bsrc, uint32_t frame_count)
{
if (check_buffer(repack, frame_count) < 0)
return -1;
int squash = repack->extra_dst_size;
const __m128i *src = (__m128i *)bsrc;
const __m128i *esrc = src + frame_count;
uint32_t *dst = (uint32_t *)repack->packet_buffer;
while (src != esrc) {
__m128i target = _mm_load_si128(src++);
__m128i buf = _mm_shufflelo_epi16(target, _MM_SHUFFLE(2, 3, 1, 0));
_mm_storeu_si128((__m128i *)dst, buf);
dst += 3;
}
return 0;
}
/*
Swap channel between LFE and FC
| FL | FR |LFE | FC | BL | BR |SBL |SBR |
| | x | | | |
| FL | FR | FC |LFE | BL | BR |SBL |SBR |
*/
int repack_8ch_swap23(struct audio_repack *repack,
const uint8_t *bsrc, uint32_t frame_count)
{
if (check_buffer(repack, frame_count) < 0)
return -1;
const __m128i *src = (__m128i *)bsrc;
const __m128i *esrc = src + frame_count;
__m128i *dst = (__m128i *)repack->packet_buffer;
while (src != esrc) {
__m128i target = _mm_load_si128(src++);
__m128i buf = _mm_shufflelo_epi16(target, _MM_SHUFFLE(2, 3, 1, 0));
_mm_store_si128(dst++, buf);
uint16_t *dst = (uint16_t *)repack->packet_buffer;
/* 2.1 audio does not require re-ordering but still needs squashing
* in order to avoid sampling issues.
*/
if (squash == 5) {
while (src != esrc) {
__m128i target = _mm_load_si128(src++);
_mm_storeu_si128((__m128i *)dst, target);
dst += 8 - squash;
}
} else {
while (src != esrc) {
__m128i target = _mm_load_si128(src++);
__m128i buf = _mm_shufflelo_epi16(target, _MM_SHUFFLE(2, 3, 1, 0));
__m128i buf2 = _mm_shufflehi_epi16(buf, _MM_SHUFFLE(1, 0, 3, 2));
_mm_storeu_si128((__m128i *)dst, buf2);
dst += 8 - squash;
}
}
return 0;
@ -81,18 +93,38 @@ int audio_repack_init(struct audio_repack *repack,
return -1;
switch (repack_mode) {
case repack_mode_8to6ch_swap23:
repack->base_src_size = 8 * (16 / 8);
repack->base_dst_size = 6 * (16 / 8);
repack->extra_dst_size = 2;
repack->repack_func = &repack_8to6ch_swap23;
case repack_mode_8to3ch_swap23:
repack->base_src_size = 8 * (16 / 8);
repack->base_dst_size = 3 * (16 / 8);
repack->extra_dst_size = 5;
repack->repack_func = &repack_squash_swap;
break;
case repack_mode_8to4ch_swap23:
repack->base_src_size = 8 * (16 / 8);
repack->base_dst_size = 4 * (16 / 8);
repack->extra_dst_size = 4;
repack->repack_func = &repack_squash_swap;
break;
case repack_mode_8ch_swap23:
repack->base_src_size = 8 * (16 / 8);
repack->base_dst_size = 8 * (16 / 8);
case repack_mode_8to5ch_swap23:
repack->base_src_size = 8 * (16 / 8);
repack->base_dst_size = 5 * (16 / 8);
repack->extra_dst_size = 3;
repack->repack_func = &repack_squash_swap;
break;
case repack_mode_8to6ch_swap23:
repack->base_src_size = 8 * (16 / 8);
repack->base_dst_size = 6 * (16 / 8);
repack->extra_dst_size = 2;
repack->repack_func = &repack_squash_swap;
break;
case repack_mode_8ch_swap23_swap46_swap57:
repack->base_src_size = 8 * (16 / 8);
repack->base_dst_size = 8 * (16 / 8);
repack->extra_dst_size = 0;
repack->repack_func = &repack_8ch_swap23;
repack->repack_func = &repack_squash_swap;
break;
default: return -1;

View file

@ -26,8 +26,11 @@ struct audio_repack {
};
enum _audio_repack_mode {
repack_mode_8to3ch_swap23,
repack_mode_8to4ch_swap23,
repack_mode_8to5ch_swap23,
repack_mode_8to6ch_swap23,
repack_mode_8ch_swap23,
repack_mode_8ch_swap23_swap46_swap57,
};
typedef enum _audio_repack_mode audio_repack_mode_t;

View file

@ -3,10 +3,18 @@ Device="Dispositiu"
Mode="Mode"
Buffering="Usa memòria intermèdia"
PixelFormat="Format de píxel"
ColorSpace="Espai de color YUV"
ColorSpace.Default="Per defecte"
ColorRange="Gamma de color YUV"
ColorRange.Default="Per defecte"
ColorRange.Partial="Parcial"
ColorRange.Full="Complet"
ChannelFormat="Canal"
ChannelFormat.None="Cap"
ChannelFormat.2_0ch="Estèreo "
ChannelFormat.5_1ch="5.1"
ChannelFormat.5_1chBack="5.1 (posterior)"
ChannelFormat.7_1ch="7.1"
ChannelFormat.2_1ch="Canals 2.1"
ChannelFormat.4_0ch="4"
ChannelFormat.4_1ch="4.1"
ChannelFormat.5_1ch="Canals 5.1"
ChannelFormat.7_1ch="Canals 7.1"

View file

@ -3,10 +3,18 @@ Device="Zařízení"
Mode="Mód"
Buffering="Použít vyrovnávací paměť"
PixelFormat="Formát pixelů"
ColorSpace="Prostor barev YUV"
ColorSpace.Default="Výchozí"
ColorRange="Rozsah barev YUV"
ColorRange.Default="Výchozí"
ColorRange.Partial="Částečný"
ColorRange.Full="Plný"
ChannelFormat="Kanály"
ChannelFormat.None="Žádný"
ChannelFormat.2_0ch="Stereo"
ChannelFormat.5_1ch="5.1"
ChannelFormat.5_1chBack="5.1 (zadní)"
ChannelFormat.7_1ch="7.1"
ChannelFormat.2_1ch="2.1ch"
ChannelFormat.4_0ch="4ch"
ChannelFormat.4_1ch="4.1ch"
ChannelFormat.5_1ch="5.1ch"
ChannelFormat.7_1ch="7.1ch"

View file

@ -2,11 +2,19 @@ BlackmagicDevice="Blackmagic-enhed"
Device="Enhed"
Mode="Tilstand"
Buffering="Brug buffering"
PixelFormat="Pixel format"
PixelFormat="Pixelformat"
ColorSpace="YUV farverum"
ColorSpace.Default="Standard"
ColorRange="YUV-farveområde"
ColorRange.Default="Standard"
ColorRange.Partial="Delvis"
ColorRange.Full="Fuld"
ChannelFormat="Kanal"
ChannelFormat.None="Intet"
ChannelFormat.2_0ch="2kan"
ChannelFormat.5_1ch="5.1kan"
ChannelFormat.5_1chBack="5.1kan (bag)"
ChannelFormat.7_1ch="7.1kan"
ChannelFormat.2_1ch="2.1 kasnals"
ChannelFormat.4_0ch="4 kanals"
ChannelFormat.4_1ch="4.1 kanals"
ChannelFormat.5_1ch="5.1 kanals"
ChannelFormat.7_1ch="7.1 kanals"

View file

@ -3,10 +3,18 @@ Device="Gerät"
Mode="Modus"
Buffering="Buffering benutzen"
PixelFormat="Pixelformat"
ColorSpace="YUV-Farbmatrix"
ColorSpace.Default="Standard"
ColorRange="YUV-Farbbereich"
ColorRange.Default="Standard"
ColorRange.Partial="Begrenzt"
ColorRange.Full="Voll"
ChannelFormat="Kanal"
ChannelFormat.None="Keins"
ChannelFormat.2_0ch="2 Kanal"
ChannelFormat.2_1ch="2.1 Kanal"
ChannelFormat.4_0ch="4 Kanal"
ChannelFormat.4_1ch="4.1 Kanal"
ChannelFormat.5_1ch="5.1 Kanal"
ChannelFormat.5_1chBack="5.1 Kanal (hinten)"
ChannelFormat.7_1ch="7.1 Kanal"

View file

@ -3,4 +3,13 @@ Device="Συσκευή"
Mode="Λειτουργία"
Buffering="Χρήση ενδιάμεσης μνήμης"
PixelFormat="Μορφή pixel"
ColorSpace="Χώρος Χρωμάτων YUV"
ColorSpace.Default="Προεπιλογή"
ColorRange="Έκταση Χρωμάτων YUV"
ColorRange.Default="Προεπιλογή"
ColorRange.Partial="Μερική"
ColorRange.Full="Πλήρης"
ChannelFormat="Κανάλι"
ChannelFormat.None="Κανένα"
ChannelFormat.2_0ch="2 Καναλιών"

View file

@ -3,9 +3,17 @@ Device="Device"
Mode="Mode"
Buffering="Use Buffering"
PixelFormat="Pixel Format"
ColorSpace="YUV Color Space"
ColorSpace.Default="Default"
ColorRange="YUV Color Range"
ColorRange.Default="Default"
ColorRange.Partial="Partial"
ColorRange.Full="Full"
ChannelFormat="Channel"
ChannelFormat.None="None"
ChannelFormat.2_0ch="2ch"
ChannelFormat.2_1ch="2.1ch"
ChannelFormat.4_0ch="4ch"
ChannelFormat.4_1ch="4.1ch"
ChannelFormat.5_1ch="5.1ch"
ChannelFormat.5_1chBack="5.1ch (Back)"
ChannelFormat.7_1ch="7.1ch"

View file

@ -3,10 +3,18 @@ Device="Dispositivo"
Mode="Modo"
Buffering="Utilizar el almacenamiento en búfer"
PixelFormat="Formato de píxel"
ColorSpace="Espacio de color YUV"
ColorSpace.Default="Predeterminado"
ColorRange="Rango de color YUV"
ColorRange.Default="Predeterminado"
ColorRange.Partial="Parcial"
ColorRange.Full="Completo"
ChannelFormat="Canal"
ChannelFormat.None="Ninguno"
ChannelFormat.2_0ch="Estéreo "
ChannelFormat.5_1ch="5.1"
ChannelFormat.5_1chBack="5.1 (posterior)"
ChannelFormat.7_1ch="7.1"
ChannelFormat.2_1ch="2.1 canales"
ChannelFormat.4_0ch="4 canales"
ChannelFormat.4_1ch="4.1 canales"
ChannelFormat.5_1ch="5.1 canales"
ChannelFormat.7_1ch="7.1 canales"

View file

@ -3,10 +3,18 @@ Device="Gailua"
Mode="Modua"
Buffering="Erabili Bufferreratzea"
PixelFormat="Pixel formatua"
ColorSpace="YUV kolore espazioa"
ColorSpace.Default="Lehenetsia"
ColorRange="YUV kolore tartea"
ColorRange.Default="Lehenetsia"
ColorRange.Partial="Partziala"
ColorRange.Full="Osoa"
ChannelFormat="Kanala"
ChannelFormat.None="Ezer ez"
ChannelFormat.2_0ch="2k"
ChannelFormat.5_1ch="5.1k"
ChannelFormat.5_1chBack="5.1k (Atzera)"
ChannelFormat.7_1ch="7.1k"
ChannelFormat.2_1ch="2.1 kanala"
ChannelFormat.4_0ch="4kanala"
ChannelFormat.4_1ch="4.1kanala"
ChannelFormat.5_1ch="5.1 kanala"
ChannelFormat.7_1ch="7.1 kanala"

View file

@ -3,10 +3,18 @@ Device="Laite"
Mode="Tila"
Buffering="Käytä puskurointia"
PixelFormat="Pikselimuoto"
ColorSpace="YUV väriavaruus"
ColorSpace.Default="Oletusarvo"
ColorRange="YUV värialue"
ColorRange.Default="Oletusarvo"
ColorRange.Partial="Osittainen"
ColorRange.Full="Täysi"
ChannelFormat="Kanava"
ChannelFormat.None="Ei mitään"
ChannelFormat.2_0ch="2ch"
ChannelFormat.2_1ch="2.1ch"
ChannelFormat.4_0ch="4ch"
ChannelFormat.4_1ch="4.1ch"
ChannelFormat.5_1ch="5.1ch"
ChannelFormat.5_1chBack="5.1ch (Taka)"
ChannelFormat.7_1ch="7.1ch"

View file

@ -3,10 +3,18 @@ Device="Périphérique"
Mode="Mode"
Buffering="Utiliser la mise en mémoire tampon"
PixelFormat="Format de pixel"
ColorSpace="Espace de couleurs YUV"
ColorSpace.Default="Défaut"
ColorRange="Gamme de couleurs YUV"
ColorRange.Default="Défaut"
ColorRange.Partial="Partiel"
ColorRange.Full="Complète"
ChannelFormat="Canaux audio"
ChannelFormat.None="Aucun"
ChannelFormat.2_0ch="canal 2"
ChannelFormat.5_1ch="canal 5.1"
ChannelFormat.5_1chBack="canal (arrière) 5.1"
ChannelFormat.7_1ch="canal 7.1"
ChannelFormat.2_0ch="2 canaux"
ChannelFormat.2_1ch="2.1 canaux"
ChannelFormat.4_0ch="4 canaux"
ChannelFormat.4_1ch="4.1 canaux"
ChannelFormat.5_1ch="5.1 canaux"
ChannelFormat.7_1ch="7.1 canaux"

View file

@ -3,10 +3,18 @@ Device="Eszköz"
Mode="Mód"
Buffering="Pufferelés használata"
PixelFormat="Képpont formátum"
ColorSpace="YUV színtér"
ColorSpace.Default="Alapértelmezett"
ColorRange="YUV színtartomány"
ColorRange.Default="Alapértelmezett"
ColorRange.Partial="Részleges"
ColorRange.Full="Teljes"
ChannelFormat="Csatorna"
ChannelFormat.None="Nincs"
ChannelFormat.2_0ch="2cs"
ChannelFormat.2_1ch="2.1cs"
ChannelFormat.4_0ch="4cs"
ChannelFormat.4_1ch="4.1cs"
ChannelFormat.5_1ch="5.1cs"
ChannelFormat.5_1chBack="5.1cs (Hátsó)"
ChannelFormat.7_1ch="7.1cs"

View file

@ -1,12 +1,20 @@
BlackmagicDevice="Blackmagic Device"
BlackmagicDevice="Dispositivo Blackmagic"
Device="Dispositivo"
Mode="Modalità"
Buffering="Usa buffer"
PixelFormat="Formato pixel"
ColorSpace="Spazio colore YUV"
ColorSpace.Default="Predefinito"
ColorRange="Gamma di colore YUV"
ColorRange.Default="Predefinito"
ColorRange.Partial="Parziale"
ColorRange.Full="Intero"
ChannelFormat="Canale"
ChannelFormat.None="Nessuno"
ChannelFormat.2_0ch="2 canali"
ChannelFormat.2_1ch="2.1 canali"
ChannelFormat.4_0ch="4 canali"
ChannelFormat.4_1ch="4.1 canali"
ChannelFormat.5_1ch="5.1 canali"
ChannelFormat.5_1chBack="5.1 canali (retro)"
ChannelFormat.7_1ch="7.1 canali"

View file

@ -3,10 +3,18 @@ Device="デバイス"
Mode="モード"
Buffering="バッファリングを使用する"
PixelFormat="ピクセルフォーマット"
ColorSpace="YUV 色空間"
ColorSpace.Default="既定"
ColorRange="YUV 色範囲"
ColorRange.Default="既定"
ColorRange.Partial="一部"
ColorRange.Full="全部"
ChannelFormat="チャンネル"
ChannelFormat.None="未設定"
ChannelFormat.2_0ch="2ch"
ChannelFormat.2_1ch="2.1ch"
ChannelFormat.4_0ch="4 ch"
ChannelFormat.4_1ch="4.1ch"
ChannelFormat.5_1ch="5.1ch"
ChannelFormat.5_1chBack="5.1ch (背部)"
ChannelFormat.7_1ch="7.1ch"

View file

@ -3,10 +3,18 @@ Device="장치"
Mode="방식"
Buffering="버퍼링 사용"
PixelFormat="픽셀 형식"
ColorSpace="YUV 색 공간"
ColorSpace.Default="기본값"
ColorRange="YUV 색상 범위"
ColorRange.Default="기본값"
ColorRange.Partial="부분"
ColorRange.Full="전체"
ChannelFormat="채널"
ChannelFormat.None="없음"
ChannelFormat.2_0ch="2채널"
ChannelFormat.5_1ch="5.1채널"
ChannelFormat.5_1chBack="5.1채널 (후면)"
ChannelFormat.7_1ch="7.1채널"
ChannelFormat.2_1ch="2.1 채널"
ChannelFormat.4_0ch="4채널"
ChannelFormat.4_1ch="4.1채널"
ChannelFormat.5_1ch="5.1 채널"
ChannelFormat.7_1ch="7.1 채널"

View file

@ -3,4 +3,18 @@ Device="Enhet"
Mode="Modus"
Buffering="Bruk bufring"
PixelFormat="Pikselformat"
ColorSpace="YUV fargerom"
ColorSpace.Default="Standard"
ColorRange="YUV fargerom"
ColorRange.Default="Standard"
ColorRange.Partial="Delvis"
ColorRange.Full="Hel"
ChannelFormat="Kanal"
ChannelFormat.None="Ingen"
ChannelFormat.2_0ch="2ch"
ChannelFormat.2_1ch="2.1ch"
ChannelFormat.4_0ch="4ch"
ChannelFormat.4_1ch="4.1ch"
ChannelFormat.5_1ch="5.1ch"
ChannelFormat.7_1ch="7.1ch"

View file

@ -3,10 +3,18 @@ Device="Apparaat"
Mode="Modus"
Buffering="Buffering Gebruiken"
PixelFormat="Pixelindeling"
ColorSpace="YUV-Kleurruimte"
ColorSpace.Default="Standaard"
ColorRange="YUV Kleurbereik"
ColorRange.Default="Standaard"
ColorRange.Partial="Gedeeltelijk"
ColorRange.Full="Volledig"
ChannelFormat="Kanaal"
ChannelFormat.None="Geen"
ChannelFormat.2_0ch="2ch"
ChannelFormat.2_1ch="2.1ch"
ChannelFormat.4_0ch="4ch"
ChannelFormat.4_1ch="4.1ch"
ChannelFormat.5_1ch="5.1ch"
ChannelFormat.5_1chBack="5.1ch (Achter)"
ChannelFormat.7_1ch="7.1ch"

View file

@ -3,10 +3,18 @@ Device="Urządzenie"
Mode="Tryb"
Buffering="Użyj buforowania"
PixelFormat="Format pikseli"
ColorSpace="Przestrzeń kolorów YUV"
ColorSpace.Default="Domyślne"
ColorRange="Zakres kolorów YUV"
ColorRange.Default="Domyślne"
ColorRange.Partial="Częściowy"
ColorRange.Full="Pełny"
ChannelFormat="Kanały"
ChannelFormat.None="Brak"
ChannelFormat.2_0ch="2.0"
ChannelFormat.2_1ch="2.1"
ChannelFormat.4_0ch="4.0"
ChannelFormat.4_1ch="4.1"
ChannelFormat.5_1ch="5.1"
ChannelFormat.5_1chBack="5.1 (tylne)"
ChannelFormat.7_1ch="7.1"

View file

@ -3,10 +3,18 @@ Device="Dispositivo"
Mode="Modo"
Buffering="Utilizar Buffering"
PixelFormat="Formato de Pixel"
ColorSpace="Espaço de cor YUV"
ColorSpace.Default="Padrão"
ColorRange="Intervalo de Cores YUV"
ColorRange.Default="Padrão"
ColorRange.Partial="Parcial"
ColorRange.Full="Completo"
ChannelFormat="Canal"
ChannelFormat.None="Nenhum"
ChannelFormat.2_0ch="2.0"
ChannelFormat.2_1ch="2.1"
ChannelFormat.4_0ch="4.0"
ChannelFormat.4_1ch="4.1"
ChannelFormat.5_1ch="5.1"
ChannelFormat.5_1chBack="5.1 (Traseiro)"
ChannelFormat.7_1ch="7.1"

View file

@ -3,4 +3,7 @@ Device="Dispositivo"
Mode="Modo"
Buffering="Utilizar Buffering"
PixelFormat="Formato de pixel"
ColorRange.Partial="Parcial"
ChannelFormat="Canal"
ChannelFormat.None="Nenhum"

View file

@ -3,10 +3,18 @@ Device="Устройство"
Mode="Режим"
Buffering="Использовать буферизацию"
PixelFormat="Формат пикселей"
ColorSpace="Цветовое пространство YUV"
ColorSpace.Default="По умолчанию"
ColorRange="Цветовой диапазон YUV"
ColorRange.Default="По умолчанию"
ColorRange.Partial="Частичный"
ColorRange.Full="Полный"
ChannelFormat="Конфигурация каналов"
ChannelFormat.None="Нет"
ChannelFormat.2_0ch="2-канальный"
ChannelFormat.2_1ch="2.1-канальный"
ChannelFormat.4_0ch="4-канальный"
ChannelFormat.4_1ch="4.1-канальный"
ChannelFormat.5_1ch="5.1-канальный"
ChannelFormat.5_1chBack="5.1-канальный (Тыловой)"
ChannelFormat.7_1ch="7.1-канальный"

View file

@ -1,4 +1,17 @@
BlackmagicDevice="Blackmagic zariadenie"
Device="Zariadenie"
Mode="Mód"
Buffering="Použiť vyrovnávaciu pamäť"
PixelFormat="Formát pixelov"
ColorSpace="Farebný priestor YUV"
ColorSpace.Default="Predvolený"
ColorRange="Rozsah farieb YUV"
ColorRange.Default="Predvolený"
ColorRange.Partial="Čiastočný"
ColorRange.Full="Plný"
ChannelFormat="Kanál"
ChannelFormat.None="Nič"
ChannelFormat.2_0ch="2ch"
ChannelFormat.4_0ch="4ch"
ChannelFormat.4_1ch="4.1ch"

View file

@ -3,10 +3,18 @@ Device="Enhet"
Mode="Läge"
Buffering="Använd buffert"
PixelFormat="Bildpunktsformat"
ColorSpace="YUV-färgrymd"
ColorSpace.Default="Standard"
ColorRange="YUV-färgområde"
ColorRange.Default="Standard"
ColorRange.Partial="Partiell"
ColorRange.Full="Full"
ChannelFormat="Kanal"
ChannelFormat.None="Ingen"
ChannelFormat.2_0ch="2ch"
ChannelFormat.5_1ch="5.1ch"
ChannelFormat.5_1chBack="5.1ch (bakom)"
ChannelFormat.7_1ch="7.1ch"
ChannelFormat.2_1ch="2.1 kanaler"
ChannelFormat.4_0ch="4 kanaler"
ChannelFormat.4_1ch="4.1 kanaler"
ChannelFormat.5_1ch="5.1 kanaler"
ChannelFormat.7_1ch="7.1 kanaler"

View file

@ -1,12 +1,20 @@
BlackmagicDevice="Blackmagic Aygıtı"
Device="Aygıt"
Mode="Mod"
Buffering="Arabelleği Kullan"
Buffering="Arabelleğe Almayı Kullan"
PixelFormat="Piksel Biçimi"
ColorSpace="YUV Renk Alanı"
ColorSpace.Default="Varsayılan"
ColorRange="YUV Renk Aralığı"
ColorRange.Default="Varsayılan"
ColorRange.Partial="Kısmi"
ColorRange.Full="Tam"
ChannelFormat="Kanal"
ChannelFormat.None="Hiçbiri"
ChannelFormat.2_0ch="2ch"
ChannelFormat.2_1ch="2.1ch"
ChannelFormat.4_0ch="4ch"
ChannelFormat.4_1ch="4.1ch"
ChannelFormat.5_1ch="5.1ch"
ChannelFormat.5_1chBack="5.1ch (Arka)"
ChannelFormat.7_1ch="7.1ch"

View file

@ -3,10 +3,18 @@ Device="Пристрій"
Mode="Режим"
Buffering="Увімкнути буферизацію"
PixelFormat="Формат пікселів"
ColorSpace="Колірний простір YUV"
ColorSpace.Default="За замовчуванням"
ColorRange="Колірний діапазон YUV"
ColorRange.Default="За замовчуванням"
ColorRange.Partial="Частковий"
ColorRange.Full="Повний"
ChannelFormat="Звук (канали)"
ChannelFormat.None="Немає"
ChannelFormat.2_0ch="2-канальний"
ChannelFormat.2_1ch="2.1-канальний"
ChannelFormat.4_0ch="4-канальний"
ChannelFormat.4_1ch="4.1-канальний"
ChannelFormat.5_1ch="5.1-канальний"
ChannelFormat.5_1chBack="5.1-канальний (Back)"
ChannelFormat.7_1ch="7.1-канальний"

View file

@ -0,0 +1,9 @@
Mode="Chế độ"
ColorSpace.Default="Mặc định"
ColorRange.Default="Mặc định"
ColorRange.Partial="Một phần"
ColorRange.Full="Đầy đủ"
ChannelFormat="Kênh"
ChannelFormat.None="Không có"
ChannelFormat.2_0ch="2ch"

View file

@ -3,10 +3,18 @@ Device="设备"
Mode="模式"
Buffering="使用缓冲"
PixelFormat="像素格式"
ColorSpace="YUV 颜色空间"
ColorSpace.Default="默认"
ColorRange="YUV 颜色范围"
ColorRange.Default="默认"
ColorRange.Partial="局部"
ColorRange.Full="全部"
ChannelFormat="频道"
ChannelFormat.None="无"
ChannelFormat.2_0ch="2ch"
ChannelFormat.2_1ch="2.1ch"
ChannelFormat.4_0ch="4ch"
ChannelFormat.4_1ch="4.1ch"
ChannelFormat.5_1ch="5.1ch"
ChannelFormat.5_1chBack="5.1ch (后)"
ChannelFormat.7_1ch="7.1ch"

View file

@ -3,10 +3,18 @@ Device="裝置"
Mode="模式"
Buffering="使用緩衝"
PixelFormat="像素格式"
ColorSpace="YUV 色彩空間"
ColorSpace.Default="預設"
ColorRange="YUV 色彩範圍"
ColorRange.Default="預設"
ColorRange.Partial="部分"
ColorRange.Full="完整"
ChannelFormat="聲道"
ChannelFormat.None="無"
ChannelFormat.2_0ch="雙聲道"
ChannelFormat.2_1ch="2.1聲道"
ChannelFormat.4_0ch="4聲道"
ChannelFormat.4_1ch="4.1聲道"
ChannelFormat.5_1ch="5.1聲道"
ChannelFormat.5_1chBack="5.1聲道(後置環繞喇叭)"
ChannelFormat.7_1ch="7.1聲道"

View file

@ -9,7 +9,11 @@
#define LOG(level, message, ...) blog(level, "%s: " message, \
obs_source_get_name(this->decklink->GetSource()), ##__VA_ARGS__)
#define ISSTEREO(flag) ((flag) == SPEAKERS_STEREO)
#ifdef _WIN32
#define IS_WIN 1
#else
#define IS_WIN 0
#endif
static inline enum video_format ConvertPixelFormat(BMDPixelFormat format)
{
@ -26,8 +30,10 @@ static inline enum video_format ConvertPixelFormat(BMDPixelFormat format)
static inline int ConvertChannelFormat(speaker_layout format)
{
switch (format) {
case SPEAKERS_2POINT1:
case SPEAKERS_4POINT0:
case SPEAKERS_4POINT1:
case SPEAKERS_5POINT1:
case SPEAKERS_5POINT1_SURROUND:
case SPEAKERS_7POINT1:
return 8;
@ -40,13 +46,16 @@ static inline int ConvertChannelFormat(speaker_layout format)
static inline audio_repack_mode_t ConvertRepackFormat(speaker_layout format)
{
switch (format) {
case SPEAKERS_2POINT1:
return repack_mode_8to3ch_swap23;
case SPEAKERS_4POINT0:
return repack_mode_8to4ch_swap23;
case SPEAKERS_4POINT1:
return repack_mode_8to5ch_swap23;
case SPEAKERS_5POINT1:
case SPEAKERS_5POINT1_SURROUND:
return repack_mode_8to6ch_swap23;
case SPEAKERS_7POINT1:
return repack_mode_8ch_swap23;
return repack_mode_8ch_swap23_swap46_swap57;
default:
assert(false && "No repack requested");
return (audio_repack_mode_t)-1;
@ -83,15 +92,29 @@ void DeckLinkDeviceInstance::HandleAudioPacket(
currentPacket.frames = frameCount;
currentPacket.timestamp = timestamp;
if (!ISSTEREO(channelFormat)) {
if (decklink && !decklink->buffering) {
currentPacket.timestamp = os_gettime_ns();
currentPacket.timestamp -=
(uint64_t)frameCount * 1000000000ULL /
(uint64_t)currentPacket.samples_per_sec;
}
int maxdevicechannel = device->GetMaxChannel();
bool isWin = IS_WIN;
if (channelFormat != SPEAKERS_UNKNOWN &&
channelFormat != SPEAKERS_MONO &&
channelFormat != SPEAKERS_STEREO &&
maxdevicechannel >= 8 &&
isWin) {
if (audioRepacker->repack((uint8_t *)bytes, frameCount) < 0) {
LOG(LOG_ERROR, "Failed to convert audio packet data");
return;
}
currentPacket.data[0] = (*audioRepacker)->packet_buffer;
currentPacket.data[0] = (*audioRepacker)->packet_buffer;
} else {
currentPacket.data[0] = (uint8_t *)bytes;
currentPacket.data[0] = (uint8_t *)bytes;
}
nextAudioTS = timestamp +
@ -118,16 +141,15 @@ void DeckLinkDeviceInstance::HandleVideoFrame(
currentFrame.height = (uint32_t)videoFrame->GetHeight();
currentFrame.timestamp = timestamp;
video_format_get_parameters(VIDEO_CS_601, VIDEO_RANGE_PARTIAL,
currentFrame.color_matrix, currentFrame.color_range_min,
currentFrame.color_range_max);
obs_source_output_video(decklink->GetSource(), &currentFrame);
}
void DeckLinkDeviceInstance::FinalizeStream()
{
input->SetCallback(nullptr);
input->DisableVideoInput();
if (channelFormat != SPEAKERS_UNKNOWN)
input->DisableAudioInput();
if (audioRepacker != nullptr)
{
@ -138,6 +160,43 @@ void DeckLinkDeviceInstance::FinalizeStream()
mode = nullptr;
}
//#define LOG_SETUP_VIDEO_FORMAT 1
void DeckLinkDeviceInstance::SetupVideoFormat(DeckLinkDeviceMode *mode_)
{
if (mode_ == nullptr)
return;
currentFrame.format = ConvertPixelFormat(pixelFormat);
colorSpace = decklink->GetColorSpace();
if (colorSpace == VIDEO_CS_DEFAULT) {
const BMDDisplayModeFlags flags = mode_->GetDisplayModeFlags();
if (flags & bmdDisplayModeColorspaceRec709)
activeColorSpace = VIDEO_CS_709;
else if (flags & bmdDisplayModeColorspaceRec601)
activeColorSpace = VIDEO_CS_601;
else
activeColorSpace = VIDEO_CS_DEFAULT;
} else {
activeColorSpace = colorSpace;
}
colorRange = decklink->GetColorRange();
currentFrame.full_range = colorRange == VIDEO_RANGE_FULL;
video_format_get_parameters(activeColorSpace, colorRange,
currentFrame.color_matrix, currentFrame.color_range_min,
currentFrame.color_range_max);
#ifdef LOG_SETUP_VIDEO_FORMAT
LOG(LOG_INFO, "Setup video format: %s, %s, %s",
pixelFormat == bmdFormat8BitYUV ? "YUV" : "RGB",
activeColorSpace == VIDEO_CS_709 ? "BT.709" : "BT.601",
colorRange == VIDEO_RANGE_FULL ? "full" : "limited");
#endif
}
bool DeckLinkDeviceInstance::StartCapture(DeckLinkDeviceMode *mode_)
{
if (mode != nullptr)
@ -150,33 +209,50 @@ bool DeckLinkDeviceInstance::StartCapture(DeckLinkDeviceMode *mode_)
if (!device->GetInput(&input))
return false;
pixelFormat = decklink->GetPixelFormat();
currentFrame.format = ConvertPixelFormat(pixelFormat);
BMDVideoInputFlags flags;
const BMDDisplayMode displayMode = mode_->GetDisplayMode();
bool isauto = mode_->GetName() == "Auto";
if (isauto) {
displayMode = bmdModeNTSC;
pixelFormat = bmdFormat8BitYUV;
flags = bmdVideoInputEnableFormatDetection;
} else {
displayMode = mode_->GetDisplayMode();
pixelFormat = decklink->GetPixelFormat();
flags = bmdVideoInputFlagDefault;
}
const HRESULT videoResult = input->EnableVideoInput(displayMode,
pixelFormat, bmdVideoInputFlagDefault);
pixelFormat, flags);
if (videoResult != S_OK) {
LOG(LOG_ERROR, "Failed to enable video input");
return false;
}
SetupVideoFormat(mode_);
channelFormat = decklink->GetChannelFormat();
currentPacket.speakers = channelFormat;
int maxdevicechannel = device->GetMaxChannel();
bool isWin = IS_WIN;
if (channelFormat != SPEAKERS_UNKNOWN) {
const int channel = ConvertChannelFormat(channelFormat);
const HRESULT audioResult = input->EnableAudioInput(
bmdAudioSampleRate48kHz, bmdAudioSampleType16bitInteger,
channel);
if (audioResult != S_OK)
LOG(LOG_WARNING, "Failed to enable audio input; continuing...");
if (!ISSTEREO(channelFormat)) {
const audio_repack_mode_t repack_mode = ConvertRepackFormat(channelFormat);
if (channelFormat != SPEAKERS_UNKNOWN &&
channelFormat != SPEAKERS_MONO &&
channelFormat != SPEAKERS_STEREO &&
maxdevicechannel >= 8 &&
isWin) {
const audio_repack_mode_t repack_mode = ConvertRepackFormat
(channelFormat);
audioRepacker = new AudioRepacker(repack_mode);
}
}
@ -257,12 +333,41 @@ HRESULT STDMETHODCALLTYPE DeckLinkDeviceInstance::VideoInputFormatChanged(
IDeckLinkDisplayMode *newMode,
BMDDetectedVideoInputFormatFlags detectedSignalFlags)
{
UNUSED_PARAMETER(events);
UNUSED_PARAMETER(newMode);
UNUSED_PARAMETER(detectedSignalFlags);
input->PauseStreams();
// There is no implementation for automatic format detection, so this
// method goes unused.
mode->SetMode(newMode);
if (events & bmdVideoInputDisplayModeChanged) {
displayMode = mode->GetDisplayMode();
}
if (events & bmdVideoInputColorspaceChanged) {
switch (detectedSignalFlags) {
case bmdDetectedVideoInputRGB444:
pixelFormat = bmdFormat8BitBGRA;
break;
default:
case bmdDetectedVideoInputYCbCr422:
pixelFormat = bmdFormat8BitYUV;
break;
}
}
const HRESULT videoResult = input->EnableVideoInput(displayMode,
pixelFormat, bmdVideoInputEnableFormatDetection);
if (videoResult != S_OK) {
LOG(LOG_ERROR, "Failed to enable video input");
input->StopStreams();
FinalizeStream();
return E_FAIL;
}
SetupVideoFormat(mode);
input->FlushStreams();
input->StartStreams();
return S_OK;
}

View file

@ -11,7 +11,11 @@ protected:
DeckLink *decklink = nullptr;
DeckLinkDevice *device = nullptr;
DeckLinkDeviceMode *mode = nullptr;
BMDDisplayMode displayMode = bmdModeNTSC;
BMDPixelFormat pixelFormat = bmdFormat8BitYUV;
video_colorspace colorSpace = VIDEO_CS_DEFAULT;
video_colorspace activeColorSpace = VIDEO_CS_DEFAULT;
video_range_type colorRange = VIDEO_RANGE_DEFAULT;
ComPtr<IDeckLinkInput> input;
volatile long refCount = 1;
int64_t audioOffset = 0;
@ -21,6 +25,7 @@ protected:
speaker_layout channelFormat = SPEAKERS_STEREO;
void FinalizeStream();
void SetupVideoFormat(DeckLinkDeviceMode *mode_);
void HandleAudioPacket(IDeckLinkAudioInputPacket *audioPacket,
const uint64_t timestamp);
@ -38,6 +43,8 @@ public:
}
inline BMDPixelFormat GetActivePixelFormat() const {return pixelFormat;}
inline video_colorspace GetActiveColorSpace() const {return colorSpace;}
inline video_range_type GetActiveColorRange() const {return colorRange;}
inline speaker_layout GetActiveChannelFormat() const {return channelFormat;}
inline DeckLinkDeviceMode *GetMode() const {return mode;}

View file

@ -32,6 +32,14 @@ BMDDisplayMode DeckLinkDeviceMode::GetDisplayMode(void) const
return bmdModeUnknown;
}
BMDDisplayModeFlags DeckLinkDeviceMode::GetDisplayModeFlags(void) const
{
if (mode != nullptr)
return mode->GetFlags();
return (BMDDisplayModeFlags)0;
}
long long DeckLinkDeviceMode::GetId(void) const
{
return id;
@ -41,3 +49,14 @@ const std::string& DeckLinkDeviceMode::GetName(void) const
{
return name;
}
void DeckLinkDeviceMode::SetMode(IDeckLinkDisplayMode *mode_)
{
IDeckLinkDisplayMode *old = mode;
if (old != nullptr)
old->Release();
mode = mode_;
if (mode != nullptr)
mode->AddRef();
}

View file

@ -4,6 +4,8 @@
#include <string>
#define MODE_ID_AUTO -1
class DeckLinkDeviceMode {
protected:
long long id;
@ -16,6 +18,9 @@ public:
virtual ~DeckLinkDeviceMode(void);
BMDDisplayMode GetDisplayMode(void) const;
BMDDisplayModeFlags GetDisplayModeFlags(void) const;
long long GetId(void) const;
const std::string& GetName(void) const;
void SetMode(IDeckLinkDisplayMode *mode);
};

View file

@ -29,6 +29,21 @@ ULONG DeckLinkDevice::Release()
bool DeckLinkDevice::Init()
{
ComPtr<IDeckLinkAttributes> attributes;
const HRESULT result = device->QueryInterface(IID_IDeckLinkAttributes,
(void **)&attributes);
if (result == S_OK) {
decklink_bool_t detectable = false;
if (attributes->GetFlag(BMDDeckLinkSupportsInputFormatDetection,
&detectable) == S_OK && !!detectable) {
DeckLinkDeviceMode *mode =
new DeckLinkDeviceMode("Auto", MODE_ID_AUTO);
modes.push_back(mode);
modeIdMap[MODE_ID_AUTO] = mode;
}
}
ComPtr<IDeckLinkInput> input;
if (device->QueryInterface(IID_IDeckLinkInput, (void**)&input) != S_OK)
return false;
@ -66,9 +81,6 @@ bool DeckLinkDevice::Init()
hash = displayName;
ComPtr<IDeckLinkAttributes> attributes;
const HRESULT result = device->QueryInterface(IID_IDeckLinkAttributes,
(void **)&attributes);
if (result != S_OK)
return true;

View file

@ -66,6 +66,8 @@ bool DeckLink::Activate(DeckLinkDevice *device, long long modeId)
return false;
if (instance->GetActiveModeId() == modeId &&
instance->GetActivePixelFormat() == pixelFormat &&
instance->GetActiveColorSpace() == colorSpace &&
instance->GetActiveColorRange() == colorRange &&
instance->GetActiveChannelFormat() == channelFormat)
return false;
}

View file

@ -22,6 +22,8 @@ protected:
volatile long activateRefs = 0;
std::recursive_mutex deviceMutex;
BMDPixelFormat pixelFormat = bmdFormat8BitYUV;
video_colorspace colorSpace = VIDEO_CS_DEFAULT;
video_range_type colorRange = VIDEO_RANGE_DEFAULT;
speaker_layout channelFormat = SPEAKERS_STEREO;
void SaveSettings();
@ -42,6 +44,16 @@ public:
{
pixelFormat = format;
}
inline video_colorspace GetColorSpace() const {return colorSpace;}
inline void SetColorSpace(video_colorspace format)
{
colorSpace = format;
}
inline video_range_type GetColorRange() const {return colorRange;}
inline void SetColorRange(video_range_type format)
{
colorRange = format;
}
inline speaker_layout GetChannelFormat() const {return channelFormat;}
inline void SetChannelFormat(speaker_layout format)
{
@ -50,4 +62,6 @@ public:
bool Activate(DeckLinkDevice *device, long long modeId);
void Deactivate();
bool buffering = false;
};

View file

@ -2,6 +2,7 @@
#if defined(_WIN32)
#include <DeckLinkAPI.h>
typedef BOOL decklink_bool_t;
typedef BSTR decklink_string_t;
IDeckLinkDiscovery *CreateDeckLinkDiscoveryInstance(void);
#define IUnknownUUID IID_IUnknown
@ -10,9 +11,11 @@ typedef REFIID CFUUIDBytes;
#elif defined(__APPLE__)
#include "mac/decklink-sdk/DeckLinkAPI.h"
#include <CoreFoundation/CoreFoundation.h>
typedef bool decklink_bool_t;
typedef CFStringRef decklink_string_t;
#elif defined(__linux__)
#include "linux/decklink-sdk/DeckLinkAPI.h"
typedef bool decklink_bool_t;
typedef const char *decklink_string_t;
#endif

View file

@ -13,16 +13,26 @@ OBS_MODULE_USE_DEFAULT_LOCALE("decklink", "en-US")
#define MODE_NAME "mode_name"
#define CHANNEL_FORMAT "channel_format"
#define PIXEL_FORMAT "pixel_format"
#define COLOR_SPACE "color_space"
#define COLOR_RANGE "color_range"
#define BUFFERING "buffering"
#define TEXT_DEVICE obs_module_text("Device")
#define TEXT_MODE obs_module_text("Mode")
#define TEXT_PIXEL_FORMAT obs_module_text("PixelFormat")
#define TEXT_COLOR_SPACE obs_module_text("ColorSpace")
#define TEXT_COLOR_SPACE_DEFAULT obs_module_text("ColorSpace.Default")
#define TEXT_COLOR_RANGE obs_module_text("ColorRange")
#define TEXT_COLOR_RANGE_DEFAULT obs_module_text("ColorRange.Default")
#define TEXT_COLOR_RANGE_PARTIAL obs_module_text("ColorRange.Partial")
#define TEXT_COLOR_RANGE_FULL obs_module_text("ColorRange.Full")
#define TEXT_CHANNEL_FORMAT obs_module_text("ChannelFormat")
#define TEXT_CHANNEL_FORMAT_NONE obs_module_text("ChannelFormat.None")
#define TEXT_CHANNEL_FORMAT_2_0CH obs_module_text("ChannelFormat.2_0ch")
#define TEXT_CHANNEL_FORMAT_2_1CH obs_module_text("ChannelFormat.2_1ch")
#define TEXT_CHANNEL_FORMAT_4_0CH obs_module_text("ChannelFormat.4_0ch")
#define TEXT_CHANNEL_FORMAT_4_1CH obs_module_text("ChannelFormat.4_1ch")
#define TEXT_CHANNEL_FORMAT_5_1CH obs_module_text("ChannelFormat.5_1ch")
#define TEXT_CHANNEL_FORMAT_5_1CH_BACK obs_module_text("ChannelFormat.5_1chBack")
#define TEXT_CHANNEL_FORMAT_7_1CH obs_module_text("ChannelFormat.7_1ch")
#define TEXT_BUFFERING obs_module_text("Buffering")
@ -32,12 +42,14 @@ static void decklink_enable_buffering(DeckLink *decklink, bool enabled)
{
obs_source_t *source = decklink->GetSource();
obs_source_set_async_unbuffered(source, !enabled);
decklink->buffering = enabled;
}
static void *decklink_create(obs_data_t *settings, obs_source_t *source)
{
DeckLink *decklink = new DeckLink(source, deviceEnum);
obs_source_set_async_decoupled(source, true);
decklink_enable_buffering(decklink,
obs_data_get_bool(settings, BUFFERING));
@ -58,8 +70,19 @@ static void decklink_update(void *data, obs_data_t *settings)
long long id = obs_data_get_int(settings, MODE_ID);
BMDPixelFormat pixelFormat = (BMDPixelFormat)obs_data_get_int(settings,
PIXEL_FORMAT);
speaker_layout channelFormat = (speaker_layout)obs_data_get_int(settings,
CHANNEL_FORMAT);
video_colorspace colorSpace = (video_colorspace)obs_data_get_int(settings,
COLOR_SPACE);
video_range_type colorRange = (video_range_type)obs_data_get_int(settings,
COLOR_RANGE);
int chFmtInt = (int)obs_data_get_int(settings, CHANNEL_FORMAT);
if (chFmtInt == 7) {
chFmtInt = SPEAKERS_5POINT1;
} else if (chFmtInt < SPEAKERS_UNKNOWN || chFmtInt > SPEAKERS_7POINT1) {
chFmtInt = 2;
}
speaker_layout channelFormat = (speaker_layout)chFmtInt;
decklink_enable_buffering(decklink,
obs_data_get_bool(settings, BUFFERING));
@ -68,14 +91,18 @@ static void decklink_update(void *data, obs_data_t *settings)
device.Set(deviceEnum->FindByHash(hash));
decklink->SetPixelFormat(pixelFormat);
decklink->SetColorSpace(colorSpace);
decklink->SetColorRange(colorRange);
decklink->SetChannelFormat(channelFormat);
decklink->Activate(device, id);
}
static void decklink_get_defaults(obs_data_t *settings)
{
obs_data_set_default_bool(settings, BUFFERING, true);
obs_data_set_default_bool(settings, BUFFERING, false);
obs_data_set_default_int(settings, PIXEL_FORMAT, bmdFormat8BitYUV);
obs_data_set_default_int(settings, COLOR_SPACE, VIDEO_CS_DEFAULT);
obs_data_set_default_int(settings, COLOR_RANGE, VIDEO_RANGE_DEFAULT);
obs_data_set_default_int(settings, CHANNEL_FORMAT, SPEAKERS_STEREO);
}
@ -136,10 +163,14 @@ static bool decklink_device_changed(obs_properties_t *props,
}
if (device->GetMaxChannel() >= 8) {
obs_property_list_add_int(channelList, TEXT_CHANNEL_FORMAT_2_1CH,
SPEAKERS_2POINT1);
obs_property_list_add_int(channelList, TEXT_CHANNEL_FORMAT_4_0CH,
SPEAKERS_4POINT0);
obs_property_list_add_int(channelList, TEXT_CHANNEL_FORMAT_4_1CH,
SPEAKERS_4POINT1);
obs_property_list_add_int(channelList, TEXT_CHANNEL_FORMAT_5_1CH,
SPEAKERS_5POINT1);
obs_property_list_add_int(channelList, TEXT_CHANNEL_FORMAT_5_1CH_BACK,
SPEAKERS_5POINT1_SURROUND);
obs_property_list_add_int(channelList, TEXT_CHANNEL_FORMAT_7_1CH,
SPEAKERS_7POINT1);
}
@ -162,6 +193,38 @@ static void fill_out_devices(obs_property_t *list)
deviceEnum->Unlock();
}
static bool color_format_changed(obs_properties_t *props,
obs_property_t *list, obs_data_t *settings);
static bool mode_id_changed(obs_properties_t *props,
obs_property_t *list, obs_data_t *settings)
{
long long id = obs_data_get_int(settings, MODE_ID);
list = obs_properties_get(props, PIXEL_FORMAT);
obs_property_set_visible(list, id != MODE_ID_AUTO);
return color_format_changed(props, nullptr, settings);
}
static bool color_format_changed(obs_properties_t *props,
obs_property_t *list, obs_data_t *settings)
{
long long id = obs_data_get_int(settings, MODE_ID);
BMDPixelFormat pixelFormat = (BMDPixelFormat)obs_data_get_int(settings,
PIXEL_FORMAT);
list = obs_properties_get(props, COLOR_SPACE);
obs_property_set_visible(list,
id != MODE_ID_AUTO && pixelFormat == bmdFormat8BitYUV);
list = obs_properties_get(props, COLOR_RANGE);
obs_property_set_visible(list,
id == MODE_ID_AUTO || pixelFormat == bmdFormat8BitYUV);
return true;
}
static obs_properties_t *decklink_get_properties(void *data)
{
obs_properties_t *props = obs_properties_create();
@ -174,13 +237,28 @@ static obs_properties_t *decklink_get_properties(void *data)
list = obs_properties_add_list(props, MODE_ID, TEXT_MODE,
OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT);
obs_property_set_modified_callback(list, mode_id_changed);
list = obs_properties_add_list(props, PIXEL_FORMAT,
TEXT_PIXEL_FORMAT, OBS_COMBO_TYPE_LIST,
OBS_COMBO_FORMAT_INT);
obs_property_set_modified_callback(list, color_format_changed);
obs_property_list_add_int(list, "8-bit YUV", bmdFormat8BitYUV);
obs_property_list_add_int(list, "8-bit BGRA", bmdFormat8BitBGRA);
list = obs_properties_add_list(props, COLOR_SPACE, TEXT_COLOR_SPACE,
OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT);
obs_property_list_add_int(list, TEXT_COLOR_SPACE_DEFAULT, VIDEO_CS_DEFAULT);
obs_property_list_add_int(list, "BT.601", VIDEO_CS_601);
obs_property_list_add_int(list, "BT.709", VIDEO_CS_709);
list = obs_properties_add_list(props, COLOR_RANGE, TEXT_COLOR_RANGE,
OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT);
obs_property_list_add_int(list, TEXT_COLOR_RANGE_DEFAULT, VIDEO_RANGE_DEFAULT);
obs_property_list_add_int(list, TEXT_COLOR_RANGE_PARTIAL, VIDEO_RANGE_PARTIAL);
obs_property_list_add_int(list, TEXT_COLOR_RANGE_FULL, VIDEO_RANGE_FULL);
list = obs_properties_add_list(props, CHANNEL_FORMAT,
TEXT_CHANNEL_FORMAT, OBS_COMBO_TYPE_LIST,
OBS_COMBO_FORMAT_INT);
@ -188,6 +266,16 @@ static obs_properties_t *decklink_get_properties(void *data)
SPEAKERS_UNKNOWN);
obs_property_list_add_int(list, TEXT_CHANNEL_FORMAT_2_0CH,
SPEAKERS_STEREO);
obs_property_list_add_int(list, TEXT_CHANNEL_FORMAT_2_1CH,
SPEAKERS_2POINT1);
obs_property_list_add_int(list, TEXT_CHANNEL_FORMAT_4_0CH,
SPEAKERS_4POINT0);
obs_property_list_add_int(list, TEXT_CHANNEL_FORMAT_4_1CH,
SPEAKERS_4POINT1);
obs_property_list_add_int(list, TEXT_CHANNEL_FORMAT_5_1CH,
SPEAKERS_5POINT1);
obs_property_list_add_int(list, TEXT_CHANNEL_FORMAT_7_1CH,
SPEAKERS_7POINT1);
obs_properties_add_bool(props, BUFFERING, TEXT_BUFFERING);