changeset 401:390fbf2a9602 src

Provide a way to retrieve video resolution. Needed for correct aspect ratio support in VLC. Patch by Jean-Baptiste Kempf /jb*videolan#org\
author rathann
date Tue, 25 May 2010 23:33:59 +0000
parents 3daa43270d2c
children 3776e1559236
files dvdnav.c dvdnav/dvdnav.h vm/vm.c vm/vm.h
diffstat 4 files changed, 23 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/dvdnav.c	Sun Sep 06 15:26:43 2009 +0000
+++ b/dvdnav.c	Tue May 25 23:33:59 2010 +0000
@@ -844,6 +844,22 @@
 
   return retval;
 }
+int dvdnav_get_video_resolution(dvdnav_t *this, uint32_t *width, uint32_t *height) {
+  int w, h;
+
+  if(!this->started) {
+    printerr("Virtual DVD machine not started.");
+    return -1;
+  }
+
+  pthread_mutex_lock(&this->vm_lock);
+  vm_get_video_res(this->vm, &w, &h);
+  pthread_mutex_unlock(&this->vm_lock);
+
+  *width  = w;
+  *height = h;
+  return 0;
+}
 
 uint8_t dvdnav_get_video_scale_permission(dvdnav_t *this) {
   uint8_t         retval;
--- a/dvdnav/dvdnav.h	Sun Sep 06 15:26:43 2009 +0000
+++ b/dvdnav/dvdnav.h	Tue May 25 23:33:59 2010 +0000
@@ -553,6 +553,11 @@
 uint8_t dvdnav_get_video_aspect(dvdnav_t *self);
 
 /*
+ * Get video resolution.
+ */
+int dvdnav_get_video_resolution(dvdnav_t *self, uint32_t *width, uint32_t *height);
+
+/*
  * Get video scaling permissions.
  * The scaling permission does only change on VTS boundaries.
  * See the DVDNAV_VTS_CHANGE event.
--- a/vm/vm.c	Sun Sep 06 15:26:43 2009 +0000
+++ b/vm/vm.c	Tue May 25 23:33:59 2010 +0000
@@ -858,8 +858,8 @@
     break;
   }
 }
+#endif
 
-/* currently unused */
 void vm_get_video_res(vm_t *vm, int *width, int *height) {
   video_attr_t attr = vm_get_video_attr(vm);
 
@@ -883,7 +883,6 @@
     break;
   }
 }
-#endif
 
 int vm_get_video_aspect(vm_t *vm) {
   int aspect = vm_get_video_attr(vm).display_aspect_ratio;
--- a/vm/vm.h	Sun Sep 06 15:26:43 2009 +0000
+++ b/vm/vm.h	Tue May 25 23:33:59 2010 +0000
@@ -159,8 +159,8 @@
 /* currently unused */
 void vm_get_audio_info(vm_t *vm, int *current, int *num_avail);
 void vm_get_subp_info(vm_t *vm, int *current, int *num_avail);
+#endif
 void vm_get_video_res(vm_t *vm, int *width, int *height);
-#endif
 int  vm_get_video_aspect(vm_t *vm);
 int  vm_get_video_scale_permission(vm_t *vm);
 video_attr_t vm_get_video_attr(vm_t *vm);