summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSiggi Langauf <siggi@users.sourceforge.net>2003-03-05 23:55:06 +0000
committerSiggi Langauf <siggi@users.sourceforge.net>2003-03-05 23:55:06 +0000
commitd46b6348487f6a736184a3d1781f2164326000d3 (patch)
treed7de96c9cdd1b40f29cc1b27cd550d7a6cf7ea8e
parentea02fab31dd66ad0d5d321c65046f0ef9c352848 (diff)
downloadxine-lib-d46b6348487f6a736184a3d1781f2164326000d3.tar.gz
xine-lib-d46b6348487f6a736184a3d1781f2164326000d3.tar.bz2
allow a little bit safer mode for snapshot allocation:
call xine_get_current_frame() with img=NULL to get width/height (and other info) before allocating the img buffer and calling again to get the frame... CVS patchset: 4343 CVS date: 2003/03/05 23:55:06
-rw-r--r--src/xine-engine/xine.c45
1 files changed, 23 insertions, 22 deletions
diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c
index cc940ea26..c4e675fa7 100644
--- a/src/xine-engine/xine.c
+++ b/src/xine-engine/xine.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: xine.c,v 1.231 2003/02/22 14:18:55 mroi Exp $
+ * $Id: xine.c,v 1.232 2003/03/05 23:55:06 siggi Exp $
*
* top-level xine functions
*
@@ -1295,27 +1295,28 @@ int xine_get_current_frame (xine_stream_t *stream, int *width, int *height,
*ratio_code = frame->ratio;
*format = frame->format;
- switch (frame->format) {
-
- case XINE_IMGFMT_YV12:
- memcpy (img, frame->base[0], frame->width*frame->height);
- memcpy (img+frame->width*frame->height, frame->base[1],
- frame->width*frame->height/4);
- memcpy (img+frame->width*frame->height+frame->width*frame->height/4,
- frame->base[2],
- frame->width*frame->height/4);
- break;
-
- case XINE_IMGFMT_YUY2:
- memcpy (img, frame->base[0], frame->width * frame->height * 2);
- break;
-
- default:
- printf ("xine: error, snapshot function not implemented for format 0x%x\n",
- frame->format);
- abort ();
- }
-
+ if (img){
+ switch (frame->format) {
+
+ case XINE_IMGFMT_YV12:
+ memcpy (img, frame->base[0], frame->width*frame->height);
+ memcpy (img+frame->width*frame->height, frame->base[1],
+ frame->width*frame->height/4);
+ memcpy (img+frame->width*frame->height+frame->width*frame->height/4,
+ frame->base[2],
+ frame->width*frame->height/4);
+ break;
+
+ case XINE_IMGFMT_YUY2:
+ memcpy (img, frame->base[0], frame->width * frame->height * 2);
+ break;
+
+ default:
+ printf ("xine: error, snapshot function not implemented for format 0x%x\n",
+ frame->format);
+ abort ();
+ }
+ }
return 1;
}