📄 mvplaylistdb.cpp
字号:
/*
* stream_entry()
************************************************************/
mplsLoadStreamEntry(file, &(pSTN_table->primary_video_stream[stream].stream_entry));
/*
* stream_attributes()
************************************************************/
mplsLoadStreamAttributes(file, &(pSTN_table->primary_video_stream[stream].stream_attributes));
/* this is a video stream so should only have video coding types */
DbgAssert((pSTN_table->primary_video_stream[stream].stream_attributes.stream_coding_type == MPLS_STREAM_CODING_TYPE_MPEG2) ||
(pSTN_table->primary_video_stream[stream].stream_attributes.stream_coding_type == MPLS_STREAM_CODING_TYPE_AVC) ||
(pSTN_table->primary_video_stream[stream].stream_attributes.stream_coding_type == MPLS_STREAM_CODING_TYPE_VC1));
}
}
/* @todo: remove this once we're not supporting old content */
if (version < 95)
{
if (LoaderFileSeek(pMPLS_DB->hLoader, file, LOADER_SEEK_CURRENT, -2) != LOADER_SUCCESS)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("%s: %u: Failed to seek in file!\n", __FILE__, __LINE__));
tStatus = MPLS_FILE_ERROR;
goto errout;
}
}
/* Primary Audio Stream Entries */
if (pSTN_table->number_of_primary_audio_stream_entries > 0)
{
#if DBG_ON(DBG_TRACE)
gMPLSMemUsage += sizeof(STREAM_TABLE) * pSTN_table->number_of_primary_audio_stream_entries;
#endif
/* allocate the required number of streams */
pSTN_table->primary_audio_stream = (STREAM_TABLE *)OS_MemAlloc(sizeof(STREAM_TABLE) * pSTN_table->number_of_primary_audio_stream_entries);
if (pSTN_table->primary_audio_stream == NULL)
{
tStatus = MPLS_NO_MEMORY;
goto errout;
}
/* intialize primary audio stream data */
memset(pSTN_table->primary_audio_stream, 0, (sizeof(STREAM_TABLE) * pSTN_table->number_of_primary_audio_stream_entries) );
for (int stream=0; stream<pSTN_table->number_of_primary_audio_stream_entries; stream++)
{
/*
* stream_entry()
************************************************************/
mplsLoadStreamEntry(file, &(pSTN_table->primary_audio_stream[stream].stream_entry));
/*
* stream_attributes()
************************************************************/
mplsLoadStreamAttributes(file, &(pSTN_table->primary_audio_stream[stream].stream_attributes));
/* this is a audio stream so should only have audio coding types */
DbgAssert((pSTN_table->primary_audio_stream[stream].stream_attributes.stream_coding_type == MPLS_STREAM_CODING_TYPE_LPCM) ||
(pSTN_table->primary_audio_stream[stream].stream_attributes.stream_coding_type == MPLS_STREAM_CODING_TYPE_AC3) ||
(pSTN_table->primary_audio_stream[stream].stream_attributes.stream_coding_type == MPLS_STREAM_CODING_TYPE_DTS) ||
(pSTN_table->primary_audio_stream[stream].stream_attributes.stream_coding_type == MPLS_STREAM_CODING_TYPE_DOLBY_LOSSLESS) ||
(pSTN_table->primary_audio_stream[stream].stream_attributes.stream_coding_type == MPLS_STREAM_CODING_TYPE_AC3_PLUS) ||
(pSTN_table->primary_audio_stream[stream].stream_attributes.stream_coding_type == MPLS_STREAM_CODING_TYPE_DTS_HD) ||
(pSTN_table->primary_audio_stream[stream].stream_attributes.stream_coding_type == MPLS_STREAM_CODING_TYPE_DTS_HD_XLL) ||
(pSTN_table->primary_audio_stream[stream].stream_attributes.stream_coding_type == MPLS_STREAM_CODING_TYPE_AC3_PLUS_SECONDARY) ||
(pSTN_table->primary_audio_stream[stream].stream_attributes.stream_coding_type == MPLS_STREAM_CODING_TYPE_DTS_HD_SECONDARY));
}
}
/* Presentation Graphics, Text Subtitle Entries */
if (pSTN_table->number_of_PG_textST_stream_entries + pSTN_table->number_of_PiP_PG_textST_stream_entries_plus > 0)
{
#if DBG_ON(DBG_TRACE)
gMPLSMemUsage += sizeof(STREAM_TABLE) * (pSTN_table->number_of_PG_textST_stream_entries + pSTN_table->number_of_PiP_PG_textST_stream_entries_plus);
#endif
/* allocate the required number of streams */
pSTN_table->PG_textST_stream = (STREAM_TABLE *)OS_MemAlloc(sizeof(STREAM_TABLE) * (pSTN_table->number_of_PG_textST_stream_entries + pSTN_table->number_of_PiP_PG_textST_stream_entries_plus));
if (pSTN_table->PG_textST_stream == NULL)
{
tStatus = MPLS_NO_MEMORY;
goto errout;
}
/* intialize pg/textst stream data */
memset(pSTN_table->PG_textST_stream, 0, (sizeof(STREAM_TABLE) * (pSTN_table->number_of_PG_textST_stream_entries + pSTN_table->number_of_PiP_PG_textST_stream_entries_plus) ) );
for (int stream=0; stream<pSTN_table->number_of_PG_textST_stream_entries + pSTN_table->number_of_PiP_PG_textST_stream_entries_plus; stream++)
{
/*
* stream_entry()
************************************************************/
mplsLoadStreamEntry(file, &(pSTN_table->PG_textST_stream[stream].stream_entry));
/*
* stream_attributes()
************************************************************/
mplsLoadStreamAttributes(file, &(pSTN_table->PG_textST_stream[stream].stream_attributes));
DbgAssert((pSTN_table->PG_textST_stream[stream].stream_attributes.stream_coding_type == MPLS_STREAM_CODING_TYPE_PG) ||
(pSTN_table->PG_textST_stream[stream].stream_attributes.stream_coding_type == MPLS_STREAM_CODING_TYPE_TEXT_SUBTITLE));
}
}
/* Ineractive Grahpics Entries */
if (pSTN_table->number_of_IG_stream_entries > 0)
{
#if DBG_ON(DBG_TRACE)
gMPLSMemUsage += sizeof(STREAM_TABLE) * pSTN_table->number_of_IG_stream_entries;
#endif
/* allocate the required number of streams */
pSTN_table->IG_stream = (STREAM_TABLE *)OS_MemAlloc(sizeof(STREAM_TABLE) * pSTN_table->number_of_IG_stream_entries);
if (pSTN_table->IG_stream == NULL)
{
tStatus = MPLS_NO_MEMORY;
goto errout;
}
/* intialize ig stream data */
memset(pSTN_table->IG_stream, 0, (sizeof(STREAM_TABLE) * pSTN_table->number_of_IG_stream_entries) );
for (int stream=0; stream<pSTN_table->number_of_IG_stream_entries; stream++)
{
/*
* stream_entry()
************************************************************/
mplsLoadStreamEntry(file, &(pSTN_table->IG_stream[stream].stream_entry));
/*
* stream_attributes()
************************************************************/
mplsLoadStreamAttributes(file, &(pSTN_table->IG_stream[stream].stream_attributes));
DbgAssert(pSTN_table->IG_stream[stream].stream_attributes.stream_coding_type == MPLS_STREAM_CODING_TYPE_IG);
}
}
/* Secondary Audio Stream Entries */
if (pSTN_table->number_of_secondary_audio_stream_entries > 0)
{
#if DBG_ON(DBG_TRACE)
gMPLSMemUsage += sizeof(SECONDARY_AUDIO_STREAM_TABLE) * pSTN_table->number_of_secondary_audio_stream_entries;
#endif
/* allocate the required number of streams */
pSTN_table->secondary_audio_stream = (SECONDARY_AUDIO_STREAM_TABLE *)OS_MemAlloc(sizeof(SECONDARY_AUDIO_STREAM_TABLE) * pSTN_table->number_of_secondary_audio_stream_entries);
if (pSTN_table->secondary_audio_stream == NULL)
{
tStatus = MPLS_NO_MEMORY;
goto errout;
}
/* intialize secondary audio stream data */
memset(pSTN_table->secondary_audio_stream, 0, (sizeof(SECONDARY_AUDIO_STREAM_TABLE) * pSTN_table->number_of_secondary_audio_stream_entries) );
for (int stream=0; stream<pSTN_table->number_of_secondary_audio_stream_entries; stream++)
{
/*
* stream_entry()
************************************************************/
mplsLoadStreamEntry(file, &(pSTN_table->secondary_audio_stream[stream].stream_entry));
/*
* stream_attributes()
************************************************************/
mplsLoadStreamAttributes(file, &(pSTN_table->secondary_audio_stream[stream].stream_attributes));
DbgAssert((pSTN_table->secondary_audio_stream[stream].stream_attributes.stream_coding_type == MPLS_STREAM_CODING_TYPE_LPCM) ||
(pSTN_table->secondary_audio_stream[stream].stream_attributes.stream_coding_type == MPLS_STREAM_CODING_TYPE_AC3) ||
(pSTN_table->secondary_audio_stream[stream].stream_attributes.stream_coding_type == MPLS_STREAM_CODING_TYPE_DTS) ||
(pSTN_table->secondary_audio_stream[stream].stream_attributes.stream_coding_type == MPLS_STREAM_CODING_TYPE_DOLBY_LOSSLESS) ||
(pSTN_table->secondary_audio_stream[stream].stream_attributes.stream_coding_type == MPLS_STREAM_CODING_TYPE_AC3_PLUS) ||
(pSTN_table->secondary_audio_stream[stream].stream_attributes.stream_coding_type == MPLS_STREAM_CODING_TYPE_DTS_HD) ||
(pSTN_table->secondary_audio_stream[stream].stream_attributes.stream_coding_type == MPLS_STREAM_CODING_TYPE_DTS_HD_XLL) ||
(pSTN_table->secondary_audio_stream[stream].stream_attributes.stream_coding_type == MPLS_STREAM_CODING_TYPE_AC3_PLUS_SECONDARY) ||
(pSTN_table->secondary_audio_stream[stream].stream_attributes.stream_coding_type == MPLS_STREAM_CODING_TYPE_DTS_HD_SECONDARY));
/* read stream attributes */
if (LoaderFileRead(pMPLS_DB->hLoader, file, (PVOID)pTmpBuf, 2, NULL) != LOADER_SUCCESS)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("%s:%u Read Failed!\n", __FUNCTION__, __LINE__));
tStatus = MPLS_FILE_ERROR;
goto errout;
}
/* number of primary audio ref entries */
pSTN_table->secondary_audio_stream[stream].number_of_primary_audio_ref_entries = pTmpBuf[0];
/* primary audio number ref */
for (ref_entry=0; ref_entry<pSTN_table->secondary_audio_stream[stream].number_of_primary_audio_ref_entries; ref_entry++)
{
if (LoaderFileRead(pMPLS_DB->hLoader, file, (PVOID)pTmpBuf, 1, NULL) != LOADER_SUCCESS)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("%s:%u Read Failed!\n", __FUNCTION__, __LINE__));
tStatus = MPLS_FILE_ERROR;
goto errout;
}
pSTN_table->secondary_audio_stream[stream].primary_audio_stream_id_ref[ref_entry] = pTmpBuf[0];
}
/* skip over the reserved byte if necessary */
if (pSTN_table->secondary_audio_stream[stream].number_of_primary_audio_ref_entries % 2 == 1)
{
if (LoaderFileSeek(pMPLS_DB->hLoader, file, LOADER_SEEK_CURRENT, 1) != LOADER_SUCCESS)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("%s: %u: Failed to seek in file!\n", __FILE__, __LINE__));
tStatus = MPLS_FILE_ERROR;
goto errout;
}
}
}
}
if (version < 95)
{
return (MPLS_SUCCESS);
}
/* Secondary Video Stream Entries */
if (pSTN_table->number_of_secondary_video_stream_entries > 0)
{
#if DBG_ON(DBG_TRACE)
gMPLSMemUsage += sizeof(SECONDARY_VIDEO_STREAM_TABLE) * pSTN_table->number_of_secondary_video_stream_entries;
#endif
/* allocate the required number of streams */
pSTN_table->secondary_video_stream = (SECONDARY_VIDEO_STREAM_TABLE *)OS_MemAlloc(sizeof(SECONDARY_VIDEO_STREAM_TABLE) * pSTN_table->number_of_secondary_video_stream_entries);
if (pSTN_table->secondary_video_stream == NULL)
{
tStatus = MPLS_NO_MEMORY;
goto errout;
}
/* intialize secondary audio stream data */
memset(pSTN_table->secondary_video_stream, 0, (sizeof(SECONDARY_VIDEO_STREAM_TABLE) * pSTN_table->number_of_secondary_video_stream_entries) );
for (int stream=0; stream<pSTN_table->number_of_secondary_video_stream_entries; stream++)
{
/*
* stream_entry()
************************************************************/
mplsLoadStreamEntry(file, &(pSTN_table->secondary_video_stream[stream].stream_entry));
/*
* stream_attributes()
************************************************************/
mplsLoadStreamAttributes(file, &(pSTN_table->secondary_video_stream[stream].stream_attributes));
/* this is a video stream so should only have video coding types */
DbgAssert((pSTN_table->secondary_video_stream[stream].stream_attributes.stream_coding_type == MPLS_STREAM_CODING_TYPE_MPEG2) ||
(pSTN_table->secondary_video_stream[stream].stream_attributes.stream_coding_type == MPLS_STREAM_CODING_TYPE_AVC) ||
(pSTN_table->secondary_video_stream[stream].stream_attributes.stream_coding_type == MPLS_STREAM_CODING_TYPE_VC1) );
/*
* secondary video - associated secondary audio
*/
if (LoaderFileRead(pMPLS_DB->hLoader, file, (PVOID)pTmpBuf, 2, NULL) != LOADER_SUCCESS)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("%s:%u Read Failed!\n", __FUNCTION__, __LINE__));
tStatus = MPLS_FILE_ERROR;
goto errout;
}
/* number of secondary audio ref entries */
pSTN_table->secondary_video_stream[stream].number_of_secondary_audio_ref_entries = pTmpBuf[0];
/* secondary audio number ref */
for (ref_entry=0; ref_entry<pSTN_table->secondary_video_stream[stream].number_of_secondary_audio_ref_entries; ref_entry++)
{
if (LoaderFileRead(pMPLS_DB->hLoader, file, (PVOID)pTmpBuf, 1, NULL) != LOADER_SUCCESS)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("%s:%u Read Failed!\n", __FUNCTION__, __LINE__));
tStatus = MPLS_FILE_ERROR;
goto errout;
}
pSTN_table->secondary_video_stream[stream].secondary_audio_stream_id_ref[ref_entry] = pTmpBuf[0];
}
/* skip over the reserved byte if necessary */
if (pSTN_table->secondary_video_stream[stream].number_of_secondary_audio_ref_entries % 2 == 1)
{
if (LoaderFileSeek(pMPLS_DB->hLoader, file, LOADER_SEEK_CURRENT, 1) != LOADER_SUCCESS)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("%s: %u: Failed to seek in file!\n", __FILE__, __LINE__));
tStatus = MPLS_FILE_ERROR;
goto errout;
}
}
/*
* secondary video - associated secondary PG/textst
*/
if (LoaderFileRead(pMPLS_DB->hLoader, file, (PVOID)pTmpBuf, 2, NULL) != LOADER_SUCCESS)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("%s:%u Read Failed!\n", __FUNCTION__, __LINE__));
tStatus = MPLS_FILE_ERROR;
goto errout;
}
/* number of PIP pg/textst ref entries */
pSTN_table->secondary_video_stream[stream].number_of_PiP_PG_textST_ref_entries = pTmpBuf[0];
/* PiP_PG_textST stream id ref */
for (ref_entry=0; ref_entry<pSTN_table->secondary_video_stream[stream].number_of_PiP_PG_textST_ref_entries; ref_entry++)
{
if (LoaderFileRead(pMPLS_DB->hLoader, file, (PVOID)pTmpBuf, 1, NULL) != LOADER_SUCCESS)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("%s:%u Read Failed!\n", __FUNCTION__, __LINE__));
tStatus = MPLS_FILE_ERROR;
goto errout;
}
pSTN_table->secondary_video_stream[stream].PiP_PG_textST_stream_id_ref[ref_entry] = pTmpBuf[0];
}
/* skip over the reserved byte if necessary */
if (pSTN_table->secondary_video_stream[stream].number_of_PiP_PG_textST_ref_entries % 2 == 1)
{
if (LoaderFileSeek(pMPLS_DB->hLoader, file, LOADER_SEEK_CURRENT, 1) != LOADER_SUCCESS)
{
DBGPRINT(DBG_ON(DBG_ERROR), ("%s: %u: Failed to seek in file!\n", __FILE__, __LINE__));
tStatus = MPLS_FILE_ERROR;
goto errout;
}
}
}
}
return (MPLS_SUCCESS);
errout:
/* free allocations */
mplsUnLoadPlayList_STN_table(pSTN_table);
return (tStatus);
}
/**
* mplsUnLoadPlayList_STN_table -- Dealloc STN_table portion of the current PlayItem.
*
* @param
* pSTN_table - pointer to record to receive the parsed data
*
* @retval
* MPLS_SUCCESS, MPLS_FILE_ERROR
*/
static MPLS_STATUS mplsUnLoadPlayList_STN_table(STN_TABLE *pSTN_tabl
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -