aboutsummaryrefslogtreecommitdiff
path: root/fmb_player_apl/include/FmbAp.h
blob: 8bfc9d58d9ce04b04c01c851b51f0a127352ab56 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
/**
*	@brief 		API of the device module is declared.
*	@since		2009/01/08
*	@note		None
*	@attention	None
*	<B><I>COPYRIGHT FUJITSU LIMITED 2009</I></B>
*/

/*
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 */

#ifndef __FMBDEVICE_H_
#define __FMBDEVICE_H_

#include "MmuxAp.h"


/**
*   @brief      Audio format.
*   @note       None
*   @attention  None
*/
enum FMBAudioFormatEnum{
	FMBEnmAudioFmtMpeg1l2,
	FMBEnmAudioFmtAc3,
	FMBEnmAudioFmtAac,
	FMBEnmAudioFmtLpcm,
	FMBEnmAudioFmtMax
};

/**
*   @brief      Audio LPCM bitrate.
*   @note       None
*   @attention  None
*/
enum FMBAudioLpcmEnum{
	FMBEnmAudioLpcm16stereo,
};

/**
*   @brief      Input and output port.
*   @note       None
*   @attention  None
*/
enum FMBPortEnum{
	FMBEnmPortFile,
	FMBEnmPortStreamport,
};


/**
*   @brief      Video rate control.
*   @note       None
*   @attention  None
*/
enum FMBVideoRateCtlEnum{
	FMBEnmVideoRateCtlCbr,
	FMBEnmVideoRateCtlVbr,
};


/**
*   @brief      Video format control.
*   @note       None
*   @attention  None
*/

enum FMBVideoFormatEnum{
	FMBEnmVideoFmt1920x1080,
	FMBEnmVideoFmt1440x1080,
	FMBEnmVideoFmt1280x720,
	FMBEnmVideoFmt720x480,
	FMBEnmVideoFmt720x576,
	FMBEnmVideoFmtMax
};

/**
*   @brief      Video frame rate control.
*   @note       None
*   @attention  None
*/

enum FMBVideoFrameEnum{
	FMBEnmVideoFrm_60p,
	FMBEnmVideoFrm_5994p,
	FMBEnmVideoFrm_50p,
	FMBEnmVideoFrm_60i,
	FMBEnmVideoFrm_5994i,
	FMBEnmVideoFrm_50i,
	FMBEnmVideoFrmMax
};

/**
*   @brief      Video resolution control.
*   @note       None
*   @attention  None
*/

enum FMBVideoResolutionEnum{
	FMBEnmVideoRsltn_NONE = 0,
	FMBEnmVideoRsltn_1920_1080_60p,
	FMBEnmVideoRsltn_1920_1080_59p,
	FMBEnmVideoRsltn_1920_1080_50p,
	FMBEnmVideoRsltn_1920_1080_60i,
	FMBEnmVideoRsltn_1920_1080_59i,
	FMBEnmVideoRsltn_1920_1080_50i,
	FMBEnmVideoRsltn_1440_1080_60i,
	FMBEnmVideoRsltn_1440_1080_59i,
	FMBEnmVideoRsltn_1440_1080_50i,
	FMBEnmVideoRsltn_1280_720_60p,
	FMBEnmVideoRsltn_1280_720_59p,
	FMBEnmVideoRsltn_1280_720_50p,
	FMBEnmVideoRsltn_720_480_60i,
	FMBEnmVideoRsltn_720_480_59i,
	FMBEnmVideoRsltn_720_576_50i,
	FMBEnmVideoRsltnMax
};

/**
*   @brief      Video Scaler for encode.
*   @note       None
*   @attention  None
*/

enum FMBVideoScalerEncEnum{
	FMBEnmVideoSclEnc_NotUse,
	FMBEnmVideoSclEncMax
};

/**
*   @brief      Request status.
*   @note       None
*   @attention  None
*/

enum FMBRequestEnum{
	FMBEnmReqNothing,
	FMBEnmReqInitEnc1pic,
	FMBEnmReqInitEnc,
	FMBEnmReqInitDec,
	FMBEnmReqInitDec1pic,
	FMBEnmReqInitStartPause,
	FMBEnmReqStartEnc,
	FMBEnmReqStartEnc1Pic,
	FMBEnmReqStartDecNormal,
	FMBEnmReqStartDecSlow,
	FMBEnmReqStartDecFrameAdvance,
	FMBEnmReqStartDec1pic,
	FMBEnmReqPause,
	FMBEnmReqStop,
	FMBEnmReqReset,
	FMBEnmReqMute,
	FMBEnmReqAutoStop,
	FMBEnmReqStopDecCore,
	FMBEnmReqStartCommand,
};


