xbmc
VideoPlayerAudioID3.h
1 /*
2  * Copyright (C) 2005-2022 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 "Interface/TimingConstants.h"
14 #include "threads/CriticalSection.h"
15 #include "threads/Thread.h"
16 
17 #include <memory>
18 #include <string>
19 #include <vector>
20 
21 #include <taglib/id3v1tag.h>
22 #include <taglib/id3v2tag.h>
23 #include <taglib/tstringlist.h>
24 
26 {
27 public:
28  explicit CVideoPlayerAudioID3(CProcessInfo& processInfo);
29  ~CVideoPlayerAudioID3() override;
30 
31  bool CheckStream(const CDVDStreamInfo& hints);
32  void Flush();
33  void WaitForBuffers();
34 
35  bool OpenStream(CDVDStreamInfo hints) override;
36  void CloseStream(bool bWaitForBuffers) override;
37  void SendMessage(std::shared_ptr<CDVDMsg> pMsg, int priority = 0) override;
38  void FlushMessages() override;
39  bool IsInited() const override;
40  bool AcceptsData() const override;
41  bool IsStalled() const override;
42 
43 protected:
44  void OnExit() override;
45  void Process() override;
46 
47 private:
48  void ProcessID3(const unsigned char* data, unsigned int length) const;
49  void ProcessID3v1(const TagLib::ID3v1::Tag* tag) const;
50  void ProcessID3v2(const TagLib::ID3v2::Tag* tag) const;
51 
52  static std::vector<std::string> GetID3v2StringList(const TagLib::ID3v2::FrameList& frameList);
53  static std::vector<std::string> StringListToVectorString(const TagLib::StringList& stringList);
54 
55  int m_speed = DVD_PLAYSPEED_NORMAL;
56  CCriticalSection m_critSection;
57  CDVDMessageQueue m_messageQueue;
58 };
Definition: DVDStreamInfo.h:23
Definition: IVideoPlayer.h:36
Definition: Thread.h:44
Definition: DVDMessageQueue.h:48
Definition: VideoPlayerAudioID3.h:25
Definition: ProcessInfo.h:26