summaryrefslogtreecommitdiffstats
path: root/libvo/vo_pgm.c
diff options
context:
space:
mode:
authorarpi_esp <arpi_esp@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-02-24 20:28:24 +0000
committerarpi_esp <arpi_esp@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-02-24 20:28:24 +0000
commitd34041569e71fc9bd772354e94dc9d16061072a5 (patch)
tree8f481cae1c70f32d1756fbe5f39000577b73042d /libvo/vo_pgm.c
parente95a95ece09bac96bdfd37322f96c6f57ef79ebc (diff)
downloadmpv-d34041569e71fc9bd772354e94dc9d16061072a5.tar.bz2
mpv-d34041569e71fc9bd772354e94dc9d16061072a5.tar.xz
Initial revision
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@2 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo/vo_pgm.c')
-rw-r--r--libvo/vo_pgm.c115
1 files changed, 115 insertions, 0 deletions
diff --git a/libvo/vo_pgm.c b/libvo/vo_pgm.c
new file mode 100644
index 0000000000..bf017e5f86
--- /dev/null
+++ b/libvo/vo_pgm.c
@@ -0,0 +1,115 @@
+#define DISP
+
+/*
+ * video_out_pgm.c, pgm interface
+ *
+ *
+ * Copyright (C) 1996, MPEG Software Simulation Group. All Rights Reserved.
+ *
+ * Hacked into mpeg2dec by
+ *
+ * Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
+ *
+ * 15 & 16 bpp support added by Franck Sicard <Franck.Sicard@solsoft.fr>
+ *
+ * Xv image suuport by Gerd Knorr <kraxel@goldbach.in-berlin.de>
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "config.h"
+#include "video_out.h"
+#include "video_out_internal.h"
+
+LIBVO_EXTERN (pgm)
+
+static vo_info_t vo_info =
+{
+ "PGM file",
+ "pgm",
+ "walken",
+ ""
+};
+
+static int image_width;
+static int image_height;
+static char header[1024];
+static int framenum = -2;
+
+static uint32_t
+init(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t fullscreen, char *title, uint32_t format)
+{
+ image_height = height;
+ image_width = width;
+
+ sprintf (header, "P5\n\n%d %d\n255\n", width, height*3/2);
+
+ return 0;
+}
+
+static const vo_info_t*
+get_info(void)
+{
+ return &vo_info;
+}
+
+static void flip_page (void)
+{
+}
+
+static uint32_t draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y)
+//static uint32_t draw_slice(uint8_t * src[], uint32_t slice_num)
+{
+ return 0;
+}
+
+uint32_t output_pgm_frame (char * fname, uint8_t * src[])
+{
+ FILE * f;
+ int i;
+
+ f = fopen (fname, "wb");
+ if (f == NULL) return 1;
+ fwrite (header, strlen (header), 1, f);
+ fwrite (src[0], image_width, image_height, f);
+ for (i = 0; i < image_height/2; i++) {
+ fwrite (src[1]+i*image_width/2, image_width/2, 1, f);
+ fwrite (src[2]+i*image_width/2, image_width/2, 1, f);
+ }
+ fclose (f);
+
+ return 0;
+}
+
+static uint32_t draw_frame(uint8_t * src[])
+{
+ char buf[100];
+
+ if (++framenum < 0)
+ return 0;
+
+ sprintf (buf, "%d.pgm", framenum);
+ return output_pgm_frame (buf, src);
+}
+
+static uint32_t
+query_format(uint32_t format)
+{
+ switch(format){
+ case IMGFMT_YV12:
+// case IMGFMT_RGB|24:
+// case IMGFMT_BGR|24:
+ return 1;
+ }
+ return 0;
+}
+
+static void
+uninit(void)
+{
+}
+
+
+