Skip to content

Commit

Permalink
Merge pull request #14155 from ace20022/teletext
Browse files Browse the repository at this point in the history
[videplayer][pvr] Fix a crash when stopping playback while teletext is opened.
  • Loading branch information
ace20022 committed Jul 6, 2018
2 parents e2c1e49 + 714b808 commit 04ceaea
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion xbmc/ApplicationPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ bool CApplicationPlayer::CanPause()
return (player && player->CanPause());
}

TextCacheStruct_t* CApplicationPlayer::GetTeletextCache()
std::shared_ptr<TextCacheStruct_t> CApplicationPlayer::GetTeletextCache()
{
std::shared_ptr<IPlayer> player = GetInternal();
if (player)
Expand Down
2 changes: 1 addition & 1 deletion xbmc/ApplicationPlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class CApplicationPlayer
int GetSubtitleCount();
void GetSubtitleStreamInfo(int index, SubtitleStreamInfo &info);
bool GetSubtitleVisible();
TextCacheStruct_t* GetTeletextCache();
std::shared_ptr<TextCacheStruct_t> GetTeletextCache();
std::string GetRadioText(unsigned int line);
int64_t GetTime() const;
int64_t GetMinTime() const;
Expand Down
3 changes: 2 additions & 1 deletion xbmc/cores/IPlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

#include <vector>
#include <string>
#include <memory>

#include "IPlayerCallback.h"
#include "VideoSettings.h"
Expand Down Expand Up @@ -152,7 +153,7 @@ class IPlayer
virtual void SetProgram(int progId) {}
virtual int GetProgramsCount() { return 0; }

virtual TextCacheStruct_t* GetTeletextCache() { return NULL; };
virtual std::shared_ptr<TextCacheStruct_t> GetTeletextCache() { return NULL; };
virtual void LoadPage(int p, int sp, unsigned char* buffer) {};

virtual std::string GetRadioText(unsigned int line) { return ""; };
Expand Down
2 changes: 1 addition & 1 deletion xbmc/cores/VideoPlayer/VideoPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3379,7 +3379,7 @@ void CVideoPlayer::SetSubtitleVisibleInternal(bool bVisible)
std::static_pointer_cast<CDVDInputStreamNavigator>(m_pInputStream)->EnableSubtitleStream(bVisible);
}

TextCacheStruct_t* CVideoPlayer::GetTeletextCache()
std::shared_ptr<TextCacheStruct_t> CVideoPlayer::GetTeletextCache()
{
if (m_CurrentTeletext.id < 0)
return 0;
Expand Down
2 changes: 1 addition & 1 deletion xbmc/cores/VideoPlayer/VideoPlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ class CVideoPlayer : public IPlayer, public CThread, public IVideoPlayer,
void SetProgram(int progId) override;
int GetProgramsCount() override;

TextCacheStruct_t* GetTeletextCache() override;
std::shared_ptr<TextCacheStruct_t> GetTeletextCache() override;
void LoadPage(int p, int sp, unsigned char* buffer) override;

std::string GetRadioText(unsigned int line) override;
Expand Down
2 changes: 1 addition & 1 deletion xbmc/cores/VideoPlayer/VideoPlayerTeletext.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class CDVDTeletextData : public CThread, public IDVDStreamPlayer
bool IsInited() const override { return true; }
bool IsStalled() const override { return true; }

TextCacheStruct_t* GetTeletextCache() { return &m_TXTCache; }
std::shared_ptr<TextCacheStruct_t> GetTeletextCache() { return std::make_shared<TextCacheStruct_t>(m_TXTCache); }
void LoadPage(int p, int sp, unsigned char* buffer);

protected:
Expand Down
2 changes: 1 addition & 1 deletion xbmc/video/Teletext.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,6 @@ class CTeletextDecoder

int m_TempPage; /* Temporary page number for number input */
int m_LastPage; /* Last selected Page */
TextCacheStruct_t* m_txtCache; /* Text cache generated by the VideoPlayer if Teletext present */
std::shared_ptr<TextCacheStruct_t> m_txtCache; /* Text cache generated by the VideoPlayer if Teletext present */
TextRenderInfo_t m_RenderInfo; /* Rendering information of displayed Teletext page */
};

0 comments on commit 04ceaea

Please sign in to comment.