]> git.vomp.tv Git - vompclient.git/blob - media.h
Code cleaning
[vompclient.git] / media.h
1 /*
2     Copyright 2004-2005 Chris Tallon, Andreas Vogel
3
4     This file is part of VOMP.
5
6     VOMP is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10
11     VOMP is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with VOMP; if not, write to the Free Software
18     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
19 */
20
21 #ifndef MEDIA_H
22 #define MEDIA_H
23
24 #include <stdio.h>
25 #include <string.h>
26 #include "defines.h"
27 #include "recinfo.h"
28 #include "mark.h"
29 #include "log.h"
30 #include "demuxer.h"
31
32 /* media types form a bitmask
33    so you can add them to have > 1*/
34 #define MEDIA_TYPE_DIR 1
35 #define MEDIA_TYPE_AUDIO 2
36 #define MEDIA_TYPE_VIDEO 4
37 #define MEDIA_TYPE_PICTURE 8
38 #define MEDIA_TYPE_UNKNOWN 0
39
40 #define MEDIA_TYPE_ALL (1+2+4+8)
41
42
43
44 class Media
45 {
46   public:
47     Media();
48     ~Media();
49
50     void setTime(ULONG startTime);
51     void setDisplayName(char* displayName);
52     void setFileName(char* fileName);
53     void setMediaType(int mtype);
54
55     ULONG getTime() const;
56     const char* getDisplayName() const;
57     const char* getFileName() const;
58     //return the time as a string
59     //if the user provides a buffer, this one is used, if NULL
60     //is given a new buffer is allocated
61     //caller must delete the buffer after usage!
62     char * getTimeString(char *buffer) const;
63     //length for the time display buffer
64     const static int TIMEBUFLEN=100;
65     int index;
66     int getMediaType() const;
67
68     void loadMarks();
69     int getPrevMark(int currentFrame);
70     int getNextMark(int currentFrame);
71     bool hasMarks();
72     MarkList* getMarkList();
73
74     
75   private:
76     ULONG start;
77     char* displayName;
78     char* fileName;
79     int mediaType;
80
81     // I only want 1 RecInfo loaded at a time
82     // if (recInfoFor == this) then recInfo is valid
83     // else delete recInfo and reload for this recording
84     static Media* recInfoFor;
85
86     MarkList* markList;
87 };
88 typedef vector<Media*> MediaList;
89
90 #endif