This commit is contained in:
王志勋 2025-11-04 17:37:21 +08:00
parent 44f7d21ec7
commit 1fdea7cbb3
28 changed files with 50 additions and 50 deletions

View File

@ -2146,8 +2146,8 @@ namespace HighlightPlus {
fxMat.mainTexture = matTexture;
fxMat.mainTextureOffset = matTextureOffset;
fxMat.mainTextureScale = matTextureScale;
//}
// if (!Application.isMobilePlatform) { // TODO: currently this does not work with URP on Android
if ((glow > 0 && glowQuality == QualityLevel.Highest && glowVisibility == Visibility.Normal) || (outline > 0 && outlineQuality == QualityLevel.Highest && outlineVisibility == Visibility.Normal)) {
fxMat.EnableKeyword(ShaderParams.SKW_DEPTHCLIP);
} else {

View File

@ -28,7 +28,7 @@ namespace RenderHeads.Media.AVProVideo.Demos.UI
_segments = new float[] { 0f, 0f };
}
// TODO: detect whether a change actually occured before setting to dirty
SetVerticesDirty();
}

View File

@ -447,7 +447,7 @@ namespace RenderHeads.Media.AVProVideo.Demos
}
else
{
// TODO: instead of activating the first one, base it on the language/track
// selection stored in the MediaPlayerUI
_mediaPlayer.TextTracks.SetActiveTextTrack(_mediaPlayer.TextTracks.GetTextTracks()[0]);
}

View File

@ -419,7 +419,7 @@ namespace RenderHeads.Media.AVProVideo.Editor
UnityEditorInternal.InternalEditorUtility.RepaintAllViews();
GL.sRGBWrite = originalSRGBWrite;
}
// TODO: OnDisable - stop the video if it's playing (and unload it?)
#endif
}

View File

