[Mplayer-cvslog] CVS: main asfheader.c,1.16,1.17 aviheader.c,1.14,1.15 dec_audio.c,1.17,1.18 demux_mpg.c,1.21,1.22 mplayer.c,1.173,1.174 stheader.h,1.9,1.10
Arpi of Ize
arpi at mplayer.dev.hu
Sat Jul 7 20:46:18 CEST 2001
Update of /cvsroot/mplayer/main
In directory mplayer:/var/tmp.root/cvs-serv26699
Modified Files:
asfheader.c aviheader.c dec_audio.c demux_mpg.c mplayer.c
stheader.h
Log Message:
some code clanup (first step to libdemuxer)
Index: asfheader.c
===================================================================
RCS file: /cvsroot/mplayer/main/asfheader.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- asfheader.c 4 Jun 2001 18:01:05 -0000 1.16
+++ asfheader.c 7 Jul 2001 18:46:15 -0000 1.17
@@ -165,7 +165,7 @@
stream_read(demuxer->stream,(char*) buffer,streamh.type_size);
switch(*((unsigned int*)&streamh.type)){
case 0xF8699E40: { // guid_audio_stream
- sh_audio_t* sh_audio=new_sh_audio(streamh.stream_no & 0x7F);
+ sh_audio_t* sh_audio=new_sh_audio(demuxer,streamh.stream_no & 0x7F);
sh_audio->wf=calloc((streamh.type_size<sizeof(WAVEFORMATEX))?sizeof(WAVEFORMATEX):streamh.type_size,1);
memcpy(sh_audio->wf,buffer,streamh.type_size);
if(verbose>=1) print_wave_header(sh_audio->wf);
@@ -183,7 +183,7 @@
break;
}
case 0xBC19EFC0: { // guid_video_stream
- sh_video_t* sh_video=new_sh_video(streamh.stream_no & 0x7F);
+ sh_video_t* sh_video=new_sh_video(demuxer,streamh.stream_no & 0x7F);
int len=streamh.type_size-(4+4+1+2);
// sh_video->bih=malloc(chunksize); memset(sh_video->bih,0,chunksize);
sh_video->bih=calloc((len<sizeof(BITMAPINFOHEADER))?sizeof(BITMAPINFOHEADER):len,1);
Index: aviheader.c
===================================================================
RCS file: /cvsroot/mplayer/main/aviheader.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- aviheader.c 5 Jun 2001 18:40:44 -0000 1.14
+++ aviheader.c 7 Jul 2001 18:46:15 -0000 1.15
@@ -70,11 +70,11 @@
chunksize-=MIN(size2,sizeof(h));
++stream_id;
if(h.fccType==streamtypeVIDEO){
- sh_video=new_sh_video(stream_id);
+ sh_video=new_sh_video(demuxer,stream_id);
memcpy(&sh_video->video,&h,sizeof(h));
} else
if(h.fccType==streamtypeAUDIO){
- sh_audio=new_sh_audio(stream_id);
+ sh_audio=new_sh_audio(demuxer,stream_id);
memcpy(&sh_audio->audio,&h,sizeof(h));
}
last_fccType=h.fccType;
Index: dec_audio.c
===================================================================
RCS file: /cvsroot/mplayer/main/dec_audio.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- dec_audio.c 8 Jun 2001 23:30:43 -0000 1.17
+++ dec_audio.c 7 Jul 2001 18:46:15 -0000 1.18
@@ -31,11 +31,11 @@
#include "loader/DirectShow/DS_AudioDec.h"
-static sh_audio_t* ac3_audio_sh=NULL;
+static sh_audio_t* dec_audio_sh=NULL;
// AC3 decoder buffer callback:
static void ac3_fill_buffer(uint8_t **start,uint8_t **end){
- int len=ds_get_packet(ac3_audio_sh->ds,start);
+ int len=ds_get_packet(dec_audio_sh->ds,start);
//printf("<ac3:%d>\n",len);
if(len<0)
*start = *end = NULL;
@@ -43,6 +43,13 @@
*end = *start + len;
}
+// MP3 decoder buffer callback:
+int mplayer_audio_read(char *buf,int size){
+ int len;
+ len=demux_read_data(dec_audio_sh->ds,buf,size);
+ return len;
+}
+
int init_audio(sh_audio_t *sh_audio){
@@ -177,7 +184,7 @@
}
case 3: {
// Dolby AC3 audio:
- ac3_audio_sh=sh_audio; // save sh_audio for the callback:
+ dec_audio_sh=sh_audio; // save sh_audio for the callback:
ac3_config.fill_buffer_callback = ac3_fill_buffer;
ac3_config.num_output_ch = 2;
ac3_config.flags = 0;
@@ -221,6 +228,7 @@
}
case 1: {
// MPEG Audio:
+ dec_audio_sh=sh_audio; // save sh_audio for the callback:
#ifdef USE_FAKE_MONO
MP3_Init(fakemono);
#else
Index: demux_mpg.c
===================================================================
RCS file: /cvsroot/mplayer/main/demux_mpg.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- demux_mpg.c 18 Jun 2001 22:11:04 -0000 1.21
+++ demux_mpg.c 7 Jul 2001 18:46:15 -0000 1.22
@@ -36,8 +36,8 @@
//static char dvdaudio_table[256];
//static unsigned int packet_start_pos=0;
-extern void *new_sh_audio(int id);
-extern void *new_sh_video(int id);
+extern void *new_sh_audio(demuxer_t *demux,int id);
+extern void *new_sh_video(demuxer_t *demux,int id);
static int demux_mpg_read_packet(demuxer_t *demux,int id){
int d;
@@ -157,7 +157,7 @@
// aid=128+(aid&0x7F);
// aid=0x80..0xBF
- if(!demux->a_streams[aid]) new_sh_audio(aid);
+ if(!demux->a_streams[aid]) new_sh_audio(demux,aid);
if(demux->audio->id==-1) demux->audio->id=aid;
if(demux->audio->id==aid){
@@ -210,7 +210,7 @@
if(id>=0x1C0 && id<=0x1DF){
// mpeg audio
int aid=id-0x1C0;
- if(!demux->a_streams[aid]) new_sh_audio(aid);
+ if(!demux->a_streams[aid]) new_sh_audio(demux,aid);
if(demux->audio->id==-1) demux->audio->id=aid;
if(demux->audio->id==aid){
ds=demux->audio;
@@ -221,7 +221,7 @@
if(id>=0x1E0 && id<=0x1EF){
// mpeg video
int aid=id-0x1E0;
- if(!demux->v_streams[aid]) new_sh_video(aid);
+ if(!demux->v_streams[aid]) new_sh_video(demux,aid);
if(demux->video->id==-1) demux->video->id=aid;
if(demux->video->id==aid){
ds=demux->video;
Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.173
retrieving revision 1.174
diff -u -r1.173 -r1.174
--- mplayer.c 7 Jul 2001 09:53:47 -0000 1.173
+++ mplayer.c 7 Jul 2001 18:46:15 -0000 1.174
@@ -20,15 +20,15 @@
#include "version.h"
#include "config.h"
-#if defined(sun)
-#define DEFAULT_CDROM_DEVICE "/vol/dev/aliases/cdrom0"
-#elif defined(__FreeBSD__)
-#define DEFAULT_CDROM_DEVICE "/dev/cdrom"
+#ifdef __FreeBSD__
#include <sys/cdrio.h>
-#else
-#define DEFAULT_CDROM_DEVICE "/dev/cdrom"
#endif
+#ifdef sun
+#define DEFAULT_CDROM_DEVICE "/vol/dev/aliases/cdrom0"
+#else
+#define DEFAULT_CDROM_DEVICE "/dev/cdrom"
+#endif
#ifndef MAX_OUTBURST
#error "============================================="
@@ -74,14 +74,9 @@
#include "opendivx/decore.h"
-
-#ifdef X11_FULLSCREEN
-extern int vo_screenwidth;
-#endif
-
extern char* win32_codec_name; // must be set before calling DrvOpen() !!!
-extern int errno;
+// extern int errno;
#include "linux/getch2.h"
#include "linux/keycodes.h"
@@ -109,7 +104,6 @@
#define ABS(x) (((x)>=0)?(x):(-(x)))
-static subtitle* subtitles=NULL;
void find_sub(subtitle* subtitles,int key);
static int
@@ -160,27 +154,24 @@
return buff;
}
-static int max_framesize=0;
-
-//static int show_packets=0;
-
//**************************************************************************//
//**************************************************************************//
// Input media streaming & demultiplexer:
//**************************************************************************//
+static int max_framesize=0;
+//static int show_packets=0;
+
#include "stream.h"
#include "demuxer.h"
#include "stheader.h"
-int avi_bitrate=0;
-
-demuxer_t *demuxer=NULL;
+static int avi_bitrate=0;
//#include "aviprint.c"
-sh_audio_t* new_sh_audio(int id){
+sh_audio_t* new_sh_audio(demuxer_t *demuxer,int id){
if(demuxer->a_streams[id]){
printf("Warning! Audio stream header %d redefined!\n",id);
} else {
@@ -191,7 +182,7 @@
return demuxer->a_streams[id];
}
-sh_video_t* new_sh_video(int id){
+sh_video_t* new_sh_video(demuxer_t *demuxer,int id){
if(demuxer->v_streams[id]){
printf("Warning! video stream header %d redefined!\n",id);
} else {
@@ -202,13 +193,6 @@
return demuxer->v_streams[id];
}
-demux_stream_t *d_audio=NULL;
-demux_stream_t *d_video=NULL;
-demux_stream_t *d_dvdsub=NULL;
-
-sh_audio_t *sh_audio=NULL;
-sh_video_t *sh_video=NULL;
-
char* encode_name=NULL;
char* encode_index_name=NULL;
int encode_bitrate=0;
@@ -243,22 +227,10 @@
};
//**************************************************************************//
-// Audio codecs:
+// The OpenDivX stuff:
//**************************************************************************//
-// MP3 decoder buffer callback:
-int mplayer_audio_read(char *buf,int size){
- int len;
- len=demux_read_data(sh_audio->ds,buf,size);
- return len;
-}
-
-//#include "dec_audio.c"
-
#ifndef NEW_DECORE
-//**************************************************************************//
-// The OpenDivX stuff:
-//**************************************************************************//
unsigned char *opendivx_src[3];
int opendivx_stride[3];
@@ -289,13 +261,13 @@
//**************************************************************************//
static vo_functions_t *video_out=NULL;
-ao_functions_t *audio_out=NULL;
+static ao_functions_t *audio_out=NULL;
-double video_time_usage=0;
-double vout_time_usage=0;
-double audio_time_usage=0;
-int total_time_usage_start=0;
-int benchmark=0;
+static double video_time_usage=0;
+static double vout_time_usage=0;
+static double audio_time_usage=0;
+static int total_time_usage_start=0;
+static int benchmark=0;
static int play_in_bg=0;
@@ -496,6 +468,17 @@
int mplayer(int argc,char* argv[], char *envp[]){
#endif
+static subtitle* subtitles=NULL;
+
+static demuxer_t *demuxer=NULL;
+
+static demux_stream_t *d_audio=NULL;
+static demux_stream_t *d_video=NULL;
+static demux_stream_t *d_dvdsub=NULL;
+
+static sh_audio_t *sh_audio=NULL;
+static sh_video_t *sh_video=NULL;
+
char* filename=NULL; //"MI2-Trailer.avi";
stream_t* stream=NULL;
int file_format=DEMUXER_TYPE_UNKNOWN;
@@ -816,7 +799,7 @@
demuxer=new_demuxer(stream,DEMUXER_TYPE_MOV,audio_id,video_id,dvdsub_id);
// stream_seek(demuxer->stream,seek_to_byte);
if(mov_check_file(demuxer)){
- printf("Detected MOV file format!\n");
+ printf("Detected QuickTime/MOV file format!\n");
file_format=DEMUXER_TYPE_MOV;
}
}
@@ -832,10 +815,6 @@
d_audio=demuxer->audio;
d_video=demuxer->video;
d_dvdsub=demuxer->sub;
-//d_audio->sh=sh_audio;
-//d_video->sh=sh_video;
-//sh_audio=d_audio->sh;sh_audio->ds=d_audio;
-//sh_video=d_video->sh;sh_video->ds=d_video;
sh_audio=NULL;
sh_video=NULL;
@@ -973,7 +952,7 @@
case DEMUXER_TYPE_MPEG_ES: {
d_audio->type=0;
has_audio=0;sh_audio=NULL; // ES streams has no audio channel
- d_video->sh=new_sh_video(0); // create dummy video stream header, id=0
+ d_video->sh=new_sh_video(demuxer,0); // create dummy video stream header, id=0
break;
}
case DEMUXER_TYPE_MPEG_PS: {
Index: stheader.h
===================================================================
RCS file: /cvsroot/mplayer/main/stheader.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- stheader.h 11 May 2001 01:22:35 -0000 1.9
+++ stheader.h 7 Jul 2001 18:46:15 -0000 1.10
@@ -60,6 +60,6 @@
HIC hic; // handle
} sh_video_t;
-sh_audio_t* new_sh_audio(int id);
-sh_video_t* new_sh_video(int id);
+sh_audio_t* new_sh_audio(demuxer_t *demuxer,int id);
+sh_video_t* new_sh_video(demuxer_t *demuxer,int id);
_______________________________________________
Mplayer-cvslog mailing list
Mplayer-cvslog at lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/mplayer-cvslog
More information about the MPlayer-cvslog
mailing list