Switch to unified view

a/libupnpp/control/avtransport.hxx b/libupnpp/control/avtransport.hxx
...
...
16
 */
16
 */
17
#ifndef _AVTRANSPORT_HXX_INCLUDED_
17
#ifndef _AVTRANSPORT_HXX_INCLUDED_
18
#define _AVTRANSPORT_HXX_INCLUDED_
18
#define _AVTRANSPORT_HXX_INCLUDED_
19
19
20
#include <string>
20
#include <string>
21
#include <memory>
21
22
22
#include "service.hxx"
23
#include "service.hxx"
23
24
24
namespace UPnPClient {
25
namespace UPnPClient {
26
27
class AVTransport;
28
typedef std::shared_ptr<AVTransport> AVTH;
25
29
26
/**
30
/**
27
 * AVTransport Service client class.
31
 * AVTransport Service client class.
28
 *
32
 *
29
 */
33
 */
...
...
40
            registerCallback();
44
            registerCallback();
41
        }
45
        }
42
46
43
    AVTransport() {}
47
    AVTransport() {}
44
48
49
    enum TransportState {Unknown, Stopped, Playing, Transitioning, 
50
                         PausedPlayback, PausedRecording, Recording, 
51
                         NoMediaPresent};
52
    enum TransportStatus {TPS_Unknown, TPS_Ok, TPS_Error};
53
    enum PlayMode {PM_Unknown, PM_Normal, PM_Shuffle, PM_RepeatOne, 
54
                   PM_RepeatAll, PM_Random, PM_Direct1};
55
56
57
    int setAVTransportURI(const string& uri, const string& metadata,
58
                          int instanceID=0)
59
    {
60
        return setURI(uri, metadata, instanceID, false);
61
    }
62
63
    int setNextAVTransportURI(const string& uri, const string& metadata,
64
                              int instanceID=0)
65
    {
66
        return setURI(uri, metadata, instanceID, true);
67
    }
68
69
    int setPlayMode(PlayMode pm, int instanceID=0);
70
    struct MediaInfo {
71
        int nrtracks;
72
        int mduration; // seconds
73
        std::string cururi;
74
        UPnPDirObject curmeta;
75
        std::string nexturi;
76
        UPnPDirObject nextmeta;
77
        std::string pbstoragemed;
78
        std::string rcstoragemed;
79
        std::string ws;
80
    };
81
    int getMediaInfo(MediaInfo& info, int instanceID=0);
82
83
    struct TransportInfo {
84
        TransportState tpstate;
85
        TransportStatus tpstatus;
86
        int curspeed;
87
    };
88
    int getTransportInfo(TransportInfo& info, int instanceID=0);
89
90
    struct PositionInfo {
91
        int track;
92
        int trackduration; // secs
93
        UPnPDirObject trackmeta;
94
        std::string trackuri;
95
        int reltime;
96
        int abstime;
97
        int relcount;
98
        int abscount;
99
    };
100
    int getPositionInfo(PositionInfo& info, int instanceID=0);
101
102
    struct DeviceCapabilities {
103
        std::string playmedia;
104
        std::string recmedia;
105
        std::string recqualitymodes;
106
    };
107
    int getDeviceCapabilities(DeviceCapabilities& info, int instanceID=0);
108
109
    struct TransportSettings {
110
        PlayMode playmode;
111
        std::string recqualitymode;
112
    };
113
    int getTransportSettings(TransportSettings& info, int instanceID=0);
114
115
    int stop(int instanceID=0);
116
    int pause(int instanceID=0);
117
    int play(int speed = 1, int instanceID = 0);
118
    enum SeekMode {SEEK_TRACK_NR, SEEK_ABS_TIME,
119
                   SEEK_REL_TIME, SEEK_ABS_COUNT,
120
                   SEEK_REL_COUNT, SEEK_CHANNEL_FREQ, 
121
                   SEEK_TAPE_INDEX, SEEK_FRAME};
122
    // Target in seconds for times.
123
    int seek(SeekMode mode, int target, int instanceID=0); 
124
    int next(int instanceID=0);
125
    int previous(int instanceID=0);
126
127
    int getCurrentTransportActions(std::string& actions, int instanceID=0);
128
45
    /** Test service type from discovery message */
129
    /** Test service type from discovery message */
46
    static bool isAVTService(const std::string& st);
130
    static bool isAVTService(const std::string& st);
47
131
48
49
protected:
132
protected:
50
    static const string SType;
133
    static const string SType;
51
134
    int setURI(const string& uri, const string& metadata,
135
               int instanceID, bool next);
52
private:
136
private:
53
    void evtCallback(const std::unordered_map<std::string, std::string>&);
137
    void evtCallback(const std::unordered_map<std::string, std::string>&);
54
    void registerCallback();
138
    void registerCallback();
55
139
56
};
140
};