#pragma once #include #include #include #include #include namespace Mist { enum negotiationState { FILL_NEW,///< New track, just sent negotiation request FILL_NEG,///< Negotiating this track, written metadata FILL_DEC,///< Declined Track FILL_ACC///< Accepted Track }; struct DTSCPageData { DTSCPageData() : pageNum(0), keyNum(0), partNum(0), dataSize(0), curOffset(0), firstTime(0), lastKeyTime(-5000){} unsigned long pageNum;///The current page number unsigned long keyNum;/// > pagesByTrack;/// trackOffset; ///< Offset of data on user page std::map trackState; ///< State of the negotiation for tracks std::map trackMap;/// metaPages;///< For each track, holds the page that describes which dataPages are mapped std::map curPageNum;///< For each track, holds the number page that is currently being written. std::map curPage;///< For each track, holds the page that is currently being written. std::map > preBuffer;///< For each track, holds to-be-buffered packets. IPC::sharedClient userClient;///< Shared memory used for connection to Mixer process. std::string streamName;///< Name of the stream to connect to void continueNegotiate(unsigned long tid, DTSC::Meta & myMeta, bool quickNegotiate = false); }; ///\brief Class containing all basic input and output functions. class InOutBase { public: void initiateMeta(); bool bufferStart(unsigned long tid, unsigned long pageNumber); void bufferNext(DTSC::Packet & pack); void bufferNext(JSON::Value & pack); void bufferFinalize(unsigned long tid); void bufferRemove(unsigned long tid, unsigned long pageNumber); void bufferLivePacket(JSON::Value & packet); void bufferLivePacket(DTSC::Packet & packet); protected: void continueNegotiate(unsigned long tid, bool quickNegotiate = false); bool standAlone; static Util::Config * config; negotiationProxy nProxy; DTSC::Packet thisPacket;//The current packet that is being parsed std::string streamName; std::set selectedTracks;///< Stores the track id's that are either selected for playback or input DTSC::Meta myMeta;///< Stores either the input or output metadata }; }