Skip to content

Instantly share code, notes, and snippets.

@RomiTT
RomiTT / pseudo_code.cpp
Last active July 29, 2023 10:42
Tip for implementing VLC custom callback with DirectX
// VLC prepares to render a video frame.
static void* lock(void* data, void** p_pixels) {
return NULL; // Picture identifier, not needed here.
}
// VLC just rendered a video frame.
static void unlock(void* data, void* id, void* const* p_pixels) {
}
// VLC wants to display a video frame.
@RomiTT
RomiTT / VideoTexture.cpp
Last active August 25, 2019 19:20
Creating a texture for pixel shader and updating the texture in DirectX 11.
//------------------------------------------------
// Creating texture for rendering video
//------------------------------------------------
// ID3D11Device* Device
ID3D11Texture2D* texture = nullptr;
D3D11_TEXTURE2D_DESC td;
RtlZeroMemory(&td, sizeof(D3D11_TEXTURE2D_DESC));
@RomiTT
RomiTT / RGB_DEFAULT.hlsl
Last active January 11, 2024 12:38
YUV to RGB HLSL Shaders - DirectX 11
//-----------------------------------------------------------
// YUV TO RGB BT.601 For SD TV
//-----------------------------------------------------------
cbuffer PS_CONSTANT_BUFFER : register(b0)
{
float Opacity;
float ignoreA;
float ignoreB;
float ignoreC;
libvlc_media_add_option(m, ":avcodec-hw=dxva2");
// Below is the information about option list.
/* Input */
var_Create (mp, "rate", VLC_VAR_FLOAT|VLC_VAR_DOINHERIT);
var_Create (mp, "sout", VLC_VAR_STRING);
var_Create (mp, "demux-filter", VLC_VAR_STRING);
@RomiTT
RomiTT / Example.cpp
Last active July 18, 2019 04:02
For thread-safe function call in native node module.
Napi::Value FGM::test(const Napi::CallbackInfo &info) {
Napi::Env env = info.Env();
auto cb = info[0].As<Napi::Function>();
threadSafeCallback = ThreadSafeFunction::Create(cb);
std::thread t([threadSafeCallback]() => {
// do something