Changeset e10d43118219b4cd6e2fce4c44b70778f9ebcc30
- Timestamp:
- 11/10/07 17:34:53 (10 months ago)
- git-parent:
- Files:
-
- Makefile.am (modified) (2 diffs)
- modules/misc/lua/Modules.am (modified) (1 diff)
- modules/misc/lua/acl.c (added)
- modules/misc/lua/callbacks.c (modified) (1 diff)
- modules/misc/lua/httpd.c (added)
- modules/misc/lua/intf.c (modified) (13 diffs)
- modules/misc/lua/net.c (modified) (1 diff)
- modules/misc/lua/vlc.c (modified) (3 diffs)
- modules/misc/lua/vlc.h (modified) (4 diffs)
- share/Makefile.am (modified) (1 diff)
- share/http-lua/.hosts (added)
- share/http-lua/custom.lua (added)
- share/http-lua/dialogs/.hosts (added)
- share/http-lua/dialogs/browse (added)
- share/http-lua/dialogs/footer (added)
- share/http-lua/dialogs/input (added)
- share/http-lua/dialogs/main (added)
- share/http-lua/dialogs/mosaic (added)
- share/http-lua/dialogs/playlist (added)
- share/http-lua/dialogs/sout (added)
- share/http-lua/dialogs/vlm (added)
- share/http-lua/favicon.ico (added)
- share/http-lua/flash.html (added)
- share/http-lua/iehacks.css (added)
- share/http-lua/images/delete.png (added)
- share/http-lua/images/delete_small.png (added)
- share/http-lua/images/eject.png (added)
- share/http-lua/images/empty.png (added)
- share/http-lua/images/fullscreen.png (added)
- share/http-lua/images/help.png (added)
- share/http-lua/images/info.png (added)
- share/http-lua/images/loop.png (added)
- share/http-lua/images/minus.png (added)
- share/http-lua/images/next.png (added)
- share/http-lua/images/pause.png (added)
- share/http-lua/images/play.png (added)
- share/http-lua/images/playlist.png (added)
- share/http-lua/images/playlist_small.png (added)
- share/http-lua/images/plus.png (added)
- share/http-lua/images/prev.png (added)
- share/http-lua/images/refresh.png (added)
- share/http-lua/images/repeat.png (added)
- share/http-lua/images/sd.png (added)
- share/http-lua/images/shuffle.png (added)
- share/http-lua/images/slider_bar.png (added)
- share/http-lua/images/slider_left.png (added)
- share/http-lua/images/slider_point.png (added)
- share/http-lua/images/slider_right.png (added)
- share/http-lua/images/slow.png (added)
- share/http-lua/images/snapshot.png (added)
- share/http-lua/images/sort.png (added)
- share/http-lua/images/sout.png (added)
- share/http-lua/images/speaker.png (added)
- share/http-lua/images/speaker_mute.png (added)
- share/http-lua/images/stop.png (added)
- share/http-lua/images/vlc16x16.png (added)
- share/http-lua/images/volume_down.png (added)
- share/http-lua/images/volume_up.png (added)
- share/http-lua/images/white.png (added)
- share/http-lua/images/white_cross_small.png (added)
- share/http-lua/index.html (added)
- share/http-lua/js/functions.js (added)
- share/http-lua/js/mosaic.js (added)
- share/http-lua/js/vlm.js (added)
- share/http-lua/mosaic.html (added)
- share/http-lua/old/.hosts (added)
- share/http-lua/old/admin/.access (added)
- share/http-lua/old/admin/browse.html (added)
- share/http-lua/old/admin/dboxfiles.html (added)
- share/http-lua/old/admin/index.html (added)
- share/http-lua/old/cone_minus.png (added)
- share/http-lua/old/cone_plus.png (added)
- share/http-lua/old/index.html (added)
- share/http-lua/old/info.html (added)
- share/http-lua/old/style.css (added)
- share/http-lua/old/vlm/edit.html (added)
- share/http-lua/old/vlm/index.html (added)
- share/http-lua/old/vlm/new.html (added)
- share/http-lua/old/vlm/show.html (added)
- share/http-lua/old/webcam.html (added)
- share/http-lua/requests/browse.xml (added)
- share/http-lua/requests/playlist.xml (added)
- share/http-lua/requests/readme (added)
- share/http-lua/requests/status.xml (added)
- share/http-lua/requests/vlm.xml (added)
- share/http-lua/requests/vlm_cmd.xml (added)
- share/http-lua/style.css (added)
- share/http-lua/vlm.html (added)
- share/http-lua/vlm_export.html (added)
- share/luaintf/http.lua (added)
- share/luaintf/modules/acl.lua (added)
- share/luaintf/modules/common.lua (modified) (1 diff)
- share/luaintf/modules/httpd.lua (added)
- share/luaintf/rc.lua (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
Makefile.am
r5dd38e7 re10d431 442 442 $(INSTALL) -m 644 $${i} $(top_builddir)/VLC-release.app/Contents/MacOS/share/luaintf/modules/`basename $${i}` ; \ 443 443 done ; \ 444 $(INSTALL) -d $(top_builddir)/VLC-release.app/Contents/MacOS/share/http-lua/dialogs 445 $(INSTALL) -d $(top_builddir)/VLC-release.app/Contents/MacOS/share/http-lua/js 446 $(INSTALL) -d $(top_builddir)/VLC-release.app/Contents/MacOS/share/http-lua/old 447 $(INSTALL) -d $(top_builddir)/VLC-release.app/Contents/MacOS/share/http-lua/old/admin 448 $(INSTALL) -d $(top_builddir)/VLC-release.app/Contents/MacOS/share/http-lua/old/vlm 449 $(INSTALL) -d $(top_builddir)/VLC-release.app/Contents/MacOS/share/http-lua/images 450 $(INSTALL) -d $(top_builddir)/VLC-release.app/Contents/MacOS/share/http-lua/requests 451 for i in $(srcdir)/share/http-lua/*.* ; do \ 452 $(INSTALL) -m 644 $${i} $(top_builddir)/VLC-release.app/Contents/MacOS/share/http-lua/`basename $${i}` ; \ 453 done ; \ 454 for i in $(srcdir)/share/http-lua/dialogs/* ; do \ 455 $(INSTALL) -m 644 $${i} $(top_builddir)/VLC-release.app/Contents/MacOS/share/http-lua/dialogs/`basename $${i}` ; \ 456 done ; \ 457 for i in $(srcdir)/share/http-lua/js/*.* ; do \ 458 $(INSTALL) -m 644 $${i} $(top_builddir)/VLC-release.app/Contents/MacOS/share/http-lua/js/`basename $${i}` ; \ 459 done ; \ 460 for i in $(srcdir)/share/http-lua/old/*.* ; do \ 461 $(INSTALL) -m 644 $${i} $(top_builddir)/VLC-release.app/Contents/MacOS/share/http-lua/old/`basename $${i}` ; \ 462 done ; \ 463 for i in $(srcdir)/share/http-lua/old/admin/*.* ; do \ 464 $(INSTALL) -m 644 $${i} $(top_builddir)/VLC-release.app/Contents/MacOS/share/http-lua/old/admin/`basename $${i}` ; \ 465 done ; \ 466 for i in $(srcdir)/share/http-lua/old/vlm/*.* ; do \ 467 $(INSTALL) -m 644 $${i} $(top_builddir)/VLC-release.app/Contents/MacOS/share/http-lua/old/vlm/`basename $${i}` ; \ 468 done ; \ 469 for i in $(srcdir)/share/http-lua/images/*.* ; do \ 470 $(INSTALL) -m 644 $${i} $(top_builddir)/VLC-release.app/Contents/MacOS/share/http-lua/images/`basename $${i}` ; \ 471 done ; \ 472 for i in $(srcdir)/share/http-lua/requests/*.* ; do \ 473 $(INSTALL) -m 644 $${i} $(top_builddir)/VLC-release.app/Contents/MacOS/share/http-lua/requests/`basename $${i}` ; \ 474 done ; \ 475 $(INSTALL) -m 644 $(srcdir)/share/http-lua/requests/readme $(top_builddir)/VLC-release.app/Contents/MacOS/share/http-lua/requests/readme.txt 444 476 $(INSTALL) -d $(top_builddir)/VLC-release.app/Contents/MacOS/share/http/dialogs 445 477 $(INSTALL) -d $(top_builddir)/VLC-release.app/Contents/MacOS/share/http/js … … 647 679 done 648 680 681 mkdir -p "$(top_builddir)/vlc-${VERSION}/http-lua/images" 682 mkdir -p "$(top_builddir)/vlc-${VERSION}/http-lua/requests" 683 mkdir -p "$(top_builddir)/vlc-${VERSION}/http-lua/js" 684 mkdir -p "$(top_builddir)/vlc-${VERSION}/http-lua/dialogs" 685 mkdir -p "$(top_builddir)/vlc-${VERSION}/http-lua/old" 686 mkdir -p "$(top_builddir)/vlc-${VERSION}/http-lua/old/vlm" 687 mkdir -p "$(top_builddir)/vlc-${VERSION}/http-lua/old/admin" 688 cp $(srcdir)/share/http-lua/*.html $(top_builddir)/vlc-${VERSION}/http-lua/ ; 689 unix2dos $(top_builddir)/vlc-${VERSION}/http-lua/*.html ; 690 cp $(srcdir)/share/http-lua/.hosts $(top_builddir)/vlc-${VERSION}/http-lua/ ; 691 unix2dos $(top_builddir)/vlc-${VERSION}/http-lua/.hosts ; 692 cp $(srcdir)/share/http-lua/*.css $(top_builddir)/vlc-${VERSION}/http-lua/ ; 693 unix2dos $(top_builddir)/vlc-${VERSION}/http-lua/*.css ; 694 cp $(srcdir)/share/http-lua/js/*.js $(top_builddir)/vlc-${VERSION}/http-lua/js/ ; 695 unix2dos $(top_builddir)/vlc-${VERSION}/http-lua/js/*.js ; 696 cp $(srcdir)/share/http-lua/dialogs/* $(top_builddir)/vlc-${VERSION}/http-lua/dialogs/ ; 697 unix2dos $(top_builddir)/vlc-${VERSION}/http-lua/dialogs/* ; 698 cp $(srcdir)/share/http-lua/dialogs/.hosts $(top_builddir)/vlc-${VERSION}/http-lua/dialogs/ ; 699 unix2dos $(top_builddir)/vlc-${VERSION}/http-lua/dialogs/.hosts ; 700 cp $(srcdir)/share/http-lua/*.ico $(top_builddir)/vlc-${VERSION}/http-lua/ ; 701 cp $(srcdir)/share/http-lua/images/*.png $(top_builddir)/vlc-${VERSION}/http-lua/images/ 702 cp $(srcdir)/share/http-lua/requests/*.xml $(top_builddir)/vlc-${VERSION}/http-lua/requests/ ; 703 unix2dos $(top_builddir)/vlc-${VERSION}/http-lua/requests/*.xml ; 704 cp $(srcdir)/share/http-lua/requests/readme $(top_builddir)/vlc-${VERSION}/http-lua/requests/readme.txt ; 705 unix2dos $(top_builddir)/vlc-${VERSION}/http-lua/requests/readme.txt ; 706 707 cp $(srcdir)/share/http-lua/old/*.html $(top_builddir)/vlc-${VERSION}/http-lua/old/ ; 708 unix2dos $(top_builddir)/vlc-${VERSION}/http-lua/old/*.html ; 709 cp $(srcdir)/share/http-lua/old/*.css $(top_builddir)/vlc-${VERSION}/http-lua/old/ ; 710 cp $(srcdir)/share/http-lua/old/.hosts $(top_builddir)/vlc-${VERSION}/http-lua/old/ ; 711 cp $(srcdir)/share/http-lua/old/*.png $(top_builddir)/vlc-${VERSION}/http-lua/old/ ; 712 cp $(srcdir)/share/http-lua/old/vlm/*.html $(top_builddir)/vlc-${VERSION}/http-lua/old/vlm/ ; 713 unix2dos $(top_builddir)/vlc-${VERSION}/http-lua/old/vlm/*.html ; 714 cp $(srcdir)/share/http-lua/old/admin/*.html $(top_builddir)/vlc-${VERSION}/http-lua/old/admin/ ; 715 unix2dos $(top_builddir)/vlc-${VERSION}/http-lua/old/admin/*.html ; 716 cp $(srcdir)/share/http-lua/old/admin/.access $(top_builddir)/vlc-${VERSION}/http-lua/old/admin/ ; 717 649 718 mkdir -p "$(top_builddir)/vlc-${VERSION}/http/images" 650 719 mkdir -p "$(top_builddir)/vlc-${VERSION}/http/requests" modules/misc/lua/Modules.am
rde31813 re10d431 1 SOURCES_lua = playlist.c meta.c intf.c vlc.c vlc.h callbacks.c objects.c variables.c configuration.c net.c vlm.c 1 SOURCES_lua = playlist.c meta.c intf.c vlc.c vlc.h callbacks.c objects.c variables.c configuration.c net.c vlm.c httpd.c acl.c modules/misc/lua/callbacks.c
rde31813 re10d431 160 160 p_callback->i_index = i_index; 161 161 p_callback->i_type = var_Type( p_obj, psz_var ); 162 p_callback->L = lua_newthread( L ); 162 p_callback->L = lua_newthread( L ); /* Do we have to keep a reference to this thread somewhere to prevent garbage collection? */ 163 163 164 164 var_AddCallback( p_obj, psz_var, vlclua_callback, p_callback ); modules/misc/lua/intf.c
rd510781 re10d431 123 123 int i; 124 124 if( !p_input ) return vlclua_error( L ); 125 vlc_mutex_lock( &input_GetItem(p_input)->lock );125 //vlc_mutex_lock( &input_GetItem(p_input)->lock ); 126 126 i_cat = input_GetItem(p_input)->i_categories; 127 127 lua_createtable( L, 0, i_cat ); … … 142 142 lua_settable( L, -3 ); 143 143 } 144 vlc_object_release( p_input );144 //vlc_object_release( p_input ); 145 145 return 1; 146 146 } … … 162 162 lua_pushstring( L, input_GetItem(p_input)->psz_name ); 163 163 vlc_object_release( p_input ); 164 } 165 return 1; 166 } 167 168 static int vlclua_input_stats( lua_State *L ) 169 { 170 input_thread_t *p_input = vlclua_get_input_internal( L ); 171 input_item_t *p_item = p_input && p_input->p ? input_GetItem( p_input ) : NULL; 172 lua_newtable( L ); 173 if( p_item ) 174 { 175 #define STATS_INT( n ) lua_pushinteger( L, p_item->p_stats->i_ ## n ); \ 176 lua_setfield( L, -2, #n ); 177 #define STATS_FLOAT( n ) lua_pushnumber( L, p_item->p_stats->f_ ## n ); \ 178 lua_setfield( L, -2, #n ); 179 STATS_INT( read_bytes ) 180 STATS_FLOAT( input_bitrate ) 181 STATS_INT( demux_read_bytes ) 182 STATS_FLOAT( demux_bitrate ) 183 STATS_INT( decoded_video ) 184 STATS_INT( displayed_pictures ) 185 STATS_INT( lost_pictures ) 186 STATS_INT( decoded_audio ) 187 STATS_INT( played_abuffers ) 188 STATS_INT( lost_abuffers ) 189 STATS_INT( sent_packets ) 190 STATS_INT( sent_bytes ) 191 STATS_FLOAT( send_bitrate ) 192 #undef STATS_INT 193 #undef STATS_FLOAT 164 194 } 165 195 return 1; … … 455 485 lua_pushstring( L, p_input->psz_uri ); 456 486 lua_setfield( L, -2, "path" ); 457 lua_pushnumber( L, ((double)p_input->i_duration)*1e-6 ); 487 if( p_input->i_duration < 0 ) 488 lua_pushnumber( L, -1 ); 489 else 490 lua_pushnumber( L, ((double)p_input->i_duration)*1e-6 ); 458 491 lua_setfield( L, -2, "duration" ); 459 492 lua_pushinteger( L, p_input->i_nb_played ); … … 477 510 intf_thread_t *p_intf = (intf_thread_t *)vlclua_get_this( L ); 478 511 playlist_t *p_playlist = pl_Yield( p_intf ); 512 /* 479 513 int i_count = 0; 480 lua_settop( L, 0 ); 514 lua_settop( L, 0 );*/ 481 515 if( p_playlist->p_input ) 482 516 { 483 char *psz_uri =517 /*char *psz_uri = 484 518 input_item_GetURI( input_GetItem( p_playlist->p_input ) ); 485 519 lua_pushstring( L, psz_uri ); 486 520 free( psz_uri ); 487 lua_pushnumber( L, config_GetInt( p_intf, "volume" ) ); 521 lua_pushnumber( L, config_GetInt( p_intf, "volume" ) );*/ 488 522 vlc_mutex_lock( &p_playlist->object_lock ); 489 523 switch( p_playlist->status.i_status ) … … 493 527 break; 494 528 case PLAYLIST_RUNNING: 495 lua_pushstring( L, " running" );529 lua_pushstring( L, "playing" ); 496 530 break; 497 531 case PLAYLIST_PAUSED: … … 503 537 } 504 538 vlc_mutex_unlock( &p_playlist->object_lock ); 505 i_count += 3; 506 } 507 vlc_object_release( p_playlist ); 508 return i_count; 539 /*i_count += 3;*/ 540 } 541 else 542 { 543 lua_pushstring( L, "stopped" ); 544 } 545 vlc_object_release( p_playlist ); 546 return 1; 509 547 } 510 548 … … 553 591 { "decode_uri", vlclua_decode_uri }, 554 592 { "resolve_xml_special_chars", vlclua_resolve_xml_special_chars }, 593 { "convert_xml_special_chars", vlclua_convert_xml_special_chars }, 555 594 556 595 { "lock_and_wait", vlclua_lock_and_wait }, … … 559 598 { "version", vlclua_version }, 560 599 { "license", vlclua_license }, 600 { "copyright", vlclua_copyright }, 561 601 { "should_die", vlclua_intf_should_die }, 562 602 { "quit", vlclua_quit }, 603 604 { "homedir", vlclua_homedir }, 605 { "datadir", vlclua_datadir }, 606 { "configdir", vlclua_configdir }, 607 { "cachedir", vlclua_cachedir }, 608 { "datadir_list", vlclua_datadir_list }, 563 609 564 610 { NULL, NULL } … … 621 667 { "enqueue", vlclua_playlist_enqueue }, 622 668 { "get", vlclua_playlist_get }, 669 { "stats", vlclua_input_stats }, 623 670 624 671 { NULL, NULL } … … 665 712 { "read", vlclua_fd_read }, 666 713 { "write", vlclua_fd_write }, 714 { "stat", vlclua_stat }, 715 716 { "opendir", vlclua_opendir }, 667 717 668 718 { "new_fd_set", vlclua_fd_set_new }, … … 684 734 }; 685 735 736 static luaL_Reg p_reg_httpd[] = 737 { 738 { "host_new", vlclua_httpd_tls_host_new }, 739 { "host_delete", vlclua_httpd_host_delete }, 740 { "handler_new", vlclua_httpd_handler_new }, 741 { "handler_delete", vlclua_httpd_handler_delete }, 742 { "file_new", vlclua_httpd_file_new }, 743 { "file_delete", vlclua_httpd_file_delete }, 744 { "redirect_new", vlclua_httpd_redirect_new }, 745 { "redirect_delete", vlclua_httpd_redirect_delete }, 746 747 { NULL, NULL } 748 }; 749 750 static luaL_Reg p_reg_acl[] = 751 { 752 { "create", vlclua_acl_create }, 753 { "delete", vlclua_acl_delete }, 754 { "check", vlclua_acl_check }, 755 { "duplicate", vlclua_acl_duplicate }, 756 { "add_host", vlclua_acl_add_host }, 757 { "add_net", vlclua_acl_add_net }, 758 { "load_file", vlclua_acl_load_file }, 759 760 { NULL, NULL } 761 }; 686 762 687 763 static void Run( intf_thread_t *p_intf ); … … 818 894 luaL_register_submodule( L, "fd", p_reg_fd ); 819 895 luaL_register_submodule( L, "vlm", p_reg_vlm ); 896 luaL_register_submodule( L, "httpd", p_reg_httpd ); 897 luaL_register_submodule( L, "acl", p_reg_acl ); 820 898 /* clean up */ 821 899 lua_pop( L, 1 ); modules/misc/lua/net.c
rde31813 re10d431 206 206 return 1; 207 207 } 208 209 int vlclua_stat( lua_State *L ) 210 { 211 #ifdef HAVE_SYS_STAT_H 212 const char *psz_path = luaL_checkstring( L, 1 ); 213 struct stat s; 214 if( utf8_stat( psz_path, &s ) ) 215 return 0; 216 //return luaL_error( L, "Couldn't stat %s.", psz_path ); 217 lua_newtable( L ); 218 if( S_ISREG( s.st_mode ) ) 219 lua_pushstring( L, "file" ); 220 else if( S_ISDIR( s.st_mode ) ) 221 lua_pushstring( L, "dir" ); 222 #ifdef S_ISCHR 223 else if( S_ISCHR( s.st_mode ) ) 224 lua_pushstring( L, "character device" ); 225 #endif 226 #ifdef S_ISBLK 227 else if( S_ISBLK( s.st_mode ) ) 228 lua_pushstring( L, "block device" ); 229 #endif 230 #ifdef S_ISFIFO 231 else if( S_ISFIFO( s.st_mode ) ) 232 lua_pushstring( L, "fifo" ); 233 #endif 234 #ifdef S_ISLNK 235 else if( S_ISLNK( s.st_mode ) ) 236 lua_pushstring( L, "symbolic link" ); 237 #endif 238 #ifdef S_ISSOCK 239 else if( S_ISSOCK( s.st_mode ) ) 240 lua_pushstring( L, "socket" ); 241 #endif 242 else 243 lua_pushstring( L, "unknown" ); 244 lua_setfield( L, -2, "type" ); 245 lua_pushinteger( L, s.st_mode ); 246 lua_setfield( L, -2, "mode" ); 247 lua_pushinteger( L, s.st_uid ); 248 lua_setfield( L, -2, "uid" ); 249 lua_pushinteger( L, s.st_gid ); 250 lua_setfield( L, -2, "gid" ); 251 lua_pushinteger( L, s.st_size ); 252 lua_setfield( L, -2, "size" ); 253 lua_pushinteger( L, s.st_atime ); 254 lua_setfield( L, -2, "access_time" ); 255 lua_pushinteger( L, s.st_mtime ); 256 lua_setfield( L, -2, "modification_time" ); 257 lua_pushinteger( L, s.st_ctime ); 258 lua_setfield( L, -2, "creation_time" ); 259 return 1; 260 #else 261 # warning "Woops, looks like we don't have stat on your platform" 262 return luaL_error( L, "System is missing <sys/stat.h>" ); 263 #endif 264 } 265 266 int vlclua_opendir( lua_State *L ) 267 { 268 const char *psz_dir = luaL_checkstring( L, 1 ); 269 DIR *p_dir; 270 int i = 0; 271 #ifdef HAVE_SYS_STAT_H 272 struct stat s; 273 if( utf8_stat( psz_dir, &s ) == -1 ) 274 return luaL_error( L, "Error while trying to stat `%s'.", psz_dir ); 275 if( !S_ISDIR( s.st_mode ) ) 276 return luaL_error( L, "`%s' is not a directory.", psz_dir ); 277 #endif 278 if( ( p_dir = utf8_opendir( psz_dir ) ) == NULL ) 279 return luaL_error( L, "cannot open directory `%s'.", psz_dir ); 280 281 lua_newtable( L ); 282 for( ;; ) 283 { 284 char *psz_filename = utf8_readdir( p_dir ); 285 if( !psz_filename ) break; 286 i++; 287 lua_pushstring( L, psz_filename ); 288 lua_rawseti( L, -2, i ); 289 free( psz_filename ); 290 } 291 closedir( p_dir ); 292 return 1; 293 } modules/misc/lua/vlc.c
rd510781 re10d431 120 120 121 121 /***************************************************************************** 122 * Get the VLC copyright 123 *****************************************************************************/ 124 int vlclua_copyright( lua_State *L ) 125 { 126 lua_pushstring( L, COPYRIGHT_MESSAGE ); 127 return 1; 128 } 129 130 /***************************************************************************** 122 131 * Get the VLC license msg/disclaimer 123 132 *****************************************************************************/ … … 138 147 vlc_object_kill( p_this->p_libvlc ); 139 148 return 0; 149 } 150 151 /***************************************************************************** 152 * Global properties getters 153 *****************************************************************************/ 154 int vlclua_datadir( lua_State *L ) 155 { 156 lua_pushstring( L, config_GetDataDir() ); 157 return 1; 158 } 159 int vlclua_homedir( lua_State *L ) 160 { 161 lua_pushstring( L, vlclua_get_this( L )->p_libvlc->psz_homedir ); 162 return 1; 163 } 164 int vlclua_configdir( lua_State *L ) 165 { 166 lua_pushstring( L, vlclua_get_this( L )->p_libvlc->psz_configdir ); 167 return 1; 168 } 169 int vlclua_cachedir( lua_State *L ) 170 { 171 lua_pushstring( L, vlclua_get_this( L )->p_libvlc->psz_cachedir ); 172 return 1; 173 } 174 int vlclua_datadir_list( lua_State *L ) 175 { 176 const char *psz_dirname = luaL_checkstring( L, 1 ); 177 vlc_object_t *p_this = vlclua_get_this( L ); 178 char *ppsz_dir_list[] = { NULL, NULL, NULL, NULL }; 179 char **ppsz_dir = ppsz_dir_list; 180 int i = 1; 181 182 if( vlclua_dir_list( p_this, psz_dirname, ppsz_dir_list ) != VLC_SUCCESS ) 183 return 0; 184 lua_newtable( L ); 185 for( ; *ppsz_dir; ppsz_dir++ ) 186 { 187 lua_pushstring( L, *ppsz_dir ); 188 lua_rawseti( L, -2, i ); 189 i ++; 190 } 191 return 1; 140 192 } 141 193 … … 270 322 * up to (stack size - 1) arguments */ 271 323 resolve_xml_special_chars( psz_string ); 324 lua_pushstring( L, psz_string ); 325 free( psz_string ); 326 } 327 return i_top; 328 } 329 330 int vlclua_convert_xml_special_chars( lua_State *L ) 331 { 332 int i_top = lua_gettop( L ); 333 int i; 334 for( i = 1; i <= i_top; i++ ) 335 { 336 char *psz_string = convert_xml_special_chars( luaL_checkstring(L,1) ); 337 lua_remove( L, 1 ); 272 338 lua_pushstring( L, psz_string ); 273 339 free( psz_string ); modules/misc/lua/vlc.h
rd510781 re10d431 101 101 } 102 102 103 static inline const char *luaL_nilorcheckstring( lua_State *L, int narg ) 104 { 105 if( lua_isnil( L, narg ) ) 106 return NULL; 107 return luaL_checkstring( L, narg ); 108 } 109 103 110 /***************************************************************************** 104 111 * Lua vlc_object_t wrapper … … 133 140 int vlclua_fd_write( lua_State * ); 134 141 142 int vlclua_stat( lua_State * ); 143 int vlclua_opendir( lua_State * ); 144 135 145 int vlclua_vlm_new( lua_State * ); 136 146 int vlclua_vlm_delete( lua_State * ); 137 147 int vlclua_vlm_execute_command( lua_State * ); 138 148 149 int vlclua_httpd_tls_host_new( lua_State *L ); 150 int vlclua_httpd_host_delete( lua_State *L ); 151 int vlclua_httpd_handler_new( lua_State * L ); 152 int vlclua_httpd_handler_delete( lua_State *L ); 153 int vlclua_httpd_file_new( lua_State *L ); 154 int vlclua_httpd_file_delete( lua_State *L ); 155 int vlclua_httpd_redirect_new( lua_State *L ); 156 int vlclua_httpd_redirect_delete( lua_State *L ); 157 158 int vlclua_acl_create( lua_State * ); 159 int vlclua_acl_delete( lua_State * ); 160 int vlclua_acl_check( lua_State * ); 161 int vlclua_acl_duplicate( lua_State * ); 162 int vlclua_acl_add_host( lua_State * ); 163 int vlclua_acl_add_net( lua_State * ); 164 int vlclua_acl_load_file( lua_State * ); 165 166 139 167 /***************************************************************************** 140 168 * Lua function bridge … … 146 174 int vlclua_version( lua_State * ); 147 175 int vlclua_license( lua_State * ); 176 int vlclua_copyright( lua_State * ); 148 177 int vlclua_quit( lua_State * ); 178 179 int vlclua_datadir( lua_State * ); 180 int vlclua_homedir( lua_State * ); 181 int vlclua_configdir( lua_State * ); 182 int vlclua_cachedir( lua_State * ); 183 int vlclua_datadir_list( lua_State * ); 149 184 150 185 int vlclua_pushvalue( lua_State *L, int i_type, vlc_value_t val ); /* internal use only */ … … 170 205 int vlclua_decode_uri( lua_State * ); 171 206 int vlclua_resolve_xml_special_chars( lua_State * ); 207 int vlclua_convert_xml_special_chars( lua_State * ); 172 208 173 209 int vlclua_msg_dbg( lua_State * ); share/Makefile.am
rde31813 re10d431 264 264 luaintf/telnet.lua \ 265 265 luaintf/dummy.lua 266 267 DIST_http_lua = \ 268 http-lua/.hosts \ 269 http-lua/dialogs/.hosts \ 270 http-lua/dialogs/browse \ 271 http-lua/dialogs/footer \ 272 http-lua/dialogs/input \ 273 http-lua/dialogs/main \ 274 http-lua/dialogs/mosaic \ 275 http-lua/dialogs/playlist \ 276 http-lua/dialogs/sout \ 277 http-lua/dialogs/vlm \ 278 http-lua/favicon.ico \ 279 http-lua/images/delete.png \ 280 http-lua/images/delete_small.png \ 281 http-lua/images/eject.png \ 282 http-lua/images/empty.png \ 283 http-lua/images/fullscreen.png \ 284 http-lua/images/help.png \ 285 http-lua/images/info.png \ 286 http-lua/images/loop.png \ 287 http-lua/images/minus.png \ 288 http-lua/images/next.png \ 289 http-lua/images/pause.png \ 290 http-lua/images/play.png \ 291 http-lua/images/playlist.png \ 292 http-lua/images/playlist_small.png \ 293 http-lua/images/plus.png \ 294 http-lua/images/prev.png \ 295 http-lua/images/refresh.png \ 296 http-lua/images/repeat.png \ 297 http-lua/images/sd.png \ 298 http-lua/images/shuffle.png \ 299 http-lua/images/slider_bar.png \ 300 http-lua/images/slider_left.png \ 301 http-lua/images/slider_point.png \ 302 http-lua/images/slider_right.png \ 303 http-lua/images/snapshot.png \ 304 http-lua/images/slow.png \ 305 http-lua/images/sort.png \ 306 http-lua/images/sout.png \ 307 http-lua/images/speaker.png \ 308 http-lua/images/speaker_mute.png \ 309 http-lua/images/stop.png \ 310 http-lua/images/vlc16x16.png \ 311 http-lua/images/volume_down.png \ 312 http-lua/images/volume_up.png \ 313 http-lua/images/white.png \ 314 http-lua/images/white_cross_small.png \ 315 http-lua/index.html \ 316 http-lua/js/functions.js \ 317 http-lua/js/mosaic.js \ 318 http-lua/js/vlm.js \ 319 http-lua/mosaic.html \ 320 http-lua/old/.hosts \ 321 http-lua/old/admin/.access \ 322 http-lua/old/admin/browse.html \ 323 http-lua/old/admin/dboxfiles.html \ 324 http-lua/old/admin/index.html \ 325 http-lua/old/cone_minus.png \ 326 http-lua/old/cone_plus.png \ 327 http-lua/old/index.html \ 328 http-lua/old/info.html \ 329 http-lua/old/style.css \ 330 http-lua/old/vlm/edit.html \ 331 http-lua/old/vlm/index.html \ 332 http-lua/old/vlm/new.html \ 333 http-lua/old/vlm/show.html \ 334 http-lua/old/webcam.html \ 335 http-lua/requests/browse.xml \ 336 http-lua/requests/playlist.xml \ 337 http-lua/requests/status.xml \ 338 http-lua/requests/vlm.xml \ 339 http-lua/requests/vlm_cmd.xml \ 340 http-lua/requests/readme \ 341 http-lua/style.css \ 342 http-lua/iehacks.css \ 343 http-lua/vlm.html \ 344 http-lua/vlm_export.html \ 345 http-lua/flash.html share/luaintf/modules/common.lua
rde31813 re10d431 71 71 math.floor(duration%60)) 72 72 end 73 74 -- realpath 75 function realpath(path) 76 return string.gsub(string.gsub(string.gsub(string.gsub(path,"/%.%./[^/]+","/"),"/[^/]+/%.%./","/"),"/%./","/"),"//","/") 77 end 78 79 -- seek 80 function seek(value) 81 local input = vlc.object.input() 82 if string.sub(value,#value)=="%" then 83 vlc.var.set(input,"position",tonumber(string.sub(value,1,#value-1))/100.) 84 else 85 vlc.var.set(input,"time",tonumber(value)) 86 end 87 end share/luaintf/rc.lua
rd510781 re10d431 287 287 288 288 function seek(name,client,value) 289 local input = vlc.object.input() 290 if string.sub(value,#value)=="%" then 291 vlc.var.set(input,"position",tonumber(string.sub(value,1,#value-1))/100.) 292 else 293 vlc.var.set(input,"time",tonumber(value)) 294 end 289 common.seek(value) 295 290 end 296 291
