| | 65 | input_thread_t *p_input_thread = GetInputThread(p_input, p_exception); |
|---|
| | 66 | vout_thread_t *p_vout = NULL; |
|---|
| | 67 | |
|---|
| | 68 | if( p_input_thread ) |
|---|
| | 69 | { |
|---|
| | 70 | p_vout = vlc_object_find( p_input_thread, VLC_OBJECT_VOUT, FIND_CHILD ); |
|---|
| | 71 | if( !p_vout ) |
|---|
| | 72 | { |
|---|
| | 73 | libvlc_exception_raise( p_exception, "No active video output" ); |
|---|
| | 74 | } |
|---|
| | 75 | vlc_object_release( p_input_thread ); |
|---|
| | 76 | } |
|---|
| | 77 | return p_vout; |
|---|
| | 78 | } |
|---|
| | 79 | |
|---|
| | 80 | /********************************************************************** |
|---|
| | 81 | * Exported functions |
|---|
| | 82 | **********************************************************************/ |
|---|
| | 83 | |
|---|
| | 84 | void libvlc_set_fullscreen( libvlc_input_t *p_input, int b_fullscreen, |
|---|
| | 85 | libvlc_exception_t *p_e ) |
|---|
| | 86 | { |
|---|
| | 87 | /* We only work on the first vout */ |
|---|
| | 88 | vout_thread_t *p_vout1 = GetVout( p_input, p_e ); |
|---|
| | 89 | vlc_value_t val; int i_ret; |
|---|
| | 90 | |
|---|
| | 91 | /* GetVout will raise the exception for us */ |
|---|
| | 92 | if( !p_vout1 ) |
|---|
| | 93 | { |
|---|
| | 94 | return; |
|---|
| | 95 | } |
|---|
| | 96 | |
|---|
| | 97 | if( b_fullscreen ) val.b_bool = VLC_TRUE; |
|---|
| | 98 | else val.b_bool = VLC_FALSE; |
|---|
| | 99 | |
|---|
| | 100 | i_ret = var_Set( p_vout1, "fullscreen", val ); |
|---|
| | 101 | if( i_ret ) |
|---|
| | 102 | libvlc_exception_raise( p_e, |
|---|
| | 103 | "Unexpected error while setting fullscreen value" ); |
|---|
| | 104 | |
|---|
| | 105 | vlc_object_release( p_vout1 ); |
|---|
| | 106 | } |
|---|
| | 107 | |
|---|
| | 108 | int libvlc_get_fullscreen( libvlc_input_t *p_input, |
|---|
| | 109 | libvlc_exception_t *p_e ) |
|---|
| | 110 | { |
|---|
| | 111 | /* We only work on the first vout */ |
|---|
| | 112 | vout_thread_t *p_vout1 = GetVout( p_input, p_e ); |
|---|
| | 113 | vlc_value_t val; int i_ret; |
|---|
| | 114 | |
|---|
| | 115 | /* GetVout will raise the exception for us */ |
|---|
| | 116 | if( !p_vout1 ) |
|---|
| | 117 | return 0; |
|---|
| | 118 | |
|---|
| | 119 | i_ret = var_Get( p_vout1, "fullscreen", &val ); |
|---|
| | 120 | if( i_ret ) |
|---|
| | 121 | libvlc_exception_raise( p_e, |
|---|
| | 122 | "Unexpected error while looking up fullscreen value" ); |
|---|
| | 123 | |
|---|
| | 124 | return val.b_bool == VLC_TRUE ? 1 : 0; |
|---|
| | 125 | } |
|---|
| | 126 | |
|---|
| | 127 | void libvlc_toggle_fullscreen( libvlc_input_t *p_input, |
|---|
| | 128 | libvlc_exception_t *p_e ) |
|---|
| | 129 | { |
|---|
| | 130 | /* We only work on the first vout */ |
|---|
| | 131 | vout_thread_t *p_vout1 = GetVout( p_input, p_e ); |
|---|
| | 132 | vlc_value_t val; int i_ret; |
|---|
| | 133 | |
|---|
| | 134 | /* GetVout will raise the exception for us */ |
|---|
| | 135 | if( !p_vout1 ) |
|---|
| | 136 | return; |
|---|
| | 137 | |
|---|
| | 138 | i_ret = var_Get( p_vout1, "fullscreen", &val ); |
|---|
| | 139 | if( i_ret ) |
|---|
| | 140 | libvlc_exception_raise( p_e, |
|---|
| | 141 | "Unexpected error while looking up fullscreen value" ); |
|---|
| | 142 | |
|---|
| | 143 | val.b_bool = !val.b_bool; |
|---|
| | 144 | i_ret = var_Set( p_vout1, "fullscreen", val ); |
|---|
| | 145 | if( i_ret ) |
|---|
| | 146 | libvlc_exception_raise( p_e, |
|---|
| | 147 | "Unexpected error while setting fullscreen value" ); |
|---|
| | 148 | |
|---|
| | 149 | vlc_object_release( p_vout1 ); |
|---|
| | 150 | } |
|---|
| | 151 | |
|---|
| | 152 | void |
|---|
| | 153 | libvlc_video_take_snapshot( libvlc_input_t *p_input, char *psz_filepath, |
|---|
| | 154 | libvlc_exception_t *p_e ) |
|---|
| | 155 | { |
|---|
| | 156 | vout_thread_t *p_vout = GetVout( p_input, p_e ); |
|---|
| 52 | | libvlc_exception_raise( p_exception, "Input does not exist" ); |
|---|
| 53 | | return NULL; |
|---|
| 54 | | } |
|---|
| 55 | | |
|---|
| 56 | | p_vout = vlc_object_find( p_input_thread, VLC_OBJECT_VOUT, FIND_CHILD ); |
|---|
| 57 | | if( !p_vout ) |
|---|
| 58 | | { |
|---|
| 59 | | vlc_object_release( p_input_thread ); |
|---|
| 60 | | libvlc_exception_raise( p_exception, "No active video output" ); |
|---|
| 61 | | return NULL; |
|---|
| 62 | | } |
|---|
| 63 | | vlc_object_release( p_input_thread ); |
|---|
| 64 | | |
|---|
| 65 | | return p_vout; |
|---|
| 66 | | } |
|---|
| 67 | | /********************************************************************** |
|---|
| 68 | | * Exported functions |
|---|
| 69 | | **********************************************************************/ |
|---|
| 70 | | |
|---|
| 71 | | void libvlc_set_fullscreen( libvlc_input_t *p_input, int b_fullscreen, |
|---|
| 72 | | libvlc_exception_t *p_e ) |
|---|
| 73 | | { |
|---|
| 74 | | /* We only work on the first vout */ |
|---|
| 75 | | vout_thread_t *p_vout1 = GetVout( p_input, p_e ); |
|---|
| 76 | | vlc_value_t val; int i_ret; |
|---|
| 77 | | |
|---|
| 78 | | /* GetVout will raise the exception for us */ |
|---|
| 79 | | if( !p_vout1 ) |
|---|
| 80 | | { |
|---|
| 81 | | return; |
|---|
| 82 | | } |
|---|
| 83 | | |
|---|
| 84 | | if( b_fullscreen ) val.b_bool = VLC_TRUE; |
|---|
| 85 | | else val.b_bool = VLC_FALSE; |
|---|
| 86 | | |
|---|
| 87 | | i_ret = var_Set( p_vout1, "fullscreen", val ); |
|---|
| 88 | | if( i_ret ) |
|---|
| 89 | | libvlc_exception_raise( p_e, |
|---|
| 90 | | "Unexpected error while setting fullscreen value" ); |
|---|
| 91 | | |
|---|
| 92 | | vlc_object_release( p_vout1 ); |
|---|
| 93 | | } |
|---|
| 94 | | |
|---|
| 95 | | int libvlc_get_fullscreen( libvlc_input_t *p_input, |
|---|
| 96 | | libvlc_exception_t *p_e ) |
|---|
| 97 | | { |
|---|
| 98 | | /* We only work on the first vout */ |
|---|
| 99 | | vout_thread_t *p_vout1 = GetVout( p_input, p_e ); |
|---|
| 100 | | vlc_value_t val; int i_ret; |
|---|
| 101 | | |
|---|
| 102 | | /* GetVout will raise the exception for us */ |
|---|
| 103 | | if( !p_vout1 ) |
|---|
| 104 | | return 0; |
|---|
| 105 | | |
|---|
| 106 | | i_ret = var_Get( p_vout1, "fullscreen", &val ); |
|---|
| 107 | | if( i_ret ) |
|---|
| 108 | | libvlc_exception_raise( p_e, |
|---|
| 109 | | "Unexpected error while looking up fullscreen value" ); |
|---|
| 110 | | |
|---|
| 111 | | return val.b_bool == VLC_TRUE ? 1 : 0; |
|---|
| 112 | | } |
|---|
| 113 | | |
|---|
| 114 | | void libvlc_toggle_fullscreen( libvlc_input_t *p_input, |
|---|
| 115 | | libvlc_exception_t *p_e ) |
|---|
| 116 | | { |
|---|
| 117 | | /* We only work on the first vout */ |
|---|
| 118 | | vout_thread_t *p_vout1 = GetVout( p_input, p_e ); |
|---|
| 119 | | vlc_value_t val; int i_ret; |
|---|
| 120 | | |
|---|
| 121 | | /* GetVout will raise the exception for us */ |
|---|
| 122 | | if( !p_vout1 ) |
|---|
| 123 | | return; |
|---|
| 124 | | |
|---|
| 125 | | i_ret = var_Get( p_vout1, "fullscreen", &val ); |
|---|
| 126 | | if( i_ret ) |
|---|
| 127 | | libvlc_exception_raise( p_e, |
|---|
| 128 | | "Unexpected error while looking up fullscreen value" ); |
|---|
| 129 | | |
|---|
| 130 | | val.b_bool = !val.b_bool; |
|---|
| 131 | | i_ret = var_Set( p_vout1, "fullscreen", val ); |
|---|
| 132 | | if( i_ret ) |
|---|
| 133 | | libvlc_exception_raise( p_e, |
|---|
| 134 | | "Unexpected error while setting fullscreen value" ); |
|---|
| 135 | | |
|---|
| 136 | | vlc_object_release( p_vout1 ); |
|---|
| 137 | | } |
|---|
| 138 | | |
|---|
| 139 | | void |
|---|
| 140 | | libvlc_video_take_snapshot( libvlc_input_t *p_input, char *psz_filepath, |
|---|
| 141 | | libvlc_exception_t *p_e ) |
|---|
| 142 | | { |
|---|
| 143 | | vout_thread_t *p_vout = GetVout( p_input, p_e ); |
|---|
| 144 | | input_thread_t *p_input_thread; |
|---|
| 145 | | |
|---|
| 146 | | char path[256]; |
|---|
| 147 | | |
|---|
| 148 | | /* GetVout will raise the exception for us */ |
|---|
| 149 | | if( !p_vout ) |
|---|
| 150 | | { |
|---|
| 151 | | return; |
|---|
| 152 | | } |
|---|
| 153 | | |
|---|
| 154 | | p_input_thread = (input_thread_t*)vlc_object_get( |
|---|
| 155 | | p_input->p_instance->p_libvlc_int, |
|---|
| 156 | | p_input->i_input_id ); |
|---|
| 157 | | if( !p_input_thread ) |
|---|
| 158 | | { |
|---|