summaryrefslogtreecommitdiffstats
path: root/ext/resindvd
diff options
context:
space:
mode:
authorJan Schmidt <thaytan@noraisin.net>2009-05-05 11:34:26 +0100
committerJan Schmidt <thaytan@noraisin.net>2009-05-06 20:19:48 +0100
commit874549b5360ad897e11f809e929d62803a7b5f2f (patch)
tree82e35568f82ba1c83f490a37ea453d5f293862cc /ext/resindvd
parent9542d9e2513c0d88a8de65c7585e0d81b7249dda (diff)
downloadgst-plugins-bad-874549b5360ad897e11f809e929d62803a7b5f2f.tar.gz
gst-plugins-bad-874549b5360ad897e11f809e929d62803a7b5f2f.tar.bz2
gst-plugins-bad-874549b5360ad897e11f809e929d62803a7b5f2f.zip
resindvd: Make the next/prev angle switching cycle at the ends
When the current angle is 1 and prev_angle is requested, loop to the maximum angle and vice versa for next_angle
Diffstat (limited to 'ext/resindvd')
-rw-r--r--ext/resindvd/resindvdsrc.c34
1 files changed, 25 insertions, 9 deletions
diff --git a/ext/resindvd/resindvdsrc.c b/ext/resindvd/resindvdsrc.c
index a2f31610..ab0fdef9 100644
--- a/ext/resindvd/resindvdsrc.c
+++ b/ext/resindvd/resindvdsrc.c
@@ -1172,6 +1172,7 @@ static RsnNavResult
rsn_dvdsrc_do_command (resinDvdSrc * src, GstNavigationCommand command)
{
RsnNavResult result = RSN_NAV_RESULT_NONE;
+ gint new_angle = 0;
switch (command) {
case GST_NAVIGATION_COMMAND_DVD_MENU:
@@ -1212,25 +1213,40 @@ rsn_dvdsrc_do_command (resinDvdSrc * src, GstNavigationCommand command)
case GST_NAVIGATION_COMMAND_PREV_ANGLE:{
gint32 cur, agls;
- if (dvdnav_get_angle_info (src->dvdnav, &cur, &agls) == DVDNAV_STATUS_OK
- && cur > 0
- && dvdnav_angle_change (src->dvdnav, cur - 1) == DVDNAV_STATUS_OK)
- GST_INFO_OBJECT (src, "Switched to angle %d", cur - 1);
- /* Angle switches are seamless and involve no branching */
+ if (dvdnav_get_angle_info (src->dvdnav, &cur, &agls) == DVDNAV_STATUS_OK) {
+ if (cur > 0 &&
+ dvdnav_angle_change (src->dvdnav, cur - 1) == DVDNAV_STATUS_OK) {
+ new_angle = cur - 1;
+ } else if (cur == 1 &&
+ dvdnav_angle_change (src->dvdnav, agls) == DVDNAV_STATUS_OK) {
+ new_angle = agls;
+ }
+ /* Angle switches are seamless and involve no branching */
+ }
break;
}
case GST_NAVIGATION_COMMAND_NEXT_ANGLE:{
gint32 cur, agls;
- if (dvdnav_get_angle_info (src->dvdnav, &cur, &agls) == DVDNAV_STATUS_OK
- && dvdnav_angle_change (src->dvdnav, cur + 1) == DVDNAV_STATUS_OK)
- GST_INFO_OBJECT (src, "Switched to angle %d", cur + 1);
- /* Angle switches are seamless and involve no branching */
+ if (dvdnav_get_angle_info (src->dvdnav, &cur, &agls) == DVDNAV_STATUS_OK) {
+ if (cur < agls
+ && dvdnav_angle_change (src->dvdnav, cur + 1) == DVDNAV_STATUS_OK) {
+ new_angle = cur + 1;
+ } else if (cur == agls
+ && dvdnav_angle_change (src->dvdnav, 1) == DVDNAV_STATUS_OK) {
+ new_angle = 1;
+ }
+ /* Angle switches are seamless and involve no branching */
+ }
break;
}
default:
break;
}
+ if (new_angle) {
+ GST_INFO_OBJECT (src, "Switched to angle %d", new_angle);
+ }
+
return result;
}