M3SMetaInfo.hpp

00001 /*********************************************************************** 00002 * * 00003 * ViTooKi * 00004 * * 00005 * title: M3SMetaInfo.hpp * 00006 * * 00007 * * 00008 * * 00009 * ITEC institute of the University of Klagenfurt (Austria) * 00010 * http://www.itec.uni-klu.ac.at * 00011 * * 00012 * * 00013 * For more information visit the ViTooKi homepage: * 00014 * http://ViTooKi.sourceforge.net * 00015 * vitooki-user@lists.sourceforge.net * 00016 * vitooki-devel@lists.sourceforge.net * 00017 * * 00018 * This file is part of ViTooKi, a free video toolkit. * 00019 * ViTooKi is free software; you can redistribute it and/or * 00020 * modify it under the terms of the GNU General Public License * 00021 * as published by the Free Software Foundation; either version 2 * 00022 * of the License, or (at your option) any later version. * 00023 * * 00024 * This program is distributed in the hope that it will be useful, * 00025 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00026 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00027 * GNU General Public License for more details. * 00028 * * 00029 * You should have received a copy of the GNU General Public License * 00030 * along with this program; if not, write to the Free Software * 00031 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, * 00032 * MA 02111-1307, USA. * 00033 * * 00034 ***********************************************************************/ 00035 00036 /*********************************************************************** 00037 * * 00038 * REVISION HISTORY: * 00039 * * 00040 * * 00041 * * 00042 ***********************************************************************/ 00043 #ifndef M3SMETAINFO_HPP 00044 #define M3SMETAINFO_HPP 00045 00046 #include "global.hpp" 00047 #include "net/HttpRequest.hpp" 00048 00049 00050 #define LINE_SIZE 1024 00051 00052 00053 class M3SMetaInfo 00054 { 00055 public: 00056 typedef enum {none, general, video, audio} SECTION; 00057 00058 M3SMetaInfo(); 00059 ~M3SMetaInfo(); 00060 00061 void initialize(); 00062 00063 bool loadFromFile(const char *filename); 00064 00065 bool loadFromURL(const char *url); 00066 00067 int getLength() { return length; }; 00068 00069 bool isVideoEnabled() { return videoEnabled; }; 00070 char *getVideoFilepath() { return videoFilepath; }; 00071 short getFPS() { return fps; }; 00072 short getVideoKBPS() { return videoKbps; }; 00073 short getWidth() { return width; }; 00074 short getHeight() { return height; }; 00075 00076 bool isAudioEnabled() { return audioEnabled; }; 00077 char *getAudioFilepath() { return audioFilepath; }; 00078 short getAudioKBPS() { return audioKbps; }; 00079 short getNumAudioChannels() { return numAudioChannels; }; 00080 unsigned int getSampleRate() { return sampleRate; }; 00081 00082 00083 void setVideoFilepath(char *videoFilepath); 00084 void setAudioFilepath(char *audioFilepath); 00085 void appendVideoFilepath(int paramSize, char *prefix, int len); 00086 void appendAudioFilepath(int paramSize, char *prefix, int len); 00087 00088 00089 private: 00090 int readLine(char **unallocatedLine, char *content, u32 &refOffset, u32 contentLength); 00091 void parseFileContent(char *content, u32 contentLength); 00092 00093 protected: 00094 int length; 00095 00096 bool videoEnabled; 00097 char *videoFilepath; 00098 short fps; 00099 short videoKbps; 00100 short width; 00101 short height; 00102 00103 bool audioEnabled; 00104 char *audioFilepath; 00105 short audioKbps; 00106 short numAudioChannels; 00107 unsigned int sampleRate; 00108 00109 HttpRequest *http; 00110 00111 char *findParam(char *line, char *name, int *len); 00112 }; 00113 00114 #endif 00115 00116