Difference between revisions of "GenReS"
(→Back-end programs) |
m (Reverted edit of Ex1B3k, changed back to last version by Khlut) |
||
(33 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
{{en|ru=GenReS(плагин)|cn=GenReS_cn}} | {{en|ru=GenReS(плагин)|cn=GenReS_cn}} | ||
+ | |||
+ | GenReS is a generic reconfigurable scriptable plugin for Mozilla based browsers. It allows to use external programs for EMBED and OBJECT HTML tags or to start them in browser full window. | ||
== Project Pages == | == Project Pages == | ||
+ | *[https://savannah.nongnu.org/files/?group=genres Download] | ||
*[https://savannah.nongnu.org/projects/genres Development] | *[https://savannah.nongnu.org/projects/genres Development] | ||
*[http://freshmeat.net/projects/genres/ Subscribe for news] | *[http://freshmeat.net/projects/genres/ Subscribe for news] | ||
*[http://sourceforge.net/projects/genres/ Mirror] | *[http://sourceforge.net/projects/genres/ Mirror] | ||
− | == Static tag parameters == | + | |
+ | == Configuration == | ||
+ | The plugin uses "~/.mozilla/genres/genres.conf" or "/etc/genres.conf" as main config file. | ||
+ | Options for mplayer, mencoder and ElphelOgm are stored in the config file "~/.mozilla/genres/mplayer.conf", which is used by mplayer.pl control script. | ||
+ | The files can contain shell-like comments. | ||
+ | === options in genres.conf === | ||
+ | ;mozillastreams={1|0} :- use or not mozilla streams (and cache) for http, https and ftp; | ||
+ | ;debuglevel={1|0} :- enable or disable the debug output; | ||
+ | ;background={-1|0|1} :- object color while loadining: 0 - black, 1 - white, -1 - mozilla default (gray). | ||
+ | |||
+ | === options in mplayer.conf === | ||
+ | ;out_file_once=template :- filename template filename; | ||
+ | ;out_file=template :- filename template filename for tags with parameter save=auto; | ||
+ | ;out_file_jpegs=template :- filename template for tags with thesaveformat=jpeg; | ||
+ | ;out_file_jpegs_auto=template :- same for save=auto and saveformat=jpeg; | ||
+ | ;vo={x11,xv} :- video output driver (see man mplayer about -vo option); | ||
+ | ;ao={arts,esd,alsa,oss} :- audio output driver (see man mplayer about -ao option); | ||
+ | ;not_ask={1|0} :- not show file save dialog for tags with save=auto parameter; | ||
+ | ;not_ask_jpegs={1|0} :- same for saveformat=jpeg; | ||
+ | ;frames=number :- frames per file limit for recording (output will be splitted). | ||
+ | |||
+ | == Usage in Javascript == | ||
+ | === Static tag parameters === | ||
;lowres: decimation for accelerated DCT (0-3); | ;lowres: decimation for accelerated DCT (0-3); | ||
;width: width of the object window; | ;width: width of the object window; | ||
− | ;loop: | + | ;loop: number of iterations of the playback (0 or nothing is infinite); |
;fps: frame frequency; | ;fps: frame frequency; | ||
+ | ;frameskip : skip n frames after one saved (only for rtp/mjpeg and ElphelOgm); | ||
+ | ;framedelay : a number of fully received frames delayed in the buffer (only for rtp/mjpeg and ElphelOgm); | ||
+ | ;rotate : the rotation angle of the image clockwise in degrees (0|90|180|240) | ||
+ | ;mirror : mirror-symmetry mapping relative to vertical axis (true|false) | ||
+ | ;flip : the same relative to horizontal (true|false); simultaneous setting of flip and mirror is equivalent to rotate=180 | ||
+ | ;saveformat=jpeg|ogm|avi : format for video recording (jpeg, ogm is only for rtp/mjpeg and ElphelOgm) | ||
− | == Dynamic variables (also | + | === Dynamic variables (can also be used as the parameters of tags) === |
;href: url of the file or stream; | ;href: url of the file or stream; | ||
;src: as yet simply another name for href. | ;src: as yet simply another name for href. | ||
;pause=1 or play=0: to pause player; | ;pause=1 or play=0: to pause player; | ||
;pause=0 or play=1: to continue playback; | ;pause=0 or play=1: to continue playback; | ||
+ | ;filepos=sec : go to time or percent specifed, maybe not works if mplayer is not support seeking for the current file; | ||
+ | ;framestep=anything : show next frame and pause (for step-by-step view); | ||
;run=1: to start player again if it was terminated (by error or end of file); | ;run=1: to start player again if it was terminated (by error or end of file); | ||
;run=0: to terminate player; | ;run=0: to terminate player; | ||
− | ;save: to run mencoder instead of mplayer; | + | ;save: to run mencoder or ElphelOgm as recorder instead of mplayer; |
− | :;save=ask: to always ask the name | + | :;save=ask: to always ask the file name for recording; |
:;save=auto: not to ask if user sets it in dialog | :;save=auto: not to ask if user sets it in dialog | ||
− | == Status variables == | + | === Status variables === |
− | This the | + | This the output from mplayer or mencoder. |
− | Now strings simply are | + | Now strings simply are split into two parts on the first of the symbols '=' or ':'. |
The left part becomes a name of the variable (gaps and nonlatin letters are removed) and the right part is a value. | The left part becomes a name of the variable (gaps and nonlatin letters are removed) and the right part is a value. | ||
− | ;frame: the message | + | ;frame: the message from mplayer/mencoder about the last frame; |
;error: last error message; | ;error: last error message; | ||
− | + | ;FATAL: fatal error message from mplayer; | |
+ | Other variables are possible but they are not used as yet. | ||
;run: special variable, the state of player process: 0 - not running, 1 - running; | ;run: special variable, the state of player process: 0 - not running, 1 - running; | ||
;pause, play: it is analogous - the pause state. | ;pause, play: it is analogous - the pause state. | ||
− | == Callback functions == | + | === Callback functions === |
− | On the arrival of data from a player it is transferred to the variables | + | On the arrival of data from a player it is transferred to the object variables and it becomes accessible from javascript. |
In this case if it is assigned the function with the corresponding name "on<variable_name>" will be called. | In this case if it is assigned the function with the corresponding name "on<variable_name>" will be called. | ||
− | ;onrun: be called on starting and stopping of playing or recording processes; | + | ;onrun: will be called on starting and stopping of playing or recording processes; |
;onerror: on error message; | ;onerror: on error message; | ||
;onframe: on each frame playing. | ;onframe: on each frame playing. | ||
− | ;onmousedown and other standard callbacks: are given already by browser and do not need | + | ;onmousedown and other standard callbacks: are given already by the browser and do not need extra code inside the plugin. |
== Back-end programs == | == Back-end programs == | ||
Line 44: | Line 78: | ||
*mplayer (compiled with live555) | *mplayer (compiled with live555) | ||
*mencoder from mplayer package | *mencoder from mplayer package | ||
− | *ElphelOgm - for receiving pure multicast or unicast rtp. | + | *ElphelOgm - for receiving pure multicast or unicast rtp with mjpeg video. |
+ | *display from the packet ImageMagick - to demonstrate static images. | ||
− | For ElphelOgm to be used, the mime-type must begin with <strong>video/m</strong> and the URL must be specifed as: | + | For ElphelOgm to be used, the mime-type must be <strong>application/x-elphel-ogm</strong> or begin with <strong>video/m</strong> and the URL must be specifed as: |
<strong>rtp://ip:port/</strong> , | <strong>rtp://ip:port/</strong> , | ||
where: | where: | ||
;ip -: the stream multicast ip | ;ip -: the stream multicast ip | ||
;port -: the stream multicast port | ;port -: the stream multicast port | ||
− | For unicast destination i.e. client ip:port must be specifed | + | For a unicast the destination i.e. client ip:port must be specifed |
− | and a stream server must be programmed to | + | and a stream server must be programmed to continuously send the stream to this address and port. |
+ | Dynamic changing of the URL is not yet supported for RTP. Instead use the sequence: <code>obj.run=0; obj.src=...; obj.run=1;</code> | ||
+ | |||
+ | == Trouble shooting == | ||
+ | Run the script <strong>mplayer.pl</strong> from a command line. It is located in /usr/lib/genres. | ||
+ | If all necessary perl modules are installed, it must print several strings in the form: "variable=value" and wait input. | ||
+ | If you see message "Can't locate Gtk2.pm in @INC" this mean that need to install this module from your distro or from [http://cpan.org CPAN]. | ||
+ | Other links: [http://gtk2-perl.sourceforge.net/ gtk2-perl home page], [http://cpan.org/modules/by-category/08_User_Interfaces/Gtk2/ gtk2-perl on CPAN], [http://freshmeat.net/projects/gtk2-perl/ gtk2-perl on freshmeat]. | ||
+ | |||
+ | Enter parameters as they presented in the html tag, but by one in line and add run=1 at the end. For example: | ||
+ | type=video/mjpeg | ||
+ | url=rtp://232.168.0.9:20000/ | ||
+ | run=1 | ||
+ | If MPlayer is running then this part works, try to see example html page in the browser (mozilla or firefox). | ||
+ | If you don't see video in the browser, but instead see a gray rectangle, maybe the page has wrong url. | ||
+ | |||
+ | See the list of installed plugins with url: <strong>about:plugins</strong> and if there is no GenReS, maybe genres.so is in a wrong place. | ||
+ | |||
+ | The plugin produce debug output. Start mozilla or firefox with redirection to a file: | ||
+ | mozilla -debug >& moz.log | ||
+ | For firefox <strong>-debug</strong> is not need. | ||
+ | Gzip and send this file to me to research. | ||
+ | |||
+ | --[[User:Khlut|Sergey Khlutchin]] 01:55, 8 February 2006 (CST) |
Latest revision as of 22:46, 17 April 2007
in English | [[{{{de}}}|deutsch]] | [[{{{fr}}}|français]] | по-русски | автоперевод | 中文版 | 机械翻译
GenReS is a generic reconfigurable scriptable plugin for Mozilla based browsers. It allows to use external programs for EMBED and OBJECT HTML tags or to start them in browser full window.
Contents
Project Pages
Configuration
The plugin uses "~/.mozilla/genres/genres.conf" or "/etc/genres.conf" as main config file. Options for mplayer, mencoder and ElphelOgm are stored in the config file "~/.mozilla/genres/mplayer.conf", which is used by mplayer.pl control script. The files can contain shell-like comments.
options in genres.conf
- mozillastreams={1|0}
- - use or not mozilla streams (and cache) for http, https and ftp;
- debuglevel={1|0}
- - enable or disable the debug output;
- background={-1|0|1}
- - object color while loadining: 0 - black, 1 - white, -1 - mozilla default (gray).
options in mplayer.conf
- out_file_once=template
- - filename template filename;
- out_file=template
- - filename template filename for tags with parameter save=auto;
- out_file_jpegs=template
- - filename template for tags with thesaveformat=jpeg;
- out_file_jpegs_auto=template
- - same for save=auto and saveformat=jpeg;
- vo={x11,xv}
- - video output driver (see man mplayer about -vo option);
- ao={arts,esd,alsa,oss}
- - audio output driver (see man mplayer about -ao option);
- not_ask={1|0}
- - not show file save dialog for tags with save=auto parameter;
- not_ask_jpegs={1|0}
- - same for saveformat=jpeg;
- frames=number
- - frames per file limit for recording (output will be splitted).
Usage in Javascript
Static tag parameters
- lowres
- decimation for accelerated DCT (0-3);
- width
- width of the object window;
- loop
- number of iterations of the playback (0 or nothing is infinite);
- fps
- frame frequency;
- frameskip
- skip n frames after one saved (only for rtp/mjpeg and ElphelOgm);
- framedelay
- a number of fully received frames delayed in the buffer (only for rtp/mjpeg and ElphelOgm);
- rotate
- the rotation angle of the image clockwise in degrees (0|90|180|240)
- mirror
- mirror-symmetry mapping relative to vertical axis (true|false)
- flip
- the same relative to horizontal (true|false); simultaneous setting of flip and mirror is equivalent to rotate=180
- saveformat=jpeg|ogm|avi
- format for video recording (jpeg, ogm is only for rtp/mjpeg and ElphelOgm)
Dynamic variables (can also be used as the parameters of tags)
- href
- url of the file or stream;
- src
- as yet simply another name for href.
- pause=1 or play=0
- to pause player;
- pause=0 or play=1
- to continue playback;
- filepos=sec
- go to time or percent specifed, maybe not works if mplayer is not support seeking for the current file;
- framestep=anything
- show next frame and pause (for step-by-step view);
- run=1
- to start player again if it was terminated (by error or end of file);
- run=0
- to terminate player;
- save
- to run mencoder or ElphelOgm as recorder instead of mplayer;
- save=ask
- to always ask the file name for recording;
- save=auto
- not to ask if user sets it in dialog
Status variables
This the output from mplayer or mencoder. Now strings simply are split into two parts on the first of the symbols '=' or ':'. The left part becomes a name of the variable (gaps and nonlatin letters are removed) and the right part is a value.
- frame
- the message from mplayer/mencoder about the last frame;
- error
- last error message;
- FATAL
- fatal error message from mplayer;
Other variables are possible but they are not used as yet.
- run
- special variable, the state of player process: 0 - not running, 1 - running;
- pause, play
- it is analogous - the pause state.
Callback functions
On the arrival of data from a player it is transferred to the object variables and it becomes accessible from javascript. In this case if it is assigned the function with the corresponding name "on<variable_name>" will be called.
- onrun
- will be called on starting and stopping of playing or recording processes;
- onerror
- on error message;
- onframe
- on each frame playing.
- onmousedown and other standard callbacks
- are given already by the browser and do not need extra code inside the plugin.
Back-end programs
Currently used:
- mplayer (compiled with live555)
- mencoder from mplayer package
- ElphelOgm - for receiving pure multicast or unicast rtp with mjpeg video.
- display from the packet ImageMagick - to demonstrate static images.
For ElphelOgm to be used, the mime-type must be application/x-elphel-ogm or begin with video/m and the URL must be specifed as: rtp://ip:port/ , where:
- ip -
- the stream multicast ip
- port -
- the stream multicast port
For a unicast the destination i.e. client ip:port must be specifed
and a stream server must be programmed to continuously send the stream to this address and port.
Dynamic changing of the URL is not yet supported for RTP. Instead use the sequence: obj.run=0; obj.src=...; obj.run=1;
Trouble shooting
Run the script mplayer.pl from a command line. It is located in /usr/lib/genres. If all necessary perl modules are installed, it must print several strings in the form: "variable=value" and wait input. If you see message "Can't locate Gtk2.pm in @INC" this mean that need to install this module from your distro or from CPAN. Other links: gtk2-perl home page, gtk2-perl on CPAN, gtk2-perl on freshmeat.
Enter parameters as they presented in the html tag, but by one in line and add run=1 at the end. For example:
type=video/mjpeg url=rtp://232.168.0.9:20000/ run=1
If MPlayer is running then this part works, try to see example html page in the browser (mozilla or firefox). If you don't see video in the browser, but instead see a gray rectangle, maybe the page has wrong url.
See the list of installed plugins with url: about:plugins and if there is no GenReS, maybe genres.so is in a wrong place.
The plugin produce debug output. Start mozilla or firefox with redirection to a file:
mozilla -debug >& moz.log
For firefox -debug is not need. Gzip and send this file to me to research.
--Sergey Khlutchin 01:55, 8 February 2006 (CST)