blob: f74b0ae4a76926a9ad6c1e9b36f232f0271ff211 [file] [log] [blame]
Mauro Carvalho Chehab447d6fb2006-05-22 10:31:37 -03001Encoder firmware API description
2================================
3
4-------------------------------------------------------------------------------
5
6Name CX2341X_ENC_PING_FW
7Enum 128/0x80
8Description
9 Does nothing. Can be used to check if the firmware is responding.
10
11-------------------------------------------------------------------------------
12
13Name CX2341X_ENC_START_CAPTURE
14Enum 129/0x81
15Description
16 Commences the capture of video, audio and/or VBI data. All encoding
17 parameters must be initialized prior to this API call. Captures frames
18 continuously or until a predefined number of frames have been captured.
19Param[0]
20 Capture stream type:
21 0=MPEG
22 1=Raw
23 2=Raw passthrough
24 3=VBI
25
26Param[1]
27 Bitmask:
28 Bit 0 when set, captures YUV
29 Bit 1 when set, captures PCM audio
30 Bit 2 when set, captures VBI (same as param[0]=3)
31 Bit 3 when set, the capture destination is the decoder
32 (same as param[0]=2)
33 Bit 4 when set, the capture destination is the host
34 Note: this parameter is only meaningful for RAW capture type.
35
36-------------------------------------------------------------------------------
37
38Name CX2341X_ENC_STOP_CAPTURE
39Enum 130/0x82
40Description
41 Ends a capture in progress
42Param[0]
43 0=stop at end of GOP (generates IRQ)
44 1=stop immediate (no IRQ)
45Param[1]
46 Stream type to stop, see param[0] of API 0x81
47Param[2]
48 Subtype, see param[1] of API 0x81
49
50-------------------------------------------------------------------------------
51
52Name CX2341X_ENC_SET_AUDIO_ID
53Enum 137/0x89
54Description
55 Assigns the transport stream ID of the encoded audio stream
56Param[0]
57 Audio Stream ID
58
59-------------------------------------------------------------------------------
60
61Name CX2341X_ENC_SET_VIDEO_ID
62Enum 139/0x8B
63Description
64 Set video transport stream ID
65Param[0]
66 Video stream ID
67
68-------------------------------------------------------------------------------
69
70Name CX2341X_ENC_SET_PCR_ID
71Enum 141/0x8D
72Description
73 Assigns the transport stream ID for PCR packets
74Param[0]
75 PCR Stream ID
76
77-------------------------------------------------------------------------------
78
79Name CX2341X_ENC_SET_FRAME_RATE
80Enum 143/0x8F
81Description
82 Set video frames per second. Change occurs at start of new GOP.
83Param[0]
84 0=30fps
85 1=25fps
86
87-------------------------------------------------------------------------------
88
89Name CX2341X_ENC_SET_FRAME_SIZE
90Enum 145/0x91
91Description
92 Select video stream encoding resolution.
93Param[0]
94 Height in lines. Default 480
95Param[1]
96 Width in pixels. Default 720
97
98-------------------------------------------------------------------------------
99
100Name CX2341X_ENC_SET_BIT_RATE
101Enum 149/0x95
102Description
Hans Verkuil54f577b2006-06-18 14:56:12 -0300103 Assign average video stream bitrate. Note on the last three params:
104 Param[3] and [4] seem to be always 0, param [5] doesn't seem to be used.
Mauro Carvalho Chehab447d6fb2006-05-22 10:31:37 -0300105Param[0]
106 0=variable bitrate, 1=constant bitrate
107Param[1]
108 bitrate in bits per second
109Param[2]
110 peak bitrate in bits per second, divided by 400
Hans Verkuil54f577b2006-06-18 14:56:12 -0300111Param[3]
112 Mux bitrate in bits per second, divided by 400. May be 0 (default).
113Param[4]
114 Rate Control VBR Padding
115Param[5]
116 VBV Buffer used by encoder
Mauro Carvalho Chehab447d6fb2006-05-22 10:31:37 -0300117
118-------------------------------------------------------------------------------
119
120Name CX2341X_ENC_SET_GOP_PROPERTIES
121Enum 151/0x97
122Description
123 Setup the GOP structure
124Param[0]
Hans Verkuil54f577b2006-06-18 14:56:12 -0300125 GOP size (maximum is 34)
Mauro Carvalho Chehab447d6fb2006-05-22 10:31:37 -0300126Param[1]
127 Number of B frames between the I and P frame, plus 1.
128 For example: IBBPBBPBBPBB --> GOP size: 12, number of B frames: 2+1 = 3
Hans Verkuil54f577b2006-06-18 14:56:12 -0300129 Note that GOP size must be a multiple of (B-frames + 1).
Mauro Carvalho Chehab447d6fb2006-05-22 10:31:37 -0300130
131-------------------------------------------------------------------------------
132
133Name CX2341X_ENC_SET_ASPECT_RATIO
134Enum 153/0x99
135Description
136 Sets the encoding aspect ratio. Changes in the aspect ratio take effect
137 at the start of the next GOP.
138Param[0]
139 '0000' forbidden
140 '0001' 1:1 square
141 '0010' 4:3
142 '0011' 16:9
143 '0100' 2.21:1
144 '0101' reserved
145 ....
146 '1111' reserved
147
148-------------------------------------------------------------------------------
149
150Name CX2341X_ENC_SET_DNR_FILTER_MODE
151Enum 155/0x9B
152Description
153 Assign Dynamic Noise Reduction operating mode
154Param[0]
155 Bit0: Spatial filter, set=auto, clear=manual
156 Bit1: Temporal filter, set=auto, clear=manual
157Param[1]
158 Median filter:
159 0=Disabled
160 1=Horizontal
161 2=Vertical
162 3=Horiz/Vert
163 4=Diagonal
164
165-------------------------------------------------------------------------------
166
167Name CX2341X_ENC_SET_DNR_FILTER_PROPS
168Enum 157/0x9D
169Description
170 These Dynamic Noise Reduction filter values are only meaningful when
171 the respective filter is set to "manual" (See API 0x9B)
172Param[0]
173 Spatial filter: default 0, range 0:15
174Param[1]
175 Temporal filter: default 0, range 0:31
176
177-------------------------------------------------------------------------------
178
179Name CX2341X_ENC_SET_CORING_LEVELS
180Enum 159/0x9F
181Description
182 Assign Dynamic Noise Reduction median filter properties.
183Param[0]
184 Threshold above which the luminance median filter is enabled.
185 Default: 0, range 0:255
186Param[1]
187 Threshold below which the luminance median filter is enabled.
188 Default: 255, range 0:255
189Param[2]
190 Threshold above which the chrominance median filter is enabled.
191 Default: 0, range 0:255
192Param[3]
193 Threshold below which the chrominance median filter is enabled.
194 Default: 255, range 0:255
195
196-------------------------------------------------------------------------------
197
198Name CX2341X_ENC_SET_SPATIAL_FILTER_TYPE
199Enum 161/0xA1
200Description
201 Assign spatial prefilter parameters
202Param[0]
203 Luminance filter
204 0=Off
205 1=1D Horizontal
206 2=1D Vertical
207 3=2D H/V Separable (default)
208 4=2D Symmetric non-separable
209Param[1]
210 Chrominance filter
211 0=Off
212 1=1D Horizontal (default)
213
214-------------------------------------------------------------------------------
215
216Name CX2341X_ENC_SET_3_2_PULLDOWN
217Enum 177/0xB1
218Description
219 3:2 pulldown properties
220Param[0]
221 0=enabled
222 1=disabled
223
224-------------------------------------------------------------------------------
225
226Name CX2341X_ENC_SET_VBI_LINE
227Enum 183/0xB7
228Description
229 Selects VBI line number.
230Param[0]
231 Bits 0:4 line number
232 Bit 31 0=top_field, 1=bottom_field
233 Bits 0:31 all set specifies "all lines"
234Param[1]
235 VBI line information features: 0=disabled, 1=enabled
236Param[2]
237 Slicing: 0=None, 1=Closed Caption
238 Almost certainly not implemented. Set to 0.
239Param[3]
240 Luminance samples in this line.
241 Almost certainly not implemented. Set to 0.
242Param[4]
243 Chrominance samples in this line
244 Almost certainly not implemented. Set to 0.
245
246-------------------------------------------------------------------------------
247
248Name CX2341X_ENC_SET_STREAM_TYPE
249Enum 185/0xB9
250Description
251 Assign stream type
Hans Verkuil54f577b2006-06-18 14:56:12 -0300252 Note: Transport stream is not working in recent firmwares.
253 And in older firmwares the timestamps in the TS seem to be
254 unreliable.
Mauro Carvalho Chehab447d6fb2006-05-22 10:31:37 -0300255Param[0]
256 0=Program stream
257 1=Transport stream
258 2=MPEG1 stream
259 3=PES A/V stream
260 5=PES Video stream
261 7=PES Audio stream
262 10=DVD stream
263 11=VCD stream
264 12=SVCD stream
265 13=DVD_S1 stream
266 14=DVD_S2 stream
267
268-------------------------------------------------------------------------------
269
270Name CX2341X_ENC_SET_OUTPUT_PORT
271Enum 187/0xBB
272Description
273 Assign stream output port (not recommended you change setting from default)
274Param[0]
275 0=Memory (default)
276 1=Streaming
277 2=Serial
278
279-------------------------------------------------------------------------------
280
281Name CX2341X_ENC_SET_AUDIO_PROPERTIES
282Enum 189/0xBD
283Description
284 Set audio stream properties, may be called while encoding is in progress.
285 Note: all bitfields are consistent with ISO11172 documentation except
286 bits 2:3 which ISO docs define as:
287 '11' Layer I
288 '10' Layer II
289 '01' Layer III
290 '00' Undefined
291 This discrepancy may indicate a possible error in the documentation.
Hans Verkuil54f577b2006-06-18 14:56:12 -0300292 Testing indicated that only Layer II is actually working, and that
293 the minimum bitrate should be 192 kbps.
Mauro Carvalho Chehab447d6fb2006-05-22 10:31:37 -0300294Param[0]
295 Bitmask:
296 0:1 '00' 44.1Khz
Trent Piepho657de3c2006-06-20 00:30:57 -0300297 '01' 48Khz
298 '10' 32Khz
299 '11' reserved
Mauro Carvalho Chehab447d6fb2006-05-22 10:31:37 -0300300
301 2:3 '01'=Layer I
302 '10'=Layer II
303
304 4:7 Bitrate:
Trent Piepho657de3c2006-06-20 00:30:57 -0300305 Index | Layer I | Layer II
306 ------+-------------+------------
307 '0000' | free format | free format
308 '0001' | 32 kbit/s | 32 kbit/s
309 '0010' | 64 kbit/s | 48 kbit/s
310 '0011' | 96 kbit/s | 56 kbit/s
311 '0100' | 128 kbit/s | 64 kbit/s
312 '0101' | 160 kbit/s | 80 kbit/s
313 '0110' | 192 kbit/s | 96 kbit/s
314 '0111' | 224 kbit/s | 112 kbit/s
315 '1000' | 256 kbit/s | 128 kbit/s
316 '1001' | 288 kbit/s | 160 kbit/s
317 '1010' | 320 kbit/s | 192 kbit/s
318 '1011' | 352 kbit/s | 224 kbit/s
319 '1100' | 384 kbit/s | 256 kbit/s
320 '1101' | 416 kbit/s | 320 kbit/s
321 '1110' | 448 kbit/s | 384 kbit/s
322 Note: For Layer II, not all combinations of total bitrate
323 and mode are allowed. See ISO11172-3 3-Annex B, Table 3-B.2
Mauro Carvalho Chehab447d6fb2006-05-22 10:31:37 -0300324
325 8:9 '00'=Stereo
Trent Piepho657de3c2006-06-20 00:30:57 -0300326 '01'=JointStereo
327 '10'=Dual
328 '11'=Mono
Hans Verkuil54f577b2006-06-18 14:56:12 -0300329 Note: testing seems to indicate that Mono and possibly
330 JointStereo are not working (default to stereo).
331 Dual does work, though.
Mauro Carvalho Chehab447d6fb2006-05-22 10:31:37 -0300332
333 10:11 Mode Extension used in joint_stereo mode.
Trent Piepho657de3c2006-06-20 00:30:57 -0300334 In Layer I and II they indicate which subbands are in
Mauro Carvalho Chehab447d6fb2006-05-22 10:31:37 -0300335 intensity_stereo. All other subbands are coded in stereo.
Trent Piepho657de3c2006-06-20 00:30:57 -0300336 '00' subbands 4-31 in intensity_stereo, bound==4
337 '01' subbands 8-31 in intensity_stereo, bound==8
338 '10' subbands 12-31 in intensity_stereo, bound==12
339 '11' subbands 16-31 in intensity_stereo, bound==16
Mauro Carvalho Chehab447d6fb2006-05-22 10:31:37 -0300340
341 12:13 Emphasis:
Trent Piepho657de3c2006-06-20 00:30:57 -0300342 '00' None
343 '01' 50/15uS
344 '10' reserved
345 '11' CCITT J.17
Mauro Carvalho Chehab447d6fb2006-05-22 10:31:37 -0300346
347 14 CRC:
Trent Piepho657de3c2006-06-20 00:30:57 -0300348 '0' off
349 '1' on
Mauro Carvalho Chehab447d6fb2006-05-22 10:31:37 -0300350
351 15 Copyright:
Trent Piepho657de3c2006-06-20 00:30:57 -0300352 '0' off
353 '1' on
Mauro Carvalho Chehab447d6fb2006-05-22 10:31:37 -0300354
355 16 Generation:
Trent Piepho657de3c2006-06-20 00:30:57 -0300356 '0' copy
357 '1' original
Mauro Carvalho Chehab447d6fb2006-05-22 10:31:37 -0300358
359-------------------------------------------------------------------------------
360
361Name CX2341X_ENC_HALT_FW
362Enum 195/0xC3
363Description
364 The firmware is halted and no further API calls are serviced until the
365 firmware is uploaded again.
366
367-------------------------------------------------------------------------------
368
369Name CX2341X_ENC_GET_VERSION
370Enum 196/0xC4
371Description
372 Returns the version of the encoder firmware.
373Result[0]
374 Version bitmask:
375 Bits 0:15 build
376 Bits 16:23 minor
377 Bits 24:31 major
378
379-------------------------------------------------------------------------------
380
381Name CX2341X_ENC_SET_GOP_CLOSURE
382Enum 197/0xC5
383Description
384 Assigns the GOP open/close property.
385Param[0]
386 0=Open
387 1=Closed
388
389-------------------------------------------------------------------------------
390
391Name CX2341X_ENC_GET_SEQ_END
392Enum 198/0xC6
393Description
394 Obtains the sequence end code of the encoder's buffer. When a capture
395 is started a number of interrupts are still generated, the last of
396 which will have Result[0] set to 1 and Result[1] will contain the size
397 of the buffer.
398Result[0]
399 State of the transfer (1 if last buffer)
400Result[1]
401 If Result[0] is 1, this contains the size of the last buffer, undefined
402 otherwise.
403
404-------------------------------------------------------------------------------
405
406Name CX2341X_ENC_SET_PGM_INDEX_INFO
407Enum 199/0xC7
408Description
409 Sets the Program Index Information.
410Param[0]
411 Picture Mask:
412 0=No index capture
413 1=I frames
414 3=I,P frames
415 7=I,P,B frames
416Param[1]
417 Elements requested (up to 400)
418Result[0]
419 Offset in SDF memory of the table.
420Result[1]
421 Number of allocated elements up to a maximum of Param[1]
422
423-------------------------------------------------------------------------------
424
425Name CX2341X_ENC_SET_VBI_CONFIG
426Enum 200/0xC8
427Description
428 Configure VBI settings
429Param[0]
430 Bitmap:
431 0 Mode '0' Sliced, '1' Raw
432 1:3 Insertion:
433 '000' insert in extension & user data
434 '001' insert in private packets
435 '010' separate stream and user data
436 '111' separate stream and private data
437 8:15 Stream ID (normally 0xBD)
438Param[1]
439 Frames per interrupt (max 8). Only valid in raw mode.
440Param[2]
441 Total raw VBI frames. Only valid in raw mode.
442Param[3]
443 Start codes
444Param[4]
445 Stop codes
446Param[5]
447 Lines per frame
448Param[6]
449 Byte per line
450Result[0]
451 Observed frames per interrupt in raw mode only. Rage 1 to Param[1]
452Result[1]
453 Observed number of frames in raw mode. Range 1 to Param[2]
454Result[2]
455 Memory offset to start or raw VBI data
456
457-------------------------------------------------------------------------------
458
459Name CX2341X_ENC_SET_DMA_BLOCK_SIZE
460Enum 201/0xC9
461Description
462 Set DMA transfer block size
463Param[0]
464 DMA transfer block size in bytes or frames. When unit is bytes,
465 supported block sizes are 2^7, 2^8 and 2^9 bytes.
466Param[1]
467 Unit: 0=bytes, 1=frames
468
469-------------------------------------------------------------------------------
470
471Name CX2341X_ENC_GET_PREV_DMA_INFO_MB_10
472Enum 202/0xCA
473Description
474 Returns information on the previous DMA transfer in conjunction with
475 bit 27 of the interrupt mask. Uses mailbox 10.
476Result[0]
477 Type of stream
478Result[1]
479 Address Offset
480Result[2]
481 Maximum size of transfer
482
483-------------------------------------------------------------------------------
484
485Name CX2341X_ENC_GET_PREV_DMA_INFO_MB_9
486Enum 203/0xCB
487Description
488 Returns information on the previous DMA transfer in conjunction with
489 bit 27 of the interrupt mask. Uses mailbox 9.
490Result[0]
491 Status bits:
492 Bit 0 set indicates transfer complete
493 Bit 2 set indicates transfer error
494 Bit 4 set indicates linked list error
495Result[1]
496 DMA type
497Result[2]
498 Presentation Time Stamp bits 0..31
499Result[3]
500 Presentation Time Stamp bit 32
501
502-------------------------------------------------------------------------------
503
504Name CX2341X_ENC_SCHED_DMA_TO_HOST
505Enum 204/0xCC
506Description
507 Setup DMA to host operation
508Param[0]
509 Memory address of link list
510Param[1]
511 Length of link list (wtf: what units ???)
512Param[2]
513 DMA type (0=MPEG)
514
515-------------------------------------------------------------------------------
516
517Name CX2341X_ENC_INITIALIZE_INPUT
518Enum 205/0xCD
519Description
520 Initializes the video input
521
522-------------------------------------------------------------------------------
523
524Name CX2341X_ENC_SET_FRAME_DROP_RATE
525Enum 208/0xD0
526Description
527 For each frame captured, skip specified number of frames.
528Param[0]
529 Number of frames to skip
530
531-------------------------------------------------------------------------------
532
533Name CX2341X_ENC_PAUSE_ENCODER
534Enum 210/0xD2
535Description
536 During a pause condition, all frames are dropped instead of being encoded.
537Param[0]
538 0=Pause encoding
539 1=Continue encoding
540
541-------------------------------------------------------------------------------
542
543Name CX2341X_ENC_REFRESH_INPUT
544Enum 211/0xD3
545Description
546 Refreshes the video input
547
548-------------------------------------------------------------------------------
549
550Name CX2341X_ENC_SET_COPYRIGHT
551Enum 212/0xD4
552Description
553 Sets stream copyright property
554Param[0]
555 0=Stream is not copyrighted
556 1=Stream is copyrighted
557
558-------------------------------------------------------------------------------
559
560Name CX2341X_ENC_SET_EVENT_NOTIFICATION
561Enum 213/0xD5
562Description
563 Setup firmware to notify the host about a particular event. Host must
564 unmask the interrupt bit.
565Param[0]
566 Event (0=refresh encoder input)
567Param[1]
568 Notification 0=disabled 1=enabled
569Param[2]
570 Interrupt bit
571Param[3]
572 Mailbox slot, -1 if no mailbox required.
573
574-------------------------------------------------------------------------------
575
576Name CX2341X_ENC_SET_NUM_VSYNC_LINES
577Enum 214/0xD6
578Description
579 Depending on the analog video decoder used, this assigns the number
580 of lines for field 1 and 2.
581Param[0]
582 Field 1 number of lines:
583 0x00EF for SAA7114
584 0x00F0 for SAA7115
585 0x0105 for Micronas
586Param[1]
587 Field 2 number of lines:
588 0x00EF for SAA7114
589 0x00F0 for SAA7115
590 0x0106 for Micronas
591
592-------------------------------------------------------------------------------
593
594Name CX2341X_ENC_SET_PLACEHOLDER
595Enum 215/0xD7
596Description
597 Provides a mechanism of inserting custom user data in the MPEG stream.
598Param[0]
599 0=extension & user data
600 1=private packet with stream ID 0xBD
601Param[1]
602 Rate at which to insert data, in units of frames (for private packet)
603 or GOPs (for ext. & user data)
604Param[2]
605 Number of data DWORDs (below) to insert
606Param[3]
607 Custom data 0
608Param[4]
609 Custom data 1
610Param[5]
611 Custom data 2
612Param[6]
613 Custom data 3
614Param[7]
615 Custom data 4
616Param[8]
617 Custom data 5
618Param[9]
619 Custom data 6
620Param[10]
621 Custom data 7
622Param[11]
623 Custom data 8
624
625-------------------------------------------------------------------------------
626
627Name CX2341X_ENC_MUTE_VIDEO
628Enum 217/0xD9
629Description
630 Video muting
631Param[0]
632 Bit usage:
633 0 '0'=video not muted
634 '1'=video muted, creates frames with the YUV color defined below
635 1:7 Unused
636 8:15 V chrominance information
637 16:23 U chrominance information
638 24:31 Y luminance information
639
640-------------------------------------------------------------------------------
641
642Name CX2341X_ENC_MUTE_AUDIO
643Enum 218/0xDA
644Description
645 Audio muting
646Param[0]
647 0=audio not muted
648 1=audio muted (produces silent mpeg audio stream)
649
650-------------------------------------------------------------------------------
651
652Name CX2341X_ENC_UNKNOWN
653Enum 219/0xDB
654Description
655 Unknown API, it's used by Hauppauge though.
656Param[0]
657 0 This is the value Hauppauge uses, Unknown what it means.
658
659-------------------------------------------------------------------------------
660
661Name CX2341X_ENC_MISC
662Enum 220/0xDC
663Description
664 Miscellaneous actions. Not known for 100% what it does. It's really a
665 sort of ioctl call. The first parameter is a command number, the second
666 the value.
667Param[0]
668 Command number:
669 1=set initial SCR value when starting encoding.
670 2=set quality mode (apparently some test setting).
671 3=setup advanced VIM protection handling (supposedly only for the cx23416
672 for raw YUV).
673 Actually it looks like this should be 0 for saa7114/5 based card and 1
674 for cx25840 based cards.
675 4=generate artificial PTS timestamps
676 5=USB flush mode
677 6=something to do with the quantization matrix
678 7=set navigation pack insertion for DVD
679 8=enable scene change detection (seems to be a failure)
680 9=set history parameters of the video input module
681 10=set input field order of VIM
682 11=set quantization matrix
683 12=reset audio interface
684 13=set audio volume delay
685 14=set audio delay
686
687Param[1]
688 Command value.