/// <summary> /// Adds the packet to the internal queue of the codec. /// </summary> /// <param name="packet">The packet to be encoded or decoded.</param> /// <feature>http://tizen.org/feature/multimedia.media_codec</feature> /// <exception cref="NotSupportedException">The required feature is not supported.</exception> /// <exception cref="ArgumentNullException"><paramref name="packet"/> is null.</exception> /// <exception cref="InvalidOperationException">The current codec is not prepared yet.</exception> /// <remarks>Any attempts to modify the packet will fail until the <see cref="InputProcessed"/> event for the packet is invoked.</remarks> /// <since_tizen> 3 </since_tizen> public void ProcessInput(MediaPacket packet) { ValidateNotDisposed(); if (packet == null) { throw new ArgumentNullException(nameof(packet)); } MediaPacket.Lock packetLock = MediaPacket.Lock.Get(packet); Native.Process(_handle, packetLock.GetHandle(), 0).ThrowIfFailed("Failed to process input.");; }
/// <summary> /// Adds the packet to the internal queue of the codec. /// </summary> /// <param name="packet">The packet to be encoded or decoded.</param> /// <exception cref="ArgumentNullException"><paramref name="packet"/> is null.</exception> /// <exception cref="InvalidOperationException">The current codec is not prepared yet.</exception> /// <remarks>Any attempts to modify the packet will fail until the <see cref="InputProcessed"/> event for the packet is invoked.</remarks> /// <since_tizen> 3 </since_tizen> public void ProcessInput(MediaPacket packet) { ValidateNotDisposed(); if (packet == null) { throw new ArgumentNullException(nameof(packet)); } MediaPacket.Lock packetLock = MediaPacket.Lock.Get(packet); int ret = Interop.MediaCodec.Process(_handle, packetLock.GetHandle(), 0); if (ret == (int)MediaCodecErrorCode.InvalidState) { throw new InvalidOperationException("The codec is in invalid state."); } MultimediaDebug.AssertNoError(ret); }
private void RegisterInputProcessed() { _inputBufferUsedCb = (lockedPacketHandle, _) => { MediaPacket packet = null; // Lock must be disposed here, note that the packet won't be disposed. using (MediaPacket.Lock packetLock = MediaPacket.Lock.FromHandle(lockedPacketHandle)) { Debug.Assert(packetLock != null); packet = packetLock.MediaPacket; } Debug.Assert(packet != null); InputProcessed?.Invoke(this, new InputProcessedEventArgs(packet)); }; Native.SetInputBufferUsedCb(_handle, _inputBufferUsedCb). ThrowIfFailed("Failed to set input buffer used callback."); }
private void RegisterInputProcessed() { _inputBufferUsedCb = (lockedPacketHandle, _) => { MediaPacket packet = null; // Lock must be disposed here, note that the packet won't be disposed. using (MediaPacket.Lock packetLock = MediaPacket.Lock.FromHandle(lockedPacketHandle)) { Debug.Assert(packetLock != null); packet = packetLock.MediaPacket; } Debug.Assert(packet != null); InputProcessed?.Invoke(this, new InputProcessedEventArgs(packet)); }; int ret = Interop.MediaCodec.SetInputBufferUsedCb(_handle, _inputBufferUsedCb); MultimediaDebug.AssertNoError(ret); }