# HG changeset patch # User arpi_esp # Date 989622435 0 # Node ID ec7e6bd74b460993f6da67acdc2cec06477fbc47 # Parent 50c5a214b0d4ee509626494e5cfd8612af170e52 very outdated, and does teh same as -dump[audio|video] in mplayer diff -r 50c5a214b0d4 -r ec7e6bd74b46 aviparse.c --- a/aviparse.c Fri May 11 23:01:52 2001 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,336 +0,0 @@ -// AVI Parser tool v0.1 (C) 2000. by A'rpi/ESP-team - -#include -#include - -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include "config.h" - -#include "loader.h" -#include "wine/avifmt.h" -//#include "libvo/video_out.h" - -#include "linux/timer.h" -#include "linux/shmem.h" - -#include "help_avp.h" - -#define DEBUG if(0) - -//static int show_packets=0; - -typedef struct { - // file: - MainAVIHeader avih; - unsigned int movi_start; - unsigned int movi_end; - // index: - AVIINDEXENTRY* idx; - int idx_size; - int idx_pos; -// int a_idx; -// int v_idx; - // video: - AVIStreamHeader video; - char *video_codec; - BITMAPINFOHEADER bih; // in format - BITMAPINFOHEADER o_bih; // out format - HIC hic; - void *our_out_buffer; - char yuv_supported; // 1 if codec support YUY2 output format - char yuv_hack_needed; // requires for divx & mpeg4 - // audio: - AVIStreamHeader audio; - char *audio_codec; - char wf_ext[64]; // in format - WAVEFORMATEX wf; // out format - HACMSTREAM srcstream; - int audio_minsize; -} avi_header_t; - -avi_header_t avi_header; - -#include "aviprint.c" -//#include "codecs.c" - -//**************************************************************************// -#include "stream.c" -//#include "demuxer.c" -//#include "demux_avi.c" - -static stream_t* stream=NULL; - -//**************************************************************************// - -extern int errno; -static int play_in_bg=0; - -void exit_player(){ -// int tmp; - // restore terminal: - getch2_disable(); - printf("\n\n"); - if(play_in_bg) system("xsetroot -solid \\#000000"); - exit(1); -} - -void exit_sighandler(int x){ - printf("\nmpgplay2 interrupted by signal %d\n",x); - exit_player(); -} - - -int main(int argc,char* argv[]){ -char* filename=NULL; //"MI2-Trailer.avi"; -int i; -//int seek_to_sec=0; -int seek_to_byte=0; -int f; // filedes -int has_audio=1; -//int audio_format=0; -//int alsa=0; -//int audio_buffer_size=-1; -int audio_id=-1; -//int video_id=-1; -//float default_max_pts_correction=0.01f; -//int delay_corrected=0; -//float force_fps=0; -//float default_fps=25; -//float audio_delay=0; -int stream_type; -//int elementary_stream=0; -int vcd_track=0; -#ifdef VCD_CACHE -int vcd_cache_size=128; -#endif -//char* video_driver="mga"; // default -//int out_fmt=0; -int idx_filepos=0; -FILE *audiofile=NULL; -FILE *videofile=NULL; -char *audiofile_name=NULL; -char *videofile_name=NULL; - - printf("%s",banner_text); - -for(i=1;i>4; -// printf("Reading INDEX block, %d chunks for %d frames\n", -// avi_header.idx_size,avi_header.avih.dwTotalFrames); - avi_header.idx=malloc(avi_header.idx_size<<4); - idx_filepos=stream_tell(stream); - stream_read(stream,(char*)avi_header.idx,avi_header.idx_size<<4); - chunksize-=avi_header.idx_size<<4; - print_index(); - break; - } - } - if(chunksize>0) stream_skip(stream,chunksize); else - if(chunksize<0) printf("WARNING!!! chunksize=%d (id=%.4s)\n",chunksize,&id); - -} - -printf("----------------------------------------------------------------------\n"); -printf("Found movie at 0x%X - 0x%X\n",avi_header.movi_start,avi_header.movi_end); -if(avi_header.idx_size<=0){ printf("No index block found!\n");return 0;} -printf("Index block at 0x%X, %d entries for %d frames\n",idx_filepos, - avi_header.idx_size,avi_header.avih.dwTotalFrames ); - -stream_reset(stream); -stream_seek(stream,avi_header.movi_start); -avi_header.idx_pos=0; - -if(audiofile_name) audiofile=fopen(audiofile_name,"wb"); -if(videofile_name) videofile=fopen(videofile_name,"wb"); - -for(i=0;i