diff options
-rw-r--r-- | Uncopyable.h | 38 | ||||
-rw-r--r-- | dxr3audiodecoder.h | 6 | ||||
-rw-r--r-- | dxr3ffmpeg.h | 7 | ||||
-rw-r--r-- | dxr3pesframe.h | 8 | ||||
-rw-r--r-- | dxr3syncbuffer.h | 5 |
5 files changed, 46 insertions, 18 deletions
diff --git a/Uncopyable.h b/Uncopyable.h new file mode 100644 index 0000000..17517cd --- /dev/null +++ b/Uncopyable.h @@ -0,0 +1,38 @@ +/* + * Uncopyable.h + * + * Copyright (C) 2004 Christian Gmeiner + * + * This program 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 2.1 + * of the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef _UNCOPYABLE_H_ +#define _UNCOPYABLE_H_ + +class Uncopyable { +protected: + // allow construction and deconstruction + // of subclasses + Uncopyable() {} + ~Uncopyable() {} + +private: + // disallow copy operations + Uncopyable(const Uncopyable&); + Uncopyable& operator=(const Uncopyable&); +}; + +#endif /*_UNCOPYABLE_H_*/ diff --git a/dxr3audiodecoder.h b/dxr3audiodecoder.h index fd9dc6b..f2063b9 100644 --- a/dxr3audiodecoder.h +++ b/dxr3audiodecoder.h @@ -29,11 +29,11 @@ #include "dxr3ffmpeg.h" #include "dxr3syncbuffer.h" #include "dxr3multichannelaudio.h" +#include "Uncopyable.h" // ================================== // decode audio to mp2 or use DD :) -class cDxr3AudioDecoder -{ +class cDxr3AudioDecoder : private Uncopyable { public: cDxr3AudioDecoder(); ~cDxr3AudioDecoder(); @@ -72,8 +72,6 @@ private: int channels; uint8_t lastHeader[4]; uint8_t pcmbuf[AVCODEC_MAX_AUDIO_FRAME_SIZE]; - - cDxr3AudioDecoder(cDxr3AudioDecoder&); // no copy constructor }; #endif /*_DXR3_AUDIODECODER_H_*/ diff --git a/dxr3ffmpeg.h b/dxr3ffmpeg.h index c094b55..8772144 100644 --- a/dxr3ffmpeg.h +++ b/dxr3ffmpeg.h @@ -29,6 +29,7 @@ extern "C" #include <string.h> #include "dxr3singleton.h" +#include "Uncopyable.h" // ================================== //! a codec used by this plugin @@ -51,8 +52,7 @@ struct Dxr3Codec the audiodecoder, but in future i want to use it for ohter nice stuff :) */ -class cDxr3Ffmpeg : public Singleton<cDxr3Ffmpeg> -{ +class cDxr3Ffmpeg : public Singleton<cDxr3Ffmpeg>, private Uncopyable { public: cDxr3Ffmpeg(); ~cDxr3Ffmpeg() {} @@ -60,9 +60,6 @@ public: bool FindCodec(struct Dxr3Codec& Codec); bool OpenCodec(struct Dxr3Codec& Codec); void CloseCodec(struct Dxr3Codec& Codec); - -private: - cDxr3Ffmpeg(cDxr3Ffmpeg&); // no copy constructor }; #endif /*_DXR3_FFMPEG_H_*/ diff --git a/dxr3pesframe.h b/dxr3pesframe.h index 305542b..4bdc448 100644 --- a/dxr3pesframe.h +++ b/dxr3pesframe.h @@ -24,6 +24,7 @@ #include <assert.h> #include <stdint.h> +#include "Uncopyable.h" // ================================== enum eVideoFrameType @@ -81,8 +82,7 @@ private: // ================================== // pes - packetized elementary stream -class cDxr3PesFrame -{ +class cDxr3PesFrame : private Uncopyable { public: // ================================== @@ -248,10 +248,6 @@ protected: protected: static const uint32_t MAX_PES_HEADER_SIZE; - -private: - cDxr3PesFrame(cDxr3PesFrame&); // no copy constructor - }; #endif /*_DXR3PESFRAME_H_*/ diff --git a/dxr3syncbuffer.h b/dxr3syncbuffer.h index 70f1632..91fdb48 100644 --- a/dxr3syncbuffer.h +++ b/dxr3syncbuffer.h @@ -28,6 +28,7 @@ #include "dxr3interface.h" #include "dxr3generaldefines.h" #include "dxr3nextpts.h" +#include "Uncopyable.h" // ================================== const uint32_t UNKNOWN_CHANNEL_COUNT = 0xFFFFFFFF; @@ -115,8 +116,7 @@ private: }; // ================================== -class cDxr3SyncBuffer : public cRingBuffer -{ +class cDxr3SyncBuffer : public cRingBuffer, private Uncopyable { public: enum eSyncBufferException { @@ -185,7 +185,6 @@ protected: private: cDxr3SyncBuffer(); // you are not allowed to use this constructor - cDxr3SyncBuffer(cDxr3SyncBuffer&); // no constructor }; #endif /*_DXR3SYNCBUFFER_H_*/ |