Changeset 39a7f7e696685c58885539226344c9c93e24fce5
- Timestamp:
- 05/12/03 05:24:47 (5 years ago)
- git-parent:
- Files:
-
- modules/access/vcdx/Modules.am (modified) (2 diffs)
- modules/access/vcdx/access.c (modified) (12 diffs)
- modules/access/vcdx/demux.c (modified) (2 diffs)
- modules/access/vcdx/intf.c (modified) (11 diffs)
- modules/access/vcdx/intf.h (modified) (2 diffs)
- modules/access/vcdx/vcdplayer.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
modules/access/vcdx/Modules.am
rfd05dc6 r39a7f7e 1 1 SOURCES_vcdx = \ 2 access.c \ 3 cdrom.c \ 4 cdrom.h \ 5 demux.c \ 2 6 intf.c \ 3 7 intf.h \ … … 6 10 vcdplayer.h \ 7 11 vcdplayer.c \ 8 cdrom.c \9 cdrom.h \10 demux.c \11 access.c \12 12 $(NULL) modules/access/vcdx/access.c
r3291e50 r39a7f7e 5 5 ***************************************************************************** 6 6 * Copyright (C) 2000,2003 VideoLAN 7 * $Id: access.c,v 1. 7 2003/12/03 21:55:33rocky Exp $7 * $Id: access.c,v 1.8 2003/12/05 04:24:47 rocky Exp $ 8 8 * 9 9 * Authors: Rocky Bernstein <rocky@panix.com> … … 31 31 #include <vlc/vlc.h> 32 32 #include <vlc/input.h> 33 #include <vlc _interface.h>33 #include <vlc/intf.h> 34 34 35 35 #include "../../demux/mpeg/system.h" 36 36 #include "vcd.h" 37 #include "vcdplayer.h" 37 38 #include "intf.h" 38 #include "vcdplayer.h"39 39 40 40 #include <cdio/cdio.h> … … 50 50 #define VCD_BLOCKS_ONCE 20 51 51 #define VCD_DATA_ONCE (VCD_BLOCKS_ONCE * M2F2_SECTOR_SIZE) 52 53 #define VCD_MRL_PREFIX "vcdx://" 52 54 53 55 /***************************************************************************** … … 194 196 p_buf += 2; 195 197 *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; 199 201 input_SetStatus( p_input, INPUT_STATUS_PAUSE ); 200 202 … … 206 208 vlc_mutex_unlock( &p_input->stream.stream_lock ); 207 209 210 dbg_print(INPUT_DBG_STILL, "Clock manage"); 208 211 input_ClockManageControl( p_input, p_pgrm, 0 ); 212 dbg_print(INPUT_DBG_STILL, "Clock manage done"); 209 213 210 214 return i_read + M2F2_SECTOR_SIZE; … … 946 950 #define meta_info_add_str(title, str) \ 947 951 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); \ 949 953 input_AddInfo( p_cat, _(title), "%s", str ); \ 950 954 } … … 978 982 } 979 983 984 #if FINISHED_PLAYLIST 985 static void 986 VCDCreatePlayListItem(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 1014 static int 1015 VCDFixupPlayList( 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 980 1070 /***************************************************************************** 981 1071 * Public routines. … … 1062 1152 { 1063 1153 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; 1067 1155 } 1068 1156 … … 1071 1159 vcdinfo_get_cd_image(p_vcd->vcd), 1072 1160 &p_vcd->p_sectors ); 1073 free( psz_source );1074 1161 if( p_vcd->num_tracks < 0 ) 1075 1162 LOG_ERR ("unable to count tracks" ); … … 1079 1166 { 1080 1167 vcdinfo_close( p_vcd->vcd ); 1081 free( p_vcd ); 1082 return VLC_EGENERIC; 1168 goto err_exit; 1083 1169 } 1084 1170 … … 1118 1204 if ( ! b_play_ok ) { 1119 1205 vcdinfo_close( p_vcd->vcd ); 1120 free( p_vcd ); 1121 return VLC_EGENERIC; 1206 goto err_exit; 1122 1207 } 1123 1208 … … 1137 1222 InformationCreate( p_input ); 1138 1223 1224 #if FINISHED_PLAYLIST 1225 VCDFixupPlayList( p_input, p_vcd, psz_source ); 1226 #endif 1227 1228 free( psz_source ); 1229 1139 1230 return VLC_SUCCESS; 1231 err_exit: 1232 free( psz_source ); 1233 free( p_vcd ); 1234 return VLC_EGENERIC; 1140 1235 } 1141 1236 modules/access/vcdx/demux.c
rc7897a2 r39a7f7e 3 3 ***************************************************************************** 4 4 * Copyright (C) 1998-2001 VideoLAN 5 * $Id: demux.c,v 1. 2 2003/11/09 00:52:32rocky Exp $5 * $Id: demux.c,v 1.3 2003/12/05 04:24:47 rocky Exp $ 6 6 * 7 7 * Author: St�ane Borel <stef@via.ecp.fr> … … 50 50 51 51 #include "vcd.h" 52 #include "vcdplayer.h" 52 53 #include "intf.h" 53 54 modules/access/vcdx/intf.c
r6a99be2 r39a7f7e 3 3 ***************************************************************************** 4 4 * Copyright (C) 2002,2003 VideoLAN 5 * $Id: intf.c,v 1. 9 2003/11/26 01:45:03rocky Exp $5 * $Id: intf.c,v 1.10 2003/12/05 04:24:47 rocky Exp $ 6 6 * 7 7 * Authors: Rocky Bernstein <rocky@panix.com> … … 36 36 #include "vcd.h" 37 37 #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" 58 39 59 40 /***************************************************************************** … … 61 42 *****************************************************************************/ 62 43 static int InitThread ( intf_thread_t *p_intf ); 63 static int MouseEvent ( vlc_object_t *, char const *,64 vlc_value_t, vlc_value_t, void * );65 44 static int KeyEvent ( vlc_object_t *, char const *, 66 45 vlc_value_t, vlc_value_t, void * ); … … 101 80 { 102 81 intf_thread_t *p_intf = (intf_thread_t *)p_this; 82 var_DelCallback( p_intf->p_vlc, "key-pressed", KeyEvent, p_intf ); 103 83 104 84 /* Destroy structure */ … … 113 93 { 114 94 vlc_object_t * p_vout = NULL; 95 mtime_t mtime = 0; 96 mtime_t mlast = 0; 115 97 thread_vcd_data_t * p_vcd; 116 98 input_thread_t * p_input; … … 136 118 { 137 119 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 } 138 149 139 150 /* … … 216 227 } 217 228 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 218 241 } else { 219 242 unsigned int digit_entered=0; … … 260 283 if( p_vout ) 261 284 { 262 var_AddCallback( p_vout, "mouse-moved", MouseEvent, p_intf );263 var_AddCallback( p_vout, "mouse-clicked", MouseEvent, p_intf );264 285 var_AddCallback( p_vout, "key-pressed", KeyEvent, p_intf ); 265 286 } … … 273 294 if( p_vout ) 274 295 { 275 var_DelCallback( p_vout, "mouse-moved", MouseEvent, p_intf );276 var_DelCallback( p_vout, "mouse-clicked", MouseEvent, p_intf );277 296 var_DelCallback( p_vout, "key-pressed", KeyEvent, p_intf ); 278 297 vlc_object_release( p_vout ); … … 319 338 320 339 /***************************************************************************** 321 * MouseEvent: callback for mouse events322 *****************************************************************************/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 /*****************************************************************************345 340 * KeyEvent: callback for keyboard events 346 341 *****************************************************************************/ … … 359 354 360 355 /***************************************************************************** 361 * dvdIntfStillTime: function provided to demux plugin to request356 * vcdIntfStillTime: function provided to demux plugin to request 362 357 * still images 363 358 *****************************************************************************/ modules/access/vcdx/intf.h
rfd05dc6 r39a7f7e 3 3 ***************************************************************************** 4 4 * Copyright (C) 2001 VideoLAN 5 * $Id: intf.h,v 1. 1 2003/10/04 18:55:13 gbazinExp $5 * $Id: intf.h,v 1.2 2003/12/05 04:24:47 rocky Exp $ 6 6 * 7 7 * Author: St�ane Borel <stef@via.ecp.fr> … … 22 22 *****************************************************************************/ 23 23 24 /***************************************************************************** 25 * intf_sys_t: description and status of interface 26 *****************************************************************************/ 27 struct 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 24 44 int vcdIntfStillTime( struct intf_thread_t *, int ); 25 45 int vcdIntfResetStillTime( intf_thread_t *p_intf ); modules/access/vcdx/vcdplayer.c
r58cd81b r39a7f7e 4 4 ***************************************************************************** 5 5 * Copyright (C) 2003 Rocky Bernstein <rocky@panix.com> 6 * $Id: vcdplayer.c,v 1. 5 2003/11/24 03:30:36rocky Exp $6 * $Id: vcdplayer.c,v 1.6 2003/12/05 04:24:47 rocky Exp $ 7 7 * 8 8 * This program is free software; you can redistribute it and/or modify … … 32 32 #include <vlc/vlc.h> 33 33 #include <vlc/input.h> 34 #include <vlc/intf.h> 34 35 35 36 #include "vcd.h" 36 37 #include "vcdplayer.h" 38 #include "intf.h" 37 39 38 40 #include <string.h> … … 184 186 /* FIXME */ 185 187 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; 187 189 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 189 195 } 190 196 vcdplayer_update_entry( p_input, … … 209 215 /* Handle any wait time given */ 210 216 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; 214 227 } 215 228