@ -18,7 +18,7 @@ namespace RenderHeads.Media.AVProVideo.Editor
private void OnInspectorGUI_SelectPlatform()
{
// TODO: support multiple targets?
MediaPlayer media = (this.target) as MediaPlayer;
int i = 0;

View File

@ -405,7 +405,7 @@ namespace RenderHeads.Media.AVProVideo.Editor
{
if (texture != EditorGUIUtility.whiteTexture)
{
// TODO: In Linear mode, this displays the texture too bright, but GUI.DrawTexture displays it correctly
//GL.sRGBWrite = true;
//GUI.DrawTexture(textureRect, rt, ScaleMode.ScaleToFit, false);
@ -751,7 +751,7 @@ namespace RenderHeads.Media.AVProVideo.Editor
{
if (!_showAlpha)
{
// TODO: In Linear mode, this displays the texture too bright, but GUI.DrawTexture displays it correctly
EditorGUI.DrawTextureTransparent(textureRect, texture, ScaleMode.ScaleToFit);
}
else

View File

@ -25,7 +25,7 @@ namespace RenderHeads.Media.AVProVideo.Editor
newUrl = newUrl.Trim();
if (EditorHelper.SafeSetPathProperty(newUrl, propPath))
{
// TODO: shouldn't we set all targets?
EditorUtility.SetDirty(property.serializedObject.targetObject);
}
MediaPlayerEditor.ShowFileWarningMessages(propPath.stringValue, (MediaPathType)propPathType.enumValueIndex, null, MediaSource.Path, false, Platform.Unknown);

View File

@ -162,7 +162,7 @@ namespace RenderHeads.Media.AVProVideo.Editor
string path = items[i];
// Slashes in path must be replaced as they cause the menu to create submenuts
string itemName = ReplaceSlashes(path);
// TODO: shorten if itemName too long
if (System.IO.File.Exists(path))
{
menu.AddItem(new GUIContent(prefix + itemName), false, Callback_Select, new RecentMenuItemData(path, propPath, propMediaSource, autoLoadMedia));

View File

@ -141,7 +141,7 @@ namespace RenderHeads.Media.AVProVideo
LateUpdate();
break;
}
// TODO: remove this, we're just doing this so we can make sure texture is correct when running in EDIT mode
LateUpdate();
}
@ -419,7 +419,7 @@ namespace RenderHeads.Media.AVProVideo
if (material != null && _mediaPlayer != null)
{
// TODO: only run when dirty
VideoRender.SetupMaterialForMedia(materialForRendering, _mediaPlayer);
}
}

View File

@ -45,7 +45,7 @@ namespace RenderHeads.Media.AVProVideo
void Update()
{
// TODO: Currently we need to call this each frame, as when it is called right after SetText()
// the ContentSizeFitter hasn't run yet, so effectively the box is a frame behind.
UpdateBackgroundRect();
}

View File

@ -50,7 +50,7 @@ namespace RenderHeads.Media.AVProVideo
if (_texturePropertyName != value)
{
_texturePropertyName = value;
// TODO: if the property changes, remove it from the perioud SetTexture()
_propTexture = new LazyShaderProperty(_texturePropertyName);
_isDirty = true;
}

View File

@ -14,7 +14,7 @@ namespace RenderHeads.Media.AVProVideo
[HelpURL("https://www.renderheads.com/products/avpro-video/")]
public sealed class ApplyToMesh : ApplyToBase
{
// TODO: add specific material / material index to target in the mesh if there are multiple materials
[Space(8f)]
[Header("Display")]
@ -81,7 +81,7 @@ namespace RenderHeads.Media.AVProVideo
if (_texturePropertyName != value)
{
_texturePropertyName = value;
// TODO: if the property changes, remove it from the perioud SetTexture()
_propTexture = new LazyShaderProperty(_texturePropertyName);
_isDirty = true;
}

View File

@ -248,7 +248,7 @@ namespace RenderHeads.Media.AVProVideo
if (_material != null)
{
// TODO: Only setup material when needed
VideoRender.SetupMaterialForMedia(_material, _mediaPlayer);
// NOTE: It seems that Graphics.DrawTexture() behaves differently than GUI.DrawTexture() when it comes to sRGB writing

View File

@ -398,7 +398,7 @@ namespace RenderHeads.Media.AVProVideo
{
if (_persistent)
{
// TODO: set "this.transform.root.gameObject" to also DontDestroyOnLoad?
DontDestroyOnLoad(this.gameObject);
}
}
@ -520,7 +520,7 @@ namespace RenderHeads.Media.AVProVideo
_isMediaOpened = true;
_autoPlayOnStartTriggered = !_autoPlayOnStart;
_finishedFrameOpenCheck = true;
long fileOffset = GetPlatformFileOffset(); // TODO: replace this with MediaReference
long fileOffset = GetPlatformFileOffset();
MediaPath mediaPath = null;
MediaHints mediaHints = _fallbackMediaHints;
@ -922,7 +922,7 @@ namespace RenderHeads.Media.AVProVideo
_resampler = null;
}
// TODO: possible bug if MediaPlayers are created and destroyed manually (instantiated), OnApplicationQuit won't be called!
}
public void ForceDispose()
@ -1373,7 +1373,7 @@ namespace RenderHeads.Media.AVProVideo
private void UpdateAudioFocus()
{
// TODO: we could use gizmos to draw the focus area
_controlInterface.SetAudioFocusEnabled(_audioFocusEnabled);
_controlInterface.SetAudioFocusProperties(_audioFocusOffLevelDB, _audioFocusWidthDegrees);
_controlInterface.SetAudioFocusRotation(_audioFocusTransform == null ? Quaternion.identity : _audioFocusTransform.rotation);
@ -1402,7 +1402,7 @@ namespace RenderHeads.Media.AVProVideo
if (ErrorCode.LoadFailed == errorCode)
{
#if !UNITY_EDITOR && UNITY_ANDROID
// TODO: Update this to handle case where media is MediaReference
if (_mediaPath.Path.ToLower().Contains("http://"))
{
Debug.LogError("Android 8 and above require HTTPS by default, change to HTTPS or enable ClearText in the AndroidManifest.xml");

View File

@ -614,7 +614,7 @@ namespace RenderHeads.Media.AVProVideo
public override byte[] GetOverrideDecryptionKey() { return null; }
}
// TODO: move these to a Setup object
[SerializeField] OptionsWindows _optionsWindows = new OptionsWindows();
[SerializeField] OptionsApple _optionsMacOSX = new OptionsApple(OptionsApple.TextureFormat.BGRA, OptionsApple.Flags.None);
[SerializeField] OptionsApple _optionsIOS = new OptionsApple(OptionsApple.TextureFormat.BGRA, OptionsApple.Flags.None);

View File

@ -36,7 +36,7 @@ namespace RenderHeads.Media.AVProVideo
// Handle looping
if (_controlInterface.IsLooping() && _timeScaleVideoTime >= Info.GetDuration())
{
// TODO: really we should seek to (_timeScaleVideoTime % Info.GetDuration())
_timeScaleVideoTime = 0.0;
}

View File

@ -614,8 +614,8 @@ namespace RenderHeads.Media.AVProVideo
NextPlayer.AudioVolume = (1f - t) * this.AudioVolume;
CurrentPlayer.AudioVolume = t * this.AudioVolume;
// TODO: support going from mono to stereo
// TODO: support videos of different aspect ratios by rendering with scaling to fit
// This can be done by blitting twice, once for each eye
// If the stereo mode is different for playera/b then both should be set to stereo during the transition
// if (CurrentPlayer.m_StereoPacking == StereoPacking.TopBottom)....
@ -663,7 +663,7 @@ namespace RenderHeads.Media.AVProVideo
#region Implementing ITextureProducer
public Texture GetTexture(int index = 0)
{
// TODO: support iOS YCbCr by supporting multiple textures
/*if (!IsTransitioning())
{
if (_currentItem != null && _currentItem.sourceType == MediaPlaylist.MediaItem.SourceType.Texture2D && _currentItem.texture != null)

View File

@ -491,7 +491,7 @@ namespace RenderHeads.Media.AVProVideo
{
double time = GetCurrentTime();
// TODO: implement a more efficient subtitle index searcher
int searchIndex = 0;
if (_currentSubtitle != null)
{

View File

@ -37,7 +37,7 @@ namespace RenderHeads.Media.AVProVideo
TextTracksChanged, // Triggered when the text tracks are added or removed
TextCueChanged = SubtitleChange, // Triggered when the text to display changes
// TODO:
//StartLoop, // Triggered when the video starts and is in loop mode
//EndLoop, // Triggered when the video ends and is in loop mode
//NewFrame // Trigger when a new video frame is available

View File

@ -89,7 +89,7 @@ namespace RenderHeads.Media.AVProVideo
for (int i = 0; i < areas.Length; i++)
{
int d = Mathf.Abs(areas[i] - area);
// TODO: add a maximum threshold to ignore differences that are too high
if (d < minDelta)
{
closestAreaIndex = i;
@ -368,7 +368,7 @@ namespace RenderHeads.Media.AVProVideo
frameRate = Mathf.Max(0f, frameRate);
keyFrameInterval = Mathf.Max(0, keyFrameInterval);
int currentFrame = Helper.ConvertTimeSecondsToFrame(seconds, frameRate);
// TODO: allow specifying a minimum number of frames so that if currentFrame is too close to nextKeyFrame, it will calculate the next-next keyframe
int nextKeyFrame = keyFrameInterval * Mathf.CeilToInt((float)(currentFrame + 1) / (float)keyFrameInterval);
return Helper.ConvertFrameToTimeSeconds(nextKeyFrame, frameRate);
}

View File

@ -15,10 +15,10 @@ using System.Runtime.InteropServices;
namespace RenderHeads.Media.AVProVideo
{
/// <summary>
/// Android implementation of BaseMediaPlayer
/// </summary>
// TODO: seal this class
public class AndroidMediaPlayer : BaseMediaPlayer
{
protected static AndroidJavaObject s_ActivityContext = null;

View File

@ -670,7 +670,7 @@ namespace RenderHeads.Media.AVProVideo
int textureId = 80000 + _playerIndex;
_cachedTextureNativePtr = new System.IntPtr(textureId);
AVPPlayerCreateVideoTexture(textureId);
// TODO: add support for mip generation
_texture = Texture2D.CreateExternalTexture(_width, _height, TextureFormat.RGBA32, false, false, _cachedTextureNativePtr);
if (_useTextureMips)
{
@ -743,7 +743,7 @@ namespace RenderHeads.Media.AVProVideo
// Update the texture
if (_cachedTextureNativePtr != System.IntPtr.Zero)
{
// TODO: only update the texture when the frame count changes
// (actually this will break the update for certain browsers such as edge and possibly safari - Sunrise)
AVPPlayerFetchVideoTexture(_playerIndex, _cachedTextureNativePtr, false);
@ -767,7 +767,7 @@ namespace RenderHeads.Media.AVProVideo
_isDirtyAudioTracks = false;
_isDirtyTextTracks = false;
// TODO: replace this crude polling check with events, or only do it once metadataReady
// Need to add event support as tracks can be added via HTML (especially text)
int videoTrackCount = AVPPlayerGetVideoTrackCount(_playerIndex);
int audioTrackCount = AVPPlayerGetAudioTrackCount(_playerIndex);

View File

@ -92,7 +92,7 @@ namespace RenderHeads.Media.AVProVideo
}
else
{
// TODO: run without vsync, just show next frame (use media clock for present?)
// use our own clock...
const double SecondsToHNS = 10000000.0;
double videoFrameDuration = SecondsToHNS / (double)GetVideoFrameRate();

View File

@ -287,7 +287,7 @@ namespace RenderHeads.Media.AVProVideo
Native.SetAudioMuted(_playerInstance, bMuted);
}
// TODO: replace all these options with a structure
public override bool OpenMedia(string path, long offset, string httpHeader, MediaHints mediaHints, int forceFileFormat = 0, bool startWithHighestBitrate = false)
{
bool result = false;
@ -371,13 +371,13 @@ namespace RenderHeads.Media.AVProVideo
if (isNewFrameSpecs)
{
eyeTexture.Dispose();
// TODO: blit from the old texture to the new texture before destroying?
}
/// Switch to the latest texture pointer
if (eyeTexture.texture != null)
{
// TODO: check whether UpdateExternalTexture resets the sampling filter to POINT - it seems to in Unity 5.6.6
if (eyeTexture.nativePointer != texturePointer)
{
eyeTexture.texture.UpdateExternalTexture(texturePointer);
@ -762,7 +762,7 @@ namespace RenderHeads.Media.AVProVideo
{
Fast = 0,
Accurate = 1,
// TODO: Add Fast_Before and Fast_After
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
@ -774,7 +774,7 @@ namespace RenderHeads.Media.AVProVideo
public float frameRate;
public uint averageBitRate;
//public string trackName;
// TODO: add index, language, name, bitrate, codec etc
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
@ -786,7 +786,7 @@ namespace RenderHeads.Media.AVProVideo
public uint bitsPerSample;
public uint averageBitRate;
//public string trackName;
// TODO: add index, language, name, bitrate, codec etc
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
@ -794,7 +794,7 @@ namespace RenderHeads.Media.AVProVideo
{
public double timeSeconds;
public SeekMode mode;
// TODO: add min-max thresholds
}
[DllImport("AVProVideoWinRT")]

View File

@ -61,7 +61,7 @@ namespace RenderHeads.Media.AVProVideo
{
return false;
}
// TODO: check via regular expression
return true;
}
}

View File

@ -211,7 +211,7 @@ namespace RenderHeads.Media.AVProVideo
_outputTexture[i].filterMode = tex.filterMode;
_outputTexture[i].wrapMode = tex.wrapMode;
_outputTexture[i].anisoLevel = tex.anisoLevel;
// TODO: set up the mips level too?
}
}

View File

@ -503,8 +503,8 @@ namespace RenderHeads.Media.AVProVideo
}
// Render resolve blit
// TODO: combine these two paths into a single material blit
{
bool prevSRGB = GL.sRGBWrite;
GL.sRGBWrite = targetTexture.sRGB;
RenderTexture prev = RenderTexture.active;
@ -524,7 +524,7 @@ namespace RenderHeads.Media.AVProVideo
}
RenderTexture.active = prev;
GL.sRGBWrite = prevSRGB;
}
return targetTexture;
}
@ -565,7 +565,7 @@ namespace RenderHeads.Media.AVProVideo
}
}
// TODO: take into account rotation
}
public static bool RequiresResolve(ITextureProducer texture)

View File

@ -126,7 +126,7 @@ namespace NaughtyAttributes.Editor
{
Undo.RecordObject(serializedObject.targetObject, "Dropdown");
// TODO: Problem with structs, because they are value type.
// The solution is to make boxing/unboxing but unfortunately I don't know the compile time type of the target object
dropdownField.SetValue(target, newValue);
}