zmf_video.h 25.9 KB
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 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854
#ifndef __ZMF_VIDEO_H__
#define __ZMF_VIDEO_H__

/**
 * @file zmf_video.h
 * @brief ZMF video interfaces
 */

#ifdef __cplusplus
extern "C" {
#endif

/**
 * @brief Initialize Video module of ZMF(Zero Media Framework).
 * @param  applicationContext For Windows, it can be the handle of the window,
 *                            The notification event will be sent to that window.
 *                            Or it can be callback function of type ZmfEventListenCallback.
 *                            For Android, it must be the Context.
 *                            For iOS, it should be NULL and is ignored.
 * @return                    0 on succeed, otherwise failed.
 */
int Zmf_VideoInitialize(void *applicationContext);

/**
 * @brief Destroy Video module of ZMF module. All resources will be released.
 * @return  0 on succeed, otherwise failed.
 */
int Zmf_VideoTerminate (void);

#ifdef __cplusplus
}
#endif /* __cplusplus */

/**
 * @brief Face direction of capture device.
 */
typedef enum {
    ZmfVideoFaceUnknown             = 0, /**< @brief Facing unknown. */
    ZmfVideoFaceFront               = 1, /**< @brief Facing front. */
    ZmfVideoFaceBack                = 2, /**< @brief Facing back. */
} ZmfVideoFaceType;

/**
 * @brief Coordinate rotation angle.
 */
typedef enum {
    ZmfRotationAngle0               = 0, /**< @brief 0 degree. */
    ZmfRotationAngle90              = 90, /**< @brief 90 degrees CCW. */
    ZmfRotationAngle180             = 180, /**< @brief 180 degrees CCW. */
    ZmfRotationAngle270             = 270, /**< @brief 270 degrees CCW. */
} ZmfRotationAngle;

/**
 * @brief Mirror type.
 */
typedef enum {
    ZmfMirrorNone                   = 0,
    ZmfMirrorHorizontal             = 1, /**< @brief Horizontal mirror. */ 
    ZmfMirrorVertical               = 2, /**< @brief Vertical mirror. */
    ZmfMirrorFlipFromLeft           = 4, /**< @brief Auto selection animation only supported on ios. */
    ZmfMirrorFlipFromTop            = 8, /**< @brief Auto selection, animation only supported on ios. */
    ZmfMirrorAuto                   = ZmfMirrorFlipFromLeft|ZmfMirrorFlipFromTop, /**< @brief Auto selection */
} ZmfMirrorType;

/**
 * @brief Built-in Render Effect type.
 */
typedef enum {
    ZmfRenderEffectNone             = 0, /**< @brief none effect. */
    /** Blur effect,
     *  JSON params:
     *   "hoffset": number of width pixel offset, default is 2
     *   "voffset": number of height pixel offset, defualt is 2
     *   "iterate": number of repetitions, default is 3
     *    "pixels": number of the blur radius 
    *      "sigma":
     */
    ZmfRenderEffectBlur             = 1,
    ZmfRenderEffectGrey             = 2, /**< @brief grey. */
    ZmfRenderEffectMask             = 3, /**< @brief mask. */
    /** Magnifier effect,
     *  JSON params:
     *    "dx": translation width offset relative to magnifier center x
     *    "dy": translation height offset relative to magnifier center y
     *     "x": width coordinate of magnifier center, range from 0 to 1
     *     "y": height coordinate of magnifier center, range from 0 to 1
     *  "zoom": zoom parameter, default is 2
     *"radius": number of radius, relative to min(width, height), default is 0.2
     */
    ZmfRenderEffectMagnifier        = 4,
    ZmfRenderEffectOldTime          = 5,
    ZmfRenderEffectPhotoVerse       = 6,
    ZmfRenderEffectLomo             = 7,
    /** Blur effect,
     *  JSON params:
     *   "hoffset": number of width pixel offset, default is 2
     *   "voffset": number of height pixel offset, defualt is 2
     *   "iterate": number of repetitions, default is 3
     *    "pixels": number of the blur radius 
    *      "sigma":
     *         "x": number of center
     *         "y": number of center
     *    "radius": number of radius, ratio of min(w,h), default is 0.2
     *       "exp": number of alpha exp, default is 1.0
     */
    ZmfRenderEffectDepthOfField     = 8,
} ZmfRenderEffectType;

typedef enum {
    ZmfRenderMatchNone              = 0,
    /** 
     * JSON param:
     *  "epsilon":
     * "duration":
     * "position":
     *     "fovy":
     * "attitude":
     */
    ZmfRenderMatchAttitude          = 1,
    ZmfRenderMatchLight             = 2,
    /** 
     * JSON param:
     *  "timestamp":
     *     "action":"ResetEffect"
     */
    ZmfRenderMatchTimeStamp         = 3,
} ZmfRenderMatchType;

typedef enum {
    ZmfRenderView,
    ZmfRenderViewFx,
    ZmfRenderImmersive,
    ZmfRenderImmersiveFx
} ZmfRenderType;

/**
 * @brief Built-in Capture Effect.
 */
typedef int ZmfCaptureEffectType;
enum {
    ZmfCaptureEffectNone             = 0, /**< @brief none effect. */
    /** 
     * option JSON param:
     *      "fps":  the minimum FPS
     * "exposure":  the percent(0-100]
     */
    ZmfCaptureSmartExposure          = 1,
    ZmfCaptureGammaCorrection        = 2,
    ZmfCaptureContrastEnhance        = 4,
    ZmfCaptureFaceEnhance            = 8,
};

/**
 * @brief Video source type.
 */
typedef enum {
    ZmfVideoSourcePeer              = 0, /**< @brief Image is from peer. */
    ZmfVideoSourceCapture           = 1, /**< @brief Image is from capture device. */
    ZmfVideoSourceFile              = 2, /**< @brief Image is from file. */
} ZmfVideoSourceType;

/**
 * @brief Video render mode.
 */
typedef enum {
    /**
     * @brief Auto selection mode.
     *
     * When the aspect of image and render area is matched, it act as 
     * @ref ZmfRenderFullScreen. Otherwise, it act as @ref ZmfRenderFullContent.
     * IOS platform will resize the window, other won't
     */
    ZmfRenderAuto                   = 0,

    /** like ZmfRenderAuto, but high accuracy, only ios supported */
    ZmfRenderMatch                  = 4,

    /**
     * @brief Scale image to fill the entire render area, and remain the aspect
     * ratio unchanged.
     */
    ZmfRenderFullScreen             = 1,

    /**
     * @brief Scale image to display all content in render area, and remain the
     * aspect ratio unchanged.
     */
    ZmfRenderFullContent            = 2,

    /**
     * @brief Auto selection mode, like ZmfRenderAuto, but not resize the window
     *
     * When the aspect of image and render area is matched, it act as 
     * @ref ZmfRenderFullScreen. Otherwise, it act as @ref ZmfRenderFullContent.
     *
     */
    ZmfRenderFullAuto               = 3,

} ZmfRenderMode;

#ifdef __OBJC__

#import <UIKit/UIKit.h>
@interface ZmfView : UIView
@end

/**
 * @defgroup ZmfVideoDeviceId Video Device ID
 * @{
 */

/** @brief Capture device ID string for rear camera. */
extern const char * ZmfVideoCaptureBack;

/** @brief Capture device ID string for front camera. */
extern const char * ZmfVideoCaptureFront;

/**
 * @}
 */

/**
 * @defgroup ZmfVideoNotificationParameters Video Notification Parameters.
 * @{
 */

/**
 * @brief An NSString object containing a string that identifies
 * ID of video capture device.
 */
extern NSString * const ZmfCapture;

/**
 * @brief An NSNumber object containing an integer that identifies
 * the facing type of capture device.
 * For a list of possible values, @ref ZmfVideoFaceType.
 */
extern NSString * const ZmfFace;

/**
 * @brief An NSNumber object containing an integer that identifies
 * the width in pixel.
 */
extern NSString * const ZmfWidth;

/**
 * @brief An NSNumber object containing an integer that identifies
 * the height in pixel.
 */
extern NSString * const ZmfHeight;

/**
 * @brief An NSString object containing an integer that identifies
 * the render source.
 */
extern NSString * const ZmfRender;

/**
 * @brief An NSNumber object containing an integer that identifies
 * the render source type.
 * For a list of possible values, @ref ZmfVideoSourceType.
 */
extern NSString * const ZmfSourceType;

/**
 * @brief An NSNumber object containing an integer that identifies
 * the handle of render window.
 */
extern NSString * const ZmfWindow;

/**
 * @brief An NSNumber object containing an integer that identifies
 * the frame rate in fps.
 */
extern NSString * const ZmfFrameRate;


/**
 * @brief A NSNumber containing a boolean that identifies
 * the exposure state.
 */
extern NSString * const ZmfExposure;

/**
 * @brief An NSString object containing a string that describes error.
 * the format match 'camera <id>|render <id>|video: <reason>'.
 */
extern NSString * const ZmfVideoError;

/**
 * @brief An NSNumber object containing an integer that identifies
 * the matching.
 */
extern NSString * const ZmfMatching;

/**
 * @}
 */

/**
 * @defgroup ZmfVideoNotifications Video Notifications.
 * @{
 */

/**
 * @brief Post when the ZMF module request to start capture video data.
 *
 * The userInfo dictionary of this notification contains @ref ZmfCapture,
 * @ref ZmfWidth, @ref ZmfHeight and @ref ZmfFrameRate, which provide detail 
 * information for the request.
 */
extern NSString * const ZmfVideoCaptureRequestStart;

/**
 * @brief Post when the ZMF module request to change video capture parameters.
 *
 * The userInfo dictionary of this notification contains @ref ZmfCapture,
 * @ref ZmfWidth, @ref ZmfHeight and @ref ZmfFrameRate, which provide detail 
 * information for the request.
 */
extern NSString * const ZmfVideoCaptureRequestChange;

/**
 * @brief Post when the ZMF module request to stop capture.
 *
 * The userInfo dictionary of this notification contains @ref ZmfCapture,
 * which provide detail information for the request.
 */
extern NSString * const ZmfVideoCaptureRequestStop;

/**
 * @brief Post when the ZMF module has received first video data after
 * @ref Zmf_VideoCaptureStart invoked.
 *
 * The userInfo dictionary of this notification contains @ref ZmfCapture,
 * @ref ZmfFace, @ref ZmfWidth, and @ref ZmfHeight, 
 * which indicate the actual parameters of the video data captured.
 */
extern NSString * const ZmfVideoCaptureDidStart;

/**
 * @brief Post when the ZMF module video capture status changed.
 * The userInfo dictionary contains the info of ZmfExposure
 */
extern NSString * const ZmfVideoCaptureStatus;

/**
 * @brief Post when the ZMF module request to start rendering video data.
 *
 * The userInfo dictionary of this notification contains @ref ZmfRender.
 */
extern NSString * const ZmfVideoRenderRequestAdd;

/**
 * @brief Post when the ZMF module has received the first image after
 * @ref Zmf_VideoRenderAdd invoked.
 */
extern NSString * const ZmfVideoRenderDidReceive;

/**
 * @brief Post when the ZMF module has delivered the first image to render after
 * @ref Zmf_VideoRenderStart and  @ref Zmf_VideoRenderAdd invoked.
 */
extern NSString * const ZmfVideoRenderDidStart;

/**
 * @brief Post when the rendering image size has changed.
 *
 * The userInfo dictionary of this notification contains @ref ZmfRender,
 * @ref ZmfWindow, @ref ZmfWidth and @ref ZmfHeight.
 */
extern NSString * const ZmfVideoRenderDidResize;

/**
 * @brief Post when the ZMF module has stop rendering video data.
 *
 * The userInfo dictionary of this notification contains @ref ZmfRender,
 * @ref ZmfWindow.
 */
extern NSString * const ZmfVideoRenderRequestRemove;

