1 2 /* 3 * Copyright (C) Texas Instruments - http://www.ti.com/ 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Lesser General Public 7 * License as published by the Free Software Foundation; either 8 * version 2.1 of the License, or (at your option) any later version. 9 * 10 * 11 * This library is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * Lesser General Public License for more details. 15 * 16 * 17 * You should have received a copy of the GNU Lesser General Public 18 * License along with this library; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 */ 21 /* ============================================================================= 22 * Texas Instruments OMAP (TM) Platform Software 23 * (c) Copyright Texas Instruments, Incorporated. All Rights Reserved. 24 * 25 * Use of this software is controlled by the terms and conditions found 26 * in the license agreement under which this software has been supplied. 27 * =========================================================================== */ 28 /** 29 * @file OMX_G722Enc_Utils.h 30 * 31 * This header file contains data and function prototypes for G722 ENCODER OMX 32 * 33 * @path $(OMAPSW_MPU)\linux\audio\src\openmax_il\g722_enc\inc 34 * 35 * @rev 0.1 36 */ 37 /* ----------------------------------------------------------------------------- 38 *! 39 *! Revision History 40 *! =================================== 41 *! Date Author(s) Version Description 42 *! --------- ------------------- ------- --------------------------------- 43 *! 08-Mar-2007 A.Donjon 0.1 Code update for G722 ENCODER 44 *! 45 *! 46 * ================================================================================= */ 47 48 49 #include <OMX_Component.h> 50 #include "LCML_DspCodec.h" 51 #include "OMX_G722Encoder.h" 52 53 #define NEWSENDCOMMAND_MEMORY 123 54 /*#endif*/ 55 56 #include <TIDspOmx.h> 57 58 /* ComponentThread constant */ 59 #define EXIT_COMPONENT_THRD 10 60 /* ======================================================================= */ 61 /** 62 * @def G722ENC_XXX_VER Component version 63 */ 64 /* ======================================================================= */ 65 #define G722ENC_MAJOR_VER 1 66 #define G722ENC_MINOR_VER 1 67 68 /* ======================================================================= */ 69 /** 70 * @def NOT_USED Defines a value for "don't care" parameters 71 */ 72 /* ======================================================================= */ 73 #define NOT_USED 10 74 75 /* ======================================================================= */ 76 /** 77 * @def NORMAL_BUFFER Defines the flag value with all flags turned off 78 */ 79 /* ======================================================================= */ 80 #define NORMAL_BUFFER 0 81 82 /* ======================================================================= */ 83 /** 84 * @def OMX_G722ENC_DEFAULT_SEGMENT Default segment ID for the LCML 85 */ 86 /* ======================================================================= */ 87 #define OMX_G722ENC_DEFAULT_SEGMENT (0) 88 89 90 /* ======================================================================= */ 91 /** 92 * @def OMX_G722ENC_SN_TIMEOUT Timeout value for the socket node 93 */ 94 /* ======================================================================= */ 95 #define OMX_G722ENC_SN_TIMEOUT (-1) 96 97 /* ======================================================================= */ 98 /** 99 * @def OMX_G722ENC_SN_PRIORITY Priority for the socket node 100 */ 101 /* ======================================================================= */ 102 #define OMX_G722ENC_SN_PRIORITY (10) 103 104 /* ======================================================================= */ 105 /** 106 * @def G722ENC_TIMEOUT_MILLISECONDS Timeout value for the component thread 107 */ 108 /* ======================================================================= */ 109 #define G722ENC_TIMEOUT_MILLISECONDS (1000) 110 111 /* ======================================================================= */ 112 /** 113 * @def G722ENC_CACHE_ALIGN_MALLOC Value to add to the size needed to 114 * malloc to ensure cache alignment 115 */ 116 /* ======================================================================= */ 117 #define G722ENC_CACHE_ALIGN_MALLOC 256 118 119 /* ======================================================================= */ 120 /** 121 * @def G722ENC_CACHE_ALIGN_OFFSET Value to add to the pointer returned 122 * by malloc to ensure cache alignment 123 */ 124 /* ======================================================================= */ 125 #define G722ENC_CACHE_ALIGN_OFFSET 128 126 127 /* ======================================================================= */ 128 /** 129 * @def G722ENC_MAX_NUM_OF_BUFS Maximum number of buffers 130 */ 131 /* ======================================================================= */ 132 #define G722ENC_MAX_NUM_OF_BUFS 10 133 134 135 /* ======================================================================= */ 136 /** 137 * @def USN_DLL_NAME Path to the USN 138 */ 139 /* ======================================================================= */ 140 #ifdef UNDER_CE 141 #define USN_DLL_NAME "\\windows\\usn.dll64P" 142 #else 143 #define USN_DLL_NAME "usn.dll64P" 144 #endif 145 /* ======================================================================= */ 146 /** 147 * @def G722ENC_DLL_NAME Path to the G722ENC SN 148 */ 149 /* ======================================================================= */ 150 #ifdef UNDER_CE 151 #define G722ENC_DLL_NAME "\\windows\\g722enc_sn.dll64P" 152 #else 153 #define G722ENC_DLL_NAME "g722enc_sn.dll64P" 154 #endif 155 /* ======================================================================= */ 156 /** 157 * @def DONT_CARE Don't care value for the LCML initialization params 158 */ 159 /* ======================================================================= */ 160 #define DONT_CARE 0 161 162 163 /* ======================================================================= */ 164 /** 165 * @def G722ENC_DEBUG Turns debug messaging on and off 166 */ 167 /* ======================================================================= */ 168 #undef G722ENC_DEBUG 169 /*#define G722ENC_DEBUG*/ 170 171 /* ======================================================================= */ 172 /** 173 * @def G722ENC_MEMCHECK Turns memory messaging on and off 174 */ 175 /* ======================================================================= */ 176 #undef G722ENC_MEMCHECK /* try to avoid the time out due to print message */ 177 178 179 /* ======================================================================= */ 180 /** 181 * @def G722ENC_DPRINT Debug print macro 182 */ 183 /* ======================================================================= */ 184 185 #ifndef UNDER_CE /* Linux definitions */ 186 #ifdef G722ENC_DEBUG 187 #define G722ENC_DPRINT(...) fprintf(stdout,__VA_ARGS__) 188 #else 189 #define G722ENC_DPRINT(...) 190 #endif 191 192 #ifdef G722ENC_MEMCHECK 193 #define G722ENC_MEMPRINT(...) fprintf(stdout,__VA_ARGS__) 194 #else 195 #define G722ENC_MEMPRINT(...) 196 #endif 197 198 #else 199 #ifdef G722ENC_DEBUG 200 #define G722ENC_DPRINT(STR, ARG...) printf() 201 #else 202 #endif 203 204 /* ======================================================================= */ 205 /** 206 * @def G722ENC_MEMCHECK Memory print macro 207 */ 208 /* ======================================================================= */ 209 #ifdef G722ENC_MEMCHECK 210 #define G722ENC_MEMPRINT(STR, ARG...) printf() 211 #else 212 #endif 213 #define G722ENC_DPRINT printf 214 #define G722ENC_MEMPRINT printf 215 216 #endif 217 218 #ifdef UNDER_CE 219 220 #ifdef DEBUG 221 #define G722ENC_DPRINT printf 222 #define G722ENC_MEMPRINT printf 223 224 #else 225 #define G722ENC_DPRINT 226 #define G722ENC_MEMPRINT 227 #endif 228 229 #endif 230 231 232 /* ======================================================================= */ 233 /** 234 * @def G722ENC_NUM_OF_PORTS Number of ports 235 */ 236 /* ======================================================================= */ 237 #define G722ENC_NUM_OF_PORTS 2 238 239 /* ======================================================================= */ 240 /** 241 * @def G722ENC_NUM_STREAMS Number of streams 242 */ 243 /* ======================================================================= */ 244 #define G722ENC_NUM_STREAMS 2 245 246 /* ======================================================================= */ 247 /** 248 * @def G722ENC_NUM_INPUT_DASF_BUFFERS Number of input buffers 249 */ 250 /* ======================================================================= */ 251 #define G722ENC_NUM_INPUT_DASF_BUFFERS 2 252 253 254 /* ======================================================================= */ 255 /** 256 * @def G722ENC_AM_DEFAULT_RATE Default audio manager rate 257 */ 258 /* ======================================================================= */ 259 #define G722ENC_AM_DEFAULT_RATE 48000 260 261 /* ======================================================================= */ 262 /** 263 * @def G722ENC_SAMPLE_RATE G722ENC SN sampling frequency 264 */ 265 /* ======================================================================= */ 266 #define G722ENC_SAMPLE_RATE 16000 267 268 /* ======================================================================= */ 269 /** 270 * M A C R O S FOR MALLOC and MEMORY FREE and CLOSING PIPES 271 */ 272 /* ======================================================================= */ 273 274 #define OMX_G722CONF_INIT_STRUCT(_s_, _name_) \ 275 memset((_s_), 0x0, sizeof(_name_)); \ 276 (_s_)->nSize = sizeof(_name_); \ 277 (_s_)->nVersion.s.nVersionMajor = 0x1; \ 278 (_s_)->nVersion.s.nVersionMinor = 0x1; \ 279 (_s_)->nVersion.s.nRevision = 0x0; \ 280 (_s_)->nVersion.s.nStep = 0x0 281 282 #define OMX_G722MEMFREE_STRUCT(_pStruct_) \ 283 if(_pStruct_ != NULL) \ 284 { \ 285 G722ENC_MEMPRINT("%d :: [FREE] %p\n", __LINE__, _pStruct_); \ 286 free(_pStruct_); \ 287 _pStruct_ = NULL; \ 288 } 289 290 #define OMX_G722CLOSE_PIPE(_pStruct_,err) \ 291 G722ENC_DPRINT("%d :: CLOSING PIPE \n", __LINE__); \ 292 err = close (_pStruct_); \ 293 if(0 != err && OMX_ErrorNone == eError) \ 294 { \ 295 eError = OMX_ErrorHardware; \ 296 printf("%d :: Error while closing pipe\n", __LINE__); \ 297 goto EXIT; \ 298 } 299 300 #define OMX_G722MALLOC_STRUCT(_pStruct_, _sName_) \ 301 _pStruct_ = (_sName_*)malloc(sizeof(_sName_)); \ 302 if(_pStruct_ == NULL) \ 303 { \ 304 printf("***********************************\n"); \ 305 printf("%d :: Malloc Failed\n", __LINE__); \ 306 printf("***********************************\n"); \ 307 eError = OMX_ErrorInsufficientResources; \ 308 goto EXIT; \ 309 } \ 310 memset(_pStruct_,0,sizeof(_sName_)); \ 311 G722ENC_MEMPRINT("%d :: [ALLOC] %p\n", __LINE__, _pStruct_); 312 /* ======================================================================= */ 313 /** G722ENC_STREAM_TYPE Values for create phase params 314 * 315 * @param G722ENCSTREAMDMM Indicates DMM 316 * 317 * @param G722ENCSTREAMINPUT Sets input stream 318 * 319 * @param G722ENCSTREAMOUTPUT Sets output stream 320 * 321 */ 322 /* ==================================================================== */ 323 typedef enum { 324 G722ENCSTREAMDMM, 325 G722ENCSTREAMINPUT, 326 G722ENCSTREAMOUTPUT 327 } G722ENC_STREAM_TYPE; 328 329 /* ======================================================================= */ 330 /** IUALG_Cmd Values for create phase params 331 * 332 * @param IULAG_CMD_STOP Socket node stop command 333 * 334 * @param IULAG_CMD_PAUSE Socket node pause command 335 * 336 * @param IULAG_CMD_GETSTATUS Socket node get status command. 337 * 338 * @param IULAG_CMD_SETSTATUS Socket node set status command. 339 * 340 * @param IUALG_CMD_USERCMDSTART Socket node start command. 341 * 342 */ 343 /* ==================================================================== */ 344 typedef enum { 345 IULAG_CMD_STOP = 0, 346 IULAG_CMD_PAUSE = 1, 347 IULAG_CMD_GETSTATUS = 2, 348 IULAG_CMD_SETSTATUS = 3, 349 IUALG_CMD_USERCMDSTART = 100 350 }IUALG_Cmd; 351 352 353 /* ======================================================================= */ 354 /** G722ENC_COMP_PORT_TYPE Port definition for component 355 * 356 * @param G722ENC_INPUT_PORT Index for input port 357 * 358 * @param G722ENC_OUTPUT_PORT Index for output port 359 * 360 */ 361 /* ==================================================================== */ 362 typedef enum G722ENC_COMP_PORT_TYPE { 363 G722ENC_INPUT_PORT = 0, 364 G722ENC_OUTPUT_PORT 365 }G722ENC_COMP_PORT_TYPE; 366 367 368 369 /* =================================================================================== */ 370 /** 371 * Socket node input buffer parameters. 372 */ 373 /* ================================================================================== */ 374 typedef struct G722ENC_UAlgInBufParamStruct { 375 unsigned long bLastBuffer; 376 }G722ENC_UAlgInBufParamStruct; 377 378 /* =================================================================================== */ 379 /** 380 * LCML data header. 381 */ 382 /* ================================================================================== */ 383 typedef struct G722ENC_LCML_BUFHEADERTYPE { 384 OMX_DIRTYPE eDir; 385 OMX_BUFFERHEADERTYPE *pBufHdr; 386 void *pOtherParams[10]; 387 G722ENC_UAlgInBufParamStruct *pIpParam; 388 /*G722ENC_UAlgOutBufParamStruct *pOpParam; */ 389 }G722ENC_LCML_BUFHEADERTYPE; 390 391 392 /* =================================================================================== */ 393 /** 394 * Socket node audio codec parameters 395 */ 396 /* ================================================================================== */ 397 typedef struct G722ENC_AudioCodecParams 398 { 399 unsigned long iSamplingRate; 400 unsigned long iStrmId; 401 unsigned short iAudioFormat; 402 403 }G722ENC_AudioCodecParams; 404 405 /* =================================================================================== */ 406 /** 407 * Structure for buffer list 408 */ 409 /* ================================================================================== */ 410 typedef struct _BUFFERLIST G722ENC_BUFFERLIST; 411 struct _BUFFERLIST{ 412 OMX_BUFFERHEADERTYPE *pBufHdr[G722ENC_MAX_NUM_OF_BUFS]; /* records buffer header send by client */ 413 OMX_U32 bufferOwner[G722ENC_MAX_NUM_OF_BUFS]; 414 OMX_U32 numBuffers; 415 OMX_U32 bBufferPending[G722ENC_MAX_NUM_OF_BUFS]; 416 }; 417 418 /* =================================================================================== */ 419 /** 420 * Component private data 421 */ 422 /* ================================================================================== */ 423 typedef struct G722ENC_COMPONENT_PRIVATE 424 { 425 /** Array of pointers to BUFFERHEADERTYPE structues 426 This pBufHeader[G722ENC_INPUT_PORT] will point to all the 427 BUFFERHEADERTYPE structures related to input port, 428 not just one structure. Same is for output port 429 also. */ 430 OMX_BUFFERHEADERTYPE* pBufHeader[G722ENC_NUM_OF_PORTS]; 431 432 /** Structure of callback pointers */ 433 OMX_CALLBACKTYPE cbInfo; 434 435 /** Handle for use with async callbacks */ 436 OMX_PORT_PARAM_TYPE sPortParam; 437 438 /** Input port parameters */ 439 OMX_AUDIO_PARAM_PORTFORMATTYPE* pInPortFormat; 440 441 /** Output port parameters */ 442 OMX_AUDIO_PARAM_PORTFORMATTYPE* pOutPortFormat; 443 444 /** Keeps track of whether a buffer is owned by the 445 component or by the IL client */ 446 OMX_U32 bIsBufferOwned[G722ENC_NUM_OF_PORTS]; 447 448 /* Audio codec parameters structure */ 449 G722ENC_AudioCodecParams *pParams; 450 451 /** This will contain info like how many buffers 452 are there for input/output ports, their size etc, but not 453 BUFFERHEADERTYPE POINTERS. */ 454 OMX_PARAM_PORTDEFINITIONTYPE* pPortDef[G722ENC_NUM_OF_PORTS]; 455 OMX_AUDIO_PARAM_ADPCMTYPE* g722Params; 456 OMX_AUDIO_PARAM_ADPCMTYPE* pcmParams; 457 OMX_PRIORITYMGMTTYPE* sPriorityMgmt; 458 459 /** This is component handle */ 460 OMX_COMPONENTTYPE* pHandle; 461 462 /** Current state of this component */ 463 OMX_STATETYPE curState; 464 465 /** The component thread handle */ 466 pthread_t ComponentThread; 467 468 /** The pipes for sending buffers to the thread */ 469 int dataPipe[2]; 470 471 /** The pipes for sending command data to the thread */ 472 int cmdDataPipe[2]; 473 474 /** The pipes for sending buffers to the thread */ 475 int cmdPipe[2]; 476 477 /** The pipes for sending buffers to the thread */ 478 int lcml_Pipe[2]; 479 480 /** Set to indicate component is stopping */ 481 OMX_U32 bIsStopping; 482 483 OMX_U32 bIsEOFSent; 484 485 /** Count of number of buffers outstanding with bridge */ 486 OMX_U32 lcml_nIpBuf; 487 488 /** Count of number of buffers outstanding with bridge */ 489 OMX_U32 lcml_nOpBuf; 490 491 /** Count of buffers sent to the LCML */ 492 OMX_U32 lcml_nCntIp; 493 494 /** Count of buffers received from the LCML */ 495 OMX_U32 lcml_nCntOpReceived; 496 497 /** Count of buffers pending from the app */ 498 OMX_U32 app_nBuf; 499 500 /** Flag for DASF mode */ 501 OMX_U32 dasfmode; 502 503 /** Audio Stream ID */ 504 OMX_U32 streamID; 505 506 /** LCML Handle */ 507 OMX_HANDLETYPE pLcmlHandle; 508 509 /** LCML Buffer Header */ 510 G722ENC_LCML_BUFHEADERTYPE *pLcmlBufHeader[2]; 511 512 /** Tee Mode Flag */ 513 OMX_U32 teemode; 514 515 /** Flag set when port definitions are allocated */ 516 OMX_U32 bPortDefsAllocated; 517 518 /** Flag set when component thread is started */ 519 OMX_U32 bCompThreadStarted; 520 521 /** Mark data */ 522 OMX_PTR pMarkData; 523 524 /** Mark buffer */ 525 OMX_MARKTYPE *pMarkBuf; 526 527 /** Mark target component */ 528 OMX_HANDLETYPE hMarkTargetComponent; 529 530 /** Flag set when buffer should not be queued to the DSP */ 531 OMX_U32 bBypassDSP; 532 533 /** Create phase arguments */ 534 OMX_U16 *pCreatePhaseArgs; 535 536 /** Input buffer list */ 537 G722ENC_BUFFERLIST *pInputBufferList; 538 539 /** Output buffer list */ 540 G722ENC_BUFFERLIST *pOutputBufferList; 541 542 /** LCML stream attributes */ 543 LCML_STRMATTR *strmAttr; 544 545 /** Component version */ 546 OMX_U32 nVersion; 547 548 /** LCML Handle */ 549 void *lcml_handle; 550 551 /** Number of initialized input buffers */ 552 int noInitInputBuf; 553 554 /** Number of initialized output buffers */ 555 int noInitOutputBuf; 556 557 /** Flag set when LCML handle is opened */ 558 int bLcmlHandleOpened; 559 560 /** Flag set when initialization params are set */ 561 OMX_U32 bInitParamsInitialized; 562 563 /** Pipe write handle for audio manager */ 564 int fdwrite; 565 566 /** Pipe read handle for audio manager */ 567 int fdread; 568 569 /** Stores input buffers while paused */ 570 OMX_BUFFERHEADERTYPE *pInputBufHdrPending[G722ENC_MAX_NUM_OF_BUFS]; 571 572 /** Number of input buffers received while paused */ 573 OMX_U32 nNumInputBufPending; 574 575 /** Stores output buffers while paused */ 576 OMX_BUFFERHEADERTYPE *pOutputBufHdrPending[G722ENC_MAX_NUM_OF_BUFS]; 577 578 /** Number of output buffers received while paused */ 579 OMX_U32 nNumOutputBufPending; 580 581 /** Keeps track of the number of invalid frames that come from the LCML */ 582 OMX_U32 nInvalidFrameCount; 583 584 /** Flag set when a disable command is pending */ 585 OMX_U32 bDisableCommandPending; 586 587 /** Parameter for pending disable command */ 588 OMX_U32 bDisableCommandParam; 589 590 /** Flag to set when socket node stop callback should not transition 591 component to OMX_StateIdle */ 592 OMX_U32 bNoIdleOnStop; 593 594 /** Flag set when idle command is pending */ 595 OMX_U32 bIdleCommandPending; 596 597 /** Flag set when socket node is stopped */ 598 OMX_U32 bDspStoppedWhileExecuting; 599 600 /** Number of outstanding FillBufferDone() calls */ 601 OMX_U32 nOutStandingFillDones; 602 603 /** Flag set when StrmCtrl has been called */ 604 OMX_U32 bStreamCtrlCalled; 605 606 OMX_PARAM_COMPONENTROLETYPE componentRole; 607 OMX_STRING* sDeviceString; 608 OMX_BOOL bLoadedCommandPending; 609 610 /** Holds the value of RT Mixer mode */ 611 OMX_U32 rtmx; 612 TI_OMX_DSP_DEFINITION tiOmxDspDefinition; 613 614 /* Removing sleep() calls. Definition. */ 615 #ifndef UNDER_CE 616 pthread_mutex_t AlloBuf_mutex; 617 pthread_cond_t AlloBuf_threshold; 618 OMX_U8 AlloBuf_waitingsignal; 619 620 pthread_mutex_t InLoaded_mutex; 621 pthread_cond_t InLoaded_threshold; 622 OMX_U8 InLoaded_readytoidle; 623 624 pthread_mutex_t InIdle_mutex; 625 pthread_cond_t InIdle_threshold; 626 OMX_U8 InIdle_goingtoloaded; 627 #else 628 OMX_Event AlloBuf_event; 629 OMX_U8 AlloBuf_waitingsignal; 630 631 OMX_Event InLoaded_event; 632 OMX_U8 InLoaded_readytoidle; 633 634 OMX_Event InIdle_event; 635 OMX_U8 InIdle_goingtoloaded; 636 #endif 637 638 #ifdef __PERF_INSTRUMENTATION__ 639 PERF_OBJHANDLE pPERF, pPERFcomp; 640 OMX_U32 nLcml_nCntIp; 641 OMX_U32 nLcml_nCntOpReceived; 642 #endif 643 644 /** Keep buffer timestamps **/ 645 OMX_S64 arrTimestamp[G722ENC_MAX_NUM_OF_BUFS]; 646 /** Keep buffer nTickCounts **/ 647 OMX_S64 arrTickCount[G722ENC_MAX_NUM_OF_BUFS]; 648 /** Index to arrTimestamp[], used for input buffer timestamps */ 649 OMX_U8 IpBufindex; 650 /** Index to arrTimestamp[], used for output buffer timestamps */ 651 OMX_U8 OpBufindex; 652 653 654 OMX_BOOL bPreempted; 655 656 } G722ENC_COMPONENT_PRIVATE; 657 658 /* =========================================================== */ 659 /** 660 * OMX_ComponentInit() Initializes component 661 * 662 * 663 * @param hComp OMX Handle 664 * 665 * @return OMX_ErrorNone = Successful 666 * Other error code = fail 667 * 668 */ 669 /*================================================================== */ 670 #ifndef UNDER_CE 671 OMX_ERRORTYPE OMX_ComponentInit (OMX_HANDLETYPE hComp); 672 #else 673 /* WinCE Implicit Export Syntax */ 674 #define OMX_EXPORT __declspec(dllexport) 675 OMX_EXPORT OMX_ERRORTYPE OMX_ComponentInit (OMX_HANDLETYPE hComp); 676 #endif 677 678 /* =========================================================== */ 679 /** 680 * G722ENC_Fill_LCMLInitParams() Fills the parameters needed 681 * to initialize the LCML 682 * 683 * @param pHandle OMX Handle 684 * 685 * @param plcml_Init LCML initialization parameters 686 * 687 * @return OMX_ErrorNone = Successful 688 * Other error code = fail 689 * 690 */ 691 /*================================================================== */ 692 OMX_ERRORTYPE G722ENC_Fill_LCMLInitParams(OMX_HANDLETYPE pHandle, 693 LCML_DSP *plcml_Init); 694 695 /* =========================================================== */ 696 /** 697 * G722ENC_GetBufferDirection() Returns direction of pBufHeader 698 * 699 * @param pBufHeader Buffer header 700 * 701 * @param eDir Buffer direction 702 * 703 * @param pComponentPrivate Component private data 704 * 705 * @return OMX_ErrorNone = Successful 706 * Other error code = fail 707 */ 708 /*================================================================== */ 709 OMX_ERRORTYPE G722ENC_GetBufferDirection(OMX_BUFFERHEADERTYPE *pBufHeader, 710 OMX_DIRTYPE *eDir, 711 G722ENC_COMPONENT_PRIVATE *pComponentPrivate); 712 713 /* =========================================================== */ 714 /** 715 * G722ENC_LCML_Callback() Callback from LCML 716 * 717 * @param event Codec Event 718 * 719 * @param args Arguments from LCML 720 * 721 * @return OMX_ErrorNone = Successful 722 * Other error code = fail 723 */ 724 /*================================================================== */ 725 OMX_ERRORTYPE G722ENC_LCML_Callback (TUsnCodecEvent event,void * args [10]); 726 727 /* =========================================================== */ 728 /** 729 * G722ENC_HandleCommand() Handles commands sent via SendCommand() 730 * 731 * @param pComponentPrivate Component private data 732 * 733 * @return OMX_ErrorNone = Successful 734 * Other error code = fail 735 */ 736 /*================================================================== */ 737 OMX_U32 G722ENC_HandleCommand (G722ENC_COMPONENT_PRIVATE *pComponentPrivate); 738 739 740 /* =========================================================== */ 741 /** 742 * G722ENC_HandleDataBuf_FromApp() Handles data buffers received 743 * from application 744 * 745 * @param pBufHeader Buffer header 746 * 747 * @param pComponentPrivate Component private data 748 * 749 * @return OMX_ErrorNone = Successful 750 * Other error code = fail 751 */ 752 /*================================================================== */ 753 OMX_ERRORTYPE G722ENC_HandleDataBuf_FromApp(OMX_BUFFERHEADERTYPE *pBufHeader, 754 G722ENC_COMPONENT_PRIVATE *pComponentPrivate); 755 756 757 758 /* =========================================================== */ 759 /** 760 * G722ENC_HandleDataBuf_FromLCML() Handles data buffers received 761 * from LCML 762 * 763 * @param pComponentPrivate Component private data 764 * 765 * @return OMX_ErrorNone = Successful 766 * Other error code = fail 767 */ 768 /*================================================================== */ 769 /***** NO LCML ******* 770 OMX_ERRORTYPE G722ENC_HandleDataBuf_FromLCML(G722ENC_COMPONENT_PRIVATE* 771 pComponentPrivate); 772 **********************/ 773 /* =========================================================== */ 774 /** 775 * GetLCMLHandle() 776 * 777 * @param 778 * 779 * @return * 780 */ 781 /*================================================================== */ 782 OMX_HANDLETYPE GetLCMLHandle(); 783 784 785 /* =========================================================== */ 786 /** 787 * G722ENC_GetCorresponding_LCMLHeader() Returns LCML header 788 * that corresponds to the given buffer 789 * 790 * @param pComponentPrivate Component private data 791 * 792 * @return OMX_ErrorNone = Successful 793 * Other error code = fail 794 */ 795 /*================================================================== */ 796 OMX_ERRORTYPE G722ENC_GetCorresponding_LCMLHeader(OMX_U8 *pBuffer, 797 OMX_DIRTYPE eDir, 798 G722ENC_LCML_BUFHEADERTYPE **ppLcmlHdr); 799 800 801 /* =========================================================== */ 802 /** 803 * G722Enc_FreeCompResources() Frees component resources 804 * 805 * @param pComponent OMX Handle 806 * 807 * @return OMX_ErrorNone = Successful 808 * Other error code = fail 809 */ 810 /*================================================================== */ 811 OMX_ERRORTYPE G722Enc_FreeCompResources(OMX_HANDLETYPE pComponent); 812 813 /* =========================================================== */ 814 /** 815 * G722Enc_StartCompThread() Starts component thread 816 * 817 * @param pComponent OMX Handle 818 * 819 * @return OMX_ErrorNone = Successful 820 * Other error code = fail 821 */ 822 /*================================================================== */ 823 OMX_ERRORTYPE G722Enc_StartCompThread(OMX_HANDLETYPE pComponent); 824 825 /* =========================================================== */ 826 /** 827 * G722ENC_GetLCMLHandle() Returns handle to the LCML 828 * 829 * 830 * @return Handle to the LCML 831 */ 832 /*================================================================== */ 833 OMX_HANDLETYPE G722ENC_GetLCMLHandle(); 834 835 836 /* ========================================================================== */ 837 /** 838 * @G722ENC_StopComponentThread() This function is called by the component during 839 * de-init to close component thread. 840 * 841 * @param pComponent handle for this instance of the component 842 * 843 * @pre 844 * 845 * @post 846 * 847 * @return none 848 */ 849 /* ========================================================================== */ 850 OMX_ERRORTYPE G722ENC_StopComponentThread(OMX_HANDLETYPE pComponent); 851 852 /* =========================================================== */ 853 /** 854 * G722ENC_FreeLCMLHandle() Frees the handle to the LCML 855 * 856 * 857 * @return OMX_ErrorNone = Successful 858 * Other error code = fail 859 */ 860 /*================================================================== */ 861 OMX_ERRORTYPE G722ENC_FreeLCMLHandle(); 862 863 864 /* =========================================================== */ 865 /** 866 * G722ENC_CleanupInitParams() Starts component thread 867 * 868 * @param pComponent OMX Handle 869 * 870 * @return OMX_ErrorNone = Successful 871 * Other error code = fail 872 */ 873 /*================================================================== */ 874 OMX_ERRORTYPE G722ENC_CleanupInitParams(OMX_HANDLETYPE pComponent); 875 876 877 /* =========================================================== */ 878 /** 879 * G722ENC_CommandToIdle() Called when the component is commanded 880 * to idle 881 * 882 * @param pComponentPrivate Component private data 883 * 884 * @return OMX_ErrorNone = Successful 885 * Other error code = fail 886 */ 887 /*================================================================== */ 888 OMX_ERRORTYPE G722ENC_CommandToIdle(G722ENC_COMPONENT_PRIVATE *pComponentPrivate); 889 890 /* =========================================================== */ 891 /** 892 * G722ENC_CommandToIdle() Called when the component is commanded 893 * to idle 894 * 895 * @param pComponentPrivate Component private data 896 * 897 * @return OMX_ErrorNone = Successful 898 * Other error code = fail 899 */ 900 /*================================================================== */ 901 OMX_ERRORTYPE G722ENC_CommandToLoaded(G722ENC_COMPONENT_PRIVATE *pComponentPrivate); 902 903 /* =========================================================== */ 904 /** 905 * G722ENC_CommandToExecuting() Called when the component is commanded 906 * to executing 907 * 908 * @param pComponentPrivate Component private data 909 * 910 * @return OMX_ErrorNone = Successful 911 * Other error code = fail 912 */ 913 /*================================================================== */ 914 OMX_ERRORTYPE G722ENC_CommandToExecuting(G722ENC_COMPONENT_PRIVATE *pComponentPrivate); 915 916 /* =========================================================== */ 917 /** 918 * G722ENC_CommandToPause() Called when the component is commanded 919 * to paused 920 * 921 * @param pComponentPrivate Component private data 922 * 923 * @return OMX_ErrorNone = Successful 924 * Other error code = fail 925 */ 926 /*================================================================== */ 927 OMX_ERRORTYPE G722ENC_CommandToPause(G722ENC_COMPONENT_PRIVATE *pComponentPrivate); 928 929 /* =========================================================== */ 930 /** 931 * G722ENC_CommandToWaitForResources() Called when the component is commanded 932 * to WaitForResources 933 * 934 * @param pComponentPrivate Component private data 935 * 936 * @return OMX_ErrorNone = Successful 937 * Other error code = fail 938 */ 939 /*================================================================== */ 940 OMX_ERRORTYPE G722ENC_CommandToWaitForResources(G722ENC_COMPONENT_PRIVATE *pComponentPrivate); 941 942 /* =========================================================== */ 943 /** 944 * G722ENC_SetPending() Called when the component queues a buffer 945 * to the LCML 946 * 947 * @param pComponentPrivate Component private data 948 * 949 * @param pBufHdr Buffer header 950 * 951 * @param eDir Direction of the buffer 952 * 953 * @return None 954 */ 955 /*================================================================== */ 956 void G722ENC_SetPending(G722ENC_COMPONENT_PRIVATE *pComponentPrivate, OMX_BUFFERHEADERTYPE *pBufHdr, OMX_DIRTYPE eDir); 957 958 /* =========================================================== */ 959 /** 960 * G722ENC_ClearPending() Called when a buffer is returned 961 * from the LCML 962 * 963 * @param pComponentPrivate Component private data 964 * 965 * @param pBufHdr Buffer header 966 * 967 * @param eDir Direction of the buffer 968 * 969 * @return None 970 */ 971 /*================================================================== */ 972 void G722ENC_ClearPending(G722ENC_COMPONENT_PRIVATE *pComponentPrivate, OMX_BUFFERHEADERTYPE *pBufHdr, OMX_DIRTYPE eDir) ; 973 974 /* =========================================================== */ 975 /** 976 * G722ENC_IsPending() Returns the status of a buffer 977 * 978 * @param pComponentPrivate Component private data 979 * 980 * @param pBufHdr Buffer header 981 * 982 * @param eDir Direction of the buffer 983 * 984 * @return None 985 */ 986 /*================================================================== */ 987 OMX_U32 G722ENC_IsPending(G722ENC_COMPONENT_PRIVATE *pComponentPrivate, OMX_BUFFERHEADERTYPE *pBufHdr, OMX_DIRTYPE eDir); 988 989 /* =========================================================== */ 990 /** 991 * G722ENC_Fill_LCMLInitParamsEx() Fills the parameters needed 992 * to initialize the LCML without recreating the socket node 993 * 994 * @param pComponent OMX Handle 995 * 996 * @return None 997 */ 998 /*================================================================== */ 999 OMX_ERRORTYPE G722ENC_Fill_LCMLInitParamsEx(OMX_HANDLETYPE pComponent); 1000 1001 /* =========================================================== */ 1002 /** 1003 * G722ENC_IsValid() Returns whether the buffer is a valid buffer 1004 * 1005 * @param pComponentPrivate Component private data 1006 * 1007 * @param pBuffer Buffer 1008 * 1009 * @param eDir Direction of the buffer 1010 * 1011 * @return None 1012 */ 1013 /*================================================================== */ 1014 OMX_U32 G722ENC_IsValid(G722ENC_COMPONENT_PRIVATE *pComponentPrivate, OMX_U8 *pBuffer, OMX_DIRTYPE eDir) ; 1015 1016 /* =========================================================== */ 1017 /** 1018 * G722ENC_TransitionToIdle() Transitions component to idle 1019 * 1020 * 1021 * @param pComponentPrivate Component private data 1022 * 1023 * @return OMX_ErrorNone = No error 1024 * OMX Error code = Error 1025 */ 1026 /*================================================================== */ 1027 OMX_ERRORTYPE G722ENC_TransitionToIdle(G722ENC_COMPONENT_PRIVATE *pComponentPrivate); 1028 1029 1030 /*void printEmmEvent (TUsnCodecEvent event);*/ 1031