⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 video_dec_glb.h

📁 最新MTK手机软件源码
💻 H
📖 第 1 页 / 共 2 页
字号:
/*****************************************************************************
*  Copyright Statement:
*  --------------------
*  This software is protected by Copyright and the information contained
*  herein is confidential. The software may not be copied and the information
*  contained herein may not be used or disclosed except with the written
*  permission of MediaTek Inc. (C) 2005
*
*  BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
*  THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
*  RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
*  AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
*  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
*  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
*  NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
*  SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
*  SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
*  THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
*  NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
*  SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
*
*  BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
*  LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
*  AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
*  OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
*  MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. 
*
*  THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
*  WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
*  LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
*  RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
*  THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
*
*****************************************************************************/

/*******************************************************************************
 *
 * Filename:
 * ---------
 * video_dec_glb.h
 *
 * Project:
 * --------
 *   MAUI
 *
 * Description:
 * ------------
 *   video decode specific definitions
 *
 * Author:
 * -------
 * -------
 *
 *==============================================================================
 *             HISTORY
 * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
 *------------------------------------------------------------------------------
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *------------------------------------------------------------------------------
 * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
 *==============================================================================
 *******************************************************************************/
#ifndef VIDEO_DEC_GLB_H
#define VIDEO_DEC_GLB_H
/*For decoder*/

#ifndef _DRV_COMM_H
#error "Please include drv_comm.h before video_dec_glb.h"
#endif
#ifndef _VISUAL_COMM_H
#error "Please include visual_comm.h before video_dec_glb.h"
#endif
#ifndef __FSAL_BUFFER_H__
#error "Please include fsal.h before video_dec_glb.h"
#endif
#ifndef __MP4_PARSER_H__
#error "Please include mp4_parser.h before video_dec_glb.h"
#endif
#ifndef L1AUDIO_H
#error "Please include l1audio.h before video_dec_glb.h"
#endif
#ifndef LCD_IF_H
#error "Please include lcd_if.h before video_dec_glb.h"
#endif
#ifndef VIDEO_FILE_CREATOR_H
#error "Please include video_file_creator.h before video_dec_glb.h"
#endif
#ifndef __MED_STATUS_H__
#error "Please include med_status.h before video_dec_glb.h"
#endif
#include "video_comm.h"
#include "video_dec_frame_buffer_manager.h"
#include "video_decore.h"
#include "video_dec_hwcofig_buffer.h"
#include "video_dec_isr.h"
#include "video_dec_buffer_manager.h"
#include "video_fileparse_adap.h"


///////////////////////////////////////////////////////////////////////////////////
//                                     Internal definition                                                                  //
///////////////////////////////////////////////////////////////////////////////////

/*  Decode bitstream buffer size per decode buffer */
#define VIDEO_DEC_BUFFER_SIZE                (DEC_MAX_FRAME_WIDTH*DEC_MAX_FRAME_HEIGHT*3)
#define VIDEO_DEC_BUFFER_COUNT             3

/* Maximum LCD display size, and it will decide the memory resource for resizer */
#define LCD_DISP_MAX_SIZE              320

/* Maximum VIDEO GPT re-flash time, Unit: ms */
#define VIDEO_MAX_GPT_REFRESH_TIME_DEF     140

/* Maximum VIDEO GPT re-flash guard time, Unit: ms */
#define VIDEO_MAX_GPT_REFRESH_GAURD_TIME  50

/* Video decode status */
typedef enum
{
    // Video decode ok
    VIDEO_DEC_OK = MED_STAT_VIDEO_DEC_START,
    // This video decode frame size in file exceed our maximum size.
    VIDEO_DEC_FRAME_SIZE_ERROR,
    // This video bitstream is error.
    VIDEO_DEC_BITSTREAM_ERROR,
    // Some functions in this file are not supported.
    VIDEO_DEC_NOT_SUPPORT,
    // This function can't be called in this state.
    VIDEO_DEC_FUNC_STATE_ERROR,
    // The resource is not enough
    VIDEO_DEC_RESOURCE_NOT_AVAIL,
    // Function parameter error
    VIDEO_DEC_FUNC_PARAMETER_ERROR,
    // The error that is the bug of the driver
    VIDEO_DEC_FATAL_ERROR,
    // Video duration exceed the max duration.
    VIDEO_DEC_LONG_DURATION,
    // The warning show the end of audio when video seek
    VIDEO_DEC_SEEK_AUDIO_END,
    // Total Video decode status
    MAX_VIDEO_DEC_STATUS
}VIDEO_DEC_STATUS;

/* Video function stage */
typedef enum
{
    VIDEO_DEC_STAGE_UNKOWN = 0,
    VIDEO_DEC_STAGE_OPEN,
    VIDEO_DEC_STAGE_SEEK,
    VIDEO_DEC_STAGE_PLAY,
    VIDEO_DEC_STAGE_STOP,
    VIDEO_DEC_STAGE_CLOSE,
    VIDEO_DEC_MAX_STAGE
}VIDEO_DEC_STAGE;

/* Video image path state */
typedef enum
{
    VIDEO_DEC_IMG_PATH_NONE = 0,
    VIDEO_DEC_IMG_PATH_HW,
    VIDEO_DEC_IMG_PATH_SW,
    VIDEO_DEC_MAX_IMG_PATH
}VIDEO_DEC_IMG_PATH_TYPE;

/* Video decode state */
typedef enum
{
    // Unknown state
    VIDEO_DEC_STATE_UNKOWN = 0,
    // Normal state
    VIDEO_DEC_STATE_NORMAL,
    // Seek state
    VIDEO_DEC_STATE_SEEK,
    MAX_VIDEO_DEC_STATE
}VIDEO_DEC_STATE;


