• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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: MediaBuffer                           */
21 /*     -------------------------------------------------------------------       */
22 /*********************************************************************************/
23 /*
24     This MediaBuffer Class is the implementation of the IMediaBuffer interface
25     that contains the guts of the data handling of media data.
26 */
27 
28 
29 #ifndef MEDIABUFFER_H_INCLUDED
30 #define MEDIABUFFER_H_INCLUDED
31 
32 #ifndef OSCL_BASE_H_INCLUDED
33 #include "oscl_base.h"
34 #endif
35 
36 #ifndef OSCL_FILE_IO_H_INCLUDED
37 #include "oscl_file_io.h"
38 #endif
39 
40 #ifndef IMEDIABUFFER_H_INCLUDED
41 #include "imediabuffer.h"
42 #endif
43 
44 #ifndef MEDIABUFFERMANAGER_H_INCLUDED
45 #include "mediabuffermanager.h"
46 #endif
47 
48 #ifndef ATOMUTILS_H_INCLUDED
49 #include "atomutils.h"
50 #endif
51 
52 
53 class MediaBufferManager; // Forward lookahead for circular includes
54 
55 
56 class MediaBuffer : public IMediaBuffer
57 {
58 
59     public:
60         MediaBuffer(int32 size); // Constructor
61         virtual ~MediaBuffer(); // Destructor
62 
63         // Member set method
setSize(uint32 size)64         void setSize(uint32 size)
65         {
66             _size = size;
67         }
68 
69         // Member get methods
getSize()70         virtual uint32 getSize() const
71         {
72             return _size;
73         }
getDataPtr()74         virtual uint8 *getDataPtr()
75         {
76             return _pdata;
77         }
getReadOnlyDataPtr()78         virtual uint8 *getReadOnlyDataPtr() const
79         {
80             return _pdata;
81         }
82 
83         virtual void freeBuf();
84         void setOwner(MediaBufferManager *);
85 
86         void readByteData(MP4_FF_FILE *fp, uint32 size);
87 
88     private:
89 
90         uint8 *_pdata;
91         uint32 _size;
92 
93         MediaBufferManager *_owner;
94 };
95 
96 #endif // MEDIABUFFER_H_INCLUDED
97 
98 
99