| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent ab06f40 commit d6f34e5
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -722,10 +722,19 @@ protected void setEventHandlerObject(Object obj) { | |||
| 722 | 722 | eventHandler = obj; | |
| 723 | 723 | ||
| 724 | 724 | try { | |
| 725 | - movieEventMethod = eventHandler.getClass().getMethod("movieEvent", | ||
| 726 | - new Class[] { Movie.class }); | ||
| 725 | + movieEventMethod = eventHandler.getClass().getMethod("movieEvent", Movie.class); | ||
| 726 | + return; | ||
| 727 | + } catch (Exception e) { | ||
| 728 | + // no such method, or an error... which is fine, just ignore | ||
| 729 | + } | ||
| 730 | + | ||
| 731 | + // movieEvent can alternatively be defined as receiving an Object, to allow | ||
| 732 | + // Processing mode implementors to support the video library without linking | ||
| 733 | + // to it at build-time. | ||
| 734 | + try { | ||
| 735 | + movieEventMethod = eventHandler.getClass().getMethod("movieEvent", Object.class); | ||
| 727 | 736 | } catch (Exception e) { | |
| 728 | - // no such method, or an error.. which is fine, just ignore | ||
| 737 | + // no such method, or an error... which is fine, just ignore | ||
| 729 | 738 | } | |
| 730 | 739 | } | |
| 731 | 740 | ||
@@ -808,20 +817,10 @@ protected synchronized void invokeEvent(int w, int h, IntBuffer buffer) { | |||
| 808 | 817 | } | |
| 809 | 818 | ||
| 810 | 819 | if (playing) { | |
| 811 | - // Creates a movieEvent. | ||
| 812 | - if (movieEventMethod != null) { | ||
| 813 | - try { | ||
| 814 | - movieEventMethod.invoke(eventHandler, new Object[] { this }); | ||
| 815 | - } catch (Exception e) { | ||
| 816 | - System.err.println("error, disabling movieEvent() for " + filename); | ||
| 817 | - e.printStackTrace(); | ||
| 818 | - movieEventMethod = null; | ||
| 819 | - } | ||
| 820 | - } | ||
| 820 | + fireMovieEvent(); | ||
| 821 | 821 | } | |
| 822 | 822 | } | |
| 823 | 823 | ||
| 824 | - | ||
| 825 | 824 | protected synchronized void invokeEvent(int w, int h, Buffer buffer) { | |
| 826 | 825 | available = true; | |
| 827 | 826 | bufWidth = w; | |
@@ -835,19 +834,22 @@ protected synchronized void invokeEvent(int w, int h, Buffer buffer) { | |||
| 835 | 834 | natBuffer = buffer; | |
| 836 | 835 | ||
| 837 | 836 | if (playing) { | |
| 838 | - // Creates a movieEvent. | ||
| 839 | - if (movieEventMethod != null) { | ||
| 840 | - try { | ||
| 841 | - movieEventMethod.invoke(eventHandler, new Object[] { this }); | ||
| 842 | - } catch (Exception e) { | ||
| 843 | - System.err.println("error, disabling movieEvent() for " + filename); | ||
| 844 | - e.printStackTrace(); | ||
| 845 | - movieEventMethod = null; | ||
| 846 | - } | ||
| 847 | - } | ||
| 837 | + fireMovieEvent(); | ||
| 848 | 838 | } | |
| 849 | 839 | } | |
| 850 | 840 | ||
| 841 | + private void fireMovieEvent() { | ||
| 842 | + // Creates a movieEvent. | ||
| 843 | + if (movieEventMethod != null) { | ||
| 844 | + try { | ||
| 845 | + movieEventMethod.invoke(eventHandler, this); | ||
| 846 | + } catch (Exception e) { | ||
| 847 | + System.err.println("error, disabling movieEvent() for " + filename); | ||
| 848 | + e.printStackTrace(); | ||
| 849 | + movieEventMethod = null; | ||
| 850 | + } | ||
| 851 | + } | ||
| 852 | + } | ||
| 851 | 853 | ||
| 852 | 854 | protected void eosEvent() { | |
| 853 | 855 | if (repeat) { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments