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

« back to all changes in this revision

Viewing changes to mpeglib/lib/output/artsOutputStream.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
  output to arts
 
3
  Copyright (C) 2000  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
 
 
15
 
 
16
#ifndef __ARTSOUTPUTSTREAM_H
 
17
#define __ARTSOUTPUTSTREAM_H
 
18
 
 
19
#include "outputStream.h"
 
20
#include "../input/bufferInputStream.h"
 
21
#include "audioTime.h"
 
22
 
 
23
 
 
24
class WindowOut;
 
25
class AVSyncer;
 
26
 
 
27
 
 
28
 
 
29
 
 
30
/**
 
31
   a word about synchronisation: Arts currently has not asynchronous
 
32
   starting of stream, which means, poll if stream is initialized
 
33
   or set a callbackfunction.
 
34
 
 
35
   mpeglib is threaded and would not have much problems
 
36
   with a "callback" but currently we only support blocking wait
 
37
   for initilisation.
 
38
 
 
39
   I think, if people realize that smooth mixing of streams
 
40
   is impossible(because of the blocking start behaviour),
 
41
   this will become a desired feature :-)
 
42
 
 
43
*/
 
44
 
 
45
 
 
46
/**
 
47
   This class offers a blocking device, its behaviour is similar
 
48
   to /dev/dsp we use a buffer to store the pcm data, if
 
49
   we open/close the buffer the stored data is removed
 
50
   and the blocking thread is "kicked"
 
51
 
 
52
   Arts must first wait for an init signal. it has its own
 
53
   method to check for eof. during seek we close this
 
54
   device, after seek we reopen it.
 
55
 
 
56
   close and open have the same functionality, they simply
 
57
   clear the buffer.
 
58
*/
 
59
 
 
60
   
 
61
 
 
62
class ArtsOutputStream : public OutputStream {
 
63
 
 
64
  BufferInputStream* stream;
 
65
  AudioTime* audioTime;
 
66
 
 
67
  void (*streamStateChangeCallback)(void*);
 
68
 
 
69
  WindowOut* x11Window;
 
70
  AVSyncer* avSyncer;
 
71
  int privateBufferSize;
 
72
  class ThreadQueue* threadQueue;
 
73
 
 
74
 public:
 
75
  ArtsOutputStream(void (*streamStateChangeCallback)(void*));
 
76
  ~ArtsOutputStream();
 
77
 
 
78
  // Audio part
 
79
 
 
80
  int audioSetup(int freq,int stereo,int sign,int big,int sampleSize);
 
81
  void audioClose();
 
82
  void audioOpen();
 
83
  void audioFlush();
 
84
  
 
85
  int audioPlay(TimeStamp* startStamp,
 
86
                TimeStamp* endStamp,char *buffer, int size);
 
87
 
 
88
 
 
89
  AudioTime* getAudioTime();
 
90
 
 
91
  int getPreferredDeliverSize();
 
92
 
 
93
  // Video part
 
94
 
 
95
  int openWindow(int width, int height,const char *title);
 
96
  void closeWindow();
 
97
  void flushWindow();
 
98
 
 
99
  PictureArray* lockPictureArray();
 
100
  void unlockPictureArray(PictureArray* pictureArray);
 
101
 
 
102
  int getFrameusec();
 
103
 
 
104
  void config(const char* key,const char* value,void* user_data);
 
105
 
 
106
  // Remote read extension
 
107
 
 
108
  int read(char** buffer,int bytes);
 
109
  void forwardReadPtr(int bytes);
 
110
 
 
111
  // buffer control
 
112
  int getBufferFillgrade();
 
113
 
 
114
  // sync control
 
115
  void setAudioBufferSize(int size);
 
116
  
 
117
 private:
 
118
  void sendSignal(int state,int value);
 
119
  void initStream();
 
120
  
 
121
};
 
122
#endif