[MPlayer-dev-eng] [PATCH] autoq support for control()

David Holm david at realityrift.com
Sat Feb 9 16:44:19 CET 2002


Hi,
users with older machines has requested I've added a feature to set a
lower output quality so they can use their dxr3's for other things than
mpeg. This patch adds a call to vo_*->control whenever autoq requests a
quality change as to be able to lower the quality in libavcodec.
I'm not sure how useful this is (how intelligent autoq really is), but
if you decide it's useful apply it. If it's not then I guess I would
request an option added so I can change output quality of libavcodec ;).

//David Holm


-------------- next part --------------
Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.390
diff -u -r1.390 mplayer.c
--- mplayer.c	9 Feb 2002 14:53:49 -0000	1.390
+++ mplayer.c	9 Feb 2002 15:53:07 -0000
@@ -1933,6 +1933,8 @@
       output_quality=0;
 //  printf("total: %8.6f  sleep: %8.6f  q: %d\n",(0.000001f*aq_total_time),aq_sleep_time,output_quality);
   set_video_quality(sh_video,output_quality);
+  if(video_out)
+      video_out->control(VOCTRL_SET_QUALITY, &output_quality);
 #endif
 }
 
Index: libvo/video_out.h
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/video_out.h,v
retrieving revision 1.16
diff -u -r1.16 video_out.h
--- libvo/video_out.h	9 Feb 2002 00:47:26 -0000	1.16
+++ libvo/video_out.h	9 Feb 2002 15:53:07 -0000
@@ -23,6 +23,11 @@
 #define VOCTRL_QUERY_FORMAT 2
 /* signal a device reset (seek/paus) */
 #define VOCTRL_RESET 3
+/* used by autoquality to adjust output quality, only useful if you
+ * are using libavcodec or similar to encode to mpeg1 or anything like that
+ * I guess.
+ */
+#define VOCTRL_SET_QUALITY 4
 
 #define VO_TRUE		1
 #define VO_FALSE	0
Index: libvo/vo_dxr3.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_dxr3.c,v
retrieving revision 1.52
diff -u -r1.52 vo_dxr3.c
--- libvo/vo_dxr3.c	9 Feb 2002 14:44:09 -0000	1.52
+++ libvo/vo_dxr3.c	9 Feb 2002 15:53:07 -0000
@@ -101,6 +101,16 @@
 {
 	uint32_t flag = 0;
 	switch (request) {
+	case VOCTRL_SET_QUALITY:
+		if (img_format != IMGFMT_MPEGPES) {
+			avc_context->quality = *((int*)data);
+			if (avc_context->quality <= 1) {
+				avc_context->quality = 2;
+			}
+			return VO_TRUE;
+		} else {
+			return VO_FALSE;
+		}
 	case VOCTRL_RESET:
 		if (!noprebuf) {
 			close(fd_video);


More information about the MPlayer-dev-eng mailing list