[Mplayer-cvslog] CVS: main/libvo vo_md5.c,1.3,1.4 vo_pgm.c,1.3,1.4

GEREOFFY arpi_esp at users.sourceforge.net
Tue Apr 17 23:00:48 CEST 2001


Update of /cvsroot/mplayer/main/libvo
In directory usw-pr-cvs1:/tmp/cvs-serv28386

Modified Files:
	vo_md5.c vo_pgm.c 
Log Message:
YV12 is working again

Index: vo_md5.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_md5.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** vo_md5.c	2001/03/03 21:46:39	1.3
--- vo_md5.c	2001/04/17 21:00:46	1.4
***************
*** 1,4 ****
- #define DISP
- 
  /* 
   * video_out_pgm.c, pgm interface
--- 1,2 ----
***************
*** 35,41 ****
  
  extern vo_functions_t video_out_pgm;
  
  static FILE * md5_file;
- static int framenum = -2;
  
  static uint32_t
--- 33,39 ----
  
  extern vo_functions_t video_out_pgm;
+ extern char vo_pgm_filename[24];
  
  static FILE * md5_file;
  
  static uint32_t
***************
*** 54,81 ****
  static void flip_page (void)
  {
- }
- 
- //static uint32_t draw_slice(uint8_t * src[], uint32_t slice_num)
- static uint32_t draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y)
- {
-     return 0;
- }
- 
- extern uint32_t output_pgm_frame (char * fname, uint8_t * src[]);
- 
- static uint32_t draw_frame(uint8_t * src[])
- {
-     char buf[100];
      char buf2[100];
      FILE * f;
      int i;
  
!     if (++framenum < 0)
! 	return 0;
  
!     sprintf (buf, "%d.pgm", framenum);
!     output_pgm_frame (buf, src);
! 
!     sprintf (buf2, "md5sum %s", buf);
      f = popen (buf2, "r");
      i = fread (buf2, 1, sizeof(buf2), f);
--- 52,62 ----
  static void flip_page (void)
  {
      char buf2[100];
      FILE * f;
      int i;
  
!     video_out_pgm.flip_page();
  
!     sprintf (buf2, "md5sum %s", vo_pgm_filename);
      f = popen (buf2, "r");
      i = fread (buf2, 1, sizeof(buf2), f);
***************
*** 83,88 ****
      fwrite (buf2, 1, i, md5_file);
  
!     remove (buf);
  
      return 0;
  }
--- 64,81 ----
      fwrite (buf2, 1, i, md5_file);
  
!     remove (vo_pgm_filename);
!     
! }
  
+ //static uint32_t draw_slice(uint8_t * src[], uint32_t slice_num)
+ static uint32_t draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y)
+ {
+     return video_out_pgm.draw_slice(image,stride,w,h,x,y);
+ }
+ 
+ //extern uint32_t output_pgm_frame (char * fname, uint8_t * src[]);
+ 
+ static uint32_t draw_frame(uint8_t * src[])
+ {
      return 0;
  }
***************
*** 91,99 ****
  query_format(uint32_t format)
  {
! //    switch(format){
! //    case IMGFMT_YV12:
! //        return 1;
! //    }
!     return 0;
  }
  
--- 84,88 ----
  query_format(uint32_t format)
  {
!     return video_out_pgm.query_format(format);
  }
  
***************
*** 102,105 ****
--- 91,96 ----
  uninit(void)
  {
+     video_out_pgm.uninit();
+     fclose(md5_file);
  }
  

Index: vo_pgm.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_pgm.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** vo_pgm.c	2001/03/03 21:46:39	1.3
--- vo_pgm.c	2001/04/17 21:00:46	1.4
***************
*** 1,4 ****
- #define DISP
- 
  /* 
   * video_out_pgm.c, pgm interface
--- 1,2 ----
***************
*** 37,41 ****
  static int image_height;
  static char header[1024];
! static int framenum = -2;
  
  static uint32_t
--- 35,43 ----
  static int image_height;
  static char header[1024];
! static int framenum = 0;
! 
! static uint8_t *image=NULL;
! 
! char vo_pgm_filename[24];
  
  static uint32_t
***************
*** 44,47 ****
--- 46,50 ----
      image_height = height;
      image_width = width;
+     image=malloc(width*height*3/2);
  
      sprintf (header, "P5\n\n%d %d\n255\n", width, height*3/2);
***************
*** 58,96 ****
  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);
  }
  
--- 61,110 ----
  static void flip_page (void)
  {
!     FILE * f;
!     int i;
  
!     sprintf (vo_pgm_filename, "%08d.pgm", framenum++);
! 
!     f = fopen (vo_pgm_filename, "wb");  if (f == NULL) return;
!     fwrite (header, strlen (header), 1, f);
!     fwrite (image, image_width, image_height*3/2, f);
!     fclose (f);
! 
!     return;
  }
  
! static uint32_t draw_slice(uint8_t *srcimg[], int stride[], int w,int h,int x,int y)
  {
      int i;
!     // copy Y:
!     uint8_t *dst=image+image_width*y+x;
!     uint8_t *src=srcimg[0];
!     for(i=0;i<h;i++){
!         memcpy(dst,src,w);
!         src+=stride[0];
!         dst+=image_width;
      }
! {
!     // copy U+V:
!     uint8_t *src1=srcimg[1];
!     uint8_t *src2=srcimg[2];
!     uint8_t *dst=image+image_width*image_height+image_width*(y/2)+(x/2);
!     for(i=0;i<h/2;i++){
!         memcpy(dst,src1,w/2);
!         memcpy(dst+image_width/2,src2,w/2);
!         src1+=stride[1];
!         src2+=stride[2];
!         dst+=image_width;
!     }
  
+ }
+     
      return 0;
  }
  
+ 
  static uint32_t draw_frame(uint8_t * src[])
  {
!     return 0;
  }
  
***************
*** 98,101 ****
--- 112,116 ----
  query_format(uint32_t format)
  {
+     if(format==IMGFMT_YV12) return 1;
  //    switch(format){
  //    case IMGFMT_YV12:
***************
*** 110,113 ****
--- 125,129 ----
  uninit(void)
  {
+     if(image){ free(image);image=NULL;}
  }
  


_______________________________________________
Mplayer-cvslog mailing list
Mplayer-cvslog at lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/mplayer-cvslog



More information about the MPlayer-cvslog mailing list