Changeset 39a7f7e696685c58885539226344c9c93e24fce5

Show
Ignore:
Timestamp:
05/12/03 05:24:47 (5 years ago)
Author:
Rocky Bernstein <rocky@videolan.org>
git-committer:
Rocky Bernstein <rocky@videolan.org> 1070598287 +0000
git-parent:

[3e50586459c47fc257f0aef7abc1f10994bfa9a5]

git-author:
Rocky Bernstein <rocky@videolan.org> 1070598287 +0000
Message:

Slightly better handling of stills and toggling pause by using the
different threads better.

Still has stream still/to MPEG bug and duplicate video window bug though.
(And could use lots of cleanup.)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/access/vcdx/Modules.am

    rfd05dc6 r39a7f7e  
    11SOURCES_vcdx = \ 
     2    access.c \ 
     3    cdrom.c \ 
     4    cdrom.h \ 
     5    demux.c \ 
    26    intf.c \ 
    37    intf.h \ 
     
    610    vcdplayer.h \ 
    711    vcdplayer.c \ 
    8     cdrom.c \ 
    9     cdrom.h \ 
    10     demux.c \ 
    11     access.c \ 
    1212    $(NULL) 
  • modules/access/vcdx/access.c

    r3291e50 r39a7f7e  
    55 ***************************************************************************** 
    66 * Copyright (C) 2000,2003 VideoLAN 
    7  * $Id: access.c,v 1.7 2003/12/03 21:55:33 rocky Exp $ 
     7 * $Id: access.c,v 1.8 2003/12/05 04:24:47 rocky Exp $ 
    88 * 
    99 * Authors: Rocky Bernstein <rocky@panix.com>  
     
    3131#include <vlc/vlc.h> 
    3232#include <vlc/input.h> 
    33 #include <vlc_interface.h> 
     33#include <vlc/intf.h> 
    3434 
    3535#include "../../demux/mpeg/system.h" 
    3636#include "vcd.h" 
     37#include "vcdplayer.h" 
    3738#include "intf.h" 
    38 #include "vcdplayer.h" 
    3939 
    4040#include <cdio/cdio.h> 
     
    5050#define VCD_BLOCKS_ONCE 20 
    5151#define VCD_DATA_ONCE   (VCD_BLOCKS_ONCE * M2F2_SECTOR_SIZE) 
     52 
     53#define VCD_MRL_PREFIX "vcdx://" 
    5254 
    5355/***************************************************************************** 
     
    194196            p_buf += 2; 
    195197            *p_buf = 0x01; 
    196             dbg_print(INPUT_DBG_STILL, "Handled still event\n"); 
    197  
    198         /* p_vcd->p_intf->b_end_of_cell = true; */ 
     198            dbg_print(INPUT_DBG_STILL, "Handled still event"); 
     199 
     200        p_vcd->p_intf->p_sys->b_still = 1; 
    199201        input_SetStatus( p_input, INPUT_STATUS_PAUSE ); 
    200202 
     
    206208        vlc_mutex_unlock( &p_input->stream.stream_lock ); 
    207209 
     210            dbg_print(INPUT_DBG_STILL, "Clock manage"); 
    208211        input_ClockManageControl( p_input, p_pgrm, 0 ); 
     212            dbg_print(INPUT_DBG_STILL, "Clock manage done"); 
    209213 
    210214            return i_read + M2F2_SECTOR_SIZE; 
     
    946950#define meta_info_add_str(title, str) \ 
    947951  if ( str ) {                              \ 
    948     dbg_print( INPUT_DBG_META, "field: %s: %s\n", title, str); 
     952    dbg_print( INPUT_DBG_META, "field: %s: %s\n", title, str);     
    949953    input_AddInfo( p_cat, _(title), "%s", str );            \ 
    950954  } 
     
    978982} 
    979983 
     984#if FINISHED_PLAYLIST 
     985static void 
     986VCDCreatePlayListItem(const input_thread_t *p_input,  
     987              thread_vcd_data_t *p_vcd,  
     988              playlist_t *p_playlist, unsigned int i_track,  
     989              char *psz_mrl, int psz_mrl_max,  
     990              const char *psz_source, int playlist_operation,  
     991              unsigned int i_pos) 
     992{ 
     993  mtime_t i_duration =  
     994    (vcdinfo_get_track_size(p_vcd->vcd, i_track) * 8 * 10000000) 
     995    / (400 * p_input->stream.control.i_rate) ; 
     996  char *p_title; 
     997  char *config_varname = MODULE_STRING "-title-format"; 
     998 
     999  snprintf(psz_mrl, psz_mrl_max, "%s%s@T%u",  
     1000       VCD_MRL_PREFIX, psz_source, i_track); 
     1001 
     1002#if 0 
     1003  p_title = VCDFormatStr(p_input, p_vcd,  
     1004             config_GetPsz( p_input, config_varname ),  
     1005             psz_mrl, i_track); 
     1006#else 
     1007  p_title = psz_mrl; 
     1008#endif 
     1009 
     1010  playlist_AddExt( p_playlist, psz_mrl, p_title, i_duration,  
     1011           0, 0, playlist_operation, i_pos ); 
     1012} 
     1013 
     1014static int 
     1015VCDFixupPlayList( input_thread_t *p_input, thread_vcd_data_t *p_vcd,  
     1016          const char *psz_source ) 
     1017{ 
     1018  unsigned int i; 
     1019  playlist_t * p_playlist; 
     1020  char       * psz_mrl; 
     1021  unsigned int psz_mrl_max = strlen(VCD_MRL_PREFIX) + strlen(psz_source) +  
     1022    strlen("@T") + strlen("100") + 1; 
     1023 
     1024  psz_mrl = malloc( psz_mrl_max ); 
     1025 
     1026  if( psz_mrl == NULL ) 
     1027    { 
     1028      msg_Warn( p_input, "out of memory" ); 
     1029      return -1; 
     1030    } 
     1031 
     1032  p_playlist = (playlist_t *) vlc_object_find( p_input, VLC_OBJECT_PLAYLIST, 
     1033                           FIND_ANYWHERE ); 
     1034  if( !p_playlist ) 
     1035    { 
     1036      msg_Warn( p_input, "can't find playlist" ); 
     1037      free(psz_mrl); 
     1038      return -1; 
     1039    } 
     1040 
     1041  if ( config_GetInt( p_input, MODULE_STRING "-PBC" ) ) { 
     1042    /* May fill out more information when the playlist user interface becomes 
     1043       more mature. 
     1044     */ 
     1045    VCDCreatePlayListItem(p_input, p_vcd, p_playlist, p_vcd->cur_track,  
     1046              psz_mrl, psz_mrl_max, psz_source, PLAYLIST_REPLACE,  
     1047              p_playlist->i_index); 
     1048  } else { 
     1049   
     1050    playlist_Delete( p_playlist, p_playlist->i_index); 
     1051 
     1052    for( i = 1 ; i < p_vcd->num_tracks ; i++ ) 
     1053      { 
     1054    VCDCreatePlayListItem(p_input, p_vcd, p_playlist, i, psz_mrl,  
     1055                  psz_mrl_max, psz_source, PLAYLIST_APPEND,  
     1056                  PLAYLIST_END); 
     1057 
     1058      } 
     1059 
     1060    playlist_Command( p_playlist, PLAYLIST_GOTO, 0 ); 
     1061 
     1062  } 
     1063     
     1064  vlc_object_release( p_playlist ); 
     1065  free(psz_mrl); 
     1066  return 0; 
     1067} 
     1068#endif 
     1069 
    9801070/***************************************************************************** 
    9811071 * Public routines. 
     
    10621152    { 
    10631153        msg_Warn( p_input, "could not open %s", psz_source ); 
    1064         free( psz_source ); 
    1065         free( p_vcd ); 
    1066         return VLC_EGENERIC; 
     1154    goto err_exit; 
    10671155    } 
    10681156 
     
    10711159                                            vcdinfo_get_cd_image(p_vcd->vcd),  
    10721160                                            &p_vcd->p_sectors ); 
    1073     free( psz_source ); 
    10741161    if( p_vcd->num_tracks < 0 ) 
    10751162        LOG_ERR ("unable to count tracks" ); 
     
    10791166    { 
    10801167        vcdinfo_close( p_vcd->vcd ); 
    1081         free( p_vcd ); 
    1082         return VLC_EGENERIC; 
     1168    goto err_exit; 
    10831169    } 
    10841170 
     
    11181204    if ( ! b_play_ok ) { 
    11191205      vcdinfo_close( p_vcd->vcd ); 
    1120       free( p_vcd ); 
    1121       return VLC_EGENERIC; 
     1206      goto err_exit; 
    11221207    } 
    11231208 
     
    11371222    InformationCreate( p_input ); 
    11381223 
     1224#if FINISHED_PLAYLIST 
     1225    VCDFixupPlayList( p_input, p_vcd, psz_source ); 
     1226#endif 
     1227     
     1228    free( psz_source ); 
     1229 
    11391230    return VLC_SUCCESS; 
     1231 err_exit: 
     1232    free( psz_source ); 
     1233    free( p_vcd ); 
     1234    return VLC_EGENERIC; 
    11401235} 
    11411236 
  • modules/access/vcdx/demux.c

    rc7897a2 r39a7f7e  
    33 ***************************************************************************** 
    44 * Copyright (C) 1998-2001 VideoLAN 
    5  * $Id: demux.c,v 1.2 2003/11/09 00:52:32 rocky Exp $ 
     5 * $Id: demux.c,v 1.3 2003/12/05 04:24:47 rocky Exp $ 
    66 * 
    77 * Author: St�ane Borel <stef@via.ecp.fr> 
     
    5050 
    5151#include "vcd.h" 
     52#include "vcdplayer.h" 
    5253#include "intf.h" 
    5354 
  • modules/access/vcdx/intf.c

    r6a99be2 r39a7f7e  
    33 ***************************************************************************** 
    44 * Copyright (C) 2002,2003 VideoLAN 
    5  * $Id: intf.c,v 1.9 2003/11/26 01:45:03 rocky Exp $ 
     5 * $Id: intf.c,v 1.10 2003/12/05 04:24:47 rocky Exp $ 
    66 * 
    77 * Authors: Rocky Bernstein <rocky@panix.com> 
     
    3636#include "vcd.h" 
    3737#include "vcdplayer.h" 
    38  
    39 /***************************************************************************** 
    40  * intf_sys_t: description and status of interface 
    41  *****************************************************************************/ 
    42 struct intf_sys_t 
    43 
    44     input_thread_t    * p_input; 
    45     thread_vcd_data_t * p_vcd; 
    46  
    47     vlc_bool_t          b_still; 
    48     vlc_bool_t          b_inf_still; 
    49     mtime_t             m_still_time; 
    50  
    51 #if FINISHED 
    52     vcdplay_ctrl_t      control; 
    53 #else  
    54     int                 control; 
    55 #endif 
    56     vlc_bool_t          b_click, b_move, b_key_pressed; 
    57 }; 
     38#include "intf.h" 
    5839 
    5940/***************************************************************************** 
     
    6142 *****************************************************************************/ 
    6243static int  InitThread     ( intf_thread_t *p_intf ); 
    63 static int  MouseEvent     ( vlc_object_t *, char const *, 
    64                              vlc_value_t, vlc_value_t, void * ); 
    6544static int  KeyEvent       ( vlc_object_t *, char const *, 
    6645                             vlc_value_t, vlc_value_t, void * ); 
     
    10180{ 
    10281    intf_thread_t *p_intf = (intf_thread_t *)p_this; 
     82    var_DelCallback( p_intf->p_vlc, "key-pressed", KeyEvent, p_intf ); 
    10383 
    10484    /* Destroy structure */ 
     
    11393{ 
    11494    vlc_object_t      * p_vout = NULL; 
     95    mtime_t             mtime = 0; 
     96    mtime_t             mlast = 0; 
    11597    thread_vcd_data_t * p_vcd; 
    11698    input_thread_t    * p_input; 
     
    136118    { 
    137119      vlc_mutex_lock( &p_intf->change_lock ); 
     120 
     121        /* 
     122         * still images 
     123         */ 
     124        if( p_intf->p_sys->b_still && !p_intf->p_sys->b_inf_still ) 
     125        { 
     126            if( p_intf->p_sys->m_still_time > 0 ) 
     127            { 
     128                /* update remaining still time */ 
     129            dbg_print(INPUT_DBG_STILL, "updating still time"); 
     130                mtime = mdate(); 
     131                if( mlast ) 
     132                { 
     133                    p_intf->p_sys->m_still_time -= mtime - mlast; 
     134                } 
     135 
     136                mlast = mtime; 
     137            } 
     138            else 
     139            { 
     140                /* still time elasped */ 
     141            dbg_print(INPUT_DBG_STILL, "wait time done - setting play"); 
     142                input_SetStatus( p_intf->p_sys->p_input, 
     143                                 INPUT_STATUS_PLAY ); 
     144                p_intf->p_sys->m_still_time = 0; 
     145                p_intf->p_sys->b_still = 0; 
     146                mlast = 0; 
     147            } 
     148        } 
    138149 
    139150      /* 
     
    216227        } 
    217228        number_addend = 0; 
     229 
     230        /* we can safely interact with the VCD player 
     231         * with the stream lock */ 
     232        if( p_intf->p_sys->b_still ) 
     233          { 
     234        dbg_print(INPUT_DBG_STILL, "Playing still after activate"); 
     235        input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_PLAY ); 
     236        p_intf->p_sys->b_still = 0; 
     237        p_intf->p_sys->b_inf_still = 0; 
     238        p_intf->p_sys->m_still_time = 0; 
     239          } 
     240 
    218241      } else { 
    219242        unsigned int digit_entered=0; 
     
    260283      if( p_vout ) 
    261284            { 
    262           var_AddCallback( p_vout, "mouse-moved", MouseEvent, p_intf ); 
    263           var_AddCallback( p_vout, "mouse-clicked", MouseEvent, p_intf ); 
    264285          var_AddCallback( p_vout, "key-pressed", KeyEvent, p_intf ); 
    265286            } 
     
    273294    if( p_vout ) 
    274295    { 
    275         var_DelCallback( p_vout, "mouse-moved", MouseEvent, p_intf ); 
    276         var_DelCallback( p_vout, "mouse-clicked", MouseEvent, p_intf ); 
    277296        var_DelCallback( p_vout, "key-pressed", KeyEvent, p_intf ); 
    278297        vlc_object_release( p_vout ); 
     
    319338 
    320339/***************************************************************************** 
    321  * MouseEvent: callback for mouse events 
    322  *****************************************************************************/ 
    323 static int MouseEvent( vlc_object_t *p_this, char const *psz_var, 
    324                        vlc_value_t oldval, vlc_value_t newval, void *p_data ) 
    325 { 
    326     intf_thread_t *p_intf = (intf_thread_t *)p_data; 
    327  
    328     vlc_mutex_lock( &p_intf->change_lock ); 
    329  
    330     if( psz_var[6] == 'c' ) /* "mouse-clicked" */ 
    331     { 
    332         p_intf->p_sys->b_click = VLC_TRUE; 
    333     } 
    334     else if( psz_var[6] == 'm' ) /* "mouse-moved" */ 
    335     { 
    336         p_intf->p_sys->b_move = VLC_TRUE; 
    337     } 
    338  
    339     vlc_mutex_unlock( &p_intf->change_lock ); 
    340  
    341     return VLC_SUCCESS; 
    342 } 
    343  
    344 /***************************************************************************** 
    345340 * KeyEvent: callback for keyboard events 
    346341 *****************************************************************************/ 
     
    359354 
    360355/***************************************************************************** 
    361  * dvdIntfStillTime: function provided to demux plugin to request 
     356 * vcdIntfStillTime: function provided to demux plugin to request 
    362357 * still images 
    363358 *****************************************************************************/ 
  • modules/access/vcdx/intf.h

    rfd05dc6 r39a7f7e  
    33 ***************************************************************************** 
    44 * Copyright (C) 2001 VideoLAN 
    5  * $Id: intf.h,v 1.1 2003/10/04 18:55:13 gbazin Exp $ 
     5 * $Id: intf.h,v 1.2 2003/12/05 04:24:47 rocky Exp $ 
    66 * 
    77 * Author: St�ane Borel <stef@via.ecp.fr> 
     
    2222 *****************************************************************************/ 
    2323 
     24/***************************************************************************** 
     25 * intf_sys_t: description and status of interface 
     26 *****************************************************************************/ 
     27struct intf_sys_t 
     28{ 
     29    input_thread_t    * p_input; 
     30    thread_vcd_data_t * p_vcd; 
     31 
     32    vlc_bool_t          b_still; 
     33    vlc_bool_t          b_inf_still; 
     34    mtime_t             m_still_time; 
     35 
     36#if FINISHED 
     37    vcdplay_ctrl_t      control; 
     38#else  
     39    int                 control; 
     40#endif 
     41    vlc_bool_t          b_click, b_move, b_key_pressed; 
     42}; 
     43 
    2444int vcdIntfStillTime( struct intf_thread_t *, int ); 
    2545int vcdIntfResetStillTime( intf_thread_t *p_intf ); 
  • modules/access/vcdx/vcdplayer.c

    r58cd81b r39a7f7e  
    44 ***************************************************************************** 
    55 * Copyright (C) 2003 Rocky Bernstein <rocky@panix.com> 
    6  * $Id: vcdplayer.c,v 1.5 2003/11/24 03:30:36 rocky Exp $ 
     6 * $Id: vcdplayer.c,v 1.6 2003/12/05 04:24:47 rocky Exp $ 
    77 * 
    88 * This program is free software; you can redistribute it and/or modify 
     
    3232#include <vlc/vlc.h> 
    3333#include <vlc/input.h> 
     34#include <vlc/intf.h> 
    3435 
    3536#include "vcd.h" 
    3637#include "vcdplayer.h" 
     38#include "intf.h" 
    3739 
    3840#include <string.h> 
     
    184186        /* FIXME */ 
    185187        p_vcd->in_still = wait_time - 1; 
    186         SLEEP_1_SEC_AND_HANDLE_EVENTS
     188   p_vcd->p_intf->p_sys->m_still_time = (wait_time - 1) * 1000000
    187189        return READ_STILL_FRAME; 
    188       } 
     190      } else { 
     191    p_vcd->p_intf->p_sys->m_still_time = 0; 
     192    p_vcd->p_intf->p_sys->b_inf_still  = 1; 
     193      } 
     194 
    189195    } 
    190196    vcdplayer_update_entry( p_input,  
     
    209215      /* Handle any wait time given */ 
    210216      if (-5 == p_vcd->in_still) { 
    211         p_vcd->in_still = wait_time - 1; 
    212         SLEEP_1_SEC_AND_HANDLE_EVENTS ; 
    213         return READ_STILL_FRAME; 
     217    if (wait_time != 0) { 
     218      /* FIXME */ 
     219      p_vcd->in_still = wait_time - 1; 
     220      p_vcd->p_intf->p_sys->m_still_time = (wait_time - 1) * 1000000; 
     221      return READ_STILL_FRAME; 
     222    } else { 
     223      p_vcd->p_intf->p_sys->m_still_time = 0; 
     224      p_vcd->p_intf->p_sys->b_inf_still  = 1; 
     225    } 
     226    return READ_STILL_FRAME; 
    214227      } 
    215228