img_decode_frame_resize()

Decode and resize a frame from a stream

Synopsis:

#include <img/img.h>

int img_decode_frame_resize(img_codec_t                  codec,
                            io_stream_t                 *input,
                            const img_decode_callouts_t *callouts,
                            img_t                       *img,
                            uintptr_t                   *decode_data );

Since:

BlackBerry 10.1.0

Arguments:

codec
The handle of the codec to use to decode the frame.
input
The input source.
callouts
A pointer to an img_decode_callouts_t structure that provides system callouts for the decoder. If you pass NULL for this value, a set of default callouts is used. See the description of img_decode_callouts_t for more details.
img
The address of an img_t structure to fill with information regarding the decoded frame.

If you set the image width and height (img.w and img.h) before calling this function, then the image is sized to fit the specified dimensions rather than clipped, as it is with img_load_file(). The resizing is performed on-the-fly during the decoding, without incurring the memory penalty of loading the entire original image and then subsequently resizing it.

If you specify only one of the dimensions, then the other dimension is calculated based on the aspect ratio of the original image.

You also set the corresponding dimension flag in the img structure. For example, if you specify the width, then you set the IMG_W bit in flags.

decode_data
The address of the uintptr_t that was used for img_decode_begin() .

Library:

libimg

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

Description:

This function decodes a frame and optionally resizes it if the image width and height are specified. You need to call img_decode_begin() first to prepare for the decode, and img_decode_finish() to release any resources allocated for the decode.

Returns:

IMG_ERR_OK
Success. The complete frame was decoded.
IMG_ERR_MEM
Memory-allocation failure.
IMG_ERR_NOSUPPORT
Output data format not supported; the codec and application could not agree on an output format.
IMG_ERR_NODATA
No frame data was present. This return code indicates the end of a multi-frame data source.
IMG_ERR_CORRUPT
Invalid data was encountered in the stream, preventing the decode from proceeding. Some of the frame may be intact.
IMG_ERR_TRUNC
Premature end of data encountered. Some of the frame may be intact.
IMG_ERR_INTR
Decoding was interrupted by the application.
IMG_ERR_DLL
Error accessing the codec DLL; check errno and/or try running your application with DL_DEBUG=1.

Classification:

Image library

Safety:  
Interrupt handler No
Signal handler No
Thread No