renderer: use probed params for tex gen
This commit is contained in:
@@ -186,11 +186,6 @@ public:
|
||||
*/
|
||||
bool RetrieveVideo(TexturePtr destination, const rational& timecode, const RetrieveVideoParams& divider, const QAtomicInt *cancelled = nullptr);
|
||||
|
||||
virtual VideoParams GetParamsForTexture(const Decoder::RetrieveVideoParams &p)
|
||||
{
|
||||
return VideoParams();
|
||||
}
|
||||
|
||||
enum RetrieveAudioStatus {
|
||||
kInvalid = -1,
|
||||
kOK,
|
||||
|
||||
@@ -152,7 +152,13 @@ bool FFmpegDecoder::RetrieveVideoInternal(TexturePtr destination, const rational
|
||||
return false;
|
||||
}
|
||||
|
||||
VideoParams vp = GetParamsForTexture(params);
|
||||
VideoParams vp(instance_.avstream()->codecpar->width,
|
||||
instance_.avstream()->codecpar->height,
|
||||
native_pix_fmt_,
|
||||
native_channel_count_,
|
||||
av_guess_sample_aspect_ratio(instance_.fmt_ctx(), instance_.avstream(), nullptr),
|
||||
VideoParams::kInterlaceNone,
|
||||
params.divider);
|
||||
|
||||
destination->Upload(working_frame_->data[0], working_frame_->linesize[0] / vp.GetBytesPerPixel());
|
||||
|
||||
@@ -947,25 +953,6 @@ void FFmpegDecoder::RemoveFirstFrame()
|
||||
cache_at_zero_ = false;
|
||||
}
|
||||
|
||||
VideoParams FFmpegDecoder::GetParamsForTexture(const Decoder::RetrieveVideoParams &p)
|
||||
{
|
||||
if (native_pix_fmt_ == VideoParams::kFormatInvalid) {
|
||||
if (instance_.IsOpen()) {
|
||||
instance_.GetFrame(working_packet_, working_frame_);
|
||||
InitScaler(working_frame_, p);
|
||||
av_frame_unref(working_frame_);
|
||||
}
|
||||
}
|
||||
|
||||
return VideoParams(instance_.avstream()->codecpar->width,
|
||||
instance_.avstream()->codecpar->height,
|
||||
native_pix_fmt_,
|
||||
native_channel_count_,
|
||||
av_guess_sample_aspect_ratio(instance_.fmt_ctx(), instance_.avstream(), nullptr),
|
||||
VideoParams::kInterlaceNone,
|
||||
p.divider);
|
||||
}
|
||||
|
||||
FFmpegDecoder::Instance::Instance() :
|
||||
fmt_ctx_(nullptr),
|
||||
codec_ctx_(nullptr),
|
||||
|
||||
@@ -66,8 +66,6 @@ public:
|
||||
|
||||
virtual FootageDescription Probe(const QString &filename, const QAtomicInt *cancelled) const override;
|
||||
|
||||
virtual VideoParams GetParamsForTexture(const Decoder::RetrieveVideoParams &p) override;
|
||||
|
||||
protected:
|
||||
virtual bool OpenInternal() override;
|
||||
virtual bool RetrieveVideoInternal(TexturePtr destination, const rational& timecode, const RetrieveVideoParams& params, const QAtomicInt *cancelled) override;
|
||||
|
||||
@@ -117,17 +117,6 @@ FootageDescription OIIODecoder::Probe(const QString &filename, const QAtomicInt*
|
||||
return desc;
|
||||
}
|
||||
|
||||
VideoParams OIIODecoder::GetParamsForTexture(const RetrieveVideoParams &p)
|
||||
{
|
||||
return VideoParams(buffer_->spec().width,
|
||||
buffer_->spec().height,
|
||||
pix_fmt_,
|
||||
channel_count_,
|
||||
OIIOUtils::GetPixelAspectRatioFromOIIO(buffer_->spec()),
|
||||
VideoParams::kInterlaceNone, // FIXME: Does OIIO deinterlace for us?
|
||||
p.divider);
|
||||
}
|
||||
|
||||
bool OIIODecoder::OpenInternal()
|
||||
{
|
||||
// If we can open the filename provided, assume everything is working
|
||||
@@ -139,7 +128,13 @@ bool OIIODecoder::RetrieveVideoInternal(TexturePtr destination, const rational &
|
||||
Q_UNUSED(timecode)
|
||||
Q_UNUSED(cancelled)
|
||||
|
||||
VideoParams vp = GetParamsForTexture(params);
|
||||
VideoParams vp(buffer_->spec().width,
|
||||
buffer_->spec().height,
|
||||
pix_fmt_,
|
||||
channel_count_,
|
||||
OIIOUtils::GetPixelAspectRatioFromOIIO(buffer_->spec()),
|
||||
VideoParams::kInterlaceNone, // FIXME: Does OIIO deinterlace for us?
|
||||
params.divider);
|
||||
|
||||
if (params.divider == 1) {
|
||||
|
||||
|
||||
@@ -42,8 +42,6 @@ public:
|
||||
|
||||
virtual FootageDescription Probe(const QString& filename, const QAtomicInt* cancelled) const override;
|
||||
|
||||
virtual VideoParams GetParamsForTexture(const Decoder::RetrieveVideoParams &p) override;
|
||||
|
||||
protected:
|
||||
virtual bool OpenInternal() override;
|
||||
virtual bool RetrieveVideoInternal(TexturePtr destination, const rational& timecode, const RetrieveVideoParams& params, const QAtomicInt *cancelled) override;
|
||||
|
||||
@@ -451,7 +451,7 @@ void RenderProcessor::ProcessVideoFootage(TexturePtr destination, const FootageJ
|
||||
|
||||
if (!IsCancelled()) {
|
||||
|
||||
VideoParams tex_params = decoder->GetParamsForTexture(p);
|
||||
VideoParams tex_params = stream.video_params();
|
||||
|
||||
if (tex_params.is_valid()) {
|
||||
TexturePtr unmanaged_texture = render_ctx_->CreateTexture(tex_params);
|
||||
|
||||
Reference in New Issue
Block a user