/**
 * @brief Post when the ZMF module has matched rendering video data.
 *
 * The userInfo dictionary of this notification contains @ref ZmfRender,
 * @ref ZmfWindow, and @ref ZmfMatching
 */
extern NSString * const ZmfVideoRenderDidMatch;

/**
 * @}
 */

#endif /* __OBJC__ */

#ifdef _WIN32

/**
 * @brief Event number for video notifications.
 *
 * The wParam of the event is the type of notification.
 * For a list of possible values, @ref ZmfVideoEventType.
 *
 * The lParam of the event may contain a JSON object which depends on the
 * type of notification.
 */
#define ZmfVideoEvent                   ZmfAudioEvent + 10

/**
 * @defgroup ZmfVideoNotificationParameters Video Notification Parameters.
 * @{
 */

/**
 * @brief A String object containing an string that identifies
 * ID of video capture device.
 */
#define ZmfCapture "Capture"

/**
 * @brief A Number object containing an integer that identifies
 * the facing type of capture device.
 * For a list of possible values, @ref ZmfVideoFaceType.
 */
#define ZmfFace "Face"

/**
 * @brief A Number object containing an integer that identifies
 * the width in pixel.
 */
#define ZmfWidth "Width"

/**
 * @brief A Number object containing an integer that identifies
 * the height in pixel.
 */
#define ZmfHeight "Height"

/**
 * @brief A String object containing a string that identifies
 * the unique render name.
 * 
 */
#define ZmfRender "Render"

/**
 * @brief A Number object containing an integer that identifies
 * the render source type.
 *
 * @ref ZmfVideoSourceType.
 */
#define ZmfSourceType "SourceType"

/**
 * @brief A Number object containing an integer that identifies
 * the handle of render window.
 */
#define ZmfWindow "Window"

/**
 * @brief A Number object containing an integer that identifies
 * the frame rate in fps.
 */
#define ZmfFrameRate "FrameRate"

/**
 * @brief A Number containing a boolean that identifies
 * the exposure state.
 */
#define ZmfExposure "Exposure"

/**
 * @brief A String object containing a string that describes error.
 * the format match 'camera <id>|render <id>|video: <reason>'.
 */
#define ZmfVideoError "VideoError"

/**
 * @brief A number object containing an integer that identifies
 * the matching.
 */
#define ZmfMatching "Matching"

/**
 * @}
 */

/**
 * @brief Type of video notifications.
 */
typedef enum  {
    /**
     * @brief Post when the ZMF module request to start capture video data.
     *
     * The lParam of this event is a JSON object contains @ref ZmfCapture,
     * @ref ZmfWidth, @ref ZmfHeight and @ref ZmfFrameRate, which provide detail 
     * information for the request.
     */
    ZmfVideoCaptureRequestStart         = 20,

    /**
     * @brief Post when the ZMF module request to change capture video data.
     *
     * The lParam of this event is a JSON object contains @ref ZmfCapture,
     * @ref ZmfWidth, @ref ZmfHeight and @ref ZmfFrameRate, which provide detail 
     * information for the request.
     */
    ZmfVideoCaptureRequestChange        = 30,

    /**
     * @brief Post when the ZMF module request to stop capture.
     *
     * The lParam of this event is a JSON object contains @ref ZmfCapture,
     * which provide detail information for the request.
     */
    ZmfVideoCaptureRequestStop          = 21,

    /**
     * @brief Post when the ZMF module has received first video data after
     * @ref Zmf_VideoCaptureStart invoked.
     *
     * The lParam of this event is a JSON object contains @ref ZmfCapture,
     * @ref ZmfFace, @ref ZmfWidth, and @ref ZmfHeight,
     * which indicate the actual parameters of the video data captured.
     */
    ZmfVideoCaptureDidStart            = 22,

    /**
     * @brief Post when the ZMF module video capture status changed.
     * The userInfo dictionary contains the info of ZmfExposure
     */
    ZmfVideoCaptureStatus              = 33,

    /**
     * @brief Post when the ZMF module request to start rendering video data.
     *
     * The lParam of this event is a JSON object contains @ref ZmfRender,
     * @ref ZmfWidth and @ref ZmfHeight.
     */
    ZmfVideoRenderRequestAdd            = 25,

    /**
     * @brief Post when the ZMF module has received the first image after
     * @ref Zmf_VideoRenderAdd invoked.
     */
    ZmfVideoRenderDidReceive            = 26,

    /**
     * @brief Post when the first image has delivery to render after
     * @ref Zmf_VideoRenderStart and @ref Zmf_VideoRenderAdd invoked.
     */
    ZmfVideoRenderDidStart              = 27,

    /**
     * @brief Post when the rendering image size has changed.
     *
     * The lParam of this event is a JSON object contains @ref ZmfRender,
     * @ref ZmfWindow, @ref ZmfWidth and @ref ZmfHeight.
     */
    ZmfVideoRenderDidResize             = 28,

    /**
     * @brief Post when the ZMF module request to stop rendering video data.
     *
     * The lParam of this event is a JSON object contains @ref ZmfRender,
     * @ref ZmfWindow
     */
    ZmfVideoRenderRequestRemove         = 29,

    /** @brief Post when the ZMF Video module has an error occurred.
     *
     * The lParam of this event is a JSON object contains @ref ZmfVideoError
     */
    ZmfVideoErrorOccurred               = 31,

    /** @brief Post when the ZMF module render matching.
     *
     * The lParam of this event is a JSON object contains @ref ZmfRender,
     * @ref ZmfWindow, and @ref ZmfMatching
     */
    ZmfVideoRenderDidMatch              = 32,

} ZmfVideoEventType;

