Skip to content

Commit

Permalink
Android 32 ftello / removed compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
peak3d committed Dec 30, 2017
1 parent 95b1c03 commit 352822a
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 23 deletions.
4 changes: 2 additions & 2 deletions lib/libbento4/Core/Ap4Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,10 @@
#endif

#if !defined(AP4_fseek)
#define AP4_fseek fseeko
#define AP4_fseek fseek
#endif
#if !defined(AP4_ftell)
#define AP4_ftell ftello
#define AP4_ftell ftell
#endif

/* some compilers (ex: MSVC 8) deprecate those, so we rename them */
Expand Down
4 changes: 2 additions & 2 deletions src/ADTSReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ uint64_t ID3TAG::getSize(const uint8_t *data, unsigned int len, unsigned int shi
{
uint64_t size(0);
const uint8_t *dataE(data + len);
for (data; data < dataE; ++data)
for (; data < dataE; ++data)
size = size << shift | *data;
return size;
};
Expand Down Expand Up @@ -87,7 +87,7 @@ uint64_t ADTSFrame::getBE(const uint8_t *data, unsigned int len)
{
uint64_t size(0);
const uint8_t *dataE(data + len);
for (data; data < dataE; ++data)
for (; data < dataE; ++data)
size = size << 8 | *data;
return size;
};
Expand Down
21 changes: 10 additions & 11 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
#endif

#define DVD_TIME_BASE 1000000
#define DVD_NOPTS_VALUE 0xFFF0000000000000ULL

#undef CreateDirectory

Expand Down Expand Up @@ -790,7 +789,7 @@ class DummyReader: public SampleReader
virtual bool EOS()const override { return false; }
virtual uint64_t DTS()const override { return DVD_NOPTS_VALUE; }
virtual uint64_t PTS()const override { return DVD_NOPTS_VALUE; }
virtual uint64_t Elapsed(uint64_t basePTS) override { return 0; }
virtual uint64_t Elapsed(uint64_t basePTS) override { return 0ULL; }
virtual AP4_Result Start(bool &bStarted) override { return AP4_SUCCESS; }
virtual AP4_Result ReadSample() override { return AP4_SUCCESS; }
virtual void Reset(bool bEOS) override {}
Expand Down Expand Up @@ -976,10 +975,10 @@ class FragmentedSampleReader : public SampleReader, public AP4_LinearReader
virtual uint64_t DTS()const override { return m_dts; };
virtual uint64_t PTS()const override { return m_pts; };

virtual uint64_t Elapsed(uint64_t basePTS)
virtual uint64_t Elapsed(uint64_t basePTS) override
{
uint64_t manifestPTS = (m_pts > m_ptsDiff) ? m_pts - m_ptsDiff : 0;
return manifestPTS > basePTS ? manifestPTS - basePTS : 0;
return manifestPTS > basePTS ? manifestPTS - basePTS : 0ULL;
};

virtual AP4_UI32 GetStreamId()const override { return m_streamId; };
Expand Down Expand Up @@ -1242,7 +1241,7 @@ class SubtitleSampleReader : public SampleReader
virtual bool EOS()const override { return m_eos; };
virtual uint64_t DTS()const override { return m_pts; };
virtual uint64_t PTS()const override { return m_pts; };
virtual uint64_t Elapsed(uint64_t basePTS) { return m_pts > basePTS ? m_pts - basePTS : 0; };
virtual uint64_t Elapsed(uint64_t basePTS) override { return m_pts > basePTS ? m_pts - basePTS : 0ULL; };
virtual AP4_Result Start(bool &bStarted) override { m_eos = false; return AP4_SUCCESS; };
virtual AP4_Result ReadSample() override
{
Expand Down Expand Up @@ -1319,11 +1318,11 @@ class TSSampleReader : public SampleReader, public TSReader
virtual bool EOS()const override { return m_eos; }
virtual uint64_t DTS()const override { return m_dts; }
virtual uint64_t PTS()const override { return m_pts; }
virtual uint64_t Elapsed(uint64_t basePTS)
virtual uint64_t Elapsed(uint64_t basePTS) override
{
// TSReader::GetPTSDiff() is the difference between playlist PTS and real PTS relative to current segment
uint64_t playlistPTS = (static_cast<int64_t>(m_pts) > m_ptsDiff) ? m_pts - m_ptsDiff : 0;
return playlistPTS > basePTS ? playlistPTS - basePTS : 0;
uint64_t playlistPTS = (static_cast<int64_t>(m_pts) > m_ptsDiff) ? m_pts - m_ptsDiff : 0ULL;
return playlistPTS > basePTS ? playlistPTS - basePTS : 0ULL;
};

virtual AP4_Result Start(bool &bStarted) override
Expand Down Expand Up @@ -1428,11 +1427,11 @@ class ADTSSampleReader : public SampleReader, public ADTSReader
virtual bool EOS()const override { return m_eos; }
virtual uint64_t DTS()const override { return m_pts; }
virtual uint64_t PTS()const override { return m_pts; }
virtual uint64_t Elapsed(uint64_t basePTS)
virtual uint64_t Elapsed(uint64_t basePTS) override
{
// TSReader::GetPTSDiff() is the difference between playlist PTS and real PTS relative to current segment
uint64_t playlistPTS = (static_cast<int64_t>(m_pts) > m_ptsDiff) ? m_pts - m_ptsDiff : 0;
return playlistPTS > basePTS ? playlistPTS - basePTS : 0;
uint64_t playlistPTS = (static_cast<int64_t>(m_pts) > m_ptsDiff) ? m_pts - m_ptsDiff : 0ULL;
return playlistPTS > basePTS ? playlistPTS - basePTS : 0ULL;
};

virtual AP4_Result Start(bool &bStarted) override
Expand Down
3 changes: 3 additions & 0 deletions wvdecrypter/wvdecrypter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,9 @@ void WV_CencSingleSampleDecrypter::GetCapabilities(const uint8_t* key, uint32_t
if (keys_.empty())
return;

caps.flags |= (SSD_DECRYPTER::SSD_CAPS::SSD_SECURE_PATH | SSD_DECRYPTER::SSD_CAPS::SSD_ANNEXB_REQUIRED);
return;

if (media == SSD_DECRYPTER::SSD_CAPS::SSD_MEDIA_VIDEO)
{
for (auto k : keys_)
Expand Down
16 changes: 8 additions & 8 deletions wvdecrypter/wvdecrypter_android.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ class WV_CencSingleSampleDecrypter : public AP4_CencSingleSampleDecrypter
const AP4_UI16* bytes_of_cleartext_data,

// array of <subsample_count> integers. NULL if subsample_count is 0
const AP4_UI32* bytes_of_encrypted_data);
const AP4_UI32* bytes_of_encrypted_data) override;

void GetCapabilities(const uint8_t *keyid, uint32_t media, SSD_DECRYPTER::SSD_CAPS &caps);

Expand Down Expand Up @@ -431,7 +431,7 @@ bool WV_CencSingleSampleDecrypter::SendSessionMessage(AMediaDrmByteArray &sessio
std::string::size_type insPos(blocks[0].find("{SSM}"));
if (insPos != std::string::npos)
{
if (insPos >= 0 && blocks[0][insPos - 1] == 'B')
if (insPos>0 && blocks[0][insPos - 1] == 'B')
{
std::string msgEncoded = b64_encode(key_request, key_request_size, true);
blocks[0].replace(insPos - 1, 6, msgEncoded);
Expand Down Expand Up @@ -470,7 +470,7 @@ bool WV_CencSingleSampleDecrypter::SendSessionMessage(AMediaDrmByteArray &sessio
if (insPos != std::string::npos)
{
std::string::size_type sidSearchPos(insPos);
if (insPos >= 0)
if (insPos > 0)
{
if (blocks[2][insPos - 1] == 'B' || blocks[2][insPos - 1] == 'b')
{
Expand All @@ -489,7 +489,7 @@ bool WV_CencSingleSampleDecrypter::SendSessionMessage(AMediaDrmByteArray &sessio
insPos = blocks[2].find("{SID}", sidSearchPos);
if (insPos != std::string::npos)
{
if (insPos >= 0)
if (insPos > 0)
{
if (blocks[2][insPos - 1] == 'B' || blocks[2][insPos - 1] == 'b')
{
Expand Down Expand Up @@ -789,7 +789,7 @@ class WVDecrypter : public SSD_DECRYPTER
cdmsession_ = nullptr;
};

virtual const char *SelectKeySytem(const char* keySystem)
virtual const char *SelectKeySytem(const char* keySystem) override
{
Log(SSD_HOST::LL_ERROR, "Key system request: %s", keySystem);
if (strcmp(keySystem, "com.widevine.alpha") == 0)
Expand All @@ -806,7 +806,7 @@ class WVDecrypter : public SSD_DECRYPTER
return nullptr;
}

virtual bool OpenDRMSystem(const char *licenseURL, const AP4_DataBuffer &serverCertificate)
virtual bool OpenDRMSystem(const char *licenseURL, const AP4_DataBuffer &serverCertificate) override
{
if (key_system_ == NONE)
return false;
Expand Down Expand Up @@ -841,14 +841,14 @@ class WVDecrypter : public SSD_DECRYPTER
caps = { 0, 0, 0};
}

virtual bool HasLicenseKey(AP4_CencSingleSampleDecrypter* decrypter, const uint8_t *keyid)
virtual bool HasLicenseKey(AP4_CencSingleSampleDecrypter* decrypter, const uint8_t *keyid) override
{
if (decrypter)
return static_cast<WV_CencSingleSampleDecrypter*>(decrypter)->HasLicenseKey(keyid);
return false;
}

virtual bool OpenVideoDecoder(AP4_CencSingleSampleDecrypter* decrypter, const SSD_VIDEOINITDATA *initData)
virtual bool OpenVideoDecoder(AP4_CencSingleSampleDecrypter* decrypter, const SSD_VIDEOINITDATA *initData) override
{
return false;
}
Expand Down

0 comments on commit 352822a

Please sign in to comment.