45 class H263Codec :
public Codec {
65 xvid_gbl_init_t xvid_gbl_init;
66 std::memset(&xvid_gbl_init, 0,
sizeof(xvid_gbl_init_t));
67 xvid_gbl_init.version = XVID_VERSION;
68 xvid_gbl_init.debug = 0;
69 xvid_global(0, XVID_GBL_INIT, &xvid_gbl_init, 0);
71 xvid_dec_create_t xvid_dec_create;
72 std::memset(&xvid_dec_create, 0,
sizeof(xvid_dec_create_t));
73 xvid_dec_create.version = XVID_VERSION;
74 xvid_dec_create.width = width;
75 xvid_dec_create.height = height;
77 int result = xvid_decore(0, XVID_DEC_CREATE, &xvid_dec_create, 0);
79 throw Common::Exception(
"H263Codec::H263Codec(): Failed to create the decore context: %d", result);
86 decodeInternal(extraData);
89 H263Codec::~H263Codec() {
90 xvid_decore(
_decHandle, XVID_DEC_DESTROY, 0, 0);
100 size_t dataSize = dataStream.
size();
102 dataStream.
read(data.get(), dataSize);
104 xvid_dec_frame_t xvid_dec_frame;
105 std::memset(&xvid_dec_frame, 0,
sizeof(xvid_dec_frame_t));
106 xvid_dec_frame.version = XVID_VERSION;
107 xvid_dec_frame.general = XVID_DEBLOCKY | XVID_DEBLOCKUV | XVID_DERINGY | XVID_DERINGUV;
108 xvid_dec_frame.bitstream = data.get();
109 xvid_dec_frame.length = dataSize;
110 xvid_dec_frame.output.csp = XVID_CSP_INTERNAL;
112 xvid_dec_stats_t xvid_dec_stats;
113 std::memset(&xvid_dec_stats, 0,
sizeof(xvid_dec_stats_t));
114 xvid_dec_stats.version = XVID_VERSION;
116 int result = xvid_decore(
_decHandle, XVID_DEC_DECODE, &xvid_dec_frame, &xvid_dec_stats);
118 throw Common::Exception(
"H263Codec::decodeFrame(): Failed to decode frame: %d", result);
121 xvid_dec_frame.output.plane[0] &&
122 xvid_dec_frame.output.plane[1] &&
123 xvid_dec_frame.output.plane[2])
126 static_cast<const byte *
>(xvid_dec_frame.output.plane[0]),
127 static_cast<const byte *>(xvid_dec_frame.output.plane[1]),
129 xvid_dec_frame.output.stride[0], xvid_dec_frame.output.stride[1]);
133 decodeInternal(dataStream, &surface);
139 return new H263Codec(width, height, extraData);
virtual size_t seek(ptrdiff_t offset, Origin whence=kOriginBegin)=0
Sets the stream position indicator for the stream.
A simple scoped smart pointer template.
Utility templates and functions.
virtual size_t read(void *dataPtr, size_t dataSize)=0
Read data from the stream.
Low-level type definitions to handle fixed width types portably.
Efficient YUV to RGB conversion.
virtual size_t size() const =0
Obtains the total size of the stream, measured in bytes.
Basic reading stream interfaces.
An image surface, in BGRA format.
Codec * makeH263Codec(int width, int height, Common::SeekableReadStream &extraData)
Create a Codec capable of decoding h.263 frames.
Interface for a seekable & readable data stream.