mirror of
https://github.com/mpv-player/mpv
synced 2025-03-24 20:31:37 +00:00
removed dummy audio track for -nosound, vo: flip detection
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@779 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
67a0dc08e7
commit
15e8f762f8
102
mplayer.c
102
mplayer.c
@ -475,7 +475,7 @@ char* video_driver=NULL; //"mga"; // default
|
|||||||
int fullscreen=0;
|
int fullscreen=0;
|
||||||
int vidmode=0;
|
int vidmode=0;
|
||||||
int softzoom=0;
|
int softzoom=0;
|
||||||
int flip=0;
|
int flip=-1;
|
||||||
int screen_size_x=0;//SCREEN_SIZE_X;
|
int screen_size_x=0;//SCREEN_SIZE_X;
|
||||||
int screen_size_y=0;//SCREEN_SIZE_Y;
|
int screen_size_y=0;//SCREEN_SIZE_Y;
|
||||||
int screen_size_xy=0;
|
int screen_size_xy=0;
|
||||||
@ -751,6 +751,9 @@ d_dvdsub=demuxer->sub;
|
|||||||
//sh_audio=d_audio->sh;sh_audio->ds=d_audio;
|
//sh_audio=d_audio->sh;sh_audio->ds=d_audio;
|
||||||
//sh_video=d_video->sh;sh_video->ds=d_video;
|
//sh_video=d_video->sh;sh_video->ds=d_video;
|
||||||
|
|
||||||
|
sh_audio=NULL;
|
||||||
|
sh_video=NULL;
|
||||||
|
|
||||||
switch(file_format){
|
switch(file_format){
|
||||||
case DEMUXER_TYPE_AVI: {
|
case DEMUXER_TYPE_AVI: {
|
||||||
//---- AVI header:
|
//---- AVI header:
|
||||||
@ -795,7 +798,7 @@ switch(file_format){
|
|||||||
}
|
}
|
||||||
if(a_pos==-1){
|
if(a_pos==-1){
|
||||||
printf("AVI_NI: No audio stream found -> nosound\n");
|
printf("AVI_NI: No audio stream found -> nosound\n");
|
||||||
has_audio=0;
|
has_audio=0;sh_audio=NULL;
|
||||||
} else {
|
} else {
|
||||||
if(force_ni || abs(a_pos-v_pos)>0x100000){ // distance > 1MB
|
if(force_ni || abs(a_pos-v_pos)>0x100000){ // distance > 1MB
|
||||||
printf("Detected NON-INTERLEAVED AVI file-format!\n");
|
printf("Detected NON-INTERLEAVED AVI file-format!\n");
|
||||||
@ -823,8 +826,7 @@ switch(file_format){
|
|||||||
if(verbose) printf("AVI: Searching for audio stream (id:%d)\n",d_audio->id);
|
if(verbose) printf("AVI: Searching for audio stream (id:%d)\n",d_audio->id);
|
||||||
if(!ds_fill_buffer(d_audio)){
|
if(!ds_fill_buffer(d_audio)){
|
||||||
printf("AVI: No Audio stream found... ->nosound\n");
|
printf("AVI: No Audio stream found... ->nosound\n");
|
||||||
has_audio=0;
|
has_audio=0;sh_audio=NULL;
|
||||||
sh_audio=NULL;
|
|
||||||
} else {
|
} else {
|
||||||
sh_audio=d_audio->sh;sh_audio->ds=d_audio;
|
sh_audio=d_audio->sh;sh_audio->ds=d_audio;
|
||||||
sh_audio->format=sh_audio->wf->wFormatTag;
|
sh_audio->format=sh_audio->wf->wFormatTag;
|
||||||
@ -856,28 +858,30 @@ switch(file_format){
|
|||||||
demuxer->idx_pos=0;
|
demuxer->idx_pos=0;
|
||||||
// demuxer->endpos=avi_header.movi_end;
|
// demuxer->endpos=avi_header.movi_end;
|
||||||
if(!ds_fill_buffer(d_video)){
|
if(!ds_fill_buffer(d_video)){
|
||||||
printf("ASF: missing video stream!? contact the author, it may be a bug :(\n");
|
printf("ASF: no video stream found!\n");
|
||||||
GUI_MSG( mplASFErrorMissingVideoStream )
|
sh_video=NULL;
|
||||||
exit(1);
|
//printf("ASF: missing video stream!? contact the author, it may be a bug :(\n");
|
||||||
}
|
//GUI_MSG( mplASFErrorMissingVideoStream )
|
||||||
sh_video=d_video->sh;sh_video->ds=d_video;
|
//exit(1);
|
||||||
if(has_audio){
|
|
||||||
if(verbose) printf("ASF: Searching for audio stream (id:%d)\n",d_audio->id);
|
|
||||||
if(!ds_fill_buffer(d_audio)){
|
|
||||||
printf("ASF: No Audio stream found... ->nosound\n");
|
|
||||||
has_audio=0;
|
|
||||||
sh_audio=NULL;
|
|
||||||
} else {
|
} else {
|
||||||
sh_audio=d_audio->sh;sh_audio->ds=d_audio;
|
sh_video=d_video->sh;sh_video->ds=d_video;
|
||||||
sh_audio->format=sh_audio->wf->wFormatTag;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sh_video->fps=1000.0f; sh_video->frametime=0.001f; // 1ms
|
sh_video->fps=1000.0f; sh_video->frametime=0.001f; // 1ms
|
||||||
printf("VIDEO: [%.4s] %ldx%ld %dbpp\n",
|
printf("VIDEO: [%.4s] %ldx%ld %dbpp\n",
|
||||||
(char *)&sh_video->bih->biCompression,
|
(char *)&sh_video->bih->biCompression,
|
||||||
sh_video->bih->biWidth,
|
sh_video->bih->biWidth,
|
||||||
sh_video->bih->biHeight,
|
sh_video->bih->biHeight,
|
||||||
sh_video->bih->biBitCount);
|
sh_video->bih->biBitCount);
|
||||||
|
}
|
||||||
|
if(has_audio){
|
||||||
|
if(verbose) printf("ASF: Searching for audio stream (id:%d)\n",d_audio->id);
|
||||||
|
if(!ds_fill_buffer(d_audio)){
|
||||||
|
printf("ASF: No Audio stream found... ->nosound\n");
|
||||||
|
has_audio=0;sh_audio=NULL;
|
||||||
|
} else {
|
||||||
|
sh_audio=d_audio->sh;sh_audio->ds=d_audio;
|
||||||
|
sh_audio->format=sh_audio->wf->wFormatTag;
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DEMUXER_TYPE_MPEG_ES: {
|
case DEMUXER_TYPE_MPEG_ES: {
|
||||||
@ -898,7 +902,7 @@ switch(file_format){
|
|||||||
case 1: sh_audio->format=0x50;break; // mpeg
|
case 1: sh_audio->format=0x50;break; // mpeg
|
||||||
case 2: sh_audio->format=0x10001;break; // dvd pcm
|
case 2: sh_audio->format=0x10001;break; // dvd pcm
|
||||||
case 3: sh_audio->format=0x2000;break; // ac3
|
case 3: sh_audio->format=0x2000;break; // ac3
|
||||||
default: has_audio=0; // unknown type
|
default: has_audio=0;sh_audio=NULL; // unknown type
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -911,9 +915,11 @@ switch(file_format){
|
|||||||
case DEMUXER_TYPE_AVI:
|
case DEMUXER_TYPE_AVI:
|
||||||
case DEMUXER_TYPE_ASF: {
|
case DEMUXER_TYPE_ASF: {
|
||||||
// display info:
|
// display info:
|
||||||
|
if(sh_video){
|
||||||
sh_video->format=sh_video->bih->biCompression;
|
sh_video->format=sh_video->bih->biCompression;
|
||||||
sh_video->disp_w=sh_video->bih->biWidth;
|
sh_video->disp_w=sh_video->bih->biWidth;
|
||||||
sh_video->disp_h=abs(sh_video->bih->biHeight);
|
sh_video->disp_h=abs(sh_video->bih->biHeight);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DEMUXER_TYPE_MPEG_ES:
|
case DEMUXER_TYPE_MPEG_ES:
|
||||||
@ -985,6 +991,7 @@ switch(file_format){
|
|||||||
|
|
||||||
//if(verbose) printf("file successfully opened (has_audio=%d)\n",has_audio);
|
//if(verbose) printf("file successfully opened (has_audio=%d)\n",has_audio);
|
||||||
|
|
||||||
|
if(sh_video)
|
||||||
printf("[V] filefmt:%d fourcc:0x%X size:%dx%d fps:%5.2f ftime:=%6.4f\n",
|
printf("[V] filefmt:%d fourcc:0x%X size:%dx%d fps:%5.2f ftime:=%6.4f\n",
|
||||||
file_format,sh_video->format,sh_video->disp_w,sh_video->disp_h,
|
file_format,sh_video->format,sh_video->disp_w,sh_video->disp_h,
|
||||||
sh_video->fps,sh_video->frametime
|
sh_video->fps,sh_video->frametime
|
||||||
@ -995,9 +1002,22 @@ fflush(stdout);
|
|||||||
if(stream_dump_type){
|
if(stream_dump_type){
|
||||||
FILE *f;
|
FILE *f;
|
||||||
int len;
|
int len;
|
||||||
demux_stream_t *ds=(stream_dump_type==1)?d_audio:d_video;
|
demux_stream_t *ds=NULL;
|
||||||
demux_stream_t *ds2=(stream_dump_type!=1)?d_audio:d_video;
|
// select stream to dump
|
||||||
ds_free_packs(ds2); ds2->id=-2; // ignore this stream!
|
switch(stream_dump_type){
|
||||||
|
case 1: ds=d_audio;break;
|
||||||
|
case 2: ds=d_video;break;
|
||||||
|
case 3: ds=d_dvdsub;break;
|
||||||
|
}
|
||||||
|
if(!ds){
|
||||||
|
printf("dump: FATAL: selected stream missing!\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
// disable other streams:
|
||||||
|
if(d_audio && d_audio!=ds) {ds_free_packs(d_audio); d_audio->id=-2; }
|
||||||
|
if(d_video && d_video!=ds) {ds_free_packs(d_video); d_video->id=-2; }
|
||||||
|
if(d_dvdsub && d_dvdsub!=ds) {ds_free_packs(d_dvdsub); d_dvdsub->id=-2; }
|
||||||
|
// let's dump it!
|
||||||
f=fopen(stream_dump_name?stream_dump_name:"stream.dump","wb");
|
f=fopen(stream_dump_name?stream_dump_name:"stream.dump","wb");
|
||||||
if(!f){ printf("Can't open dump file!!!\n");exit(1); }
|
if(!f){ printf("Can't open dump file!!!\n");exit(1); }
|
||||||
while(!ds->eof){
|
while(!ds->eof){
|
||||||
@ -1010,6 +1030,11 @@ if(stream_dump_type){
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!sh_video){
|
||||||
|
printf("Sorry, no video stream... it's unplayable yet\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
//================== Init AUDIO (codec) ==========================
|
//================== Init AUDIO (codec) ==========================
|
||||||
if(has_audio){
|
if(has_audio){
|
||||||
// Go through the codec.conf and find the best codec...
|
// Go through the codec.conf and find the best codec...
|
||||||
@ -1080,6 +1105,14 @@ if(i>=CODECS_MAX_OUTFMT){
|
|||||||
}
|
}
|
||||||
sh_video->outfmtidx=i;
|
sh_video->outfmtidx=i;
|
||||||
|
|
||||||
|
if(flip==-1){
|
||||||
|
// autodetect flipping
|
||||||
|
flip=0;
|
||||||
|
if(sh_video->codec->outflags[i]&CODECS_FLAG_FLIP)
|
||||||
|
if(!(sh_video->codec->outflags[i]&CODECS_FLAG_NOFLIP))
|
||||||
|
flip=1;
|
||||||
|
}
|
||||||
|
|
||||||
if(verbose) printf("vo_debug1: out_fmt=0x%08X\n",out_fmt);
|
if(verbose) printf("vo_debug1: out_fmt=0x%08X\n",out_fmt);
|
||||||
|
|
||||||
switch(sh_video->codec->driver){
|
switch(sh_video->codec->driver){
|
||||||
@ -1230,7 +1263,7 @@ make_pipe(&keyb_fifo_get,&keyb_fifo_put);
|
|||||||
fullscreen?"fs ":"",
|
fullscreen?"fs ":"",
|
||||||
vidmode?"vm ":"",
|
vidmode?"vm ":"",
|
||||||
softzoom?"zoom ":"",
|
softzoom?"zoom ":"",
|
||||||
flip?"flip ":""
|
(flip==1)?"flip ":""
|
||||||
// fullscreen|(vidmode<<1)|(softzoom<<2)|(flip<<3)
|
// fullscreen|(vidmode<<1)|(softzoom<<2)|(flip<<3)
|
||||||
);
|
);
|
||||||
if((out_fmt&IMGFMT_BGR_MASK)==IMGFMT_BGR)
|
if((out_fmt&IMGFMT_BGR_MASK)==IMGFMT_BGR)
|
||||||
@ -1445,17 +1478,21 @@ if(!has_audio){
|
|||||||
if(sh_audio) if(sh_audio->a_buffer) free(sh_audio->a_buffer);
|
if(sh_audio) if(sh_audio->a_buffer) free(sh_audio->a_buffer);
|
||||||
alsa=1;
|
alsa=1;
|
||||||
// fake, required for timer:
|
// fake, required for timer:
|
||||||
|
#if 1
|
||||||
|
sh_audio=NULL;
|
||||||
|
#else
|
||||||
sh_audio=new_sh_audio(255); // FIXME!!!!!!!!!!
|
sh_audio=new_sh_audio(255); // FIXME!!!!!!!!!!
|
||||||
sh_audio->samplerate=76800;
|
sh_audio->samplerate=76800;
|
||||||
sh_audio->samplesize=sh_audio->channels=2;
|
sh_audio->samplesize=sh_audio->channels=2;
|
||||||
sh_audio->o_bps=sh_audio->channels*sh_audio->samplerate*sh_audio->samplesize;
|
sh_audio->o_bps=sh_audio->channels*sh_audio->samplerate*sh_audio->samplesize;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
current_module=NULL;
|
current_module=NULL;
|
||||||
|
|
||||||
//==================== START PLAYING =======================
|
//==================== START PLAYING =======================
|
||||||
|
|
||||||
if(file_format==DEMUXER_TYPE_AVI){
|
if(file_format==DEMUXER_TYPE_AVI && has_audio){
|
||||||
a_pts=d_audio->pts;
|
a_pts=d_audio->pts;
|
||||||
audio_delay-=(float)(sh_audio->audio.dwInitialFrames-sh_video->video.dwInitialFrames)*sh_video->frametime;
|
audio_delay-=(float)(sh_audio->audio.dwInitialFrames-sh_video->video.dwInitialFrames)*sh_video->frametime;
|
||||||
// audio_delay-=(float)(sh_audio->audio.dwInitialFrames-sh_video->video.dwInitialFrames)/default_fps;
|
// audio_delay-=(float)(sh_audio->audio.dwInitialFrames-sh_video->video.dwInitialFrames)/default_fps;
|
||||||
@ -1480,13 +1517,12 @@ InitTimer();
|
|||||||
while(!eof){
|
while(!eof){
|
||||||
|
|
||||||
/*========================== PLAY AUDIO ============================*/
|
/*========================== PLAY AUDIO ============================*/
|
||||||
if(!has_audio){
|
//if(!has_audio){
|
||||||
int playsize=512;
|
// int playsize=512;
|
||||||
a_frame+=playsize/(float)(sh_audio->o_bps);
|
// a_frame+=playsize/(float)(sh_audio->o_bps);
|
||||||
a_pts+=playsize/(float)(sh_audio->o_bps);
|
// a_pts+=playsize/(float)(sh_audio->o_bps);
|
||||||
//time_frame+=playsize/(float)(sh_audio->o_bps);
|
//time_frame+=playsize/(float)(sh_audio->o_bps);
|
||||||
|
//} else
|
||||||
} else
|
|
||||||
while(has_audio){
|
while(has_audio){
|
||||||
unsigned int t;
|
unsigned int t;
|
||||||
int playsize=outburst;
|
int playsize=outburst;
|
||||||
@ -2009,11 +2045,11 @@ switch(sh_video->codec->driver){
|
|||||||
float skip_audio_secs=0;
|
float skip_audio_secs=0;
|
||||||
|
|
||||||
// clear demux buffers:
|
// clear demux buffers:
|
||||||
if(has_audio) ds_free_packs(d_audio);
|
if(has_audio){ ds_free_packs(d_audio);sh_audio->a_buffer_len=0;}
|
||||||
ds_free_packs(d_video);
|
ds_free_packs(d_video);
|
||||||
|
|
||||||
// printf("sh_audio->a_buffer_len=%d \n",sh_audio->a_buffer_len);
|
// printf("sh_audio->a_buffer_len=%d \n",sh_audio->a_buffer_len);
|
||||||
sh_audio->a_buffer_len=0;
|
|
||||||
|
|
||||||
switch(file_format){
|
switch(file_format){
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user