gavl

Modules | Typedefs | Enumerations | Functions
Video conversion options
Video

## Modules
| Video conversion flags

## Typedefs
typedef struct gavl_video_options_s | gavl_video_options_t

## Enumerations
enum | gavl_alpha_mode_t { GAVL_ALPHA_IGNORE = 0 , GAVL_ALPHA_BLEND_COLOR }
enum | gavl_deinterlace_mode_t { GAVL_DEINTERLACE_NONE = 0 , GAVL_DEINTERLACE_COPY = 1 , GAVL_DEINTERLACE_SCALE = 2 , GAVL_DEINTERLACE_BLEND = 3 }
enum | gavl_deinterlace_drop_mode_t { GAVL_DEINTERLACE_DROP_TOP , GAVL_DEINTERLACE_DROP_BOTTOM }
| Specifies which field to drop when deinterlacing. More...
enum | gavl_scale_mode_t { GAVL_SCALE_AUTO , GAVL_SCALE_NEAREST , GAVL_SCALE_BILINEAR , GAVL_SCALE_QUADRATIC , GAVL_SCALE_CUBIC_BSPLINE , GAVL_SCALE_CUBIC_MITCHELL , GAVL_SCALE_CUBIC_CATMULL , GAVL_SCALE_SINC_LANCZOS , GAVL_SCALE_NONE }
enum | gavl_downscale_filter_t { GAVL_DOWNSCALE_FILTER_AUTO = 0 , GAVL_DOWNSCALE_FILTER_NONE , GAVL_DOWNSCALE_FILTER_WIDE , GAVL_DOWNSCALE_FILTER_GAUSS }

