1 Encoder firmware API description
2 ================================
4 -------------------------------------------------------------------------------
6 Name CX2341X_ENC_PING_FW
9 Does nothing. Can be used to check if the firmware is responding.
11 -------------------------------------------------------------------------------
13 Name CX2341X_ENC_START_CAPTURE
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.
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
33 Bit 4 when set, the capture destination is the host
34 Note: this parameter is only meaningful for RAW capture type.
36 -------------------------------------------------------------------------------
38 Name CX2341X_ENC_STOP_CAPTURE
41 Ends a capture in progress
43 0=stop at end of GOP (generates IRQ)
44 1=stop immediate (no IRQ)
46 Stream type to stop, see param[0] of API 0x81
48 Subtype, see param[1] of API 0x81
50 -------------------------------------------------------------------------------
52 Name CX2341X_ENC_SET_AUDIO_ID
55 Assigns the transport stream ID of the encoded audio stream
59 -------------------------------------------------------------------------------
61 Name CX2341X_ENC_SET_VIDEO_ID
64 Set video transport stream ID
68 -------------------------------------------------------------------------------
70 Name CX2341X_ENC_SET_PCR_ID
73 Assigns the transport stream ID for PCR packets
77 -------------------------------------------------------------------------------
79 Name CX2341X_ENC_SET_FRAME_RATE
82 Set video frames per second. Change occurs at start of new GOP.
87 -------------------------------------------------------------------------------
89 Name CX2341X_ENC_SET_FRAME_SIZE
92 Select video stream encoding resolution.
94 Height in lines. Default 480
96 Width in pixels. Default 720
98 -------------------------------------------------------------------------------
100 Name CX2341X_ENC_SET_BIT_RATE
103 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.
106 0=variable bitrate, 1=constant bitrate
108 bitrate in bits per second
110 peak bitrate in bits per second, divided by 400
112 Mux bitrate in bits per second, divided by 400. May be 0 (default).
114 Rate Control VBR Padding
116 VBV Buffer used by encoder
118 -------------------------------------------------------------------------------
120 Name CX2341X_ENC_SET_GOP_PROPERTIES
123 Setup the GOP structure
125 GOP size (maximum is 34)
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
129 Note that GOP size must be a multiple of (B-frames + 1).
131 -------------------------------------------------------------------------------
133 Name CX2341X_ENC_SET_ASPECT_RATIO
136 Sets the encoding aspect ratio. Changes in the aspect ratio take effect
137 at the start of the next GOP.
148 -------------------------------------------------------------------------------
150 Name CX2341X_ENC_SET_DNR_FILTER_MODE
153 Assign Dynamic Noise Reduction operating mode
155 Bit0: Spatial filter, set=auto, clear=manual
156 Bit1: Temporal filter, set=auto, clear=manual
165 -------------------------------------------------------------------------------
167 Name CX2341X_ENC_SET_DNR_FILTER_PROPS
170 These Dynamic Noise Reduction filter values are only meaningful when
171 the respective filter is set to "manual" (See API 0x9B)
173 Spatial filter: default 0, range 0:15
175 Temporal filter: default 0, range 0:31
177 -------------------------------------------------------------------------------
179 Name CX2341X_ENC_SET_CORING_LEVELS
182 Assign Dynamic Noise Reduction median filter properties.
184 Threshold above which the luminance median filter is enabled.
185 Default: 0, range 0:255
187 Threshold below which the luminance median filter is enabled.
188 Default: 255, range 0:255
190 Threshold above which the chrominance median filter is enabled.
191 Default: 0, range 0:255
193 Threshold below which the chrominance median filter is enabled.
194 Default: 255, range 0:255
196 -------------------------------------------------------------------------------
198 Name CX2341X_ENC_SET_SPATIAL_FILTER_TYPE
201 Assign spatial prefilter parameters
207 3=2D H/V Separable (default)
208 4=2D Symmetric non-separable
212 1=1D Horizontal (default)
214 -------------------------------------------------------------------------------
216 Name CX2341X_ENC_SET_VBI_LINE
219 Selects VBI line number.
222 Bit 31 0=top_field, 1=bottom_field
223 Bits 0:31 all set specifies "all lines"
225 VBI line information features: 0=disabled, 1=enabled
227 Slicing: 0=None, 1=Closed Caption
228 Almost certainly not implemented. Set to 0.
230 Luminance samples in this line.
231 Almost certainly not implemented. Set to 0.
233 Chrominance samples in this line
234 Almost certainly not implemented. Set to 0.
236 -------------------------------------------------------------------------------
238 Name CX2341X_ENC_SET_STREAM_TYPE
242 Note: Transport stream is not working in recent firmwares.
243 And in older firmwares the timestamps in the TS seem to be
258 -------------------------------------------------------------------------------
260 Name CX2341X_ENC_SET_OUTPUT_PORT
263 Assign stream output port. Normally 0 when the data is copied through
264 the PCI bus (DMA), and 1 when the data is streamed to another chip
265 (pvrusb and cx88-blackbird).
271 Unknown, but leaving this to 0 seems to work best. Indications are that
272 this might have to do with USB support, although passing anything but 0
275 -------------------------------------------------------------------------------
277 Name CX2341X_ENC_SET_AUDIO_PROPERTIES
280 Set audio stream properties, may be called while encoding is in progress.
281 Note: all bitfields are consistent with ISO11172 documentation except
282 bits 2:3 which ISO docs define as:
287 This discrepancy may indicate a possible error in the documentation.
288 Testing indicated that only Layer II is actually working, and that
289 the minimum bitrate should be 192 kbps.
301 Index | Layer I | Layer II
302 ------+-------------+------------
303 '0000' | free format | free format
304 '0001' | 32 kbit/s | 32 kbit/s
305 '0010' | 64 kbit/s | 48 kbit/s
306 '0011' | 96 kbit/s | 56 kbit/s
307 '0100' | 128 kbit/s | 64 kbit/s
308 '0101' | 160 kbit/s | 80 kbit/s
309 '0110' | 192 kbit/s | 96 kbit/s
310 '0111' | 224 kbit/s | 112 kbit/s
311 '1000' | 256 kbit/s | 128 kbit/s
312 '1001' | 288 kbit/s | 160 kbit/s
313 '1010' | 320 kbit/s | 192 kbit/s
314 '1011' | 352 kbit/s | 224 kbit/s
315 '1100' | 384 kbit/s | 256 kbit/s
316 '1101' | 416 kbit/s | 320 kbit/s
317 '1110' | 448 kbit/s | 384 kbit/s
318 Note: For Layer II, not all combinations of total bitrate
319 and mode are allowed. See ISO11172-3 3-Annex B, Table 3-B.2
325 Note: the cx23415 cannot decode Joint Stereo properly.
327 10:11 Mode Extension used in joint_stereo mode.
328 In Layer I and II they indicate which subbands are in
329 intensity_stereo. All other subbands are coded in stereo.
330 '00' subbands 4-31 in intensity_stereo, bound==4
331 '01' subbands 8-31 in intensity_stereo, bound==8
332 '10' subbands 12-31 in intensity_stereo, bound==12
333 '11' subbands 16-31 in intensity_stereo, bound==16
353 -------------------------------------------------------------------------------
355 Name CX2341X_ENC_HALT_FW
358 The firmware is halted and no further API calls are serviced until the
359 firmware is uploaded again.
361 -------------------------------------------------------------------------------
363 Name CX2341X_ENC_GET_VERSION
366 Returns the version of the encoder firmware.
373 -------------------------------------------------------------------------------
375 Name CX2341X_ENC_SET_GOP_CLOSURE
378 Assigns the GOP open/close property.
383 -------------------------------------------------------------------------------
385 Name CX2341X_ENC_GET_SEQ_END
388 Obtains the sequence end code of the encoder's buffer. When a capture
389 is started a number of interrupts are still generated, the last of
390 which will have Result[0] set to 1 and Result[1] will contain the size
393 State of the transfer (1 if last buffer)
395 If Result[0] is 1, this contains the size of the last buffer, undefined
398 -------------------------------------------------------------------------------
400 Name CX2341X_ENC_SET_PGM_INDEX_INFO
403 Sets the Program Index Information.
404 The information is stored as follows:
407 u32 length; // Length of this frame
408 u32 offset_low; // Offset in the file of the
409 u32 offset_high; // start of this frame
410 u32 mask1; // Bits 0-1 are the type mask:
412 u32 pts; // The PTS of the frame
413 u32 mask2; // Bit 0 is bit 32 of the pts.
416 struct info index[400];
418 The table_ptr is the encoder memory address in the table were
419 *new* entries will be written. Note that this is a ringbuffer,
420 so the table_ptr will wraparound.
427 (Seems to be ignored, it always indexes I, P and B frames)
429 Elements requested (up to 400)
431 Offset in the encoder memory of the start of the table.
433 Number of allocated elements up to a maximum of Param[1]
435 -------------------------------------------------------------------------------
437 Name CX2341X_ENC_SET_VBI_CONFIG
440 Configure VBI settings
443 0 Mode '0' Sliced, '1' Raw
445 '000' insert in extension & user data
446 '001' insert in private packets
447 '010' separate stream and user data
448 '111' separate stream and private data
449 8:15 Stream ID (normally 0xBD)
451 Frames per interrupt (max 8). Only valid in raw mode.
453 Total raw VBI frames. Only valid in raw mode.
463 Observed frames per interrupt in raw mode only. Rage 1 to Param[1]
465 Observed number of frames in raw mode. Range 1 to Param[2]
467 Memory offset to start or raw VBI data
469 -------------------------------------------------------------------------------
471 Name CX2341X_ENC_SET_DMA_BLOCK_SIZE
474 Set DMA transfer block size
476 DMA transfer block size in bytes or frames. When unit is bytes,
477 supported block sizes are 2^7, 2^8 and 2^9 bytes.
479 Unit: 0=bytes, 1=frames
481 -------------------------------------------------------------------------------
483 Name CX2341X_ENC_GET_PREV_DMA_INFO_MB_10
486 Returns information on the previous DMA transfer in conjunction with
487 bit 27 of the interrupt mask. Uses mailbox 10.
493 Maximum size of transfer
495 -------------------------------------------------------------------------------
497 Name CX2341X_ENC_GET_PREV_DMA_INFO_MB_9
500 Returns information on the previous DMA transfer in conjunction with
501 bit 27 of the interrupt mask. Uses mailbox 9.
504 Bit 0 set indicates transfer complete
505 Bit 2 set indicates transfer error
506 Bit 4 set indicates linked list error
510 Presentation Time Stamp bits 0..31
512 Presentation Time Stamp bit 32
514 -------------------------------------------------------------------------------
516 Name CX2341X_ENC_SCHED_DMA_TO_HOST
519 Setup DMA to host operation
521 Memory address of link list
523 Length of link list (wtf: what units ???)
527 -------------------------------------------------------------------------------
529 Name CX2341X_ENC_INITIALIZE_INPUT
532 Initializes the video input
534 -------------------------------------------------------------------------------
536 Name CX2341X_ENC_SET_FRAME_DROP_RATE
539 For each frame captured, skip specified number of frames.
541 Number of frames to skip
543 -------------------------------------------------------------------------------
545 Name CX2341X_ENC_PAUSE_ENCODER
548 During a pause condition, all frames are dropped instead of being encoded.
553 -------------------------------------------------------------------------------
555 Name CX2341X_ENC_REFRESH_INPUT
558 Refreshes the video input
560 -------------------------------------------------------------------------------
562 Name CX2341X_ENC_SET_COPYRIGHT
565 Sets stream copyright property
567 0=Stream is not copyrighted
568 1=Stream is copyrighted
570 -------------------------------------------------------------------------------
572 Name CX2341X_ENC_SET_EVENT_NOTIFICATION
575 Setup firmware to notify the host about a particular event. Host must
576 unmask the interrupt bit.
578 Event (0=refresh encoder input)
580 Notification 0=disabled 1=enabled
584 Mailbox slot, -1 if no mailbox required.
586 -------------------------------------------------------------------------------
588 Name CX2341X_ENC_SET_NUM_VSYNC_LINES
591 Depending on the analog video decoder used, this assigns the number
592 of lines for field 1 and 2.
594 Field 1 number of lines:
599 Field 2 number of lines:
604 -------------------------------------------------------------------------------
606 Name CX2341X_ENC_SET_PLACEHOLDER
609 Provides a mechanism of inserting custom user data in the MPEG stream.
611 0=extension & user data
612 1=private packet with stream ID 0xBD
614 Rate at which to insert data, in units of frames (for private packet)
615 or GOPs (for ext. & user data)
617 Number of data DWORDs (below) to insert
637 -------------------------------------------------------------------------------
639 Name CX2341X_ENC_MUTE_VIDEO
645 0 '0'=video not muted
646 '1'=video muted, creates frames with the YUV color defined below
648 8:15 V chrominance information
649 16:23 U chrominance information
650 24:31 Y luminance information
652 -------------------------------------------------------------------------------
654 Name CX2341X_ENC_MUTE_AUDIO
660 1=audio muted (produces silent mpeg audio stream)
662 -------------------------------------------------------------------------------
664 Name CX2341X_ENC_UNKNOWN
667 Unknown API, it's used by Hauppauge though.
669 0 This is the value Hauppauge uses, Unknown what it means.
671 -------------------------------------------------------------------------------
673 Name CX2341X_ENC_MISC
676 Miscellaneous actions. Not known for 100% what it does. It's really a
677 sort of ioctl call. The first parameter is a command number, the second
681 1=set initial SCR value when starting encoding.
682 2=set quality mode (apparently some test setting).
683 3=setup advanced VIM protection handling (supposedly only for the cx23416
685 Actually it looks like this should be 0 for saa7114/5 based card and 1
686 for cx25840 based cards.
687 4=generate artificial PTS timestamps
689 6=something to do with the quantization matrix
690 7=set navigation pack insertion for DVD
691 8=enable scene change detection (seems to be a failure)
692 9=set history parameters of the video input module
693 10=set input field order of VIM
694 11=set quantization matrix
695 12=reset audio interface
696 13=set audio volume delay