From 857f14714a87fac0f9c530f05bd6e6099f0fe9f0 Mon Sep 17 00:00:00 2001 From: Joerg Mueller Date: Tue, 25 May 2010 12:40:33 +0000 Subject: Merge with trunk, revision 28528 - 28976. --- intern/audaspace/ffmpeg/AUD_FFMPEGFactory.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'intern/audaspace/ffmpeg/AUD_FFMPEGFactory.cpp') diff --git a/intern/audaspace/ffmpeg/AUD_FFMPEGFactory.cpp b/intern/audaspace/ffmpeg/AUD_FFMPEGFactory.cpp index f67c819ff10..8e71c97baec 100644 --- a/intern/audaspace/ffmpeg/AUD_FFMPEGFactory.cpp +++ b/intern/audaspace/ffmpeg/AUD_FFMPEGFactory.cpp @@ -23,6 +23,9 @@ * ***** END LGPL LICENSE BLOCK ***** */ +// needed for INT64_C +#define __STDC_CONSTANT_MACROS + #include "AUD_FFMPEGFactory.h" #include "AUD_FFMPEGReader.h" #include "AUD_Buffer.h" -- cgit v1.2.3 From 99bbc90266beeedd432981d7332a04ebafae413c Mon Sep 17 00:00:00 2001 From: Joerg Mueller Date: Sat, 19 Jun 2010 10:31:47 +0000 Subject: Deleting my GSoC branch to recreate it. --- intern/audaspace/ffmpeg/AUD_FFMPEGFactory.cpp | 68 --------------------------- 1 file changed, 68 deletions(-) delete mode 100644 intern/audaspace/ffmpeg/AUD_FFMPEGFactory.cpp (limited to 'intern/audaspace/ffmpeg/AUD_FFMPEGFactory.cpp') diff --git a/intern/audaspace/ffmpeg/AUD_FFMPEGFactory.cpp b/intern/audaspace/ffmpeg/AUD_FFMPEGFactory.cpp deleted file mode 100644 index 8e71c97baec..00000000000 --- a/intern/audaspace/ffmpeg/AUD_FFMPEGFactory.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * $Id$ - * - * ***** BEGIN LGPL LICENSE BLOCK ***** - * - * Copyright 2009 Jörg Hermann Müller - * - * This file is part of AudaSpace. - * - * AudaSpace is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * AudaSpace is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with AudaSpace. If not, see . - * - * ***** END LGPL LICENSE BLOCK ***** - */ - -// needed for INT64_C -#define __STDC_CONSTANT_MACROS - -#include "AUD_FFMPEGFactory.h" -#include "AUD_FFMPEGReader.h" -#include "AUD_Buffer.h" - -AUD_FFMPEGFactory::AUD_FFMPEGFactory(const char* filename) -{ - if(filename != NULL) - { - m_filename = new char[strlen(filename)+1]; AUD_NEW("string") - strcpy(m_filename, filename); - } - else - m_filename = NULL; -} - -AUD_FFMPEGFactory::AUD_FFMPEGFactory(unsigned char* buffer, int size) -{ - m_filename = NULL; - m_buffer = AUD_Reference(new AUD_Buffer(size)); - memcpy(m_buffer.get()->getBuffer(), buffer, size); -} - -AUD_FFMPEGFactory::~AUD_FFMPEGFactory() -{ - if(m_filename) - { - delete[] m_filename; AUD_DELETE("string") - } -} - -AUD_IReader* AUD_FFMPEGFactory::createReader() -{ - AUD_IReader* reader; - if(m_filename) - reader = new AUD_FFMPEGReader(m_filename); - else - reader = new AUD_FFMPEGReader(m_buffer); - AUD_NEW("reader") - return reader; -} -- cgit v1.2.3 From 7296600434c49b40215ba842af73a8b1517e12eb Mon Sep 17 00:00:00 2001 From: Joerg Mueller Date: Wed, 28 Jul 2010 09:36:03 +0000 Subject: Audaspace: HUGE Refactor. Some points of the refactor not sorted by importance: * Fixed immutability of readers and factories (there are exceptions...) * Fixed copy constructors and = operators * Removed messaging system * Removed reader types * Added const where possible * Using initalisers when possible * Avoided use of pointers when possible * Removed AUD_NEW and AUD_DELETE macros * Removed useless NULL pointer checks * Fixed exception catching * Fixed some yet unknown bugs * Lots of other stuff --- intern/audaspace/ffmpeg/AUD_FFMPEGFactory.cpp | 36 ++++++++------------------- 1 file changed, 10 insertions(+), 26 deletions(-) (limited to 'intern/audaspace/ffmpeg/AUD_FFMPEGFactory.cpp') diff --git a/intern/audaspace/ffmpeg/AUD_FFMPEGFactory.cpp b/intern/audaspace/ffmpeg/AUD_FFMPEGFactory.cpp index 8e71c97baec..cad64d70790 100644 --- a/intern/audaspace/ffmpeg/AUD_FFMPEGFactory.cpp +++ b/intern/audaspace/ffmpeg/AUD_FFMPEGFactory.cpp @@ -24,45 +24,29 @@ */ // needed for INT64_C +#ifndef __STDC_CONSTANT_MACROS #define __STDC_CONSTANT_MACROS +#endif #include "AUD_FFMPEGFactory.h" #include "AUD_FFMPEGReader.h" #include "AUD_Buffer.h" -AUD_FFMPEGFactory::AUD_FFMPEGFactory(const char* filename) +AUD_FFMPEGFactory::AUD_FFMPEGFactory(std::string filename) : + m_filename(filename) { - if(filename != NULL) - { - m_filename = new char[strlen(filename)+1]; AUD_NEW("string") - strcpy(m_filename, filename); - } - else - m_filename = NULL; } -AUD_FFMPEGFactory::AUD_FFMPEGFactory(unsigned char* buffer, int size) +AUD_FFMPEGFactory::AUD_FFMPEGFactory(const data_t* buffer, int size) : + m_buffer(new AUD_Buffer(size)) { - m_filename = NULL; - m_buffer = AUD_Reference(new AUD_Buffer(size)); memcpy(m_buffer.get()->getBuffer(), buffer, size); } -AUD_FFMPEGFactory::~AUD_FFMPEGFactory() -{ - if(m_filename) - { - delete[] m_filename; AUD_DELETE("string") - } -} - -AUD_IReader* AUD_FFMPEGFactory::createReader() +AUD_IReader* AUD_FFMPEGFactory::createReader() const { - AUD_IReader* reader; - if(m_filename) - reader = new AUD_FFMPEGReader(m_filename); + if(m_buffer.get()) + return new AUD_FFMPEGReader(m_buffer); else - reader = new AUD_FFMPEGReader(m_buffer); - AUD_NEW("reader") - return reader; + return new AUD_FFMPEGReader(m_filename); } -- cgit v1.2.3