Simplify names of enum class members
The member name is now always prefixed with the class name so can be shortened without risk of confusion / mixing.
This commit is contained in:
parent
38eac9b673
commit
53f39657b8
@ -87,12 +87,12 @@ AC3Codec::AC3ParseError AC3Codec::parseHeader(uint8_t* buf, uint8_t* end)
|
||||
gbc.setBuffer(buf, end);
|
||||
|
||||
if (gbc.getBits(16) != 0x0B77) // sync_word
|
||||
return AC3ParseError::AC3_PARSE_ERROR_SYNC;
|
||||
return AC3ParseError::SYNC;
|
||||
|
||||
// read ahead to bsid to make sure this is AC-3, not E-AC-3
|
||||
int id = gbc.showBits(29) & 0x1F;
|
||||
if (id > 16)
|
||||
return AC3ParseError::AC3_PARSE_ERROR_BSID;
|
||||
return AC3ParseError::BSID;
|
||||
|
||||
m_bsid = id;
|
||||
if (m_bsid > 10) // bsid = 16 => EAC3
|
||||
@ -103,13 +103,13 @@ AC3Codec::AC3ParseError AC3Codec::parseHeader(uint8_t* buf, uint8_t* end)
|
||||
|
||||
strmtyp = gbc.getBits(2);
|
||||
if (strmtyp == 3)
|
||||
return AC3ParseError::AC3_PARSE_ERROR_SYNC; // invalid stream type
|
||||
return AC3ParseError::SYNC; // invalid stream type
|
||||
|
||||
substreamid = gbc.getBits(3);
|
||||
|
||||
m_frame_size = (gbc.getBits(11) + 1) * 2;
|
||||
if (m_frame_size < AC3_HEADER_SIZE)
|
||||
return AC3ParseError::AC3_PARSE_ERROR_FRAME_SIZE; // invalid header size
|
||||
return AC3ParseError::FRAME_SIZE; // invalid header size
|
||||
|
||||
fscod = gbc.getBits(2);
|
||||
|
||||
@ -117,7 +117,7 @@ AC3Codec::AC3ParseError AC3Codec::parseHeader(uint8_t* buf, uint8_t* end)
|
||||
{
|
||||
int m_fscod2 = gbc.getBits(2);
|
||||
if (m_fscod2 == 3)
|
||||
return AC3ParseError::AC3_PARSE_ERROR_SYNC;
|
||||
return AC3ParseError::SYNC;
|
||||
|
||||
numblkscod = 3;
|
||||
m_sample_rate = ff_ac3_freqs[m_fscod2] / 2;
|
||||
@ -266,11 +266,11 @@ AC3Codec::AC3ParseError AC3Codec::parseHeader(uint8_t* buf, uint8_t* end)
|
||||
gbc.skipBits(16); // m_crc1
|
||||
m_fscod = gbc.getBits(2);
|
||||
if (m_fscod == 3)
|
||||
return AC3ParseError::AC3_PARSE_ERROR_SAMPLE_RATE;
|
||||
return AC3ParseError::SAMPLE_RATE;
|
||||
|
||||
m_frmsizecod = gbc.getBits(6);
|
||||
if (m_frmsizecod > 37)
|
||||
return AC3ParseError::AC3_PARSE_ERROR_FRAME_SIZE;
|
||||
return AC3ParseError::FRAME_SIZE;
|
||||
|
||||
gbc.skipBits(5); // skip bsid, already got it
|
||||
|
||||
@ -290,7 +290,7 @@ AC3Codec::AC3ParseError AC3Codec::parseHeader(uint8_t* buf, uint8_t* end)
|
||||
m_channels = ff_ac3_channels[m_acmod] + m_lfeon;
|
||||
m_frame_size = ff_ac3_frame_sizes[m_frmsizecod][m_fscod] * 2;
|
||||
}
|
||||
return AC3ParseError::AC3_PARSE_NO_ERROR;
|
||||
return AC3ParseError::NO_ERROR;
|
||||
}
|
||||
|
||||
bool AC3Codec::decodeDtsHdFrame(uint8_t* buffer, uint8_t* end)
|
||||
@ -372,7 +372,7 @@ int AC3Codec::decodeFrame(uint8_t* buf, uint8_t* end, int& skipBytes)
|
||||
skipBytes = 0;
|
||||
err = parseHeader(buf, end);
|
||||
|
||||
if (err != AC3ParseError::AC3_PARSE_NO_ERROR)
|
||||
if (err != AC3ParseError::NO_ERROR)
|
||||
return 0; // parse error
|
||||
|
||||
m_frameDurationNano = (1000000000ull * m_samples) / m_sample_rate;
|
||||
@ -459,7 +459,7 @@ AC3Codec::AC3ParseError AC3Codec::testParseHeader(uint8_t* buf, uint8_t* end)
|
||||
|
||||
int test_sync_word = gbc.getBits(16);
|
||||
if (test_sync_word != 0x0B77)
|
||||
return AC3ParseError::AC3_PARSE_ERROR_SYNC;
|
||||
return AC3ParseError::SYNC;
|
||||
|
||||
// read ahead to bsid to make sure this is AC-3, not E-AC-3
|
||||
int test_bsid = gbc.showBits(29) & 0x1F;
|
||||
@ -470,22 +470,22 @@ AC3Codec::AC3ParseError AC3Codec::testParseHeader(uint8_t* buf, uint8_t* end)
|
||||
|
||||
if (test_bsid > 16)
|
||||
{
|
||||
return AC3ParseError::AC3_PARSE_ERROR_SYNC; // invalid stream type
|
||||
return AC3ParseError::SYNC; // invalid stream type
|
||||
}
|
||||
else if (m_bsid > 10)
|
||||
{
|
||||
return AC3ParseError::AC3_PARSE_ERROR_SYNC; // doesn't used for EAC3
|
||||
return AC3ParseError::SYNC; // doesn't used for EAC3
|
||||
}
|
||||
else
|
||||
{
|
||||
int test_crc1 = gbc.getBits(16);
|
||||
int test_fscod = gbc.getBits(2);
|
||||
if (test_fscod == 3)
|
||||
return AC3ParseError::AC3_PARSE_ERROR_SAMPLE_RATE;
|
||||
return AC3ParseError::SAMPLE_RATE;
|
||||
|
||||
int test_frmsizecod = gbc.getBits(6);
|
||||
if (test_frmsizecod > 37)
|
||||
return AC3ParseError::AC3_PARSE_ERROR_FRAME_SIZE;
|
||||
return AC3ParseError::FRAME_SIZE;
|
||||
|
||||
gbc.skipBits(5); // skip bsid, already got it
|
||||
|
||||
@ -494,7 +494,7 @@ AC3Codec::AC3ParseError AC3Codec::testParseHeader(uint8_t* buf, uint8_t* end)
|
||||
|
||||
if (test_fscod != m_fscod || /*(test_frmsizecod>>1) != (m_frmsizecod>>1) ||*/
|
||||
test_bsmod != m_bsmod /*|| test_acmod != m_acmod*/)
|
||||
return AC3ParseError::AC3_PARSE_ERROR_SYNC;
|
||||
return AC3ParseError::SYNC;
|
||||
|
||||
if ((test_acmod & 1) && test_acmod != AC3_ACMOD_MONO)
|
||||
{
|
||||
@ -509,12 +509,12 @@ AC3Codec::AC3ParseError AC3Codec::testParseHeader(uint8_t* buf, uint8_t* end)
|
||||
{
|
||||
int test_dsurmod = gbc.getBits(2);
|
||||
if (test_dsurmod != m_dsurmod)
|
||||
return AC3ParseError::AC3_PARSE_ERROR_SYNC;
|
||||
return AC3ParseError::SYNC;
|
||||
}
|
||||
int test_lfeon = gbc.getBit();
|
||||
|
||||
if (test_lfeon != m_lfeon)
|
||||
return AC3ParseError::AC3_PARSE_ERROR_SYNC;
|
||||
return AC3ParseError::SYNC;
|
||||
|
||||
int test_halfratecod = max(test_bsid, 8) - 8;
|
||||
int test_sample_rate = ff_ac3_freqs[test_fscod] >> test_halfratecod;
|
||||
@ -523,14 +523,14 @@ AC3Codec::AC3ParseError AC3Codec::testParseHeader(uint8_t* buf, uint8_t* end)
|
||||
int test_frame_size = ff_ac3_frame_sizes[test_frmsizecod][test_fscod] * 2;
|
||||
if (test_halfratecod != m_halfratecod || test_sample_rate != m_sample_rate || test_bit_rate != m_bit_rate ||
|
||||
test_channels != m_channels /*|| test_frame_size != m_frame_size*/)
|
||||
return AC3ParseError::AC3_PARSE_ERROR_SYNC;
|
||||
return AC3ParseError::SYNC;
|
||||
}
|
||||
return AC3ParseError::AC3_PARSE_NO_ERROR;
|
||||
return AC3ParseError::NO_ERROR;
|
||||
}
|
||||
|
||||
bool AC3Codec::testDecodeTestFrame(uint8_t* buf, uint8_t* end)
|
||||
{
|
||||
return testParseHeader(buf, end) == AC3ParseError::AC3_PARSE_NO_ERROR;
|
||||
return testParseHeader(buf, end) == AC3ParseError::NO_ERROR;
|
||||
}
|
||||
|
||||
uint64_t AC3Codec::getFrameDurationNano()
|
||||
|
@ -41,11 +41,11 @@ class AC3Codec
|
||||
|
||||
enum class AC3ParseError
|
||||
{
|
||||
AC3_PARSE_NO_ERROR = 0,
|
||||
AC3_PARSE_ERROR_SYNC = -1,
|
||||
AC3_PARSE_ERROR_BSID = -2,
|
||||
AC3_PARSE_ERROR_SAMPLE_RATE = -3,
|
||||
AC3_PARSE_ERROR_FRAME_SIZE = -4
|
||||
NO_ERROR = 0,
|
||||
SYNC = -1,
|
||||
BSID = -2,
|
||||
SAMPLE_RATE = -3,
|
||||
FRAME_SIZE = -4
|
||||
};
|
||||
|
||||
AC3Codec()
|
||||
|
@ -230,7 +230,7 @@ bool writeBdMovieObjectData(const MuxerManager& muxer, AbstractOutputStream* fil
|
||||
{0x21, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}}};
|
||||
|
||||
BDMV_VersionNumber num = BDMV_VersionNumber::Version1;
|
||||
if (diskType == DiskType::DT_BLURAY)
|
||||
if (diskType == DiskType::BLURAY)
|
||||
{
|
||||
num = isV3() ? BDMV_VersionNumber::Version3 : BDMV_VersionNumber::Version2;
|
||||
}
|
||||
@ -303,7 +303,7 @@ bool BlurayHelper::open(const string& dst, DiskType dt, int64_t diskSize, int ex
|
||||
|
||||
bool BlurayHelper::createBluRayDirs()
|
||||
{
|
||||
if (m_dt == DiskType::DT_BLURAY)
|
||||
if (m_dt == DiskType::BLURAY)
|
||||
{
|
||||
if (m_isoWriter)
|
||||
{
|
||||
@ -359,7 +359,7 @@ bool BlurayHelper::writeBluRayFiles(const MuxerManager& muxer, bool usedBlankPL,
|
||||
file = new File();
|
||||
|
||||
uint8_t* V3metaData;
|
||||
if (m_dt == DiskType::DT_BLURAY)
|
||||
if (m_dt == DiskType::BLURAY)
|
||||
{
|
||||
if (isV3())
|
||||
{
|
||||
@ -420,7 +420,7 @@ bool BlurayHelper::createCLPIFile(TSMuxer* muxer, int clpiNum, bool doLog)
|
||||
uint8_t* clpiBuffer = new uint8_t[CLPI_BUFFER_SIZE];
|
||||
CLPIParser clpiParser;
|
||||
string version_number;
|
||||
if (m_dt == DiskType::DT_BLURAY)
|
||||
if (m_dt == DiskType::BLURAY)
|
||||
memcpy(&clpiParser.version_number, isV3() ? "0300" : "0200", 5);
|
||||
else
|
||||
memcpy(&clpiParser.version_number, "0100", 5);
|
||||
@ -433,7 +433,7 @@ bool BlurayHelper::createCLPIFile(TSMuxer* muxer, int clpiNum, bool doLog)
|
||||
clpiParser.is_ATC_delta = false;
|
||||
if (doLog)
|
||||
{
|
||||
if (m_dt == DiskType::DT_BLURAY)
|
||||
if (m_dt == DiskType::BLURAY)
|
||||
{
|
||||
LTRACE(LT_INFO, 2, "Creating Blu-ray stream info and seek index");
|
||||
}
|
||||
@ -624,7 +624,7 @@ bool BlurayHelper::createMPLSFile(TSMuxer* mainMuxer, TSMuxer* subMuxer, int aut
|
||||
}
|
||||
}
|
||||
|
||||
if (dt == DiskType::DT_BLURAY)
|
||||
if (dt == DiskType::BLURAY)
|
||||
{
|
||||
LTRACE(LT_INFO, 2, "Creating Blu-ray playlist");
|
||||
}
|
||||
|
@ -334,7 +334,7 @@ FileEntryInfo::FileEntryInfo(IsoWriter* owner, FileEntryInfo* parent, uint32_t o
|
||||
|
||||
bool FileEntryInfo::isFile() const
|
||||
{
|
||||
return m_fileType == FileTypes::FileType_File || m_fileType == FileTypes::FileType_RealtimeFile;
|
||||
return m_fileType == FileTypes::File || m_fileType == FileTypes::RealtimeFile;
|
||||
}
|
||||
|
||||
FileEntryInfo::~FileEntryInfo()
|
||||
@ -358,7 +358,7 @@ void FileEntryInfo::writeEntity(ByteFileWriter& writer, FileEntryInfo* subDir)
|
||||
{
|
||||
bool isSystemFile = (m_objectId == 0);
|
||||
|
||||
writer.writeDescriptorTag(DescriptorTag::DESC_TYPE_FileId, m_owner->absoluteSectorNum() + 1);
|
||||
writer.writeDescriptorTag(DescriptorTag::FileId, m_owner->absoluteSectorNum() + 1);
|
||||
writer.writeLE16(0x01); // File Version Number
|
||||
writer.writeLE8(!subDir->isFile() ? 0x02
|
||||
: (isSystemFile ? 0x10 : 0)); // File Characteristics, 'directory' bit (1-th)
|
||||
@ -418,7 +418,7 @@ void FileEntryInfo::serializeDir()
|
||||
|
||||
// ------------ 1 (parent entry) ---------------
|
||||
|
||||
writer.writeDescriptorTag(DescriptorTag::DESC_TYPE_FileId, m_owner->absoluteSectorNum() + 1);
|
||||
writer.writeDescriptorTag(DescriptorTag::FileId, m_owner->absoluteSectorNum() + 1);
|
||||
writer.writeLE16(0x01); // File Version Number
|
||||
writer.writeLE8(0x0A); // File Characteristics, parent flag (3-th bit) and 'directory' bit (1-th)
|
||||
writer.writeLE8(0x00); // Length of File Identifier (=L_FI)
|
||||
@ -558,9 +558,9 @@ int ISOFile::write(const void* data, uint32_t len)
|
||||
|
||||
bool ISOFile::open(const char* name, unsigned int oflag, unsigned int systemDependentFlags)
|
||||
{
|
||||
FileTypes fileType = FileTypes::FileType_File;
|
||||
FileTypes fileType = FileTypes::File;
|
||||
if (strEndWith(name, ".m2ts") || strEndWith(name, ".ssif"))
|
||||
fileType = FileTypes::FileType_RealtimeFile;
|
||||
fileType = FileTypes::RealtimeFile;
|
||||
m_entry = m_owner->getEntryByName(toIsoSeparator(name), fileType);
|
||||
return true;
|
||||
}
|
||||
@ -673,11 +673,11 @@ bool IsoWriter::open(const std::string& fileName, int64_t diskSize, int extraISO
|
||||
m_metadataLBN = (int)(m_file.size() / SECTOR_SIZE);
|
||||
|
||||
// create root
|
||||
m_rootDirInfo = new FileEntryInfo(this, 0, 0, FileTypes::FileType_Directory);
|
||||
m_rootDirInfo = new FileEntryInfo(this, 0, 0, FileTypes::Directory);
|
||||
|
||||
// create system stream dir
|
||||
m_systemStreamDir = new FileEntryInfo(this, 0, 0, FileTypes::FileType_SystemStreamDirectory);
|
||||
m_metadataMappingFile = new FileEntryInfo(this, m_systemStreamDir, 0, FileTypes::FileType_File);
|
||||
m_systemStreamDir = new FileEntryInfo(this, 0, 0, FileTypes::SystemStreamDirectory);
|
||||
m_metadataMappingFile = new FileEntryInfo(this, m_systemStreamDir, 0, FileTypes::File);
|
||||
m_metadataMappingFile->setName("*UDF Unique ID Mapping Data");
|
||||
m_systemStreamDir->addFile(m_metadataMappingFile);
|
||||
|
||||
@ -705,7 +705,7 @@ FileEntryInfo* IsoWriter::mkdir(const char* name, FileEntryInfo* parent)
|
||||
if (parent == 0)
|
||||
parent = m_rootDirInfo;
|
||||
|
||||
FileEntryInfo* dir = new FileEntryInfo(this, parent, m_objectUniqId++, FileTypes::FileType_Directory);
|
||||
FileEntryInfo* dir = new FileEntryInfo(this, parent, m_objectUniqId++, FileTypes::Directory);
|
||||
dir->setName(name);
|
||||
parent->addSubDir(dir);
|
||||
// m_sectorNum += 2;
|
||||
@ -715,7 +715,7 @@ FileEntryInfo* IsoWriter::mkdir(const char* name, FileEntryInfo* parent)
|
||||
|
||||
bool IsoWriter::createDir(const std::string& dir)
|
||||
{
|
||||
getEntryByName(toIsoSeparator(dir), FileTypes::FileType_Directory);
|
||||
getEntryByName(toIsoSeparator(dir), FileTypes::Directory);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -724,15 +724,15 @@ ISOFile* IsoWriter::createFile() { return new ISOFile(this); }
|
||||
bool IsoWriter::createInterleavedFile(const std::string& inFile1, const std::string& inFile2,
|
||||
const std::string& outFile)
|
||||
{
|
||||
FileEntryInfo* inEntry1 = getEntryByName(toIsoSeparator(inFile1), FileTypes::FileType_RealtimeFile);
|
||||
FileEntryInfo* inEntry1 = getEntryByName(toIsoSeparator(inFile1), FileTypes::RealtimeFile);
|
||||
if (!inEntry1)
|
||||
return false;
|
||||
|
||||
FileEntryInfo* inEntry2 = getEntryByName(toIsoSeparator(inFile2), FileTypes::FileType_RealtimeFile);
|
||||
FileEntryInfo* inEntry2 = getEntryByName(toIsoSeparator(inFile2), FileTypes::RealtimeFile);
|
||||
if (!inEntry2)
|
||||
return false;
|
||||
|
||||
FileEntryInfo* outEntry = getEntryByName(toIsoSeparator(outFile), FileTypes::FileType_RealtimeFile);
|
||||
FileEntryInfo* outEntry = getEntryByName(toIsoSeparator(outFile), FileTypes::RealtimeFile);
|
||||
if (!outEntry)
|
||||
return false;
|
||||
|
||||
@ -769,7 +769,7 @@ FileEntryInfo* IsoWriter::getEntryByName(const std::string& name, FileTypes file
|
||||
FileEntryInfo* entry = m_rootDirInfo;
|
||||
if (!entry)
|
||||
return 0;
|
||||
bool isDir = fileType == FileTypes::FileType_Directory || fileType == FileTypes::FileType_SystemStreamDirectory;
|
||||
bool isDir = fileType == FileTypes::Directory || fileType == FileTypes::SystemStreamDirectory;
|
||||
size_t idxMax = isDir ? parts.size() : parts.size() - 1;
|
||||
for (size_t i = 0; i < idxMax; ++i)
|
||||
{
|
||||
@ -860,7 +860,7 @@ void IsoWriter::close()
|
||||
int64_t sz = m_file.size();
|
||||
m_metadataMirrorLBN = (int)(m_file.size() / SECTOR_SIZE + 1);
|
||||
m_tagLocationBaseAddr = m_partitionStartAddress;
|
||||
writeExtentFileDescriptor(0, 0, FileTypes::FileType_MetadataMirror, m_metadataFileLen,
|
||||
writeExtentFileDescriptor(0, 0, FileTypes::MetadataMirror, m_metadataFileLen,
|
||||
m_metadataMirrorLBN - m_partitionStartAddress, 0);
|
||||
|
||||
// allocate space for metadata mirror file
|
||||
@ -881,7 +881,7 @@ void IsoWriter::close()
|
||||
m_file.seek(1024 * 576);
|
||||
// metadata file location and length (located at 576K, point to 640K address)
|
||||
m_tagLocationBaseAddr = m_partitionStartAddress;
|
||||
writeExtentFileDescriptor(0, 0, FileTypes::FileType_Metadata, m_metadataFileLen,
|
||||
writeExtentFileDescriptor(0, 0, FileTypes::Metadata, m_metadataFileLen,
|
||||
m_metadataLBN - m_partitionStartAddress, 0);
|
||||
m_tagLocationBaseAddr = m_metadataLBN; // Don't know why. Doing just as scenarist does
|
||||
writeMetadata(m_metadataLBN);
|
||||
@ -949,10 +949,10 @@ void IsoWriter::writeEntity(FileEntryInfo* dir)
|
||||
|
||||
int IsoWriter::allocateEntity(FileEntryInfo* entity, int sectorNum)
|
||||
{
|
||||
if ((entity->m_fileType == FileTypes::FileType_File || entity->m_fileType == FileTypes::FileType_RealtimeFile) &&
|
||||
if ((entity->m_fileType == FileTypes::File || entity->m_fileType == FileTypes::RealtimeFile) &&
|
||||
entity->m_objectId)
|
||||
m_totalFiles++;
|
||||
else if (entity->m_fileType == FileTypes::FileType_Directory)
|
||||
else if (entity->m_fileType == FileTypes::Directory)
|
||||
m_totalDirectories++;
|
||||
|
||||
sectorNum += entity->allocateEntity(sectorNum);
|
||||
@ -968,7 +968,7 @@ void IsoWriter::writeAllocationExtentDescriptor(ExtentList* extents, size_t star
|
||||
{
|
||||
uint32_t* buff32 = (uint32_t*)m_buffer;
|
||||
memset(m_buffer, 0, sizeof(m_buffer));
|
||||
writeDescriptorTag(m_buffer, DescriptorTag::DESC_TYPE_AllocationExtent, absoluteSectorNum());
|
||||
writeDescriptorTag(m_buffer, DescriptorTag::AllocationExtent, absoluteSectorNum());
|
||||
|
||||
uint8_t* curPos = m_buffer + 24;
|
||||
for (size_t i = start; i < indexEnd; ++i)
|
||||
@ -993,7 +993,7 @@ int IsoWriter::writeExtentFileDescriptor(bool namedStream, uint32_t objectId, Fi
|
||||
int sectorsWrited = 0;
|
||||
|
||||
memset(m_buffer, 0, sizeof(m_buffer));
|
||||
writeDescriptorTag(m_buffer, DescriptorTag::DESC_TYPE_ExtendedFile, absoluteSectorNum());
|
||||
writeDescriptorTag(m_buffer, DescriptorTag::ExtendedFile, absoluteSectorNum());
|
||||
|
||||
uint32_t* buff32 = (uint32_t*)m_buffer;
|
||||
uint16_t* buff16 = (uint16_t*)m_buffer;
|
||||
@ -1004,13 +1004,13 @@ int IsoWriter::writeExtentFileDescriptor(bool namedStream, uint32_t objectId, Fi
|
||||
buff32[36 / 4] = 0xffffffff; // uid
|
||||
buff32[40 / 4] = 0xffffffff; // guid
|
||||
// zero Permissions, File Link Count, Record Format, Record Display Attributes
|
||||
if (fileType >= FileTypes::FileType_Metadata)
|
||||
if (fileType >= FileTypes::Metadata)
|
||||
{
|
||||
buff32[44 / 4] = 0x000000; // Permissions
|
||||
assert(linkCount == 0);
|
||||
buff16[48 / 2] = linkCount; // File Link Count
|
||||
}
|
||||
else if (fileType == FileTypes::FileType_File || fileType == FileTypes::FileType_RealtimeFile)
|
||||
else if (fileType == FileTypes::File || fileType == FileTypes::RealtimeFile)
|
||||
{
|
||||
buff32[44 / 4] = 0x1084; // Permissions
|
||||
assert(linkCount == 1);
|
||||
@ -1044,7 +1044,7 @@ int IsoWriter::writeExtentFileDescriptor(bool namedStream, uint32_t objectId, Fi
|
||||
m_buffer[200] = objectId; // Unique ID
|
||||
|
||||
// skip Length of Extended Attributes
|
||||
if (fileType != FileTypes::FileType_File && fileType != FileTypes::FileType_RealtimeFile)
|
||||
if (fileType != FileTypes::File && fileType != FileTypes::RealtimeFile)
|
||||
{
|
||||
// metadata object (metadata file, directory e.t.c). Using short extent
|
||||
buff32[212 / 4] = 0x08; // Length of Allocation Descriptors
|
||||
@ -1113,7 +1113,7 @@ void IsoWriter::writeIcbTag(bool namedStream, uint8_t* buffer, FileTypes fileTyp
|
||||
// skip reserved byte
|
||||
buffer[11] = (uint8_t)fileType; // metadata file type
|
||||
// skip 6 byte zero Parent ICB Location
|
||||
if (fileType == FileTypes::FileType_File || fileType == FileTypes::FileType_RealtimeFile)
|
||||
if (fileType == FileTypes::File || fileType == FileTypes::RealtimeFile)
|
||||
buff16[18 / 2] = 0x0021; // flags: archive + long AD
|
||||
else
|
||||
buff16[18 / 2] = 0x0020; // flags: archive
|
||||
@ -1127,7 +1127,7 @@ void IsoWriter::writeFileSetDescriptor()
|
||||
|
||||
ByteFileWriter writer;
|
||||
writer.setBuffer(m_buffer, sizeof(m_buffer));
|
||||
writer.writeDescriptorTag(DescriptorTag::DESC_TYPE_FileSet, absoluteSectorNum());
|
||||
writer.writeDescriptorTag(DescriptorTag::FileSet, absoluteSectorNum());
|
||||
|
||||
writer.writeTimestamp(m_currentTime); // Volume Descriptor Sequence Number
|
||||
writer.writeLE16(0x03); // Interchange Level
|
||||
@ -1157,7 +1157,7 @@ void IsoWriter::writePrimaryVolumeDescriptor()
|
||||
|
||||
ByteFileWriter writer;
|
||||
writer.setBuffer(m_buffer, sizeof(m_buffer));
|
||||
writer.writeDescriptorTag(DescriptorTag::DESC_TYPE_PrimVol, absoluteSectorNum());
|
||||
writer.writeDescriptorTag(DescriptorTag::PrimVol, absoluteSectorNum());
|
||||
|
||||
writer.writeLE32(0x01); // Volume Descriptor Sequence Number
|
||||
writer.writeLE32(0x00); // Primary Volume Descriptor Number
|
||||
@ -1210,7 +1210,7 @@ void IsoWriter::writePrimaryVolumeDescriptor()
|
||||
void IsoWriter::writeImpUseDescriptor()
|
||||
{
|
||||
memset(m_buffer, 0, sizeof(m_buffer));
|
||||
writeDescriptorTag(m_buffer, DescriptorTag::DESC_TYPE_ImplUseVol, absoluteSectorNum());
|
||||
writeDescriptorTag(m_buffer, DescriptorTag::ImplUseVol, absoluteSectorNum());
|
||||
|
||||
uint32_t* buff32 = (uint32_t*)m_buffer;
|
||||
uint16_t* buff16 = (uint16_t*)m_buffer;
|
||||
@ -1237,7 +1237,7 @@ void IsoWriter::writeImpUseDescriptor()
|
||||
void IsoWriter::writePartitionDescriptor()
|
||||
{
|
||||
memset(m_buffer, 0, sizeof(m_buffer));
|
||||
writeDescriptorTag(m_buffer, DescriptorTag::DESC_TYPE_Partition, absoluteSectorNum());
|
||||
writeDescriptorTag(m_buffer, DescriptorTag::Partition, absoluteSectorNum());
|
||||
|
||||
uint32_t* buff32 = (uint32_t*)m_buffer;
|
||||
uint16_t* buff16 = (uint16_t*)m_buffer;
|
||||
@ -1260,7 +1260,7 @@ void IsoWriter::writePartitionDescriptor()
|
||||
void IsoWriter::writeLogicalVolumeDescriptor()
|
||||
{
|
||||
memset(m_buffer, 0, sizeof(m_buffer));
|
||||
writeDescriptorTag(m_buffer, DescriptorTag::DESC_TYPE_LogicalVol, absoluteSectorNum());
|
||||
writeDescriptorTag(m_buffer, DescriptorTag::LogicalVol, absoluteSectorNum());
|
||||
uint32_t* buff32 = (uint32_t*)m_buffer;
|
||||
uint16_t* buff16 = (uint16_t*)m_buffer;
|
||||
|
||||
@ -1321,7 +1321,7 @@ void IsoWriter::writeLogicalVolumeDescriptor()
|
||||
void IsoWriter::writeUnallocatedSpaceDescriptor()
|
||||
{
|
||||
memset(m_buffer, 0, sizeof(m_buffer));
|
||||
writeDescriptorTag(m_buffer, DescriptorTag::DESC_TYPE_UnallocSpace, absoluteSectorNum());
|
||||
writeDescriptorTag(m_buffer, DescriptorTag::UnallocSpace, absoluteSectorNum());
|
||||
|
||||
uint32_t* buff32 = (uint32_t*)m_buffer;
|
||||
uint16_t* buff16 = (uint16_t*)m_buffer;
|
||||
@ -1335,7 +1335,7 @@ void IsoWriter::writeUnallocatedSpaceDescriptor()
|
||||
void IsoWriter::writeTerminationDescriptor()
|
||||
{
|
||||
memset(m_buffer, 0, sizeof(m_buffer));
|
||||
writeDescriptorTag(m_buffer, DescriptorTag::DESC_TYPE_Terminating, absoluteSectorNum());
|
||||
writeDescriptorTag(m_buffer, DescriptorTag::Terminating, absoluteSectorNum());
|
||||
|
||||
uint32_t* buff32 = (uint32_t*)m_buffer;
|
||||
uint16_t* buff16 = (uint16_t*)m_buffer;
|
||||
@ -1347,7 +1347,7 @@ void IsoWriter::writeTerminationDescriptor()
|
||||
void IsoWriter::writeLogicalVolumeIntegrityDescriptor()
|
||||
{
|
||||
memset(m_buffer, 0, sizeof(m_buffer));
|
||||
writeDescriptorTag(m_buffer, DescriptorTag::DESC_TYPE_LogicalVolIntegrity, absoluteSectorNum());
|
||||
writeDescriptorTag(m_buffer, DescriptorTag::LogicalVolIntegrity, absoluteSectorNum());
|
||||
|
||||
uint32_t* buff32 = (uint32_t*)m_buffer;
|
||||
uint16_t* buff16 = (uint16_t*)m_buffer;
|
||||
@ -1382,7 +1382,7 @@ void IsoWriter::writeLogicalVolumeIntegrityDescriptor()
|
||||
void IsoWriter::writeAnchorVolumeDescriptor(uint32_t endPartitionAddr)
|
||||
{
|
||||
memset(m_buffer, 0, sizeof(m_buffer));
|
||||
writeDescriptorTag(m_buffer, DescriptorTag::DESC_TYPE_AnchorVolPtr, absoluteSectorNum());
|
||||
writeDescriptorTag(m_buffer, DescriptorTag::AnchorVolPtr, absoluteSectorNum());
|
||||
|
||||
uint32_t* buff32 = (uint32_t*)m_buffer;
|
||||
buff32[4] = 0x8000; // point of the main volume descriptor
|
||||
|
@ -27,45 +27,45 @@ static const int MAX_SUBMUXER_RATE = 35000000;
|
||||
|
||||
enum class DescriptorTag
|
||||
{
|
||||
DESC_TYPE_SpoaringTable = 0, // UDF
|
||||
DESC_TYPE_PrimVol = 1,
|
||||
DESC_TYPE_AnchorVolPtr = 2,
|
||||
DESC_TYPE_VolPtr = 3,
|
||||
DESC_TYPE_ImplUseVol = 4,
|
||||
DESC_TYPE_Partition = 5,
|
||||
DESC_TYPE_LogicalVol = 6,
|
||||
DESC_TYPE_UnallocSpace = 7,
|
||||
DESC_TYPE_Terminating = 8,
|
||||
DESC_TYPE_LogicalVolIntegrity = 9,
|
||||
SpoaringTable = 0, // UDF
|
||||
PrimVol = 1,
|
||||
AnchorVolPtr = 2,
|
||||
VolPtr = 3,
|
||||
ImplUseVol = 4,
|
||||
Partition = 5,
|
||||
LogicalVol = 6,
|
||||
UnallocSpace = 7,
|
||||
Terminating = 8,
|
||||
LogicalVolIntegrity = 9,
|
||||
|
||||
DESC_TYPE_FileSet = 256,
|
||||
DESC_TYPE_FileId = 257,
|
||||
DESC_TYPE_AllocationExtent = 258,
|
||||
DESC_TYPE_Indirect = 259,
|
||||
DESC_TYPE_Terminal = 260,
|
||||
DESC_TYPE_File = 261,
|
||||
DESC_TYPE_ExtendedAttrHeader = 262,
|
||||
DESC_TYPE_UnallocatedSpace = 263,
|
||||
DESC_TYPE_SpaceBitmap = 264,
|
||||
DESC_TYPE_PartitionIntegrity = 265,
|
||||
DESC_TYPE_ExtendedFile = 266
|
||||
FileSet = 256,
|
||||
FileId = 257,
|
||||
AllocationExtent = 258,
|
||||
Indirect = 259,
|
||||
Terminal = 260,
|
||||
File = 261,
|
||||
ExtendedAttrHeader = 262,
|
||||
UnallocatedSpace = 263,
|
||||
SpaceBitmap = 264,
|
||||
PartitionIntegrity = 265,
|
||||
ExtendedFile = 266
|
||||
};
|
||||
|
||||
enum class FileTypes
|
||||
{
|
||||
FileType_Unspecified = 0,
|
||||
FileType_UnallocatedSpace = 1,
|
||||
FileType_PartitionIntegrityEntry = 2,
|
||||
FileType_IndirectEntry = 3,
|
||||
FileType_Directory = 4,
|
||||
FileType_File = 5,
|
||||
Unspecified = 0,
|
||||
UnallocatedSpace = 1,
|
||||
PartitionIntegrityEntry = 2,
|
||||
IndirectEntry = 3,
|
||||
Directory = 4,
|
||||
File = 5,
|
||||
|
||||
FileType_SystemStreamDirectory = 13,
|
||||
SystemStreamDirectory = 13,
|
||||
|
||||
FileType_RealtimeFile = 249,
|
||||
FileType_Metadata = 250,
|
||||
FileType_MetadataMirror = 251,
|
||||
FileType_MetadataBitmap = 252,
|
||||
RealtimeFile = 249,
|
||||
Metadata = 250,
|
||||
MetadataMirror = 251,
|
||||
MetadataBitmap = 252,
|
||||
};
|
||||
|
||||
class ByteFileWriter
|
||||
|
@ -52,7 +52,7 @@ DiskType checkBluRayMux(const char* metaFileName, int& autoChapterLen, vector<do
|
||||
TextFile file(metaFileName, File::ofRead);
|
||||
string str;
|
||||
file.readLine(str);
|
||||
DiskType result = DiskType::DT_NONE;
|
||||
DiskType result = DiskType::NONE;
|
||||
while (str.length() > 0)
|
||||
{
|
||||
if (strStartWith(str, "MUXOPT"))
|
||||
@ -101,11 +101,11 @@ DiskType checkBluRayMux(const char* metaFileName, int& autoChapterLen, vector<do
|
||||
V3_flags |= HDMV_V3;
|
||||
|
||||
if (str.find("--blu-ray") != string::npos)
|
||||
result = DiskType::DT_BLURAY;
|
||||
result = DiskType::BLURAY;
|
||||
else if (str.find("--avchd") != string::npos)
|
||||
result = DiskType::DT_AVCHD;
|
||||
result = DiskType::AVCHD;
|
||||
else
|
||||
result = DiskType::DT_NONE;
|
||||
result = DiskType::NONE;
|
||||
}
|
||||
else if (strStartWith(str, "V_MPEG4/ISO/MVC"))
|
||||
stereoMode = true;
|
||||
@ -725,16 +725,16 @@ int main(int argc, char** argv)
|
||||
insertBlankPL, blankNum, stereoMode, isoDiskLabel);
|
||||
std::string fileExt2 = unquoteStr(fileExt);
|
||||
bool muxMode = fileExt2 == "M2TS" || fileExt2 == "TS" || fileExt2 == "SSIF" || fileExt2 == "ISO" ||
|
||||
dt != DiskType::DT_NONE;
|
||||
dt != DiskType::NONE;
|
||||
|
||||
if (muxMode)
|
||||
{
|
||||
BlurayHelper blurayHelper;
|
||||
|
||||
MuxerManager muxerManager(readManager, tsMuxerFactory);
|
||||
muxerManager.setAllowStereoMux(fileExt2 == "SSIF" || dt != DiskType::DT_NONE);
|
||||
muxerManager.setAllowStereoMux(fileExt2 == "SSIF" || dt != DiskType::NONE);
|
||||
muxerManager.openMetaFile(argv[1]);
|
||||
if (!isV3() && dt == DiskType::DT_BLURAY && muxerManager.getHevcFound())
|
||||
if (!isV3() && dt == DiskType::BLURAY && muxerManager.getHevcFound())
|
||||
{
|
||||
LTRACE(LT_INFO, 2, "HEVC stream detected: changing Blu-Ray version to V3.");
|
||||
V3_flags |= HDMV_V3;
|
||||
@ -746,7 +746,7 @@ int main(int argc, char** argv)
|
||||
if (!isValidFileName(dstFile))
|
||||
throw runtime_error(string("Output filename is invalid: ") + dstFile);
|
||||
|
||||
if (dt != DiskType::DT_NONE)
|
||||
if (dt != DiskType::NONE)
|
||||
{
|
||||
if (!blurayHelper.open(dstFile, dt, muxerManager.totalSize(), muxerManager.getExtraISOBlocks(),
|
||||
muxerManager.useReproducibleIsoHeader()))
|
||||
@ -757,8 +757,8 @@ int main(int argc, char** argv)
|
||||
}
|
||||
if (muxerManager.getTrackCnt() == 0)
|
||||
THROW(ERR_COMMON, "No tracks selected");
|
||||
muxerManager.doMux(dstFile, dt != DiskType::DT_NONE ? &blurayHelper : 0);
|
||||
if (dt != DiskType::DT_NONE)
|
||||
muxerManager.doMux(dstFile, dt != DiskType::NONE ? &blurayHelper : 0);
|
||||
if (dt != DiskType::NONE)
|
||||
{
|
||||
blurayHelper.writeBluRayFiles(muxerManager, insertBlankPL, firstMplsOffset, blankNum, stereoMode);
|
||||
TSMuxer* mainMuxer = dynamic_cast<TSMuxer*>(muxerManager.getMainMuxer());
|
||||
|
@ -2150,9 +2150,9 @@ int MatroskaDemuxer::matroska_add_stream()
|
||||
uint64_t num;
|
||||
if ((res = ebml_read_uint(&id, &num)) < 0)
|
||||
break;
|
||||
if (num != (uint64_t)MatroskaAspectRatioMode::MATROSKA_ASPECT_RATIO_MODE_FREE &&
|
||||
num != (uint64_t)MatroskaAspectRatioMode::MATROSKA_ASPECT_RATIO_MODE_KEEP &&
|
||||
num != (uint64_t)MatroskaAspectRatioMode::MATROSKA_ASPECT_RATIO_MODE_FIXED)
|
||||
if (num != (uint64_t)MatroskaAspectRatioMode::FREE &&
|
||||
num != (uint64_t)MatroskaAspectRatioMode::KEEP &&
|
||||
num != (uint64_t)MatroskaAspectRatioMode::FIXED)
|
||||
{
|
||||
LTRACE(LT_INFO, 0, "Ignoring unknown aspect ratio " << (uint32_t)num);
|
||||
break;
|
||||
|
@ -158,9 +158,9 @@ enum class MatroskaEyeMode
|
||||
|
||||
enum class MatroskaAspectRatioMode
|
||||
{
|
||||
MATROSKA_ASPECT_RATIO_MODE_FREE = 0x0,
|
||||
MATROSKA_ASPECT_RATIO_MODE_KEEP = 0x1,
|
||||
MATROSKA_ASPECT_RATIO_MODE_FIXED = 0x2
|
||||
FREE = 0x0,
|
||||
KEEP = 0x1,
|
||||
FIXED = 0x2
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -268,7 +268,7 @@ int MPEG2StreamReader::decodePicture(uint8_t* buff)
|
||||
if (rez == NOT_ENOUGH_BUFFER)
|
||||
return rez;
|
||||
|
||||
if (m_frame.pict_type == PictureCodingType::PCT_I_FRAME)
|
||||
if (m_frame.pict_type == PictureCodingType::I_FRAME)
|
||||
{
|
||||
m_framesAtGop = -1;
|
||||
m_lastRef = -1;
|
||||
@ -305,7 +305,7 @@ int MPEG2StreamReader::decodePicture(uint8_t* buff)
|
||||
m_isFirstFrame = false;
|
||||
int refDif = m_frame.ref - m_framesAtGop;
|
||||
m_curPts = m_curDts + refDif * m_pcrIncPerFrame;
|
||||
m_lastIFrame = m_frame.pict_type == PictureCodingType::PCT_I_FRAME;
|
||||
m_lastIFrame = m_frame.pict_type == PictureCodingType::I_FRAME;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -347,7 +347,7 @@ MPEGPictureHeader::MPEGPictureHeader(int bufferSize)
|
||||
intra_dc_precision(0),
|
||||
intra_vlc_format(0),
|
||||
mpeg_f_code(),
|
||||
pict_type(PictureCodingType::PCT_FORBIDDEN),
|
||||
pict_type(PictureCodingType::FORBIDDEN),
|
||||
picture_structure(0),
|
||||
progressive_frame(0),
|
||||
q_scale_type(0),
|
||||
@ -376,12 +376,12 @@ void MPEGPictureHeader::buildHeader()
|
||||
bitWriter.putBits(3, (int)pict_type);
|
||||
bitWriter.putBits(16, vbv_delay);
|
||||
|
||||
if (pict_type == PictureCodingType::PCT_P_FRAME || pict_type == PictureCodingType::PCT_B_FRAME)
|
||||
if (pict_type == PictureCodingType::P_FRAME || pict_type == PictureCodingType::B_FRAME)
|
||||
{
|
||||
bitWriter.putBits(1, full_pel[0]);
|
||||
bitWriter.putBits(3, mpeg_f_code[0][0]);
|
||||
}
|
||||
if (pict_type == PictureCodingType::PCT_B_FRAME)
|
||||
if (pict_type == PictureCodingType::B_FRAME)
|
||||
{
|
||||
bitWriter.putBits(1, full_pel[1]);
|
||||
bitWriter.putBits(3, mpeg_f_code[1][0]);
|
||||
@ -440,19 +440,19 @@ uint8_t* MPEGPictureHeader::deserialize(uint8_t* buf, int64_t buf_size)
|
||||
|
||||
ref = bitReader.getBits(10); /* temporal ref */
|
||||
pict_type = (PictureCodingType)bitReader.getBits(3);
|
||||
if (pict_type == PictureCodingType::PCT_FORBIDDEN || pict_type == PictureCodingType::PCT_D_FRAME)
|
||||
if (pict_type == PictureCodingType::FORBIDDEN || pict_type == PictureCodingType::D_FRAME)
|
||||
return 0;
|
||||
|
||||
vbv_delay = bitReader.getBits(16);
|
||||
|
||||
if (pict_type == PictureCodingType::PCT_P_FRAME || pict_type == PictureCodingType::PCT_B_FRAME)
|
||||
if (pict_type == PictureCodingType::P_FRAME || pict_type == PictureCodingType::B_FRAME)
|
||||
{
|
||||
full_pel[0] = bitReader.getBit();
|
||||
f_code = bitReader.getBits(3);
|
||||
mpeg_f_code[0][0] = f_code;
|
||||
mpeg_f_code[0][1] = f_code;
|
||||
}
|
||||
if (pict_type == PictureCodingType::PCT_B_FRAME)
|
||||
if (pict_type == PictureCodingType::B_FRAME)
|
||||
{
|
||||
full_pel[1] = bitReader.getBit();
|
||||
f_code = bitReader.getBits(3);
|
||||
|
@ -164,11 +164,11 @@ class MPEGGOPHeader : public MPEGHeader
|
||||
|
||||
enum class PictureCodingType
|
||||
{
|
||||
PCT_FORBIDDEN,
|
||||
PCT_I_FRAME,
|
||||
PCT_P_FRAME,
|
||||
PCT_B_FRAME,
|
||||
PCT_D_FRAME
|
||||
FORBIDDEN,
|
||||
I_FRAME,
|
||||
P_FRAME,
|
||||
B_FRAME,
|
||||
D_FRAME
|
||||
};
|
||||
|
||||
class MPEGPictureHeader : public MPEGRawDataHeader
|
||||
|
@ -342,7 +342,7 @@ void PGSStreamReader::renderTextShow(int64_t inTime)
|
||||
// composition segment. pts=x, dts = x-0.0648 (pts alignment to video grid) (I get constant value from real PGS
|
||||
// track as example)
|
||||
int rLen =
|
||||
m_render->composePresentationSegment(curPos, CompositionMode::CM_Start, inTime, inTime - PRESENTATION_DTS_DELTA,
|
||||
m_render->composePresentationSegment(curPos, CompositionMode::Start, inTime, inTime - PRESENTATION_DTS_DELTA,
|
||||
m_objectWindowTop, m_demuxMode, m_forced_on_flag);
|
||||
m_renderedBlocks.push_back(PGSRenderedBlock(inTime, inTime - PRESENTATION_DTS_DELTA, rLen, curPos));
|
||||
curPos += rLen;
|
||||
@ -387,7 +387,7 @@ void PGSStreamReader::renderTextHide(int64_t outTime)
|
||||
uint8_t* curPos = m_renderedData;
|
||||
// composition segment. pts=x, dts = x-0.001 (pts alignment to video grid)
|
||||
int rLen =
|
||||
m_render->composePresentationSegment(curPos, CompositionMode::CM_Finish, outTime,
|
||||
m_render->composePresentationSegment(curPos, CompositionMode::Finish, outTime,
|
||||
outTime - windowsTransferTime - 90, m_objectWindowTop, m_demuxMode, false);
|
||||
m_renderedBlocks.push_back(PGSRenderedBlock(outTime, outTime - windowsTransferTime - 90, rLen, curPos));
|
||||
curPos += rLen;
|
||||
|
@ -389,7 +389,7 @@ uint8_t* TextToPGSConverter::doConvert(std::string& text, const TextAnimation& a
|
||||
m_paletteID = 0;
|
||||
m_paletteVersion = 0;
|
||||
|
||||
curPos += composePresentationSegment(curPos, CompositionMode::CM_Start, inTimePTS,
|
||||
curPos += composePresentationSegment(curPos, CompositionMode::Start, inTimePTS,
|
||||
inTimePTS - PRESENTATION_DTS_DELTA, objectWindowTop, true, forced);
|
||||
curPos += composeWindowDefinition(curPos, inTimePTS - windowsTransferTime, inTimePTS - PRESENTATION_DTS_DELTA,
|
||||
objectWindowTop, objectWindowHeight);
|
||||
@ -409,7 +409,7 @@ uint8_t* TextToPGSConverter::doConvert(std::string& text, const TextAnimation& a
|
||||
{
|
||||
palette_update_flag = 1;
|
||||
m_paletteVersion++;
|
||||
curPos += composePresentationSegment(curPos, CompositionMode::CM_Update, updateTime,
|
||||
curPos += composePresentationSegment(curPos, CompositionMode::Update, updateTime,
|
||||
updateTime - windowsTransferTime, objectWindowTop, true, forced);
|
||||
curPos += composePaletteDefinition(buildPalette(toCurve(opacity)), curPos, updateTime - windowsTransferTime,
|
||||
updateTime - windowsTransferTime);
|
||||
@ -426,7 +426,7 @@ uint8_t* TextToPGSConverter::doConvert(std::string& text, const TextAnimation& a
|
||||
{
|
||||
palette_update_flag = 1;
|
||||
m_paletteVersion++;
|
||||
curPos += composePresentationSegment(curPos, CompositionMode::CM_Update, (int64_t)updateTime,
|
||||
curPos += composePresentationSegment(curPos, CompositionMode::Update, (int64_t)updateTime,
|
||||
(int64_t)updateTime - windowsTransferTime, objectWindowTop, true, forced);
|
||||
curPos +=
|
||||
composePaletteDefinition(buildPalette(toCurve(opacity)), curPos, (int64_t)updateTime - windowsTransferTime,
|
||||
@ -440,7 +440,7 @@ uint8_t* TextToPGSConverter::doConvert(std::string& text, const TextAnimation& a
|
||||
// 3. hide text
|
||||
|
||||
palette_update_flag = 0;
|
||||
curPos += composePresentationSegment(curPos, CompositionMode::CM_Finish, outTimePTS,
|
||||
curPos += composePresentationSegment(curPos, CompositionMode::Finish, outTimePTS,
|
||||
outTimePTS - windowsTransferTime - 90, objectWindowTop, true, false);
|
||||
curPos += composeWindowDefinition(curPos, outTimePTS - windowsTransferTime, outTimePTS - windowsTransferTime - 90,
|
||||
objectWindowTop, objectWindowHeight);
|
||||
@ -464,12 +464,12 @@ long TextToPGSConverter::composePresentationSegment(uint8_t* buff, CompositionMo
|
||||
|
||||
curPos += composeVideoDescriptor(curPos);
|
||||
curPos += composeCompositionDescriptor(curPos, m_composition_number++,
|
||||
mode == CompositionMode::CM_Start ? EPOTH_START : EPOTH_NORMAL);
|
||||
mode == CompositionMode::Start ? EPOTH_START : EPOTH_NORMAL);
|
||||
*curPos++ = palette_update_flag << 7; // palette_update_flag = 0 and 7 reserved bits
|
||||
*curPos++ = m_paletteID; // paletteID ref
|
||||
*curPos++ = mode != CompositionMode::CM_Finish ? 1 : 0; // number_of_composition_objects
|
||||
*curPos++ = mode != CompositionMode::Finish ? 1 : 0; // number_of_composition_objects
|
||||
// composition object
|
||||
if (mode != CompositionMode::CM_Finish)
|
||||
if (mode != CompositionMode::Finish)
|
||||
{
|
||||
*curPos++ = 0; // objectID ref
|
||||
*curPos++ = 0; // objectID ref
|
||||
|
@ -17,9 +17,9 @@ namespace text_subtitles
|
||||
{
|
||||
enum class CompositionMode
|
||||
{
|
||||
CM_Start,
|
||||
CM_Update,
|
||||
CM_Finish
|
||||
Start,
|
||||
Update,
|
||||
Finish
|
||||
};
|
||||
|
||||
struct TextAnimation
|
||||
|
@ -1467,7 +1467,7 @@ int MPLSParser::compose(uint8_t* buffer, int bufferSize, DiskType dt)
|
||||
|
||||
std::string type_indicator = "MPLS";
|
||||
std::string version_number;
|
||||
if (dt == DiskType::DT_BLURAY)
|
||||
if (dt == DiskType::BLURAY)
|
||||
version_number = (isV3() ? "0300" : "0200");
|
||||
else
|
||||
version_number = "0100";
|
||||
|
@ -66,16 +66,16 @@ string VC1SequenceHeader::getStreamDescr()
|
||||
rez << "Profile: ";
|
||||
switch (profile)
|
||||
{
|
||||
case Profile::PROFILE_SIMPLE:
|
||||
case Profile::SIMPLE:
|
||||
rez << "Simple";
|
||||
break;
|
||||
case Profile::PROFILE_MAIN:
|
||||
case Profile::MAIN:
|
||||
rez << "Main";
|
||||
break;
|
||||
case Profile::PROFILE_COMPLEX:
|
||||
case Profile::COMPLEX:
|
||||
rez << "Complex";
|
||||
break;
|
||||
case Profile::PROFILE_ADVANCED:
|
||||
case Profile::ADVANCED:
|
||||
rez << "Advanced@" << level;
|
||||
break;
|
||||
default:
|
||||
@ -158,10 +158,10 @@ int VC1SequenceHeader::decode_sequence_header()
|
||||
{
|
||||
bitReader.setBuffer(m_nalBuffer, m_nalBuffer + m_nalBufferLen); // skip 00 00 01 xx marker
|
||||
profile = (Profile)bitReader.getBits(2);
|
||||
if (profile == Profile::PROFILE_COMPLEX)
|
||||
if (profile == Profile::COMPLEX)
|
||||
LTRACE(LT_WARN, 0, "WMV3 Complex Profile is not fully supported");
|
||||
|
||||
else if (profile == Profile::PROFILE_ADVANCED)
|
||||
else if (profile == Profile::ADVANCED)
|
||||
return decode_sequence_header_adv();
|
||||
else
|
||||
{
|
||||
@ -174,7 +174,7 @@ int VC1SequenceHeader::decode_sequence_header()
|
||||
}
|
||||
|
||||
bitReader.skipBits(8); // frmrtq_postproc, bitrtq_postproc
|
||||
if (bitReader.getBit() && profile == Profile::PROFILE_SIMPLE) // loop_filter
|
||||
if (bitReader.getBit() && profile == Profile::SIMPLE) // loop_filter
|
||||
LTRACE(LT_WARN, 0, "LOOPFILTER shell not be enabled in simple profile");
|
||||
if (bitReader.getBit()) // reserved res_x8
|
||||
LTRACE(LT_WARN, 0, "1 for reserved RES_X8 is forbidden");
|
||||
@ -182,12 +182,12 @@ int VC1SequenceHeader::decode_sequence_header()
|
||||
int res_fasttx = bitReader.getBit(); // reserved
|
||||
if (!res_fasttx)
|
||||
LTRACE(LT_WARN, 0, "0 for reserved RES_FASTTX is forbidden");
|
||||
if (profile == Profile::PROFILE_SIMPLE && !bitReader.getBit()) // fastuvmc
|
||||
if (profile == Profile::SIMPLE && !bitReader.getBit()) // fastuvmc
|
||||
{
|
||||
LTRACE(LT_ERROR, 0, "FASTUVMC unavailable in Simple Profile");
|
||||
return NALUnit::UNSUPPORTED_PARAM;
|
||||
}
|
||||
if (profile == Profile::PROFILE_SIMPLE && bitReader.getBit()) // extended_mv
|
||||
if (profile == Profile::SIMPLE && bitReader.getBit()) // extended_mv
|
||||
{
|
||||
LTRACE(LT_ERROR, 0, "Extended MVs unavailable in Simple Profile");
|
||||
return NALUnit::UNSUPPORTED_PARAM;
|
||||
@ -202,7 +202,7 @@ int VC1SequenceHeader::decode_sequence_header()
|
||||
bitReader.skipBits(2); // overlap, resync_marker
|
||||
|
||||
rangered = bitReader.getBit();
|
||||
if (rangered && profile == Profile::PROFILE_SIMPLE)
|
||||
if (rangered && profile == Profile::SIMPLE)
|
||||
LTRACE(LT_WARN, 0, "RANGERED should be set to 0 in simple profile");
|
||||
max_b_frames = bitReader.getBits(3);
|
||||
bitReader.skipBits(2); // quantizer_mode
|
||||
@ -348,7 +348,7 @@ int VC1Frame::decode_frame_direct(const VC1SequenceHeader& sequenceHdr, uint8_t*
|
||||
try
|
||||
{
|
||||
bitReader.setBuffer(buffer, end); // skip 00 00 01 xx marker
|
||||
if (sequenceHdr.profile < Profile::PROFILE_ADVANCED)
|
||||
if (sequenceHdr.profile < Profile::ADVANCED)
|
||||
return vc1_parse_frame_header(sequenceHdr);
|
||||
else
|
||||
return vc1_parse_frame_header_adv(sequenceHdr);
|
||||
|
@ -11,26 +11,26 @@
|
||||
|
||||
enum class VC1Code
|
||||
{
|
||||
VC1_CODE_ENDOFSEQ = 0x0A,
|
||||
VC1_CODE_SLICE,
|
||||
VC1_CODE_FIELD,
|
||||
VC1_CODE_FRAME,
|
||||
VC1_CODE_ENTRYPOINT,
|
||||
VC1_CODE_SEQHDR,
|
||||
ENDOFSEQ = 0x0A,
|
||||
SLICE,
|
||||
FIELD,
|
||||
FRAME,
|
||||
ENTRYPOINT,
|
||||
SEQHDR,
|
||||
|
||||
VC1_USER_CODE_SLICE = 0x1B, // user-defined slice
|
||||
VC1_USER_CODE_FIELD,
|
||||
VC1_USER_CODE_FRAME,
|
||||
VC1_USER_CODE_ENTRYPOINT,
|
||||
VC1_USER_CODE_SEQHDR
|
||||
USER_SLICE = 0x1B, // user-defined slice
|
||||
USER_FIELD,
|
||||
USER_FRAME,
|
||||
USER_ENTRYPOINT,
|
||||
USER_SEQHDR
|
||||
};
|
||||
|
||||
enum class Profile
|
||||
{
|
||||
PROFILE_SIMPLE,
|
||||
PROFILE_MAIN,
|
||||
PROFILE_COMPLEX, ///< TODO: WMV9 specific
|
||||
PROFILE_ADVANCED
|
||||
SIMPLE,
|
||||
MAIN,
|
||||
COMPLEX, ///< TODO: WMV9 specific
|
||||
ADVANCED
|
||||
};
|
||||
|
||||
const int ff_vc1_fps_nr[7] = {24, 25, 30, 50, 60, 48, 72};
|
||||
@ -153,7 +153,7 @@ class VC1SequenceHeader : public VC1Unit
|
||||
public:
|
||||
VC1SequenceHeader()
|
||||
: VC1Unit(),
|
||||
profile(Profile::PROFILE_SIMPLE),
|
||||
profile(Profile::SIMPLE),
|
||||
level(0),
|
||||
interlace(0),
|
||||
time_base_num(0),
|
||||
|
@ -55,9 +55,9 @@ int VC1StreamReader::getTSDescriptor(uint8_t* dstBuff, bool blurayMode, bool hdm
|
||||
for (uint8_t* nal = VC1Unit::findNextMarker(m_buffer, m_bufEnd); nal <= m_bufEnd - 32;
|
||||
nal = VC1Unit::findNextMarker(nal + 4, m_bufEnd))
|
||||
{
|
||||
uint8_t unitType = nal[3];
|
||||
auto unitType = (VC1Code)nal[3];
|
||||
|
||||
if (unitType == (uint8_t)VC1Code::VC1_CODE_SEQHDR)
|
||||
if (unitType == VC1Code::SEQHDR)
|
||||
{
|
||||
uint8_t* nextNal = VC1Unit::findNextMarker(nal + 4, m_bufEnd);
|
||||
VC1SequenceHeader sequence;
|
||||
@ -76,13 +76,13 @@ int VC1StreamReader::getTSDescriptor(uint8_t* dstBuff, bool blurayMode, bool hdm
|
||||
int profile = (int)sequence.profile << 4;
|
||||
switch (sequence.profile)
|
||||
{
|
||||
case Profile::PROFILE_SIMPLE:
|
||||
case Profile::SIMPLE:
|
||||
dstBuff[7] = profile + 0x11 + (sequence.level >> 1);
|
||||
break;
|
||||
case Profile::PROFILE_MAIN:
|
||||
case Profile::MAIN:
|
||||
dstBuff[7] = profile + 0x41 + (sequence.level >> 1);
|
||||
break;
|
||||
case Profile::PROFILE_ADVANCED:
|
||||
case Profile::ADVANCED:
|
||||
dstBuff[7] = profile + 0x61 + sequence.level;
|
||||
break;
|
||||
default:
|
||||
@ -95,7 +95,7 @@ int VC1StreamReader::getTSDescriptor(uint8_t* dstBuff, bool blurayMode, bool hdm
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool VC1StreamReader::skipNal(uint8_t* nal) { return !m_eof && nal[0] == (uint8_t)VC1Code::VC1_CODE_ENDOFSEQ; }
|
||||
bool VC1StreamReader::skipNal(uint8_t* nal) { return !m_eof && nal[0] == (uint8_t)VC1Code::ENDOFSEQ; }
|
||||
|
||||
CheckStreamRez VC1StreamReader::checkStream(uint8_t* buffer, int len)
|
||||
{
|
||||
@ -108,19 +108,19 @@ CheckStreamRez VC1StreamReader::checkStream(uint8_t* buffer, int len)
|
||||
for (uint8_t* nal = VC1Unit::findNextMarker(buffer, end); nal <= end - 32;
|
||||
nal = VC1Unit::findNextMarker(nal + 4, end))
|
||||
{
|
||||
uint8_t unitType = nal[3];
|
||||
auto unitType = (VC1Code)nal[3];
|
||||
switch (unitType)
|
||||
{
|
||||
case (uint8_t)VC1Code::VC1_CODE_ENDOFSEQ:
|
||||
case VC1Code::ENDOFSEQ:
|
||||
break;
|
||||
case (uint8_t)VC1Code::VC1_CODE_SLICE:
|
||||
case (uint8_t)VC1Code::VC1_USER_CODE_SLICE:
|
||||
case VC1Code::SLICE:
|
||||
case VC1Code::USER_SLICE:
|
||||
break;
|
||||
case (uint8_t)VC1Code::VC1_CODE_FIELD:
|
||||
case (uint8_t)VC1Code::VC1_USER_CODE_FIELD:
|
||||
case VC1Code::FIELD:
|
||||
case VC1Code::USER_FIELD:
|
||||
break;
|
||||
case (uint8_t)VC1Code::VC1_CODE_FRAME:
|
||||
case (uint8_t)VC1Code::VC1_USER_CODE_FRAME:
|
||||
case VC1Code::FRAME:
|
||||
case VC1Code::USER_FRAME:
|
||||
nextNal = VC1Unit::findNextMarker(nal + 4, end);
|
||||
if (m_frame.decode_frame_direct(m_sequence, nal + 4, nextNal) != 0)
|
||||
break;
|
||||
@ -138,15 +138,15 @@ CheckStreamRez VC1StreamReader::checkStream(uint8_t* buffer, int len)
|
||||
if (m_frame.pict_type == VC1PictType::I_TYPE)
|
||||
iFrameFound = true;
|
||||
break;
|
||||
case (uint8_t)VC1Code::VC1_CODE_ENTRYPOINT:
|
||||
case (uint8_t)VC1Code::VC1_USER_CODE_ENTRYPOINT:
|
||||
case VC1Code::ENTRYPOINT:
|
||||
case VC1Code::USER_ENTRYPOINT:
|
||||
nextNal = VC1Unit::findNextMarker(nal + 4, end);
|
||||
m_sequence.vc1_unescape_buffer(nal + 4, nextNal - nal - 4);
|
||||
if (m_sequence.decode_entry_point() != 0)
|
||||
break;
|
||||
break;
|
||||
case (uint8_t)VC1Code::VC1_CODE_SEQHDR:
|
||||
case (uint8_t)VC1Code::VC1_USER_CODE_SEQHDR:
|
||||
case VC1Code::SEQHDR:
|
||||
case VC1Code::USER_SEQHDR:
|
||||
nextNal = VC1Unit::findNextMarker(nal + 4, end);
|
||||
m_sequence.vc1_unescape_buffer(nal + 4, nextNal - nal - 4);
|
||||
if (m_sequence.decode_sequence_header() != 0)
|
||||
@ -173,17 +173,17 @@ int VC1StreamReader::intDecodeNAL(uint8_t* buff)
|
||||
|
||||
int rez = 0;
|
||||
uint8_t* nextNal = 0;
|
||||
switch (*buff)
|
||||
switch ((VC1Code)*buff)
|
||||
{
|
||||
case (uint8_t)VC1Code::VC1_CODE_ENTRYPOINT:
|
||||
case VC1Code::ENTRYPOINT:
|
||||
return decodeEntryPoint(buff);
|
||||
break;
|
||||
case (uint8_t)VC1Code::VC1_CODE_ENDOFSEQ:
|
||||
case VC1Code::ENDOFSEQ:
|
||||
nextNal = VC1Unit::findNextMarker(buff, m_bufEnd) + 3;
|
||||
if (!m_eof && nextNal >= m_bufEnd)
|
||||
return NOT_ENOUGH_BUFFER;
|
||||
break;
|
||||
case (uint8_t)VC1Code::VC1_CODE_SEQHDR:
|
||||
case VC1Code::SEQHDR:
|
||||
m_spsPpsFound = true;
|
||||
rez = decodeSeqHeader(buff);
|
||||
if (rez != 0)
|
||||
@ -193,15 +193,15 @@ int VC1StreamReader::intDecodeNAL(uint8_t* buff)
|
||||
{
|
||||
if (nextNal >= m_bufEnd)
|
||||
return NOT_ENOUGH_BUFFER;
|
||||
switch (*nextNal)
|
||||
switch ((VC1Code)*nextNal)
|
||||
{
|
||||
case (uint8_t)VC1Code::VC1_CODE_ENTRYPOINT:
|
||||
case VC1Code::ENTRYPOINT:
|
||||
rez = decodeEntryPoint(nextNal);
|
||||
if (rez != 0)
|
||||
return rez;
|
||||
break;
|
||||
case (uint8_t)VC1Code::VC1_CODE_FRAME:
|
||||
case (uint8_t)VC1Code::VC1_USER_CODE_FRAME:
|
||||
case VC1Code::FRAME:
|
||||
case VC1Code::USER_FRAME:
|
||||
rez = decodeFrame(nextNal);
|
||||
if (rez == 0)
|
||||
{
|
||||
@ -214,8 +214,8 @@ int VC1StreamReader::intDecodeNAL(uint8_t* buff)
|
||||
}
|
||||
// m_lastIFrame = true;
|
||||
break;
|
||||
case (uint8_t)VC1Code::VC1_CODE_FRAME:
|
||||
case (uint8_t)VC1Code::VC1_USER_CODE_FRAME:
|
||||
case VC1Code::FRAME:
|
||||
case VC1Code::USER_FRAME:
|
||||
m_decodedAfterSeq = false;
|
||||
rez = decodeFrame(buff);
|
||||
return rez;
|
||||
@ -244,7 +244,7 @@ int VC1StreamReader::decodeSeqHeader(uint8_t* buff)
|
||||
{
|
||||
LTRACE(LT_INFO, 2, "Decoding VC-1 stream (track " << m_streamIndex << "): " << m_sequence.getStreamDescr());
|
||||
}
|
||||
if (m_sequence.profile != Profile::PROFILE_ADVANCED)
|
||||
if (m_sequence.profile != Profile::ADVANCED)
|
||||
THROW(ERR_VC1_ERR_PROFILE,
|
||||
"Only ADVANCED profile are supported now. For feature request contat to: r_vasilenko@smlabs.net.");
|
||||
|
||||
@ -360,7 +360,8 @@ int VC1StreamReader::getNextBFrames(uint8_t* buffer, int64_t& bTiming)
|
||||
for (uint8_t* nal = VC1Unit::findNextMarker(buffer, m_bufEnd); nal < m_bufEnd - 4;
|
||||
nal = VC1Unit::findNextMarker(nal + 4, m_bufEnd))
|
||||
{
|
||||
if (nal[3] == (uint8_t)VC1Code::VC1_CODE_FRAME || nal[3] == (uint8_t)VC1Code::VC1_USER_CODE_FRAME)
|
||||
auto vc1Code = (VC1Code)nal[3];
|
||||
if (vc1Code == VC1Code::FRAME || vc1Code == VC1Code::USER_FRAME)
|
||||
{
|
||||
VC1Frame frame;
|
||||
if (frame.decode_frame_direct(m_sequence, nal + 4, m_bufEnd) != 0)
|
||||
@ -370,8 +371,6 @@ int VC1StreamReader::getNextBFrames(uint8_t* buffer, int64_t& bTiming)
|
||||
bFrameCnt++;
|
||||
|
||||
int64_t pcrIncVal = m_pcrIncPerFrame;
|
||||
// if (frame.fcm == 2) // coded field
|
||||
// pcrIncVal = m_pcrIncPerField;
|
||||
|
||||
if (m_sequence.pulldown)
|
||||
{
|
||||
@ -405,7 +404,8 @@ uint8_t* VC1StreamReader::findNextFrame(uint8_t* buffer)
|
||||
for (uint8_t* nal = VC1Unit::findNextMarker(buffer, m_bufEnd); nal < m_bufEnd - 4;
|
||||
nal = VC1Unit::findNextMarker(nal + 4, m_bufEnd))
|
||||
{
|
||||
if (nal[3] != (uint8_t)VC1Code::VC1_CODE_FIELD && nal[3] != (uint8_t)VC1Code::VC1_USER_CODE_FIELD)
|
||||
auto vc1Code = (VC1Code)nal[3];
|
||||
if (vc1Code != VC1Code::FIELD && vc1Code != VC1Code::USER_FIELD)
|
||||
return nal;
|
||||
}
|
||||
if (m_eof)
|
||||
|
@ -103,9 +103,9 @@ typedef std::vector<std::pair<int, int>> PriorityDataInfo; // mark some data as
|
||||
|
||||
enum class DiskType
|
||||
{
|
||||
DT_NONE,
|
||||
DT_BLURAY,
|
||||
DT_AVCHD
|
||||
NONE,
|
||||
BLURAY,
|
||||
AVCHD
|
||||
};
|
||||
|
||||
uint16_t AV_RB16(const uint8_t* buffer);
|
||||
|
Loading…
x
Reference in New Issue
Block a user