1. pygame
  2. Untitled project
  3. pygame

Commits

zeroth  committed bb2ba31

Added basic documentation

  • Participants
  • Parent commits cdea134
  • Branches tylerthemovie

Comments (0)

Files changed (2)

File src/gmovie.c

View file
 }
  PyObject* _movie_get_paused (PyMovie *movie, void *closure)
 {
-    return PyInt_FromLong((long)movie->paused);
+    return PyBool_FromLong((long)movie->paused);
 }
 PyObject* _movie_get_playing (PyMovie *movie, void *closure)
 {
     PyObject *pyo;
-    pyo= PyInt_FromLong((long)movie->playing);
+    pyo= PyBool_FromLong((long)movie->playing);
     return pyo;
 }
 
 }
 
  static PyMethodDef _movie_methods[] = {
-   { "play",    (PyCFunction) _movie_play, METH_VARARGS,
-               "Play the movie file from current time-mark. If loop<0, then it will loop infinitely. If there is no loop value, then it will play once." },
-   { "stop", (PyCFunction) _movie_stop, METH_NOARGS,
-                "Stop the movie, and set time-mark to 0:0"},
-   { "pause", (PyCFunction) _movie_pause, METH_NOARGS,
-                "Pause movie."},
-   { "rewind", (PyCFunction) _movie_rewind, METH_VARARGS,
-                "Rewind movie to time_pos. If there is no time_pos, same as stop."},
-   { "resize", (PyCFunction) _movie_resize, METH_VARARGS,
-   				"Resize video to  specified width and height, in that order."},
-   { NULL, NULL, 0, NULL }
+   { "play",   (PyCFunction) _movie_play,   METH_VARARGS, DOC_GMOVIEMOVIEPLAY},
+   { "stop",   (PyCFunction) _movie_stop,   METH_NOARGS,  DOC_GMOVIEMOVIESTOP},
+   { "pause",  (PyCFunction) _movie_pause,  METH_NOARGS,  DOC_GMOVIEMOVIEPAUSE},
+   { "rewind", (PyCFunction) _movie_rewind, METH_VARARGS, DOC_GMOVIEMOVIEREWIND},
+   { "resize", (PyCFunction) _movie_resize, METH_VARARGS, DOC_GMOVIEMOVIERESIZE},
+   { NULL,     NULL,                        0,            NULL }
 };
 
  static PyGetSetDef _movie_getsets[] =
 {
-    { "paused",  (getter) _movie_get_paused,  NULL,                        NULL, NULL },
-    { "playing", (getter) _movie_get_playing, NULL,                        NULL, NULL },
-    { "height",  (getter) _movie_get_height,  (setter) _movie_set_height,  NULL, NULL },
-    { "width",   (getter) _movie_get_width,   (setter) _movie_set_width,   NULL, NULL },
-    { "surface", (getter) _movie_get_surface, (setter) _movie_set_surface, NULL, NULL },
-    { NULL,      NULL,                        NULL,                        NULL, NULL }
+    { "paused",  (getter) _movie_get_paused,  NULL,                        DOC_GMOVIEMOVIEPAUSE,   NULL },
+    { "playing", (getter) _movie_get_playing, NULL,                        DOC_GMOVIEMOVIEPLAYING, NULL },
+    { "height",  (getter) _movie_get_height,  (setter) _movie_set_height,  DOC_GMOVIEMOVIEHEIGHT,  NULL },
+    { "width",   (getter) _movie_get_width,   (setter) _movie_set_width,   DOC_GMOVIEMOVIEWIDTH,   NULL },
+    { "surface", (getter) _movie_get_surface, (setter) _movie_set_surface, DOC_GMOVIEMOVIESURFACE, NULL },
+    { NULL,      NULL,                        NULL,                        NULL,                   NULL }
 };
 
  static PyTypeObject PyMovie_Type =
 {
     PyObject_HEAD_INIT(NULL)
     0, 
-    "pygame.gmovie.Movie",          /* tp_name */
+    "pygame._movie.Movie",          /* tp_name */
     sizeof (PyMovie),           /* tp_basicsize */
     0,                          /* tp_itemsize */
     (destructor) _movie_dealloc,/* tp_dealloc */
     0,                          /* tp_setattro */
     0,                          /* tp_as_buffer */
     Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
-    0,                          /* tp_doc */
+    DOC_GMOVIE,                 /* tp_doc */
     0,                          /* tp_traverse */
     0,                          /* tp_clear */
     0,                          /* tp_richcompare */
     0,                          /* tp_weaklist */
     0                           /* tp_del */
 };
-
+/*DOC*/ static char _movie_doc[] =
+/*DOC*/    "ffmpeg wrapper module for pygame";
 
 PyMODINIT_FUNC
 init_movie(void)
    }*/
    // Create the module
    
-   module = Py_InitModule3 ("_movie", NULL, "pygame._movie plays movies and streams."); //movie doc needed
+   module = Py_InitModule3 ("_movie", NULL, _movie_doc); //movie doc needed
 
    if (module == NULL) {
       return;
    uint8_t *s = (uint8_t *)"FLUSH";
    flush_pkt.data= s;
    
-   
-
    // Add the type to the module.
    Py_INCREF(&PyMovie_Type);
    PyModule_AddObject(module, "Movie", (PyObject*)&PyMovie_Type);

File src/pygamedocs.h

View file
 
 #define DOC_PYGAMETRANSFORMTHRESHOLD "pygame.transform.threshold(DestSurface, Surface, color, threshold = (0,0,0,0), diff_color = (0,0,0,0), change_return = 1, Surface = None, inverse = False): return num_threshold_pixels\nfinds which, and how many pixels in a surface are within a threshold of a color."
 
-
+#define DOC_GMOVIE "pygame backend module that wraps the ffmpeg library to play video files"
+
+#define DOC_GMOVIEMOVIE "pygame._movie.Movie(filename, surface=None): returns Movie or None\nIf the optional surface argument is a surface, then the movie will output to that surface instead of using overlays."
+
+#define DOC_GMOVIEMOVIEPLAY "pygame._movie.Movie.play(loops=0): return None\nplays the video file loops+1 times."
+
+#define DOC_GMOVIEMOVIESTOP "pygame._movie.Movie.stop(): return None\nstops the video file and returns it to timestamp o."
+
+#define DOC_GMOVIEMOVIEPAUSE "pygame._movie.Movie.pause(): return None\npauses video file at that very moment or unpauses the video file."
+
+#define DOC_GMOVIEMOVIEREWIND "pygame._movie.Movie.rewind(): return None\nsame as stop()"
+
+#define DOC_GMOVIEMOVIERESIZE "pygame._movie.Movie.resize(width, height): return None\nresizes the video screen"
+
+#define DOC_GMOVIEMOVIEPAUSED "pygame._movie.Movie.paused: return bool\nchecks if the movie file has been paused"
+
+#define DOC_GMOVIEMOVIEPLAYING "pygame._movie.Movie.playing: return bool\nchecks if the movie file is playing. True even when paused, but false when stop has been called."
+
+#define DOC_GMOVIEMOVIEWIDTH   "pygame._movie.Movie.width: Gets or sets the width\nGet or set the width of the screen for the video playback"
+
+#define DOC_GMOVIEMOVIEHEIGHT  "pygame._movie.Movie.height: Gets or sets the height\nGet or set the height of the screen for the video playback"
+
+#define DOC_GMOVIEMOVIESURFACE "pygame._movie.Movie.surface: Gets or sets the surface to which the video is displayed on"
 
 /* Docs in a comments... slightly easier to read. */
 
  pygame.transform.threshold(DestSurface, Surface, color, threshold = (0,0,0,0), diff_color = (0,0,0,0), change_return = 1, Surface = None, inverse = False): return num_threshold_pixels
 finds which, and how many pixels in a surface are within a threshold of a color.
 
-
-
+pygame._movie
+ pygame wrapper around ffmpeg library to play video files
+
+pygame._movie.Movie
+ Python Object to represent and control a movie being played
 */