001/* ---------------------------------------------------------------------------- 002 * This file was automatically generated by SWIG (http://www.swig.org). 003 * Version 4.0.2 004 * 005 * Do not make changes to this file unless you know what you are doing--modify 006 * the SWIG interface file instead. 007 * ----------------------------------------------------------------------------- */ 008 009package com.avpkit.core; 010import com.avpkit.ferry.*; 011/** 012 * This class wraps an IMediaData object, but then allows you to set<br> 013 * new TimeStamps and TimeBases.<br> 014 * <br> 015 * The underlying wrapped object's time stamps and time bases do not change. This<br> 016 * can be useful when you need to use a IMediaObject in a time space that has<br> 017 * different time bases than the frame originally expected, and you don't<br> 018 * want to change the actual object. 019 */ 020public class IMediaDataWrapper extends IMediaData { 021 // JNIHelper.swg: Start generated code 022 // >>>>>>>>>>>>>>>>>>>>>>>>>>> 023 /** 024 * This method is only here to use some references and remove 025 * a Eclipse compiler warning. 026 */ 027 @SuppressWarnings("unused") 028 private void noop() 029 { 030 IBuffer.make(null, 1); 031 } 032 033 private volatile long swigCPtr; 034 035 /** 036 * Internal Only. 037 */ 038 protected IMediaDataWrapper(long cPtr, boolean cMemoryOwn) { 039 super(AVPKitJNI.IMediaDataWrapper_SWIGUpcast(cPtr), cMemoryOwn); 040 swigCPtr = cPtr; 041 } 042 043 /** 044 * Internal Only. 045 */ 046 protected IMediaDataWrapper(long cPtr, boolean cMemoryOwn, 047 java.util.concurrent.atomic.AtomicLong ref) 048 { 049 super(AVPKitJNI.IMediaDataWrapper_SWIGUpcast(cPtr), 050 cMemoryOwn, ref); 051 swigCPtr = cPtr; 052 } 053 054 /** 055 * Internal Only. Not part of public API. 056 * 057 * Get the raw value of the native object that obj is proxying for. 058 * 059 * @param obj The java proxy object for a native object. 060 * @return The raw pointer obj is proxying for. 061 */ 062 public static long getCPtr(IMediaDataWrapper obj) { 063 if (obj == null) return 0; 064 return obj.getMyCPtr(); 065 } 066 067 /** 068 * Internal Only. Not part of public API. 069 * 070 * Get the raw value of the native object that we're proxying for. 071 * 072 * @return The raw pointer we're proxying for. 073 */ 074 public long getMyCPtr() { 075 if (swigCPtr == 0) throw new IllegalStateException("underlying native object already deleted"); 076 return swigCPtr; 077 } 078 079 /** 080 * Create a new IMediaDataWrapper object that is actually referring to the 081 * exact same underlying native object. 082 * 083 * @return the new Java object. 084 */ 085 @Override 086 public IMediaDataWrapper copyReference() { 087 if (swigCPtr == 0) 088 return null; 089 else 090 return new IMediaDataWrapper(swigCPtr, swigCMemOwn, getJavaRefCount()); 091 } 092 093 /** 094 * Compares two values, returning true if the underlying objects in native code are the same object. 095 * 096 * That means you can have two different Java objects, but when you do a comparison, you'll find out 097 * they are the EXACT same object. 098 * 099 * @return True if the underlying native object is the same. False otherwise. 100 */ 101 public boolean equals(Object obj) { 102 boolean equal = false; 103 if (obj instanceof IMediaDataWrapper) 104 equal = (((IMediaDataWrapper)obj).swigCPtr == this.swigCPtr); 105 return equal; 106 } 107 108 /** 109 * Get a hashable value for this object. 110 * 111 * @return the hashable value. 112 */ 113 public int hashCode() { 114 return (int)swigCPtr; 115 } 116 117 // <<<<<<<<<<<<<<<<<<<<<<<<<<< 118 // JNIHelper.swg: End generated code 119 120 121 /** 122 * Return the object being wrapped 123 * 124 * @return the wrapped object 125 */ 126 public IMediaData get() 127 { 128 IMediaData retval = null; 129 if ((retval = getVideoPicture()) == null) 130 if ((retval = getAudioSamples()) == null) 131 if ((retval = getPacket()) == null) 132 if ((retval = getMediaDataWrapper()) == null) 133 retval = null; 134 return retval; 135 } 136 137 /** 138 * Gets the non IMediaDataWrapper object ultimately wrapped in this 139 * wrapper, or null if there isn't one. 140 * 141 * @return The non IMediaDataWrapper object ultimately wrapped 142 */ 143 public IMediaData unwrap() 144 { 145 IMediaData retval = null; 146 if ((retval = unwrapVideoPicture()) == null) 147 if ((retval = unwrapAudioSamples()) == null) 148 if ((retval = unwrapPacket()) == null) 149 if ((retval = unwrapMediaDataWrapper()) == null) 150 retval = null; 151 return retval; 152 } 153 154 /** 155 * Set an object to wrap, or null to release the old object.<br> 156 * <br> 157 * @param aObj The object to wrap; null just releases the last object 158 */ 159 public void wrap(IMediaData aObj) { 160 AVPKitJNI.IMediaDataWrapper_wrap(swigCPtr, this, IMediaData.getCPtr(aObj), aObj); 161 } 162 163 /** 164 * Allows you to reset whether the wrapper things this is key or not.<br> 165 * <br> 166 * Note the underlying wrapped object will continue to keep it's prior setting.<br> 167 * <br> 168 * @param aIsKey The new key value. 169 */ 170 public void setKey(boolean aIsKey) { 171 AVPKitJNI.IMediaDataWrapper_setKey(swigCPtr, this, aIsKey); 172 } 173 174 /** 175 * Create a new IMediaDataWrapper object that wraps the given obj.<br> 176 * <br> 177 * @param obj The object to wrap.<br> 178 * @return a new object or null on error. 179 */ 180 public static IMediaDataWrapper make(IMediaData obj) { 181 long cPtr = AVPKitJNI.IMediaDataWrapper_make(IMediaData.getCPtr(obj), obj); 182 return (cPtr == 0) ? null : new IMediaDataWrapper(cPtr, false); 183 } 184 185 protected IPacket getPacket() { 186 long cPtr = AVPKitJNI.IMediaDataWrapper_getPacket(swigCPtr, this); 187 return (cPtr == 0) ? null : new IPacket(cPtr, false); 188 } 189 190 protected IAudioSamples getAudioSamples() { 191 long cPtr = AVPKitJNI.IMediaDataWrapper_getAudioSamples(swigCPtr, this); 192 return (cPtr == 0) ? null : new IAudioSamples(cPtr, false); 193 } 194 195 protected IVideoPicture getVideoPicture() { 196 long cPtr = AVPKitJNI.IMediaDataWrapper_getVideoPicture(swigCPtr, this); 197 return (cPtr == 0) ? null : new IVideoPicture(cPtr, false); 198 } 199 200 protected IMediaDataWrapper getMediaDataWrapper() { 201 long cPtr = AVPKitJNI.IMediaDataWrapper_getMediaDataWrapper(swigCPtr, this); 202 return (cPtr == 0) ? null : new IMediaDataWrapper(cPtr, false); 203 } 204 205 protected IPacket unwrapPacket() { 206 long cPtr = AVPKitJNI.IMediaDataWrapper_unwrapPacket(swigCPtr, this); 207 return (cPtr == 0) ? null : new IPacket(cPtr, false); 208 } 209 210 protected IAudioSamples unwrapAudioSamples() { 211 long cPtr = AVPKitJNI.IMediaDataWrapper_unwrapAudioSamples(swigCPtr, this); 212 return (cPtr == 0) ? null : new IAudioSamples(cPtr, false); 213 } 214 215 protected IVideoPicture unwrapVideoPicture() { 216 long cPtr = AVPKitJNI.IMediaDataWrapper_unwrapVideoPicture(swigCPtr, this); 217 return (cPtr == 0) ? null : new IVideoPicture(cPtr, false); 218 } 219 220 protected IMediaDataWrapper unwrapMediaDataWrapper() { 221 long cPtr = AVPKitJNI.IMediaDataWrapper_unwrapMediaDataWrapper(swigCPtr, this); 222 return (cPtr == 0) ? null : new IMediaDataWrapper(cPtr, false); 223 } 224 225}