]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - dpvsimpledecode.c
Add a third masterextra and default it to dpm.dpmaster.org
[xonotic/darkplaces.git] / dpvsimpledecode.c
index a72bf3645f86b40fea31ae22e021bd3fc67e5833..011c95bf4d32260c3078aaebec28fa304779b10f 100644 (file)
@@ -1,3 +1,23 @@
+/*
+Copyright (C) 2002-2013 DarkPlaces contributors
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+*/
+
 #include "quakedef.h"
 #include "dpvsimpledecode.h"
 
@@ -230,6 +250,7 @@ typedef struct dpvsimpledecodestream_s
        unsigned int info_imageBmask;
        unsigned int info_imageBshift;
        unsigned int info_imagesize;
+       double info_aspectratio;
 
        // current video frame (needed because of delta compression)
        int videoframenum;
@@ -360,6 +381,7 @@ void *dpvsimpledecode_open(clvideo_t *video, char *filename, const char **errors
                                                s->info_imagewidth = hz_bitstream_read_short(s->framedatablocks);
                                                s->info_imageheight = hz_bitstream_read_short(s->framedatablocks);
                                                s->info_framerate = (double) hz_bitstream_read_int(s->framedatablocks) * (1.0 / 65536.0);
+                                               s->info_aspectratio = (double)s->info_imagewidth / (double)s->info_imageheight;
 
                                                if (s->info_framerate > 0.0)
                                                {
@@ -391,6 +413,7 @@ void *dpvsimpledecode_open(clvideo_t *video, char *filename, const char **errors
                                                                video->getheight = dpvsimpledecode_getheight;
                                                                video->getframerate = dpvsimpledecode_getframerate;
                                                                video->decodeframe = dpvsimpledecode_video;
+                                                               video->getaspectratio = dpvsimpledecode_getaspectratio;
 
                                                                return s;
                                                        }
@@ -512,6 +535,13 @@ double dpvsimpledecode_getframerate(void *stream)
        return s->info_framerate;
 }
 
+// return aspect ratio of the stream
+double dpvsimpledecode_getaspectratio(void *stream)
+{
+       dpvsimpledecodestream_t *s = (dpvsimpledecodestream_t *)stream;
+       return s->info_aspectratio;
+}
+
 static int dpvsimpledecode_convertpixels(dpvsimpledecodestream_t *s, void *imagedata, int imagebytesperrow)
 {
        unsigned int a, x, y, width, height;