## Functions
GAVL_PUBLIC void | gavl_video_options_set_defaults (gavl_video_options_t *opt)
| Set all options to their defaults.
GAVL_PUBLIC gavl_video_options_t * | gavl_video_options_create ()
| Create an options container.
GAVL_PUBLIC void | gavl_video_options_copy (gavl_video_options_t *dst, const gavl_video_options_t *src)
| Copy video options.
GAVL_PUBLIC void | gavl_video_options_destroy (gavl_video_options_t *opt)
| Destroy video options.
GAVL_PUBLIC void | gavl_video_options_set_rectangles (gavl_video_options_t *opt, const gavl_rectangle_f_t *src_rect, const gavl_rectangle_i_t *dst_rect)
| Set source and destination rectangles.
GAVL_PUBLIC void | gavl_video_options_get_rectangles (gavl_video_options_t *opt, gavl_rectangle_f_t *src_rect, gavl_rectangle_i_t *dst_rect)
| Get source and destination rectangles.
GAVL_PUBLIC void | gavl_video_options_set_quality (gavl_video_options_t *opt, int quality)
| Set the quality level for the converter.
GAVL_PUBLIC int | gavl_video_options_get_quality (gavl_video_options_t *opt)
| Get the quality level for the converter.
GAVL_PUBLIC void | gavl_video_options_set_conversion_flags (gavl_video_options_t *opt, int conversion_flags)
| Set the conversion flags.
GAVL_PUBLIC int | gavl_video_options_get_conversion_flags (gavl_video_options_t *opt)
| Get the conversion flags.
GAVL_PUBLIC void | gavl_video_options_set_alpha_mode (gavl_video_options_t *opt, gavl_alpha_mode_t alpha_mode)
| Set the alpha mode.
GAVL_PUBLIC gavl_alpha_mode_t | gavl_video_options_get_alpha_mode (gavl_video_options_t *opt)
| Get the alpha mode.
GAVL_PUBLIC void | gavl_video_options_set_scale_mode (gavl_video_options_t *opt, gavl_scale_mode_t scale_mode)
| Set the scale mode.
GAVL_PUBLIC gavl_scale_mode_t | gavl_video_options_get_scale_mode (gavl_video_options_t *opt)
| Get the scale mode.
GAVL_PUBLIC void | gavl_video_options_set_scale_order (gavl_video_options_t *opt, int order)
| Set the scale order for GAVL_SCALE_SINC_LANCZOS.
GAVL_PUBLIC int | gavl_video_options_get_scale_order (gavl_video_options_t *opt)
| Get the scale order for GAVL_SCALE_SINC_LANCZOS.
GAVL_PUBLIC void | gavl_video_options_set_background_color (gavl_video_options_t *opt, const float *color)
| Set the background color for alpha blending.
GAVL_PUBLIC void | gavl_video_options_get_background_color (gavl_video_options_t *opt, float *color)
| Get the background color for alpha blending.
GAVL_PUBLIC void | gavl_video_options_set_deinterlace_drop_mode (gavl_video_options_t *opt, gavl_deinterlace_drop_mode_t deinterlace_drop_mode)
| Set the deinterlace drop mode.
GAVL_PUBLIC gavl_deinterlace_drop_mode_t | gavl_video_options_get_deinterlace_drop_mode (gavl_video_options_t *opt)
| Get the deinterlace drop mode.
GAVL_PUBLIC void | gavl_video_options_set_downscale_filter (gavl_video_options_t *opt, gavl_downscale_filter_t f)
| Set antialiasing filter for downscaling.
GAVL_PUBLIC gavl_downscale_filter_t | gavl_video_options_get_downscale_filter (gavl_video_options_t *opt)
| Get the antialiasing filter for downscaling.
GAVL_PUBLIC void | gavl_video_options_set_downscale_blur (gavl_video_options_t *opt, float f)
| Set blur factor for downscaling.
GAVL_PUBLIC float | gavl_video_options_get_downscale_blur (gavl_video_options_t *opt)
| Get blur factor for downscaling.
GAVL_PUBLIC void | gavl_video_options_set_num_threads (gavl_video_options_t *opt, int n)
| Set number of threads.
GAVL_PUBLIC int | gavl_video_options_get_num_threads (gavl_video_options_t *opt)
| Set number of threads.
GAVL_PUBLIC void | gavl_video_options_set_run_func (gavl_video_options_t *opt, gavl_video_run_func func, void *client_data)
| Set function to be passed to each thread.
GAVL_PUBLIC gavl_video_run_func | gavl_video_options_get_run_func (gavl_video_options_t *opt, void **client_data)
| Get function to be passed to each thread.
GAVL_PUBLIC void | gavl_video_options_set_stop_func (gavl_video_options_t *opt, gavl_video_stop_func func, void *client_data)
| Set function to be passed to each thread.
GAVL_PUBLIC gavl_video_stop_func | gavl_video_options_get_stop_func (gavl_video_options_t *opt, void **client_data)
| Get function to be passed to each thread.

## Detailed Description

## Typedef Documentation

## ◆ gavl_video_options_t

typedef struct gavl_video_options_s gavl_video_options_t

Opaque container for video conversion options

You don't want to know what's inside.

## Enumeration Type Documentation

## ◆ gavl_alpha_mode_t

enum gavl_alpha_mode_t

Alpha handling mode

Set the desired behaviour if the source format has a transparency channel but the destination doesn't.

Enumerator
GAVL_ALPHA_IGNORE | Ignore alpha channel
GAVL_ALPHA_BLEND_COLOR | Blend over a specified background color

## ◆ gavl_deinterlace_mode_t

enum gavl_deinterlace_mode_t

Deinterlace mode

Specifies a deinterlacing mode

Enumerator
GAVL_DEINTERLACE_NONE | Don't care about interlacing
GAVL_DEINTERLACE_COPY | Take one field and copy it to the other
GAVL_DEINTERLACE_SCALE | Take one field and scale it vertically by 2
GAVL_DEINTERLACE_BLEND | Linear blend fields together

## ◆ gavl_deinterlace_drop_mode_t

enum gavl_deinterlace_drop_mode_t

Specifies which field to drop when deinterlacing.

This is used for deinterlacing with GAVL_DEINTERLACE_COPY and GAVL_DEINTERLACE_SCALE.

Enumerator
GAVL_DEINTERLACE_DROP_TOP | Drop top field, use bottom field
GAVL_DEINTERLACE_DROP_BOTTOM | Drop bottom field, use top field

