1 /* ------------------------------------------------------------------ 2 * Copyright (C) 1998-2009 PacketVideo 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 * express or implied. 14 * See the License for the specific language governing permissions 15 * and limitations under the License. 16 * ------------------------------------------------------------------- 17 */ 18 /*********************************************************************************/ 19 /* ------------------------------------------------------------------- */ 20 /* MPEG-4 Util: IMediaBuffer */ 21 /* ------------------------------------------------------------------- */ 22 /*********************************************************************************/ 23 /* 24 This IMediaBuffer Class is the interface that consumers of MediaBuffers will 25 use. This includes PVPlayer and PVServer. It is mainly used when retrieving 26 Mpeg-4 data from file and returning a data buffer to either PVPlayer or 27 PVServer. 28 */ 29 30 31 #ifndef IMEDIABUFFER_H_INCLUDED 32 #define IMEDIABUFFER_H_INCLUDED 33 34 #ifndef OSCL_BASE_H_INCLUDED 35 #include "oscl_base.h" 36 #endif 37 38 #ifndef OSCL_FILE_IO_H_INCLUDED 39 #include "oscl_file_io.h" 40 #endif 41 42 class IMediaBuffer 43 { 44 45 public: ~IMediaBuffer()46 virtual ~IMediaBuffer() {}; // So destructor of MediaBuffer gets called 47 48 // Member get methods 49 50 // Returns the size of the data in the buffer 51 virtual uint32 getSize() const = 0; 52 53 // Returns a pointer to the data in the buffer 54 virtual uint8 *getDataPtr() = 0; 55 // Returns a read-only pointer to the data in the buffer - USE THIS METHOD 56 virtual uint8 *getReadOnlyDataPtr() const = 0; 57 58 // This method MUST be called when you are done with the buffer. This allows 59 // the underlying buffer manager to handle memory management by reusing the 60 // buffer when you are done. 61 virtual void freeBuf() = 0; 62 63 }; 64 65 #endif // IMEDIABUFFER_H_INCLUDED 66 67