/**
*   @brief      Function mode.
*   @note       None
*   @attention  None
*/

enum FMBFuncModeEnum{
	FMBEnmFuncModeEnc,
	FMBEnmFuncModeDec,
};


/**
*   @brief      Kind of bitrate calcuration.
*   @note       None
*   @attention  None
*/
enum FMBBitrateCalcEnum{
	FMBEnmBitrateCalcVideobase,
	FMBEnmBitrateCalcSystembase,
};


/**
*	@brief		TS packet type
*	@note		None
*	@attention	None
*/

enum FMBTsPacketTypeEnum{
	FMBEnmInputTsPacket,
	FMBEnmOutputTsPacket,
	FMBEnmTsPacketMax
};

/**
*   @brief      TS format.
*   @note       None
*   @attention  None
*/

enum FMBTsFormatEnum{
	FMBEnmTsFormat188,
	FMBEnmTsFormat192,
	FMBEnmTsFormat192e,
};


/**
*   @brief      State of waiting send stream thread.
*   @note       None
*   @attention  None
*/
enum FMBStreamSendEndStateEnum{
	FMBEnmStreamSendEndOff,
	FMBEnmStreamSendEndOn,
};


/**
*   @brief      Running state of request.
*   @note       None
*   @attention  None
*/

enum FMBResultEnum{
	FMBEnmResultContinue,			///<The request is being executed.
	FMBEnmResultRequestComplete,	///<The request was completed.
};

/**
*   @brief      PID type.
*   @note       None
*   @attention  None
*/

enum FMBPidTypeEnum{
	FMBEnmInputVideoPid,
	FMBEnmInputAudioPid,
	FMBEnmInputPmtPid,
	FMBEnmInputSitPid,
	FMBEnmInputPcrPid,
	FMBEnmOutputVideoPid,
	FMBEnmOutputAudioPid,
	FMBEnmOutputPmtPid,
	FMBEnmOutputSitPid,
	FMBEnmOutputPcrPid,

	FMBEnmPidMax
};

/**
*   @brief      Device number.
*   @note       None
*   @attention  None
*/
enum FMBDeviceNumEnum {
	FMBEnmDevice_NONE = -1,
	FMBEnmDevice_0 = 0,
	FMBEnmDevice_1,
	FMBEnmDevice_2,
	FMBEnmDevice_3,
	FMBEnmDevice_4,
	FMBEnmDevice_5,
	FMBEnmDevice_6,
	FMBEnmDevice_7,

	FMBEnmDeviceMax
};

/**
*   @brief      CBR max bitrate value.
*   @note       None
*   @attention  None
*/
#define       FMB_MAX_BITRATE_CBR             65535


/**
*   @brief      VBR max bitrate value.
*   @note       None
*   @attention  None
*/
#define       FMB_MAX_BITRATE_VBR             65535

/**
*   @brief      Number of function mode.
*   @note       None
*   @attention  None
*/
#define       FMB_FUNCTION_MODE_NUM                 3

/**
*   @brief      PID max value.
*   @note       None
*   @attention  None
*/
#define		  FMB_MAX_PID_VALUE					0x1FFF

#define       FMB_MAX_STREAM                        2	// FMBEnmStreamMAX


#define       FMB_AUDIO_FORMAT_KIND                 4

//#define		  FMB_TS_PACKET_TYPE					3

#define       FMB_DEVNAME_CHAR                    "fmb"
#define       FMB_DEVNAME_MAX_CHAR                 24
#define       FMB_KEYBUFF_MAX_CHAR                202
#define       FMB_BITRATE_MAX_CHAR                FMB_KEYBUFF_MAX_CHAR
#define       FMB_FACTOR_MAX_CHAR                 512
#define       FMB_ERRINFO_MAX_CHAR                512
#define       FMB_FILEPATH_MAX_CHAR               FMB_KEYBUFF_MAX_CHAR
#define       FMB_FIRMPATH_MAX_CHAR               FMB_KEYBUFF_MAX_CHAR	

