Home | History | Annotate | Download | only in mediaeditor
      1 /*
      2  * Copyright (C) 2011 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 
     18 #ifndef VIDEO_BROWSER_MAIN_H
     19 #define VIDEO_BROWSER_MAIN_H
     20 
     21 /**
     22  ************************************************************************
     23  * @file    VideoBrowserMain.h
     24  * @brief   Video browser Interface functions
     25  ************************************************************************
     26 */
     27 
     28 #define VIDEOBROWSER    0x423
     29 
     30 #include "M4OSA_Memory.h"
     31 #include "M4OSA_CharStar.h"
     32 #include "M4OSA_OptionID.h"
     33 #include "M4OSA_Debug.h"
     34 #include "M4VIFI_FiltersAPI.h"
     35 #include "M4OSA_FileReader.h"
     36 
     37 
     38 /**
     39  ************************************************************************
     40  * @brief    Error codes definition.
     41  * @note    These value are the Browser engine specific error codes.
     42  ************************************************************************
     43 */
     44 #define M4ERR_VB_MEDIATYPE_NOT_SUPPORTED    M4OSA_ERR_CREATE(M4_ERR, VIDEOBROWSER, 0x01)
     45 #define M4ERR_VB_NO_VIDEO                   M4OSA_ERR_CREATE(M4_ERR, VIDEOBROWSER, 0x02)
     46 
     47 #ifdef __cplusplus
     48 extern "C" {
     49 #endif
     50 
     51 /*
     52  *  Video Browser draw mode, extension for angle based bliting can be done
     53  */
     54 typedef enum
     55 {
     56     VideoBrowser_kVBNormalBliting
     57 } VideoBrowser_videoBrowerDrawMode;
     58 
     59 
     60 /*--- Video Browser output frame color type ---*/
     61 typedef enum
     62 {
     63     VideoBrowser_kYUV420,
     64     VideoBrowser_kGB565
     65 } VideoBrowser_VideoColorType;
     66 
     67 /**
     68  ************************************************************************
     69  * enumeration  VideoBrowser_Notification
     70  * @brief       Video Browser notification type.
     71  * @note        This callback mechanism must be used to wait the completion of an asynchronous
     72  * operation, before calling another API function.
     73  ************************************************************************
     74 */
     75 typedef enum
     76 {
     77     /**
     78      * A frame is ready to be displayed, it should be displayed in the callback function
     79      * pCbData type = M4VIFI_ImagePlane*
     80      */
     81     VIDEOBROWSER_DISPLAY_FRAME            = 0x00000001,
     82     VIDEOBROWSER_NOTIFICATION_NONE        = 0xffffffff
     83 }VideoBrowser_Notification;
     84 
     85 
     86 /**
     87  ************************************************************************
     88  * @brief    videoBrowser_Callback type definition
     89  * @param    pInstance          (IN) Video Browser context.
     90  * @param    notificationID     (IN) Id of the callback which generated the error
     91  * @param    errCode            (IN) Error code from the core
     92  * @param    pCbData            (IN) pointer to data associated wit the callback.
     93  * @param    pCbUserData        (IN) pointer to application user data passed in init.
     94  * @note    This callback mechanism is used to request display of an image
     95  ************************************************************************
     96 */
     97 typedef M4OSA_Void (*videoBrowser_Callback) (M4OSA_Context pInstance,
     98                                         VideoBrowser_Notification notificationID,
     99                                         M4OSA_ERR errCode,
    100                                         M4OSA_Void* pCbData,
    101                                         M4OSA_Void* pCallbackUserData);
    102 
    103 
    104 /******************************************************************************
    105 * @brief   This function allocates the resources needed for browsing a video file.
    106 * @param   ppContext     (OUT): Pointer on a context filled by this function.
    107 * @param   pURL          (IN) : Path of File to browse
    108 * @param   DrawMode      (IN) : Indicate which method is used to draw (Direct draw etc...)
    109 * @param   pfCallback    (IN) : Callback function to be called when a frame must be displayed
    110 * @param   pCallbackData (IN)  : User defined data that will be passed as parameter of the callback
    111 * @param   clrType       (IN) : Required color type.
    112 * @return  M4NO_ERROR / M4ERR_PARAMETER / M4ERR_STATE / M4ERR_ALLOC
    113 ******************************************************************************/
    114 M4OSA_ERR videoBrowserCreate(M4OSA_Context* ppContext, M4OSA_Char* pURL,
    115                                         M4OSA_UInt32 DrawMode,
    116                                         M4OSA_FileReadPointer* ptrF,
    117                                         videoBrowser_Callback pfCallback,
    118                                         M4OSA_Void* pCallbackData,
    119                                         VideoBrowser_VideoColorType clrType);
    120 
    121 /******************************************************************************
    122 * @brief        This function frees the resources needed for browsing a video file.
    123 * @param        pContext     (IN) : Video browser context
    124 * @return       M4NO_ERROR / M4ERR_PARAMETER / M4ERR_STATE
    125 ******************************************************************************/
    126 M4OSA_ERR videoBrowserCleanUp(M4OSA_Context pContext) ;
    127 
    128 
    129 /******************************************************************************
    130 * @brief        This function allocates the resources needed for browsing a video file.
    131 * @param        pContext  (IN)      : Video browser context
    132 * @param        pTime     (IN/OUT)  : Pointer on the time to reach. Updated by
    133 *                                     this function with the reached time
    134 * @return       M4NO_ERROR / M4ERR_PARAMETER / M4ERR_STATE / M4ERR_ALLOC
    135 ******************************************************************************/
    136 M4OSA_ERR videoBrowserPrepareFrame(M4OSA_Context pContext, M4OSA_UInt32* pTime,
    137         M4OSA_UInt32 tolerance);
    138 
    139 /******************************************************************************
    140 * @brief        This function sets the size and the position of the display.
    141 * @param        pContext     (IN) : Video Browser context
    142 * @param        pixelArray   (IN) : Array to hold the video frame.
    143 * @param        x            (IN) : Horizontal position of the top left corner
    144 * @param        y            (IN) : Vertical position of the top left corner
    145 * @param        dx           (IN) : Width of the display window
    146 * @param        dy           (IN) : Height of the video window
    147 * @return       M4NO_ERROR / M4ERR_PARAMETER / M4ERR_STATE / M4ERR_ALLOC
    148 ******************************************************************************/
    149 M4OSA_ERR videoBrowserSetWindow(M4OSA_Context pContext, M4OSA_Int32* pixelArray,
    150                                 M4OSA_UInt32 x, M4OSA_UInt32 y,
    151                                 M4OSA_UInt32 dx, M4OSA_UInt32 dy);
    152 
    153 /******************************************************************************
    154 * @brief        This function displays the current frame.
    155 * @param        pContext     (IN) : Video browser context
    156 * @return       M4NO_ERROR / M4ERR_PARAMETER / M4ERR_STATE / M4ERR_ALLOC
    157 ******************************************************************************/
    158 M4OSA_ERR videoBrowserDisplayCurrentFrame(M4OSA_Context pContext);
    159 
    160 #ifdef __cplusplus
    161 }
    162 #endif
    163 
    164 #endif /* VIDEO_BROWSER_MAIN_H */
    165