summaryrefslogtreecommitdiffstats
path: root/mpeglib/lib/util/render/pictureArray.cpp
blob: 71381ea018cb439531e42a76de0f439469a5653a (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
91
92
93
94
95
96
97
98
99
100
101
/*
  nice try of an X11 output plugin
  Copyright (C) 1999  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

 */


#include "pictureArray.h"



PictureArray::PictureArray(int width, int height) {
  int i;
  pictureCallback=NULL;
  imageType=PICTURE_NO_TYPE;

  for (i=0;i<_PICTURE_ARRAY_SIZE;i++) {
    pictureArray[i]=new YUVPicture(width,height);
    imageType=pictureArray[i]->getImageType();
  }  
  
  /* Find a pict image structure in ring buffer not currently locked. */
  /* Set current pict image structure to the one just found in ring. */
  
  current=pictureArray[0];
  past=pictureArray[1];
  future=pictureArray[2];

  picPerSec=0.0;
  this->width=width;
  this->height=height;

}


PictureArray::~PictureArray() {
  int i;
  for (i=0;i<_PICTURE_ARRAY_SIZE;i++) {
    if (pictureArray[i] != NULL) {
      delete pictureArray[i];
      pictureArray[i]=NULL;
    }

  } 
}





void PictureArray::setPicturePerSecond(double val) {
  picPerSec=val;
}


double PictureArray::getPicturePerSecond() {
  return picPerSec;
}




void PictureArray::forward() {
  /* Update past and future references if needed. */

  YUVPicture* tmp=past;

  past = future;
  future = current;
  current = tmp;
    

}




YUVPicture* PictureArray::getYUVPictureCallback() {
  return pictureCallback;
}


void PictureArray::setYUVPictureCallback(YUVPicture* pic) {
  this->pictureCallback=pic;
}


void PictureArray::setImageType(int imageType) {
  int i;
  this->imageType=imageType;
  for (i=0;i<_PICTURE_ARRAY_SIZE;i++) {
    pictureArray[i]->setImageType(imageType);
  }  
}