Source

pygame / src / movie.c

Diff from to

File src/movie.c

 {
     SMPEG* movie = PyMovie_AsSMPEG (self);
     int loops = 0;
+
+	if (!SDL_WasInit (SDL_INIT_VIDEO))
+        return RAISE (PyExc_SDLError,
+                      "cannot convert without pygame.display initialized");
+
     Py_BEGIN_ALLOW_THREADS;
     SMPEG_loop (movie, loops);
     SMPEG_play (movie);
 movie_stop (PyObject* self)
 {
     SMPEG* movie = PyMovie_AsSMPEG (self);
+
+	if (!SDL_WasInit (SDL_INIT_VIDEO))
+        return RAISE (PyExc_SDLError,
+                      "cannot convert without pygame.display initialized");
+
     Py_BEGIN_ALLOW_THREADS;
     SMPEG_stop (movie);
     Py_END_ALLOW_THREADS;
 }
 
 static PyObject*
-movie_pause (PyObject* self)
-{
+movie_pause (PyObject* self) {
     SMPEG* movie = PyMovie_AsSMPEG (self);
+
+	if (!SDL_WasInit (SDL_INIT_VIDEO))
+        return RAISE (PyExc_SDLError,
+                      "cannot convert without pygame.display initialized");
+
+
     Py_BEGIN_ALLOW_THREADS;
     SMPEG_pause (movie);
     Py_END_ALLOW_THREADS;
 movie_rewind (PyObject* self)
 {
     SMPEG* movie = PyMovie_AsSMPEG (self);
+
+	if (!SDL_WasInit (SDL_INIT_VIDEO))
+        return RAISE (PyExc_SDLError,
+                      "cannot convert without pygame.display initialized");
+
     Py_BEGIN_ALLOW_THREADS;
     SMPEG_rewind (movie);
     Py_END_ALLOW_THREADS;
 {
     SMPEG* movie = PyMovie_AsSMPEG (self);
     float seconds;
-    if (!PyArg_ParseTuple (args, "f", &seconds))
+
+	if (!SDL_WasInit (SDL_INIT_VIDEO))
+	return RAISE (PyExc_SDLError,
+				  "cannot convert without pygame.display initialized");
+
+	
+	if (!PyArg_ParseTuple (args, "f", &seconds))
         return NULL;
     Py_BEGIN_ALLOW_THREADS;
     SMPEG_skip (movie, seconds);
     if (!PyArg_ParseTuple (args, "f", &value))
         return NULL;
 
+	if (!SDL_WasInit (SDL_INIT_VIDEO))
+        return RAISE (PyExc_SDLError,
+                      "cannot convert without pygame.display initialized");
+
+
     Py_BEGIN_ALLOW_THREADS;
     volume = (int) (value * 100);
     if (volume < 0)
     if (!PyArg_ParseTuple (args, "O|O", &surfobj, &posobj))
         return NULL;
 
+
+	if (!SDL_WasInit (SDL_INIT_VIDEO))
+        return RAISE (PyExc_SDLError,
+                      "cannot convert without pygame.display initialized");
+
+
     Py_XDECREF (((PyMovieObject*) self)->surftarget);
     ((PyMovieObject*) self)->surftarget = NULL;
 
     SMPEG* movie = PyMovie_AsSMPEG (self);
     SMPEG_Info info;
 
+	if (!SDL_WasInit (SDL_INIT_VIDEO))
+        return RAISE (PyExc_SDLError,
+                      "cannot convert without pygame.display initialized");
+
     Py_BEGIN_ALLOW_THREADS;
     SMPEG_getinfo (movie, &info);
     Py_END_ALLOW_THREADS;
     SMPEG* movie = PyMovie_AsSMPEG (self);
     SMPEG_Info info;
 
+	if (!SDL_WasInit (SDL_INIT_VIDEO))
+        return RAISE (PyExc_SDLError,
+                      "cannot convert without pygame.display initialized");
+
+
     Py_BEGIN_ALLOW_THREADS;
     SMPEG_getinfo (movie, &info);
     Py_END_ALLOW_THREADS;
     SMPEG* movie = PyMovie_AsSMPEG (self);
     SMPEG_Info info;
 
+	if (!SDL_WasInit (SDL_INIT_VIDEO))
+        return RAISE (PyExc_SDLError,
+                      "cannot convert without pygame.display initialized");
+
     Py_BEGIN_ALLOW_THREADS;
     SMPEG_getinfo (movie, &info);
     Py_END_ALLOW_THREADS;
     SMPEG* movie = PyMovie_AsSMPEG (self);
     SMPEG_Info info;
 
+	if (!SDL_WasInit (SDL_INIT_VIDEO))
+        return RAISE (PyExc_SDLError,
+                      "cannot convert without pygame.display initialized");
+
     Py_BEGIN_ALLOW_THREADS;
     SMPEG_getinfo (movie, &info);
     Py_END_ALLOW_THREADS;
     SMPEG* movie = PyMovie_AsSMPEG (self);
     SMPEG_Info info;
 
+	if (!SDL_WasInit (SDL_INIT_VIDEO))
+        return RAISE (PyExc_SDLError,
+                      "cannot convert without pygame.display initialized");
+
     Py_BEGIN_ALLOW_THREADS;
     SMPEG_getinfo (movie, &info);
     Py_END_ALLOW_THREADS;
 static PyObject*
 movie_get_length (PyObject* self)
 {
-    SMPEG* movie = PyMovie_AsSMPEG (self);
+	SMPEG* movie;
     SMPEG_Info info;
 
+	if (!SDL_WasInit (SDL_INIT_VIDEO))
+        return RAISE (PyExc_SDLError,
+                      "cannot convert without pygame.display initialized");
+
+	movie = PyMovie_AsSMPEG (self);
+
     Py_BEGIN_ALLOW_THREADS;
     SMPEG_getinfo (movie, &info);
     Py_END_ALLOW_THREADS;
 static PyObject*
 movie_get_busy (PyObject* self)
 {
-    SMPEG* movie = PyMovie_AsSMPEG (self);
+    SMPEG* movie;
+
+	if (!SDL_WasInit (SDL_INIT_VIDEO))
+        return RAISE (PyExc_SDLError,
+                      "cannot convert without pygame.display initialized");
+
+    movie = PyMovie_AsSMPEG (self);
+
     return PyInt_FromLong (SMPEG_status (movie) == SMPEG_PLAYING);
 }
 
     SMPEG_Info info;
     int framenum;
 
+    if (!SDL_WasInit (SDL_INIT_VIDEO))
+        return RAISE (PyExc_SDLError,
+                      "cannot convert without pygame.display initialized");
+
     if (!PyArg_ParseTuple (args, "i", &framenum))
         return NULL;
     Py_BEGIN_ALLOW_THREADS;
     SDL_Surface* screen;
     char* error;
     int audioavail = 0;
+
+    if (!SDL_WasInit (SDL_INIT_VIDEO))
+        return RAISE (PyExc_SDLError,
+                      "cannot convert without pygame.display initialized");
+
     if (!PyArg_ParseTuple (arg, "O", &file))
         return NULL;