summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Melanson <mike@multimedia.cx>2002-10-22 05:33:52 +0000
committerMike Melanson <mike@multimedia.cx>2002-10-22 05:33:52 +0000
commit596552a20f9980015761057f95038ac7f06848d4 (patch)
tree275934055df46d856fb8d7cdc57f31689f768246 /src
parent42a6a49ba4171ace472bfe89340167e370bb3a85 (diff)
downloadxine-lib-596552a20f9980015761057f95038ac7f06848d4.tar.gz
xine-lib-596552a20f9980015761057f95038ac7f06848d4.tar.bz2
bring the RPZA decoder in line with the latest API revision
CVS patchset: 2924 CVS date: 2002/10/22 05:33:52
Diffstat (limited to 'src')
-rw-r--r--src/libxinevdec/qtrpza.c101
1 files changed, 53 insertions, 48 deletions
diff --git a/src/libxinevdec/qtrpza.c b/src/libxinevdec/qtrpza.c
index 293b381d4..3d49445b1 100644
--- a/src/libxinevdec/qtrpza.c
+++ b/src/libxinevdec/qtrpza.c
@@ -21,7 +21,7 @@
* For more information about the RPZA format, visit:
* http://www.pcisys.net/~melanson/codecs/
*
- * $Id: qtrpza.c,v 1.5 2002/10/06 03:48:13 komadori Exp $
+ * $Id: qtrpza.c,v 1.6 2002/10/22 05:33:52 tmmm Exp $
*/
#include <stdio.h>
@@ -38,11 +38,17 @@
#define VIDEOBUFSIZE 128*1024
+typedef struct {
+ video_decoder_class_t decoder_class;
+} qtrpza_class_t;
+
typedef struct qtrpza_decoder_s {
video_decoder_t video_decoder; /* parent video decoder structure */
+ qtrpza_class_t *class;
+ xine_stream_t *stream;
+
/* these are traditional variables in a video decoder object */
- vo_instance_t *video_out; /* object that will receive frames */
uint64_t video_step; /* frame duration in pts units */
int decoder_ok; /* current decoder status */
int skipframes;
@@ -275,22 +281,6 @@ void decode_qtrpza(qtrpza_decoder_t *this) {
*************************************************************************/
/*
- * This function is responsible is called to initialize the video decoder
- * for use. Initialization usually involves setting up the fields in your
- * private video decoder object.
- */
-static void qtrpza_init (video_decoder_t *this_gen,
- vo_instance_t *video_out) {
- qtrpza_decoder_t *this = (qtrpza_decoder_t *) this_gen;
-
- /* set our own video_out object to the one that xine gives us */
- this->video_out = video_out;
-
- /* indicate that the decoder is not quite ready yet */
- this->decoder_ok = 0;
-}
-
-/*
* This function receives a buffer of data from the demuxer layer and
* figures out how to handle it based on its header flags.
*/
@@ -307,7 +297,7 @@ static void qtrpza_decode_data (video_decoder_t *this_gen,
return;
if (buf->decoder_flags & BUF_FLAG_HEADER) { /* need to initialize */
- this->video_out->open (this->video_out);
+ this->stream->video_out->open (this->stream->video_out);
if(this->buf)
free(this->buf);
@@ -323,7 +313,7 @@ static void qtrpza_decode_data (video_decoder_t *this_gen,
this->buf = malloc(this->bufsize);
this->size = 0;
- this->video_out->open (this->video_out);
+ this->stream->video_out->open (this->stream->video_out);
this->decoder_ok = 1;
init_yuv_planes(&this->yuv_planes, this->width, this->height);
@@ -345,7 +335,7 @@ static void qtrpza_decode_data (video_decoder_t *this_gen,
if (buf->decoder_flags & BUF_FLAG_FRAME_END) {
- img = this->video_out->get_frame (this->video_out,
+ img = this->stream->video_out->get_frame (this->stream->video_out,
this->width, this->height,
42, XINE_IMGFMT_YUY2, VO_BOTH_FIELDS);
@@ -393,11 +383,10 @@ static void qtrpza_reset (video_decoder_t *this_gen) {
}
/*
- * This function is called when xine shuts down the decoder. It should
- * free any memory and release any other resources allocated during the
- * execution of the decoder.
+ * This function frees the video decoder instance allocated to the decoder.
*/
-static void qtrpza_close (video_decoder_t *this_gen) {
+static void qtrpza_dispose (video_decoder_t *this_gen) {
+
qtrpza_decoder_t *this = (qtrpza_decoder_t *) this_gen;
if (this->buf) {
@@ -407,41 +396,57 @@ static void qtrpza_close (video_decoder_t *this_gen) {
if (this->decoder_ok) {
this->decoder_ok = 0;
- this->video_out->close(this->video_out);
+ this->stream->video_out->close(this->stream->video_out);
}
-}
-/*
- * This function returns the human-readable ID string to identify
- * this decoder.
- */
-static char *qtrpza_get_id(void) {
- return "QT RPZA";
-}
-
-/*
- * This function frees the video decoder instance allocated to the decoder.
- */
-static void qtrpza_dispose (video_decoder_t *this_gen) {
free (this_gen);
}
-static void *init_video_decoder_plugin (xine_t *xine, void *data) {
+static video_decoder_t *open_plugin (video_decoder_class_t *class_gen, xine_stream_t *stream) {
- qtrpza_decoder_t *this ;
+ qtrpza_decoder_t *this ;
- this = (qtrpza_decoder_t *) malloc (sizeof (qtrpza_decoder_t));
- memset(this, 0, sizeof (qtrpza_decoder_t));
+ this = (qtrpza_decoder_t *) xine_xmalloc (sizeof (qtrpza_decoder_t));
- this->video_decoder.init = qtrpza_init;
this->video_decoder.decode_data = qtrpza_decode_data;
this->video_decoder.flush = qtrpza_flush;
this->video_decoder.reset = qtrpza_reset;
- this->video_decoder.close = qtrpza_close;
- this->video_decoder.get_identifier = qtrpza_get_id;
this->video_decoder.dispose = qtrpza_dispose;
+ this->size = 0;
+
+ this->stream = stream;
+ this->class = (qtrpza_class_t *) class_gen;
+
+ this->decoder_ok = 0;
+ this->buf = NULL;
+
+ return &this->video_decoder;
+}
+
+static char *get_identifier (video_decoder_class_t *this) {
+ return "QT RPZA";
+}
+
+static char *get_description (video_decoder_class_t *this) {
+ return "Quicktime Video (RPZA) decoder plugin";
+}
+
+static void dispose_class (video_decoder_class_t *this) {
+ free (this);
+}
+
+static void *init_plugin (xine_t *xine, void *data) {
+
+ qtrpza_class_t *this;
+
+ this = (qtrpza_class_t *) xine_xmalloc (sizeof (qtrpza_class_t));
+
+ this->decoder_class.open_plugin = open_plugin;
+ this->decoder_class.get_identifier = get_identifier;
+ this->decoder_class.get_description = get_description;
+ this->decoder_class.dispose = dispose_class;
- return (video_decoder_t *) this;
+ return this;
}
/* plugin catalog information */
@@ -454,6 +459,6 @@ static decoder_info_t video_decoder_info = {
plugin_info_t xine_plugin_info[] = {
/* type, API, "name", version, special_info, init_function */
- { PLUGIN_VIDEO_DECODER, 10, "QT RPZA", XINE_VERSION_CODE, &video_decoder_info, &init_video_decoder_plugin },
+ { PLUGIN_VIDEO_DECODER, 11, "rpza", XINE_VERSION_CODE, &video_decoder_info, &init_plugin },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};