summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Melanson <mike@multimedia.cx>2002-10-22 05:27:54 +0000
committerMike Melanson <mike@multimedia.cx>2002-10-22 05:27:54 +0000
commit42a6a49ba4171ace472bfe89340167e370bb3a85 (patch)
tree37a92323e837b105cfca18bed63e77ccbe853dd9
parent480e1c2c82a6283f7c972ac9e87052b451f8f454 (diff)
downloadxine-lib-42a6a49ba4171ace472bfe89340167e370bb3a85.tar.gz
xine-lib-42a6a49ba4171ace472bfe89340167e370bb3a85.tar.bz2
bring the SMC decoder in line with the latest API revision
CVS patchset: 2923 CVS date: 2002/10/22 05:27:54
-rw-r--r--src/libxinevdec/qtsmc.c101
1 files changed, 53 insertions, 48 deletions
diff --git a/src/libxinevdec/qtsmc.c b/src/libxinevdec/qtsmc.c
index 0218f8013..048cac687 100644
--- a/src/libxinevdec/qtsmc.c
+++ b/src/libxinevdec/qtsmc.c
@@ -23,7 +23,7 @@
* For more information on the SMC format, visit:
* http://www.pcisys.net/~melanson/codecs/
*
- * $Id: qtsmc.c,v 1.5 2002/10/06 03:48:13 komadori Exp $
+ * $Id: qtsmc.c,v 1.6 2002/10/22 05:27:54 tmmm Exp $
*/
#include <stdio.h>
@@ -47,11 +47,17 @@
#define CQUAD 4
#define COCTET 8
+typedef struct {
+ video_decoder_class_t decoder_class;
+} qtsmc_class_t;
+
typedef struct qtsmc_decoder_s {
video_decoder_t video_decoder; /* parent video decoder structure */
+ qtsmc_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;
@@ -492,22 +498,6 @@ void decode_qtsmc(qtsmc_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 qtsmc_init (video_decoder_t *this_gen,
- vo_instance_t *video_out) {
- qtsmc_decoder_t *this = (qtsmc_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.
*/
@@ -539,7 +529,7 @@ static void qtsmc_decode_data (video_decoder_t *this_gen,
}
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);
@@ -555,7 +545,7 @@ static void qtsmc_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);
@@ -577,7 +567,7 @@ static void qtsmc_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);
@@ -625,11 +615,10 @@ static void qtsmc_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 qtsmc_close (video_decoder_t *this_gen) {
+static void qtsmc_dispose (video_decoder_t *this_gen) {
+
qtsmc_decoder_t *this = (qtsmc_decoder_t *) this_gen;
if (this->buf) {
@@ -639,41 +628,57 @@ static void qtsmc_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 *qtsmc_get_id(void) {
- return "QT SMC";
-}
-
-/*
- * This function frees the video decoder instance allocated to the decoder.
- */
-static void qtsmc_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) {
- qtsmc_decoder_t *this ;
+ qtsmc_decoder_t *this ;
- this = (qtsmc_decoder_t *) malloc (sizeof (qtsmc_decoder_t));
- memset(this, 0, sizeof (qtsmc_decoder_t));
+ this = (qtsmc_decoder_t *) xine_xmalloc (sizeof (qtsmc_decoder_t));
- this->video_decoder.init = qtsmc_init;
this->video_decoder.decode_data = qtsmc_decode_data;
this->video_decoder.flush = qtsmc_flush;
this->video_decoder.reset = qtsmc_reset;
- this->video_decoder.close = qtsmc_close;
- this->video_decoder.get_identifier = qtsmc_get_id;
this->video_decoder.dispose = qtsmc_dispose;
+ this->size = 0;
+
+ this->stream = stream;
+ this->class = (qtsmc_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 SMC";
+}
+
+static char *get_description (video_decoder_class_t *this) {
+ return "Quicktime Graphics (SMC) video decoder plugin";
+}
+
+static void dispose_class (video_decoder_class_t *this) {
+ free (this);
+}
+
+static void *init_plugin (xine_t *xine, void *data) {
+
+ qtsmc_class_t *this;
+
+ this = (qtsmc_class_t *) xine_xmalloc (sizeof (qtsmc_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 */
@@ -686,7 +691,7 @@ 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 SMC", XINE_VERSION_CODE, &video_decoder_info, &init_video_decoder_plugin },
+ { PLUGIN_VIDEO_DECODER, 11, "smc", XINE_VERSION_CODE, &video_decoder_info, &init_plugin },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};