#endif /* _WIN32 */

#ifdef __cplusplus
extern "C" {
#endif
/** deprecated, use Zmf_CameraGetCount */
#define Zmf_VideoCaptureGetCount Zmf_CameraGetCount
/** deprecated, use Zmf_CameraGetName */
#define Zmf_VideoCaptureGetName Zmf_CameraGetName
/**
 * @brief Get count of video capture devices.
 * @return  The total count of video capture devices.
 */
int Zmf_CameraGetCount (void);

/**
* @brief Get count of Desktop devices, only supported on Windows
* @return  The total count of video capture devices.
*/
int Zmf_DesktopGetCount(void);

/**
* @brief Get count of Windows, only supported on Windows
* @return  The total count of video capture devices.
*/
int Zmf_WindowGetCount(void);

/**
 * @brief Get the name of specific capture device.
 * @param  iIndex    The index of capture device, from 0 to count - 1.
 * @param  acId      Pointer the buffer contains unique name utf8 string.
 * @param  acName    Pointer the buffer contains friendly name utf8 string.
 * @return        0  on succeed, otherwise failed.
 */
int Zmf_CameraGetName (int iIndex, char acId[512], char acName[512]);

/**
* @brief Get the name of specific desktop device, only supported on Windows
* @param  iIndex    The index of capture device, from 0 to count - 1.
* @param  acId      Pointer the buffer contains unique name utf8 string.
* @param  acName    Pointer the buffer contains friendly name utf8 string.
* @return        0  on succeed, otherwise failed.
*/
int Zmf_DesktopGetName(int iIndex, char acId[512], char acName[512]);

/**
* @brief Get the name of specific windows, only supported on Windows
* @param  iIndex    The index of capture device, from 0 to count - 1.
* @param  acId      Pointer the buffer contains unique name utf8 string.
* @param  acName    Pointer the buffer contains friendly name utf8 string.
* @return        0  on succeed, otherwise failed.
*/
int Zmf_WindowGetName(int iIndex, char acId[512], char acName[512]);

/**
 * @brief Get the face and angle of specific capture device.
 * @param  pcId      The ID of capture device.
 * @param  piFace    Capture device face @ref ZmfVideoFaceType
 * @param  piAngle   Capture device angle @ref ZmfRotationAngle
 * @return  orient angle >0 on succeed, otherwise failed.
 */
int Zmf_VideoCaptureGetOrient (const char *pcId, int *piFace, int *piAngle);

/**
 * @brief Start running video capture device.
 * @param  pcId       The ID of capture device.
 * @param  iWidth     The captured image width in pixel, 0 for auto selection.
 * @param  iHeight    The captured image height in pixel, 0 for auto selection.
 * @param  iFrameRate The captured frame rate in fps, 0 for auto selection.
 * @return          0 on succeed, otherwise failed.
 */
int Zmf_VideoCaptureStart (const char *pcId, int iWidth, int iHeight, int iFrameRate);

/**
 * @brief rotate the image from the capture device
 * @param  pcId       The ID of capture device.
 * @param  enAngle    The rotation angle, @ref ZmfRotationAngle.
 * @return       0 on succeed, otherwise failed.
 */
int Zmf_VideoCaptureRotate (const char *pcId, ZmfRotationAngle enAngle);

/**
 * @brief Set the face of specific capture device.
 * @param  pcId      The ID of capture device.
 * @param  iFace     Capture device face @ref ZmfVideoFaceType
 * @return  0 on succeed, otherwise failed.
 */
int Zmf_VideoCaptureFace (const char *pcId, int iFace);

/**
 * @brief Listens device rotation event automatically, or in response to rotation angle fixture
 * @param bEnable     whether Listens event or fixed angle
 * @param fixedDeviceAngle  if bEnable is false, this is fixed angle
 * @return       0 on succeed, otherwise failed.
 */
int Zmf_VideoCaptureEnableRotation(int bEnable, int fixedDeviceAngle);

/**
 * @brief Set screen orientation (window coordinates),
 *        affects Zmf_VideoCaptureGetOrient
 * @return 0 on succeed, otherwise failed.
 */
int Zmf_VideoCaptureSetScreenOrientation(int screenOrient);

/**
 * @brief Set the effect type of specific capture.
 * @param  enEffectType  Effect type, @ref ZmfCaptureEffectType
 * @param  strJson  Effect param, json string
 * @return 0 on succeed, otherwise failed.
 */
int Zmf_VideoCaptureEffect (ZmfCaptureEffectType enEffectType, const char* strJson);

/**
 * @brief Stop running video capture device.
 * @param  pcId      The ID of capture device.
 * @return  0        on succeed, otherwise failed.
 */
int Zmf_VideoCaptureStop (const char *pcId);

/**
 * @brief Stop all running video capture devices.
 * @return  0 on succeed, otherwise failed.
 */
int Zmf_VideoCaptureStopAll (void);

/**
 * @brief Initialize resource and start render on specific window.
 * @param  pWnd   The handle of window to render on.
 * @return      0 on succeed, otherwise failed.
 */
int Zmf_VideoRenderStart (void *pWnd, ZmfRenderType enRenderType);

/**
 * @brief Stop render and destroy resource.
 * @param  pWnd The handle of window to render on.
 * @return    0 on succeed, otherwise failed.
 */
int Zmf_VideoRenderStop (void *pWnd);

/**
 * @brief Attach render source to specific window.
 * @param  pWnd    The handle of window to render on.
 * @param  renderId The render source notified by @ref ZmfVideoRenderRequestAdd.
 * @param  iOrder  The Z-Order value render source. It must assign different
 *                 value for each render source. Render with larger value
 *                 overlapped on render with smaller value.
 * @param  enMode  Render mode, @ref ZmfRenderMode.
 * @return       0 on succeed, otherwise failed.
 */
int Zmf_VideoRenderAdd (void *pWnd, const char* renderId, int iOrder, ZmfRenderMode enMode);

/**
 * @brief replace render oldRenderId with newRenderId
 * @param  pWnd    The handle of window to render on.
 * @param  oldRenderId The current render id, used by @ref Zmf_VideoRenderAdd.
 * @param  newRenderId The new render id
 */
int Zmf_VideoRenderReplace(void *pWnd, const char* oldRenderId, const char *newRenderId);

/**
 * @brief Take an snapshot of video render.
 * @param  renderId  The render source notified by @ref ZmfVideoRenderRequestAdd.
 * @param  iWidth    The file image width in pixel, -1 keep origin.
 * @param  iHeight   The file image height in pixel, -1 keep origin.
 * @param  jpgFileName  The file path name.
 * @return 0 on succeed, otherwise failed.
 */
int Zmf_VideoRenderSnapshot(const char *renderId, int iWidth, int iHeight, const char *jpgFileName);

/**
 * @brief Detach render source from specific window.
 * @param  pWnd    The handle of window.
 * @param  renderId The render source used by @ref Zmf_VideoRenderAdd.
 * @return       0 on succeed, otherwise failed.
 */
int Zmf_VideoRenderRemove (void *pWnd, const char* renderId);

/**
 * @brief Detach all render sources from specific window.
 * @param  pWnd    The handle of window.
 * @return       0 on succeed, otherwise failed.
 */
int Zmf_VideoRenderRemoveAll(void *pWnd);

/**
 * @brief Move render area of specific render source.
 * 
 * The origin of coordination is the top left point of window.
 * X-axis positive direction is from left to right.
 * Y-axis positive direction is from top to bottom.
 * The valid range is from 0.0 to 1.0.
 * 
 * @param  pWnd    The handle of window.
 * @param  renderId The render source.
 * @param  fLeft   The X position of top left point of render area.
 *                 Default is 0.0.
 * @param  fTop    The Y position of top left point of render area.
 *                 Default is 0.0.
 * @param  fRight  The X position of right bottom point of render area.
 *                 Default is 1.0.
 * @param  fBottom The Y position of right bottom point of render area.
 *                 Default is 1.0.
 * @return       0 on succeed, otherwise failed.
 */
int Zmf_VideoRenderMove (void *pWnd, const char* renderId, float fLeft, float fTop,
                         float fRight, float fBottom);

/**
 * @brief Set the mirror type of specific render source.
 * @param  pWnd    The handle of window.
 * @param  renderId The render source.
 * @param  enType  Mirror type, @ref ZmfMirrorType
 * @return       0 on succeed, otherwise failed.
 */
int Zmf_VideoRenderMirror (void *pWnd, const char* renderId, ZmfMirrorType enType);


/**
 * @brief  Set whether continuously update or freeze of specific render source.
 * @param  pWnd     The handle of window.
 * @param  renderId The render source.
 * @param  bEnable  boolean value
 * @return        0 on succeed, otherwise failed.
 */
int Zmf_VideoRenderFreeze (void *pWnd, const char* renderId, int bEnable);

/**
 * @brief Set coordination rotation angle according to the coordination
 * of the window.
 * @param  pWnd    The handle of window.
 * @param  enAngle The rotation angle, @ref ZmfRotationAngle.
 * @return       0 on succeed, otherwise failed.
 */
int Zmf_VideoRenderRotate (void *pWnd, ZmfRotationAngle enAngle);

/**
 * @brief Set the effect type of specific render.
 * @param  pWnd    The handle of window.
 * @param  renderId The render source.
 * @param  enEffectType  Effect type, @ref ZmfRenderEffectType
 * @param  strJson  Effect param, json string
 * @return 0 on succeed, otherwise failed.
 */
int Zmf_VideoRenderEffect(void *pWnd, const char* renderId, ZmfRenderEffectType enEffectType, const char* strJson);

/**
 * @brief Set the match type of specific render.
 * @param  pWnd    The handle of window.
 * @param  renderId The render source.
 * @param  enMatchType  Effect type, @ref ZmfRenderEffectType
 * @param  strJson  Effect param, json string
 * @return 0 on succeed, otherwise failed.
 */
int Zmf_VideoRenderMatch(void *pWnd, const char* renderId, ZmfRenderMatchType enMatchType, const char* strJson);

/**
 * @brief get the location point of specific render.
 * @param  pWnd    The handle of window.
 * @param  renderId The render source.
 * @param  location point
 * @return 0 on succeed, otherwise failed.
 */
int Zmf_VideoRenderGetLocation(void *pWnd, const char* renderId, float* location);

#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif /* __ZMF_VIDEO_H__ */