Home   News   Product   Order   Forum   Feedback   Partner   Profile © Neatware 2000
Neatware Examples: Advanced
Search
preview, play_vcd, ...
Home : Last Update: Thu Jul 06 16:06:33 2000
  1. adv_preview

    ::file::get command with the arguments driver, subdir, and filename gets a list of file specified in the filename. At first the program gets all the .dat files in the MPEGAV subdirectory of the f: driver. The ::file::join command gets the full path. Then it sets the preview frame number. Finally, it plays the video from 0 to the frames.

    	package require media 1.0
    
    get width and height
    	set w [expr [?screen width]/2]
    	set h [expr [?screen height]/2]
    
    get all the .dat files
    	set ls [::file::get "f:/" "MPEGAV" "*.dat"]
    	set path [::file::join "f:/" "MPEGAV"]
    
    set end frames and start play
    	set frames [expr 5*30]
    	_window "title=Ladybug2000 Preview auto=true centre=$w $h"
    
    	  foreach e $ls {
    	    _video "name=[::file::join $path $e]"
    	      _play "from=0 to=$frames"
    	    video_
    	  }
    
    	window_
    

  2. adv_play_vcd

    It palys all the .dat files in the MPEGAV directory of the driver f:. And do the transform between two video files.

    	package require media 1.0
    
    change f:/ to c:/ if cd-rom is c:
    	set ls [::file::get "f:/" "MPEGAV" "*.dat"]
    	set path [::file::join f:/ MPEGAV]
    
    	set w [?screen width]
    	set h [?screen height]
    
    open window
    	_window "title=Ladybug2000 VCD Player 
    	  border=normal auto=true centre=$w $h"
    
    	  _snap "image=../Media/default.png"
    
    open video files
    	  foreach e $ls {
    	    _video "name=[::file::join $path $e]"
    	      !window "title=Ladybug2000 VCD -- $e"
    	      _transform {name=Wipe duration=20}
    	      _play {from=0}
    	      _snap
    	    video_
    	  }
    
    	window_
    
    

  3. adv_play_cutlist

    It sets a cutlist with the first file numbered as 0. suppose vcd mpeg files in the f: driver and MPEGAV folder. Get all the .dat files in teh f:/MPEGAV into the ls list. change f: to your own vcd driver such as d:. The code will generate a list r included the name of the .dat file. Here we suppose cutls is organized in increasing order

    	package require media 1.0
    
    set your own cutlist {0 1 14}
    	set cutls {0 1 14}
    
    	set ls [::file::get "f:/" "MPEGAV" "*.dat"]
    	set path [::file::join f:/ MPEGAV]
    
    select the file name from the ls
     
    	set j 0
    	set r {}  
    	for {set i 0} {$i < [::list::length $ls]} {incr i} {
    	  if {$i == [::list::index $cutls $j]} {
    	    ::list::append r [::list::index $ls $i]
    	    incr j
    	  }
    	}
    
    open window and video and play
    	_window "title=Ladybug2000 Cutlist 
    	  border=windowless auto=true centre=800 600"
    
    	  foreach e $r {
    	    _video "name=[::file::join $path $e]"
    	      _play
    	    video_
    	  }
    
    	window_
    
    

  4. adv_play_reverse

    It shows how to play a video in reverse. Note: it may lost some quality of the picture because intra frames are produced by the front or behind frames. So it is better to use the video that all the frames are key frames. In the program the _seek command reset the current frame position. _step command will play one frame.

    	package require media 1.0
    
    	set ls {neat.mpg}
    
    	_window {title=Ladybug2000 Reverse Play centre=480 320}
    	  foreach e $ls \{
    	    _video "name=$e"
    
    get total video frames. move header to the last frame.
    	      set frames [?video length]
    	      _seek "current=[expr $frames-1]"
    
    playback in reverse
    	      for {} {$frames > 0} {incr frames -15} {
    	        _step
    	        _seek "current=[expr $frames-1]"
    	      }
    	    video_
    	  \}
    	window_
    

  5. adv_preview_step

    Using _step command play the video and display the frame number of the video. It is useful to correspond a frame with its number.

    	package require media 1.0
    
    	set w [expr [?screen width]/2]
    	set h [expr [?screen height]/2]
    
    	set ls [::file::get f:/ MPEGAV *.dat]
    	set path [::file::join f:/ MPEGAV]
    
    	set frames [expr 5*30]
    
    open window and video
    	_window "title=Ladybug2000 auto=true Preview centre=$w $h"
    
    	  foreach e $ls \{
    	    _video "name=[::file::join $path $e]"
    	      for {set n 0} {$n < $frames} {incr n} \{
    
    dispaly current frame number
    	        !window "title=Ladybug2000 File: $e Frame: $n"
    	        _step
    	      \}
    	    video_
    	  \}
    
    	window_
    

    << Transform         Interactivity >>

Home : Last Update: Thu Jul 06 16:06:33 2000
Search
preview, play_vcd, ...
Neatware Examples: Advanced
Home   News   Product   Order   Forum   Feedback   Partner   Profile © Neatware 2000