summaryrefslogtreecommitdiffstats
path: root/mpeglib/lib/mpgplayer/mpegStreamPlayer.h
blob: 584e0a223fc2a6ca25fcec75fe9152cd004e77e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/*
  feeds audio/video streams to the decoders
  Copyright (C) 2000  Martin Vogt

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU Library General Public License as published by
  the Free Software Foundation.

  For more information look at the file COPYRIGHT in this package

 */




#ifndef __MPEGSTREAMPLAYER_H
#define __MPEGSTREAMPLAYER_H

#include "../decoder/decoderPlugin.h"
#include "../util/syncClock.h"

class MpegSystemHeader;

class MpegStreamPlayer {

 protected:
  SyncClock* syncClock;
  DecoderPlugin* audioDecoder;
  DecoderPlugin* videoDecoder;
  BufferInputStream* audioInput;
  BufferInputStream* videoInput;
  OutputStream* output;
  InputStream* input;
  TimeStamp* timeStampVideo;
  TimeStamp* timeStampAudio;

  int packetCnt;
  int audioPacketCnt;
  int videoPacketCnt;
  int seekPos;
  int writeToDisk;

  char* nukeBuffer;

 public:
  MpegStreamPlayer(InputStream* input,
		   OutputStream* output,
		   DecoderPlugin* audioDecoder,
		   DecoderPlugin* videoDecoder);
  ~MpegStreamPlayer();

  int isInit();
  void processThreadCommand(Command* command);

  //
  // Mpeg special functions [START]
  //

  int processSystemHeader(MpegSystemHeader* mpegSystemHeader);
  int insertAudioData(MpegSystemHeader* header,int len);
  int insertVideoData(MpegSystemHeader* header,int len);

  //
  // Mpeg special functions [END]
  //
 


  int insertAudioDataRaw(unsigned char* input,int len,TimeStamp* stamp);
  int insertVideoDataRaw(unsigned char* input,int len,TimeStamp* stamp);

  void dumpData(MpegSystemHeader* mpegSystemHeader);

  void setWriteToDisk(int lwriteToDisk);
  int getWriteToDisk();
  
  int hasEnd();
 protected:
  int processResyncRequest();

  int getByteDirect();
  void nuke(int byte);

  // useful methods
  int finishAudio(int len);
  int finishVideo(int len);

};

#endif