Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. /* ----------------------------- MNI Header -----------------------------------
  2. @NAME       : mpeg.h
  3. @INPUT      :
  4. @OUTPUT     :
  5. @RETURNS    :
  6. @DESCRIPTION: Types and function prototypes needed for applications to
  7.               use the Berkely MPEG decoding engine via the MNI front
  8.               end.
  9. @METHOD     :
  10. @GLOBALS    : Types defined:
  11.                  ImageDesc  - structure giving height, width, etc.
  12.                  DitherEnum - the different dither types supported by
  13.                               the decoding engine
  14. @CALLS      :
  15. @CREATED    : Greg Ward, 94/6/16.
  16. @MODIFIED   : Greg Ward, 94/9/12 (based on John Cristy's fixes): made
  17.               more amenable to use with other libraries that also
  18.               happen to define TRUE, FALSE, [Bb]oolean, and added
  19.               PROTO macro
  20. ---------------------------------------------------------------------------- */
  21.  
  22. #ifndef __MPEG_H
  23. #define __MPEG_H
  24.  
  25. #include <stdio.h>
  26.  
  27. /* An attempt at a portable and integrable boolean type... */
  28.  
  29. #if (!defined(TRUE) || !defined(FALSE))
  30. # define TRUE 1
  31. # define FALSE 0
  32. #endif
  33.  
  34. #if (!defined (BOOLEAN_TYPE_EXISTS))
  35. typedef unsigned int Boolean;
  36. #endif
  37.  
  38. typedef struct
  39. {
  40.    short red, green, blue;
  41. } ColormapEntry;
  42.  
  43. typedef struct
  44. {
  45.    int  Height;                 /* in pixels */
  46.    int  Width;
  47.    int  Depth;                  /* image depth (bits) */
  48.    int  PixelSize;              /* bits actually stored per pixel */
  49.    int  Size;                   /* bytes for whole image */
  50.    int  BitmapPad;              /* "quantum" of a scanline -- each scanline */
  51.                                 /* starts on an even interval of this */
  52.                                 /* many bits */
  53.    int  PictureRate;            /* required number of frames/sec [?] */
  54.    int  BitRate;                /* ??? */
  55.    
  56.    int  ColormapSize;
  57.    ColormapEntry *Colormap;     /* an array of ColormapSize entries */
  58. } ImageDesc;
  59.  
  60. typedef enum
  61. {
  62.    HYBRID_DITHER,
  63.    HYBRID2_DITHER,
  64.    FS4_DITHER,
  65.    FS2_DITHER,
  66.    FS2FAST_DITHER,
  67.    Twox2_DITHER,
  68.    GRAY_DITHER,
  69.    FULL_COLOR_DITHER,
  70.    NO_DITHER,
  71.    ORDERED_DITHER,
  72.    MONO_DITHER,
  73.    MONO_THRESHOLD,
  74.    ORDERED2_DITHER,
  75.    MBORDERED_DITHER
  76. } DitherEnum;
  77.  
  78.  
  79. typedef enum
  80. {
  81.    MPEG_DITHER,
  82.    MPEG_QUIET,
  83.    MPEG_LUM_RANGE,
  84.    MPEG_CR_RANGE,
  85.    MPEG_CB_RANGE,
  86.    MPEG_CMAP_INDEX
  87. } MPEGOptionEnum;
  88.  
  89. #ifdef __cplusplus
  90. extern "C" {
  91. #endif
  92.  
  93. /*
  94.  * Kludge so we can compile under ANSI or K&R.  (This only means
  95.  * that programs that *use* mpeg_lib can be compiled with K&R;
  96.  * the library itself must be compiled with an ANSI compiler.
  97.  * Mixing and matching compilers, BTW, is not a good idea...)
  98.  */
  99. #undef PROTO
  100. #if __STDC__ || __cplusplus
  101. #define PROTO(formal_parameters) formal_parameters
  102. #else
  103. #define const
  104. #define PROTO(formal_parameters) ()
  105. #endif
  106.  
  107. /* Function prototypes (all are defined in wrapper.c) */
  108.  
  109. Boolean OpenMPEG PROTO((FILE *MPEGfile, ImageDesc *ImgInfo));
  110. void    CloseMPEG PROTO((void));
  111. Boolean RewindMPEG PROTO((FILE *MPEGfile, ImageDesc *Image));
  112. void    SetMPEGOption PROTO((MPEGOptionEnum Option, int value));
  113. Boolean GetMPEGFrame PROTO((char *Frame));
  114.  
  115. #ifdef __cplusplus
  116. }
  117. #endif
  118.  
  119. #endif   /* __MPEG_H */
  120.