Get the total number of frames in the image stream
Synopsis:
#include <img/img.h>
int img_decode_get_frame_count( img_codec_t codec,
io_stream_t *input,
uintptr_t *decode_data,
unsigned *count );
Arguments:
-
codec
- The handle of the codec to use to decode the frame.
-
input
- The input source.
-
decode_data
- The address of the uintptr_t that was used for
img_decode_begin()
.
-
count
- A pointer to an unsigned integer where the number of frames can be stored.
Library:
libimg
Use the -l img option to
qcc
to link against this library.
Description:
Gets the total number of image frames in the image stream.
This function may only be called after calling
img_decode_begin()
, and before calling
img_decode_finish()
. If the function is successful, the count parameter contains a valid number of
frames.
Note: Calling this function may require reading the entire image stream
to determine the correct count of frames that can be decoded. For example, some image
file formats do not store the total number of frames in the header (for example, GIF),
thus the whole stream must be read to determine EOF and get an exact count. If you do
not want this behavior, provide an
img_decode_set_value_f
callout instead, and wait for the
IMG_VALUE_TYPE_FRAME_COUNT value to be returned once
it is known.
Returns:
-
IMG_ERR_OK
- Success. The complete frame was decoded.
-
IMG_ERR_PARM
- One of the parameters supplied was invalid.
-
IMG_ERR_NOTIMPL
- The codec does not provide an implementation for this function.
-
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.
Classification:
Image library
| Safety: |
|
| Interrupt handler |
No |
| Signal handler |
No |
| Thread |
No |