[Mplayer-cvslog] CVS: main mplayer.c,1.438,1.439
Arpi of Ize
arpi at mplayer.dev.hu
Mon Mar 18 02:49:45 CET 2002
Update of /cvsroot/mplayer/main
In directory mplayer:/var/tmp.root/cvs-serv18457
Modified Files:
mplayer.c
Log Message:
video codec selection redesigned and moved to libmpcodecs - now it's 'intelligent'
Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.438
retrieving revision 1.439
diff -u -r1.438 -r1.439
--- mplayer.c 17 Mar 2002 02:28:32 -0000 1.438
+++ mplayer.c 18 Mar 2002 01:49:42 -0000 1.439
@@ -1010,6 +1010,8 @@
demuxer=demux_open(stream,file_format,audio_id,video_id,dvdsub_id);
if(!demuxer) goto goto_next_file; // exit_player(MSGTR_Exit_error); // ERROR
+current_module="demux_open2";
+
//file_format=demuxer->file_format;
d_audio=demuxer->audio;
@@ -1167,58 +1169,6 @@
if(!sh_video)
goto main;
-current_module="select_video_codec";
-
-// Go through the codec.conf and find the best codec...
-sh_video->codec=NULL;
-if(video_family!=-1) mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_TryForceVideoFmt,video_family);
-{ /* local vars */
-short bestprio=-1;
-struct codecs_st *bestcodec=NULL;
-while(1){
- sh_video->codec=find_codec(sh_video->format,
- sh_video->bih?((unsigned int*) &sh_video->bih->biCompression):NULL,sh_video->codec,0);
- if(!sh_video->codec/* && bestprio==-1*/){
- if(video_family!=-1) {
- //sh_video->codec=NULL; /* re-search */
- mp_msg(MSGT_CPLAYER,MSGL_WARN,MSGTR_CantFindVfmtFallback);
- video_family=-1;
- continue;
- }
- if(bestprio==-1 || !video_codec) {
- mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_CantFindVideoCodec,sh_video->format);
- mp_msg(MSGT_CPLAYER,MSGL_HINT, MSGTR_TryUpgradeCodecsConfOrRTFM,get_path("codecs.conf"));
- if(!sh_audio)
- goto goto_next_file;
- sh_video = d_video->sh = NULL;
- goto main; // exit_player(MSGTR_Exit_error);
- }
- } else {
- // is next line needed anymore? - atmos ::
- if(!allow_dshow && sh_video->codec->driver==VFM_DSHOW) continue; // skip DShow
- else if(video_codec && strcmp(sh_video->codec->name,video_codec)) continue;
- else if(video_family!=-1 && sh_video->codec->driver!=video_family) continue;
- else if(video_family==-1 && !video_codec && sh_video->codec->priority) {
- if(sh_video->codec->priority > bestprio) {
- //printf("\n\n!!! setting bestprio from %d to %d for %s!!!\n\n", bestprio, sh_video->codec->priority, sh_video->codec->name);
- bestprio=sh_video->codec->priority;
- bestcodec=sh_video->codec;
- }
- continue;
- }
- } /* sh_video->codec */
- break;
-}
-if(bestprio!=-1) {
- //printf("chose codec %s by priority.\n", bestcodec->name);
- sh_video->codec=bestcodec;
-}
-
-} /* end local vars */
-
-mp_msg(MSGT_CPLAYER,MSGL_INFO,"%s video codec: [%s] drv:%d prio:%d (%s)\n",
- video_codec?mp_gettext("Forcing"):mp_gettext("Detected"),sh_video->codec->name,sh_video->codec->driver,sh_video->codec->priority!=-1?sh_video->codec->priority:0,sh_video->codec->info);
-
current_module="preinit_libvo";
if((i=video_out->preinit(vo_subdevice))!=0){
@@ -1230,13 +1180,37 @@
current_module="init_video_codec";
-// init codec:
-//if(!init_video(sh_video,&vtune.pitch[0])){
-if(!init_video(sh_video,NULL)){
- mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_CouldntInitVideoCodec);
- goto goto_next_file; // exit_player(MSGTR_Exit_error);
+mp_msg(MSGT_CPLAYER,MSGL_INFO,"==========================================================================\n");
+
+// Go through the codec.conf and find the best codec...
+sh_video->inited=0;
+if(video_codec){
+ // forced codec by name:
+ mp_msg(MSGT_CPLAYER,MSGL_INFO,"Forced video codec: %s\n",video_codec);
+ init_video(sh_video,video_codec,-1,-1);
+} else {
+ int status;
+ // try in stability order: UNTESTED, WORKING, BUGGY, BROKEN
+ if(video_family>=0) mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_TryForceVideoFmt,video_family);
+ for(status=CODECS_STATUS__MAX;status>=CODECS_STATUS__MIN;--status){
+ if(video_family>=0) // try first the preferred codec family:
+ if(init_video(sh_video,NULL,video_family,status)) break;
+ if(init_video(sh_video,NULL,-1,status)) break;
+ }
+}
+if(!sh_video->inited){
+ mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_CantFindVideoCodec,sh_video->format);
+ mp_msg(MSGT_CPLAYER,MSGL_HINT, MSGTR_TryUpgradeCodecsConfOrRTFM,get_path("codecs.conf"));
+ mp_msg(MSGT_CPLAYER,MSGL_INFO,"==========================================================================\n");
+ if(!sh_audio) goto goto_next_file;
+ sh_video = d_video->sh = NULL;
+ goto main; // exit_player(MSGTR_Exit_error);
}
+mp_msg(MSGT_CPLAYER,MSGL_INFO,"%s video codec: [%s] drv:%d prio:%d (%s)\n",
+ video_codec?mp_gettext("Forcing"):mp_gettext("Detected"),sh_video->codec->name,sh_video->codec->driver,sh_video->codec->priority!=-1?sh_video->codec->priority:0,sh_video->codec->info);
+mp_msg(MSGT_CPLAYER,MSGL_INFO,"==========================================================================\n");
+
if(auto_quality>0){
// Auto quality option enabled
output_quality=get_video_quality_max(sh_video);
@@ -2444,7 +2418,7 @@
if ( use_gui ) guiGetEvent( guiIEvent,(char *)MP_CMD_GUI_FULLSCREEN );
else
#endif
- video_out->control(VOCTRL_FULLSCREEN, 0);
+ if(video_out) video_out->control(VOCTRL_FULLSCREEN, 0);
} break;
case MP_CMD_SUB_POS:
{
More information about the MPlayer-cvslog
mailing list