internal MediaPacketVideoPlane(MediaPacket packet, int index) { Debug.Assert(packet != null, "The packet is null!"); Debug.Assert(!packet.IsDisposed, "Packet is already disposed!"); Debug.Assert(index >= 0, "Video plane index must not be negative!"); _packet = packet; int ret = Interop.MediaPacket.GetVideoStrideWidth(packet.GetHandle(), index, out _strideWidth); MultimediaDebug.AssertNoError(ret); ret = Interop.MediaPacket.GetVideoStrideHeight(packet.GetHandle(), index, out _strideHeight); MultimediaDebug.AssertNoError(ret); Debug.Assert(_strideWidth >= 0 && _strideHeight >= 0, "size must not be negative!"); IntPtr dataHandle; ret = Interop.MediaPacket.GetVideoPlaneData(packet.GetHandle(), index, out dataHandle); MultimediaDebug.AssertNoError(ret); Debug.Assert(dataHandle != IntPtr.Zero, "Data handle is invalid!"); _buffer = new DependentMediaBuffer(packet, dataHandle, _strideWidth * _strideHeight); }
/// <summary> /// Pushes elementary stream to decode audio or video. /// </summary> /// <remarks>This source must be set as a source to a player and the player must be in the <see cref="PlayerState.Ready"/>, /// <see cref="PlayerState.Playing"/>, or <see cref="PlayerState.Paused"/> state.</remarks> /// <param name="packet">The <see cref="MediaPacket"/> to decode.</param> /// <exception cref="InvalidOperationException"> /// This source is not set as a source to a player.<br/> /// -or-<br/> /// The player is not in the valid state. /// </exception> /// <exception cref="ArgumentNullException"><paramref name="packet"/> is null.</exception> /// <exception cref="ObjectDisposedException"><paramref name="packet"/> has been disposed of.</exception> /// <exception cref="ArgumentException"> /// <paramref name="packet"/> is neither video nor audio type.<br/> /// -or-<br/> /// The format of packet is not matched with the specified format in the constructor. /// </exception> /// <exception cref="NoBufferSpaceException">The internal buffer has reached its limits.</exception> /// <seealso cref="Player.SetSource(MediaSource)"/> /// <seealso cref="MediaStreamConfiguration.BufferMaxSize"/> /// <seealso cref="MediaPacket"/> /// <since_tizen> 3 </since_tizen> public void Push(MediaPacket packet) { if (_player == null) { Log.Error(PlayerLog.Tag, "The source is not set as a source to a player yet."); throw new InvalidOperationException("The source is not set as a source to a player yet."); } if (packet == null) { Log.Error(PlayerLog.Tag, "packet is null"); throw new ArgumentNullException(nameof(packet)); } if (packet.IsDisposed) { Log.Error(PlayerLog.Tag, "packet is disposed"); throw new ObjectDisposedException(nameof(packet)); } if (packet.Format.Type == MediaFormatType.Text || packet.Format.Type == MediaFormatType.Container) { Log.Error(PlayerLog.Tag, "The format of the packet is invalid : " + packet.Format.Type); throw new ArgumentException($"The format of the packet is invalid : { packet.Format.Type }."); } if (!packet.Format.Equals(_audioMediaFormat) && !packet.Format.Equals(_videoMediaFormat)) { Log.Error(PlayerLog.Tag, "The format of the packet is invalid : Unmatched format."); throw new ArgumentException($"The format of the packet is invalid : Unmatched format."); } if (packet.Format.Type == MediaFormatType.Video && _videoMediaFormat == null) { Log.Error(PlayerLog.Tag, "Video is not configured with the current source."); throw new ArgumentException("Video is not configured with the current source."); } if (packet.Format.Type == MediaFormatType.Audio && _audioMediaFormat == null) { Log.Error(PlayerLog.Tag, "Audio is not configured with the current source."); throw new ArgumentException("Audio is not configured with the current source."); } _player.ValidatePlayerState(PlayerState.Paused, PlayerState.Playing, PlayerState.Ready); NativePlayer.PushMediaStream(_player.Handle, packet.GetHandle()). ThrowIfFailed(_player, "Failed to push the packet to the player"); }
internal IntPtr GetHandle() { return(_packet.GetHandle()); }
internal IntPtr GetHandle() => _packet.GetHandle();