Skip to content

Commit

Permalink
Applied latest modification lost in copy paste.
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Boutot committed Aug 16, 2019
1 parent 9febb69 commit 35f8ffe
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 42 deletions.
2 changes: 1 addition & 1 deletion Source/AjaMedia/Private/Player/AjaMediaPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ bool FAjaMediaPlayer::OnInputFrameReceived(const AJA::AJAInputFrameData& InInput

if (AjaThreadCurrentTextureSample.IsValid())
{
if (AjaThreadCurrentTextureSample->UpdateProperties(InVideoFrame.Stride, InVideoFrame.Width, InVideoFrame.Height, VideoSampleFormat, DecodedTime, VideoFrameRate, DecodedTimecode, bIsSRGBInput))
if (AjaThreadCurrentTextureSample->SetProperties(InVideoFrame.Stride, InVideoFrame.Width, InVideoFrame.Height, VideoSampleFormat, DecodedTime, VideoFrameRate, DecodedTimecode, bIsSRGBInput))
{
Samples->AddVideo(AjaThreadCurrentTextureSample.ToSharedRef());
}
Expand Down
45 changes: 6 additions & 39 deletions Source/AjaMedia/Private/Player/AjaMediaTextureSample.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,10 @@ class FAjaMediaTextureSample
* @param InTime The sample time (in the player's own clock).
* @param InFrameRate The framerate of the media that produce the sample.
* @param InTimecode The sample timecode if available.
* @param bInIsSRGB Whether the sample is in sRGB space.
*/
bool InitializeProgressive(const AJA::AJAVideoFrameData& InVideoData, EMediaTextureSampleFormat InSampleFormat, FTimespan InTime, const FFrameRate& InFrameRate, const TOptional<FTimecode>& InTimecode, bool bInIsSRGB)
{
bIsSRGBInput = bInIsSRGB;

return Super::Initialize(InVideoData.VideoBuffer
, InVideoData.VideoBufferSize
, InVideoData.Stride
Expand All @@ -36,7 +35,8 @@ class FAjaMediaTextureSample
, InSampleFormat
, InTime
, InFrameRate
, InTimecode);
, InTimecode
, bInIsSRGB);
}

/**
Expand All @@ -48,11 +48,10 @@ class FAjaMediaTextureSample
* @param InFrameRate The framerate of the media that produce the sample.
* @param InTimecode The sample timecode if available.
* @param bEven Only take the even frame from the image.
* @param bInIsSRGB Whether the sample is in sRGB space.
*/
bool InitializeInterlaced_Halfed(const AJA::AJAVideoFrameData& InVideoData, EMediaTextureSampleFormat InSampleFormat, FTimespan InTime, const FFrameRate& InFrameRate, const TOptional<FTimecode>& InTimecode, bool bInEven, bool bInIsSRGB)
{
bIsSRGBInput = bInIsSRGB;

return Super::InitializeWithEvenOddLine(bInEven
, InVideoData.VideoBuffer
, InVideoData.VideoBufferSize
Expand All @@ -62,36 +61,8 @@ class FAjaMediaTextureSample
, InSampleFormat
, InTime
, InFrameRate
, InTimecode);
}

/**
* Set the sample properties.
*
* @param InStride The number of channel of the video buffer.
* @param InWidth The sample rate of the video buffer.
* @param InHeight The sample rate of the video buffer.
* @param InSampleFormat The sample format of the video buffer.
* @param InTime The sample time (in the player's own clock).
* @param InFrameRate The framerate of the media that produce the sample.
* @param InTimecode The sample timecode if available.
* @param bInIsSRGB Whether the sample is in sRGB space.
*/
bool UpdateProperties(uint32 InStride, uint32 InWidth, uint32 InHeight, EMediaTextureSampleFormat InSampleFormat, FTimespan InTime, const FFrameRate& InFrameRate, const TOptional<FTimecode>& InTimecode, bool bInIsSRGB)
{
bIsSRGBInput = bInIsSRGB;

return Super::SetProperties(InStride, InWidth, InHeight, InSampleFormat, InTime, InFrameRate, InTimecode);
}

/**
* Is output Srgb
*
* @return false
*/
virtual bool IsOutputSrgb() const override
{
return bIsSRGBInput;
, InTimecode
, bInIsSRGB);
}

/**
Expand All @@ -104,10 +75,6 @@ class FAjaMediaTextureSample
return MediaShaders::YuvToRgbRec709Full;
}

protected:

/** Wheter the sample is in sRGB space and requires an explicit conversion to linear */
bool bIsSRGBInput;
};

/*
Expand Down
2 changes: 1 addition & 1 deletion Source/AjaMediaOutput/Private/AjaMediaCapture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ bool UAjaMediaCapture::InitAJA(UAjaMediaOutput* InAjaMediaOutput)
return true;
}

void UAjaMediaCapture::OnFrameCaptured_RenderingThread(const FCaptureBaseData& InBaseData, TSharedPtr<FMediaCaptureUserData> InUserData, void* InBuffer, int32 Width, int32 Height)
void UAjaMediaCapture::OnFrameCaptured_RenderingThread(const FCaptureBaseData& InBaseData, TSharedPtr<FMediaCaptureUserData, ESPMode::ThreadSafe> InUserData, void* InBuffer, int32 Width, int32 Height)
{
// Prevent the rendering thread from copying while we are stopping the capture.
FScopeLock ScopeLock(&RenderThreadCriticalSection);
Expand Down
2 changes: 1 addition & 1 deletion Source/AjaMediaOutput/Public/AjaMediaCapture.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class AJAMEDIAOUTPUT_API UAjaMediaCapture : public UMediaCapture
virtual bool UpdateRenderTargetImpl(UTextureRenderTarget2D* InRenderTarget) override;
virtual void StopCaptureImpl(bool bAllowPendingFrameToBeProcess) override;

virtual void OnFrameCaptured_RenderingThread(const FCaptureBaseData& InBaseData, TSharedPtr<FMediaCaptureUserData> InUserData, void* InBuffer, int32 Width, int32 Height) override;
virtual void OnFrameCaptured_RenderingThread(const FCaptureBaseData& InBaseData, TSharedPtr<FMediaCaptureUserData, ESPMode::ThreadSafe> InUserData, void* InBuffer, int32 Width, int32 Height) override;

private:
struct FAjaOutputCallback;
Expand Down

0 comments on commit 35f8ffe

Please sign in to comment.