#define       FMB_FILEPATH_MIN_CODE_RANGE         0x21	
#define       FMB_FILEPATH_MAX_CODE_RANGE         0x7E	
#define       FMB_KEY_ESC                         0x1b	
#define       FMB_KEY_CTRL_O                      0x0f	
#define       FMB_KEY_CTRL_X                      0x18	

#define       FMB_CODE_INVALID_KIND                 8
#define       FMB_CODE_QUOTATION_MARKS            0x22	
#define       FMB_CODE_ASTERISK                   0x2A	
#define       FMB_CODE_COLON                      0x3A	
#define       FMB_CODE_LESS_THAN_SIGN             0x3C	
#define       FMB_CODE_GRATER_THAN_SIGN           0x3E	
#define       FMB_CODE_QUESTION_MARK              0x3F	
#define       FMB_CODE_BACKSLASH                  0x5C	
#define       FMB_CODE_BERTIE_KALVER              0x7C	

#define       FMB_DEFUALT_BITRATE_CBR_ENC        30000
#define       FMB_DEFUALT_BITRATE_VBR_AVE_ENC    30000
#define       FMB_DEFUALT_BITRATE_VBR_PEAK_ENC   30000
#define       FMB_DEFUALT_BITRATE_AUDIO           256
#define       FMB_DEFUALT_BITRATE_AUDIO_LPCM     1536		//< 16bit 48Khz stereo2ch=(16*48*2)kbps
#define       FMB_DEFUALT_FILEPATH_OUT_ENC       "./outputstream.mpg"
#define       FMB_DEFUALT_FILEPATH_IN_DEC        "./inputstream.mpg"
#define       FMB_DEFUALT_FILENAME               "./stream"
#define       FMB_DEFUALT_FILENAME_EXT           ".mpg"

#define       FMB_DEFAULT_INPUT_VIDEO_PID        0x1011
#define       FMB_DEFAULT_INPUT_AUDIO_PID        0x1100
#define       FMB_DEFAULT_INPUT_PMT_PID          0x0100
#define       FMB_DEFAULT_INPUT_SIT_PID          0x001f
#define       FMB_DEFAULT_INPUT_PCR_PID          0x1001
#define       FMB_DEFAULT_OUTPUT_VIDEO_PID       0x1011
#define       FMB_DEFAULT_OUTPUT_AUDIO_PID       0x1100
#define       FMB_DEFAULT_OUTPUT_PMT_PID         0x0100
#define       FMB_DEFAULT_OUTPUT_SIT_PID         0x001f
#define       FMB_DEFAULT_OUTPUT_PCR_PID         0x1001

///< PCI address BAR0
#define       PCI_OUSER_ADDR                     0x80

///< PCI address BAR1
#define       PCI_ENC_IF_CTL_ADDR				 0x1E2010
#define       PCI_ENC_IF_OPT_ADDR				 0x1E2014
#define       PCI_DEC_IF_CTL_ADDR				 0x1E4010
#define       PCI_DEC_IF_OPT_ADDR				 0x1E4014

///< LSI control register
#define       LSI_GPIO_CNT_ADDR                  0x90014
#define       LSI_GPIO_OUT_ADDR                  0x90018

///< VBR max audio bitrate value.
#define       FMB_MAX_AUDIO_BITRATE_VBR          512

///< VBR min audio bitrate value.
#define       FMB_MIN_AUDIO_BITRATE_VBR          128

///< Audio Format menu strings.
#define 	  AUDIO_FMT_UNSUPPORTED_STR          "(unsupported)"
#define 	  AUDIO_FMT_UNSUPPORTED_STR_LEN      14
#define 	  AUDIO_FMT_VALIDCHAR_LEN            8

/**
*   @brief      Bitrate struct data.
*   @note       None
*   @attention  None
*/

struct FMBVideoBitrateParam{
	unsigned short	vRateMode;
	unsigned long	vBitrate;
	unsigned short	vAveBitrate;
	unsigned short	vMinBitrate;
	unsigned short	vMaxBitrate;
	unsigned long	muxRate;
	BOOL			isValid;
};


