-
Notifications
You must be signed in to change notification settings - Fork 114
Open
Description
I have struggled on this problem for about 1 day. I tried so hard on many ways, like this, but I still cannot make it use RV24 chroma.
@vlc.CallbackDecorators.VideoSetupCb
def setup_cb(opaque, chroma, width, height, pitch, lines):
_ctx = ct.cast(opaque, ct.POINTER(VideoContext)).contents
w = width.contents.value
h = height.contents.value
# Try to negotiate RV24
requested_chroma = b'RV24'
# Check if RV24 is supported by trying to set it
chroma.contents = ct.c_char_p(requested_chroma)
# Configure for RV24
pitch[0] = w * 3 # 3 bytes per pixel for RGB24
lines[0] = h
_ctx.width = w
_ctx.height = h
print(f"Negotiated format: {requested_chroma} {w}x{h}")
return 1When i compare the c api and python api. I noticed that, ctypes.c_char_p is interpreted by python with bytes class. With bytes, I cannot pass my message back to VLC. Thats why it doesn't know what I want.
VideoFormatCb = ctypes.CFUNCTYPE(
ctypes.c_uint,
ctypes.POINTER(ctypes.c_void_p),
ctypes.c_char_p,
ctypes.POINTER(ctypes.c_uint),
ctypes.POINTER(ctypes.c_uint),
ctypes.POINTER(ctypes.c_uint),
ctypes.POINTER(ctypes.c_uint),
)=> I have tried to modify the callback type, but unfortunately, it still not working as expected.
VideoFormatCb = ctypces.CFUNCTYPE(
ctypes.c_uint,
ctypes.POINTER(ctypes.c_void_p),
ctypes.POINTER(ctypes.c_char),
ctypes.POINTER(ctypes.c_uint),
ctypes.POINTER(ctypes.c_uint),
ctypes.POINTER(ctypes.c_uint),
ctypes.POINTER(ctypes.c_uint),
)Metadata
Metadata
Assignees
Labels
No labels