Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 226334
b: refs/heads/master
c: ad1ecf8
h: refs/heads/master
v: v3
  • Loading branch information
Hans Verkuil authored and Mauro Carvalho Chehab committed Dec 29, 2010
1 parent 3ffef6a commit 354c897
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 501 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 08af245de0cf6ab5f4ed008ee2bb99273774fce0
refs/heads/master: ad1ecf8639e51ab8066cd4f37fd36b6b7cbdd8b3
74 changes: 3 additions & 71 deletions trunk/Documentation/video4linux/Zoran
Original file line number Diff line number Diff line change
Expand Up @@ -322,76 +322,11 @@ your IRQs and make sure the card has its own interrupts.

4. Programming interface

This driver conforms to video4linux and video4linux2, both can be used to
use the driver. Since video4linux didn't provide adequate calls to fully
use the cards' features, we've introduced several programming extensions,
which are currently officially accepted in the 2.4.x branch of the kernel.
These extensions are known as the v4l/mjpeg extensions. See zoran.h for
details (structs/ioctls).

Information - video4linux:
http://linux.bytesex.org/v4l2/API.html
Documentation/video4linux/API.html
/usr/include/linux/videodev.h

Information - video4linux/mjpeg extensions:
./zoran.h
(also see below)

Information - video4linux2:
http://linuxtv.org
http://v4l2spec.bytesex.org/
/usr/include/linux/videodev2.h

More information on the video4linux/mjpeg extensions, by Serguei
Miridonovi and Rainer Johanni:
--
The ioctls for that interface are as follows:

BUZIOC_G_PARAMS
BUZIOC_S_PARAMS

Get and set the parameters of the buz. The user should always do a
BUZIOC_G_PARAMS (with a struct buz_params) to obtain the default
settings, change what he likes and then make a BUZIOC_S_PARAMS call.

BUZIOC_REQBUFS

Before being able to capture/playback, the user has to request
the buffers he is wanting to use. Fill the structure
zoran_requestbuffers with the size (recommended: 256*1024) and
the number (recommended 32 up to 256). There are no such restrictions
as for the Video for Linux buffers, you should LEAVE SUFFICIENT
MEMORY for your system however, else strange things will happen ....
On return, the zoran_requestbuffers structure contains number and
size of the actually allocated buffers.
You should use these numbers for doing a mmap of the buffers
into the user space.
The BUZIOC_REQBUFS ioctl also makes it happen, that the next mmap
maps the MJPEG buffer instead of the V4L buffers.

BUZIOC_QBUF_CAPT
BUZIOC_QBUF_PLAY

Queue a buffer for capture or playback. The first call also starts
streaming capture. When streaming capture is going on, you may
only queue further buffers or issue syncs until streaming
capture is switched off again with a argument of -1 to
a BUZIOC_QBUF_CAPT/BUZIOC_QBUF_PLAY ioctl.

BUZIOC_SYNC

Issue this ioctl when all buffers are queued. This ioctl will
block until the first buffer becomes free for saving its
data to disk (after BUZIOC_QBUF_CAPT) or for reuse (after BUZIOC_QBUF_PLAY).

BUZIOC_G_STATUS

Get the status of the input lines (video source connected/norm).
This driver conforms to video4linux2. Support for V4L1 and for the custom
zoran ioctls has been removed in kernel 2.6.38.

For programming example, please, look at lavrec.c and lavplay.c code in
lavtools-1.2p2 package (URL: http://www.cicese.mx/)
and the 'examples' directory in the original Buz driver distribution.
the MJPEG-tools (http://mjpeg.sf.net/).

Additional notes for software developers:

Expand All @@ -402,9 +337,6 @@ Additional notes for software developers:
standard is "more constant" for current country than geometry
settings of a variety of TV capture cards which may work in ITU or
square pixel format.
--
Please note that lavplay/lavrec are also included in the MJPEG-tools
(http://mjpeg.sf.net/).

===========================

Expand Down
107 changes: 0 additions & 107 deletions trunk/drivers/media/video/zoran/zoran.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,118 +33,13 @@

#include <media/v4l2-device.h>

#define ZORAN_VIDMODE_PAL 0
#define ZORAN_VIDMODE_NTSC 1
#define ZORAN_VIDMODE_SECAM 2

struct zoran_requestbuffers {
unsigned long count; /* Number of buffers for MJPEG grabbing */
unsigned long size; /* Size PER BUFFER in bytes */
};

struct zoran_sync {
unsigned long frame; /* number of buffer that has been free'd */
unsigned long length; /* number of code bytes in buffer (capture only) */
unsigned long seq; /* frame sequence number */
struct timeval timestamp; /* timestamp */
};

struct zoran_status {
int input; /* Input channel, has to be set prior to BUZIOC_G_STATUS */
int signal; /* Returned: 1 if valid video signal detected */
int norm; /* Returned: ZORAN_VIDMODE_PAL or ZORAN_VIDMODE_NTSC */
int color; /* Returned: 1 if color signal detected */
};

struct zoran_params {

/* The following parameters can only be queried */

int major_version; /* Major version number of driver */
int minor_version; /* Minor version number of driver */

/* Main control parameters */

int input; /* Input channel: 0 = Composite, 1 = S-VHS */
int norm; /* Norm: ZORAN_VIDMODE_PAL or ZORAN_VIDMODE_NTSC */
int decimation; /* decimation of captured video,
* enlargement of video played back.
* Valid values are 1, 2, 4 or 0.
* 0 is a special value where the user
* has full control over video scaling */

/* The following parameters only have to be set if decimation==0,
* for other values of decimation they provide the data how the image is captured */

int HorDcm; /* Horizontal decimation: 1, 2 or 4 */
int VerDcm; /* Vertical decimation: 1 or 2 */
int TmpDcm; /* Temporal decimation: 1 or 2,
* if TmpDcm==2 in capture every second frame is dropped,
* in playback every frame is played twice */
int field_per_buff; /* Number of fields per buffer: 1 or 2 */
int img_x; /* start of image in x direction */
int img_y; /* start of image in y direction */
int img_width; /* image width BEFORE decimation,
* must be a multiple of HorDcm*16 */
int img_height; /* image height BEFORE decimation,
* must be a multiple of VerDcm*8 */

/* --- End of parameters for decimation==0 only --- */

/* JPEG control parameters */

int quality; /* Measure for quality of compressed images.
* Scales linearly with the size of the compressed images.
* Must be beetween 0 and 100, 100 is a compression
* ratio of 1:4 */

int odd_even; /* Which field should come first ??? */

int APPn; /* Number of APP segment to be written, must be 0..15 */
int APP_len; /* Length of data in JPEG APPn segment */
char APP_data[60]; /* Data in the JPEG APPn segment. */

int COM_len; /* Length of data in JPEG COM segment */
char COM_data[60]; /* Data in JPEG COM segment */

unsigned long jpeg_markers; /* Which markers should go into the JPEG output.
* Unless you exactly know what you do, leave them untouched.
* Inluding less markers will make the resulting code
* smaller, but there will be fewer applications
* which can read it.
* The presence of the APP and COM marker is
* influenced by APP0_len and COM_len ONLY! */
#define JPEG_MARKER_DHT (1<<3) /* Define Huffman Tables */
#define JPEG_MARKER_DQT (1<<4) /* Define Quantization Tables */
#define JPEG_MARKER_DRI (1<<5) /* Define Restart Interval */
#define JPEG_MARKER_COM (1<<6) /* Comment segment */
#define JPEG_MARKER_APP (1<<7) /* App segment, driver will allways use APP0 */

int VFIFO_FB; /* Flag for enabling Video Fifo Feedback.
* If this flag is turned on and JPEG decompressing
* is going to the screen, the decompress process
* is stopped every time the Video Fifo is full.
* This enables a smooth decompress to the screen
* but the video output signal will get scrambled */

/* Misc */

char reserved[312]; /* Makes 512 bytes for this structure */
};

/*
Private IOCTL to set up for displaying MJPEG
*/
#define BUZIOC_G_PARAMS _IOR ('v', BASE_VIDIOC_PRIVATE+0, struct zoran_params)
#define BUZIOC_S_PARAMS _IOWR('v', BASE_VIDIOC_PRIVATE+1, struct zoran_params)
#define BUZIOC_REQBUFS _IOWR('v', BASE_VIDIOC_PRIVATE+2, struct zoran_requestbuffers)
#define BUZIOC_QBUF_CAPT _IOW ('v', BASE_VIDIOC_PRIVATE+3, int)
#define BUZIOC_QBUF_PLAY _IOW ('v', BASE_VIDIOC_PRIVATE+4, int)
#define BUZIOC_SYNC _IOR ('v', BASE_VIDIOC_PRIVATE+5, struct zoran_sync)
#define BUZIOC_G_STATUS _IOWR('v', BASE_VIDIOC_PRIVATE+6, struct zoran_status)


#ifdef __KERNEL__

#define MAJOR_VERSION 0 /* driver major version */
#define MINOR_VERSION 10 /* driver minor version */
Expand Down Expand Up @@ -507,6 +402,4 @@ static inline struct zoran *to_zoran(struct v4l2_device *v4l2_dev)
#define btor(dat,adr) btwrite((dat) | btread(adr), adr)
#define btaor(dat,mask,adr) btwrite((dat) | ((mask) & btread(adr)), adr)

#endif /* __kernel__ */

#endif
2 changes: 1 addition & 1 deletion trunk/drivers/media/video/zoran/zoran_card.c
Original file line number Diff line number Diff line change
Expand Up @@ -943,7 +943,7 @@ zoran_open_init_params (struct zoran *zr)
memset(zr->jpg_settings.jpg_comp.COM_data, 0,
sizeof(zr->jpg_settings.jpg_comp.COM_data));
zr->jpg_settings.jpg_comp.jpeg_markers =
JPEG_MARKER_DHT | JPEG_MARKER_DQT;
V4L2_JPEG_MARKER_DHT | V4L2_JPEG_MARKER_DQT;
i = zoran_check_jpg_settings(zr, &zr->jpg_settings, 0);
if (i)
dprintk(1, KERN_ERR "%s: %s internal error\n",
Expand Down
Loading

0 comments on commit 354c897

Please sign in to comment.