private string GetCodecInfo(bool audioInfo) { Player.ValidatePlayerState(PlayerState.Ready, PlayerState.Playing, PlayerState.Paused); IntPtr audioPtr = IntPtr.Zero; IntPtr videoPtr = IntPtr.Zero; try { NativePlayer.GetCodecInfo(Player.Handle, out audioPtr, out videoPtr). ThrowIfFailed("Failed to get codec info"); if (audioInfo) { Log.Debug(PlayerLog.Tag, "it is audio case"); return(Marshal.PtrToStringAnsi(audioPtr)); } else { Log.Debug(PlayerLog.Tag, "it is video case"); return(Marshal.PtrToStringAnsi(videoPtr)); } } finally { LibcSupport.Free(audioPtr); LibcSupport.Free(videoPtr); } }