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 #ifndef C_API_ADDONINSTANCE_PVR_STREAM_H
10 #define C_API_ADDONINSTANCE_PVR_STREAM_H
11 
12 #include "../inputstream/demux_packet.h"
13 #include "pvr_defines.h"
14 
15 #include <stdint.h>
16 #include <time.h>
17 
18 //¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
19 // "C" Definitions group 9 - PVR stream definitions (NOTE: Becomes replaced
20 // in future by inputstream addon instance way)
21 #ifdef __cplusplus
22 extern "C"
23 {
24 #endif /* __cplusplus */
25 
26   //============================================================================
27   /// @ingroup cpp_kodi_addon_pvr_Defs_Stream
28   /// @brief Maximum of allowed streams
29   ///
30   #define PVR_STREAM_MAX_STREAMS 20
31   //----------------------------------------------------------------------------
32 
33   //============================================================================
34   /// @ingroup cpp_kodi_addon_pvr_Defs_Stream
35   /// @brief Invalid codec identifier
36   ///
37   #define PVR_INVALID_CODEC_ID 0
38   //----------------------------------------------------------------------------
39 
40   //============================================================================
41   /// @ingroup cpp_kodi_addon_pvr_Defs_Stream
42   /// @brief Invalid codec
43   ///
44   #define PVR_INVALID_CODEC \
45     { \
46       PVR_CODEC_TYPE_UNKNOWN, PVR_INVALID_CODEC_ID \
47     }
48   //----------------------------------------------------------------------------
49 
50   //============================================================================
51   /// @defgroup cpp_kodi_addon_pvr_Defs_Stream_PVR_CODEC_TYPE enum PVR_CODEC_TYPE
52   /// @ingroup cpp_kodi_addon_pvr_Defs_Stream
53   /// @brief **Inputstream types**\n
54   /// To identify type on stream.
55   ///
56   /// Used on @ref kodi::addon::PVRStreamProperties::SetCodecType and @ref kodi::addon::PVRStreamProperties::SetCodecType.
57   ///
58   ///@{
59   typedef enum PVR_CODEC_TYPE
60   {
61     /// @brief To set nothing defined.
62     PVR_CODEC_TYPE_UNKNOWN = -1,
63 
64     /// @brief To identify @ref cpp_kodi_addon_pvr_Defs_Stream_PVRStreamProperties as Video.
65     PVR_CODEC_TYPE_VIDEO,
66 
67     /// @brief To identify @ref cpp_kodi_addon_pvr_Defs_Stream_PVRStreamProperties as Audio.
68     PVR_CODEC_TYPE_AUDIO,
69 
70     /// @brief To identify @ref cpp_kodi_addon_pvr_Defs_Stream_PVRStreamProperties as Data.
71     ///
72     /// With codec id related source identified.
73     PVR_CODEC_TYPE_DATA,
74 
75     /// @brief To identify @ref cpp_kodi_addon_pvr_Defs_Stream_PVRStreamProperties as Subtitle.
76     PVR_CODEC_TYPE_SUBTITLE,
77 
78     /// @brief To identify @ref cpp_kodi_addon_pvr_Defs_Stream_PVRStreamProperties as Radio RDS.
79     PVR_CODEC_TYPE_RDS,
80 
81     PVR_CODEC_TYPE_NB
82   } PVR_CODEC_TYPE;
83   ///@}
84   //----------------------------------------------------------------------------
85 
86   //============================================================================
87   /// @defgroup cpp_kodi_addon_pvr_Defs_Stream_PVR_CODEC struct PVR_CODEC
88   /// @ingroup cpp_kodi_addon_pvr_Defs_Stream
89   /// @brief **Codec identification structure**\n
90   /// Identifier about stream between Kodi and addon.
91   ///
92   ///@{
93   typedef struct PVR_CODEC
94   {
95     /// @brief Used codec type for stream.
96     enum PVR_CODEC_TYPE codec_type;
97 
98     /// @brief Related codec identifier, normally match the ffmpeg id's.
99     unsigned int codec_id;
100   } PVR_CODEC;
101   ///@}
102   //----------------------------------------------------------------------------
103 
104   /*!
105    * @brief "C" Stream properties
106    *
107    * Structure used to interface in "C" between Kodi and Addon.
108    *
109    * See @ref cpp_kodi_addon_pvr_Defs_Stream_PVRStreamProperties for description of values.
110    */
111   typedef struct PVR_STREAM_PROPERTIES
112   {
113     unsigned int iStreamCount;
114     struct PVR_STREAM
115     {
116       unsigned int iPID;
117       enum PVR_CODEC_TYPE iCodecType;
118       unsigned int iCodecId;
119       char strLanguage[4];
120       int iSubtitleInfo;
121       int iFPSScale;
122       int iFPSRate;
123       int iHeight;
124       int iWidth;
125       float fAspect;
126       int iChannels;
127       int iSampleRate;
128       int iBlockAlign;
129       int iBitRate;
130       int iBitsPerSample;
131     } stream[PVR_STREAM_MAX_STREAMS];
132   } PVR_STREAM_PROPERTIES;
133 
134   /*!
135    * @brief "C" Times of playing stream (Live TV and recordings)
136    *
137    * Structure used to interface in "C" between Kodi and Addon.
138    *
139    * See @ref cpp_kodi_addon_pvr_Defs_Stream_PVRStreamTimes for description of values.
140    */
141   typedef struct PVR_STREAM_TIMES
142   {
143     time_t startTime;
144     int64_t ptsStart;
145     int64_t ptsBegin;
146     int64_t ptsEnd;
147   } PVR_STREAM_TIMES;
148 
149 #ifdef __cplusplus
150 }
151 #endif /* __cplusplus */
152 
153 #endif /* !C_API_ADDONINSTANCE_PVR_STREAM_H */
154