Skip to content

Commit

Permalink
Tidy-up header files
Browse files Browse the repository at this point in the history
  • Loading branch information
jcdr428 committed Aug 10, 2023
1 parent ab82fa2 commit dccba0e
Show file tree
Hide file tree
Showing 23 changed files with 36 additions and 75 deletions.
1 change: 0 additions & 1 deletion tsMuxer/BufferedReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

#include <containers/safequeue.h>
#include <system/terminatablethread.h>
#include <types/types.h>

#include <map>
#include <string>
Expand Down
3 changes: 1 addition & 2 deletions tsMuxer/abstractDemuxer.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#define ABSTRACT_DEMUXER_H_

#include <assert.h>
#include <memory.h>
#include <types/types.h>

#include <map>
Expand Down Expand Up @@ -39,7 +38,7 @@ class MemoryBlock
m_size += num;
if (m_data.size() < m_size)
{
m_data.resize(FFMIN(m_size * 2, m_size + 1024 * 1024));
m_data.resize(FFMIN(m_size * 2, m_size + 1024LL * 1024));
}
}

Expand Down
5 changes: 0 additions & 5 deletions tsMuxer/abstractreader.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
#ifndef ABSTRACT_READER_H_
#define ABSTRACT_READER_H_

#include <types/types.h>

#include <string>

#include "abstractDemuxer.h"
#include "avPacket.h"

struct CodecInfo;

typedef std::string translateStreamName(const std::string& streamName);
Expand Down
3 changes: 0 additions & 3 deletions tsMuxer/avCodecs.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@
#define AV_CODECS_H_

#include <types/types.h>

#include <string>

#include "avPacket.h"

static constexpr int CODEC_ID_NONE = 0;
static constexpr int CODEC_V_MPEG4_H264 = 1;
static constexpr int CODEC_A_AAC = 2;
Expand Down
6 changes: 3 additions & 3 deletions tsMuxer/bitStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class BitStreamReader : public BitStream
m_bitLeft += INT_BIT - num;
}
m_totalBits -= num;
return prevVal + (m_curVal >> m_bitLeft) & m_masks[num];
return static_cast<int>(prevVal + (m_curVal >> m_bitLeft) & m_masks[num]);
}

unsigned get32Bits()
Expand Down Expand Up @@ -110,7 +110,7 @@ class BitStreamReader : public BitStream
curVal = getCurVal(m_buffer + 1);
bitLeft += INT_BIT - num;
}
return prevVal + (curVal >> bitLeft) & m_masks[num];
return static_cast<int>(prevVal + (curVal >> bitLeft) & m_masks[num]);
}

int getBit()
Expand All @@ -126,7 +126,7 @@ class BitStreamReader : public BitStream
m_bitLeft = INT_BIT - 1;
}
m_totalBits--;
return (m_curVal >> m_bitLeft) & 1;
return static_cast<int>(m_curVal >> m_bitLeft) & 1;
}

void skipBits(const unsigned num)
Expand Down
8 changes: 4 additions & 4 deletions tsMuxer/blank_patterns.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef BLANK_PATTERNS_H_
#define BLANK_PATTERNS_H_

uint8_t pattern_ntsc[] = {
inline uint8_t pattern_ntsc[] = {
0x00, 0x00, 0x00, 0x01, 0x67, 0x4D, 0x40, 0x29, 0xB9, 0x10, 0x16, 0x87, 0xB4, 0x20, 0x01, 0x00, 0x00, 0x03, 0x00,
0x2F, 0xF3, 0xB6, 0x51, 0xE3, 0x06, 0x54, 0x00, 0x00, 0x00, 0x01, 0x68, 0xEE, 0x3C, 0x80,

Expand All @@ -20,7 +20,7 @@ uint8_t pattern_ntsc[] = {
0x00, 0x00, 0x00, 0x01, 0x41, 0x9A, 0x18, 0x6C, 0x86, 0xBF, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0C,
0x08};

uint8_t pattern_pal[] = {
inline uint8_t pattern_pal[] = {
0x00, 0x00, 0x00, 0x01, 0x67, 0x4D, 0x40, 0x29, 0xB9, 0x10, 0x16, 0x82, 0x4D, 0x08, 0x00, 0x40, 0x00, 0x00,
0x0B, 0xFC, 0xED, 0x94, 0x78, 0xC1, 0x95, 0x00, 0x00, 0x00, 0x01, 0x68, 0xEE, 0x3C, 0x80,

Expand All @@ -40,7 +40,7 @@ uint8_t pattern_pal[] = {
0x00, 0x00, 0x00, 0x01, 0x41, 0x9A, 0x18, 0x6C, 0x86, 0xBF, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00,
0x03, 0x00, 0x03, 0x02};

uint8_t pattern_1280[] = {
inline uint8_t pattern_1280[] = {
0x00, 0x00, 0x00, 0x01, 0x67, 0x4D, 0x40, 0x29, 0xB9, 0x10, 0x0A, 0x00, 0xB7, 0x42, 0x00, 0x10, 0x00, 0x00,
0x03, 0x02, 0xFF, 0x3B, 0x65, 0x1E, 0x30, 0x65, 0x40, 0x00, 0x00, 0x00, 0x01, 0x68, 0xEE, 0x3C, 0x80, 0x00,

Expand All @@ -65,7 +65,7 @@ uint8_t pattern_1280[] = {
0x00, 0x00, 0x00, 0x01, 0x41, 0x9A, 0x18, 0x6C, 0x86, 0xBF, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00,
0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x01, 0x2F};

uint8_t pattern_1920[] = {
inline uint8_t pattern_1920[] = {
0x00, 0x00, 0x00, 0x01, 0x67, 0x4D, 0x40, 0x29, 0xB9, 0x10, 0x0F, 0x00, 0x44, 0xFC, 0xB0, 0x80, 0x04, 0x00, 0x00,
0x03, 0x00, 0xBF, 0xCE, 0xD9, 0x47, 0x8C, 0x19, 0x50, 0x00, 0x00, 0x00, 0x01, 0x68, 0xEE, 0x3C, 0x80,

Expand Down
1 change: 0 additions & 1 deletion tsMuxer/blurayHelper.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include "blurayHelper.h"

#include <fs/directory.h>

#include <array>

#include "iso_writer.h"
Expand Down
6 changes: 1 addition & 5 deletions tsMuxer/bufferedFileReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

#include <fs/file.h>
#include <fs/systemlog.h>
#include <memory.h>
#include <types/types.h>

#include "BufferedReader.h"
Expand Down Expand Up @@ -55,10 +54,7 @@ struct FileReaderData : public ReaderData

uint32_t readBlock(uint8_t* buffer, const int max_size) override
{
int rez = 0;
rez = m_file.read(buffer, max_size);

return rez;
return m_file.read(buffer, max_size);
}

bool openStream() override;
Expand Down
2 changes: 0 additions & 2 deletions tsMuxer/bufferedFileWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
#include <system/terminatablethread.h>
#include <types/types.h>

#include <map>

#include "vod_common.h"

constexpr unsigned WRITE_QUEUE_MAX_SIZE = 400 * 1024 * 1024 / DEFAULT_FILE_BLOCK_SIZE; // 400 Mb max queue size
Expand Down
2 changes: 0 additions & 2 deletions tsMuxer/bufferedReaderManager.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#ifndef BUFFERED_READER_MANAGER_H_
#define BUFFERED_READER_MANAGER_H_

#include <types/types.h>

#include <vector>

#include "bufferedFileReader.h"
Expand Down
4 changes: 1 addition & 3 deletions tsMuxer/combinedH264Demuxer.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@
#define COMBINED_H264_DEMUXER_H

#include <map>
#include <set>
#include <string>

#include "BufferedReader.h"
#include "abstractDemuxer.h"
#include "abstractreader.h"
#include "bufferedReaderManager.h"
Expand Down Expand Up @@ -61,7 +59,7 @@ class CombinedH264Demuxer : public AbstractDemuxer, public CombinedH264Reader
bool isPidFilterSupported() const override { return true; }

private:
BufferedReaderManager& m_readManager;
BufferedReaderManager m_readManager;
AbstractReader* m_bufferedReader;
int m_readerID;
int m_lastReadRez;
Expand Down
4 changes: 4 additions & 0 deletions tsMuxer/convertUTF.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#ifndef CONVERT_UTF_
#define CONVERT_UTF_

/*
* Copyright 2001-2004 Unicode, Inc.
*
Expand Down Expand Up @@ -212,4 +215,5 @@ void IterateUTF8Chars(const std::string& utf8String, Fn f)

} // namespace convertUTF

#endif
/* --------------------------------------------------------------------- */
2 changes: 0 additions & 2 deletions tsMuxer/dtsStreamReader.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#ifndef DTS_STREAM_READER_
#define DTS_STREAM_READER_

#include <algorithm>

#include "simplePacketizerReader.h"

class DTSStreamReader : public SimplePacketizerReader
Expand Down
4 changes: 0 additions & 4 deletions tsMuxer/dvbSubStreamReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

#include "simplePacketizerReader.h"

#if 1

class DVBSubStreamReader final : public SimplePacketizerReader
{
public:
Expand Down Expand Up @@ -40,5 +38,3 @@ class DVBSubStreamReader final : public SimplePacketizerReader
};

#endif

#endif
1 change: 0 additions & 1 deletion tsMuxer/h264StreamReader.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#ifndef H264_STREAM_READER_H_
#define H264_STREAM_READER_H_

#include <iostream>
#include <map>

#include "avPacket.h"
Expand Down
3 changes: 1 addition & 2 deletions tsMuxer/hevc.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ struct HevcUnit
nuh_layer_id(0),
nuh_temporal_id_plus1(0),
m_nalBuffer(nullptr),
m_nalBufferLen(0),
m_reader()
m_nalBufferLen(0)
{
}

Expand Down
6 changes: 1 addition & 5 deletions tsMuxer/ioContextDemuxer.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
#ifndef IO_CONTEXT_DEMUXER_H_
#define IO_CONTEXT_DEMUXER_H_

#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>

#include "BufferedReader.h"
Expand Down Expand Up @@ -103,7 +99,7 @@ class IOContextDemuxer : public AbstractDemuxer
Track* tracks[MAX_STREAMS];
int num_tracks;

BufferedReaderManager& m_readManager;
BufferedReaderManager m_readManager;
AbstractReader* m_bufferedReader;
int m_readerID;
int m_lastReadRez;
Expand Down
28 changes: 14 additions & 14 deletions tsMuxer/iso_writer.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@
#include <map>
#include <string>

static const int SECTOR_SIZE = 2048;
static const int ALLOC_BLOCK_SIZE = 1024 * 64;
static const int METADATA_START_ADDR = 1024 * 640 / SECTOR_SIZE;
static const int MAX_EXTENT_SIZE = 0x40000000;
static const uint32_t NEXT_EXTENT = 0xc0000000;
static constexpr int SECTOR_SIZE = 2048;
static constexpr int ALLOC_BLOCK_SIZE = 1024 * 64;
static constexpr int METADATA_START_ADDR = 1024 * 640 / SECTOR_SIZE;
static constexpr int MAX_EXTENT_SIZE = 0x40000000;
static constexpr uint32_t NEXT_EXTENT = 0xc0000000;

static const int64_t META_BLOCK_PER_DATA = 16 * 1000000000ll;
static constexpr int64_t META_BLOCK_PER_DATA = 16 * 1000000000ll;

// it can be allocated inside single sector of a extended file
static const unsigned MAX_EXTENTS_IN_EXTFILE = (SECTOR_SIZE - 216 - 32) / 16;
static const unsigned MAX_EXTENTS_IN_EXTCONT = (SECTOR_SIZE - 24 - 32) / 16;
static constexpr unsigned MAX_EXTENTS_IN_EXTFILE = (SECTOR_SIZE - 216 - 32) / 16;
static constexpr unsigned MAX_EXTENTS_IN_EXTCONT = (SECTOR_SIZE - 24 - 32) / 16;

static const int MAIN_INTERLEAVE_BLOCKSIZE = 6144 * 3168;
static const int SUB_INTERLEAVE_BLOCKSIZE = 6144 * 1312;
static constexpr int MAIN_INTERLEAVE_BLOCKSIZE = 6144 * 3168;
static constexpr int SUB_INTERLEAVE_BLOCKSIZE = 6144 * 1312;

static const int MAX_MAIN_MUXER_RATE = 48000000;
static const int MAX_4K_MUXER_RATE = 109000000;
static const int MAX_SUBMUXER_RATE = 35000000;
static constexpr int MAX_MAIN_MUXER_RATE = 48000000;
static constexpr int MAX_4K_MUXER_RATE = 109000000;
static constexpr int MAX_SUBMUXER_RATE = 35000000;

enum class DescriptorTag
{
Expand Down Expand Up @@ -115,7 +115,7 @@ typedef std::vector<Extent> ExtentList;
struct MappingEntry
{
MappingEntry() : parentLBN(0), LBN(0) {}
MappingEntry(int _parentLBN, int _LBN) : parentLBN(_parentLBN), LBN(_LBN) {}
MappingEntry(const int _parentLBN, const int _lbn) : parentLBN(_parentLBN), LBN(_lbn) {}

int parentLBN;
int LBN;
Expand Down
4 changes: 2 additions & 2 deletions tsMuxer/matroskaDemuxer.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ class MatroskaDemuxer : public IOContextDemuxer

uint64_t segment_start;
uint64_t created;
uint64_t fileDuration;
int64_t fileDuration;
char *writing_app;
char *muxing_app;
uint64_t time_scale;
std::map<uint64_t, uint64_t> m_firstTimecode;
std::map<int64_t, int64_t> m_firstTimecode;
bool index_parsed;
bool metadata_parsed;
int num_streams;
Expand Down
2 changes: 0 additions & 2 deletions tsMuxer/matroskaParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@

#include "aac.h"
#include "abstractStreamReader.h"
#include "avCodecs.h"
#include "avPacket.h"
#include "ioContextDemuxer.h"
#include "vod_common.h"

typedef IOContextTrackType MatroskaTrackType;
typedef Track MatroskaTrack;
Expand Down
4 changes: 2 additions & 2 deletions tsMuxer/mlpCodec.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include <types/types.h>

#ifndef MLP_CODEC_H_
#define MLP_CODEC_H_

#include <types/types.h>

static constexpr int MLP_HEADER_LEN = 7;

enum class MlpSubType
Expand Down
2 changes: 0 additions & 2 deletions tsMuxer/movDemuxer.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@
#define MOV_DEMUXER_H_

#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>

#include "BufferedReader.h"
#include "bufferedReaderManager.h"
#include "ioContextDemuxer.h"

Expand Down
10 changes: 2 additions & 8 deletions tsMuxer/mpegVideo.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@

#include <types/types.h>

#include <iostream>

#include "avPacket.h"
#include "bitStream.h"
#include "vod_common.h"
Expand Down Expand Up @@ -47,14 +45,10 @@ class MPEGHeader
// uint8_t* bufStart = buffer;
for (buffer += 2; buffer < end;)
{
if (*buffer > 1)
buffer += 3;
else if (*buffer == 0)
if (*buffer == 0)
buffer++;
else if (buffer[-2] == 0 && buffer[-1] == 0)
{
else if (buffer[-2] == 0 && buffer[-1] == 0 && buffer[0] == 1)
return buffer - 2;
}
else
buffer += 3;
}
Expand Down

0 comments on commit dccba0e

Please sign in to comment.