Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions GstHandlerControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@ GstHandlerControl::ScopeHelper GstHandlerControl::getScopeHelper()

bool GstHandlerControl::waitForDone(int MaximumDelayMilliseconds, std::string name)
{
// Negative delays are treated as an immediate timeout.
if (MaximumDelayMilliseconds < 0)
{
MW_LOG_ERR("GstHandlerControl: invalid negative delay %d", MaximumDelayMilliseconds);
return false;
}

const std::chrono::steady_clock::time_point end =
std::chrono::milliseconds{MaximumDelayMilliseconds} + std::chrono::steady_clock::now();

Expand Down
17 changes: 13 additions & 4 deletions InterfacePlayerRDK.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3188,11 +3188,20 @@ void InterfacePlayerPriv::SendNewSegmentEvent(int type, GstClockTime startPts ,G

if( (GstMediaType)mediaType == eGST_MEDIATYPE_VIDEO )
{
bool isVideoMaster = socInterface->IsVideoMaster(gstPrivateContext->video_sink);
if( !isVideoMaster )
bool isVideoMaster = true;
if (socInterface)
{
isVideoMaster = socInterface->IsVideoMaster(gstPrivateContext->video_sink);
}
else
{
MW_LOG_WARN("socInterface is null, assuming video master");
}

// set applied_rate to trickplay rate if video sink doesn't use vmaster
// so that it can correctly handle there being no audio
if (!isVideoMaster)
{
// set applied_rate to trickplay rate if video sink doesn't use vmaster
// so that it can correctly handle there being no audio
segment.applied_rate = gstPrivateContext->rate;
}
}
Expand Down
12 changes: 12 additions & 0 deletions baseConversion/_base64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@
*/
char *base64_Encode(const unsigned char *src, size_t len)
{
if( !src )
{
return NULL;
}
if( !len )
{
return strdup("");
}
const unsigned char *fin = &src[len];
const static char *encode = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; // base64
char *rc = (char *)malloc(((len+2)/3)*4+1);
Expand Down Expand Up @@ -64,6 +72,10 @@ char *base64_Encode(const unsigned char *src, size_t len)
*/
unsigned char *base64_Decode(const char *src, size_t *outLen, size_t srcLen)
{
if( !src || !outLen )
{
return NULL;
}
static const signed char decode[256] =
{
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Expand Down
14 changes: 10 additions & 4 deletions drm/helper/VerimatrixHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <memory>
#include <iostream>

#include "PlayerLogManager.h"
#include "VerimatrixHelper.h"
#include "DrmUtils.h"
#include "DrmConstants.h"
Expand Down Expand Up @@ -121,10 +122,15 @@ void VerimatrixHelper::generateLicenseRequest(const ChallengeInfo& challengeInfo

void VerimatrixHelper::transformLicenseResponse(std::shared_ptr<DrmData> licenseResponse) const
{
if(mDrmInfo.mediaFormat == eMEDIAFORMAT_HLS)
licenseResponse->setData((unsigned char*)mDrmInfo.keyURI.c_str(), mDrmInfo.keyURI.length());
else if(mDrmInfo.mediaFormat == eMEDIAFORMAT_DASH)
licenseResponse->setData((unsigned char*)mKeyID.data(), mKeyID.size());
if(!licenseResponse)
{
MW_LOG_WARN("invalid license response");
return;
}
if (mDrmInfo.mediaFormat == eMEDIAFORMAT_HLS)
licenseResponse->setData(mDrmInfo.keyURI.c_str(), mDrmInfo.keyURI.length());
else if (mDrmInfo.mediaFormat == eMEDIAFORMAT_DASH)
licenseResponse->setData(reinterpret_cast<const char*>(mKeyID.data()), mKeyID.size());
else
MW_LOG_WARN("unknown mediaFormat %d", mDrmInfo.mediaFormat);
}
Expand Down
116 changes: 116 additions & 0 deletions externals/PlayerExternalsInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,114 @@ class FakePlayerExternalsInterface : public PlayerExternalsInterfaceBase
playerDsHdcpProtocolVersion_t m_hdcpCurrentProtocol;
public:
FakePlayerExternalsInterface(){SetHDMIStatus();}
/**
* @brief Get the source video width.
*
* Returns the width of the source video stream.
*
* @return int Source width in pixels.
*/
int getSourceWidth() const { return m_sourceWidth; }

/**
* @brief Get the source video height.
*
* Returns the height of the source video stream.
*
* @return int Source height in pixels.
*/
int getSourceHeight() const { return m_sourceHeight; }

/**
* @brief Get the display width.
*
* Returns the width of the display.
*
* @return int Display width in pixels.
*/
int getDisplayWidth() const { return m_displayWidth; }

/**
* @brief Get the display height.
*
* Returns the height of the display.
*
* @return int Display height in pixels.
*/
int getDisplayHeight() const { return m_displayHeight; }

/**
* @brief Check if HDCP is enabled.
*
* Returns true if HDCP (High-bandwidth Digital Content Protection) is enabled.
*
* @return bool True if HDCP is enabled, false otherwise.
*/
bool isHDCPEnabled() const { return m_isHDCPEnabled; }

/**
* @brief Get the associated GstElement pointer.
*
* Returns the internal GstElement pointer used by this player interface.
*
* @return GstElement* Pointer to the GstElement.
*/
GstElement* getGstElement() const { return m_gstElement; }

/**
* @brief Set the source video width.
*
* Sets the width of the source video stream.
*
* @param width Source width in pixels.
*/
void setSourceWidth(int width) { m_sourceWidth = width; }

/**
* @brief Set the source video height.
*
* Sets the height of the source video stream.
*
* @param height Source height in pixels.
*/
void setSourceHeight(int height) { m_sourceHeight = height; }

/**
* @brief Set the display width.
*
* Sets the width of the display.
*
* @param width Display width in pixels.
*/
void setDisplayWidth(int width) { m_displayWidth = width; }

/**
* @brief Set the display height.
*
* Sets the height of the display.
*
* @param height Display height in pixels.
*/
void setDisplayHeight(int height) { m_displayHeight = height; }

/**
* @brief Enable or disable HDCP.
*
* Sets the HDCP (High-bandwidth Digital Content Protection) enabled state.
*
* @param enabled True to enable HDCP, false to disable.
*/
void setHDCPEnabled(bool enabled) { m_isHDCPEnabled = enabled; }

/**
* @brief Set the GstElement pointer (for fake/test purposes).
*
* Sets the internal GstElement pointer used by this player interface.
*
* @param element Pointer to the GstElement.
*/
void setGstElementFake(GstElement *element) { m_gstElement = element; }


void Initialize() override {}

Expand Down Expand Up @@ -212,6 +320,14 @@ class PlayerExternalsInterface

void SetUseFireBoltSDK(bool t_use_firebolt_sdk);

#ifdef UBUNTU
static std::shared_ptr<PlayerExternalsInterface> createInstance()
{
return std::shared_ptr<PlayerExternalsInterface>(
new PlayerExternalsInterface());
}
#endif

void SetPowerEvent(bool powerEvt);

bool GetPowerEvent();
Expand Down
33 changes: 22 additions & 11 deletions playerisobmff/playerisobmffbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1408,28 +1408,39 @@ SencIsoBmffBox* SencIsoBmffBox::constructSencBox(uint32_t sz, uint8_t *ptr)
*/
void SencIsoBmffBox::truncate(uint32_t firstSampleSize)
{
if (numSamples > 1)
if (numSamples <= 1)
{
if (firstSampleSize)
{
auto newEnd{sampleCountLoc + sizeof(uint32_t) + firstSampleSize};
auto oldSize{getSize()};
auto newSize{static_cast<uint32_t>(newEnd - getBase())};
return;
}

if (firstSampleSize)
{
uint8_t *base = getBase();
uint32_t oldSize = getSize();
uint8_t *end = base + oldSize;

if ((oldSize - newSize) >= PLAYER_SIZEOF_SIZE_AND_TAG)
uint8_t *newEnd = sampleCountLoc + sizeof(uint32_t) + firstSampleSize;
if (newEnd <= base || newEnd > end)
{
MW_LOG_INFO("SencIsoBmffBox::truncate: computed end is out of bounds");
}
else
{
uint32_t newSize = static_cast<uint32_t>(newEnd - base);
if (newSize <= oldSize && (oldSize - newSize) >= PLAYER_SIZEOF_SIZE_AND_TAG)
{
PLAYER_WRITE_U32(getBase(), newSize);
PLAYER_WRITE_U32(base, newSize);
SkipIsoBmffBox skip{oldSize - newSize, newEnd};
}
else
{
MW_LOG_INFO("No room for a skip box");
}
}

numSamples = 1;
PLAYER_WRITE_U32(sampleCountLoc, numSamples);
}

numSamples = 1;
PLAYER_WRITE_U32(sampleCountLoc, numSamples);
}

/**
Expand Down
33 changes: 32 additions & 1 deletion playerisobmff/playerisobmffbuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,30 @@ void PlayerIsoBmffBuffer::setBuffer(uint8_t *buf, size_t sz)
bufSize = sz;
}

/**
* @brief Get buffer pointer
*/
uint8_t* PlayerIsoBmffBuffer::getBuffer() const
{
return buffer;
}

/**
* @brief Get buffer size
*/
size_t PlayerIsoBmffBuffer::getBufferSize() const
{
return bufSize;
}

/**
* @brief Get parsed mdat box count
*/
size_t PlayerIsoBmffBuffer::getMdatCount() const
{
return mdatCount;
}

/**
* @fn parseBuffer
* @param[in] correctBoxSize - flag to correct the box size
Expand All @@ -83,11 +107,18 @@ bool PlayerIsoBmffBuffer::parseBuffer(bool correctBoxSize, int newTrackId)
/**
* @brief Get list of box handles in a parsed buffer
*/
player_isobmff::IsoBmffBox* PlayerIsoBmffBuffer::getChunkedfBox() const
player_isobmff::IsoBmffBox* PlayerIsoBmffBuffer::getChunkedBox() const
{
return this->chunkedBox;
}

/**
* @brief Deprecated alias for getChunkedBox()
*/
player_isobmff::IsoBmffBox* PlayerIsoBmffBuffer::getChunkedfBox() const
{
return getChunkedBox();
}
/**
* @brief Print ISOBMFF boxes
*/
Expand Down
44 changes: 38 additions & 6 deletions playerisobmff/playerisobmffbuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,21 @@ class PlayerIsoBmffBuffer

PlayerIsoBmffBuffer(const PlayerIsoBmffBuffer&) = delete;
PlayerIsoBmffBuffer& operator=(const PlayerIsoBmffBuffer&) = delete;


/**
* @fn getChunkedBox
*
* @return Box handle if Chunk box found in a parsed buffer. NULL otherwise
*/
IsoBmffBox* getChunkedBox() const;

/**
* @fn getChunkedfBox
*
* @return Box handle if Chunk box found in a parsed buffer. NULL otherwise
* @note Deprecated alias for getChunkedBox.
*/
player_isobmff::IsoBmffBox* getChunkedfBox() const;
IsoBmffBox* getChunkedfBox() const;

/**
* @fn UpdateBufferData
Expand Down Expand Up @@ -149,11 +157,35 @@ class PlayerIsoBmffBuffer
bool parseMdatBox(uint8_t *buf, size_t &size);

/**
* @fn getMdatBoxSize
* @param[out] size - size of mdat buffer
* @return true if buffer size available. false otherwise
*/
* @fn getMdatBoxSize
* @param[out] size - size of mdat buffer
* @return true if buffer size available. false otherwise
*/
bool getMdatBoxSize(size_t &size);


/**
* @brief Get the vector of ISOBMFF boxes
* @return Constant reference to the vector of boxes
*/
const std::vector<player_isobmff::IsoBmffBox*>& getBoxes() const {
return boxes;
}

/**
* @brief Get buffer pointer
*/
uint8_t* getBuffer() const;
/**
* @brief Get buffer size
*/
size_t getBufferSize() const;

/**
* @brief Get parsed mdat box count
*/
size_t getMdatCount() const;

};

#endif /* __PLAYERISOBMFFBUFFER_H__ */
Loading
Loading