home *** CD-ROM | disk | FTP | other *** search
/ Network PC / Network PC.iso / amiga utilities / graphics / display / mpega / src / mpega.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-11-20  |  1.7 KB  |  70 lines

  1. /*------------------------------------------------------------------------------
  2.  
  3.     File    :    mpega.c
  4.  
  5.     Author  :    Stéphane TAVENARD
  6.  
  7.     $VER:   mpega.c  1.1  (10/09/1995)
  8.  
  9.     (C) Copyright 1995-1995 Stéphane TAVENARD
  10.     All Rights Reserved
  11.  
  12.     #Rev|   Date   |              Comment
  13.     ----|----------|--------------------------------------------------------
  14.     0    |01/05/1995| Initial revision                      ST
  15.     1    |28/05/1995| First release                      ST
  16.     2    |05/06/1995| Aminet release ? not yet ...              ST
  17.     3    |23/06/1995| Aminet release                      ST
  18.     4    |10/09/1995| Added Mixing frequency option, Aminet release      ST
  19.  
  20.     ------------------------------------------------------------------------
  21.  
  22.     MPEG I Audio layer I & II fast decoding
  23.  
  24. ------------------------------------------------------------------------------*/
  25.  
  26. #include <stdio.h>
  27. #include <stdlib.h>
  28. #include "mpega_decode.h"
  29. #include "user_interface.h"
  30.  
  31. static frame_params *fr_ps;
  32.  
  33. void main_exit( void )
  34. {
  35.    if( fr_ps ) {
  36.       fr_ps = MPEGA_close( fr_ps );
  37.    }
  38. }
  39.  
  40. int main( int argc, char **argv )
  41. {
  42.    fr_ps = MPEGA_open();
  43.    if( !fr_ps ) {
  44.       fprintf( stderr, "Not enough memory !\n" );
  45.       exit( 0 );
  46.    }
  47.    atexit( main_exit );
  48.  
  49.    USIN_get_parameters( argc, argv, fr_ps );
  50.  
  51.    if( !MPEGA_init_decode( fr_ps ) ) exit( 0 );
  52.  
  53.    USIN_display_info( fr_ps );
  54.  
  55.     while( MPEGA_decode_frame( fr_ps ) ) {
  56.        if( fr_ps->out_write_length > fr_ps->out_write_level ) {
  57.       (void)MPEGA_write_out( fr_ps );
  58.        }
  59.        if( (fr_ps->frame_count & 15) == 0 ) USIN_display_frame_number( fr_ps );
  60.     }
  61.     (void)MPEGA_write_out( fr_ps );
  62.     (void)MPEGA_write_out( fr_ps ); /* Second write for close audio or file */
  63.  
  64.     USIN_epilog( fr_ps );
  65.  
  66.     fr_ps = MPEGA_close( fr_ps );
  67.  
  68.     return 0;
  69. }
  70.