Public Members KXAnim (QWidget *parent, const char *name=0) ~KXAnim () void setFile (QString file) void setAutoResize (bool val) bool getAutoResize () void updateSize () void setLoop (bool val) bool getLoop () QString getVideoFileName () int getVideoHeight () int getVideoWidth () float getVideoSpeed () int getVideoFrames () QString getVideoCodec () QString getErrorCode () QString getErrorString () bool isPlaying () bool isActive () void resetXAnimDefaults () void setAudio (bool val) void setAudioSync (bool val) void setInitialVolume (int val) enum colorMap { static332, lookupTable, grayScale, none } void setColorMapping (colorMap val) void setColorAhead (int val) void setGammaDisplay (float val) void setResizing (bool val) void setScaleFactor (float val) void setScaleHFactor (float val) void setScaleVFactor (float val) void setScaleWidth (int val) void setScaleHeight (int val) void setScaleDisplayToBuffer (bool val) void setScaleFactorB (float val) void setScaleHFactorB (float val) void setScaleVFactorB (float val) void setScaleWidthB (int val) void setScaleHeightB (int val) void setScaleBufferToDisplay (bool val) void setLoading (int val) void setX11Shared (bool val) void setMultiBuffer (bool val) void setUsePixmap (bool val) void setX11VisualClass ( const char *val) void setPauseAt (int val) void setExtraParameters (const char *val) void setExecutable (const char *val) Public Slots void play () void pause () void stop () void stepForward () void stepBack () void stepForwardWA () void stepBackWA () void toggleSound () void volumeIncrement () void volumeDecrement () void setVolume (int v) void faster () void slower () void resetSpeed () Protected Members void changeProperty ( const char * c) virtual void closeEvent ( QCloseEvent *) virtual void mousePressEvent ( QMouseEvent *) Signals void stopped () void mouseClick ( QMouseEvent *) |
#include <kxanim.h>
Inherits: QWidget
Widget class for video playing
This widget is an xanim wrapper to easily allow the video playing on your applications.
Constructor. The parent argument is NOT optional.
Use this method to tell the player the name of the file to play. The file will not start to play until you call the play() slot. You need to call stop() before you can set a new filename.
After call this method, you should wait for an stopped signal. Just then, the information about the file will be available.
Also check for KXAnim::getErrorNumber and getErrorString to know if there was some error.
If val==true, the widget will resize by himself after the setFile() to fit to the size of the video. If val==false, the video size will be adjusted to fit to the widget size.
The size of the widget is automatically updated by setFile and play But if you need to know the effective size of the widget *before* you call play, you need to call updateSize manually.
Default is true
Returns the auto-resize state (see setAutoResize ).
Updates the widget size to fit video size (taking care of the scale factors that applies). See setAutoResize .
If val==true, the video will loop forever.
Default is true
Returns the loop state ( see setLoop ).
Returns the current video file name (or an empty string, if there's no video yet).
Returns the video height (in pixels).
Returns the video height (in pixels).
Returns the video playback speed (in frames per second).
Returns the number of frames in the video.
Returns the string that describes the video codec.
Returns the the error code number. You should check this number after a setFile. If the code is zero , the there were no errors. To get a string containing a description see getErrorCode.
Returns the string that describes the error during setFile.
Returns true is the video is in play mode. Otherwise it returns false.
Returns true is the video is active. Otherwise it returns false. The widget is NOT Active only when it's stopped. Therefore, you can use this method to check if the video is REALLY stopped.
This method reset all the configuration parameters to their default values.
If val==true, enables sound output.
Default is true
If val==true, allows xanim skip video frames for audio sync.
Default is true
Sets the initial audio volume.
Default is 40
See setColorMapping .
Tells KXAnim which type of color mapping to use for non truecolor displays.
If val==KXAnim::static322, xanim will convert truecolor anims to static322.
If val==KXAnim::lookupTable, xanim will sample the color of truecolor animations ahead of time and forms a color lookup table.
If val==KXAnim::grayScale, xanim will convert TrueColor animations to gray scale.
Those three option are ignored for TrueColor and DirectColor displays.
if val==KXAnim::none, xanim will use the default color mapping.
Default is KXAnim::none
This sets the number of frames ahead to use for the look up table when using KXAnim::lookupTable in setColorMapping.
Default is 5
Set gamma of display. Gamma's greater than 1.0 typically brighten the animation.
Default is 1.0
If val==true, the video size can be changed "on the fly".
Default is true
Scale the size of anim by "val" before displaying.
Default is 1.0 (no scaling)
Scale the horizontal size of anim by "val" before displaying.
Default is 1.0 (no scaling)
Scale the vertical size of anim by "val" before displaying.
Default is 1.0 (no scaling)
Scale the animation to have width "val" before displaying.
Default is 0 (no scaling)
Scale the animation to have height "val" before displaying.
Default is 0 (no scaling)
Copy display scaling factors to buffering scaling factors.
Default is false.
Scale the size of anim by "val" before buffering it.
Default is 1.0 (no scaling)
Scale the horizontal size of anim by "val" before buffering it.
Default is 1.0 (no scaling)
Scale the vertical size of anim by "val" before buffering it.
Default is 1.0 (no scaling)
Scale the animation to have width "val" before buffering it.
Default is 0 (no scaling)
Scale the animation to have height "val" before buffering it.
Default is 0 (no scaling)
Copy buffering scaling factors to display scaling factors.
Default is false.
0: KXAnim will load the entire video into memory.
1: KXAnim will load and decompress the animation entirely into memory before displaying.
2: KXAnim will read each sector only when needed
Default is 2.
If val==true, KXAnim will use X11 shared memory (this is mutually exclusive with setPreload .
Default is false.
If val==true, KXAnim will use X11 Buffering (if present) to smooth animations by double-buffering.
Default is true.
If val==true, KXAnim will use Pixmap instead of Image in X11shared. This option has no effect if the animation is buffered.
Default is false.
Select the best "X11 Visual of Class..." when displaying the animation. val can be anyone of the following strings and is case insensitive:
default |
staticgray |
grayscale |
staticcolor |
pseudocolor |
truecolor |
directcolor |
Default is "default".
This will pause XAnim at frame "val". val=-1 disables this option.
Default is -1 (no pause).
Use this method to pass any extra parameters you want to xanim (separated by spaces).
Use this method to set the executable name for xanim. Default is "xanim", but you can change it, for instance, if you don't have xanim in the path.
Start playing the video.
Pauses the video playing (xanim is still runnig).
Stops the video and exit xanim (don't worry about it, it's transparent for the class user).
![]() | Calling this slot doesn't mean that the video will stop immediately. Use the stopped signal to know exactly when the player is set to the inactive mode (see isActive ). |
Single step forward one frame. Pauses the video playing.
Single step back one frame. Pauses the video playing.
Single step forward one frame staying with anim. Pauses the video playing.
Single step back one frame staying with anim. Pauses the video playing.
Toggle sound between ON/OFF.
Increment volume by 1.
Decrement volume by 1.
Setup volume where v is a number from 0 to 100.
Increase animation playback speed.
Decrease animation playback speed.
Reset animation playback speed to original values.
Don't use it! This is internally used for the communication with xanim.
This signal is emitted after a call to the stop() slot, and means that the player has really stopped playing (that xanim is inactive) (see stop).
This signal is emitted when the user clicks into the widget.