[Mplayer-cvslog] CVS: main mplayer.c,1.458,1.459

Arpi of Ize arpi at mplayer.dev.hu
Thu Apr 4 16:44:50 CEST 2002


Update of /cvsroot/mplayer/main
In directory mplayer:/var/tmp.root/cvs-serv26460

Modified Files:
	mplayer.c 
Log Message:
dvdnav support improved - patch by Kees Cook <mplayer at outflux.net>
spudec initialization cleanup(?)


Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.458
retrieving revision 1.459
diff -u -r1.458 -r1.459
--- mplayer.c	4 Apr 2002 14:24:11 -0000	1.458
+++ mplayer.c	4 Apr 2002 14:44:47 -0000	1.459
@@ -1004,6 +1004,10 @@
 }
 #endif
 
+#ifdef USE_DVDNAV
+  if (dvd_nav) stream_cache_size=0;	// must disable caching...
+#endif
+
 // CACHE2: initial prefill: 20%  later: 5%  (should be set by -cacheopts)
 if(stream_cache_size){
   current_module="enable_cache";
@@ -1109,20 +1113,34 @@
 //================== Read SUBTITLES (DVD & TEXT) ==========================
 if(sh_video){
 
-current_module="spudec";
 if (spudec_ifo) {
   unsigned int palette[16], width, height;
+  current_module="spudec_init_vobsub";
   if (vobsub_parse_ifo(spudec_ifo, palette, &width, &height, 1) >= 0)
     vo_spudec=spudec_new_scaled(palette, sh_video->disp_w, sh_video->disp_h);
 }
 
+#ifdef USE_DVDNAV
+if (vo_spudec==NULL && stream->type==STREAMTYPE_DVDNAV) {
+  current_module="spudec_init_dvdnav";
+  vo_spudec=spudec_new_scaled(dvdnav_stream_get_palette((dvdnav_priv_t*)(stream->priv)),
+			    sh_video->disp_w, sh_video->disp_h);
+}
+#endif
+
 #ifdef USE_DVDREAD
-if (vo_spudec==NULL) {
-current_module="spudec_init";
-vo_spudec=spudec_new_scaled(stream->type==STREAMTYPE_DVD?((dvd_priv_t *)(stream->priv))->cur_pgc->palette:NULL,
+if (vo_spudec==NULL && stream->type==STREAMTYPE_DVD) {
+  current_module="spudec_init_dvdread";
+  vo_spudec=spudec_new_scaled(((dvd_priv_t *)(stream->priv))->cur_pgc->palette,
 			    sh_video->disp_w, sh_video->disp_h);
 }
 #endif
+
+if (vo_spudec==NULL) {
+  current_module="spudec_init_normal";
+  vo_spudec=spudec_new_scaled(NULL, sh_video->disp_w, sh_video->disp_h);
+}
+
 if (vo_spudec!=NULL)
   inited_flags|=INITED_SPUDEC;
 
@@ -1383,6 +1401,12 @@
 
 InitTimer();
 
+#ifdef USE_DVDNAV
+if (dvd_nav && stream->type==STREAMTYPE_DVDNAV) {
+  dvdnav_stream_fullstart((dvdnav_priv_t *)stream->priv);
+}
+#endif
+
 total_time_usage_start=GetTimer();
 audio_time_usage=0; video_time_usage=0; vout_time_usage=0;
 while(!eof){
@@ -1902,6 +1926,11 @@
 	rel_seek_secs+=step_sec;
 }
 
+#ifdef USE_DVDNAV
+if (stream->type==STREAMTYPE_DVDNAV && dvd_nav_still)
+    dvdnav_stream_sleeping((dvdnav_priv_t*)stream->priv);
+#endif
+
 //================= Keyboard events, SEEKing ====================
 
 #ifndef HAVE_NEW_INPUT
@@ -1976,13 +2005,6 @@
       break;
     // quit
     case KEY_ESC: // ESC
-#ifdef USE_DVDNAV
-      if(dvd_nav) {
-              printf("menu\n");
-        dvdnav_menu_call(stream->priv,DVD_MENU_Root);
-        break;
-      }
-#endif
     case 'q': 
       exit_player(MSGTR_Exit_quit);
     case KEY_ENTER: // ESC
@@ -2459,25 +2481,182 @@
 	if(sub_pos <0) sub_pos=0;
     }	break;
 #ifdef USE_DVDNAV
+    case MP_CMD_DVDNAV_EVENT: {
+      dvdnav_priv_t * dvdnav_priv = (dvdnav_priv_t*)(stream->priv);
+      dvdnav_event_t * dvdnav_event = (dvdnav_event_t *)(cmd->args[0].v.v);
+
+      if (!dvdnav_event) {
+        printf("DVDNAV Event NULL?!\n");
+        break;
+      }
+
+      if (stream->type!=STREAMTYPE_DVDNAV) {
+        printf("Got DVDNAV event when not running a DVDNAV stream!?\n");
+        break;
+      }
+
+      //printf("mplayer: got event: %d\n",dvdnav_event->event);
+
+      switch (dvdnav_event->event) {
+      case DVDNAV_BLOCK_OK: {
+          /* be silent about this one */
+                break;
+          }
+      case DVDNAV_HIGHLIGHT: {
+          dvdnav_highlight_event_t *hevent = (dvdnav_highlight_event_t*)(dvdnav_event->details);
+          if (!hevent) {
+                printf("DVDNAV Event: Highlight event broken\n");
+                break;
+          }
+
+          if (hevent->display && hevent->buttonN>0)
+          {
+                //dvdnav_priv->seen_root_menu=1; /* if we got a highlight, we're on a menu */
+                sprintf( dvd_nav_text, "Highlight button %d (%u,%u)-(%u,%u) PTS %d (now is %5.2f)",
+                     hevent->buttonN,
+                     hevent->sx,hevent->sy,
+                     hevent->ex,hevent->ey,
+                     hevent->pts, d_video->pts);
+                printf("DVDNAV Event: %s\n",dvd_nav_text);
+                //osd_show_dvd_nav_delay = 60;
+
+                osd_show_dvd_nav_highlight=1;
+                osd_show_dvd_nav_sx=hevent->sx;
+                osd_show_dvd_nav_ex=hevent->ex;
+                osd_show_dvd_nav_sy=hevent->sy;
+                osd_show_dvd_nav_ey=hevent->ey;
+          }
+          else {
+                  osd_show_dvd_nav_highlight=0;
+                  printf("DVDNAV Event: Highlight Hide\n");
+          }
+        break;
+        }
+      case DVDNAV_STILL_FRAME: {
+          dvdnav_still_event_t *still_event = (dvdnav_still_event_t*)(dvdnav_event->details);
+
+          printf( "######################################## DVDNAV Event: Still Frame: %d sec(s)\n", still_event->length );
+          while (dvdnav_stream_sleeping(dvdnav_priv)) {
+            usleep(1000); /* 1ms */
+          }
+          dvdnav_stream_sleep(dvdnav_priv,still_event->length);
+        break;
+        }
+      case DVDNAV_STOP: {
+          printf( "DVDNAV Event: Nav Stop\n" );
+        break;
+        }
+      case DVDNAV_NOP: {
+        printf("DVDNAV Event: Nav NOP\n");
+        break;
+        }
+      case DVDNAV_SPU_STREAM_CHANGE: {
+        dvdnav_stream_change_event_t * stream_change=(dvdnav_stream_change_event_t*)(dvdnav_event->details);
+
+        printf("DVDNAV Event: Nav SPU Stream Change: phys: %d logical: %d\n",
+                stream_change->physical,
+                stream_change->logical);
+
+        if (vo_spudec && dvdsub_id!=stream_change->physical) {
+                mp_msg(MSGT_INPUT,MSGL_DBG2,"d_dvdsub->id change: was %d is now %d\n",
+                        d_dvdsub->id,stream_change->physical);
+                // FIXME: need a better way to change SPU id
+                d_dvdsub->id=dvdsub_id=stream_change->physical;
+                if (vo_spudec) spudec_reset(vo_spudec);
+        }
+
+        break;
+        }
+      case DVDNAV_AUDIO_STREAM_CHANGE: {
+        int aid_temp;
+        dvdnav_stream_change_event_t *stream_change = (dvdnav_stream_change_event_t*)(dvdnav_event->details);
+
+        printf("DVDNAV Event: Nav Audio Stream Change: phys: %d logical: %d\n",
+                stream_change->physical,
+                stream_change->logical);
+
+        aid_temp=stream_change->physical;
+        if (aid_temp>=0) aid_temp+=128; // FIXME: is this sane?
+        if (d_audio && audio_id!=aid_temp) {
+                mp_msg(MSGT_INPUT,MSGL_DBG2,"d_audio->id change: was %d is now %d\n",
+                        d_audio->id,aid_temp);
+                // FIXME: need a bettery way to change audio stream id
+                d_audio->id=dvdsub_id=aid_temp;
+                resync_audio_stream(sh_audio);
+        }
+
+        break;
+      }
+      case DVDNAV_VTS_CHANGE: {
+        printf("DVDNAV Event: Nav VTS Change\n");
+        break;
+        }
+      case DVDNAV_CELL_CHANGE: {
+        dvdnav_cell_change_event_t *cell_change = (dvdnav_cell_change_event_t*)(dvdnav_event->details);
+        cell_playback_t * cell_playback = cell_change->new_cell;
+
+        printf("DVDNAV Event: Nav Cell Change\n");
+        osd_show_dvd_nav_highlight=0; /* screen changed, disable menu */
+        /*
+        printf("new still time: %d\n",cell_playback->still_time);
+        printf("new cell_cmd_nr: %d\n",cell_playback->cell_cmd_nr);
+        printf("new playback_time: %02d:%02d:%02d.%02d\n",
+                        cell_playback->playback_time.hour,
+                        cell_playback->playback_time.minute,
+                        cell_playback->playback_time.second,
+                        cell_playback->playback_time.frame_u);
+
+        */
+        //rel_seek_secs=1; // not really: we can't seek, but it'll reset the muxer
+        //abs_seek_pos=0;
+        break;
+        }
+      case DVDNAV_NAV_PACKET: {
+        // printf("DVDNAV Event: Nav Packet\n");
+        break;
+        }
+      case DVDNAV_SPU_CLUT_CHANGE: {
+        uint32_t * new_clut = (uint32_t *)(dvdnav_event->details);
+
+        printf("DVDNAV Event: Nav SPU CLUT Change\n");
+        // send new palette to SPU decoder
+        if (vo_spudec) spudec_update_palette(vo_spudec,new_clut);
+
+        break;
+        }
+      case DVDNAV_SEEK_DONE: {
+        printf("DVDNAV Event: Nav Seek Done\n");
+        break;
+        }
+      }
+
+      // free the dvdnav event
+      free(dvdnav_event->details);
+      free(dvdnav_event);
+      cmd->args[0].v.v=NULL;
+    }
     case MP_CMD_DVDNAV: {
+      dvdnav_priv_t * dvdnav_priv=(dvdnav_priv_t*)stream->priv;
+
       switch (cmd->args[0].v.i) {
         case MP_CMD_DVDNAV_UP:
-          dvdnav_upper_button_select(stream->priv);
+          dvdnav_upper_button_select(dvdnav_priv->dvdnav);
           break;
         case MP_CMD_DVDNAV_DOWN:
-          dvdnav_lower_button_select(stream->priv);
+          dvdnav_lower_button_select(dvdnav_priv->dvdnav);
           break;
         case MP_CMD_DVDNAV_LEFT:
-          dvdnav_left_button_select(stream->priv);
+          dvdnav_left_button_select(dvdnav_priv->dvdnav);
           break;
         case MP_CMD_DVDNAV_RIGHT:
-          dvdnav_right_button_select(stream->priv);
+          dvdnav_right_button_select(dvdnav_priv->dvdnav);
           break;
         case MP_CMD_DVDNAV_MENU:
-          dvdnav_menu_call(stream->priv,DVD_MENU_Root);
+          printf("Menu call\n");
+          dvdnav_menu_call(dvdnav_priv->dvdnav,DVD_MENU_Root);
           break;
         case MP_CMD_DVDNAV_SELECT:
-          dvdnav_button_activate(stream->priv);
+          dvdnav_button_activate(dvdnav_priv->dvdnav);
           break;
         default:
           mp_msg(MSGT_CPLAYER, MSGL_V, "Weird DVD Nav cmd %d\n",cmd->args[0].v.i);
@@ -2628,6 +2807,12 @@
       char osd_text_tmp[50];
       if(pts==osd_last_pts-1) ++pts; else osd_last_pts=pts;
       vo_osd_text=osd_text_buffer;
+#ifdef USE_DVDNAV
+      if (osd_show_dvd_nav_delay) {
+          sprintf(osd_text_tmp, "DVDNAV: %s", dvd_nav_text);
+          osd_show_dvd_nav_delay--;
+      } else
+#endif
       if (osd_show_sub_delay) {
 	  sprintf(osd_text_tmp, "Sub delay: %d ms",(int)(sub_delay*1000));
 	  osd_show_sub_delay--;




More information about the MPlayer-cvslog mailing list