Main Page Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages

# Ogre::Codec Class Reference

Abstract class that defines a 'codec'. More...

`#include <OgreCodec.h>`

Inheritance diagram for Ogre::Codec:

[legend]
List of all members.

## Public Methods

virtual | ~Codec ()
virtual void | code (const DataChunk &input, DataChunk *output,...) const=0
| Codes the data in the input chunk and saves the result in the output chunk.
virtual void | codeToFile (const DataChunk &input, const String &outFileName, CodecData *pData) const=0
| Codes the data in the input chunk and saves the result in the output filename provided.
virtual CodecData * | decode (const DataChunk &input, DataChunk *output,...) const=0
| Codes the data from the input chunk into the output chunk.
virtual String | getType () const=0
| Returns the type of the codec as a String.

## Static Public Methods

void | registerCodec (Codec *pCodec)
| Registers a new codec in the database.
void | unRegisterCodec (Codec *pCodec)
| Unregisters a codec from the database.
Codec * | getCodec (const String &extension)
| Gets the codec registered for the passed in file extension.

## Protected Types

typedef std::map< String, Codec * > | CodecList

## Static Protected Attributes

CodecList | ms_mapCodecs
| A map that contains all the registered codecs.

## Detailed Description

Abstract class that defines a 'codec'.

Remarks:
  A codec class works like a two-way filter for data - data entered on one end (the decode end) gets processed and transformed into easily usable data while data passed the other way around codes it back.

  The codec concept is a pretty generic one - you can easily understand how it can be used for images, sounds, archives, even compressed data.

Definition at line 41 of file OgreCodec.h.

## Member Typedef Documentation

typedef std::map< String, Codec* > Ogre::Codec::CodecList`[protected]`

| Definition at line 44 of file OgreCodec.h.

## Constructor & Destructor Documentation

Ogre::Codec::~Codec | ( |  | ) | `[virtual]`

| Definition at line 34 of file OgreCodec.cpp.

## Member Function Documentation

virtual void Ogre::Codec::code | ( | const DataChunk & | input,
|  | DataChunk * | output,
|  | ... |
| ) | const`[pure virtual]`

Codes the data in the input chunk and saves the result in the output chunk.

Note:
  Has a variable number of arguments, which depend on the codec type.

Implemented in Ogre::ILImageCodec, and Ogre::ImageCodec.

virtual void Ogre::Codec::codeToFile | ( | const DataChunk & | input,
|  | const String & | outFileName,
|  | CodecData * | pData
| ) | const`[pure virtual]`

Codes the data in the input chunk and saves the result in the output filename provided.

Provided for efficiency since coding to memory is progressive therefore memory required is unknown leading to reallocations.

Parameters:

  input | The input data
  outFileName | The filename to write to
  pData | Extra information to be passed to the codec (codec type specific)

Implemented in Ogre::ILImageCodec, and Ogre::ImageCodec.

Referenced by Ogre::Image::save(), Ogre::Win32Window::writeContentsToFile(), Ogre::SDLWindow::writeContentsToFile(), Ogre::GLXWindow::writeContentsToFile(), Ogre::D3D9RenderWindow::writeContentsToFile(), and Ogre::D3D7RenderWindow::writeContentsToFile().

virtual CodecData* Ogre::Codec::decode | ( | const DataChunk & | input,
|  | DataChunk * | output,
|  | ... |
| ) | const`[pure virtual]`

Codes the data from the input chunk into the output chunk.

Remarks:
  The returned CodecData pointer is a pointer to a class that holds information about the decoded buffer. For an image, this would be the size, the bitdepht, etc.

Note:
  Has a variable number of arguments, which depend on the codec type.

Implemented in Ogre::ILImageCodec, and Ogre::ImageCodec.

Referenced by Ogre::Image::load().

Codec * Ogre::Codec::getCodec | ( | const String & | extension | ) | `[static]`

| Gets the codec registered for the passed in file extension. Definition at line 37 of file OgreCodec.cpp. References Except, ms_mapCodecs, and Ogre::String.

virtual String Ogre::Codec::getType | ( |  | ) | const`[pure virtual]`

| Returns the type of the codec as a String. Implemented in Ogre::BMPCodec, Ogre::TGACodec, Ogre::JPEGCodec, Ogre::JPGCodec, Ogre::DDSCodec, Ogre::PNGCodec, Ogre::ILImageCodec, and Ogre::ImageCodec. Referenced by registerCodec(), and unRegisterCodec().

void Ogre::Codec::registerCodec | ( | Codec * | pCodec | ) | `[static]`

| Registers a new codec in the database. Definition at line 65 of file OgreCodec.h. References getType().

void Ogre::Codec::unRegisterCodec | ( | Codec * | pCodec | ) | `[static]`

| Unregisters a codec from the database. Definition at line 72 of file OgreCodec.h. References getType().

## Member Data Documentation

std::map< String, Codec * > Ogre::Codec::ms_mapCodecs`[static, protected]`

| A map that contains all the registered codecs. Definition at line 32 of file OgreCodec.cpp. Referenced by getCodec().

The documentation for this class was generated from the following files:

- OgreCodec.h
- OgreCodec.cpp

Copyright © 2002-2003 by The OGRE Team
Last modified Sun Nov 28 19:50:50 2004