Libmpo  Build #33
A WIP library to decode and encode MPO (multiple picture object) files
 All Data Structures Files Functions Variables Enumerations Enumerator
dmpo.h File Reference

Decompression methods and objects. More...

#include <stdbool.h>
#include "mpo.h"

Go to the source code of this file.

Data Structures

struct  decompress_struct_extended
 
struct  mpo_decompress
 

Typedefs

typedef struct mpo_decompress mpo_decompress_struct
 
typedef struct
decompress_struct_extended 
jpeg_decompress_struct_extended
 

Functions

void mpo_create_decompress (mpo_decompress_struct *mpoinfo)
 Initializes the mpoinfo struct. More...
 
void mpo_stdio_src (mpo_decompress_struct *mpoinfo, FILE *input)
 Set the source as a stdio FILE. More...
 
void mpo_mem_src (mpo_decompress_struct *mpoinfo, unsigned char *inbuffer, unsigned long insize)
 
bool mpo_read_header (mpo_decompress_struct *mpoinfo)
 Read the first image header. More...
 
int mpo_get_number_images (mpo_decompress_struct *mpoinfo)
 Number of images of the file. More...
 
bool mpo_start_decompress (mpo_decompress_struct *mpoinfo)
 Start JPEG decompression of current image.
 
J_COLOR_SPACE mpo_get_color_space (mpo_decompress_struct *mpoinfo)
 the output colorspace
 
JDIMENSION get_output_scanline (mpo_decompress_struct *mpoinfo)
 Next scanline to be read from jpeg_read_scanlines(). More...
 
JDIMENSION get_output_width (mpo_decompress_struct *mpoinfo)
 The output width.
 
JDIMENSION get_output_height (mpo_decompress_struct *mpoinfo)
 The output height.
 
bool all_scanlines_processed (mpo_decompress_struct *mpoinfo)
 convenience function More...
 
size_t mpo_read_scanlines (mpo_decompress_struct *mpoinfo, JSAMPARRAY scanlines, size_t max_lines)
 Read some scanlines of data from the JPEG decompressor. More...
 
void mpo_skip_to_image (mpo_decompress_struct *mpoinfo, int image)
 Skips to the beggining of an image. More...
 
bool mpo_finish_decompress (mpo_decompress_struct *mpoinfo)
 Finish JPEG decompression. More...
 
void mpo_destroy_decompress (mpo_decompress_struct *mpoinfo)
 Destroy the mpoinfo struct.
 
void mpo_decompress_error_exit (mpo_decompress_struct *mpoinfo, void exit_func(j_common_ptr))
 Function called when an error occurs in libjpeg. More...
 

Detailed Description

Decompression methods and objects.

Author
Lectem

Function Documentation

bool all_scanlines_processed ( mpo_decompress_struct mpoinfo)

convenience function

Returns
output_scanline >= output_height
JDIMENSION get_output_scanline ( mpo_decompress_struct mpoinfo)

Next scanline to be read from jpeg_read_scanlines().

Application may use this to control its processing loop, e.g., "while (get_output_scanline(mpoinfo) < get_output_height(mpoinfo))".

void mpo_create_decompress ( mpo_decompress_struct mpoinfo)

Initializes the mpoinfo struct.

Call this before doing anything with the decompression struct. It will initialize and create all necessary stuff for the decompression.

Note
Please call mpo_destroy_decompress once done with the decompression struct
void mpo_decompress_error_exit ( mpo_decompress_struct mpoinfo,
void   exit_funcj_common_ptr 
)

Function called when an error occurs in libjpeg.

Defaults to stopping the application

bool mpo_finish_decompress ( mpo_decompress_struct mpoinfo)

Finish JPEG decompression.

This will also set currentImage to currentImage+1

int mpo_get_number_images ( mpo_decompress_struct mpoinfo)

Number of images of the file.

Note
Only works after reading the 1st image header
bool mpo_read_header ( mpo_decompress_struct mpoinfo)

Read the first image header.

This will load all the MPO header information of the first image. You need to call this once before starting any decompression

Note
Individual images headers for the other images will be retrieved by calling mpo_start_decompress
Returns
false if suspended due to lack of input data
true if found a valid header
size_t mpo_read_scanlines ( mpo_decompress_struct mpoinfo,
JSAMPARRAY  scanlines,
size_t  max_lines 
)

Read some scanlines of data from the JPEG decompressor.

The return value will be the number of lines actually read. This may be less than the number requested in several cases, including bottom of image, data source suspension, and operating modes that emit multiple scanlines at a time.

void mpo_skip_to_image ( mpo_decompress_struct mpoinfo,
int  image 
)

Skips to the beggining of an image.

You can skip data by calling this function. You can then use mpo_start_decompress to resume decompression of the image passed in arguments.

Note
The skipped images header information retrieval will also be skipped.
void mpo_stdio_src ( mpo_decompress_struct mpoinfo,
FILE *  input 
)

Set the source as a stdio FILE.

The file has to be opened before calling.

Note
The file has to be closed by the caller once the decompression is finished.