📄 descriptors.cpp
字号:
/* <LIC_AMD_STD>
* Copyright (C) 2003-2005 Advanced Micro Devices, Inc. All Rights Reserved.
*
* Unless otherwise designated in writing, this software and any related
* documentation are the confidential proprietary information of AMD.
* THESE MATERIALS ARE PROVIDED "AS IS" WITHOUT ANY
* UNLESS OTHERWISE NOTED IN WRITING, EXPRESS OR IMPLIED WARRANTY OF ANY
* KIND, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY,
* NONINFRINGEMENT, TITLE, FITNESS FOR ANY PARTICULAR PURPOSE AND IN NO
* EVENT SHALL AMD OR ITS LICENSORS BE LIABLE FOR ANY DAMAGES WHATSOEVER.
*
* AMD does not assume any responsibility for any errors which may appear
* in the Materials nor any responsibility to support or update the
* Materials. AMD retains the right to modify the Materials at any time,
* without notice, and is not obligated to provide such modified
* Materials to you. AMD is not obligated to furnish, support, or make
* any further information available to you.
* </LIC_AMD_STD> */
/* <CTL_AMD_STD>
* </CTL_AMD_STD> */
/* <DOC_AMD_STD>
* </DOC_AMD_STD> */
#include "descriptors.h"
void CSLConfigDescriptor::ReadData(Byte_Stream &input_stream)
{
UINT temp =0;
predefined = input_stream.GetByte();
if (predefined==0)
{
temp = input_stream.GetByte();
useAccessUnitStartFlag = BitField(temp,7,1);
useAccessUnitEndFlag = BitField(temp,6,1);
useRandomAccessPointFlag = BitField(temp,5,1);
hasRandomAccessUnitsOnlyFlag = BitField(temp,4,1);
usePaddingFlag = BitField(temp,3,1);
useTimeStampsFlag = BitField(temp,2,1);
useIdleFlag = BitField(temp,1,1);
durationFlag = BitField(temp,0,1);
timeStampResolution = input_stream.GetUINT();
OCRResolution = input_stream.GetUINT();
timeStampLength = input_stream.GetByte(); // must be . 64
OCRLength = input_stream.GetByte(); // must be . 64
AU_Length = input_stream.GetByte(); // must be . 32
instantBitrateLength = input_stream.GetByte();
temp = input_stream.GetWORD();
degradationPriorityLength = BitField(temp,12,4);
AU_seqNumLength = BitField(temp,7,5); // must be . 16
packetSeqNumLength = BitField(temp,2,5); // must be . 16
reserved = BitField(temp,0,2); // should be 11;
if (durationFlag) {
timeScale = input_stream.GetUINT();
accessUnitDuration = input_stream.GetWORD();
compositionUnitDuration = input_stream.GetWORD();
}
if (!useTimeStampsFlag) {
// TODO: currently assumeses timeStampLength to be 32-bits
temp = input_stream.GetUINT();
startDecodingTimeStamp = BitField(temp,0,timeStampLength);
temp = input_stream.GetUINT();
startCompositionTimeStamp = BitField(temp,0,timeStampLength);
}
}
temp = input_stream.GetByte();
OCRstreamFlag = BitField(temp,7,1);
reserved = BitField(temp,0,7); // should be 1111111;
if (OCRstreamFlag)
OCR_ES_Id = input_stream.GetWORD();
}
void CDecoderConfigDescriptor::ReadData(Byte_Stream &input_stream)
{
UINT temp =0;
objectTypeIndication = input_stream.GetByte();
temp = input_stream.GetByte();
streamType = BitField(temp,2,6);
upStream = BitField(temp,1,1);
reserved = BitField(temp,0,1);
temp = input_stream.GetUINT();
bufferSizeDB = BitField(temp,8,24);
maxBitrate = BitField(temp,0,8);
temp = input_stream.GetUINT();
maxBitrate <<= 24;
maxBitrate |= BitField(temp,8,24);
avgBitrate = BitField(temp,0,8);
avgBitrate <<= 24;
temp = input_stream.GetWORD();
avgBitrate |= (temp << 8);
temp = input_stream.GetByte();
avgBitrate |= temp ;
//if(DescriptorSize > 18 )
//AudioSpecificInfo.ReadData(input_stream);
}
void CES_Descriptor::ReadData(Byte_Stream &input_stream)
{
UINT temp =0;
int byte_count = 0;
tag = input_stream.GetByte();
if(tag == ES_DescrTag)
{
GetDescriptorLength(input_stream);
ES_ID = input_stream.GetWORD();
temp = input_stream.GetByte();
streamDependenceFlag = BitField(temp,7,1);
URL_Flag = BitField(temp,6,1);
reserved = BitField(temp,5,1);
streamPriority = BitField(temp,0,5);
//if(reserved != 0x1)
if (streamDependenceFlag)
dependsOn_ES_ID = input_stream.GetWORD();
if(URL_Flag)
{
URLlength = input_stream.GetByte();
URLstring = (m_u8 *) malloc(URLlength * sizeof(m_u8));
memcpy(URLstring,input_stream.GetBytePointer(),URLlength);
}
tag = input_stream.GetByte();
if(tag == DecoderConfigDescrTag)
{
decConfigDescr = new CDecoderConfigDescriptor();
decConfigDescr->GetDescriptorLength(input_stream);
decConfigDescr->tag = DecoderConfigDescrTag;
decConfigDescr->ReadData(input_stream);
}
// skip rest of the descriptor
/*
tag = input_stream.GetByte();
if(tag == SLConfigDescrTag)
{
byte_count = 0;
while(input_stream.GetByte() == 0x80 && byte_count++ < 4);
slConfigDescr = new CSLConfigDescriptor;
slConfigDescr->tag = SLConfigDescrTag;
slConfigDescr->ReadData(input_stream);
}
*/
}
}
void CObjectDescriptor::ReadData(Byte_Stream &input_stream)
{
UINT temp =0;
//tag = input_stream.GetByte();
temp = input_stream.GetWORD();
ObjectDescriptorID = BitField(temp,6,10);
URL_Flag = BitField(temp,5,1);
reserved = BitField(temp,0,5);
//if(reserved != 0xf1)
if(URL_Flag)
{
URLlength = input_stream.GetByte();
URLstring = (m_u8 *) malloc(URLlength * sizeof(m_u8));
memcpy(URLstring,input_stream.GetBytePointer(),URLlength);
}
else
{
while(input_stream.GetByte() == ES_DescrTag)
{
CESDescriptorList[esd_cnt] = new CES_Descriptor;
CESDescriptorList[esd_cnt]->tag = ES_DescrTag;
CESDescriptorList[esd_cnt]->ReadData(input_stream);
esd_cnt++;
}
}
}
void CInitialObjectDescriptor::ReadData(Byte_Stream &input_stream)
{
UINT temp =0;
temp = input_stream.GetWORD();
ObjectDescriptorID = BitField(temp,6,10);
URL_Flag = BitField(temp,5,1);
includeInlineProfileLevelFlag = BitField(temp,4,1);
reserved = BitField(temp,0,4);
//if(reserved != 0xf)
if(URL_Flag)
{
URLlength = input_stream.GetByte();
URLstring = (m_u8 *) malloc(URLlength * sizeof(m_u8));
memcpy(URLstring,input_stream.GetBytePointer(),URLlength);
}
else
{
ODProfileLevelIndication = input_stream.GetByte();
sceneProfileLevelIndication = input_stream.GetByte();
audioProfileLevelIndication = input_stream.GetByte();
visualProfileLevelIndication = input_stream.GetByte();
graphicsProfileLevelIndication = input_stream.GetByte();
}
while(input_stream.GetByte() == ES_DescrTag)
{
CESDescriptorList[esd_cnt] = new CES_Descriptor;
CESDescriptorList[esd_cnt]->tag = ES_DescrTag;
CESDescriptorList[esd_cnt]->ReadData(input_stream);
esd_cnt++;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -