summaryrefslogtreecommitdiffstats
path: root/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxPVRClient.h
blob: 2fc3c6309cdac7c4374aaab53ca5269956259cc9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#pragma once
/*
 *      Copyright (C) 2012-2013 Team XBMC
 *      http://xbmc.org
 *
 *  This Program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2, or (at your option)
 *  any later version.
 *
 *  This Program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with XBMC; see the file COPYING.  If not, see
 *  <http://www.gnu.org/licenses/>.
 *
 */

#include "DVDDemux.h"
#include <map>
#include "pvr/addons/PVRClient.h"

extern "C" {
#include "libavcodec/avcodec.h"
#include "libavformat/avformat.h"
}

class CDVDDemuxPVRClient;
struct PVR_STREAM_PROPERTIES;

class CDemuxStreamPVRInternal
{
public:
  CDemuxStreamPVRInternal(CDVDDemuxPVRClient *parent);
  ~CDemuxStreamPVRInternal();

  void DisposeParser();

  CDVDDemuxPVRClient  * m_parent;
  AVCodecParserContext* m_parser;
  AVCodecContext      * m_context;
  bool                  m_parser_split;
};

class CDemuxStreamVideoPVRClient
  : public CDemuxStreamVideo
  , public CDemuxStreamPVRInternal
{
public:
  CDemuxStreamVideoPVRClient(CDVDDemuxPVRClient *parent)
    : CDemuxStreamPVRInternal(parent)
  {}
  virtual void GetStreamInfo(std::string& strInfo);
};

class CDemuxStreamAudioPVRClient
  : public CDemuxStreamAudio
  , public CDemuxStreamPVRInternal
{
public:
  CDemuxStreamAudioPVRClient(CDVDDemuxPVRClient *parent)
    : CDemuxStreamPVRInternal(parent)
  {}
  virtual void GetStreamInfo(std::string& strInfo);
};

class CDemuxStreamSubtitlePVRClient
  : public CDemuxStreamSubtitle
  , public CDemuxStreamPVRInternal
{
public:
  CDemuxStreamSubtitlePVRClient(CDVDDemuxPVRClient *parent)
    : CDemuxStreamPVRInternal(parent)
  {}
  virtual void GetStreamInfo(std::string& strInfo);
};


class CDVDDemuxPVRClient : public CDVDDemux
{
  friend class CDemuxStreamPVRInternal;

public:

  CDVDDemuxPVRClient();
  ~CDVDDemuxPVRClient();

  bool Open(CDVDInputStream* pInput);
  void Dispose();
  void Reset();
  void Abort();
  void Flush();
  DemuxPacket* Read();
  bool SeekTime(int time, bool backwords = false, double* startpts = NULL);
  void SetSpeed(int iSpeed);
  int GetStreamLength() { return 0; }
  CDemuxStream* GetStream(int iStreamId);
  int GetNrOfStreams();
  std::string GetFileName();
  virtual void GetStreamCodecName(int iStreamId, std::string &strName);

protected:
  CDVDInputStream* m_pInput;
#ifndef MAX_STREAMS
  #define MAX_STREAMS 100
#endif
  CDemuxStream* m_streams[MAX_STREAMS]; // maximum number of streams that ffmpeg can handle
  std::shared_ptr<PVR::CPVRClient> m_pvrClient;

private:
  void RequestStreams();
  void ParsePacket(DemuxPacket* pPacket);
  void DisposeStream(int iStreamId);
};