xbmc
VideoPlayerTeletext.h
1 /*
2  * Copyright (C) 2005-2018 Team Kodi
3  * This file is part of Kodi - https://kodi.tv
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  * See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
11 #include "DVDMessageQueue.h"
12 #include "IVideoPlayer.h"
13 #include "threads/Thread.h"
14 #include "video/TeletextDefines.h"
15 
16 class CDVDStreamInfo;
17 
19 {
20 public:
21  explicit CDVDTeletextData(CProcessInfo &processInfo);
22  ~CDVDTeletextData() override;
23 
24  bool CheckStream(CDVDStreamInfo &hints);
25  bool OpenStream(CDVDStreamInfo hints) override;
26  void CloseStream(bool bWaitForBuffers) override;
27  void Flush();
28 
29  // waits until all available data has been rendered
30  void WaitForBuffers() { m_messageQueue.WaitUntilEmpty(); }
31  bool AcceptsData() const override { return !m_messageQueue.IsFull(); }
32  void SendMessage(std::shared_ptr<CDVDMsg> pMsg, int priority = 0) override
33  {
34  if (m_messageQueue.IsInited())
35  m_messageQueue.Put(pMsg, priority);
36  }
37  void FlushMessages() override { m_messageQueue.Flush(); }
38  bool IsInited() const override { return true; }
39  bool IsStalled() const override { return true; }
40 
41  std::shared_ptr<TextCacheStruct_t> GetTeletextCache() { return m_TXTCache; }
42  void LoadPage(int p, int sp, unsigned char* buffer);
43 
44 protected:
45  void OnExit() override;
46  void Process() override;
47 
48 private:
49  void ResetTeletextCache();
50  void Decode_p2829(unsigned char *vtxt_row, TextExtData_t **ptExtData);
51  void SavePage(int p, int sp, unsigned char* buffer);
52  void ErasePage(int magazine);
53  void AllocateCache(int magazine);
54 
55  int m_speed;
56  std::shared_ptr<TextCacheStruct_t> m_TXTCache = std::make_shared<TextCacheStruct_t>();
57  CDVDMessageQueue m_messageQueue;
58 };
59 
Definition: DVDStreamInfo.h:25
Definition: IVideoPlayer.h:36
Definition: Thread.h:44
void Process() override
Definition: VideoPlayerTeletext.cpp:219
Definition: DVDMessageQueue.h:48
Definition: TeletextDefines.h:341
Definition: VideoPlayerTeletext.h:18
Definition: ProcessInfo.h:26