Remove AegiVideoFrame::cppAlloc, which was only needed by the dshow video provider.

Originally committed to SVN as r3728.
This commit is contained in:
Thomas Goyne 2009-10-21 04:29:15 +00:00
parent 7581d41935
commit c4d07cb525
3 changed files with 2 additions and 22 deletions

View file

@ -61,7 +61,6 @@ void AegiVideoFrame::Reset() {
// Set properties // Set properties
format = FORMAT_NONE; format = FORMAT_NONE;
flipped = false; flipped = false;
cppAlloc = true;
invertChannels = true; invertChannels = true;
} }
@ -126,8 +125,7 @@ void AegiVideoFrame::Allocate() {
// Reallocate, if necessary // Reallocate, if necessary
if (memSize != size) { if (memSize != size) {
if (data[0]) { if (data[0]) {
if (cppAlloc) delete[] data[0]; delete[] data[0];
else free(data[0]);
} }
data[0] = new unsigned char[size]; data[0] = new unsigned char[size];
for (int i=1;i<4;i++) data[i] = NULL; for (int i=1;i<4;i++) data[i] = NULL;
@ -138,20 +136,12 @@ void AegiVideoFrame::Allocate() {
data[1] = data[0] + (pitch[0]*height); data[1] = data[0] + (pitch[0]*height);
data[2] = data[0] + (pitch[0]*height+pitch[1]*height/2); data[2] = data[0] + (pitch[0]*height+pitch[1]*height/2);
} }
// Flag as allocated by C++
cppAlloc = true;
} }
} }
/// @brief Clear /// @brief Clear
///
void AegiVideoFrame::Clear() { void AegiVideoFrame::Clear() {
// Free memory delete[] data[0];
if (cppAlloc) delete[] data[0];
else free(data[0]);
// Zero variables // Zero variables
for (int i=0;i<4;i++) { for (int i=0;i<4;i++) {
@ -165,7 +155,6 @@ void AegiVideoFrame::Clear() {
// Reset properties // Reset properties
format = FORMAT_NONE; format = FORMAT_NONE;
flipped = false; flipped = false;
cppAlloc = true;
invertChannels = true; invertChannels = true;
} }

View file

@ -99,16 +99,12 @@ public:
// Pitch, that is, the number of bytes used by each row. // Pitch, that is, the number of bytes used by each row.
unsigned int pitch[4]; unsigned int pitch[4];
/// First row is actually the bottom one /// First row is actually the bottom one
bool flipped; bool flipped;
/// Swap Red and Blue channels or U and V planes (controls RGB versus BGR ordering etc) /// Swap Red and Blue channels or U and V planes (controls RGB versus BGR ordering etc)
bool invertChannels; bool invertChannels;
/// Allocated with C++'s "new" operator, instead of "malloc"
bool cppAlloc;
AegiVideoFrame(); AegiVideoFrame();
AegiVideoFrame(int width,int height,VideoFrameFormat format=FORMAT_RGB32); AegiVideoFrame(int width,int height,VideoFrameFormat format=FORMAT_RGB32);

View file

@ -344,11 +344,6 @@ const AegiVideoFrame AvisynthVideoProvider::GetFrame(int _n) {
// Aegisub's video frame // Aegisub's video frame
AegiVideoFrame &final = iframe; AegiVideoFrame &final = iframe;
final.flipped = false;
final.cppAlloc = true;
final.invertChannels = false;
// Format
final.format = FORMAT_RGB32; final.format = FORMAT_RGB32;
final.flipped = true; final.flipped = true;
final.invertChannels = true; final.invertChannels = true;