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 * Name : pv_2way_track_info_impl.h 21 * Part of : 22 * Interface : 23 * Description : Interface class and supporting definitions for the PV2Way SDK 24 * Version : (see RELEASE field in copyright header above) 25 * 26 * ============================================================================== 27 */ 28 29 #ifndef PV_2WAY_TRACK_INFO_IMPL_H_INCLUDED 30 #define PV_2WAY_TRACK_INFO_IMPL_H_INCLUDED 31 32 33 #include "pv_2way_basic_interfaces.h" 34 35 36 class PV2WayTrackInfoImpl : public PV2WayTrackInfoInterface 37 38 { 39 40 private: 41 42 PVMFFormatType iMimeString; 43 uint8* iFormatSpecificInfo; 44 uint32 iFormatSpecificInfoLen; 45 int32 iEventCode; 46 PVUuid iEventUuid; 47 int32 iRefCount; 48 49 public: 50 51 PV2WayTrackInfoImpl(PVMFFormatType aMimeString, uint8* aFormatSpecificInfo, uint32 aFormatSpecificInfoLen, int32 aCode, PVUuid aUuid): iRefCount(1) 52 { 53 iMimeString = aMimeString; 54 55 iFormatSpecificInfo = aFormatSpecificInfo; 56 iFormatSpecificInfoLen = aFormatSpecificInfoLen; 57 iEventCode = aCode; 58 iEventUuid = aUuid; 59 } 60 61 /* 62 Returns the code and space UUID for this info message 63 64 @param aCode Reference to an integer which will be filled in with event code 65 @param aUuid Reference to a PVUuid which will be filled in with UUID assocated to event code 66 67 @return None 68 */ 69 virtual void GetCodeUUID(int32& aCode, PVUuid& aUuid) 70 { 71 aCode = iEventCode; 72 aUuid = iEventUuid; 73 } 74 75 /* 76 Returns a reference to the format string. 77 78 @return Reference to the format string 79 */ 80 81 virtual void GetFormatString(PVMFFormatType& aMimeString) 82 { 83 84 aMimeString = iMimeString; 85 } 86 87 88 /* Returns the Format Specific Info associated with this track 89 90 @return A pointer to the Format Specific Info. NULL if FSI is not present 91 */ 92 93 virtual uint8* GetFormatSpecificInfo(uint32& aFormatSpecificInfoLen) 94 { 95 if (aFormatSpecificInfoLen == 0 || iFormatSpecificInfo == NULL) 96 { 97 aFormatSpecificInfoLen = 0; 98 return NULL; 99 } 100 aFormatSpecificInfoLen = iFormatSpecificInfoLen; 101 return iFormatSpecificInfo; 102 } 103 104 // From PVInterface 105 106 /* 107 Increments the reference count for this info message object 108 */ 109 110 virtual void addRef() 111 { 112 ++iRefCount; 113 } 114 115 /* 116 Decrements the reference count for this info message object and deletes 117 this object if count goes to 0. 118 */ 119 120 virtual void removeRef() 121 { 122 --iRefCount; 123 if (iRefCount == 0) 124 { 125 OSCL_DELETE(this); 126 } 127 } 128 129 /* 130 Returns the extension interface for the specified UUID if this info 131 message object supports it. If the requested extension interface is supported 132 true is returned, else false. 133 */ 134 135 virtual bool queryInterface(const PVUuid& uuid, PVInterface*& iface) 136 { 137 if (uuid == PV2WayTrackInfoInterfaceUUID) 138 { 139 PV2WayTrackInfoInterface* myInterface = OSCL_STATIC_CAST(PV2WayTrackInfoInterface*, this); 140 iface = OSCL_STATIC_CAST(PVInterface*, myInterface); 141 } 142 else 143 { 144 return false; 145 } 146 147 return true; 148 } 149 }; 150 151 #endif 152