Video converter
Video

Video format converter. More...

## Typedefs

typedef struct gavl_video_converter_s | gavl_video_converter_t
| Opaque video converter structure. More...

## Functions

GAVL_PUBLIC gavl_video_converter_t * | gavl_video_converter_create ()
| Creates a video converter. More...
GAVL_PUBLIC void | gavl_video_converter_destroy (gavl_video_converter_t *cnv)
| Destroys a video converter and frees all associated memory. More...
GAVL_PUBLIC gavl_video_options_t * | gavl_video_converter_get_options (gavl_video_converter_t *cnv)
| gets options of a video converter More...
GAVL_PUBLIC int | gavl_video_converter_init (gavl_video_converter_t *cnv, const gavl_video_format_t *input_format, const gavl_video_format_t *output_format)
| Initialize a video converter. More...
GAVL_PUBLIC int | gavl_video_converter_reinit (gavl_video_converter_t *cnv)
| Reinitialize a video converter. More...
GAVL_PUBLIC void | gavl_video_convert (gavl_video_converter_t *cnv, const gavl_video_frame_t *input_frame, gavl_video_frame_t *output_frame)
| Convert video. More...

## Detailed Description

Video format converter.

This is a generic converter, which converts video frames from one arbitrary format to another. It can convert pixelformats, scale images and deinterlace.

For quality levels of 3 and below, pixelformats are converted in one single step, without the need for intermediate frames. Quality levels of 4 and 5 will take care of chroma placement. For this, a gavl_video_scaler_t will be used.

Deinterlacing is enabled if the input format is interlaced and the output format is progressive and the deinterlace mode is something else than GAVL_DEINTERLACE_NONE. You can also force deinterlacing (GAVL_FORCE_DEINTERLACE).

Create a video converter with gavl_video_converter_create. If you want to configure it, get the options pointer with gavl_video_converter_get_options and change the options (See Video conversion options). Call gavl_video_converter_init to initialize the converter for the input and output formats. Video frames are then converted with gavl_video_convert.

When you are done, you can either reinitialize the converter or destroy it with gavl_video_converter_destroy.

## Typedef Documentation

## gavl_video_converter_t

typedef struct gavl_video_converter_s gavl_video_converter_t

Opaque video converter structure.

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

## Function Documentation

## gavl_video_converter_create()

GAVL_PUBLIC gavl_video_converter_t * gavl_video_converter_create | ( |  | ) |

Creates a video converter.

Returns
  A newly allocated video converter

## gavl_video_converter_destroy()

GAVL_PUBLIC void gavl_video_converter_destroy | ( | gavl_video_converter_t * | cnv | ) |

Destroys a video converter and frees all associated memory.

Parameters

  cnv | A video converter

## gavl_video_converter_get_options()

GAVL_PUBLIC gavl_video_options_t * gavl_video_converter_get_options | ( | gavl_video_converter_t * | cnv | ) |

gets options of a video converter

Parameters

  cnv | A video converter

After you called this, you can use the gavl_video_options_set_*() functions to change the options. Options will become valid with the next call to gavl_video_converter_init or gavl_video_converter_reinit.

## gavl_video_converter_init()

GAVL_PUBLIC int gavl_video_converter_init | ( | gavl_video_converter_t * | cnv,
|  | const gavl_video_format_t * | input_format,
|  | const gavl_video_format_t * | output_format
| ) |  |

Initialize a video converter.

Parameters

  cnv | A video converter
  input_format | Input format
  output_format | Output format

Returns
  The number of single conversion steps necessary to perform the conversion. It may be 0, in this case you must not use the converter and have to pass the video frames directly. If something goes wrong (should never happen), -1 is returned.

This function can be called multiple times with one instance

## gavl_video_converter_reinit()

GAVL_PUBLIC int gavl_video_converter_reinit | ( | gavl_video_converter_t * | cnv | ) |

Reinitialize a video converter.

Parameters

  cnv | A video converter

Returns
  The number of single conversion steps necessary to perform the conversion. It may be 0, in this case you must not use the converter and have to pass the video frames directly. If something goes wrong (should never happen), -1 is returned.

This function can be called if the input and output formats didn't change but the options did.

## gavl_video_convert()

GAVL_PUBLIC void gavl_video_convert | ( | gavl_video_converter_t * | cnv,
|  | const gavl_video_frame_t * | input_frame,
|  | gavl_video_frame_t * | output_frame
| ) |  |

Convert video.

Parameters

  cnv | A video converter
  input_frame | Input frame
  output_frame | Output frame