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