4
votes

in Raspberry-Pi code, there is a s5p-jpeg codec driver.

drivers/media/platform/s5p-jpeg/jpeg-core.c

Can sombody please tell me where I can find an example of how to use it? Or any other v4l2 codec driver?

I have googled for it, but I cannot find any example which uses a v4l2 codec driver.

3
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.Ken White
what do you want to acchieve? what have you tried?umläute
I am trying to learn how to use a v4l2 codec driver. How to pass in an input image and how to get an output image?michael

3 Answers

3
votes

(adding another answer, since it's completely different :-))

A "codec" API in the V4L2 specs, refers to hardware codecs. such a codec is a device that has the following features:

  • the hardware codec shows up as a /dev/videoX device

  • it has a video input, where you're userland application can send a video-stream - e.g. containing JPEG-encoded video frames - to, so it has the V4L2_CAP_VIDEO_OUTPUT capability and

  • it has a video output, where you're userland application can read a video-stream - e.g. containing the uncompressed frames - from, so it also has the V4L2_CAP_VIDEO_CAPTURE capability.

There are numerous applications that can write video to a v4l2 OUTPUT device, here are a few that i know of:

afaik, these application don't have any specific code to deal with "v4l2 codec devices", but can write to/read from v4l2 devices, which is all that you should need.

Also check the v4l-utils.git: Look in utils/v4l2-ctl/v4l2-ctl-streaming.cpp

2
votes

v4l2 is very liberal when it comes to formats: e.g. capture devices can deliver frames in virtually any format.

So if you are writing a user-land tool (application, library,...; as opposed to a kernel-driver), though shalt not fiddle with codecs (if you can avoid it). Imagine each and every application in the world that wants to read v4l2-streams, having to add code to decode frames in SQ905C or MJPEG or whatnot codec (each application adding their own set of buggy implementation)

Instead, smart people created a library which will decompress the frames delivered by your capture device and provide these frames in a standard way: libv4l2.

Incidentally, if you insist on writing your own code, libv4l2 is a good reference implementation.

Oh, and if you were thinking about simpy loading a module to the encoding/decoding in kernel-space (e.g. you have webcam "foo" which delivers images in format "XYZ" but you want it to deliver images in format "ABC" by means of adding a kernel-module) then you are out of luck.

Linus T. has been quite clear [missing reference] that codec conversion code is not to be run within kernel-space.

0
votes

The code here accesses a v4l2 codec driver

It indeeds checks the V4L2_CAP_VIDEO_M2M cap

It is based on the kernel capture example but with some extra code