[DVDnav-discuss] r1192 - in trunk/libdvdnav/src: dvdnav.c dvdnav/dvdnav.h vm/vm.c vm/vm.h

rathann subversion at mplayerhq.hu
Wed May 26 01:33:59 CEST 2010


Author: rathann
Date: Wed May 26 01:33:59 2010
New Revision: 1192

Log:
Provide a way to retrieve video resolution.
Needed for correct aspect ratio support in VLC.

Patch by Jean-Baptiste Kempf /jb*videolan#org\

Modified:
   trunk/libdvdnav/src/dvdnav.c
   trunk/libdvdnav/src/dvdnav/dvdnav.h
   trunk/libdvdnav/src/vm/vm.c
   trunk/libdvdnav/src/vm/vm.h

Modified: trunk/libdvdnav/src/dvdnav.c
==============================================================================
--- trunk/libdvdnav/src/dvdnav.c	Fri Mar  5 22:16:01 2010	(r1191)
+++ trunk/libdvdnav/src/dvdnav.c	Wed May 26 01:33:59 2010	(r1192)
@@ -844,6 +844,22 @@ uint8_t dvdnav_get_video_aspect(dvdnav_t
 
   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;

Modified: trunk/libdvdnav/src/dvdnav/dvdnav.h
==============================================================================
--- trunk/libdvdnav/src/dvdnav/dvdnav.h	Fri Mar  5 22:16:01 2010	(r1191)
+++ trunk/libdvdnav/src/dvdnav/dvdnav.h	Wed May 26 01:33:59 2010	(r1192)
@@ -553,6 +553,11 @@ dvdnav_status_t dvdnav_get_serial_string
 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.

Modified: trunk/libdvdnav/src/vm/vm.c
==============================================================================
--- trunk/libdvdnav/src/vm/vm.c	Fri Mar  5 22:16:01 2010	(r1191)
+++ trunk/libdvdnav/src/vm/vm.c	Wed May 26 01:33:59 2010	(r1192)
@@ -858,8 +858,8 @@ void vm_get_subp_info(vm_t *vm, int *cur
     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 @@ void vm_get_video_res(vm_t *vm, int *wid
     break;
   }
 }
-#endif
 
 int vm_get_video_aspect(vm_t *vm) {
   int aspect = vm_get_video_attr(vm).display_aspect_ratio;

Modified: trunk/libdvdnav/src/vm/vm.h
==============================================================================
--- trunk/libdvdnav/src/vm/vm.h	Fri Mar  5 22:16:01 2010	(r1191)
+++ trunk/libdvdnav/src/vm/vm.h	Wed May 26 01:33:59 2010	(r1192)
@@ -159,8 +159,8 @@ void vm_get_angle_info(vm_t *vm, int *cu
 /* 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);
-void vm_get_video_res(vm_t *vm, int *width, int *height);
 #endif
+void vm_get_video_res(vm_t *vm, int *width, int *height);
 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);


More information about the DVDnav-discuss mailing list