📄 clpinfodb.cpp
字号:
return(0);
}
return (m_ciStart);
}
/**
* ClpInfoGet_ciEnd -- Get the last coarse index of the currently loaded clip (based on the in and out times set)
*
* @retval
* m_ciEnd
*/
ULONG ClpInfo::ClpInfoGet_ciEnd()
{
if (hClpInfo == NULL)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("ClpInfoGet_ciEnd: Database not created!\n"));
return (0);
}
if (m_tClpInfoData == NULL)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("ClpInfoGet_ciEnd: Clip not loaded!\n"));
return(0);
}
return(m_ciEnd);
}
/**
* ClpInfoGet_fiStart -- Get the first fine index of the currently loaded clip (based on the in and out times set)
*
* @retval
* m_fiStart
*/
ULONG ClpInfo::ClpInfoGet_fiStart()
{
if (hClpInfo == NULL)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("ClpInfoGet_fiStart: Database not created!\n"));
return (0);
}
if (m_tClpInfoData == NULL)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("ClpInfoGet_fiStart: Clip not loaded!\n"));
return(0);
}
return (m_fiStart);
}
/**
* ClpInfoGet_fiEnd -- Get the last fine index of the currently loaded clip (based on the in and out times set)
*
* @retval
* m_fiEnd
*/
ULONG ClpInfo::ClpInfoGet_fiEnd()
{
if (hClpInfo == NULL)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("ClpInfoGet_fiEnd: Database not created!\n"));
return (0);
}
if (m_tClpInfoData == NULL)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("ClpInfoGet_fiEnd: Clip not loaded!\n"));
return(0);
}
return(m_fiEnd);
}
/**
* ClpInfoGet_ubAppType -- Get the application type of the currently loaded clip
*
* @retval
* application_type
*/
UBYTE ClpInfo::ClpInfoGet_ubAppType()
{
if (hClpInfo == NULL)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("ClpInfoGet_ubAppType: Database not created!\n"));
return (0);
}
if (m_tClpInfoData == NULL)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("ClpInfoGet_ubAppType: Clip not loaded!\n"));
return(0);
}
return(m_tClpInfoData->ClipInfo.application_type);
}
/*
* ClpInfoSearch_CoarseForPTS -- returns the largest index that is <= the ptsIN
*
* KEEP LOGIC OF ALL CLIPINFO SEARCHING FUNCTIONS EQUAL
*
* @param
* ciStart -- the first index ciFound could be (cannot be > ciEnd )
* ciEnd -- the last index ciFound could be (cannot be < ciStart)
* ptsIN -- the time we're looking for
* ciFound -- the first index that's equal or the largest index that is < ptsIN
*
* @retval
* CLPINFO_STATUS
*/
CLPINFO_STATUS ClpInfo::ClpInfoSearch_CoarseForPTS(ULONG ciStart, ULONG ciEnd, ULONG ptsIN, ULONG *ciFound)
{
ULONG ciLeft = ciStart;
ULONG ciRight = ciEnd + 1;
ULONG ciMid;
COARSEINFO *pClpInfoEpMapCoarse;
FINEINFO *pClpInfoEpMapFine;
ULONG ptsMid;
ULONG ref_to_EP_fine;
if (hClpInfo == NULL)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("ClpInfoSearch_CoarseForPTS: Database not created!\n"));
return (CLPINFO_FAILURE);
}
if (m_tClpInfoData == NULL)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("ClpInfoSearch_CoarseForPTS: Clip not loaded!\n"));
return(CLPINFO_FAILURE);
}
pClpInfoEpMapCoarse = m_tClpInfoData->CPI.EP_map.stream_pid_entry[EPMAP_STREAMINDEX].EP_map_for_one_stream_PID.coarse;
pClpInfoEpMapFine = m_tClpInfoData->CPI.EP_map.stream_pid_entry[EPMAP_STREAMINDEX].EP_map_for_one_stream_PID.fine;
DBGPRINT(DBG_ON(DBG_VERBOSE), (" ptsIN: 0x%x\n", ptsIN));
/* binary search */
while (ciLeft < ciRight - 1)
{
ciMid = (ciLeft + ciRight) / 2;
ref_to_EP_fine = pClpInfoEpMapCoarse[ciMid].ref_to_EP_fine_id;
ptsMid = ( ( (pClpInfoEpMapCoarse[ciMid].PTS_EP_coarse & 0xfffe) << 18) | (pClpInfoEpMapFine[ref_to_EP_fine].PTS_EP_fine << 8) );
DBGPRINT(DBG_ON(DBG_VERBOSE), (" pClpInfoEpMapCoarse[%i].PTS_EP: 0x%x\n", ciMid, ptsMid));
if (ptsMid > ptsIN)
{
ciRight = ciMid;
}
else
{
ciLeft = ciMid;
}
}
*ciFound = ciLeft;
#if DBG_ON(DBG_VERBOSE)
ULONG ptsFound;
ref_to_EP_fine = pClpInfoEpMapCoarse[*ciFound].ref_to_EP_fine_id;
ptsFound = ( ( (pClpInfoEpMapCoarse[*ciFound].PTS_EP_coarse & 0xfffe) << 18) | (pClpInfoEpMapFine[ref_to_EP_fine].PTS_EP_fine << 8) );
DBGPRINT(DBG_ON(DBG_VERBOSE), (" FOUND pClpInfoEpMapCoarse[%i].PTS_EP: 0x%x\n", *ciFound, ptsFound));
#endif
return(CLPINFO_SUCCESS);
}
/*
* ClpInfoSearch_FineForPTS -- returns the largest index that is <= the ptsIN
*
* KEEP LOGIC OF ALL CLIPINFO SEARCHING FUNCTIONS EQUAL
*
* @param
* ciStart -- the first index ciFound could be (cannot be > ciEnd )
* ptsIN -- the time we're looking for
* fiFound -- the first index that's equal or the largest index that is < ptsIN
*
* @retval
* CLPINFO_STATUS
*/
CLPINFO_STATUS ClpInfo::ClpInfoSearch_FineForPTS(ULONG ciStart, ULONG ptsIN, ULONG *fiFound)
{
ULONG fiLeft;
ULONG fiRight;
ULONG fiMid;
COARSEINFO *pClpInfoEpMapCoarse;
FINEINFO *pClpInfoEpMapFine;
ULONG ulNumCoarseEntries;
ULONG ulNumFineEntries;
ULONG ptsMid;
if (hClpInfo == NULL)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("ClpInfoSearch_FineForPTS: Database not created!\n"));
return (CLPINFO_FAILURE);
}
if (m_tClpInfoData == NULL)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("ClpInfoSearch_FineForPTS: Clip not loaded!\n"));
return(CLPINFO_FAILURE);
}
/* Get the Coarse and Fine */
pClpInfoEpMapCoarse = m_tClpInfoData->CPI.EP_map.stream_pid_entry[EPMAP_STREAMINDEX].EP_map_for_one_stream_PID.coarse;
pClpInfoEpMapFine = m_tClpInfoData->CPI.EP_map.stream_pid_entry[EPMAP_STREAMINDEX].EP_map_for_one_stream_PID.fine;
ulNumCoarseEntries = m_tClpInfoData->CPI.EP_map.stream_pid_entry[EPMAP_STREAMINDEX].number_of_EP_coarse_entries;
ulNumFineEntries = m_tClpInfoData->CPI.EP_map.stream_pid_entry[EPMAP_STREAMINDEX].number_of_EP_fine_entries;
/* Get the range to search */
fiLeft = pClpInfoEpMapCoarse[ciStart].ref_to_EP_fine_id; /* current ref to fine */
fiRight = (ciStart + 1 < ulNumCoarseEntries) ? pClpInfoEpMapCoarse[ciStart+1].ref_to_EP_fine_id : ulNumFineEntries; /* next ref to fine */
/* binary search */
DBGPRINT(DBG_ON(DBG_VERBOSE), (" ptsIN: 0x%x\n", ptsIN));
while (fiLeft < fiRight - 1)
{
fiMid = (fiLeft + fiRight) / 2;
ptsMid = ( ( (pClpInfoEpMapCoarse[ciStart].PTS_EP_coarse & 0xfffe) << 18) | (pClpInfoEpMapFine[fiMid].PTS_EP_fine << 8) );
DBGPRINT(DBG_ON(DBG_VERBOSE), (" pClpInfoEpMapFine[%i].PTS_EP: 0x%x\n", fiMid, ptsMid));
if (ptsMid > ptsIN)
{
fiRight = fiMid;
}
else
{
fiLeft = fiMid;
}
}
*fiFound = fiLeft;
#if DBG_ON(DBG_VERBOSE)
ULONG ptsFound;
ptsFound = ( ( (pClpInfoEpMapCoarse[ciStart].PTS_EP_coarse & 0xfffe) << 18) | (pClpInfoEpMapFine[*fiFound].PTS_EP_fine << 8) );
DBGPRINT(DBG_ON(DBG_VERBOSE), (" FOUND pClpInfoEpMapFine[%i].PTS_EP: 0x%x\n", *fiFound, ptsFound));
#endif
return(CLPINFO_SUCCESS);
}
/*
* returns the largest index that is <= the spnIN
*
* KEEP LOGIC OF ALL CLIPINFO SEARCHING FUNCTIONS EQUAL
*
* @param
* ciStart -- the first index ciFound could be (cannot be > ciEnd )
* ciEnd -- the last index ciFound could be (cannot be < ciStart )
* spnIN -- the spn we're looking for
* ciFound -- the first index that's equal or the largest index that is < spnIN
*
* @retval
* CLPINFO_STATUS
*/
CLPINFO_STATUS ClpInfo::ClpInfoSearch_CoarseForSPN(ULONG ciStart, ULONG ciEnd, ULONG spnIN, ULONG *ciFound)
{
ULONG ciLeft = ciStart;
ULONG ciRight = ciEnd + 1;
ULONG ciMid;
COARSEINFO *pClpInfoEpMapCoarse;
FINEINFO *pClpInfoEpMapFine;
ULONG spnMid;
ULONG ref_to_EP_fine;
if (hClpInfo == NULL)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("ClpInfoSearch_CoarseForSPN: Database not created!\n"));
return (CLPINFO_FAILURE);
}
if (m_tClpInfoData == NULL)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("ClpInfoSearch_CoarseForSPN: Clip not loaded!\n"));
return(CLPINFO_FAILURE);
}
pClpInfoEpMapCoarse = m_tClpInfoData->CPI.EP_map.stream_pid_entry[EPMAP_STREAMINDEX].EP_map_for_one_stream_PID.coarse;
pClpInfoEpMapFine = m_tClpInfoData->CPI.EP_map.stream_pid_entry[EPMAP_STREAMINDEX].EP_map_for_one_stream_PID.fine;
DBGPRINT(DBG_ON(DBG_VERBOSE), (" spnIN: 0x%x\n", spnIN));
/* binary search */
while (ciLeft < ciRight - 1)
{
ciMid = (ciLeft + ciRight) / 2;
ref_to_EP_fine = pClpInfoEpMapCoarse[ciMid].ref_to_EP_fine_id;
spnMid = ( (pClpInfoEpMapCoarse[ciMid].SPN_EP_coarse & 0xfffe0000) | (pClpInfoEpMapFine[ref_to_EP_fine].SPN_EP_fine) );
DBGPRINT(DBG_ON(DBG_VERBOSE), (" pClpInfoEpMapCoarse[%i].PTS_EP: 0x%x\n", ciMid, spnMid));
if (spnMid > spnIN)
{
ciRight = ciMid;
}
else
{
ciLeft = ciMid;
}
}
*ciFound = ciLeft;
#if DBG_ON(DBG_VERBOSE)
ULONG spnFound;
ref_to_EP_fine = pClpInfoEpMapCoarse[*ciFound].ref_to_EP_fine_id;
spnFound = ( (pClpInfoEpMapCoarse[*ciFound].SPN_EP_coarse & 0xfffe0000) | (pClpInfoEpMapFine[ref_to_EP_fine].SPN_EP_fine) );
DBGPRINT(DBG_ON(DBG_VERBOSE), (" FOUND pClpInfoEpMapCoarse[%i].SPN_EP: 0x%x\n", *ciFound, spnFound));
#endif
return(CLPINFO_SUCCESS);
}
/*
* returns the largest index that is <= the spnIN
*
* KEEP LOGIC OF ALL CLIPINFO SEARCHING FUNCTIONS EQUAL
*
* @param
* ciStart -- the coarse at which we start our search of the fines (only search from this coarse to the next)
* spnIN -- the spn we're looking for
* fiFound -- the first index that's equal or the largest index that is < spnIN
*
* @retval
* CLPINFO_STATUS
*/
CLPINFO_STATUS ClpInfo::ClpInfoSearch_FineForSPN(ULONG ciStart, ULONG spnIN, ULONG *fiFound)
{
ULONG fiLeft;
ULONG fiRight;
ULONG fiMid;
COARSEINFO *pClpInfoEpMapCoarse;
FINEINFO *pClpInfoEpMapFine;
ULONG ulNumCoarseEntries;
ULONG ulNumFineEntries;
ULONG spnMid;
if (hClpInfo == NULL)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("ClpInfoSearch_FineForSPN: Database not created!\n"));
return (CLPINFO_FAILURE);
}
if (m_tClpInfoData == NULL)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("ClpInfoSearch_FineForSPN: Clip not loaded!\n"));
return(CLPINFO_FAILURE);
}
/* Get the Coarse and Fine */
pClpInfoEpMapCoarse = m_tClpInfoData->CPI.EP_map.stream_pid_entry[EPMAP_STREAMINDEX].EP_map_for_one_stream_PID.coarse;
pClpInfoEpMapFine = m_tClpInfoData->CPI.EP_map.stream_pid_entry[EPMAP_STREAMINDEX].EP_map_for_one_stream_PID.fine;
ulNumCoarseEntries = m_tClpInfoData->CPI.EP_map.stream_pid_entry[EPMAP_STREAMINDEX].number_of_EP_coarse_entries;
ulNumFineEntries = m_tClpInfoData->CPI.EP_map.stream_pid_entry[EPMAP_STREAMINDEX].number_of_EP_fine_entries;
/* Get the range to search */
fiLeft = pClpInfoEpMapCoarse[ciStart].ref_to_EP_fine_id; /* current ref to fine */
fiRight = (ciStart + 1 < ulNumCoarseEntries) ? pClpInfoEpMapCoarse[ciStart+1].ref_to_EP_fine_id : ulNumFineEntries; /* next ref to fine */
/* binary search */
DBGPRINT(DBG_ON(DBG_VERBOSE), (" spnIN: 0x%x\n", spnIN));
while (fiLeft < fiRight - 1)
{
fiMid = (fiLeft + fiRight) / 2;
spnMid = ( ( (pClpInfoEpMapCoarse[ciStart].SPN_EP_coarse & 0xfffe0000)) | (pClpInfoEpMapFine[fiMid].SPN_EP_fine) );
DBGPRINT(DBG_ON(DBG_VERBOSE), (" pClpInfoEpMapFine[%i].SPN_EP: 0x%x\n", fiMid, spnMid));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -