Remove stdafx.{cpp,h}

Precompiled headers aren't actually used by any of the compilers, so leaving
this header in the repo doesn't make much sense.
However, removing it revealed some places in the code which rely on windows.h
being included on WIN32, which was probably included via the tchar.h include.
These places have been fixed to explicitly include windows.h.
This commit is contained in:
Daniel Kamil Kozar 2019-10-26 18:17:16 +02:00
parent fc3d2b2410
commit 0fd3b37746
No known key found for this signature in database
GPG Key ID: A5FB0175B3A93F03
49 changed files with 22 additions and 104 deletions

View File

@ -1,30 +1,13 @@
#ifndef __T_TYPES_H
#define __T_TYPES_H
#ifdef WIN32
#include <winsock2.h>
#else
#include <netinet/in.h>
#endif
#include <string>
#include <vector>
#include <cstdint>
//class Serializator;
#if defined _MSC_VER
//typedef unsigned __int8 uint8_t;
//typedef unsigned __int16 uint16_t;
//typedef unsigned __int32 uint32_t;
//typedef unsigned __int64 uint64_t;
//typedef __int8 int8_t;
//typedef __int16 int16_t;
//typedef __int32 int32_t;
//typedef __int64 int64_t;
#else
#define override
#endif
#ifdef WIN32
#define strcasecmp stricmp

View File

@ -1,4 +1,3 @@
#include "stdafx.h"
#include "abstractDemuxer.h"
#include "subTrackFilter.h"

View File

@ -45,7 +45,6 @@ add_executable (tsmuxer
simplePacketizerReader.cpp
singleFileMuxer.cpp
srtStreamReader.cpp
stdafx.cpp
textSubtitles.cpp
textSubtitlesRender.cpp
tsDemuxer.cpp

View File

@ -1,4 +1,3 @@
#include "stdafx.h"
#include "aac.h"
#include "bitStream.h"
#include "vod_common.h"

View File

@ -1,4 +1,3 @@
#include "stdafx.h"
#include "abstractMuxer.h"
#include "vodCoreException.h"

View File

@ -1,7 +1,6 @@
#ifndef __ABSTRACT_MUXER_H
#define __ABSTRACT_MUXER_H
#include "stdafx.h"
#include <fs/file.h>
#include <fs/systemlog.h>
#include "metaDemuxer.h"

View File

@ -1,4 +1,3 @@
#include "stdafx.h"
#include <sstream>
#include "bitStream.h"
#include "avCodecs.h"

View File

@ -1,4 +1,3 @@
#include "stdafx.h"
#include <sstream>
#include "bitStream.h"
#include "avCodecs.h"

View File

@ -1,4 +1,3 @@
#include "stdafx.h"
#include "avCodecs.h"

View File

@ -1,4 +1,3 @@
#include "stdafx.h"
#include "base64.h"
#include <iostream>

View File

@ -1,4 +1,3 @@
#include "stdafx.h"
#include "bitStream.h"
#include <cstdint>

View File

@ -1,10 +1,13 @@
#include "stdafx.h"
#include "bufferedFileReader.h"
#include <iostream>
#include <fs/systemlog.h>
#include "vod_common.h"
#include "vodCoreException.h"
#ifdef WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif
using namespace std;

View File

@ -1,4 +1,3 @@
#include "stdafx.h"
#include "bufferedFileWriter.h"
#include <fs/systemlog.h>

View File

@ -1,4 +1,3 @@
#include "stdafx.h"
#include "BufferedReader.h"
#include "vod_common.h"

View File

@ -1,4 +1,3 @@
#include "stdafx.h"
#include <limits.h>
#include "bufferedReaderManager.h"
#include <fs/systemlog.h>

View File

@ -1,4 +1,3 @@
#include "stdafx.h"
#include "combinedH264Demuxer.h"
#include "avCodecs.h"

View File

@ -1,6 +1,6 @@
#include "stdafx.h"
#include "dtsStreamReader.h"
#include <sstream>
#include <algorithm>
enum DCAExtensionMask {
DCA_EXT_CORE = 0x001, ///< core in core substream
@ -740,7 +740,7 @@ int DTSStreamReader::buf14To16(uint8_t *p_out, const uint8_t *p_in, int i_in, in
if( bits_out < 8 )
{
int need = min( 8 - bits_out, bits_in );
int need = std::min( 8 - bits_out, bits_in );
cur <<= need;
cur |= ( tmp >> (bits_in - need) );
tmp <<= (8 - bits_in + need);

View File

@ -1,4 +1,3 @@
#include "stdafx.h"
#include "dvbSubStreamReader.h"
#if 1

View File

@ -5,6 +5,7 @@
#include "math.h"
#include "vodCoreException.h"
#include "tsPacket.h"
#include <algorithm>
using namespace std;
@ -1206,7 +1207,7 @@ int H264StreamReader::detectPrimaryPicType(SliceUnit& firstSlice, uint8_t* buff)
m_nextFrameFound = false;
m_nextFrameIdr = false;
m_pict_type = -1;
m_pict_type = max(m_pict_type, sliceTypeToPictType(firstSlice.slice_type));
m_pict_type = std::max(m_pict_type, sliceTypeToPictType(firstSlice.slice_type));
//if (firstSlice.orig_slice_type >= 5) // all other slice at this picture must be same type
// return 0; // OK
@ -1240,7 +1241,7 @@ int H264StreamReader::detectPrimaryPicType(SliceUnit& firstSlice, uint8_t* buff)
m_nextFrameIdr = slice.isIDR();
return 0; // next frame found
}
m_pict_type = max(m_pict_type, sliceTypeToPictType(slice.slice_type));
m_pict_type = std::max(m_pict_type, sliceTypeToPictType(slice.slice_type));
break;
/*
case nuDelimiter:

View File

@ -604,9 +604,6 @@ void IsoWriter::setVolumeLabel(const std::string& value)
bool IsoWriter::open(const std::string& fileName, int64_t diskSize, int extraISOBlocks)
{
int systemFlags = 0;
#ifdef WIN32
systemFlags += FILE_FLAG_NO_BUFFERING;
#endif
if (!m_file.open(fileName.c_str(), File::ofWrite, systemFlags))
return false;

View File

@ -1,4 +1,3 @@
#include "stdafx.h"
#include "lpcmStreamReader.h"
#include "vod_common.h"
#include <sstream>

View File

@ -1,4 +1,3 @@
#include "stdafx.h"
#include "matroskaParser.h"
#include "vodCoreException.h"

View File

@ -1,4 +1,3 @@
#include "stdafx.h"
#include <iomanip>
#include <chrono>

View File

@ -1,4 +1,3 @@
#include "stdafx.h"
#include "mp3Codec.h"

View File

@ -1,4 +1,3 @@
#include "stdafx.h"
#include "mpeg2StreamReader.h"
#include <fs/systemlog.h>

View File

@ -1,4 +1,3 @@
#include "stdafx.h"
#include "mpegAudioStreamReader.h"

View File

@ -1,4 +1,3 @@
#include "stdafx.h"
#ifndef WIN32
#endif
@ -9,6 +8,7 @@
#include <fs/systemlog.h>
#include "nalUnits.h"
#include "math.h"
#include <algorithm>
const static double EPSILON = 5e-5;
const static int64_t MAX_PULLDOWN_ASYNC = 100000000ll;
@ -62,7 +62,7 @@ int MPEGStreamReader::flushPacket(AVPacket& avPacket)
}
if (decodeRez == 0) {
avPacket.data = m_tmpBuffer;
avPacket.size = min(MAX_AV_PACKET_SIZE, m_tmpBufferLen);
avPacket.size = std::min(MAX_AV_PACKET_SIZE, m_tmpBufferLen);
}
if (m_tmpBufferLen > MAX_AV_PACKET_SIZE) {
LTRACE(LT_ERROR, 2, "Too large last buffer (" << m_tmpBufferLen << " bytes). Truncate buffer to " <<
@ -128,7 +128,7 @@ int MPEGStreamReader::readPacket(AVPacket& avPacket)
}
if (m_bufEnd - m_curPos < MAX_AV_PACKET_SIZE) {
uint8_t* nextNal = NALUnit::findNALWithStartCode(min(m_curPos + 3,m_bufEnd), m_bufEnd, m_longCodesAllowed);
uint8_t* nextNal = NALUnit::findNALWithStartCode(std::min(m_curPos + 3,m_bufEnd), m_bufEnd, m_longCodesAllowed);
if (nextNal == m_bufEnd) {
storeBufferRest();
return NEED_MORE_DATA;
@ -178,7 +178,7 @@ int MPEGStreamReader::readPacket(AVPacket& avPacket)
return 0; // return zero AV packet for new frame
}
}
uint8_t* findEnd = min(m_bufEnd, m_curPos + MAX_AV_PACKET_SIZE);
uint8_t* findEnd = std::min(m_bufEnd, m_curPos + MAX_AV_PACKET_SIZE);
uint8_t* nal = NALUnit::findNALWithStartCode(m_curPos + isNal, findEnd, m_longCodesAllowed);
if (nal == findEnd)

View File

@ -1,4 +1,3 @@
#include "stdafx.h"
#ifndef WIN32
#endif

View File

@ -1,6 +1,5 @@
#include "muxerManager.h"
#include "stdafx.h"
#include "muxerManager.h"
#include "vodCoreException.h"

View File

@ -1,4 +1,3 @@
#include "stdafx.h"
#include "nalUnits.h"
//#include <math.h>

View File

@ -1,4 +1,3 @@
#include "stdafx.h"
#include "pesPacket.h"

View File

@ -1,4 +1,3 @@
#include "stdafx.h"
#include "programStreamDemuxer.h"
#include "pesPacket.h"
#include "tsPacket.h"

View File

@ -1,4 +1,3 @@
#include "stdafx.h"
#include "tsPacket.h"
#include "avCodecs.h"

View File

@ -1,4 +1,3 @@
#include "stdafx.h"
#include "simplePacketizerReader.h"
#include "vod_common.h"

View File

@ -1,4 +1,3 @@
#include "stdafx.h"
#include <fs/directory.h>
#include "singleFileMuxer.h"
#include "vodCoreException.h"

View File

@ -1,7 +1,6 @@
#ifndef __SINGLE_FILE_MUXER_H
#define __SINGLE_FILE_MUXER_H
#include "stdafx.h"
#include <types/types.h>
#include "abstractMuxer.h"
#include "avPacket.h"

View File

@ -1,4 +1,3 @@
#include "stdafx.h"
#include "memory.h"
#include "srtStreamReader.h"

View File

@ -1,8 +0,0 @@
// stdafx.cpp : source file that includes just the standard includes
// vodTransport.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file

View File

@ -1,16 +0,0 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#ifdef WIN32
#pragma once
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <stdio.h>
#include <tchar.h>
#endif

View File

@ -1,4 +1,3 @@
#include "stdafx.h"
#include "textSubtitles.h"
#ifdef WIN32

View File

@ -1,4 +1,3 @@
#include "stdafx.h"
#include "tsDemuxer.h"
#include "avCodecs.h"

View File

@ -1,4 +1,3 @@
#include "stdafx.h"
#include "tsMuxer.h"
#include "pesPacket.h"
@ -18,6 +17,10 @@
#include <fs/textfile.h>
#include "iso_writer.h"
#ifdef WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif
using namespace std;

View File

@ -1,7 +1,6 @@
#ifndef __TS_MUXER_H
#define __TS_MUXER_H
#include "stdafx.h"
#include <types/types.h>
#include <map>
#include <vector>

View File

@ -1,4 +1,3 @@
#include "stdafx.h"
#ifndef WIN32
#endif

View File

@ -1,4 +1,3 @@
#include "stdafx.h"
#include "utf8Converter.h"
#include "convertUTF.h"
#include "vodCoreException.h"
@ -8,7 +7,7 @@
#include "memory.h"
#ifdef WIN32
#include "winerror.h"
#include <windows.h>
#else
#include <locale.h>
#include <iconv.h>

View File

@ -1,4 +1,3 @@
#include "stdafx.h"
#include <memory.h>
#include <sstream>
#include "vc1Parser.h"

View File

@ -1,4 +1,3 @@
#include "stdafx.h"
#include <iostream>
#include "vc1StreamReader.h"

View File

@ -1,4 +1,3 @@
#include "stdafx.h"
#include "vod_common.h"
#include <fs/directory.h>

View File

@ -5,6 +5,8 @@
#include <string>
#include <vector>
#include <iostream>
#include <thread>
#include <chrono>
#if 1
extern bool sLastMsg;
@ -21,15 +23,7 @@ class Process {
public:
static void sleep(int millisec)
{
#ifdef WIN32
Sleep( millisec );
#else
struct timespec requested_time;
requested_time.tv_sec = millisec / 1000;
requested_time.tv_nsec = (millisec % 1000) * 1000000;
struct timespec remaining;
nanosleep( &requested_time, &remaining );
#endif
std::this_thread::sleep_for(std::chrono::milliseconds(millisec));
}
};