changeset 5789:0132c5747e8a

fix audio only files play
author pontscho
date Mon, 22 Apr 2002 21:36:12 +0000
parents 8bd1c1e319fb
children d141f1e9cc36
files Gui/interface.c Gui/interface.h mplayer.c
diffstat 3 files changed, 61 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/Gui/interface.c	Mon Apr 22 18:42:42 2002 +0000
+++ b/Gui/interface.c	Mon Apr 22 21:36:12 2002 +0000
@@ -13,8 +13,11 @@
 #include "mplayer/mplayer.h"
 #include "app.h"
 #include "../libvo/x11_common.h"
+#include "../libvo/video_out.h"
 #include "../input/input.h"
+
 #include "../libmpdemux/stream.h"
+#include "../libmpdemux/demuxer.h"
 
 guiInterface_t guiIntfStruct;
 
@@ -45,6 +48,20 @@
   evSkinBrowser
  };
 
+typedef struct 
+{
+ demux_stream_t *ds;
+ unsigned int format;
+ struct codecs_st *codec;
+ int inited;
+ // output format:                                                                                
+ float timer;
+ float fps;
+ float frametime;
+ int i_bps;
+ int disp_w,disp_h;
+} tmp_sh_video_t;
+
 void guiGetEvent( int type,char * arg )
 {
 #ifdef USE_DVDREAD
@@ -70,6 +87,23 @@
    case guiSetFileName:
         if ( arg ) guiSetFilename( guiIntfStruct.Filename,arg );
         break;
+   case guiSetAudioOnly:
+	guiIntfStruct.AudioOnly=(int)arg;
+	if ( (int)arg ) wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow );
+	  else wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow );
+	break;
+   case guiReDrawSubWindow:
+	wsPostRedisplay( &appMPlayer.subWindow );
+	break;
+   case guiSetShVideo:
+        if ( arg )
+	 {
+	  tmp_sh_video_t * sh_video = (tmp_sh_video_t *)arg;
+	  mplResizeToMovieSize( sh_video->disp_w,sh_video->disp_h );
+	  guiIntfStruct.MovieWidth=sh_video->disp_w;
+	  guiIntfStruct.MovieHeight=sh_video->disp_h;
+         }
+	break;
 #ifdef USE_DVDREAD
    case guiSetDVD:
         guiIntfStruct.DVD.titles=dvdp->vmg_file->tt_srpt->nr_of_srpts;
@@ -106,7 +140,7 @@
 
 void guiEventHandling( void )
 {
- if ( use_gui && !guiIntfStruct.Playing ) wsHandleEvents();
+ if ( ( use_gui && !guiIntfStruct.Playing )||( guiIntfStruct.AudioOnly ) ) wsHandleEvents();
  gtkEventHandling();
  mplTimerHandler(); // handle GUI timer events
 }
--- a/Gui/interface.h	Mon Apr 22 18:42:42 2002 +0000
+++ b/Gui/interface.h	Mon Apr 22 21:36:12 2002 +0000
@@ -75,6 +75,7 @@
    int    Track;
    int    AudioType;
    int    StreamType;
+   int	  AudioOnly;
    int    TimeSec;
    int    LengthInSec;
    int    FrameDrop;
@@ -93,12 +94,15 @@
 
 extern guiInterface_t guiIntfStruct;
 
-#define guiXEvent      0
-#define guiCEvent      1
-#define guiIEvent      2
-#define guiSetDVD      3
-#define guiSetFileName 4
-#define guiSetState    5
+#define guiXEvent           0
+#define guiCEvent           1
+#define guiIEvent           2
+#define guiSetDVD           3
+#define guiSetFileName      4
+#define guiSetState         5
+#define guiSetAudioOnly     6
+#define guiReDrawSubWindow  7
+#define guiSetShVideo       8
 
 #define guiSetStop  0
 #define guiSetPlay  1
--- a/mplayer.c	Mon Apr 22 18:42:42 2002 +0000
+++ b/mplayer.c	Mon Apr 22 21:36:12 2002 +0000
@@ -769,6 +769,7 @@
 #ifdef HAVE_NEW_GUI
     if ( use_gui ) {
 
+      guiGetEvent( guiReDrawSubWindow,0 );
       while ( guiIntfStruct.Playing != 1 )
        {
 #ifdef HAVE_NEW_INPUT
@@ -1280,22 +1281,6 @@
 
 // ========== Init display (sh_video->disp_w*sh_video->disp_h/out_fmt) ============
 
-#ifdef HAVE_NEW_GUI
-   if ( use_gui )
-    {
-     mplResizeToMovieSize( sh_video->disp_w,sh_video->disp_h );
-     guiIntfStruct.MovieWidth=sh_video->disp_w;
-     guiIntfStruct.MovieHeight=sh_video->disp_h;
-     guiIntfStruct.StreamType=stream->type;
-     guiGetEvent( guiSetFileName,filename );
-     if ( sh_audio ) guiIntfStruct.AudioType=sh_audio->channels;
-      else guiIntfStruct.AudioType=0;
-#ifdef USE_DVDREAD
-     if ( stream->type == STREAMTYPE_DVD ) guiGetEvent( guiSetDVD,(char *)stream->priv );
-#endif
-    }
-#endif
-
 current_module="init_vo_vaa";
 
    if(video_out->control(VOCTRL_QUERY_VAA, &vo_vaa)==VO_NOTIMPL)
@@ -1327,6 +1312,20 @@
 
 fflush(stdout);
 
+#ifdef HAVE_NEW_GUI
+   if ( use_gui )
+    {
+     guiGetEvent( guiSetShVideo,(char *)sh_video );
+     guiGetEvent( guiSetFileName,filename );
+     guiIntfStruct.StreamType=stream->type;
+     if ( sh_audio ) guiIntfStruct.AudioType=sh_audio->channels; else guiIntfStruct.AudioType=0;
+     if ( !sh_video && sh_audio ) guiGetEvent( guiSetAudioOnly,1 ); else guiGetEvent( guiSetAudioOnly,0 );
+#ifdef USE_DVDREAD
+     if ( stream->type == STREAMTYPE_DVD ) guiGetEvent( guiSetDVD,(char *)stream->priv );
+#endif
+    }
+#endif
+
 {
 //int frame_corr_num=0;   //
 //float v_frame=0;    // Video
@@ -2734,6 +2733,7 @@
 
 #ifdef HAVE_NEW_GUI
       if(use_gui){
+        guiEventHandling();
 	if(demuxer->file_format==DEMUXER_TYPE_AVI && sh_video->video.dwLength>2){
 	  // get pos from frame number / total frames
 	  guiIntfStruct.Position=(float)d_video->pack_no*100.0f/sh_video->video.dwLength;