IpatchCramDecoder

IpatchCramDecoder — CRAM decoder object.

Synopsis




                    IpatchCramDecoderFileInfo;
                    DecoderRelocEntry;
                    IpatchCramDecoder;
                    IpatchCramDecoderClass;
IpatchCramDecoder*  ipatch_cram_decoder_new             (IpatchFile *cramfile);
void                ipatch_cram_decoder_set_cram_file   (IpatchCramDecoder *decoder,
                                                         IpatchFile *cramfile);
gboolean            ipatch_cram_decoder_start           (IpatchCramDecoder *decoder,
                                                         GError **err);
IpatchCramDecoderFileInfo* ipatch_cram_decoder_next_file
                                                        (IpatchCramDecoder *decoder,
                                                         GError **err);
void                ipatch_cram_decoder_set_dest_file   (IpatchCramDecoder *decoder,
                                                         IpatchFile *dest);
gboolean            ipatch_cram_decoder_decode_file     (IpatchCramDecoder *decoder,
                                                         GError **err);
gboolean            ipatch_cram_decoder_decode_all      (IpatchCramDecoder *decoder,
                                                         const char *path,
                                                         GError **err);

Object Hierarchy


  GObject
   +----IpatchCramDecoder

Properties


  "comment"                  gchararray            : Read
  "file-audio-md5"           gchararray            : Read
  "file-binary-md5"          gchararray            : Read
  "file-compress-size"       guint64               : Read
  "file-date"                guint                 : Read
  "file-flags"               guint                 : Read
  "file-name"                gchararray            : Read
  "file-size"                guint64               : Read
  "flags"                    guint                 : Read
  "read-version"             guint                 : Read
  "software"                 gchararray            : Read
  "version"                  guint                 : Read

Description

An object for decoding (uncompressing) a CRAM file. The IpatchConverter interface may be a more convenient method for decoding a CRAM file.

Details

IpatchCramDecoderFileInfo

typedef struct {
  char *filename;     /* file name (can be contain a relative path) */
  guint64 size;			/* size of original file */
  guint64 compress_size;    /* total compressed size (incl. CRAM overhead) */
  guint32 date;		     /* unix file timestamp or 0 if not set */
  guint flags;			/* per file flags */
} IpatchCramDecoderFileInfo;


DecoderRelocEntry

typedef struct _DecoderRelocEntry DecoderRelocEntry;


IpatchCramDecoder

typedef struct _IpatchCramDecoder IpatchCramDecoder;


IpatchCramDecoderClass

typedef struct {
  GObjectClass parent_class;
} IpatchCramDecoderClass;


ipatch_cram_decoder_new ()

IpatchCramDecoder*  ipatch_cram_decoder_new             (IpatchFile *cramfile);

Create a new Cram decoder instance.

cramfile : Source Cram file to decode or NULL to set later
Returns : New Cram decoder with a refcount of 1 which the caller owns.

ipatch_cram_decoder_set_cram_file ()

void                ipatch_cram_decoder_set_cram_file   (IpatchCramDecoder *decoder,
                                                         IpatchFile *cramfile);

Set the source Cram file object to decode from. Either passing a cram file object to ipatch_cram_decoder_new() or calling this function is required before decoding can commence.

decoder : Cram decoder
cramfile : Source Cram file object to decode from

ipatch_cram_decoder_start ()

gboolean            ipatch_cram_decoder_start           (IpatchCramDecoder *decoder,
                                                         GError **err);

This function loads the Cram header and gets ready for decoding.

decoder : Cram decoder
err : Location to store error info or NULL
Returns : TRUE on success, FALSE otherwise

ipatch_cram_decoder_next_file ()

IpatchCramDecoderFileInfo* ipatch_cram_decoder_next_file
                                                        (IpatchCramDecoder *decoder,
                                                         GError **err);

Start decode of next file in Cram source file. Decodes the file header and returns the filename, original size and date information. This function should be called until it returns NULL which indicates no more files (or error). ipatch_cram_decoder_set_dest_file() and ipatch_cram_decoder_decode_file() can be called after this function (provided NULL is not returned) to decode a file at a time, if they are not called before the next call to this function then the current file is skipped.

See ipatch_cram_decoder_decode_all() for an alternative decoding method which just decodes all files to a specified path.

decoder : Cram decoder
err : Location to store error info or NULL
Returns : File info structure which is internal and should not be modified or freed or NULL if no more files to decode or error (in which case err may be set).

ipatch_cram_decoder_set_dest_file ()

void                ipatch_cram_decoder_set_dest_file   (IpatchCramDecoder *decoder,
                                                         IpatchFile *dest);

This function sets the file object to decode the current file in the cram stream to. It can be called after ipatch_cram_decoder_next_file() to decode one file at a time. To extract all files in a CRAM file to a directory call ipatch_cram_decoder_decode_all() instead.

decoder : Cram decoder
dest : Destination file object to decode current file to

ipatch_cram_decoder_decode_file ()

gboolean            ipatch_cram_decoder_decode_file     (IpatchCramDecoder *decoder,
                                                         GError **err);

Decodes a single file from a cram stream. The ipatch_cram_decoder_next_file() and ipatch_cram_decoder_set_dest() functions must be called before this, for each file in the stream.

decoder : Cram decoder
err : Location to store error info or NULL
Returns : TRUE on success, FALSE on error (in which case err may be set).

ipatch_cram_decoder_decode_all ()

gboolean            ipatch_cram_decoder_decode_all      (IpatchCramDecoder *decoder,
                                                         const char *path,
                                                         GError **err);

Decodes all files from a cram file to the specified path. The ipatch_cram_decoder_start() function must be called before this.

decoder : Cram decoder
path : Path to use as the root of file extraction or NULL to use current working directory
err : Location to store error info or NULL
Returns : TRUE on success, FALSE otherwise (in which case err may be set).

Property Details

The "comment" property

  "comment"                  gchararray            : Read

Comment.

Default value: NULL


The "file-audio-md5" property

  "file-audio-md5"           gchararray            : Read

Current file audio data MD5.

Default value: NULL


The "file-binary-md5" property

  "file-binary-md5"          gchararray            : Read

Current file binary data MD5.

Default value: NULL


The "file-compress-size" property

  "file-compress-size"       guint64               : Read

Current file total compressed size.

Default value: 0


The "file-date" property

  "file-date"                guint                 : Read

Current file date (timestamp).

Default value: 0


The "file-flags" property

  "file-flags"               guint                 : Read

Current file CRAM flags.

Default value: 0


The "file-name" property

  "file-name"                gchararray            : Read

Current file name.

Default value: NULL


The "file-size" property

  "file-size"                guint64               : Read

Current file original size.

Default value: 0


The "flags" property

  "flags"                    guint                 : Read

CRAM flags.

Default value: 0


The "read-version" property

  "read-version"             guint                 : Read

Minimum required CRAM decoder version.

Default value: 0


The "software" property

  "software"                 gchararray            : Read

Software used to write the file.

Default value: NULL


The "version" property

  "version"                  guint                 : Read

CRAM version.

Default value: 0

See Also

IpatchCramDecoderConverter