## ◆ gavl_scale_mode_t

enum gavl_scale_mode_t

Scaling algorithm

Enumerator
GAVL_SCALE_AUTO | Take mode from conversion quality
GAVL_SCALE_NEAREST | Nearest neighbor
GAVL_SCALE_BILINEAR | Bilinear
GAVL_SCALE_QUADRATIC | Quadratic
GAVL_SCALE_CUBIC_BSPLINE | Cubic B-Spline
GAVL_SCALE_CUBIC_MITCHELL | Cubic Mitchell-Netravali
GAVL_SCALE_CUBIC_CATMULL | Cubic Catmull-Rom
GAVL_SCALE_SINC_LANCZOS | Sinc with Lanczos window. Set order with gavl_video_options_set_scale_order
GAVL_SCALE_NONE | Used internally when the scaler is used as a convolver

## ◆ gavl_downscale_filter_t

enum gavl_downscale_filter_t

Antialiasing filters

Specifies the antialiasing filter to be used when downscaling images.

Since 1.1.0

Enumerator
GAVL_DOWNSCALE_FILTER_AUTO | Auto selection based on quality.
GAVL_DOWNSCALE_FILTER_NONE | Fastest method, might produce heavy aliasing artifacts.
GAVL_DOWNSCALE_FILTER_WIDE | Widen the filter curve according to the scaling ratio.
GAVL_DOWNSCALE_FILTER_GAUSS | Do a Gaussian preblur.

## Function Documentation

## ◆ gavl_video_options_set_defaults()

GAVL_PUBLIC void gavl_video_options_set_defaults | ( | gavl_video_options_t * | opt | ) |

Set all options to their defaults.

Parameters

  opt | Video options

## ◆ gavl_video_options_create()

GAVL_PUBLIC gavl_video_options_t * gavl_video_options_create | ( |  | ) |

Create an options container.

Returns
  Newly allocated udio options with default values

Use this to store options, which will apply for more than one converter instance. Applying the options will be done by gavl_*_get_options() followed by gavl_video_options_copy().

## ◆ gavl_video_options_copy()

GAVL_PUBLIC void gavl_video_options_copy | ( | gavl_video_options_t * | dst,
|  | const gavl_video_options_t * | src
| ) |  |

Copy video options.

Parameters

  dst | Destination
  src | Source

## ◆ gavl_video_options_destroy()

GAVL_PUBLIC void gavl_video_options_destroy | ( | gavl_video_options_t * | opt | ) |

Destroy video options.

Parameters

  opt | Video options

## ◆ gavl_video_options_set_rectangles()

GAVL_PUBLIC void gavl_video_options_set_rectangles | ( | gavl_video_options_t * | opt,
|  | const gavl_rectangle_f_t * | src_rect,
|  | const gavl_rectangle_i_t * | dst_rect
| ) |  |

Set source and destination rectangles.

Parameters

  opt | Video options
  src_rect | Rectangular area in the source frame or NULL
  dst_rect | Rectangular area in the destination frame or NULL

Set the source and destination rectangles the converter or scaler will operate on. If you don't call this function, the rectangles will be set to the full image dimensions of the source and destination formats respectively. If one rectangle is NULL, BOTH rectangles will be cleared as if you never called this function. See Rectangles for convenience functions, which calculate the proper rectangles in some typical playback or transcoding situations.

## ◆ gavl_video_options_get_rectangles()

GAVL_PUBLIC void gavl_video_options_get_rectangles | ( | gavl_video_options_t * | opt,
|  | gavl_rectangle_f_t * | src_rect,
|  | gavl_rectangle_i_t * | dst_rect
| ) |  |

Get source and destination rectangles.

Parameters

  opt | Video options
  src_rect | Returns the rectangular area in the source frame
  dst_rect | Returns the rectangular area in the destination frame

## ◆ gavl_video_options_set_quality()

GAVL_PUBLIC void gavl_video_options_set_quality | ( | gavl_video_options_t * | opt,
|  | int | quality
| ) |  |

Set the quality level for the converter.

Parameters

  opt | Video options
  quality | Quality level (see Quality settings)

