main.c 721 Bytes
#include <stdio.h>

int atoi( char * );

int parse_trace;
int num_tok;

#include "huf.h"
#include "huf_proto.h"
#include "mpeg_proto.h"

main(int argc, char **argv)
{
    int stream;

    num_tok = 0;
    parse_trace = 0;

    if( argc > 1 )
	stream = mpeg_open_stream( argv[1] );
    else
	stream = mpeg_open_stream( "bits.file" );

    mpeg_start_saving_tokens( stream, "tokens.out" );

    parse_trace = 0;
    if( argc > 2 ) {
	parse_trace = 1;
	if( atoi( argv[2] ) >= 0 )
	    mpeg_set_trace_file( stderr );
	else
	    mpeg_set_trace_file( stdout );
    };

    huf_set_trace(0);
    if( argc > 3 )
	huf_set_trace(1);

    while( mpeg_process_next_picture( stream ) >= 0 )
	;
    
    mpeg_close_stream( stream );
}