📄 dr_prefetch.h
字号:
/******************************************************************************
*******************************************************************************
** **
** Copyright (c) 2005 Videon Central, Inc. **
** All rights reserved. **
** **
** The computer program contained herein contains proprietary information **
** which is the property of Videon Central, Inc. The program may be used **
** and/or copied only with the written permission of Videon Central, Inc. **
** or in accordance with the terms and conditions stipulated in the **
** agreement/contract under which the programs have been supplied. **
** **
*******************************************************************************
******************************************************************************/
/**
* @file dr_prefetch.h
*
* DR Prefetch Class header file.
*
* $Id: dr_prefetch.h,v 1.62 2007/01/26 20:48:26 rbehe Exp $
*/
#ifndef DR_PREFETCH_H
#define DR_PREFETCH_H
#include "dr_types.h"
#define DR_DATATASK_PRIORITY OS_TASK_NORMAL_PRIORITY
#define DR_PLAYQUEUE_DEPTH 1 /* If you change this, bad things happen */
#define DR_PREFETCH_STACK_SIZE (16*1024)
typedef enum tagDR_ANGLE
{
DR_NO_AGL_C = 0,
DR_AGL_C1,
DR_AGL_C2,
DR_AGL_C3,
DR_AGL_C4,
DR_AGL_C5,
DR_AGL_C6,
DR_AGL_C7,
DR_AGL_C8,
DR_AGL_C9,
DR_AGL_C_INVALID
} DR_ANGLE;
typedef enum tagDRPRE_STATE
{
DRPRE_STATE_IDLE = 0,
DRPRE_STATE_RUNNING
} DRPRE_STATE;
#ifdef __cplusplus
extern "C" {
#endif
static BYTE ms_idnum = 0; /* used to give each object allocated of the class a unique identifier - for debug purposes */
typedef struct tagLocalContext
{
ULONG spnOfPayload;
ULONG ulClipNum;
PVOID pvContext;
}LocalContext;
class LocalContextManager
{
private:
BYTE m_numContexts;
BYTE m_index;
LocalContext *m_LocalContext;
public:
LocalContextManager()
{
m_numContexts = 0;
m_index = 0;
m_LocalContext = NULL;
}
LocalContext *NewLocalContext(void)
{
m_index = (m_index+1) % m_numContexts;
return ( CurrentLocalContext() );
}
LocalContext *CurrentLocalContext(void)
{
if (m_LocalContext != NULL)
{
return ( &(m_LocalContext[m_index]) );
}
else
{
return (NULL);
}
}
void Allocate(BYTE bNumContexts)
{
DbgAssert(bNumContexts < 255);
m_LocalContext = (LocalContext *)OS_MemAlloc(sizeof(LocalContext) * bNumContexts);
if (m_LocalContext == NULL)
{
DbgAssert(0);
//@todo handle error
}
m_numContexts = bNumContexts;
}
void Delete(void)
{
if (m_LocalContext != NULL)
{
OS_MemFree(m_LocalContext);
m_LocalContext = NULL;
}
m_numContexts = 0;
}
};
class DRPrefetch
{
private:
/*status and debug variables */
DRPRE_STATE m_State;
/* the PrefetchThread handle */
int m_prefetchThreadID;
/* semaphore to allow calls to play() to block */
OS_SEM_ID m_semPlayBlock;
void destroy(void);
virtual uint32 GetPlayRate(void) {DbgPrint(("%s:%u - need to implement", __FILE__, __LINE__)); return 0;}
virtual PVOID GetContext(void) {DbgPrint(("%s:%u - need to implement", __FILE__, __LINE__)); return NULL;}
virtual PVOID GetNextContext(void) {DbgPrint(("%s:%u - need to implement", __FILE__, __LINE__)); return NULL;}
virtual ULONG GetCellPosition(void) {DbgPrint(("%s:%u - need to implement", __FILE__, __LINE__)); return 0xfffff;}
protected:
/* the data stream */
cStream* m_prefetchStream;
/* the play queue */
cStream* m_prefetchPlayQueue;
PVOID m_pPlayMessagePool;
/* passed in parameters */
LOADER_HANDLE m_loader;
DR_EVENT m_event;
PVOID m_pContext;
BYTE m_idnum;
/* death flags */
BOOLEAN m_fKill;
BOOLEAN m_fAbort;
/* semaphores */
OS_SEM_ID m_semPlayQueueEnabled;
static OS_SEM_ID m_semDevice;
BOOLEAN m_fPlayQueueEnabled;
/* encryption type is stored as a value here */
ENCRYPTION_TYPE m_encryption_type;
PVOID m_pvPlayContext;
BOOLEAN Abort(void);
BOOLEAN Flush(BOOLEAN fGracefully, ULONG ulFlushLevel, ULONG ulClipNum, ULONG *spnIn, PVOID *pvContext);
DR_ERROR drSendStream(DROUTPUTMESSAGE streamMessage, cPayload *pPayload);
DR_ERROR drSendTimingInfo(BYTE bAppType, BYTE bTransCond, ULONG ulStartTime, ULONG ulStopTime, PVOID pvContext);
/**
* private helper function used to get a new payload.
*/
inline cPayload *drGetPayload(void)
{
cPayload *pStreamPayload = NULL;
while ((NULL == (pStreamPayload = NEW_PAYLOAD)) && (m_fAbort == FALSE))
{
DbgPrint(("SYSTEM OUT OF PAYLOADS!!\n"));
OS_TaskDelay(OS_WAIT_1S / 10);
}
return (pStreamPayload);
}
public:
DRPrefetch()
{
/* initialize variables */
m_State = DRPRE_STATE_IDLE;
m_idnum = ms_idnum++;
m_prefetchStream = NULL;
m_prefetchPlayQueue = NULL;
m_pPlayMessagePool = NULL;
m_prefetchThreadID = 0;
m_loader = NULL;
m_event = NULL;
m_pContext = NULL;
m_fKill = FALSE;
m_fAbort = FALSE;
m_semPlayBlock = 0;
m_semPlayQueueEnabled = 0;
m_fPlayQueueEnabled = FALSE;
m_encryption_type = NONE;
m_pvPlayContext = NULL;
}
virtual ~DRPrefetch()
{
destroy();
ms_idnum--;
}
void * operator new( size_t size )
{
return ( OS_MemAlloc(size) );
}
void operator delete( void * pvPFB )
{
OS_MemFree(pvPFB);
}
virtual DR_ERROR Configure (LOADER_HANDLE prm_loader, cStream* prm_stream, DR_EVENT prm_event, PVOID prm_pContext);
void setEncryptionType(ENCRYPTION_TYPE prm_encryption_type)
{
m_encryption_type = prm_encryption_type;
}
DR_ERROR GetStatus (DR_STATCMD cmd, uint32 *pStatus);
void Stop (BOOLEAN reset);
DR_ERROR QueueControl (DR_QUEUE_CMD cmd);
void Play(PLAYCMD play, BOOLEAN fBlockonPlay);
ULONG PrefetchThread(void);
virtual void ResetParams(void) {}
virtual DR_ERROR AngleChange(ANGLECMD *) {DbgPrint(("%s:%u - need to implement", __FILE__, __LINE__)); return DR_FAILURE;}
virtual DR_ERROR StopAtChangePoint(BOOLEAN fAngle, ULONG *ulAngleChangePointPTS, PVOID *pvContext) {DbgPrint(("%s:%u - need to implement", __FILE__, __LINE__)); return DR_FAILURE;}
virtual DR_ERROR SetSpeed(SPEEDCMD *) {DbgPrint(("%s:%u - need to implement", __FILE__, __LINE__)); return DR_FAILURE;}
virtual DR_ERROR dataRetrieve(PLAYCMD playcmd) = 0;
};
#ifdef __cplusplus
}
#endif
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -