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.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/ext/xvid/gstxvid.c b/ext/xvid/gstxvid.c
index 3683a0f6..e1a9700e 100644
--- a/ext/xvid/gstxvid.c
+++ b/ext/xvid/gstxvid.c
@@ -21,13 +21,59 @@
#include "config.h"
#endif
+#include <string.h>
+
#include "gstxviddec.h"
#include "gstxvidenc.h"
+gchar *
+gst_xvid_error (int errorcode)
+{
+ gchar *error;
+
+ switch (errorcode) {
+ case XVID_ERR_FAIL:
+ error = "Operation failed";
+ break;
+ case XVID_ERR_OK:
+ error = "No error";
+ break;
+ case XVID_ERR_MEMORY:
+ error = "Memory error";
+ break;
+ case XVID_ERR_FORMAT:
+ error = "Invalid format";
+ break;
+ default:
+ error = "Unknown error";
+ break;
+ }
+
+ return error;
+}
+
static gboolean
plugin_init (GModule *module,
GstPlugin *plugin)
{
+ XVID_INIT_PARAM xinit;
+ gint ret;
+
+ /* 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("Faied 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 (gst_xviddec_plugin_init(module, plugin) &&
gst_xvidenc_plugin_init(module, plugin));
}