📄 mv_dec01.c
字号:
/*==========================================================================*/
/* (Copyright (C) 2003 Koninklijke Philips Electronics N.V. */
/* All rights reserved. */
/* This source code and any compilation or derivative thereof is the */
/* proprietary information of Koninklijke Philips Electronics N.V. */
/* and is confidential in nature. */
/* Under no circumstances is this software to be exposed to or placed */
/* under an Open Source License of any type without the expressed */
/* written permission of Koninklijke Philips Electronics N.V. */
/*==========================================================================*/
/*==========================================================================*/
/*
SOURCE_FILE: MV_DEC01.C
PACKAGE: DEC
COMPONENT: IPVD
(C) 1998: Philips Semiconductors
*/
/*==========================================================================*/
/*MPP:::DEC======================================================*/
/* PACKAGE NAME: DEC
SCOPE: PLATEFORM
ORIGINAL AUTHOR: B.LEMESLE
DESCRIPTION :
Basic functionalities of the video decoding package to retrieve User Data.
DATA TYPES:
FUNCTIONS:
MV_DEC_enable_user_data
MV_DEC_disable_user_data
MV_DEC_user_data_process
MV_DEC_get_user_data
*/
/*EMP=======================================================================*/
/*==========================================================================*/
/* I N C L U D E S */
/*==========================================================================*/
#include "standard.h"
#include "tmosal.h"
#include "mv_decl.h"
#include "mv_decp.h"
#include "mv_inpl.h"
#include "mv_drv.h"
#include "ipvd_dbgl.h"
/*==========================================================================*/
/* G L O B A L D A T A D E C L A R A T I O N S */
/*==========================================================================*/
/*==========================================================================*/
/* L O C A L S Y M B O L D E F I N I T I O N S */
/*==========================================================================*/
/*==========================================================================*/
/* L O C A L D A T A D E C L A R A T I O N S */
/*==========================================================================*/
/*==========================================================================*/
/* L O C A L F U N C T I O N S P R O T O T Y P E S */
/*==========================================================================*/
static void LF_MV_DEC_store_user_data(unsigned long in_start_addr,unsigned long in_stop_addr);
/*==========================================================================*/
/* G L O B A L F U N C T I O N S */
/*==========================================================================*/
/*MPF=======================================================================*/
/*
FUNCTION NAME: MV_DEC_enable_user_data
PACKAGE: DEC
SCOPE: PLATEFORM
DESCRIPTION:
Enable extraction of the specified type(s) of user data (SEQUENCE, GOP
or PICTURE level) from the video data stream.
Input parameter can be :
- MV_DEC_SEQ_UD : enable extraction of UD at sequence level
- MV_DEC_GOP_UD : enable extraction of UD at gop level
- MV_DEC_PICT_UD : enable extraction of UD at picture level
When user data is available to be parsed an
MV_DEC_UD_PROCESSING_NEEDED_EVENT is generated.
The user data should then be parsed using the MV_DEC_user_data_process()
routine.
Afterthat, when the user data are available, an MV_DEC_UD_AVAILABLE_EVENT
is notified to application, so that it can retrieve it by calling the
MV_DEC_get_user_data() routine.
Extraction of more than one type of user data can be initiated by
logically OR-ing the masks for the desired types of user data.
Initially no user data extraction is requested.
PRECONDITIONS:
To retrieve correctly User Data, Application must enable notification of
MV_DEC_UD_PROCESSING_NEEDED_EVENT and MV_DEC_UD_AVAILABLE_EVENT via API
MV_DEC_enable_notification() before calling MV_DEC_enable_user_data()
routine
POSTCONDITIONS:
Once, MV_DEC_enable_user_data() has been called, application can call
MV_DEC_play() to begin retrieval of User Data
CALLING SEQUENCE:
*/
extern void
MV_DEC_enable_user_data(
const MV_DEC_UD_TYPE in_type /* type of User Data to extract */
)
/*EMP=======================================================================*/
{
unsigned long lv_video_event_mask;
/* Add UD type request */
GV_MV_DEC_ud_status.dec_ud_request |= in_type;
lv_video_event_mask = MV_drv_video_event_enable();
/* write video_event_enable to enable selected UD type */
if (GV_MV_INP_status.inp_data_format != MV_INP_FORMAT_ES)
{
lv_video_event_mask |= (MV_DEC_VIDEO_EVENT_PES_H_SC1 | MV_DEC_VIDEO_EVENT_PES_H_SC2);
}
if(in_type & MV_DEC_SEQ_UD)
{
lv_video_event_mask |= MV_DEC_VIDEO_EVENT_SEQ_UD_SC;
}
if(in_type & MV_DEC_GOP_UD)
{
lv_video_event_mask |= MV_DEC_VIDEO_EVENT_GOP_UD_SC;
}
if(in_type & MV_DEC_PICT_UD)
{
lv_video_event_mask |= MV_DEC_VIDEO_EVENT_PICT_UD_SC;
}
MV_drv_set_video_event_enable(lv_video_event_mask);
} /* End of MV_DEC_enable_user_data */
/*MPF=======================================================================*/
/*
FUNCTION NAME: MV_DEC_disable_user_data
PACKAGE: DEC
SCOPE: PLATEFORM
DESCRIPTION:
Disable extraction of the specified type(s) of user data (SEQUENCE, GOP
or PICTURE level) from the video data stream.
Input parameter can be :
- MV_DEC_SEQ_UD : disable extraction of UD at sequence level
- MV_DEC_GOP_UD : disable extraction of UD at gop level
- MV_DEC_PICT_UD : disable extraction of UD at picture level
Disabling of more than one type of user data can be initiated by
logically OR-ing the masks for the desired types of user data.
PRECONDITIONS:
None
POSTCONDITIONS:
None
CALLING SEQUENCE:
*/
extern void
MV_DEC_disable_user_data(
const MV_DEC_UD_TYPE in_type /* type of User Data to extract */
)
/*EMP=======================================================================*/
{
unsigned long lv_video_event_mask;
GV_MV_DEC_ud_status.dec_ud_request &= ~in_type;
lv_video_event_mask = MV_drv_video_event_enable();
if(in_type & MV_DEC_SEQ_UD)
{
lv_video_event_mask &= ~MV_DEC_VIDEO_EVENT_SEQ_UD_SC;
}
if(in_type & MV_DEC_GOP_UD)
{
lv_video_event_mask &= ~MV_DEC_VIDEO_EVENT_GOP_UD_SC;
}
if(in_type & MV_DEC_PICT_UD)
{
lv_video_event_mask &= ~MV_DEC_VIDEO_EVENT_PICT_UD_SC;
}
if (GV_MV_INP_status.inp_data_format != MV_INP_FORMAT_ES)
{
if (!(lv_video_event_mask & (MV_DEC_VIDEO_EVENT_PICT_UD_SC|MV_DEC_VIDEO_EVENT_GOP_UD_SC|MV_DEC_VIDEO_EVENT_SEQ_UD_SC)))
{
lv_video_event_mask &= ~(MV_DEC_VIDEO_EVENT_PES_H_SC1 | MV_DEC_VIDEO_EVENT_PES_H_SC2);
}
}
/* write video_event_enable to disable selected UD type */
MV_drv_set_video_event_enable(lv_video_event_mask);
} /* End of MV_DEC_disable_user_data */
/*MPF=======================================================================*/
/*
FUNCTION NAME: MV_DEC_get_user_data
PACKAGE: DEC
SCOPE: PLATEFORM
DESCRIPTION:
Get user data extracted from the video data stream.
Get the extracted user data. The user data is stored in the data area
pointed to by `ou_data_read_ptr'. The size of the data area must be
specified in `in_nbytes_to_read'. The number of MV_DEC_UD_DATA read and
stored is returned in `ou_nbytes_read_ptr'.
Extraction of user data was initiated by a call to MV_DEC_enable_user_data(),
on arrival of MV_DEC_UD_PROCESSING_NEEDED_EVENT, application must call
MV_DEC_user_data_process() for parsing user data which are stored in the
User Data buffer.
Avaibility of the user data in the buffer is signalled through an
MV_DEC_UD_AVAILABLE_EVENT.
NOTE:
The size of the User Data buffer is given by the application at the
initialisation phase, when it calls MV_DEC_bufuse().
PRECONDITIONS:
Application must wait for MV_DEC_UD_AVAILABLE_EVENT before calling
the routine.
POSTCONDITIONS:
None
NOTE:
CALLING SEQUENCE:
*/
extern void
MV_DEC_get_user_data(
MV_DEC_UD_SIZE in_nbytes_to_read, /* In: Nr of bytes to read */
MV_DEC_UD_DATA * ou_data_read_ptr, /* Out: Pointer to video data (byte) */
MV_DEC_UD_SIZE * ou_nbytes_read_ptr, /* Out: Nr of bytes read */
MV_DEC_UD_SIZE * ou_nbytes_remaining_ptr /* Out: Nr of bytes still unread */
)
/*EMP=======================================================================*/
{
unsigned long lv_count = 0; /* in bytes */
unsigned long lv_ud_count; /* in bytes */
Int32 timeout = 1000;
tmErrorCode_t returnVal;
/* take the sync semaphore, to continue : it allows no loses
of user data while application is retrieving user data */
returnVal = tmosalSemAcquire(GV_MV_DEC_ud_status.ptr_sync_semaphore, &timeout);
if(returnVal == TM_OK)
{
/* Get size of user data available in buffer */
lv_ud_count = GV_MV_DEC_ud_status.dec_ud_bfm; /* in bytes */
/* Check if requested number of userdata is available */
if (in_nbytes_to_read <= lv_ud_count)
{
*ou_nbytes_read_ptr = in_nbytes_to_read;
*ou_nbytes_remaining_ptr = lv_ud_count - in_nbytes_to_read;
}
else
{
*ou_nbytes_read_ptr = lv_ud_count;
*ou_nbytes_remaining_ptr = 0;
}
lv_ud_count = *ou_nbytes_read_ptr;
/* Get the user data in buffer */
while(lv_ud_count > 0)
{
ou_data_read_ptr[lv_count] = *(unsigned char *)(GV_MV_DEC_ud_status.dec_ud_adr + GV_MV_DEC_ud_status.dec_ud_rptr);
GV_MV_DEC_ud_status.dec_ud_rptr++;
GV_MV_DEC_ud_status.dec_ud_bfm--;
GV_MV_DEC_ud_status.dec_ud_rptr = GV_MV_DEC_ud_status.dec_ud_rptr % GV_MV_DEC_ud_status.dec_ud_buffer_size; /* for ud buffer wrap around */
lv_count++;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -