{
intf_sys_t *p_sys = p_intf->p_sys;
vlc_value_t val;
-
- #define ReturnTrue \
- do { \
- pl_Release( p_intf ); \
- return 1; \
- } while(0)
-
- #define ReturnFalse \
- do { \
- pl_Release( p_intf ); \
- return 0; \
- } while(0)
+ int i_ret = 1;
playlist_t *p_playlist = pl_Hold( p_intf );
var_Get( p_playlist, "random", &val );
val.b_bool = !val.b_bool;
var_Set( p_playlist, "random", val );
- ReturnTrue;
+ goto end;
case 'l':
var_Get( p_playlist, "loop", &val );
val.b_bool = !val.b_bool;
var_Set( p_playlist, "loop", val );
- ReturnTrue;
+ goto end;
case 'R':
var_Get( p_playlist, "repeat", &val );
val.b_bool = !val.b_bool;
var_Set( p_playlist, "repeat", val );
- ReturnTrue;
+ goto end;
/* Playlist sort */
case 'o':
PlaylistGetRoot( p_intf ),
SORT_TITLE_NODES_FIRST, ORDER_NORMAL );
p_sys->b_need_update = true;
- ReturnTrue;
+ goto end;
case 'O':
playlist_RecursiveNodeSort( p_playlist,
PlaylistGetRoot( p_intf ),
SORT_TITLE_NODES_FIRST, ORDER_REVERSE );
p_sys->b_need_update = true;
- ReturnTrue;
+ goto end;
/* Playlist view */
case 'v':
}
//p_sys->b_need_update = true;
PlaylistRebuild( p_intf );
- ReturnTrue;
+ goto end;
/* Playlist navigation */
case 'g':
b_box_plidx_follow = true;
PL_UNLOCK;
p_sys->b_box_plidx_follow = b_box_plidx_follow;
- ReturnTrue;
+ goto end;
}
}
if( p_sys->i_box_type == BOX_BROWSE )
{
if( p_sys->i_box_bidx >= p_sys->i_dir_entries ) p_sys->i_box_bidx = p_sys->i_dir_entries - 1;
if( p_sys->i_box_bidx < 0 ) p_sys->i_box_bidx = 0;
- ReturnTrue;
+ goto end;
}
}
else if( p_sys->i_box_type == BOX_HELP || p_sys->i_box_type == BOX_INFO ||
{
case KEY_HOME:
p_sys->i_box_start = 0;
- ReturnTrue;
+ goto end;
#ifdef __FreeBSD__
case KEY_SELECT:
#endif
case KEY_END:
p_sys->i_box_start = p_sys->i_box_lines_total - 1;
- ReturnTrue;
+ goto end;
case KEY_UP:
if( p_sys->i_box_start > 0 ) p_sys->i_box_start--;
- ReturnTrue;
+ goto end;
case KEY_DOWN:
if( p_sys->i_box_start < p_sys->i_box_lines_total - 1 )
{
p_sys->i_box_start++;
}
- ReturnTrue;
+ goto end;
case KEY_PPAGE:
p_sys->i_box_start -= p_sys->i_box_lines;
if( p_sys->i_box_start < 0 ) p_sys->i_box_start = 0;
- ReturnTrue;
+ goto end;
case KEY_NPAGE:
p_sys->i_box_start += p_sys->i_box_lines;
if( p_sys->i_box_start >= p_sys->i_box_lines_total )
{
p_sys->i_box_start = p_sys->i_box_lines_total - 1;
}
- ReturnTrue;
+ goto end;
default:
break;
}
case KEY_HOME:
p_sys->f_slider = 0;
ManageSlider( p_intf );
- ReturnTrue;
+ goto end;
#ifdef __FreeBSD__
case KEY_SELECT:
#endif
case KEY_END:
p_sys->f_slider = 99.9;
ManageSlider( p_intf );
- ReturnTrue;
+ goto end;
case KEY_UP:
p_sys->f_slider += 5.0;
if( p_sys->f_slider >= 99.0 ) p_sys->f_slider = 99.0;
ManageSlider( p_intf );
- ReturnTrue;
+ goto end;
case KEY_DOWN:
p_sys->f_slider -= 5.0;
if( p_sys->f_slider < 0.0 ) p_sys->f_slider = 0.0;
ManageSlider( p_intf );
- ReturnTrue;
+ goto end;
default:
break;
case KEY_CLEAR:
case 0x0c: /* ^l */
clear();
- ReturnTrue;
+ goto end;
case KEY_ENTER:
case '\r':
case '\n':
SearchPlaylist( p_intf, p_sys->psz_old_search );
}
p_sys->i_box_type = BOX_PLAYLIST;
- ReturnTrue;
+ goto end;
case 0x1b: /* ESC */
/* Alt+key combinations return 2 keys in the terminal keyboard:
* ESC, and the 2nd key.
*
*/
if( wgetch( p_sys->w ) != ERR )
- ReturnFalse;
+ {
+ i_ret = 0;
+ goto end;
+ }
p_sys->i_box_plidx = p_sys->i_before_search;
p_sys->i_box_type = BOX_PLAYLIST;
- ReturnTrue;
+ goto end;
case KEY_BACKSPACE:
case 0x7f:
RemoveLastUTF8Entity( p_sys->psz_search_chain, i_chain_len );
free( p_sys->psz_old_search );
p_sys->psz_old_search = NULL;
SearchPlaylist( p_intf, p_sys->psz_search_chain );
- ReturnTrue;
+ goto end;
}
else if( p_sys->i_box_type == BOX_OPEN && p_sys->psz_open_chain )
{
case KEY_CLEAR:
case 0x0c: /* ^l */
clear();
- ReturnTrue;
+ break;
case KEY_ENTER:
case '\r':
case '\n':
p_sys->b_box_plidx_follow = true;
}
p_sys->i_box_type = BOX_PLAYLIST;
- ReturnTrue;
+ break;
case 0x1b: /* ESC */
if( wgetch( p_sys->w ) != ERR )
- ReturnFalse;
+ {
+ i_ret = 0;
+ break;
+ }
p_sys->i_box_type = BOX_PLAYLIST;
- ReturnTrue;
+ break;
case KEY_BACKSPACE:
case 0x7f:
RemoveLastUTF8Entity( p_sys->psz_open_chain, i_chain_len );
free( psz_utf8 );
}
#endif
- break;
}
}
- ReturnTrue;
+ goto end;
}
{
case 0x1b: /* ESC */
if( wgetch( p_sys->w ) != ERR )
- ReturnFalse;
+ {
+ i_ret = 0;
+ break;
+ }
case 'q':
case 'Q':
case KEY_EXIT:
libvlc_Quit( p_intf->p_libvlc );
- ReturnFalse;
+ i_ret = 0;
+ break;
/* Box switching */
case 'i':
else
p_sys->i_box_type = BOX_INFO;
p_sys->i_box_lines_total = 0;
- ReturnTrue;
+ break;
case 'm':
if( p_sys->i_box_type == BOX_META )
p_sys->i_box_type = BOX_NONE;
else
p_sys->i_box_type = BOX_META;
p_sys->i_box_lines_total = 0;
- ReturnTrue;
+ break;
case 'L':
if( p_sys->i_box_type == BOX_LOG )
p_sys->i_box_type = BOX_NONE;
else
p_sys->i_box_type = BOX_LOG;
- ReturnTrue;
+ break;
case 'P':
if( p_sys->i_box_type == BOX_PLAYLIST )
p_sys->i_box_type = BOX_NONE;
else
p_sys->i_box_type = BOX_PLAYLIST;
- ReturnTrue;
+ break;
case 'B':
if( p_sys->i_box_type == BOX_BROWSE )
p_sys->i_box_type = BOX_NONE;
else
p_sys->i_box_type = BOX_BROWSE;
- ReturnTrue;
+ break;
case 'x':
if( p_sys->i_box_type == BOX_OBJECTS )
p_sys->i_box_type = BOX_NONE;
else
p_sys->i_box_type = BOX_OBJECTS;
- ReturnTrue;
+ break;
case 'S':
if( p_sys->i_box_type == BOX_STATS )
p_sys->i_box_type = BOX_NONE;
else
p_sys->i_box_type = BOX_STATS;
- ReturnTrue;
+ break;
case 'c':
p_sys->b_color = !p_sys->b_color;
if( p_sys->b_color && !p_sys->b_color_started )
start_color_and_pairs( p_intf );
- ReturnTrue;
+ break;
case 'h':
case 'H':
if( p_sys->i_box_type == BOX_HELP )
else
p_sys->i_box_type = BOX_HELP;
p_sys->i_box_lines_total = 0;
- ReturnTrue;
+ break;
case '/':
if( p_sys->i_box_type != BOX_SEARCH )
{
- if( p_sys->psz_search_chain == NULL )
- ReturnTrue;
- p_sys->psz_search_chain[0] = '\0';
- p_sys->b_box_plidx_follow = false;
- p_sys->i_before_search = p_sys->i_box_plidx;
- p_sys->i_box_type = BOX_SEARCH;
+ if( p_sys->psz_search_chain )
+ {
+ p_sys->psz_search_chain[0] = '\0';
+ p_sys->b_box_plidx_follow = false;
+ p_sys->i_before_search = p_sys->i_box_plidx;
+ p_sys->i_box_type = BOX_SEARCH;
+ }
}
- ReturnTrue;
+ break;
case 'A': /* Open */
if( p_sys->i_box_type != BOX_OPEN )
{
- if( p_sys->psz_open_chain == NULL )
- ReturnTrue;
- p_sys->psz_open_chain[0] = '\0';
- p_sys->i_box_type = BOX_OPEN;
+ if( p_sys->psz_open_chain )
+ {
+ p_sys->psz_open_chain[0] = '\0';
+ p_sys->i_box_type = BOX_OPEN;
+ }
}
- ReturnTrue;
+ break;
/* Navigation */
case KEY_RIGHT:
p_sys->f_slider += 1.0;
if( p_sys->f_slider > 99.9 ) p_sys->f_slider = 99.9;
ManageSlider( p_intf );
- ReturnTrue;
+ break;
case KEY_LEFT:
p_sys->f_slider -= 1.0;
if( p_sys->f_slider < 0.0 ) p_sys->f_slider = 0.0;
ManageSlider( p_intf );
- ReturnTrue;
+ break;
/* Common control */
case 'f':
var_Set( p_playlist, "fullscreen", val );
}
}
- ReturnFalse;
+ i_ret = 0;
+ break;
}
case ' ':
PlayPause( p_intf );
- ReturnTrue;
+ break;
case 's':
playlist_Stop( p_playlist );
- ReturnTrue;
+ break;
case 'e':
Eject( p_intf );
- ReturnTrue;
+ break;
case '[':
if( p_sys->p_input )
var_SetVoid( p_sys->p_input, "prev-title" );
- ReturnTrue;
+ break;
case ']':
if( p_sys->p_input )
var_SetVoid( p_sys->p_input, "next-title" );
- ReturnTrue;
+ break;
case '<':
if( p_sys->p_input )
var_SetVoid( p_sys->p_input, "prev-chapter" );
- ReturnTrue;
+ break;
case '>':
if( p_sys->p_input )
var_SetVoid( p_sys->p_input, "next-chapter" );
- ReturnTrue;
+ break;
case 'p':
playlist_Prev( p_playlist );
clear();
- ReturnTrue;
+ break;
case 'n':
playlist_Next( p_playlist );
clear();
- ReturnTrue;
+ break;
case 'a':
aout_VolumeUp( p_playlist, 1, NULL );
clear();
- ReturnTrue;
+ break;
case 'z':
aout_VolumeDown( p_playlist, 1, NULL );
clear();
- ReturnTrue;
+ break;
/*
* ^l should clear and redraw the screen
case KEY_CLEAR:
case 0x0c: /* ^l */
clear();
- ReturnTrue;
+ break;
default:
- ReturnFalse;
+ i_ret = 0;
}
-#undef ReturnFalse
-#undef ReturnTrue
+
+end:
+ pl_Release( p_intf );
+ return i_ret;
}
static void ManageSlider( intf_thread_t *p_intf )