📄 video_editor.c
字号:
/*****************************************************************************
* 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).
*
*****************************************************************************/
/*****************************************************************************
* 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) 2001
*
*****************************************************************************/
/*****************************************************************************
*
* Filename:
* ---------
* video_editor.c
*
* Project:
* --------
* Maui_Software
*
* Description:
* ------------
* This Module defines video editor api for media task
*
* 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!
*------------------------------------------------------------------------------
* Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*============================================================================
****************************************************************************/
#if defined(__VIDEO_EDITOR__)
#include "FSAL.h"
#include "MP4_Parser.h"
#include "MP4_Producer_Audio.h"
#include "MP4_Sample_Data_Audio.h"
#include "rtc_sw.h"
#include "lcd_if.h"
#include "video_file_creator.h"
#include "drv_comm.h"
#include "visual_comm.h"
#include "l1audio.h"
#include "bmd.h"
#include "video_dec_glb.h"
#include "video_enc_glb.h"
#include "video_glb.h"
#include "video_editor.h"
#include "video_hw.h"
#include "intrCtrl.h"
#include "visualhisr.h"
extern VIDEO_EDITOR_STRUCT VIDEO_EDITOR_DATA;
extern MP4_FILELIST_STRUCT mp4_files;
extern kal_uint32 video_editor_get_virtual_time(void);
extern void video_editor_set_virtual_time(kal_uint32 virtual_time);
extern void video_enc_lisr_process(kal_uint32 encode_work_yuv,
kal_uint32 time_stamp,
kal_uint32 delay_offset);
extern void mpeg4_dec_seek_lisr_process(kal_uint32 status);
extern void video_dec_set_seek_frame(kal_uint32 frame_number);
extern MEDIA_STATUS_CODE video_editor_get_first_audio_frame(kal_uint32 video_frame,
kal_uint32 *audio_first_frame_number,
kal_bool *has_audio_frame);
extern MEDIA_STATUS_CODE video_editor_get_last_audio_frame(kal_uint32 current_video_frame,
kal_uint32 *audio_last_frame_number);
extern MEDIA_STATUS_CODE video_encode_comm_setup(MP4ENC_SETUP_STRUCT *setup_input);
extern MEDIA_STATUS_CODE video_decoder_initialize(MP4DEC_INIT_STRUCT *init_input, kal_uint32 max_width, kal_uint32 max_height);
extern MEDIA_STATUS_CODE video_editor_avsync_info(kal_bool av_sync,
kal_uint32 video_start_time,
kal_uint32 audio_start_time,
kal_uint32 av_duration,
VEDITOR_AVSYNC_AUDIO_STRUCT *audio_avsync,
kal_uint32 *current_video_frame_no);
extern MEDIA_STATUS_CODE video_dec_seek_by_frame(kal_uint32 frame_no, void (*callback)(kal_uint8 event), kal_bool seek_from_current_frame);
extern void mpeg4_dec_seek_HISR(void);
void MPEG4_EDITOR_LISR(void);
/*Video editor common part*/
kal_uint32 video_editor_avsync_first_frame(kal_uint32 current_time_stamp)
{
if (VIDEO_EDITOR_DATA.video_avsync.start_frame_discard)
{
current_time_stamp += video_dec_get_curr_frame_duration()+VIDEO_EDITOR_DATA.video_avsync.delta_start_frame_duratoin;
}
else
{
current_time_stamp += VIDEO_EDITOR_DATA.video_avsync.delta_start_frame_duratoin;
}
return current_time_stamp;
}
kal_uint32 video_editor_avsync_end_frame(kal_uint32 current_time_stamp)
{
if (VIDEO_EDITOR_DATA.video_avsync.end_frame_discard)
{
current_time_stamp += video_dec_get_curr_frame_duration()+VIDEO_EDITOR_DATA.video_avsync.delta_end_frame_duratoin;
}
else
{
current_time_stamp += VIDEO_EDITOR_DATA.video_avsync.delta_end_frame_duratoin;
}
return current_time_stamp;
}
kal_bool video_editor_check_end(void)
{
if (VIDEO_EDITOR_DATA.video_decode_end)
{
VIDEO_EDITOR_DATA.glb_time_stamp = video_editor_avsync_end_frame(VIDEO_EDITOR_DATA.glb_time_stamp);
}
return VIDEO_EDITOR_DATA.video_decode_end;
}
MEDIA_STATUS_CODE video_editor_open(VIDEO_EDITOR_OPEN_STRUCT *veditor_struct, VEDITOR_AVSYNC_AUDIO_STRUCT *audio_avsync, kal_uint32 *current_video_frame_no)
{
MEDIA_STATUS_CODE result;
MP4ENC_SETUP_STRUCT video_enc_input;
MP4DEC_INIT_STRUCT video_dec_input;
ASSERT(VIDEO_EDITOR_DATA.veditor_state == VIEDO_EDITOR_STATE_IDLE);
g_video_dec_status.scenario = VIDEO_SCENARIO_EDITOR;
g_video_enc_status.scenario = VIDEO_SCENARIO_EDITOR;
VIDEO_EDITOR_DATA.pstVIDParser = veditor_struct->pstVIDParser;
VIDEO_EDITOR_DATA.pstVIDFSAL = veditor_struct->pstVIDFSAL;
VIDEO_EDITOR_DATA.pstAUDParser = veditor_struct->pstAUDParser;
VIDEO_EDITOR_DATA.pstAUDFSAL = veditor_struct->pstAUDFSAL;
// VIDEO_EDITOR_DATA.editor_type = veditor_struct->editor_type;
VIDEO_EDITOR_DATA.call_back = veditor_struct->call_back;
VIDEO_EDITOR_DATA.call_by_next = KAL_FALSE;
VIDEO_EDITOR_DATA.need_avsync = veditor_struct->need_avsync;
VIDEO_EDITOR_DATA.video_start_time = veditor_struct->video_start_time;
VIDEO_EDITOR_DATA.audio_start_time = veditor_struct->audio_start_time;
VIDEO_EDITOR_DATA.av_duration = veditor_struct->av_duration;
VIDEO_EDITOR_DATA.check_end_call_back = video_editor_check_end;
VIDEO_EDITOR_DATA.video_decode_end = KAL_FALSE;
/*Obtain AV time scale*/
VIDEO_EDITOR_DATA.glb_time_stamp = 0;
g_video_dec_status.PARSE_STATUS =
MP4_GetMediaTimeScale(VIDEO_EDITOR_DATA.pstAUDParser,
&VIDEO_EDITOR_DATA.audio_time_scale,
MP4_TRACK_AUDIO);
if (g_video_dec_status.PARSE_STATUS != MP4_PARSER_OK)
{
VIDEO_ASSERT(0);
return MP4_PARSER_ERROR;
}
g_video_dec_status.PARSE_STATUS =
MP4_GetMediaTimeScale(VIDEO_EDITOR_DATA.pstVIDParser,
&VIDEO_EDITOR_DATA.video_time_scale,
MP4_TRACK_VIDEO);
if (g_video_dec_status.PARSE_STATUS != MP4_PARSER_OK)
{
VIDEO_ASSERT(0);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -