Skip to content

Commit

Permalink
codecoverlay: Include codec name in overlay
Browse files Browse the repository at this point in the history
  • Loading branch information
popcornmix committed May 23, 2016
1 parent 9d89217 commit 4e82f75
Show file tree
Hide file tree
Showing 12 changed files with 42 additions and 6 deletions.
Expand Up @@ -125,7 +125,7 @@ bool CDVDAudioCodecFFmpeg::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options

m_iSampleFormat = AV_SAMPLE_FMT_NONE;
m_matrixEncoding = AV_MATRIX_ENCODING_NONE;

m_codecname = m_pCodecContext->codec->name;
return true;
}

Expand Down
3 changes: 2 additions & 1 deletion xbmc/cores/VideoPlayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.h
Expand Up @@ -41,7 +41,7 @@ class CDVDAudioCodecFFmpeg : public CDVDAudioCodec
virtual int GetData(uint8_t** dst);
virtual void Reset();
virtual AEAudioFormat GetFormat() { return m_format; }
virtual const char* GetName() { return "FFmpeg"; }
virtual const char* GetName() { return m_codecname.c_str(); }
virtual enum AVMatrixEncoding GetMatrixEncoding();
virtual enum AVAudioServiceType GetAudioServiceType();
virtual int GetProfile();
Expand All @@ -64,6 +64,7 @@ class CDVDAudioCodecFFmpeg : public CDVDAudioCodec

int m_channels;
uint64_t m_layout;
std::string m_codecname;

void BuildChannelMap();
void ConvertToFloat();
Expand Down
6 changes: 5 additions & 1 deletion xbmc/cores/VideoPlayer/VideoPlayerAudio.cpp
Expand Up @@ -135,6 +135,8 @@ void CVideoPlayerAudio::OpenStream(CDVDStreamInfo &hints, CDVDAudioCodec* codec)
if (hints.samplerate != m_streaminfo.samplerate)
SwitchCodecIfNeeded();

m_codecname = m_pAudioCodec->GetName();

m_audioClock = 0;
m_stalled = m_messageQueue.GetPacketCount(CDVDMsg::DEMUXER_PACKET) == 0;

Expand Down Expand Up @@ -207,8 +209,9 @@ void CVideoPlayerAudio::UpdatePlayerInfo()
{
std::ostringstream s;
s << "aq:" << std::setw(2) << std::min(99,m_messageQueue.GetLevel()) << "%";
s << ", ac:" << m_codecname;
s << ", Kb/s:" << std::fixed << std::setprecision(2) << (double)GetAudioBitrate() / 1024.0;

s << ", " << m_streaminfo.channels << " channel, " << m_streaminfo.samplerate/1000 << " kHz";
//print the inverse of the resample ratio, since that makes more sense
//if the resample ratio is 0.5, then we're playing twice as fast
#ifdef TARGET_RASPBERRY_PI
Expand Down Expand Up @@ -595,6 +598,7 @@ bool CVideoPlayerAudio::SwitchCodecIfNeeded()

delete m_pAudioCodec;
m_pAudioCodec = codec;
m_codecname = m_pAudioCodec->GetName();

return true;
}
Expand Down
1 change: 1 addition & 0 deletions xbmc/cores/VideoPlayer/VideoPlayerAudio.h
Expand Up @@ -95,6 +95,7 @@ class CVideoPlayerAudio : public CThread, public IDVDStreamPlayerAudio
CDVDClock* m_pClock; // dvd master clock
CDVDAudioCodec* m_pAudioCodec; // audio codec
BitstreamStats m_audioStats;
std::string m_codecname;

int m_speed;
bool m_stalled;
Expand Down
12 changes: 11 additions & 1 deletion xbmc/cores/VideoPlayer/VideoPlayerVideo.cpp
Expand Up @@ -95,6 +95,9 @@ CVideoPlayerVideo::CVideoPlayerVideo(CDVDClock* pClock
m_iFrameRateLength = 0;
m_bFpsInvalid = false;
m_bAllowFullscreen = false;
m_width = 0;
m_height = 0;
m_display_aspect = 0.0f;
}

CVideoPlayerVideo::~CVideoPlayerVideo()
Expand Down Expand Up @@ -186,6 +189,7 @@ void CVideoPlayerVideo::OpenStream(CDVDStreamInfo &hint, CDVDVideoCodec* codec)
m_pVideoCodec = codec;
m_hints = hint;
m_stalled = m_messageQueue.GetPacketCount(CDVDMsg::DEMUXER_PACKET) == 0;
m_codecname = m_pVideoCodec->GetName();
m_packets.clear();
m_syncState = IDVDStreamPlayer::SYNC_STARTING;
}
Expand Down Expand Up @@ -601,6 +605,7 @@ bool CVideoPlayerVideo::ProcessDecoderOutput(int &decoderState, double &frametim

if (m_syncState == IDVDStreamPlayer::SYNC_STARTING && !(m_picture.iFlags & DVP_FLAG_DROPPED))
{
m_codecname = m_pVideoCodec->GetName();
m_syncState = IDVDStreamPlayer::SYNC_WAITSYNC;
SStartMsg msg;
msg.player = VideoPlayer_VIDEO;
Expand Down Expand Up @@ -883,6 +888,9 @@ int CVideoPlayerVideo::OutputPicture(const DVDVideoPicture* src, double pts)
m_droppingStats.AddOutputDropGain(pts, 1);
return EOS_DROPPED;
}
m_width = pPicture->iWidth;
m_height = pPicture->iHeight;
m_display_aspect = (float)pPicture->iDisplayWidth / (float)pPicture->iDisplayHeight;

m_renderManager.FlipPage(m_bAbortOutput, pts, -1, mDisplayField);

Expand All @@ -893,8 +901,10 @@ std::string CVideoPlayerVideo::GetPlayerInfo()
{
std::ostringstream s;
s << "vq:" << std::setw(2) << std::min(99,GetLevel()) << "%";
s << ", dc:" << m_codecname;
s << ", Mb/s:" << std::fixed << std::setprecision(2) << (double)GetVideoBitrate() / (1024.0*1024.0);
s << ", fr:" << std::fixed << std::setprecision(3) << m_fFrameRate;
s << ", " << m_width << "x" << m_height;
s << ", fr:" << std::fixed << std::setprecision(3) << m_fFrameRate << ", ar:" << std::setprecision(2) << m_display_aspect;
s << ", drop:" << m_iDroppedFrames;
s << ", skip:" << m_renderManager.GetSkippedFrames();

Expand Down
4 changes: 4 additions & 0 deletions xbmc/cores/VideoPlayer/VideoPlayerVideo.h
Expand Up @@ -131,6 +131,10 @@ class CVideoPlayerVideo : public CThread, public IDVDStreamPlayerVideo
int m_speed;
bool m_stalled;
IDVDStreamPlayer::ESyncState m_syncState;
std::string m_codecname;
int m_width;
int m_height;
float m_display_aspect;
std::atomic_bool m_bAbortOutput;

BitstreamStats m_videoStats;
Expand Down
1 change: 1 addition & 0 deletions xbmc/cores/omxplayer/OMXAudioCodecOMX.cpp
Expand Up @@ -134,6 +134,7 @@ bool COMXAudioCodecOMX::Open(CDVDStreamInfo &hints)

m_iSampleFormat = AV_SAMPLE_FMT_NONE;
m_desiredSampleFormat = m_pCodecContext->sample_fmt == AV_SAMPLE_FMT_S16 ? AV_SAMPLE_FMT_S16 : AV_SAMPLE_FMT_FLTP;
m_codecname = m_pCodecContext->codec->name;
return true;
}

Expand Down
3 changes: 2 additions & 1 deletion xbmc/cores/omxplayer/OMXAudioCodecOMX.h
Expand Up @@ -47,7 +47,7 @@ class COMXAudioCodecOMX
CAEChannelInfo GetChannelMap();
int GetSampleRate();
int GetBitsPerSample();
static const char* GetName() { return "FFmpeg"; }
const char* GetName() { return m_codecname.c_str(); }
int GetBitRate();
unsigned int GetFrameSize() { return m_frameSize; }

Expand All @@ -70,4 +70,5 @@ class COMXAudioCodecOMX
bool m_bNoConcatenate;
unsigned int m_frameSize;
double m_dts, m_pts;
std::string m_codecname;
};
4 changes: 3 additions & 1 deletion xbmc/cores/omxplayer/OMXPlayerAudio.cpp
Expand Up @@ -141,6 +141,7 @@ void OMXPlayerAudio::OpenStream(CDVDStreamInfo &hints, COMXAudioCodecOMX *codec)
m_format = GetDataFormat(m_hints);
m_format.m_sampleRate = 0;
m_format.m_channelLayout = 0;
m_codecname = m_pAudioCodec->GetName();

g_dataCacheCore.SignalAudioInfoChange();
}
Expand Down Expand Up @@ -638,7 +639,8 @@ std::string OMXPlayerAudio::GetPlayerInfo()
{
std::ostringstream s;
s << "aq:" << std::setw(2) << std::min(99,m_messageQueue.GetLevel() + MathUtils::round_int(100.0/8.0*GetCacheTime())) << "%";
s << ", ac:" << m_codecname;
s << ", Kb/s:" << std::fixed << std::setprecision(2) << (double)GetAudioBitrate() / 1024.0;

s << ", " << m_hints.channels << " channel, " << m_hints.samplerate/1000 << " kHz";
return s.str();
}
1 change: 1 addition & 0 deletions xbmc/cores/omxplayer/OMXPlayerAudio.h
Expand Up @@ -63,6 +63,7 @@ class OMXPlayerAudio : public CThread, public IDVDStreamPlayerAudio
bool m_DecoderOpen;

bool m_bad_state;
std::string m_codecname;

virtual void OnStartup();
virtual void OnExit();
Expand Down
8 changes: 8 additions & 0 deletions xbmc/cores/omxplayer/OMXPlayerVideo.cpp
Expand Up @@ -106,6 +106,9 @@ OMXPlayerVideo::OMXPlayerVideo(OMXClock *av_clock,
m_iCurrentPts = DVD_NOPTS_VALUE;
m_nextOverlay = DVD_NOPTS_VALUE;
m_flush = false;
m_width = 0;
m_height = 0;
m_display_aspect = 0.0f;
}

OMXPlayerVideo::~OMXPlayerVideo()
Expand Down Expand Up @@ -587,6 +590,8 @@ std::string OMXPlayerVideo::GetPlayerInfo()
s << ", vq:" << std::setw(2) << std::min(99,GetLevel()) << "%";
s << ", dc:" << m_codecname;
s << ", Mb/s:" << std::fixed << std::setprecision(2) << (double)GetVideoBitrate() / (1024.0*1024.0);
s << ", " << m_width << "x" << m_height;
s << ", fr:" << std::fixed << std::setprecision(3) << m_fFrameRate << ", ar:" << std::setprecision(2) << m_display_aspect;
if (m_omxVideo.GetPlayerInfo(match, phase, pll))
{
s << ", match:" << std::fixed << std::setprecision(2) << match;
Expand Down Expand Up @@ -706,6 +711,9 @@ void OMXPlayerVideo::ResolutionUpdateCallBack(uint32_t width, uint32_t height, f
m_bAllowFullscreen = false; // only allow on first configure
}

m_width = width;
m_height = height;
m_display_aspect = display_aspect;
unsigned int iDisplayWidth = width;
unsigned int iDisplayHeight = height;

Expand Down
3 changes: 3 additions & 0 deletions xbmc/cores/omxplayer/OMXPlayerVideo.h
Expand Up @@ -56,6 +56,9 @@ class OMXPlayerVideo : public CThread, public IDVDStreamPlayerVideo
IDVDStreamPlayer::ESyncState m_syncState;
bool m_flush;
std::string m_codecname;
int m_width;
int m_height;
float m_display_aspect;
std::atomic_bool m_bAbortOutput;
double m_iSubtitleDelay;
bool m_bRenderSubs;
Expand Down

0 comments on commit 4e82f75

Please sign in to comment.