Commit 32ecb127 authored by Gerd Knorr's avatar Gerd Knorr Committed by Linus Torvalds

[PATCH] v4l2 api: mpeg encoder support

Add a ioctl to set mpeg hardware encoder parameters.
Signed-off-by: default avatarGerd Knorr <kraxel@bytesex.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 1fe3fc30
...@@ -268,64 +268,92 @@ struct v4l2_timecode ...@@ -268,64 +268,92 @@ struct v4l2_timecode
/* The above is based on SMPTE timecodes */ /* The above is based on SMPTE timecodes */
#if 1
/* /*
* C O M P R E S S I O N P A R A M E T E R S * M P E G C O M P R E S S I O N P A R A M E T E R S
*
* ### WARNING: this is still work-in-progress right now, most likely
* ### there will be some incompatible changes.
*
*/ */
#if 0
/* ### generic compression settings don't work, there is too much
* ### codec-specific stuff. Maybe reuse that for MPEG codec settings enum v4l2_bitrate_mode {
* ### later ... */ V4L2_BITRATE_NONE = 0, /* not specified */
struct v4l2_compression V4L2_BITRATE_CBR, /* constant bitrate */
{ V4L2_BITRATE_VBR, /* variable bitrate */
__u32 quality; };
__u32 keyframerate; struct v4l2_bitrate {
__u32 pframerate; /* rates are specified in kbit/sec */
__u32 reserved[5]; enum v4l2_bitrate_mode mode;
__u32 min;
/* what we'll need for MPEG, extracted from some postings on __u32 target; /* use this one for CBR */
the v4l list (Gert Vervoort, PlasmaJohn). __u32 max;
};
system stream:
- type: elementary stream(ES), packatised elementary stream(s) (PES) enum v4l2_mpeg_streamtype {
program stream(PS), transport stream(TS) V4L2_MPEG_SS_1, /* MPEG-1 system stream */
- system bitrate V4L2_MPEG_PS_2, /* MPEG-2 program stream */
- PS packet size (DVD: 2048 bytes, VCD: 2324 bytes) V4L2_MPEG_TS_2, /* MPEG-2 transport stream */
- TS video PID V4L2_MPEG_PS_DVD, /* MPEG-2 program stream with DVD header fixups */
- TS audio PID };
- TS PCR PID enum v4l2_mpeg_audiotype {
- TS system information tables (PAT, PMT, CAT, NIT and SIT) V4L2_MPEG_AU_2_I, /* MPEG-2 layer 1 */
- (MPEG-1 systems stream vs. MPEG-2 program stream (TS not supported V4L2_MPEG_AU_2_II, /* MPEG-2 layer 2 */
by MPEG-1 systems) V4L2_MPEG_AU_2_III, /* MPEG-2 layer 3 */
V4L2_MPEG_AC3, /* AC3 */
audio: V4L2_MPEG_LPCM, /* LPCM */
- type: MPEG (+Layer I,II,III), AC-3, LPCM };
- bitrate enum v4l2_mpeg_videotype {
- sampling frequency (DVD: 48 Khz, VCD: 44.1 KHz, 32 kHz) V4L2_MPEG_VI_1, /* MPEG-1 */
- Trick Modes? (ff, rew) V4L2_MPEG_VI_2, /* MPEG-2 */
- Copyright };
- Inverse Telecine enum v4l2_mpeg_aspectratio {
V4L2_MPEG_ASPECT_SQUARE = 1, /* square pixel */
video: V4L2_MPEG_ASPECT_4_3 = 2, /* 4 : 3 */
- picturesize (SIF, 1/2 D1, 2/3 D1, D1) and PAL/NTSC norm can be set V4L2_MPEG_ASPECT_16_9 = 3, /* 16 : 9 */
through excisting V4L2 controls V4L2_MPEG_ASPECT_1_221 = 4, /* 1 : 2,21 */
- noise reduction, parameters encoder specific? };
- MPEG video version: MPEG-1, MPEG-2
- GOP (Group Of Pictures) definition: struct v4l2_mpeg_compression {
- N: number of frames per GOP /* general */
- M: distance between reference (I,P) frames enum v4l2_mpeg_streamtype st_type;
- open/closed GOP struct v4l2_bitrate st_bitrate;
- quantiser matrix: inter Q matrix (64 bytes) and intra Q matrix (64 bytes)
- quantiser scale: linear or logarithmic /* transport streams */
- scanning: alternate or zigzag __u16 ts_pid_pmt;
- bitrate mode: CBR (constant bitrate) or VBR (variable bitrate). __u16 ts_pid_audio;
- target video bitrate for CBR __u16 ts_pid_video;
- target video bitrate for VBR __u16 ts_pid_pcr;
- maximum video bitrate for VBR - min. quantiser value for VBR
- max. quantiser value for VBR /* program stream */
- adaptive quantisation value __u16 ps_size;
- return the number of bytes per GOP or bitrate for bitrate monitoring __u16 reserved_1; /* align */
*/ /* audio */
enum v4l2_mpeg_audiotype au_type;
struct v4l2_bitrate au_bitrate;
__u32 au_sample_rate;
__u8 au_pesid;
__u8 reserved_2[3]; /* align */
/* video */
enum v4l2_mpeg_videotype vi_type;
enum v4l2_mpeg_aspectratio vi_aspect_ratio;
struct v4l2_bitrate vi_bitrate;
__u32 vi_frame_rate;
__u16 vi_frames_per_gop;
__u16 vi_bframes_count;
__u8 vi_pesid;
__u8 reserved_3[3]; /* align */
/* misc flags */
__u32 closed_gops:1;
__u32 pulldown:1;
__u32 reserved_4:30; /* align */
/* I don't expect the above being perfect yet ;) */
__u32 reserved_5[8];
}; };
#endif #endif
...@@ -841,9 +869,9 @@ struct v4l2_streamparm ...@@ -841,9 +869,9 @@ struct v4l2_streamparm
#define VIDIOC_ENUM_FMT _IOWR ('V', 2, struct v4l2_fmtdesc) #define VIDIOC_ENUM_FMT _IOWR ('V', 2, struct v4l2_fmtdesc)
#define VIDIOC_G_FMT _IOWR ('V', 4, struct v4l2_format) #define VIDIOC_G_FMT _IOWR ('V', 4, struct v4l2_format)
#define VIDIOC_S_FMT _IOWR ('V', 5, struct v4l2_format) #define VIDIOC_S_FMT _IOWR ('V', 5, struct v4l2_format)
#if 0 #if 1 /* experimental */
#define VIDIOC_G_COMP _IOR ('V', 6, struct v4l2_compression) #define VIDIOC_G_MPEGCOMP _IOR ('V', 6, struct v4l2_mpeg_compression)
#define VIDIOC_S_COMP _IOW ('V', 7, struct v4l2_compression) #define VIDIOC_S_MPEGCOMP _IOW ('V', 7, struct v4l2_mpeg_compression)
#endif #endif
#define VIDIOC_REQBUFS _IOWR ('V', 8, struct v4l2_requestbuffers) #define VIDIOC_REQBUFS _IOWR ('V', 8, struct v4l2_requestbuffers)
#define VIDIOC_QUERYBUF _IOWR ('V', 9, struct v4l2_buffer) #define VIDIOC_QUERYBUF _IOWR ('V', 9, struct v4l2_buffer)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment