[libdvdnav-devel] [Git][videolan/libdvdnav][master] 2 commits: dvdnav_get_video_resolution: return an appropriate DVDNAV_STATUS code instead of -1 or 0.

Jean-Baptiste Kempf gitlab at videolan.org
Thu Nov 23 01:40:52 CET 2017


Jean-Baptiste Kempf pushed to branch master at videolan / libdvdnav


Commits:
c1f20ed3 by Andreas Zelend at 2017-11-23T01:40:34+01:00
dvdnav_get_video_resolution: return an appropriate DVDNAV_STATUS code instead of -1 or 0.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

- - - - -
0f6e7089 by Andreas Zelend at 2017-11-23T01:40:39+01:00
dvdnav_get_spu_attr/dvdnav_get_audio_attr: return DVDNAV_STATUS_ERR in case of failure instead of -1.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

- - - - -


2 changed files:

- src/dvdnav.c
- src/dvdnav/dvdnav.h


Changes:

=====================================
src/dvdnav.c
=====================================
--- a/src/dvdnav.c
+++ b/src/dvdnav.c
@@ -935,12 +935,12 @@ uint8_t dvdnav_get_video_aspect(dvdnav_t *this) {
 
   return retval;
 }
-int dvdnav_get_video_resolution(dvdnav_t *this, uint32_t *width, uint32_t *height) {
+dvdnav_status_t 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;
+    return DVDNAV_STATUS_ERR;
   }
 
   pthread_mutex_lock(&this->vm_lock);
@@ -949,7 +949,7 @@ int dvdnav_get_video_resolution(dvdnav_t *this, uint32_t *width, uint32_t *heigh
 
   *width  = w;
   *height = h;
-  return 0;
+  return DVDNAV_STATUS_OK;
 }
 
 uint8_t dvdnav_get_video_scale_permission(dvdnav_t *this) {
@@ -1079,13 +1079,13 @@ int8_t dvdnav_get_audio_logical_stream(dvdnav_t *this, uint8_t audio_num) {
 dvdnav_status_t dvdnav_get_audio_attr(dvdnav_t *this, uint8_t audio_num, audio_attr_t *audio_attr) {
   if(!this->started) {
     printerr("Virtual DVD machine not started.");
-    return -1;
+    return DVDNAV_STATUS_ERR;
   }
   pthread_mutex_lock(&this->vm_lock);
   if (!this->vm->state.pgc) {
     printerr("No current PGC.");
     pthread_mutex_unlock(&this->vm_lock);
-    return -1;
+    return DVDNAV_STATUS_ERR;
   }
   *audio_attr=vm_get_audio_attr(this->vm, audio_num);
   pthread_mutex_unlock(&this->vm_lock);
@@ -1116,13 +1116,13 @@ int8_t dvdnav_get_spu_logical_stream(dvdnav_t *this, uint8_t subp_num) {
 dvdnav_status_t dvdnav_get_spu_attr(dvdnav_t *this, uint8_t audio_num, subp_attr_t *subp_attr) {
   if(!this->started) {
     printerr("Virtual DVD machine not started.");
-    return -1;
+    return DVDNAV_STATUS_ERR;
   }
   pthread_mutex_lock(&this->vm_lock);
   if (!this->vm->state.pgc) {
     printerr("No current PGC.");
     pthread_mutex_unlock(&this->vm_lock);
-    return -1;
+    return DVDNAV_STATUS_ERR;
   }
   *subp_attr=vm_get_subp_attr(this->vm, audio_num);
   pthread_mutex_unlock(&this->vm_lock);


=====================================
src/dvdnav/dvdnav.h
=====================================
--- a/src/dvdnav/dvdnav.h
+++ b/src/dvdnav/dvdnav.h
@@ -571,7 +571,7 @@ 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);
+dvdnav_status_t dvdnav_get_video_resolution(dvdnav_t *self, uint32_t *width, uint32_t *height);
 
 /*
  * Get video scaling permissions.



View it on GitLab: https://code.videolan.org/videolan/libdvdnav/compare/0e0ed2a574779ab5870b728c780dde1a233caca8...0f6e70895cef951d4aa1589f473f80c420998804

---
View it on GitLab: https://code.videolan.org/videolan/libdvdnav/compare/0e0ed2a574779ab5870b728c780dde1a233caca8...0f6e70895cef951d4aa1589f473f80c420998804
You're receiving this email because of your account on code.videolan.org.


More information about the libdvdnav-devel mailing list