bestsource: Fixes to fps and colorspace conversion
Some of these got lost in the process before. For now, default to 709 if the colorspace is unkown. More detailed colorspace guessing can be added in the future.
This commit is contained in:
parent
9ea7808a30
commit
7ea1d650a9
1 changed files with 9 additions and 1 deletions
|
@ -147,7 +147,7 @@ BSVideoProvider::BSVideoProvider(agi::fs::path const& filename, std::string cons
|
|||
Keyframes.push_back(n);
|
||||
}
|
||||
|
||||
TimecodesVector.push_back((int) frame->GetAVFrame()->pts);
|
||||
TimecodesVector.push_back(frame->Pts * properties.TimeBase.Den / properties.TimeBase.Num);
|
||||
ps->SetProgress(n, properties.NumFrames);
|
||||
}
|
||||
|
||||
|
@ -182,6 +182,14 @@ void BSVideoProvider::GetFrame(int n, VideoFrame &out) {
|
|||
throw VideoDecodeError("Couldn't convert frame!");
|
||||
}
|
||||
|
||||
int range = frame->color_range == AVCOL_RANGE_JPEG;
|
||||
const int *coefficients = sws_getCoefficients(frame->colorspace == AVCOL_SPC_UNSPECIFIED ? AVCOL_SPC_BT709 : frame->colorspace);
|
||||
|
||||
sws_setColorspaceDetails(context,
|
||||
coefficients, range,
|
||||
coefficients, range,
|
||||
0, 1 << 16, 1 << 16);
|
||||
|
||||
out.data.resize(frame->width * frame->height * 4);
|
||||
uint8_t *data[1] = {&out.data[0]};
|
||||
int stride[1] = {frame->width * 4};
|
||||
|
|
Loading…
Reference in a new issue