mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
add default stride handling, code cleaning
This commit is contained in:
parent
ac9aaf4037
commit
382cc13650
@ -46,6 +46,7 @@ public:
|
|||||||
int numerator = 0;
|
int numerator = 0;
|
||||||
int denominator = 0;
|
int denominator = 0;
|
||||||
PixelFormat pf = PixelFormat::NO_CHANGE;
|
PixelFormat pf = PixelFormat::NO_CHANGE;
|
||||||
|
long defstride = 0;
|
||||||
GUID guid = GUID_NULL;
|
GUID guid = GUID_NULL;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -108,6 +109,7 @@ private:
|
|||||||
EncoderThreadManager* _threadManager;
|
EncoderThreadManager* _threadManager;
|
||||||
PixelFormat _pixelFormat,
|
PixelFormat _pixelFormat,
|
||||||
_pixelFormatConfig;
|
_pixelFormatConfig;
|
||||||
|
bool _bottomUp;
|
||||||
int _lineLength,
|
int _lineLength,
|
||||||
_frameByteSize,
|
_frameByteSize,
|
||||||
_noSignalCounterThreshold,
|
_noSignalCounterThreshold,
|
||||||
|
@ -359,6 +359,7 @@ done:
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
_pixelFormat = props.pf;
|
_pixelFormat = props.pf;
|
||||||
|
_bottomUp = (props.defstride < 0);
|
||||||
_width = props.width;
|
_width = props.width;
|
||||||
_height = props.height;
|
_height = props.height;
|
||||||
_frameByteSize = _width * _height * 3;
|
_frameByteSize = _width * _height * 3;
|
||||||
@ -436,6 +437,14 @@ void MFGrabber::enumVideoCaptureDevices()
|
|||||||
properties.denominator = denominator;
|
properties.denominator = denominator;
|
||||||
properties.pf = pixelformat;
|
properties.pf = pixelformat;
|
||||||
properties.guid = format;
|
properties.guid = format;
|
||||||
|
|
||||||
|
HRESULT hr = pType->GetUINT32(MF_MT_DEFAULT_STRIDE, (UINT32*)&properties.defstride);
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
hr = MFGetStrideForBitmapInfoHeader(format.Data1, width, &properties.defstride);
|
||||||
|
if (FAILED(hr))
|
||||||
|
DebugIf (verbose, _log, "failed to get default stride");
|
||||||
|
}
|
||||||
devicePropertyList.append(properties);
|
devicePropertyList.append(properties);
|
||||||
|
|
||||||
DebugIf (verbose, _log, "%s %d x %d @ %d fps (%s)", QSTRING_CSTR(dev), properties.width, properties.height, properties.fps, QSTRING_CSTR(pixelFormatToString(properties.pf)));
|
DebugIf (verbose, _log, "%s %d x %d @ %d fps (%s)", QSTRING_CSTR(dev), properties.width, properties.height, properties.fps, QSTRING_CSTR(pixelFormatToString(properties.pf)));
|
||||||
@ -541,7 +550,7 @@ void MFGrabber::process_image(const void *frameImageBuffer, int size)
|
|||||||
{
|
{
|
||||||
if (!_threadManager->_threads[i]->isBusy())
|
if (!_threadManager->_threads[i]->isBusy())
|
||||||
{
|
{
|
||||||
_threadManager->_threads[i]->setup(_pixelFormat, (uint8_t*)frameImageBuffer, size, _width, _height, _lineLength, _cropLeft, _cropTop, _cropBottom, _cropRight, _videoMode, (_pixelFormat == PixelFormat::BGR24), _flipMode, _pixelDecimation);
|
_threadManager->_threads[i]->setup(_pixelFormat, (uint8_t*)frameImageBuffer, size, _width, _height, _lineLength, _cropLeft, _cropTop, _cropBottom, _cropRight, _videoMode, _bottomUp, _flipMode, _pixelDecimation);
|
||||||
_threadManager->_threads[i]->process();
|
_threadManager->_threads[i]->process();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -797,7 +806,7 @@ QJsonArray MFGrabber::discover(const QJsonObject& params)
|
|||||||
resolution_default["width"] = 640;
|
resolution_default["width"] = 640;
|
||||||
resolution_default["height"] = 480;
|
resolution_default["height"] = 480;
|
||||||
resolution_default["fps"] = 25;
|
resolution_default["fps"] = 25;
|
||||||
format_default["format"] = "bgr24";
|
format_default["format"] = "rgb24";
|
||||||
format_default["resolution"] = resolution_default;
|
format_default["resolution"] = resolution_default;
|
||||||
video_inputs_default["inputIdx"] = 0;
|
video_inputs_default["inputIdx"] = 0;
|
||||||
video_inputs_default["standards"] = "PAL";
|
video_inputs_default["standards"] = "PAL";
|
||||||
|
@ -54,24 +54,19 @@ void ImageResampler::processImage(const uint8_t * data, int width, int height, i
|
|||||||
int xDestStart, xDestEnd;
|
int xDestStart, xDestEnd;
|
||||||
int yDestStart, yDestEnd;
|
int yDestStart, yDestEnd;
|
||||||
|
|
||||||
FlipMode flipMode;
|
if (bottomUp)
|
||||||
if (!_bottomUp)
|
|
||||||
{
|
|
||||||
flipMode = _flipMode;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
if (_flipMode == FlipMode::NO_CHANGE)
|
if (_flipMode == FlipMode::NO_CHANGE)
|
||||||
flipMode = FlipMode::HORIZONTAL;
|
_flipMode = FlipMode::HORIZONTAL;
|
||||||
else if (_flipMode == FlipMode::HORIZONTAL)
|
else if (_flipMode == FlipMode::HORIZONTAL)
|
||||||
flipMode = FlipMode::NO_CHANGE;
|
_flipMode = FlipMode::NO_CHANGE;
|
||||||
else if (_flipMode == FlipMode::VERTICAL)
|
else if (_flipMode == FlipMode::VERTICAL)
|
||||||
flipMode = FlipMode::BOTH;
|
_flipMode = FlipMode::BOTH;
|
||||||
else if (_flipMode == FlipMode::BOTH)
|
else if (_flipMode == FlipMode::BOTH)
|
||||||
flipMode = FlipMode::VERTICAL;
|
_flipMode = FlipMode::VERTICAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (flipMode)
|
switch (_flipMode)
|
||||||
{
|
{
|
||||||
case FlipMode::NO_CHANGE:
|
case FlipMode::NO_CHANGE:
|
||||||
xDestStart = 0;
|
xDestStart = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user