Changeset 387
- Timestamp:
- 01/08/2008 01:39:59 (8 months ago)
- Location:
- trunk
- Files:
-
- 3 modified
-
lib/shoes/help.rb (modified) (1 diff)
-
samples/video.rb (modified) (1 diff)
-
shoes/ruby.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/shoes/help.rb
r385 r387 507 507 The horizontal screen size of the image in pixels. 508 508 509 == Video == 510 511 Shoes supports embedding of QuickTime, Flash video (FLV), DivX, Xvid and various other popular video formats. This is all thanks to VideoLAN and ffmpeg, two sensational open source libraries. Use the `video` method on a slot to setup a Shoes::Video object. 512 513 In addition to video formats, some audio formats are also supported, such as MP3, WAV and Ogg Vorbis. 514 515 Video support is optional in Shoes and some builds do not support video. For example, video support is unavailable for PowerPC. When you download Shoes, the build for your platform will be marked `novideo` in the filename if no video support is available. 516 517 === hide() » self === 518 519 Hides the video. If already playing, the video will continue to play. This just turns off display of the video. One possible use of this method is to collapse the video area when it is playing an audio file, such as an MP3. 520 521 === length() » a number === 522 523 The full length of the video in milliseconds. Returns nil if the video is not yet loaded. 524 525 === move(x, y) » self === 526 527 Moves the video to specific coordinates, the (x, y) being the upper left hand corner of the video. 528 529 === pause() » self === 530 531 Pauses the video, if it is playing. 532 533 === playing?() » true of false === 534 535 Returns true if the video is currently playing. Or, false if the video is paused or stopped. 536 537 === play() » self === 538 539 Starts playing the video, if it isn't already playing. If already playing, the video is restarted from the beginning. 540 541 === position() » a decimal === 542 543 The position of the video as a decimanl number (a Float) between the beginning (0.0) and the end (1.0). For instance, a Float value of 0.5 indicates the halfway point of the video. 544 545 === position = a decimal === 546 547 Sets the position of the video using a Float value. To move the video to its 25% position: `@video.position = 0.25`. 548 549 === remove() » self === 550 551 Removes the video from its slot. This will stop the video as well. 552 553 === show() » self === 554 555 Reveals the video, if it has been hidden by the `hide()` method. 556 557 === stop() » self === 558 559 Stops the video, if it is playing. 560 561 === time() » a number === 562 563 The time position of the video in milliseconds. So, if the video is 10 seconds into play, this method would return the number 10000. 564 565 === time = a number === 566 567 Set the position of the video to a time in milliseconds. 568 569 === toggle() » self === 570 571 Toggles the visibility of the video. If the video can be seen, then `hide` is called. Otherwise, `show` is called. 572 509 573 END -
trunk/samples/video.rb
r272 r387 1 Shoes.app do 2 stack do 1 Shoes.app :width => 408, :height => 334, :resizable => false do 2 background "#eee" 3 stack :margin => 4 do 3 4 @vid = video "http://whytheluckystiff.net/o..e/adventure_time.flv" 4 para "controls: ",5 link("play") { @vid.play }, ", ",6 link("pause") { @vid.pause }, ", ",7 link("stop") { @vid.stop }, ", ",8 link("hide") { @vid.hide }, ", ",9 link("show") { @vid.show }10 5 end 6 para "controls: ", 7 link("play") { @vid.play }, ", ", 8 link("pause") { @vid.pause }, ", ", 9 link("stop") { @vid.stop }, ", ", 10 link("hide") { @vid.hide }, ", ", 11 link("show") { @vid.show }, ", ", 12 link("+5 sec") { @vid.time += 5000 } 11 13 end -
trunk/shoes/ruby.c
r384 r387 1079 1079 } 1080 1080 1081 #define VIDEO_GET_METHOD(x, ctype, rbtype) \ 1082 VALUE shoes_video_get_##x(VALUE self) \ 1083 { \ 1084 shoes_video *self_t; \ 1085 Data_Get_Struct(self, shoes_video, self_t); \ 1086 if (self_t->init == 1) \ 1087 { \ 1088 libvlc_input_t *input = libvlc_playlist_get_input(self_t->vlc, NULL); \ 1089 if (input != NULL) { \ 1090 ctype len = libvlc_input_get_##x(input, &self_t->excp); \ 1091 shoes_vlc_exception(&self_t->excp); \ 1092 return rbtype(len); \ 1093 } \ 1094 } \ 1095 return Qnil; \ 1096 } 1097 1098 #define VIDEO_SET_METHOD(x, rbconv) \ 1099 VALUE shoes_video_set_##x(VALUE self, VALUE val) \ 1100 { \ 1101 shoes_video *self_t; \ 1102 Data_Get_Struct(self, shoes_video, self_t); \ 1103 if (self_t->init == 1) \ 1104 { \ 1105 libvlc_input_t *input = libvlc_playlist_get_input(self_t->vlc, NULL); \ 1106 if (input != NULL) { \ 1107 libvlc_input_set_##x(input, rbconv(val), &self_t->excp); \ 1108 shoes_vlc_exception(&self_t->excp); \ 1109 } \ 1110 } \ 1111 return val; \ 1112 } 1113 1081 1114 VIDEO_METHOD(clear); 1082 1115 VIDEO_METHOD(prev); … … 1084 1117 VIDEO_METHOD(pause); 1085 1118 VIDEO_METHOD(stop); 1119 VIDEO_GET_METHOD(length, vlc_int64_t, INT2NUM); 1120 VIDEO_GET_METHOD(time, vlc_int64_t, INT2NUM); 1121 VIDEO_SET_METHOD(time, NUM2INT); 1122 VIDEO_GET_METHOD(position, float, rb_float_new); 1123 VIDEO_SET_METHOD(position, NUM2DBL); 1086 1124 #endif 1087 1125 … … 3572 3610 rb_define_method(cVideo, "pause", CASTHOOK(shoes_video_pause), 0); 3573 3611 rb_define_method(cVideo, "stop", CASTHOOK(shoes_video_stop), 0); 3612 rb_define_method(cVideo, "length", CASTHOOK(shoes_video_get_length), 0); 3613 rb_define_method(cVideo, "position", CASTHOOK(shoes_video_get_position), 0); 3614 rb_define_method(cVideo, "position=", CASTHOOK(shoes_video_set_position), 1); 3615 rb_define_method(cVideo, "time", CASTHOOK(shoes_video_get_time), 0); 3616 rb_define_method(cVideo, "time=", CASTHOOK(shoes_video_set_time), 1); 3574 3617 #endif 3575 3618
