Allocate and initialise the SwsContext for pixel format conversion.
- Parameters
-
| target_width | Desired output width (0 = source width). |
| target_height | Desired output height (0 = source height). |
| target_format | Desired AVPixelFormat (negative = AV_PIX_FMT_RGBA). |
- Returns
- True on success.
Definition at line 294 of file VideoStreamContext.cpp.
297{
299 return false;
300
302 m_last_error =
"setup_scaler: source pix_fmt is AV_PIX_FMT_NONE — "
303 "codec has not resolved its output format yet";
304 return false;
305 }
306
311 : static_cast<int>(AV_PIX_FMT_RGBA);
312
314 static_cast<int>(
width),
320 SWS_BILINEAR,
321 nullptr, nullptr, nullptr);
322
325 return false;
326 }
327
328 const AVPixFmtDescriptor* desc = av_pix_fmt_desc_get(
330 if (desc) {
331 int bits = 0;
332 for (int c = 0; c < desc->nb_components; ++c)
333 bits += desc->comp[c].depth;
335 } else {
337 }
338
341 if (align_remainder != 0)
343
344 return true;
345}
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.
References codec_context, height, m_last_error, out_bytes_per_pixel, out_height, out_linesize, out_pixel_format, out_width, sws_context, target_format, target_height, target_width, and width.
Referenced by open(), and rebuild_scaler_from_frame().