mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-27 01:28:34 +00:00
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
This commit is contained in:
parent
9542d9e251
commit
874549b536
1 changed files with 25 additions and 9 deletions
|
@ -1172,6 +1172,7 @@ static RsnNavResult
|
||||||
rsn_dvdsrc_do_command (resinDvdSrc * src, GstNavigationCommand command)
|
rsn_dvdsrc_do_command (resinDvdSrc * src, GstNavigationCommand command)
|
||||||
{
|
{
|
||||||
RsnNavResult result = RSN_NAV_RESULT_NONE;
|
RsnNavResult result = RSN_NAV_RESULT_NONE;
|
||||||
|
gint new_angle = 0;
|
||||||
|
|
||||||
switch (command) {
|
switch (command) {
|
||||||
case GST_NAVIGATION_COMMAND_DVD_MENU:
|
case GST_NAVIGATION_COMMAND_DVD_MENU:
|
||||||
|
@ -1212,25 +1213,40 @@ rsn_dvdsrc_do_command (resinDvdSrc * src, GstNavigationCommand command)
|
||||||
|
|
||||||
case GST_NAVIGATION_COMMAND_PREV_ANGLE:{
|
case GST_NAVIGATION_COMMAND_PREV_ANGLE:{
|
||||||
gint32 cur, agls;
|
gint32 cur, agls;
|
||||||
if (dvdnav_get_angle_info (src->dvdnav, &cur, &agls) == DVDNAV_STATUS_OK
|
if (dvdnav_get_angle_info (src->dvdnav, &cur, &agls) == DVDNAV_STATUS_OK) {
|
||||||
&& cur > 0
|
if (cur > 0 &&
|
||||||
&& dvdnav_angle_change (src->dvdnav, cur - 1) == DVDNAV_STATUS_OK)
|
dvdnav_angle_change (src->dvdnav, cur - 1) == DVDNAV_STATUS_OK) {
|
||||||
GST_INFO_OBJECT (src, "Switched to angle %d", cur - 1);
|
new_angle = cur - 1;
|
||||||
/* Angle switches are seamless and involve no branching */
|
} 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;
|
break;
|
||||||
}
|
}
|
||||||
case GST_NAVIGATION_COMMAND_NEXT_ANGLE:{
|
case GST_NAVIGATION_COMMAND_NEXT_ANGLE:{
|
||||||
gint32 cur, agls;
|
gint32 cur, agls;
|
||||||
if (dvdnav_get_angle_info (src->dvdnav, &cur, &agls) == DVDNAV_STATUS_OK
|
if (dvdnav_get_angle_info (src->dvdnav, &cur, &agls) == DVDNAV_STATUS_OK) {
|
||||||
&& dvdnav_angle_change (src->dvdnav, cur + 1) == DVDNAV_STATUS_OK)
|
if (cur < agls
|
||||||
GST_INFO_OBJECT (src, "Switched to angle %d", cur + 1);
|
&& dvdnav_angle_change (src->dvdnav, cur + 1) == DVDNAV_STATUS_OK) {
|
||||||
/* Angle switches are seamless and involve no branching */
|
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;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (new_angle) {
|
||||||
|
GST_INFO_OBJECT (src, "Switched to angle %d", new_angle);
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue