Theora Playback Library  1.0.0
All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
TheoraDataSource.h
Go to the documentation of this file.
1 /************************************************************************************
2 This source file is part of the Theora Video Playback Library
3 For latest info, see http://libtheoraplayer.sourceforge.net/
4 *************************************************************************************
5 Copyright (c) 2008-2013 Kresimir Spes (kspes@cateia.com)
6 This program is free software; you can redistribute it and/or modify it under
7 the terms of the BSD license: http://www.opensource.org/licenses/bsd-license.php
8 *************************************************************************************/
9 #ifndef _TheoraDataSource_h
10 #define _TheoraDataSource_h
11 
12 #include <stdio.h>
13 #include <string>
14 #include "TheoraExport.h"
15 
23 {
24 public:
25 
26  virtual ~TheoraDataSource();
31  virtual int read(void* output,int nBytes)=0;
33  virtual std::string repr()=0;
35  virtual void seek(unsigned long byte_index)=0;
37  virtual unsigned long size()=0;
39  virtual unsigned long tell()=0;
40 };
41 
42 
47 {
48  FILE* mFilePtr;
49  std::string mFilename;
50  unsigned long mSize;
51 
52  void openFile();
53 public:
54  TheoraFileDataSource(std::string filename);
56 
57  int read(void* output,int nBytes);
58  void seek(unsigned long byte_index);
59  std::string repr() { return mFilename; }
60  unsigned long size();
61  unsigned long tell();
62 
63  std::string getFilename() { return mFilename; }
64 };
65 
72 {
73  std::string mFilename;
74  unsigned long mSize,mReadPointer;
75  unsigned char* mData;
76 public:
77  TheoraMemoryFileDataSource(std::string filename);
79 
80  int read(void* output,int nBytes);
81  void seek(unsigned long byte_index);
82  std::string repr() { return "MEM:"+mFilename; }
83  unsigned long size();
84  unsigned long tell();
85  std::string getFilename() { return mFilename; }
86 };
87 
88 #endif