struct FMBVideoBitrateProp {
	enum	FMBVideoRateCtlEnum	videoRateCtl;			///<Kind of video bitrate control
	enum	FMBBitrateCalcEnum	bitrateCalckind;		///<System bitrate calcurate weither system base or video base.
	int							videoBitrateCbr;		///<Video bitrate in CBR
	int							videoBitrateVbrAverage;	///<Video average bitrate in VBR
	int							videoBitrateVbrPeak;	///<Video peak bitrate in VBR
	int							systemMuxRate;			///<System bitrate
	struct	FMBVideoBitrateParam	videoBitrateParam;	///<Video bitrate parameter(struct data)
};

/**
*   @brief      Property struct data.
*   @note       None
*   @attention  None
*/

struct FMBProperty{
	enum	FMBAudioFormatEnum	audioFmt;				///<Audio Format
	int							audioFmtReload;			///<Audio Format Reload data
	int							audioBitrateCbr[FMB_AUDIO_FORMAT_KIND];		///<Audio average bitrate (kbps)
	int							audioBitrateVbrAverage;	///<Audio average bitrate (kbps)
	int							audioBitrateVbrPeak;	///<Audio peak bitrate ,only use AAC(kbps)
	enum	FMBAudioLpcmEnum	audioLpcm;				///<Audio LPCM
	enum	FMBPortEnum			inputPort;				///<Kind of input port
	enum	FMBPortEnum			outputPort;				///<Kind of output port
	char						inputfile[FMB_FILEPATH_MAX_CHAR];	///<Input file path
	char						outputfile[FMB_FILEPATH_MAX_CHAR];	///<Output file path
	struct	FMBVideoBitrateProp	videoBitrateProp;
	enum	FMBVideoFormatEnum	videoFmt;			///<Kind of video format
	enum	FMBVideoFrameEnum	videoFrm;			///<Kind of video frame
	enum	FMBVideoResolutionEnum	videoRsltn;	///<Kind of video resolution
	enum	FMBVideoScalerEncEnum	videoScalerEnc;		///<Kind of video Scaler enc
	double						speedSlow;				///<play slow speed
	BOOL						isMute;					///<TRUE:Audio-status is mute.  FALSE:Audio-status is not mute.
};


/**
*   @brief      Common property struct data..
*   @note       None
*   @attention  None
*/
struct FMBComProperty{
	enum	FMBFuncModeEnum	setMode;					///<Kind of Mode(enc/dec)
	enum	FMBRequestEnum	currentRequest;				///<Kind of current request
	enum	FMBRequestEnum	lastRequest;				///<Kind of last request
	BOOL					isInternalDecodeStatus;		///<TRUE:Status is decoding.    FALSE:Status is not decoding.
	int						deviceFd;					//<device handle.
	char					devicePath[FMB_DEVNAME_MAX_CHAR];	///<save device path(when application start,devicePath is set(/dev/fjfmb0 or /dev/fjfmb1 etc).)
	char					deviceName[FMB_DEVNAME_MAX_CHAR];	///<save device name(when application start,deviceName is set(fjfmb0 or fjfmb1 etc).)
	enum	FMBTsFormatEnum	tsFormat[FMBEnmTsPacketMax];					///<Kind of TS format(188 ,192,192e)
	enum	FMBStreamSendEndStateEnum	waitStreamSendEnd;		///<wait indication Stream send end
	enum	FMBPidTypeEnum				PidType;					///<Current PID Type	
	enum	FMBTsPacketTypeEnum			TsType;	///<Current TS packet type			
	int									PidValue[FMBEnmPidMax];	///<PID value				
	char					configPath[FMB_FIRMPATH_MAX_CHAR];	///<save config path
	HANDLE					hEmptyScet;
	enum FMBDeviceNumEnum	deviceNum;
	int						fdPipeWrite;
	int						fdPipeRead;
	enum	FMBResultEnum	fmbRc;
};


struct RecvEnv {
	char					*p_devicePath;	///<save device path(when application start,devicePath is set(/dev/fjfmb0 or /dev/fjfmb1 etc).)
	enum FMBDeviceNumEnum	deviceNum;
	int						*p_fdPipeWrite;
	int						*p_fdPipeRead;
};

struct RecvThread {
	struct RecvEnv		t_env;
	pthread_t			thread;
};

struct BootEnv {
	char					driver_ver[FMB_DRIVER_VERSION_LENGTH];
	unsigned short			firm_ver[FMB_VERSION_REG_SIZE / 2];