/* main video decoder information*/
typedef struct
{
    // Decode type = DECODE_TYPE_MPEG4 or DECODE_TYPE_H263
    DECODE_TYPE decode_type;
    // Store the VOS information
    MP4VIDEO_VOS_STRUCT *VOS;
    // total frames in media file
    kal_uint32 total_frames_in_file;
    // Stop frame no, when error detected!
    kal_uint32 stop_frame_no;
    // Task prepare frame number.
    kal_uint32 prepare_frames_no;
    // Hisr decode frame number.
    kal_uint32 hdr_parse_frames_no;
    // LISR decode frame number.
    kal_uint32 dec_frames_no;
    // current play time, Unit: ms
    kal_uint64 current_play_time;
    // video average frame duration
    kal_uint32 video_avg_frame_duration;
    // video time scale
    kal_uint32 video_time_scale;
    // Audio time scale
    kal_uint32 audio_time_scale;
    // snapshot resize memory
    kal_uint32 snapshot_resize_memory;
    // snapshot imgdma memory
    kal_uint32 snapshot_imgdma_memory;
    // video frame duration tick
    kal_uint32 video_frame_duration_tick; /*Unit: audio time scale*/
    // This variable is a tricky when seek & prepare data
    kal_bool is_allow_isr;
    // This variable will be KAL_TRUE, when video is end.
    kal_bool video_end;
    // The max frame width and height that decoder support
    kal_uint16 max_width, max_height;
    // The frame width and height in bitstream
    kal_uint16 real_width, real_height;
    // The frame width and height in bitstream
    kal_uint16 width, height;
    // The display width and height
    kal_uint16 disp_width, disp_height;
    // seek_by_time(KAL_TRUE) or seek_by_frame(KAL_FALSE)
    kal_bool seek_by_time;
    // seek_by_time(KAL_TRUE) or seek_by_frame(KAL_FALSE)
    kal_uint64 seek_time;
    // The time for the next frame of seeked frame.
    kal_uint64 seek_next_frame_time;
    // The incoming-call state or not
    kal_bool incall;
    // display to LCD or not
    kal_bool display_enable;
    // display previous frame or not
    kal_bool prev_display_enable;
    // audio enable or not when incoming-call 
    kal_bool audio_enable;
    // data partitioned bistream? This value will be obtained from VOS parse.
    kal_uint8 data_partitioned;
    // Support RVLC. This value will be obtained from VOS parse.
    kal_uint8 resversible_vlc;
    // Time increment value. This value will be obtained from VOS parse.
    kal_uint16 time_increment;
    // Resync marker disable?? This value will be obtain from VOS parse.
    kal_uint8 resync_marker_disable;
    // is non-coded frame??
    kal_bool is_non_coded;
    // Interlanced bitstream? This value will be obtain from VOS parse.
    kal_uint8 interlaced;
    // skip frames, exception recover 
    kal_uint32 skip_frames;
    // total lost display frames, exception recover
    kal_uint32 disp_lost_frames;
    // total lost frames, exception recover
    kal_uint32 lost_frames;
    // prepare to recover
    kal_bool prepare_recover;
    // start to recover?
    kal_bool recover_start;
    // start frame when recover
    kal_uint32 recover_start_frame;
    // The seek frame number(used by lower layer)
    kal_uint32 seek_frame_number;
    // The seek frame number(used by higher layer). 
    // When video bitstream is error, seek_frame_number != seek_result_frame_number
    kal_uint32 seek_result_frame_number;
    // This variable store the AV condition for media file. Unit: ms
    kal_uint64 audio_duration;
    // This variable store the AV condition for media file. Unit: ms
    kal_uint64 video_duration;
    // play speed, unit = x/100; for example play_speed = 50  
    // ==> The result speed will be(50/100 = 0.5)*normal speed.
    kal_uint16 play_speed;
    // skip isr stutus check, exception recover
    kal_bool skip_check_isr_status;
    // Total decode error frame count in high speed
    kal_uint8 decode_error_frame_count_in_high_speed;
    // decode state
    VIDEO_DEC_STAGE stage;
    // LCD id
    kal_uint8 lcd_id;
    // total play time
    kal_uint64 play_time;
    // previous frame duration 
    kal_uint32 pre_frame_duration;
    // The address of resizer working memory
    kal_uint32 resz_work_memory;
    // image path type
    VIDEO_DEC_IMG_PATH_TYPE path_type;
    // Video callback function, which is register by MED task.
    void (*video_dec_callback)(kal_uint8 event);
    // set KAL_TRUE to send primitve to notify upper layer
    kal_bool isr_error_event_happen;
    // Visual version, we only support version 1.
    // This variable is for debugging.
    kal_uint8 visual_version;
    // DECODE state
    VIDEO_DEC_STATE dec_state;
    // Mp4 video parser
    STMp4Parser *pMp4Parser;
    // file system abstration layer
    STFSAL *pstFSAL;
    // Store the VOS data
    MP4VIDEO_VOS_STRUCT VOS_DATA;
    // force disable deblock function or not
    kal_bool force_deblock_disable;
    // force disable display or not
    //kal_bool force_display_disable;
} VIDEO_DEC_STRUCT;


/* video decoder status */
typedef struct
{
    // Decoder is running or not
    kal_bool running;
    // video scenario
    VIDEO_SCENARIO_ENUM scenario;
    // Video decode status
    VIDEO_DEC_STATUS VIDEO_STATUS;
    // The status of file system abstration layer
    FSAL_Status FSAL_STATUS;
    // Store the file that result FSAL_Status
    STFSAL *FSAL_ERROR_FILE;
    // The status of Mp4 parser

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -