~ubuntu-branches/ubuntu/hoary/kdemultimedia/hoary

« back to all changes in this revision

Viewing changes to mpeglib/lib/mpegplay/mpegVideoLength.h

  • Committer: Bazaar Package Importer
  • Author(s): Martin Schulze
  • Date: 2003-01-22 15:00:51 UTC
  • Revision ID: james.westby@ubuntu.com-20030122150051-uihwkdoxf15mi1tn
Tags: upstream-2.2.2
ImportĀ upstreamĀ versionĀ 2.2.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
  mpg I video/audio player plugin
 
3
  Copyright (C) 1999  Martin Vogt
 
4
 
 
5
  This program is free software; you can redistribute it and/or modify
 
6
  it under the terms of the GNU Library General Public License as published by
 
7
  the Free Software Foundation.
 
8
 
 
9
  For more information look at the file COPYRIGHT in this package
 
10
 
 
11
 */
 
12
 
 
13
 
 
14
#ifndef __MPEGVIDEOLENGTH_H
 
15
#define __MPEGVIDEOLENGTH_H
 
16
 
 
17
#include "../input/inputPlugin.h"
 
18
 
 
19
 
 
20
 
 
21
 
 
22
 
 
23
 
 
24
/**
 
25
   This class calculates the length (in seconds) of an mpeg stream.
 
26
   I do not know how to make it right, my approach
 
27
   seeks at the beginning of the stream for the timecode in
 
28
   the picture gop then jumps near the end and does the same.
 
29
   then it substracts the values.
 
30
   It has some limitations, it does not seek higher than 600 MB,
 
31
   because it seems the kernel has some problems with this.
 
32
   (It resets the scsi system, and sometimes hang/crash)
 
33
   Thus it only seek near 600 and assumes linear relation
 
34
   for the rest. (Means: it calculates the length of the rest
 
35
   with the sec/mb value calculates from the 600 mb
 
36
   should be exact enough.
 
37
*/
 
38
 
 
39
class MpegVideoStream;
 
40
class MpegVideoHeader;
 
41
class MpegSystemStream;
 
42
class MpegSystemHeader;
 
43
class GOP;
 
44
 
 
45
class MpegVideoLength {
 
46
 
 
47
  // these are used fo non system streams
 
48
  MpegVideoHeader*     mpegVideoHeader;
 
49
  MpegVideoStream*     mpegVideoStream;
 
50
 
 
51
  // these for system streams
 
52
  MpegSystemHeader*    mpegSystemHeader;
 
53
  MpegSystemStream*    mpegSystemStream;
 
54
 
 
55
  
 
56
  InputStream* input;
 
57
  GOP* startGOP;
 
58
  GOP* endGOP;
 
59
  GOP* lengthGOP;
 
60
 
 
61
 
 
62
  int lHasStart;
 
63
  int lHasEnd;
 
64
  int lCanSeek;
 
65
  int lHasStream;
 
66
  int lHasSystemStream;
 
67
  int lHasRawStream;
 
68
  int lHasResync;
 
69
  int lSysLayer;
 
70
  long upperEnd;
 
71
  long realLength;
 
72
 
 
73
 public:
 
74
  MpegVideoLength(InputStream* input);
 
75
  ~MpegVideoLength();
 
76
 
 
77
  int firstInitialize();
 
78
 
 
79
  long getLength();
 
80
  long getSeekPos(int seconds);
 
81
 
 
82
 
 
83
 private:
 
84
  int seekToStart();
 
85
  int seekToEnd();
 
86
  int seekValue(unsigned int code,long& endPos);
 
87
  int parseToGOP(GOP* gop);
 
88
  int parseToPTS(GOP* gop);
 
89
  
 
90
 
 
91
};
 
92
#endif
 
93