summaryrefslogtreecommitdiffstats
path: root/ext/xvid/gstxvid.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/xvid/gstxvid.c')
-rw-r--r--ext/xvid/gstxvid.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/ext/xvid/gstxvid.c b/ext/xvid/gstxvid.c
index fb7d06f4..8496a9d4 100644
--- a/ext/xvid/gstxvid.c
+++ b/ext/xvid/gstxvid.c
@@ -26,6 +26,38 @@
#include "gstxviddec.h"
#include "gstxvidenc.h"
+gboolean
+gst_xvid_init (void)
+{
+ XVID_INIT_PARAM xinit;
+ gint ret;
+ static gboolean is_init = FALSE;
+
+ /* only init once */
+ if (is_init == TRUE) {
+ return TRUE;
+ }
+
+ /* set up xvid initially (function pointers, CPU flags) */
+ memset(&xinit, 0, sizeof(XVID_INIT_PARAM));
+ xinit.cpu_flags = 0;
+ if ((ret = xvid_init(NULL, 0, &xinit, NULL)) != XVID_ERR_OK) {
+ g_warning("Failed to initialize XviD: %s (%d)",
+ gst_xvid_error(ret), ret);
+ return FALSE;
+ }
+
+ if (xinit.api_version != API_VERSION) {
+ g_warning("Xvid API version mismatch! %d.%d (that's us) != %d.%d (lib)",
+ (API_VERSION >> 8) & 0xff, API_VERSION & 0xff,
+ (xinit.api_version >> 8) & 0xff, xinit.api_version & 0xff);
+ return FALSE;
+ }
+
+ is_init = TRUE;
+ return TRUE;
+}
+
gchar *
gst_xvid_error (int errorcode)
{