## ◆ gavl_video_options_get_quality()

GAVL_PUBLIC int gavl_video_options_get_quality | ( | gavl_video_options_t * | opt | ) |

Get the quality level for the converter.

Parameters

  opt | Video options

Returns
  Quality level (see Quality settings)

## ◆ gavl_video_options_set_conversion_flags()

GAVL_PUBLIC void gavl_video_options_set_conversion_flags | ( | gavl_video_options_t * | opt,
|  | int | conversion_flags
| ) |  |

Set the conversion flags.

Parameters

  opt | Video options
  conversion_flags | Conversion flags (see Video conversion flags)

## ◆ gavl_video_options_get_conversion_flags()

GAVL_PUBLIC int gavl_video_options_get_conversion_flags | ( | gavl_video_options_t * | opt | ) |

Get the conversion flags.

Parameters

  opt | Video options

Returns
  Flags (see Video conversion flags)

## ◆ gavl_video_options_set_alpha_mode()

GAVL_PUBLIC void gavl_video_options_set_alpha_mode | ( | gavl_video_options_t * | opt,
|  | gavl_alpha_mode_t | alpha_mode
| ) |  |

Set the alpha mode.

Parameters

  opt | Video options
  alpha_mode | Alpha mode

## ◆ gavl_video_options_get_alpha_mode()

GAVL_PUBLIC gavl_alpha_mode_t gavl_video_options_get_alpha_mode | ( | gavl_video_options_t * | opt | ) |

Get the alpha mode.

Parameters

  opt | Video options

Returns
  Alpha mode

## ◆ gavl_video_options_set_scale_mode()

GAVL_PUBLIC void gavl_video_options_set_scale_mode | ( | gavl_video_options_t * | opt,
|  | gavl_scale_mode_t | scale_mode
| ) |  |

Set the scale mode.

Parameters

  opt | Video options
  scale_mode | Scale mode

## ◆ gavl_video_options_get_scale_mode()

GAVL_PUBLIC gavl_scale_mode_t gavl_video_options_get_scale_mode | ( | gavl_video_options_t * | opt | ) |

Get the scale mode.

Parameters

  opt | Video options

Returns
  Scale mode

## ◆ gavl_video_options_set_scale_order()

GAVL_PUBLIC void gavl_video_options_set_scale_order | ( | gavl_video_options_t * | opt,
|  | int | order
| ) |  |

Set the scale order for GAVL_SCALE_SINC_LANCZOS.

Parameters

  opt | Video options
  order | Order (must be at least 4)

## ◆ gavl_video_options_get_scale_order()

GAVL_PUBLIC int gavl_video_options_get_scale_order | ( | gavl_video_options_t * | opt | ) |

Get the scale order for GAVL_SCALE_SINC_LANCZOS.

Parameters

  opt | Video options

Returns
  Order

## ◆ gavl_video_options_set_background_color()

GAVL_PUBLIC void gavl_video_options_set_background_color | ( | gavl_video_options_t * | opt,
|  | const float * | color
| ) |  |

Set the background color for alpha blending.

Parameters

  opt | Video options
  color | Array of 3 float values (0.0 .. 1.0) in RGB order

## ◆ gavl_video_options_get_background_color()

GAVL_PUBLIC void gavl_video_options_get_background_color | ( | gavl_video_options_t * | opt,
|  | float * | color
| ) |  |

Get the background color for alpha blending.

Parameters

  opt | Video options
  color | Returns 3 float values (0.0 .. 1.0) in RGB order

## ◆ gavl_video_options_set_deinterlace_drop_mode()

GAVL_PUBLIC void gavl_video_options_set_deinterlace_drop_mode | ( | gavl_video_options_t * | opt,
|  | gavl_deinterlace_drop_mode_t | deinterlace_drop_mode
| ) |  |

Set the deinterlace drop mode.

Parameters

  opt | Video options
  deinterlace_drop_mode | Deinterlace drop mode

## ◆ gavl_video_options_get_deinterlace_drop_mode()

