summaryrefslogtreecommitdiffstats
path: root/mpeglib/lib/util/render/renderMachine.h
blob: 728a67403b568edd245005edc10e33f6f817bf76 (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
/*
  puts the yuv images onto a surface
  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 __RENDERMACHINE_H
#define __RENDERMACHINE_H




/**
   RenderMachine. We still have the problem, because of performance,
   that we cannot have a yuv picture format in the decoder
   and one in the output to x11. they must be shared.
   XV support then directly works on them and SDL images
   can be exported to the decoder as well.

   Another point is : mode switch. User want desktop->fullscreen switch.
   Due to the threaded nature, we must have a single synchronization
   point, when we know that the decoder currently does _not_ decode
   so that we can switch the imaged and free the memory.

   Some points are currently unclear, for example how to handle 
   applications, which want to redirect the image into their own 
   buffers, but hey, there are that many classes and layers
   I really think it should be doable somehow

*/

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#ifndef SDL_WRAPPER
#include "x11/x11Surface.h"
#endif

#ifdef SDL_WRAPPER
#include "sdl/sdlSurface.h"
#endif

#include "pictureArray.h"
#include "../abstract/abs_thread.h"

class RenderMachine {


  Surface* surface;
  PictureArray* pictureArray;

  
  TimeStamp* startTime;
  TimeStamp* endTime;

  int initialMode;

 public:
  RenderMachine();
  ~RenderMachine();

  int openWindow(int width, int height,const char *title);
  int x11WindowId();
  void closeWindow();
  void flushWindow();

  
  PictureArray* lockPictureArray();
  void unlockPictureArray(PictureArray* pictureArray);

  void config(const char* key, const char* value,void* user_data);

 private:
  void waitRestTime();
  void putImage(YUVPicture* pic,TimeStamp* waitTime,TimeStamp* earlyTime);

  int switchToMode(int mode);

};
#endif