MistServer  2.5.3-Pro-19-gf5e75b1 ( Generic_64)
input_ogg.h
Go to the documentation of this file.
1 #include "input.h"
2 #include <mist/dtsc.h>
3 #include <mist/ogg.h>
4 
5 namespace Mist {
6 
7  struct segPart {
8  char * segData;
9  unsigned int len;
10  };
11 
12  class segment {
13  public:
14  segment() : time(0), tid(0), bytepos(0), keyframe(0){}
15  bool operator < (const segment & rhs) const {
16  return time < rhs.time || (time == rhs.time && tid < rhs.tid);
17  }
18  std::vector<std::string> parts;
19  unsigned long long int time;
20  unsigned long long int tid;
21  long long unsigned int bytepos;
22  bool keyframe;
23  JSON::Value toJSON(OGG::oggCodec myCodec);
24  };
25 
26  struct position {
27  bool operator < (const position & rhs) const {
28  if (time < rhs.time){
29  return true;
30  } else {
31  if (time == rhs.time){
32  if (trackID < rhs.trackID){
33  return true;
34  }
35  }
36  }
37  return false;
38  }
39  long unsigned int trackID;
40  long long unsigned int time;
41  long long unsigned int bytepos;
42  long long unsigned int segmentNo;
43  };
44 /*
45  class oggTrack {
46  public:
47  oggTrack() : lastTime(0), parsedHeaders(false), lastPageOffset(0), nxtSegment(0){ }
48  codecType codec;
49  std::string contBuffer;//buffer for continuing pages
50  segment myBuffer;
51  double lastTime;
52  long long unsigned int lastGran;
53  bool parsedHeaders;
54  double msPerFrame;
55  long long unsigned int lastPageOffset;
56  OGG::Page myPage;
57  unsigned int nxtSegment;
58  //Codec specific elements
59  //theora
60  theora::header idHeader;
61  //vorbis
62  std::deque<vorbis::mode> vModes;
63  char channels;
64  unsigned long blockSize[2];
65  unsigned long getBlockSize(unsigned int vModeIndex);
66  };*/
67 
68  class inputOGG : public Input {
69  public:
70  inputOGG(Util::Config * cfg);
71  protected:
72  //Private Functions
73  bool setup();
74  bool readHeader();
75  position seekFirstData(long long unsigned int tid);
76  void getNext(bool smart = true);
77  void seek(int seekTime);
78  void trackSelect(std::string trackSpec);
79 
80  void parseBeginOfStream(OGG::Page & bosPage);
81  std::set<position> currentPositions;
82  FILE * inFile;
83  std::map<long unsigned int, OGG::oggTrack> oggTracks;//this remembers all metadata for every track
84  std::set<segment> sortedSegments;//probably not needing this
85  long long unsigned int calcGranuleTime(unsigned long tid, long long unsigned int granule);
86  long long unsigned int calcSegmentDuration(unsigned long tid , std::string & segment);
87 
88  };
89 }
90 
92 
93 
oggCodec
Definition: ogg.h:25
unsigned int len
Definition: input_ogg.h:9
std::set< position > currentPositions
Definition: input_ogg.h:81
Definition: input_ogg.h:7
char * segData
Definition: input_ogg.h:8
A JSON::Value is either a string or an integer, but may also be an object, array or null...
Definition: json.h:21
std::set< segment > sortedSegments
Definition: input_ogg.h:84
Definition: input.h:19
Recording to file.
Definition: input.cpp:13
Definition: input_ogg.h:12
long long unsigned int bytepos
Definition: input_ogg.h:41
Definition: input_ogg.h:26
long long unsigned int segmentNo
Definition: input_ogg.h:42
unsigned long long int time
Definition: input_ogg.h:19
long long unsigned int time
Definition: input_ogg.h:40
Deals with parsing configuration from commandline options.
Definition: config.h:18
long unsigned int trackID
Definition: input_ogg.h:39
unsigned long long int tid
Definition: input_ogg.h:20
Definition: ogg.h:39
Definition: input_ogg.h:68
bool keyframe
Definition: input_ogg.h:22
std::vector< std::string > parts
Definition: input_ogg.h:18
std::map< long unsigned int, OGG::oggTrack > oggTracks
Definition: input_ogg.h:83
Mist::inputOGG mistIn
Definition: input_ogg.h:91
long long unsigned int bytepos
Definition: input_ogg.h:21
FILE * inFile
Definition: input_ogg.h:82
segment()
Definition: input_ogg.h:14