img_write_file()

Updated: April 19, 2023

Encode a frame to a file on the filesystem

Synopsis:

#include <img/img.h>

int img_write_file( img_lib_t                    ilib,
                    const char*                  path,
                    const img_encode_callouts_t* callouts,
                    img_t*                       img );

Arguments:

ilib
A handle for the image library, returned by img_lib_attach().
path
The full path to the file to create.
callouts
A pointer to an img_encode_callouts_t structure that provides system callouts for the encoder. If you specify NULL for this value, the library supplies a set of default callouts.
img
The address of an img_t structure describing the frame to be encoded.

Library:

libimg

Use the -l img option to qcc to link against this library.

Description:

This function encodes a frame to a file on the filesystem. This function is only capable of encoding a single frame. A codec is chosen based on the extension included in the provided filename.

The file will be automatically unlinked if the encode fails for any reason.

Returns:

IMG_ERR_OK
Success
IMG_ERR_FILE
Error accessing path (errno is set).
IMG_ERR_MEM
Memory-allocation failure.
IMG_ERR_FORMAT
No appropriate codec could be found that handles the extension included in the provided filename. The codec you require could be missing or corrupt.
IMG_ERR_NOSUPPORT
Input data format not supported; the codec and application could not agree on an output format.
IMG_ERR_TRUNC
Error writing data; file was truncated.
IMG_ERR_INTR
Encode was interrupted by application.

Classification:

Image library

Safety:  
Interrupt handler No
Signal handler No
Thread No