MediaViewer(3)
MediaViewer - a ViewKit class for viewing media files and data
As shipped in IRIX 6.5. First release of IRIX 6.5.
NAME MediaViewer - a ViewKit class for viewing media files and data INHERITS FROM VkComponent HEADER FILE #include <MediaViewer/MediaViewer.h> LIBRARY /usr/lib/libMediaViewer.so PUBLIC PROTOCOL SUMMARY Constructor and Destructor MediaViewer(const char *name, Widget parent); virtual ~MediaViewer(); static VkComponent *CreateMediaViewer(const char *name, Widget parent); View Functions virtual void viewFile(const char *filename); virtual void viewData(const char *name, Atom type, void *data, unsigned long length); virtual void viewData(const char *name, const char *type, void *data, unsigned long length); Access Functions virtual const char *getFtrTypeName(); virtual const char *getFtrDescription(); virtual const char *getTargetName(); CLASS DESCRIPTION The MediaViewer class is a simple ViewKit (see ViewKit(3)) application programming interface to the MediaWarehouse media viewer framework. MediaViewer allows ViewKit-based applications to view media data within the applications' user interface. By default, MediaViewer supports viewers for a variety of media types, including image, audio, movie, 3D models, text, and HTML. The viewers are dynamically loaded DSOs (see DSO(5)) so end users may add new viewers or change the configuration of the existing viewers. For more information on these customizations, see the ``Adding New Data Types and Viewers'' section later in this man page. FUNCTION DESCRIPTION MediaViewer(const char *name, Widget parent); The constructor initializes the MediaViewer framework. name is used by the VkComponent base class. The widget parent identifies the MediaViewer's position in the application's widget hierarchy. The application may, if necessary, set constraints on the MediaViewer's ViewKit base widget. static VkComponent *CreateMediaViewer(const char *name, Widget parent); CreateMediaViewer() is a convenience function that constructs a MediaViewer object and returns a pointer to the VkComponent base class. Applications may free this object via the virtual destructor. virtual void viewFile(const char *filename); The viewFile() method displays the contents of the specified file in the viewer. viewFile() uses the Indigo Magic file typing rules (see ftr(1)) to determine which viewer to use. virtual void viewData(const char *name, Atom type, void *data, unsigned long length); virtual void viewData(const char *name, const char *type, void *data, unsigned long length); The viewData() methods allow applications to specify data in-line (i.e., not in a file). The name is passed to the viewer, which will usually use it as a title. The type, which may be specified as either an atom or as a string, is the X Inter-Client Communication Conventions Manual (ICCCM) target type for this piece of data. The data itself is specified by a pointer and a length in bytes. Note that many of the default viewers do not support in-line data. virtual const char *getFtrTypeName(); After a file is viewed with viewFile(), getFtrTypeName() returns the FTR name for the file. virtual const char *getFtrDescription(); After a file is viewed with viewFile(), getFtrTypeName() returns the FTR description for the file. virtual const char *getTargetName(); After a file is viewed with viewFile(), getFtrTypeName() returns the ICCCM target name for the file's data. INHERITED MEMBER FUNCTIONS Inherited from VkComponent show(), hide(), name(), className(), baseWidget(), installDestroyHandler(), removeDestroyHandler(), widgetDestroyed(), setDefaultResources(), getResources(), okToQuit(), _name, _baseWidget, _w, deleteCallback LINKING WITH MEDIAVIEWER MediaViewer requires the MediaViewer library as well as the ViewKit, Motif, and X libraries. A typical compile command is: CC -o sample sample.c++ -lMediaViewer -lvk -lvkhelp -lSgm -lXm -lXt -lX11 ADDING NEW DATA TYPES AND VIEWERS By default, MediaViewer provides viewers for popular image, audio, movie, 3D, and text data formats. You may add additional viewers, if you wish. The viewers are configured via the /usr/lib/mediaw/mediawrc file. The file maps FTR names and ICCCM target types with viewer DSOs. If you wish to add a viewer for a new data type, specify the viewer in this format: target_type.viewer: viewer_DSO_name FTR_name.targetType: target_type The first line maps the target type to the DSO. The second line maps FTR names to target names for data that is read from files. FTR_name is the FTR (see FTR(1))name. target_type is the target type. viewer_DSO_name is the name of the DSO (see DSO(5)) containing the viewer procedures. The DSO should provide these functions: extern "C" { void *create(Widget); void view(void* handle, Atom type, void* data, unsigned long length); void hide(void* handle); void destroy(void* handle); }; The create function should create the viewer using the specified widget as its parent and return a handle to the viewer. The handle is passed as the first argument to the other three functions. The view function should map and view the data. It is called with an X atom representing the ICCCM target type, a pointer to the data, and the length of the data. The data may be a file name, for file-based target types. The hide and destroy functions are optional. If provided, they will be called when the viewer is unmapped and destroyed, respectively. FILES /usr/lib/mediaw/mediawrc - MediaWarehouse viewer framework configuration file SEE ALSO ftr(1), ViewKit(3), VkComponent(3), DSO(5), Inter-Client Communication Conventions Manual