	char					*p_firmPath;
	unsigned short			*p_firmLSIVer;
	struct fmb_version_info	*p_version_info;
	unsigned long			*p_subSystemId;
	int						*p_deviceFd;
	HANDLE					*p_sceHandle;
	int						*p_fdPipeRead;
};

struct BootThread {
	struct BootEnv		t_env;
	pthread_t			thread;
};

struct StreamThread {
	void*					start_routine;
	unsigned char*			fBuf;
	BOOL					isThread;
	BOOL					isStop;
	BOOL					isForceStop;
	int						fmbfd;
	int						fd;
	unsigned int			streamSize;
	BOOL					isFrameUpdate;
	BOOL					isSeqEnd;
	BOOL					isSystemCmdAck;
	int						fSize;
	int						priority;
	__off64_t				fileStartPos;
	__off64_t				fileEndPos;
	enum FMBDeviceNumEnum	deviceNum;
	int						*p_fdPipeWrite;
};

struct FMBDeviceInfo {
	struct FMBProperty				t_Property_A[FMB_FUNCTION_MODE_NUM];
	struct FMBComProperty			t_ComProperty;
	struct RecvThread				t_RecvThread;
	struct BootThread				t_BootThread;
	struct StreamThread				t_StreamThread_A[FMB_MAX_STREAM];

	int								used;
	BOOL							stateAutoStop;
	unsigned short					firmLSIVer;
	struct fmb_version_info			version_info;
	unsigned long					subSystemId;
	HANDLE							hSceCurrent;		//Scenario executing it now.
};


/**
*   @brief      Information struct data..
*   @note       None
*   @attention  None
*/
struct FMBInfo {
	BOOL					isDeviceSelecting;
	enum FMBDeviceNumEnum	currentDeviceNum;
	enum MMUXDeviceNumEnum  currentMmxuDevNum;
	int						totalCodecChip;
	int						countCodecChip;
	int						totalBorad;
	char					firmPath_A[FMB_FIRMPATH_MAX_CHAR];	///<save farm path			
	struct FMBDeviceInfo	*pt_deviceInfo_A[FMBEnmDeviceMax];
	MmuxHandle				hdMmux_A[MMUXDeviceMax];
};


int FmbInit(struct FMBDeviceInfo *p_DevInfo, enum FMBDeviceNumEnum deviceNum);
void FmbTerminate(struct FMBDeviceInfo *p_DevInfo);
void FmbInitEnc1pic(void);
void FmbInitEnc(void);
void FmbInitDec(void);
void FmbInitDec1pic(void);
void FmbInitStartPause(void);
void FmbStartEnc(void);
void FmbStartEnc1Pic(void);
void FmbStartDecNormal(void);
void FmbStartDec1pic(void);
enum FMBResultEnum FmbStartDecSlow(void);
void FmbStartDecFrameAdvance(void);
void FmbPause(void);
void FmbSetMuteMode(void);
void FmbStop(void);
void FmbDecStopCore(void);
void FmbStop1picDec(void);
void FmbReset(void);
void FmbCancelRequest(void);
BOOL FmbCheckSenario(void);
enum FMBResultEnum FmbStartCommand(char* cmdbuf);
enum FMBResultEnum FmbStartCommandSenario(struct SceTableType* cmdtable);
void FmbApplySettingGpioVideoFormat(void);


int FmbInitInfo(void);
void FmbReleaseInfo(void);
int FmbCreatDevInfoAll(void);
void FmbDellDevInfoAll(void);
int FmbCreatDevInfo( char *p_devicePath );
void FmbDelDevInfo(enum FMBDeviceNumEnum deviceNum);

int FmbGetDeviceTotal(void);
int FmbGetBoardTotal(void);

void FmbEnableDeviceSel(void);
void FmbDisableDeviceSel(void);
BOOL FmbIsNotDeviceSelecting(void);

void FmbSetCurDeviceNum(enum FMBDeviceNumEnum deviceNum);
enum FMBDeviceNumEnum FmbGetCurDeviceNum(void);
enum FMBDeviceNumEnum FmbGetCurDevNumOnBoard(void);

struct FMBDeviceInfo *FmbGetCurDevInfo(void);
struct FMBDeviceInfo *FmbGetDevInfo(enum FMBDeviceNumEnum deviceNum);
struct FMBProperty *FmbGetProperty(enum FMBDeviceNumEnum deviceNum);
struct FMBComProperty *FmbGetComProperty(enum FMBDeviceNumEnum deviceNum);

int FmbGetRecvWtireHd(enum FMBDeviceNumEnum	deviceNum);
int FmbGetRecvReadHd(enum FMBDeviceNumEnum deviceNum);
int FmbGetDeviceHd(enum FMBDeviceNumEnum deviceNum);
HANDLE FmbGetHandSceCurrent(void);
void FmbSetHandSceCurrent(HANDLE hSceCurrent);

enum MMUXDeviceNumEnum FmbGetCurMmuxDevNum(void);
void FmbSetCurMmuxDevNum(enum MMUXDeviceNumEnum deviceNum);
MmuxHandle FmbGetCurMmuxHd(void);
MmuxHandle FmbGetMmuxHd(enum MMUXDeviceNumEnum deviceNum);

enum FMBDeviceNumEnum FmbSetFirstDev(void);
enum FMBDeviceNumEnum FmbSetNextDev(void);
void FmbMultiCall(void (*fun)(void));

void FmbEnableDevUse(enum FMBDeviceNumEnum deviceNum);
void FmbDisableDevUse(enum FMBDeviceNumEnum deviceNum);
void FmbEnableDevUseAll(void);
void FmbDisableDevUseAll(void);
int FmbIsDevUse(enum FMBDeviceNumEnum deviceNum);

enum FMBResultEnum OnFmbMessage(int fd);

//The bitrate-parameter set in the core is actually calculated.
BOOL FmbCalcVideoBitrateParam(struct FMBVideoBitrateProp *p_VidoBitrateProp,
							  enum	FMBVideoFrameEnum	videoFrm,
							  enum	FMBAudioFormatEnum	audioFmt);

void DrvSetIsNotify(HANDLE sceHandle, BOOL isNotify);

inline enum FMBVideoResolutionEnum FmbRsltnMmux2Fmb(enum MMUX_RESOLUTION resolution_Mmux);
void FmbSetVideoFormat(enum FMBVideoResolutionEnum resolution_Fmb, enum FMBFuncModeEnum setmode);
int FmbAutoSetCurVideoFormat(void);


extern struct FMBInfo* const	 gp_FmbInfo;

extern struct FMBDeviceInfo	*gp_FmbDevInfo;
extern struct FMBProperty       *gp_FmbProperty;
extern struct FMBComProperty    *gp_FmbComProperty;


extern const char	*g_FmbNamePort[];			///< Input & Output Port name
extern const char	*g_FmbNameVideoRateCtls[];	///< Video rate control name
extern const char	*g_FmbNameVideoFmts[];		///< Video format name
extern const char	*g_FmbNameAudioFmts[];		///< Audio format name
extern const char	*g_FmbNameVideoFrms[];      ///< Video framerate name
extern const char	*g_FmbNameVideoRsltn[];     ///< Video resolution name
extern const char	*g_FmbNameVideoSclEncs[];   ///< Video scaler encode name
extern const char	*g_FmbNamePacketSize[];		///< Packet size name(H52_ESL-0126)
extern const char	*g_FmbNameTSFormat[];   	///< TS format name
extern const unsigned short	g_FmbGpioVideoFormat[FMBEnmVideoFmtMax][FMBEnmVideoFrmMax];   ///< Video Format GPIO setting
extern const unsigned short	g_FmbInitVideoFormat[FMBEnmVideoFmtMax][FMBEnmVideoFrmMax];   ///< V_FORMAT setting
extern const unsigned short	g_FmbInitVideoIpFormat[FMBEnmVideoFmtMax][FMBEnmVideoFrmMax]; ///< V_IP_FORMAT setting
extern const unsigned short	g_FmbInitVideoSclEnc[FMBEnmVideoFmtMax][FMBEnmVideoSclEncMax]; ///< V_STRM_FORMAT setting
extern const unsigned short	g_FmbVideoEsInfoFormatBD0C[FMBEnmVideoFmtMax][FMBEnmVideoFrmMax];  ///< ES_INFO_0C(BD) setting
extern const unsigned short	g_FmbVideoEsInfoFormatDVB06[FMBEnmVideoFmtMax][FMBEnmVideoFrmMax];  ///< ES_INFO_06(DVB) setting
#endif	//__FMBDEVICE_H_