GAVL_PUBLIC gavl_deinterlace_drop_mode_t gavl_video_options_get_deinterlace_drop_mode | ( | gavl_video_options_t * | opt | ) |

Get the deinterlace drop mode.

Parameters

  opt | Video options

Returns
  Deinterlace drop mode

## ◆ gavl_video_options_set_downscale_filter()

GAVL_PUBLIC void gavl_video_options_set_downscale_filter | ( | gavl_video_options_t * | opt,
|  | gavl_downscale_filter_t | f
| ) |  |

Set antialiasing filter for downscaling.

Parameters

  opt | Video options
  f | Filter type (see gavl_downscale_filter_t)

Since 1.1.0

## ◆ gavl_video_options_get_downscale_filter()

GAVL_PUBLIC gavl_downscale_filter_t gavl_video_options_get_downscale_filter | ( | gavl_video_options_t * | opt | ) |

Get the antialiasing filter for downscaling.

Parameters

  opt | Video options

Returns
  antialiasing filter for downscaling

Since 1.1.0

## ◆ gavl_video_options_set_downscale_blur()

GAVL_PUBLIC void gavl_video_options_set_downscale_blur | ( | gavl_video_options_t * | opt,
|  | float | f
| ) |  |

Set blur factor for downscaling.

Parameters

  opt | Video options
  f | Factor

Specifies an additional blur-factor for downscaling. The default value of 1.0 calculates the preblur coefficients according the the downsample factor. Larger values mean more blurring (and slower scaling), smaller values mean less blurring (and probably more aliasing artifacts), 0 is equivalent to calling gavl_video_options_set_downscale_filter with GAVL_DOWNSCALE_FILTER_NONE as argument.

Since 1.1.0

## ◆ gavl_video_options_get_downscale_blur()

GAVL_PUBLIC float gavl_video_options_get_downscale_blur | ( | gavl_video_options_t * | opt | ) |

Get blur factor for downscaling.

Parameters

  opt | Video options

Returns
  Factor

Since 1.1.0

## ◆ gavl_video_options_set_num_threads()

GAVL_PUBLIC void gavl_video_options_set_num_threads | ( | gavl_video_options_t * | opt,
|  | int | n
| ) |  |

Set number of threads.

Parameters

  opt | Video options
  n | Number of threads

Since 1.1.1

## ◆ gavl_video_options_get_num_threads()

GAVL_PUBLIC int gavl_video_options_get_num_threads | ( | gavl_video_options_t * | opt | ) |

Set number of threads.

Parameters

  opt | Video options

Returns
  Number of threads

Since 1.1.1

## ◆ gavl_video_options_set_run_func()

GAVL_PUBLIC void gavl_video_options_set_run_func | ( | gavl_video_options_t * | opt,
|  | gavl_video_run_func | func,
|  | void * | client_data
| ) |  |

Set function to be passed to each thread.

Parameters

  opt | Video options
  func | Function to be passed to each thread
  client_data | Client data to be passed to the run function

Since 1.1.1

## ◆ gavl_video_options_get_run_func()

GAVL_PUBLIC gavl_video_run_func gavl_video_options_get_run_func | ( | gavl_video_options_t * | opt,
|  | void ** | client_data
| ) |  |

Get function to be passed to each thread.

Parameters

  opt | Video options
  client_data | Returns client data

Returns
  The function

Since 1.1.1

## ◆ gavl_video_options_set_stop_func()

GAVL_PUBLIC void gavl_video_options_set_stop_func | ( | gavl_video_options_t * | opt,
|  | gavl_video_stop_func | func,
|  | void * | client_data
| ) |  |

Set function to be passed to each thread.

Parameters

  opt | Video options
  func | Function to be passed to each thread
  client_data | Client data to be passed to the run function

Since 1.1.1

## ◆ gavl_video_options_get_stop_func()

GAVL_PUBLIC gavl_video_stop_func gavl_video_options_get_stop_func | ( | gavl_video_options_t * | opt,
|  | void ** | client_data
| ) |  |

Get function to be passed to each thread.

Parameters

  opt | Video options
  client_data | Returns client data

Returns
  The function

Since 1.1.1