*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->IRIX man pages -> old-compression/clQueryScheme (3d)              
Title
Content
Arch
Section
 

Contents


clQueryScheme(3dm)					    clQueryScheme(3dm)


NAME    [Toc]    [Back]

     clQueryScheme, clQueryMaxHeaderSize, clReadHeader - Determine the scheme
     and read the stream header

SYNOPSIS    [Toc]    [Back]

     #include <dmedia/cl.h>

     int clQueryScheme(void *header)
     int clQueryMaxHeaderSize(int scheme)
     int clReadHeader(CLhandle handle, int headerSize, void *header)

ARGUMENTS    [Toc]    [Back]

     header	    A pointer to a buffer containing at	least 16 bytes of the
		    header.

     scheme	    The	decompression scheme to	use.

     handle	    A handle to	the decompressor.

     headerSize	    The	maximum	size of	the header in bytes.

     header	    A pointer to a buffer containing the header.

     clQueryScheme attempts to determine the appropriate decompression scheme
     from 16 bytes of the stream header.  It can be called before
     clOpenDecompressor	to determine which scheme to use.

     Once the scheme has been determined, the handle can be opened and then
     the header	can be read using clReadHeader.	 The size of the header
     information is obtained from clQueryMaxHeaderSize.

     clReadHeader uses only the	data in	header and does	not depend on any
     implicitly	defined	buffers.  This call will set up	state parameters for
     handle based on information available in the header.  The format of the
     header is scheme-dependent	and should not be accessed directly by the
     application.

RETURN VALUES    [Toc]    [Back]

     On	success, clQueryScheme returns the scheme identifier,
     clQueryMaxHeaderSize returns the maximum size of the header, and
     clReadHeader returns the number of	header bytes read for all cases	except
     for MPEG1,	in which case it returns a value of 1. This is becuase many
     different types of	headers	and much non-header information	may need to be
     read enroute to reading the relevant MPEG1	headers.  On failure, these
     calls return negative error codes.









									Page 1






clQueryScheme(3dm)					    clQueryScheme(3dm)



EXAMPLE
	  #include <dmedia/cl.h>

	  int decompressionScheme;
	   ...
	  /* Determine the scheme from the first 16 bytes of the header	*/
	  header = malloc(16);
	  read(inFile, header, 16);
	  decompressionScheme =	clQueryScheme(header);
	  if(decompressionScheme < 0) {
	      fprintf(stderr, "Unknown scheme in stream	header.");
	      exit(0);
	  }
	  free(header);

	  /* Open the appropriate decompressor */
	  clOpenDecompressor(decompressionScheme, &decompressorHdl);

	  /* Find out how much header information to provide */
	  headerSize = clQueryMaxHeaderSize(decompressionScheme);

	  if(headerSize	> 0) {

	      /* Get the header	data */
	      header = malloc(headerSize);
	      lseek(inFile, 0, SEEK_SET);
	      read(inFile, header, headerSize);

	      /* Read the header */
	      clReadHeader(decompressorHdl, headerSize,	header);
	      free(header);

	      /* Reset the stream */
	      lseek(inFile, 0, SEEK_SET);
	  }
	   ...

SEE ALSO    [Toc]    [Back]

      
      
     CLintro(3dm), clOpenDecompressor(3dm)


									PPPPaaaaggggeeee 2222
[ Back ]
 Similar pages
Name OS Title
sockatmark FreeBSD determine whether the read pointer is at the OOB mark
ldnshread Tru64 read an indexed/named section header of a common object file
ldshread Tru64 read an indexed/named section header of a common object file
ldshread IRIX read an indexed/named section header of a common object file
vlisstreamused IRIX determine if VL stream is used
fwide Linux set and determine the orientation of a FILE stream
bgets IRIX read stream up to next delimiter
ldfhread IRIX read the file header of a common object file
ldfhread Tru64 read the file header of a common object file
ldahread IRIX read the archive header of a member of an archive file
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service