intel / libyami

Yet Another Media Infrastructure. it is core part of media codec with hardware acceleration, it is yummy to your video experience on Linux like platform.
Apache License 2.0
146 stars 106 forks source link

Usage of v4l2_wrapper #882

Open philolt opened 4 years ago

philolt commented 4 years ago

Hi, How can I use the compiled libyami_v4l2.so to expose the hardware codecs via v4l2? The only device which is visible is the integrated Webcam of my intel notebook. I searched the whole repo but didn't find a hint how to setup. thanks and best regards

xuguangxin commented 4 years ago

Hi @PipOlt , thanks for interested on this. all v4l2 functions exposed by https://github.com/intel/libyami/blob/apache/interface/v4l2_wrapper.h you can refer to https://github.com/intel/libyami-utils/blob/master/tests/v4l2decode.cpp for api usage. here is some high level introduction. https://github.com/intel/libyami/wiki/V4L2-Codec. You can read it with code, but it's little old, not all information is accurate.

philolt commented 4 years ago

Hi @xuguangxin, Thank you for your fast response. I thought, the v4l2-wrapper acts as a v4l2-device like a capture card. I found all of the documents you posted earlier. But I don't understand how to load the library in a normal linux environment. I expected an exposed device like /dev/video$X for the v4l2 codec. But therefore I need something like a kernel Module. Can you explain how this is working especially in context of video acceleration under chromium? best regards!

xuguangxin commented 4 years ago

@PipOlt , No, it's for decoder and encoder. not for capture. here is the example how to use it https://github.com/intel/libyami-utils/blob/master/tests/V4L2Device.cpp#L219 chrome has similar class https://github.com/chromium/chromium/blob/master/media/gpu/v4l2/v4l2_device.h#L393. If you write a chrome wrapper and hook it up here https://github.com/chromium/chromium/blob/master/media/gpu/v4l2/v4l2_device.cc#L984. you may plugin it to chrome.

thanks

philolt commented 4 years ago

@xuguangxin Ok, thank you for the information. I thought it would be possible to load the codec as a device of v4l2 like this https://github.com/torvalds/linux/blob/master/drivers/media/platform/vicodec/vicodec-core.c. It can be loaded as kernel module and then there is a entrypoint at /dev/video* for the codec. thanks!

xuguangxin commented 4 years ago

no, it's a simulation for v4l2 in user space. nothing related to the kernel module