summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/libxinevdec/svq1.c77
1 files changed, 51 insertions, 26 deletions
diff --git a/src/libxinevdec/svq1.c b/src/libxinevdec/svq1.c
index 3bdb8baa3..6904f7ce7 100644
--- a/src/libxinevdec/svq1.c
+++ b/src/libxinevdec/svq1.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: svq1.c,v 1.10 2002/10/06 19:55:18 jkeil Exp $
+ * $Id: svq1.c,v 1.11 2002/10/22 05:14:34 tmmm Exp $
*/
#include <stdio.h>
@@ -85,10 +85,16 @@ typedef struct svq1_s {
int height;
} svq1_t;
+typedef struct {
+ video_decoder_class_t decoder_class;
+} svq1_class_t;
+
typedef struct svq1dec_decoder_s {
video_decoder_t video_decoder;
- vo_instance_t *video_out;
+ svq1_class_t *class;
+ xine_stream_t *stream;
+
int64_t video_step;
int decoder_ok;
@@ -1366,14 +1372,6 @@ static void svq1_copy_frame (svq1_t *svq1, uint8_t *base[3], int pitches[3]) {
}
}
-static void svq1dec_init (video_decoder_t *this_gen, vo_instance_t *video_out) {
- svq1dec_decoder_t *this = (svq1dec_decoder_t *) this_gen;
-
- this->video_out = video_out;
- this->decoder_ok = 0;
- this->svq1 = (svq1_t *) xine_xmalloc (sizeof(svq1_t));
-}
-
static void svq1dec_decode_data (video_decoder_t *this_gen, buf_element_t *buf) {
svq1dec_decoder_t *this = (svq1dec_decoder_t *) this_gen;
@@ -1389,7 +1387,7 @@ static void svq1dec_decode_data (video_decoder_t *this_gen, buf_element_t *buf)
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;
} else if (this->decoder_ok) {
@@ -1415,7 +1413,7 @@ static void svq1dec_decode_data (video_decoder_t *this_gen, buf_element_t *buf)
if (this->svq1->width > 0 && this->svq1->height > 0) {
- img = this->video_out->get_frame (this->video_out,
+ img = this->stream->video_out->get_frame (this->stream->video_out,
this->svq1->width,
this->svq1->height,
XINE_VO_ASPECT_DONT_TOUCH, XINE_IMGFMT_YV12, VO_BOTH_FIELDS);
@@ -1466,7 +1464,8 @@ static void svq1dec_reset (video_decoder_t *this_gen) {
this->size = 0;
}
-static void svq1dec_close (video_decoder_t *this_gen) {
+static void svq1dec_dispose (video_decoder_t *this_gen) {
+
svq1dec_decoder_t *this = (svq1dec_decoder_t *) this_gen;
if (this->svq1) {
@@ -1484,31 +1483,57 @@ static void svq1dec_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);
}
-}
-
-static char *svq1dec_get_id(void) {
- return "svq1";
-}
-static void svq1dec_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) {
- svq1dec_decoder_t *this ;
+ svq1dec_decoder_t *this ;
this = (svq1dec_decoder_t *) xine_xmalloc (sizeof (svq1dec_decoder_t));
- this->video_decoder.init = svq1dec_init;
this->video_decoder.decode_data = svq1dec_decode_data;
this->video_decoder.flush = svq1dec_flush;
this->video_decoder.reset = svq1dec_reset;
- this->video_decoder.close = svq1dec_close;
- this->video_decoder.get_identifier = svq1dec_get_id;
this->video_decoder.dispose = svq1dec_dispose;
+ this->size = 0;
+
+ this->stream = stream;
+ this->class = (svq1_class_t *) class_gen;
+
+ this->svq1 = (svq1_t *) xine_xmalloc (sizeof(svq1_t));
+
+ this->decoder_ok = 0;
+ this->buf = NULL;
+
+ return &this->video_decoder;
+}
+
+static char *get_identifier (video_decoder_class_t *this) {
+ return "SVQ1";
+}
+
+static char *get_description (video_decoder_class_t *this) {
+ return "Sorenson Video v1 decoder plugin";
+}
+
+static void dispose_class (video_decoder_class_t *this) {
+ free (this);
+}
+
+static void *init_plugin (xine_t *xine, void *data) {
+
+ svq1_class_t *this;
+
+ this = (svq1_class_t *) xine_xmalloc (sizeof (svq1_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 this;
}
@@ -1529,6 +1554,6 @@ static decoder_info_t dec_info_video = {
plugin_info_t xine_plugin_info[] = {
/* type, API, "name", version, special_info, init_function */
- { PLUGIN_VIDEO_DECODER, 10, "svq1", XINE_VERSION_CODE, &dec_info_video, init_video_decoder_plugin },
+ { PLUGIN_VIDEO_DECODER, 11, "svq1", XINE_VERSION_CODE, &dec_info_video, init_plugin },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};