[Mplayer-cvslog] CVS: main/libvo vo_md5.c,1.14,1.15
Alex Beregszaszi
syncmail at mplayerhq.hu
Sat Jul 17 13:22:16 CEST 2004
CVS change done by Alex Beregszaszi
Update of /cvsroot/mplayer/main/libvo
In directory mail:/var2/tmp/cvs-serv24484
Modified Files:
vo_md5.c
Log Message:
1, killed some 100l's (no error checking). 2, added subotion for output filename. 3, fallback to 'md5' in case 'md5sum' is not available - this is the case on Darwin
Index: vo_md5.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_md5.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- vo_md5.c 11 Nov 2002 15:20:26 -0000 1.14
+++ vo_md5.c 17 Jul 2004 11:22:14 -0000 1.15
@@ -35,12 +35,15 @@
extern vo_functions_t video_out_pgm;
extern char vo_pgm_filename[24];
-static FILE * md5_file;
+static FILE * md5_file = NULL;
+static char * md5_filename = NULL;
static uint32_t
config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t fullscreen, char *title, uint32_t format)
{
- md5_file = fopen ("md5", "w");
+ md5_file = fopen (md5_filename?md5_filename:"md5", "w");
+ if (!md5_file)
+ return -1;
return video_out_pgm.config (width, height, d_width,d_height,fullscreen, title, format);
}
@@ -58,12 +61,16 @@
snprintf (buf2, 100, "md5sum %s", vo_pgm_filename);
f = popen (buf2, "r");
+ if (!f) {
+ snprintf (buf2, 100, "md5 %s", vo_pgm_filename);
+ f = popen(buf2, "r");
+ }
+ if (f) {
i = fread (buf2, 1, sizeof(buf2), f);
pclose (f);
fwrite (buf2, 1, i, md5_file);
-
+ }
remove (vo_pgm_filename);
-
}
//static uint32_t draw_slice(uint8_t * src[], uint32_t slice_num)
@@ -90,7 +97,17 @@
uninit(void)
{
video_out_pgm.uninit();
- fclose(md5_file);
+ if (md5_file)
+ {
+ fflush(md5_file);
+ fclose(md5_file);
+ md5_file = NULL;
+ }
+ if (md5_filename)
+ {
+ free(md5_filename);
+ md5_filename = NULL;
+ }
}
@@ -101,10 +118,7 @@
static uint32_t preinit(const char *arg)
{
if(arg)
- {
- printf("vo_md5: Unknown subdevice: %s\n",arg);
- return ENOSYS;
- }
+ md5_filename = strdup(arg);
return 0;
}
More information about the MPlayer-cvslog
mailing list