Skip to content

Commit

Permalink
[videoplayer] Move stream info defines to a own header file.
Browse files Browse the repository at this point in the history
  • Loading branch information
ace20022 committed Nov 27, 2017
1 parent f1ab257 commit 992063a
Show file tree
Hide file tree
Showing 29 changed files with 176 additions and 166 deletions.
6 changes: 3 additions & 3 deletions xbmc/ApplicationPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -565,14 +565,14 @@ void CApplicationPlayer::OnNothingToQueueNotify()
player->OnNothingToQueueNotify();
}

void CApplicationPlayer::GetVideoStreamInfo(int streamId, SPlayerVideoStreamInfo &info)
void CApplicationPlayer::GetVideoStreamInfo(int streamId, VideoStreamInfo &info)
{
std::shared_ptr<IPlayer> player = GetInternal();
if (player)
player->GetVideoStreamInfo(streamId, info);
}

void CApplicationPlayer::GetAudioStreamInfo(int index, SPlayerAudioStreamInfo &info)
void CApplicationPlayer::GetAudioStreamInfo(int index, AudioStreamInfo &info)
{
std::shared_ptr<IPlayer> player = GetInternal();
if (player)
Expand Down Expand Up @@ -636,7 +636,7 @@ void CApplicationPlayer::SetAudioStream(int iStream)
}
}

void CApplicationPlayer::GetSubtitleStreamInfo(int index, SPlayerSubtitleStreamInfo &info)
void CApplicationPlayer::GetSubtitleStreamInfo(int index, SubtitleStreamInfo &info)
{
std::shared_ptr<IPlayer> player = GetInternal();
if (player)
Expand Down
12 changes: 6 additions & 6 deletions xbmc/ApplicationPlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ class CAction;
class CPlayerOptions;
class CStreamDetails;

struct SPlayerAudioStreamInfo;
struct SPlayerVideoStreamInfo;
struct SPlayerSubtitleStreamInfo;
struct AudioStreamInfo;
struct VideoStreamInfo;
struct SubtitleStreamInfo;
struct TextCacheStruct_t;

class CApplicationPlayer
Expand Down Expand Up @@ -105,7 +105,7 @@ class CApplicationPlayer
void GetAudioCapabilities(std::vector<int> &audioCaps);
int GetAudioStream();
int GetAudioStreamCount();
void GetAudioStreamInfo(int index, SPlayerAudioStreamInfo &info);
void GetAudioStreamInfo(int index, AudioStreamInfo &info);
int GetCacheLevel() const;
float GetCachePercentage() const;
int GetChapterCount();
Expand All @@ -119,7 +119,7 @@ class CApplicationPlayer
int GetSubtitle();
void GetSubtitleCapabilities(std::vector<int> &subCaps);
int GetSubtitleCount();
void GetSubtitleStreamInfo(int index, SPlayerSubtitleStreamInfo &info);
void GetSubtitleStreamInfo(int index, SubtitleStreamInfo &info);
bool GetSubtitleVisible();
TextCacheStruct_t* GetTeletextCache();
std::string GetRadioText(unsigned int line);
Expand All @@ -130,7 +130,7 @@ class CApplicationPlayer
int64_t GetTotalTime() const;
int GetVideoStream();
int GetVideoStreamCount();
void GetVideoStreamInfo(int streamId, SPlayerVideoStreamInfo &info);
void GetVideoStreamInfo(int streamId, VideoStreamInfo &info);
bool HasAudio() const;
bool HasMenu() const;
bool HasVideo() const;
Expand Down
8 changes: 4 additions & 4 deletions xbmc/GUIInfoManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6294,7 +6294,7 @@ std::string CGUIInfoManager::GetLabel(int info, int contextWindow, std::string *
case VIDEOPLAYER_SUBTITLES_LANG:
if(g_application.m_pPlayer && g_application.m_pPlayer->IsPlaying() && g_application.m_pPlayer->GetSubtitleVisible())
{
SPlayerSubtitleStreamInfo info;
SubtitleStreamInfo info;
g_application.m_pPlayer->GetSubtitleStreamInfo(g_application.m_pPlayer->GetSubtitle(), info);
strLabel = info.language;
}
Expand Down Expand Up @@ -8466,7 +8466,7 @@ std::string CGUIInfoManager::GetRadioRDSLabel(int item)
if (!tag.GetLanguage().empty())
return tag.GetLanguage();

SPlayerAudioStreamInfo info;
AudioStreamInfo info;
g_application.m_pPlayer->GetAudioStreamInfo(g_application.m_pPlayer->GetAudioStream(), info);
return info.language;
}
Expand Down Expand Up @@ -9332,8 +9332,8 @@ void CGUIInfoManager::UpdateAVInfo()
{
if (CServiceBroker::GetDataCacheCore().HasAVInfoChanges())
{
SPlayerVideoStreamInfo video;
SPlayerAudioStreamInfo audio;
VideoStreamInfo video;
AudioStreamInfo audio;

g_application.m_pPlayer->GetVideoStreamInfo(CURRENT_STREAM, video);
g_application.m_pPlayer->GetAudioStreamInfo(CURRENT_STREAM, audio);
Expand Down
4 changes: 2 additions & 2 deletions xbmc/GUIInfoManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,8 @@ friend CSetCurrentItemJob;
//For checking visibility of custom nodes for a role.
std::vector<std::pair<std::string, int>> m_libraryRoleCounts;

SPlayerVideoStreamInfo m_videoInfo;
SPlayerAudioStreamInfo m_audioInfo;
VideoStreamInfo m_videoInfo;
AudioStreamInfo m_audioInfo;

CCriticalSection m_critInfo;

Expand Down
8 changes: 4 additions & 4 deletions xbmc/Util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2124,17 +2124,17 @@ ExternalStreamInfo CUtil::GetExternalStreamDetailsFromFilename(const std::string
StringUtils::ToLower(flag_tmp);
if (!flag_tmp.compare("none"))
{
info.flag |= CDemuxStream::FLAG_NONE;
info.flag |= StreamFlags::FLAG_NONE;
continue;
}
else if (!flag_tmp.compare("default"))
{
info.flag |= CDemuxStream::FLAG_DEFAULT;
info.flag |= StreamFlags::FLAG_DEFAULT;
continue;
}
else if (!flag_tmp.compare("forced"))
{
info.flag |= CDemuxStream::FLAG_FORCED;
info.flag |= StreamFlags::FLAG_FORCED;
continue;
}

Expand All @@ -2146,7 +2146,7 @@ ExternalStreamInfo CUtil::GetExternalStreamDetailsFromFilename(const std::string
StringUtils::Trim(name);
info.name = StringUtils::RemoveDuplicatedSpacesAndTabs(name);
if (info.flag == 0)
info.flag = CDemuxStream::FLAG_NONE;
info.flag = StreamFlags::FLAG_NONE;

CLog::Log(LOGDEBUG, "%s - Language = '%s' / Name = '%s' / Flag = '%u' from %s",
__FUNCTION__, info.language.c_str(), info.name.c_str(), info.flag, CURL::GetRedacted(associatedFile).c_str());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ bool CActiveAEDSPProcess::Create(const AEAudioFormat &inputFormat, const AEAudio
if (identifier < 0)
identifier = 0;

SPlayerAudioStreamInfo info;
AudioStreamInfo info;
g_application.m_pPlayer->GetAudioStreamInfo(identifier, info);

m_addonStreamProperties.strName = info.name.c_str();
Expand Down
58 changes: 4 additions & 54 deletions xbmc/cores/IPlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "VideoSettings.h"
#include "guilib/Geometry.h"
#include "guilib/Resolution.h"
#include "Interface/StreamInfo.h"

#define CURRENT_STREAM -1
#define CAPTUREFLAG_CONTINUOUS 0x01 //after a render is done, render a new one immediately
Expand Down Expand Up @@ -76,57 +77,6 @@ enum IPlayerSubtitleCapabilities
IPC_SUBS_OFFSET
};

struct SPlayerAudioStreamInfo
{
bool valid;
int bitrate;
int channels;
int samplerate;
int bitspersample;
std::string language;
std::string name;
std::string audioCodecName;

SPlayerAudioStreamInfo()
{
valid = false;
bitrate = 0;
channels = 0;
samplerate = 0;
bitspersample = 0;
}
};

struct SPlayerSubtitleStreamInfo
{
std::string language;
std::string name;
};

struct SPlayerVideoStreamInfo
{
bool valid;
int bitrate;
float videoAspectRatio;
int height;
int width;
std::string language;
std::string name;
std::string videoCodecName;
CRect SrcRect;
CRect DestRect;
std::string stereoMode;

SPlayerVideoStreamInfo() : SrcRect {}, DestRect {}
{
valid = false;
bitrate = 0;
videoAspectRatio = 1.0f;
height = 0;
width = 0;
}
};

enum ERENDERFEATURE
{
RENDERFEATURE_GAMMA,
Expand Down Expand Up @@ -180,7 +130,7 @@ class IPlayer
virtual float GetSubTitleDelay() { return 0.0f; }
virtual int GetSubtitleCount() { return 0; }
virtual int GetSubtitle() { return -1; }
virtual void GetSubtitleStreamInfo(int index, SPlayerSubtitleStreamInfo &info){};
virtual void GetSubtitleStreamInfo(int index, SubtitleStreamInfo &info){};
virtual void SetSubtitle(int iStream){};
virtual bool GetSubtitleVisible(){ return false;};
virtual void SetSubtitleVisible(bool bVisible){};
Expand All @@ -194,11 +144,11 @@ class IPlayer
virtual int GetAudioStreamCount() { return 0; }
virtual int GetAudioStream() { return -1; }
virtual void SetAudioStream(int iStream){};
virtual void GetAudioStreamInfo(int index, SPlayerAudioStreamInfo &info){};
virtual void GetAudioStreamInfo(int index, AudioStreamInfo &info){};

virtual int GetVideoStream() const { return -1; }
virtual int GetVideoStreamCount() const { return 0; }
virtual void GetVideoStreamInfo(int streamId, SPlayerVideoStreamInfo &info) {}
virtual void GetVideoStreamInfo(int streamId, VideoStreamInfo &info) {}
virtual void SetVideoStream(int iStream) {}

virtual TextCacheStruct_t* GetTeletextCache() { return NULL; };
Expand Down
6 changes: 3 additions & 3 deletions xbmc/cores/RetroPlayer/RetroPlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,18 @@ namespace RETRO
//virtual float GetSubTitleDelay() override { return 0.0f; }
//virtual int GetSubtitleCount() override { return 0; }
//virtual int GetSubtitle() override { return -1; }
//virtual void GetSubtitleStreamInfo(int index, SPlayerSubtitleStreamInfo &info) override { }
//virtual void GetSubtitleStreamInfo(int index, SubtitleStreamInfo &info) override { }
//virtual void SetSubtitle(int iStream) override { }
//virtual bool GetSubtitleVisible() override { return false; }
//virtual void SetSubtitleVisible(bool bVisible) override { }
//virtual void AddSubtitle(const std::string& strSubPath) override { }
//virtual int GetAudioStreamCount() override { return 0; }
//virtual int GetAudioStream() override { return -1; }
//virtual void SetAudioStream(int iStream) override { }
//virtual void GetAudioStreamInfo(int index, SPlayerAudioStreamInfo &info) override { }
//virtual void GetAudioStreamInfo(int index, AudioStreamInfo &info) override { }
//virtual int GetVideoStream() const override { return -1; }
//virtual int GetVideoStreamCount() const override { return 0; }
//virtual void GetVideoStreamInfo(int streamId, SPlayerVideoStreamInfo &info) override { }
//virtual void GetVideoStreamInfo(int streamId, VideoStreamInfo &info) override { }
//virtual void SetVideoStream(int iStream) override { }
//virtual TextCacheStruct_t* GetTeletextCache() override { return NULL; }
//virtual void LoadPage(int p, int sp, unsigned char* buffer) override { }
Expand Down
1 change: 1 addition & 0 deletions xbmc/cores/VideoPlayer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ set(HEADERS AudioSinkAE.h
VideoPlayerTeletext.h
VideoPlayerVideo.h
VideoReferenceClock.h
Interface/StreamInfo.h
Interface/Addon/DemuxPacket.h
Interface/Addon/DemuxCrypto.h
Interface/Addon/TimingConstants.h)
Expand Down
17 changes: 3 additions & 14 deletions xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemux.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <vector>
#include <memory>
#include "system.h"
#include "Interface/StreamInfo.h"

struct DemuxPacket;
struct DemuxCryptoSession;
Expand Down Expand Up @@ -94,7 +95,7 @@ class CDemuxStream
memset(language, 0, sizeof(language));
disabled = false;
changes = 0;
flags = FLAG_NONE;
flags = StreamFlags::FLAG_NONE;
realtime = false;
}

Expand All @@ -121,26 +122,14 @@ class CDemuxStream
uint8_t* ExtraData; // extra data for codec to use
unsigned int ExtraSize; // size of extra data

StreamFlags flags;
char language[4]; // ISO 639 3-letter language code (empty string if undefined)
bool disabled; // set when stream is disabled. (when no decoder exists)

std::string codecName;

int changes; // increment on change which player may need to know about

enum EFlags
{ FLAG_NONE = 0x0000
, FLAG_DEFAULT = 0x0001
, FLAG_DUB = 0x0002
, FLAG_ORIGINAL = 0x0004
, FLAG_COMMENT = 0x0008
, FLAG_LYRICS = 0x0010
, FLAG_KARAOKE = 0x0020
, FLAG_FORCED = 0x0040
, FLAG_HEARING_IMPAIRED = 0x0080
, FLAG_VISUAL_IMPAIRED = 0x0100
} flags;

std::shared_ptr<DemuxCryptoSession> cryptoSession;
std::shared_ptr<ADDON::IAddonProvider> externalInterfaces;
};
Expand Down
2 changes: 1 addition & 1 deletion xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1553,7 +1553,7 @@ CDemuxStream* CDVDDemuxFFmpeg::AddStream(int streamIdx)

stream->source = STREAM_SOURCE_DEMUX;
stream->pPrivate = pStream;
stream->flags = (CDemuxStream::EFlags)pStream->disposition;
stream->flags = (StreamFlags)pStream->disposition;

AVDictionaryEntry *langTag = av_dict_get(pStream->metadata, "language", NULL, 0);
if (!langTag)
Expand Down
4 changes: 2 additions & 2 deletions xbmc/cores/VideoPlayer/DVDDemuxers/DemuxMultiSource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,9 @@ void CDemuxMultiSource::SetMissingStreamDetails(DemuxPtr demuxer)
{
ExternalStreamInfo info = CUtil::GetExternalStreamDetailsFromFilename(baseFileName, fileName);

if (stream->flags == CDemuxStream::FLAG_NONE)
if (stream->flags == StreamFlags::FLAG_NONE)
{
stream->flags = static_cast<CDemuxStream::EFlags>(info.flag);
stream->flags = static_cast<StreamFlags>(info.flag);
}
if (stream->language[0] == '\0')
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ struct DVDNavAudioStreamInfo : DVDNavStreamInfo

struct DVDNavSubtitleStreamInfo : DVDNavStreamInfo
{
CDemuxStream::EFlags flags;
StreamFlags flags;

DVDNavSubtitleStreamInfo() : DVDNavStreamInfo(),
flags(CDemuxStream::EFlags::FLAG_NONE) {}
flags(StreamFlags::FLAG_NONE) {}
};

struct DVDNavVideoStreamInfo : DVDNavStreamInfo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ CDemuxStream* CInputStreamAddon::GetStream(int streamId) const
{
demuxStream->ExtraData = new uint8_t[stream.m_ExtraSize];
demuxStream->ExtraSize = stream.m_ExtraSize;
demuxStream->flags = static_cast<CDemuxStream::EFlags>(stream.m_flags);
demuxStream->flags = static_cast<StreamFlags>(stream.m_flags);
for (unsigned int j = 0; j < stream.m_ExtraSize; ++j)
demuxStream->ExtraData[j] = stream.m_ExtraData[j];
}
Expand Down
4 changes: 0 additions & 4 deletions xbmc/cores/VideoPlayer/IVideoPlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@
#define VideoPlayer_TELETEXT 4
#define VideoPlayer_RDS 5


template <typename T> class CRectGen;
typedef CRectGen<float> CRect;

class CDVDMsg;
class CDVDStreamInfo;
class CProcessInfo;
Expand Down
Loading

0 comments on commit 992063a

Please sign in to comment.