unsigned long width; /**< Width */
unsigned long height; /**< Height */
size_t size; /**< Size */
- unsigned int image_count; /**< ImageCount */
- gboolean screen_desc_updated; /**< Check if screen description is updated */
- unsigned int current_count; /**< ImageCount */
- write_data write_data_ptr; /**< Encoded output data attached to callback */
- void *GifFile; /**< GifFile opened */
void *data; /**< Frames */
} mm_util_gif_data;
*/
int mm_util_decode_from_gif_memory(mm_util_gif_data * decoded, void *memory);
-/**
- * This function creates gif file for output file
- *
- * @param encoded [in ] pointer of mm_util_gif_data.
- * @param filename [out] output file name on to which the encoded stream will be written.
- * @return This function returns zero on success, or negative value with error code.
- * @remark image_count should be set to a valid value depending on number of images
- * to be encoded in the gif file.
- * @see mm_util_gif_data
- * @since R1, 1.0
- */
-int mm_util_encode_open_gif_file(mm_util_gif_data *encoded, const char *filename);
-
-/**
- * This function creates gif file for output memory
- *
- * @param encoded [in ] pointer of mm_util_gif_data.
- * @param filename [out] output file memory on to which the encoded stream will be written.
- * @return This function returns zero on success, or negative value with error code.
- * @remark image_count should be set to a valid value depending on number of images
- * to be encoded in the gif file.
- * @see mm_util_gif_data
- * @since R1, 1.0
- */
-int mm_util_encode_open_gif_memory(mm_util_gif_data *encoded, void **data);
-
-/**
- * This function encodes raw data to gif file/memory
- *
- * @param encoded [in ] pointer of mm_util_gif_data.
- * @param filename [out] output file name on to which the encoded stream will be written.
- * @return This function returns zero on success, or negative value with error code.
- * @remark image_count should be set to a valid value depending on number of images
- * to be encoded in the gif file.
- * @see mm_util_gif_data
- * @since R1, 1.0
- */
-int mm_util_encode_gif(mm_util_gif_data *encoded);
-
-/**
- * This function closes and deallocates all the memory allocated with giffile.
- *
- * @param encoded [in ] pointer of mm_util_gif_data.
- * @return This function returns zero on success, or negative value with error code.
- * @remark image_count should be set to a valid value depending on number of images
- * to be encoded in the gif file.
- * @see mm_util_gif_data
- * @since R1, 1.0
- */
-int mm_util_encode_close_gif(mm_util_gif_data *encoded);
-
/**
* This function creates the handle of the single image(frame).
*
return size;
}
-int mm_util_encode_open_gif_file(mm_util_gif_data *encoded, const char *filename)
-{
- mm_util_debug("mm_util_encode_open_gif_file");
- if (filename) {
- if ((encoded->GifFile = EGifOpenFileName(filename, 0, NULL)) == NULL) {
- mm_util_error("could not open file");
- return MM_UTIL_ERROR_INVALID_OPERATION;
- }
- } else
- return MM_UTIL_ERROR_INVALID_PARAMETER;
-
- return MM_UTIL_ERROR_NONE;
-}
-
-int mm_util_encode_open_gif_memory(mm_util_gif_data *encoded, void **data)
-{
- mm_util_debug("mm_util_encode_open_gif_memory");
- if (data) {
- encoded->write_data_ptr.mem = data;
- encoded->write_data_ptr.size = 0;
-
- if ((encoded->GifFile = EGifOpen(&(encoded->write_data_ptr), __write_function, NULL)) == NULL) {
- mm_util_error("could not open File");
- return MM_UTIL_ERROR_INVALID_OPERATION;
- }
- } else
- return MM_UTIL_ERROR_INVALID_PARAMETER;
-
- return MM_UTIL_ERROR_NONE;
-}
-
-int mm_util_encode_close_gif(mm_util_gif_data *encoded)
-{
- mm_util_debug("mm_util_encode_close_gif");
- if (encoded->GifFile == NULL) {
- mm_util_error("Invalid parameter");
- return MM_UTIL_ERROR_INVALID_PARAMETER;
- }
- if (EGifCloseFile(encoded->GifFile, NULL) == GIF_ERROR) {
- mm_util_error("could not close file");
- return MM_UTIL_ERROR_INVALID_OPERATION;
- }
- encoded->GifFile = NULL;
-
- return MM_UTIL_ERROR_NONE;
-}
-
static const int DEFAULT_COLORMAP_SIZE = (1 << 8);
int _gif_image_alloc_glob_ext_block(GifFileType *gif_file, int function, int byte_count, ExtensionBlock **ext_block);
mm_util_retvm_if(gif_image->image_data == NULL, MM_UTIL_ERROR_INVALID_PARAMETER, "Invalid parameter");
/* encode OutputBuffer to GifFile */
- unsigned char *ptr = gif_image->intermediate_image;
mm_util_retvm_if(gif_image->intermediate_image == NULL, MM_UTIL_ERROR_INVALID_OPERATION, "Intermediate_image is null");
mm_util_debug("put pixel count: %lu", (gif_image->intermediate_image_size / sizeof(GifPixelType)));
for (idx = 0; idx < (gif_image->intermediate_image_size / sizeof(GifPixelType)); idx++) {
- GifPixelType pixel = (GifPixelType)ptr[idx];
+ GifPixelType pixel = (GifPixelType)gif_image->intermediate_image[idx];
if (EGifPutPixel(gif_file->GifFile, pixel) == GIF_ERROR) {
mm_util_error("could not put pixel");
return MM_UTIL_ERROR_INVALID_OPERATION;