Allocate and initialise the SwsContext for pixel format conversion.
298{
300 return false;
301
303 m_last_error =
"setup_scaler: source pix_fmt is AV_PIX_FMT_NONE — "
304 "codec has not resolved its output format yet";
305 return false;
306 }
307
312 : static_cast<int>(AV_PIX_FMT_RGBA);
313
315 static_cast<int>(
width),
321 SWS_BILINEAR,
322 nullptr, nullptr, nullptr);
323
326 return false;
327 }
328
329 const AVPixFmtDescriptor* desc = av_pix_fmt_desc_get(
331 if (!desc) {
332 m_last_error =
"setup_scaler: no descriptor for target pixel format";
333 return false;
334 }
335
336 if (av_pix_fmt_count_planes(
static_cast<AVPixelFormat
>(
out_pixel_format)) != 1) {
337 m_last_error = std::string(
"setup_scaler: target format ")
338 + (desc->name ? desc->name : "?")
339 + " is multi-planar; the read path writes a single packed plane";
340 return false;
341 }
342
344
347 if (align_remainder != 0)
349
350 return true;
351}
uint32_t target_width
Requested output width (0 = source).
uint32_t target_height
Requested output height (0 = source).
uint32_t out_height
Output height after scaling.
uint32_t height
Source height in pixels.
uint32_t width
Source width in pixels.
int out_pixel_format
Output AVPixelFormat.
int out_linesize
Output row stride in bytes.
SwsContext * sws_context
Owned; freed in destructor.
AVCodecContext * codec_context
Owned; freed in destructor.
int target_format
Requested AVPixelFormat (negative = RGBA).
uint32_t out_bytes_per_pixel
Bytes per pixel in output format.
uint32_t out_width
Output width after scaling.