RDK Documentation (Open Sourced RDK Components)
AampcliVirtualChannelMap.h
1 /*
2  * If not stated otherwise in this file or this component's license file the
3  * following copyright and licenses apply:
4  *
5  * Copyright 2022 RDK Management
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 
20 /**
21  * @file AampcliVirtualChannel.h
22  * @brief AampcliVirtualChannel header file.
23  */
24 
25 #ifndef AAMPCLIVIRTUALCHANNELMAP_H
26 #define AAMPCLIVIRTUALCHANNELMAP_H
27 
28 #include <stdlib.h>
29 #include <sstream>
30 #include <priv_aamp.h>
31 
32 #define VIRTUAL_CHANNEL_VALID(x) ((x) > 0)
33 #define MAX_BUFFER_LENGTH 4096
34 
35 /**
36  * @struct VirtualChannelInfo
37  * @brief Holds information of a virtual channel
38  */
40 {
41  VirtualChannelInfo() : channelNumber(0), name(), uri()
42  {
43  }
44 
45  int channelNumber;
46  std::string name;
47  std::string uri;
48 };
49 
50 /**
51  * @class VirtualChannelMap
52  * @brief Holds all of the virtual channels
53  */
55 {
56  public:
57  VirtualChannelMap() : mVirtualChannelMap(),mCurrentlyTunedChannel(0),mAutoChannelNumber(0) {}
59  {
60  mVirtualChannelMap.clear();
61  }
62 
63  VirtualChannelInfo* find(const int channelNumber);
64  VirtualChannelInfo* prev();
65  VirtualChannelInfo* next();
66  void add(VirtualChannelInfo& channelInfo);
67  bool isPresent(const VirtualChannelInfo& channelInfo);
68  void print();
69  void setCurrentlyTunedChannel(int value);
70  void showList(void);
71  void tuneToChannel( VirtualChannelInfo &channel, PlayerInstanceAAMP *playerInstanceAamp);
72  std::string getNextFieldFromCSV( const char **pptr );
73  void loadVirtualChannelMapFromCSV( FILE *f );
74  void loadVirtualChannelMapLegacyFormat( FILE *f );
75  const char *skipwhitespace( const char *ptr );
76 
77  protected:
78  std::list<VirtualChannelInfo> mVirtualChannelMap;
79  int mAutoChannelNumber;
80  int mCurrentlyTunedChannel;
81 };
82 
83 #endif // AAMPCLIVIRTUALCHANNEL_H
VirtualChannelInfo
Holds information of a virtual channel.
Definition: AampcliVirtualChannelMap.h:39
VirtualChannelMap::loadVirtualChannelMapLegacyFormat
void loadVirtualChannelMapLegacyFormat(FILE *f)
Parse config entries for aamp-cli, and update mVirtualChannelMap based on the config.
Definition: AampcliVirtualChannelMap.cpp:307
PlayerInstanceAAMP
Player interface class for the JS pluggin.
Definition: main_aamp.h:692
VirtualChannelMap
Holds all of the virtual channels.
Definition: AampcliVirtualChannelMap.h:54
priv_aamp.h
Private functions and types used internally by AAMP.