[gst-devel] gstreamer patch for MJPEG/V4L devices

Ronald Bultje rbultje at ronald.bitfreak.net
Tue Oct 2 12:17:07 CEST 2001


Hello,

as most people on the IRC channel #gstreamer will probably know, I've been
working on a 'v4lmjpegsrc', which is in short some sort of gstreamer plugin
with which someone can capture JPEG encoded frames from a DC10+, Buz,
LML33, Marvel G200/400+RRG or some other zoran/MJPEG-card with MJPEG/V4L
compatible drivers. Well, I think it's finished now, so here's a patch :-).

In short, it works pretty much okay. Performance is okay, I just can hardly
test it because avimux seems to not work correctly... Anyway, I could test
it with (yes, hang me for this ;-) ) v4lmjpegsrc->jpegdec->sdlvideosink
(this is pretty much useless but it works :-) ).

Here's a short list of all options (some are similar to their v4lsrc
counterpart):
x_offset, y_offset, width, height: for the (sub)frame of the full unscaled
   picture to capture
h_decimation, v_decimation: vertical/horizontal decimation of the
   (sub)frame or, if no subframe has been given, of the the full picture
buffer_size, num_buffers: size (in byte) per JPEG buffer we request from
   the driver and the number of drivers
tune: frequency
input: 0=composite, 1=svideo, 2=tvtuner, 3=autodetect (V4L-standard)
norm: 0=PAL, 1=NTSC, 2=SECAM, 3=autodetect (V4L-standard)
mute: unmute or remute the audio (only works if audio goes through the
   device)
bright, contrast, hue, color: picture properties
quality: JPEG capture quality
device: the video device (default: "/dev/video")

Known problems: I use GstBuffer's "gpointer pool_private" for storage of my
struct when defining the GstBufferFreeFunc to be used to free the buffer
(which is actually just a requeue of the buffer). This is pretty ugly but I
couldn't think of a better solution here. I need the struct to know which
frame I should actually re-queue and which filedescriptor I should use for
the ioctl() call. If this is bad, please suggest alternatives :-).

Besides that, it seemed to work reasonable here, I didn't see any crashes,
so I guess it works pretty fine. Some code is based on lavrec, most code is
written from scratch. Please make comments on whatever except coding style
since I usually figure out some self-made-up coding style ;-).

Thanks to the gstreamer-guys for gstreamer and their help on building this
plugin :-). I hope this one can go into Gstreamer.

Regards,

Ronald

PS: with this code, it should not be a very big problem to create a
v4lmjpegsink, which accepts JPEG frames and sends them to the output of the
MJPEG card. Probably my next project :-)

-- 
-   .-.
-   /V\    | Ronald Bultje <rbultje at ronald.bitfreak.net>
-  // \\   | Running: Linux 2.4.4 and OpenBSD 2.8
- /(   )\  | http://ronald.bitfreak.net/
-  ^^-^^
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gstreamer-patch.tar.gz
Type: application/x-compressed-tar
Size: 12116 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20011002/217bcda5/attachment.bin>


More information about the gstreamer-devel mailing list