00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include <sys/types.h>
00028 #include <stdlib.h>
00029 #include <vlc/vlc.h>
00030 #include <vlc/intf.h>
00031 #include <vlc/vout.h>
00032
00033 #include <stdio.h>
00034 #include <string.h>
00035 #include <dirent.h>
00036 #include <sys/stat.h>
00037 #include <unistd.h>
00038 #include <pwd.h>
00039 #include <grp.h>
00040
00041 #ifdef HAVE_CONFIG_H
00042 # include <config.h>
00043 #endif
00044
00045 #include <gtk/gtk.h>
00046
00047 #include "pda_callbacks.h"
00048 #include "pda_interface.h"
00049 #include "pda_support.h"
00050 #include "pda.h"
00051
00052 #define VLC_MAX_MRL 256
00053
00054 static char *get_file_perms(struct stat st);
00055
00056
00057
00058
00059 void * E_(__GtkGetIntf)( GtkWidget * widget )
00060 {
00061 void *p_data;
00062
00063 if( GTK_IS_MENU_ITEM( widget ) )
00064 {
00065
00066 while( widget->parent && !GTK_IS_MENU( widget ) )
00067 {
00068 widget = widget->parent;
00069 }
00070
00071
00072 p_data = gtk_object_get_data( GTK_OBJECT( widget ), "p_intf" );
00073 if( p_data )
00074 {
00075 return p_data;
00076 }
00077
00078
00079 widget = gtk_menu_get_attach_widget( GTK_MENU( widget ) );
00080 }
00081
00082
00083 widget = gtk_widget_get_toplevel( GTK_WIDGET( widget ) );
00084
00085 p_data = gtk_object_get_data( GTK_OBJECT( widget ), "p_intf" );
00086
00087 return p_data;
00088 }
00089
00090 void PlaylistAddItem(GtkWidget *widget, gchar *name, char **ppsz_options, int i_size)
00091 {
00092 intf_thread_t *p_intf = GtkGetIntf( widget );
00093 playlist_t *p_playlist;
00094 int i_id , i_pos=0;
00095 GtkTreeView *p_tvplaylist = NULL;
00096
00097 p_playlist = (playlist_t *)
00098 vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
00099
00100 if( p_playlist == NULL)
00101 {
00102 return;
00103 }
00104
00105
00106 p_tvplaylist = (GtkTreeView *) lookup_widget( GTK_WIDGET(widget), "tvPlaylist");
00107 if (p_tvplaylist)
00108 {
00109 GtkTreeModel *p_play_model;
00110 GtkTreeIter p_play_iter;
00111
00112 p_play_model = gtk_tree_view_get_model(p_tvplaylist);
00113
00114 if (p_play_model)
00115 {
00116 int i;
00117
00118
00119 gtk_list_store_append (GTK_LIST_STORE(p_play_model), &p_play_iter);
00120 gtk_list_store_set (GTK_LIST_STORE(p_play_model), &p_play_iter,
00121 0, name,
00122 1, "no info",
00123 2, p_playlist->i_size,
00124 -1 );
00125
00126
00127 #if 0
00128 if (p_intf->p_sys->b_autoplayfile)
00129 {
00130 playlist_Add( p_playlist, (const char*)name, (const char**)ppsz_options, i_size,
00131 PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END);
00132 }
00133 else
00134 #endif
00135 {
00136 i_id = playlist_AddExt( p_playlist, (const char*)name,
00137 (const char*)name,
00138 PLAYLIST_APPEND, PLAYLIST_END,
00139 (mtime_t) 0,
00140 (const char **) ppsz_options, i_pos );
00141 }
00142
00143
00144 for (i=0; i<i_size; i++)
00145 free(ppsz_options[i]);
00146 free(ppsz_options);
00147 }
00148 }
00149 vlc_object_release( p_playlist );
00150 }
00151
00152 void PlaylistRebuildListStore( GtkListStore * p_list, playlist_t * p_playlist )
00153 {
00154 GtkTreeIter iter;
00155 int i_dummy;
00156 gchar * ppsz_text[2];
00157 #if 0
00158 GdkColor red;
00159 red.red = 65535;
00160 red.blue = 0;
00161 red.green = 0;
00162 #endif
00163 vlc_mutex_lock( &p_playlist->object_lock );
00164 for( i_dummy = 0; i_dummy < p_playlist->i_size ; i_dummy++ )
00165 {
00166 ppsz_text[0] = p_playlist->pp_items[i_dummy]->input.psz_name;
00167 ppsz_text[1] = "no info";
00168 gtk_list_store_append (p_list, &iter);
00169 gtk_list_store_set (p_list, &iter,
00170 0, ppsz_text[0],
00171 1, ppsz_text[1],
00172 2, i_dummy,
00173 -1);
00174 }
00175 vlc_mutex_unlock( &p_playlist->object_lock );
00176 }
00177
00178
00179
00180
00181 void ReadDirectory(intf_thread_t *p_intf, GtkListStore *p_list, char *psz_dir )
00182 {
00183 GtkTreeIter iter;
00184 struct dirent **pp_namelist;
00185 struct passwd *p_pw;
00186 struct group *p_grp;
00187 struct stat st;
00188 int n=-1, status=-1;
00189
00190 msg_Dbg(p_intf, "Changing to dir %s", psz_dir);
00191 if (psz_dir)
00192 {
00193 status = chdir(psz_dir);
00194 if (status<0)
00195 msg_Dbg(p_intf, "permision denied" );
00196 }
00197 n = scandir(".", &pp_namelist, 0, alphasort);
00198
00199 if (n<0)
00200 perror("scandir");
00201 else
00202 {
00203 int i;
00204 gchar *ppsz_text[4];
00205
00206 if (lstat("..", &st)==0)
00207 {
00208
00209 p_pw = getpwuid(st.st_uid);
00210 p_grp = getgrgid(st.st_gid);
00211
00212
00213 ppsz_text[0] = "..";
00214 ppsz_text[1] = get_file_perms(st);
00215 ppsz_text[2] = p_pw->pw_name;
00216 ppsz_text[3] = p_grp->gr_name;
00217
00218
00219 gtk_list_store_append (p_list, &iter);
00220 gtk_list_store_set (p_list, &iter,
00221 0, ppsz_text[0],
00222 1, ppsz_text[1],
00223 2, st.st_size,
00224 3, ppsz_text[2],
00225 4, ppsz_text[3],
00226 -1);
00227
00228 if (ppsz_text[1]) free(ppsz_text[1]);
00229 }
00230
00231 for (i=0; i<n; i++)
00232 {
00233 if ((pp_namelist[i]->d_name[0] != '.') &&
00234 (lstat(pp_namelist[i]->d_name, &st)==0))
00235 {
00236
00237 p_pw = getpwuid(st.st_uid);
00238 p_grp = getgrgid(st.st_gid);
00239
00240
00241 ppsz_text[0] = pp_namelist[i]->d_name;
00242 ppsz_text[1] = get_file_perms(st);
00243 ppsz_text[2] = p_pw->pw_name;
00244 ppsz_text[3] = p_grp->gr_name;
00245 #if 0
00246 msg_Dbg(p_intf, "(%d) file: %s permission: %s user: %s group: %s", i, ppsz_text[0], ppsz_text[1], ppsz_text[2], ppsz_text[3] );
00247 #endif
00248 gtk_list_store_append (p_list, &iter);
00249 gtk_list_store_set (p_list, &iter,
00250 0, ppsz_text[0],
00251 1, ppsz_text[1],
00252 2, st.st_size,
00253 3, ppsz_text[2],
00254 4, ppsz_text[3],
00255 -1);
00256
00257 if (ppsz_text[1]) free(ppsz_text[1]);
00258 }
00259 }
00260 free(pp_namelist);
00261 }
00262 }
00263
00264 static char *get_file_perms(const struct stat st)
00265 {
00266 char *psz_perm;
00267
00268 psz_perm = (char *) malloc(sizeof(char)*10);
00269 strncpy( psz_perm, "----------", sizeof("----------"));
00270
00271
00272 if (S_ISLNK(st.st_mode))
00273 psz_perm[0]= 'l';
00274 else if (S_ISDIR(st.st_mode))
00275 psz_perm[0]= 'd';
00276 else if (S_ISCHR(st.st_mode))
00277 psz_perm[0]= 'c';
00278 else if (S_ISBLK(st.st_mode))
00279 psz_perm[0]= 'b';
00280 else if (S_ISFIFO(st.st_mode))
00281 psz_perm[0]= 'f';
00282 else if (S_ISSOCK(st.st_mode))
00283 psz_perm[0]= 's';
00284 else if (S_ISREG(st.st_mode))
00285 psz_perm[0]= '-';
00286 else
00287 psz_perm[0]= '?';
00288
00289
00290 if (st.st_mode & S_IRUSR)
00291 psz_perm[1]= 'r';
00292 if (st.st_mode & S_IWUSR)
00293 psz_perm[2]= 'w';
00294 if (st.st_mode & S_IXUSR)
00295 {
00296 if (st.st_mode & S_ISUID)
00297 psz_perm[3] = 's';
00298 else
00299 psz_perm[3]= 'x';
00300 }
00301 else if (st.st_mode & S_ISUID)
00302 psz_perm[3] = 'S';
00303
00304 if (st.st_mode & S_IRGRP)
00305 psz_perm[4]= 'r';
00306 if (st.st_mode & S_IWGRP)
00307 psz_perm[5]= 'w';
00308 if (st.st_mode & S_IXGRP)
00309 {
00310 if (st.st_mode & S_ISGID)
00311 psz_perm[6] = 's';
00312 else
00313 psz_perm[6]= 'x';
00314 }
00315 else if (st.st_mode & S_ISGID)
00316 psz_perm[6] = 'S';
00317
00318 if (st.st_mode & S_IROTH)
00319 psz_perm[7]= 'r';
00320 if (st.st_mode & S_IWOTH)
00321 psz_perm[8]= 'w';
00322 if (st.st_mode & S_IXOTH)
00323 {
00324
00325 if (st.st_mode &S_ISVTX)
00326 psz_perm[9] = 't';
00327 else
00328 psz_perm[9]= 'x';
00329 }
00330 else if (st.st_mode &S_ISVTX)
00331 psz_perm[9]= 'T';
00332
00333 return psz_perm;
00334 }
00335
00336
00337
00338
00339
00340 gboolean onPDADeleteEvent(GtkWidget *widget, GdkEvent *event, gpointer user_data)
00341 {
00342 intf_thread_t *p_intf = GtkGetIntf( widget );
00343
00344 vlc_mutex_lock( &p_intf->change_lock );
00345 p_intf->p_vlc->b_die = VLC_TRUE;
00346 vlc_mutex_unlock( &p_intf->change_lock );
00347 msg_Dbg( p_intf, "about to exit vlc ... signaled" );
00348
00349 return TRUE;
00350 }
00351
00352
00353 void onRewind(GtkButton *button, gpointer user_data)
00354 {
00355 intf_thread_t *p_intf = GtkGetIntf( button );
00356
00357 if (p_intf->p_sys->p_input != NULL)
00358 {
00359 var_SetVoid( p_intf->p_sys->p_input, "rate-slower" );
00360 }
00361 }
00362
00363
00364 void onPause(GtkButton *button, gpointer user_data)
00365 {
00366 intf_thread_t *p_intf = GtkGetIntf( button );
00367
00368 if (p_intf->p_sys->p_input != NULL)
00369 {
00370 var_SetInteger( p_intf->p_sys->p_input, "state", PAUSE_S );
00371 }
00372 }
00373
00374
00375 void onPlay(GtkButton *button, gpointer user_data)
00376 {
00377 intf_thread_t *p_intf = GtkGetIntf( GTK_WIDGET( button ) );
00378 playlist_t *p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
00379
00380 if (p_playlist)
00381 {
00382 vlc_mutex_lock( &p_playlist->object_lock );
00383 if (p_playlist->i_size)
00384 {
00385 vlc_mutex_unlock( &p_playlist->object_lock );
00386 playlist_Play( p_playlist );
00387 gdk_window_lower( p_intf->p_sys->p_window->window );
00388 }
00389 else
00390 {
00391 vlc_mutex_unlock( &p_playlist->object_lock );
00392 }
00393 vlc_object_release( p_playlist );
00394 }
00395 }
00396
00397
00398 void onStop(GtkButton *button, gpointer user_data)
00399 {
00400 intf_thread_t *p_intf = GtkGetIntf( GTK_WIDGET( button ) );
00401 playlist_t *p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
00402 FIND_ANYWHERE );
00403 if (p_playlist)
00404 {
00405 playlist_Stop( p_playlist );
00406 vlc_object_release( p_playlist );
00407 gdk_window_raise( p_intf->p_sys->p_window->window );
00408 }
00409 }
00410
00411
00412 void onForward(GtkButton *button, gpointer user_data)
00413 {
00414 intf_thread_t *p_intf = GtkGetIntf( button );
00415
00416 if (p_intf->p_sys->p_input != NULL)
00417 {
00418 var_SetVoid( p_intf->p_sys->p_input, "rate-faster" );
00419 }
00420 }
00421
00422
00423 void onAbout(GtkButton *button, gpointer user_data)
00424 {
00425 intf_thread_t *p_intf = GtkGetIntf( GTK_WIDGET(button) );
00426
00427
00428 if (p_intf->p_sys->p_notebook)
00429 {
00430 gtk_widget_show( GTK_WIDGET(p_intf->p_sys->p_notebook) );
00431 gtk_notebook_set_page(p_intf->p_sys->p_notebook,6);
00432 }
00433 }
00434
00435
00436 gboolean SliderRelease(GtkWidget *widget, GdkEventButton *event, gpointer user_data)
00437 {
00438 intf_thread_t *p_intf = GtkGetIntf( widget );
00439
00440 msg_Dbg( p_intf, "SliderButton Release" );
00441 vlc_mutex_lock( &p_intf->change_lock );
00442 p_intf->p_sys->b_slider_free = 1;
00443 vlc_mutex_unlock( &p_intf->change_lock );
00444
00445 return TRUE;
00446 }
00447
00448
00449 gboolean SliderPress(GtkWidget *widget, GdkEventButton *event, gpointer user_data)
00450 {
00451 intf_thread_t *p_intf = GtkGetIntf( widget );
00452
00453 msg_Dbg( p_intf, "SliderButton Press" );
00454 vlc_mutex_lock( &p_intf->change_lock );
00455 p_intf->p_sys->b_slider_free = 0;
00456 vlc_mutex_unlock( &p_intf->change_lock );
00457
00458 return TRUE;
00459 }
00460
00461 void SliderMove(GtkRange *range, GtkScrollType scroll, gpointer user_data)
00462 {
00463 intf_thread_t *p_intf = GtkGetIntf( range );
00464 msg_Dbg( p_intf, "SliderButton Move" );
00465 }
00466
00467
00468 void addSelectedToPlaylist(GtkTreeModel *model, GtkTreePath *path,
00469 GtkTreeIter *iter, gpointer *userdata)
00470 {
00471 gchar *psz_filename;
00472
00473 gtk_tree_model_get(model, iter, 0, &psz_filename, -1);
00474
00475 PlaylistAddItem(GTK_WIDGET(userdata), psz_filename, 0, 0);
00476 }
00477
00478 void onFileListRow(GtkTreeView *treeview, GtkTreePath *path,
00479 GtkTreeViewColumn *column, gpointer user_data)
00480 {
00481 intf_thread_t *p_intf = GtkGetIntf( GTK_WIDGET(treeview) );
00482 GtkTreeSelection *p_selection = gtk_tree_view_get_selection(treeview);
00483
00484 if (gtk_tree_selection_count_selected_rows(p_selection) == 1)
00485 {
00486 struct stat st;
00487 GtkTreeModel *p_model;
00488 GtkTreeIter iter;
00489 gchar *psz_filename;
00490
00491
00492 p_model = gtk_tree_view_get_model(treeview);
00493 if (!p_model)
00494 {
00495 msg_Err(p_intf, "PDA: Filelist model contains a NULL pointer\n" );
00496 return;
00497 }
00498 if (!gtk_tree_model_get_iter(p_model, &iter, path))
00499 {
00500 msg_Err( p_intf, "PDA: Could not get iter from model" );
00501 return;
00502 }
00503
00504 gtk_tree_model_get(p_model, &iter, 0, &psz_filename, -1);
00505 if (stat((char*)psz_filename, &st)==0)
00506 {
00507 if (S_ISDIR(st.st_mode))
00508 {
00509 GtkListStore *p_store = NULL;
00510
00511
00512 p_store = gtk_list_store_new (5,
00513 G_TYPE_STRING,
00514 G_TYPE_STRING,
00515 G_TYPE_UINT64,
00516 G_TYPE_STRING,
00517 G_TYPE_STRING);
00518 if (p_store)
00519 {
00520 ReadDirectory(p_intf, p_store, psz_filename);
00521
00522
00523 gtk_tree_view_set_model(treeview, (GtkTreeModel*) p_store);
00524 g_object_unref(p_store);
00525 }
00526 }
00527 }
00528 }
00529 }
00530
00531 void onAddFileToPlaylist(GtkButton *button, gpointer user_data)
00532 {
00533 GtkTreeView *p_treeview = NULL;
00534
00535 p_treeview = (GtkTreeView *) lookup_widget( GTK_WIDGET(button), "tvFileList");
00536 if (p_treeview)
00537 {
00538 GtkTreeSelection *p_selection = gtk_tree_view_get_selection(p_treeview);
00539
00540 gtk_tree_selection_selected_foreach(p_selection, (GtkTreeSelectionForeachFunc) &addSelectedToPlaylist, (gpointer) p_treeview);
00541 }
00542 }
00543
00544
00545 void NetworkBuildMRL(GtkEditable *editable, gpointer user_data)
00546 {
00547 intf_thread_t *p_intf = GtkGetIntf( GTK_WIDGET(editable) );
00548 GtkSpinButton *p_networkPort = NULL;
00549 GtkEntry *p_entryMRL = NULL;
00550 GtkEntry *p_networkType = NULL;
00551 GtkEntry *p_networkAddress = NULL;
00552 GtkEntry *p_networkProtocol = NULL;
00553 const gchar *psz_mrlNetworkType;
00554 const gchar *psz_mrlAddress;
00555 const gchar *psz_mrlProtocol;
00556 gint i_mrlPort;
00557 char text[VLC_MAX_MRL];
00558 int i_pos = 0;
00559
00560 p_entryMRL = (GtkEntry*) lookup_widget( GTK_WIDGET(editable), "entryMRL" );
00561
00562 p_networkType = (GtkEntry*) lookup_widget( GTK_WIDGET(editable), "entryNetworkType" );
00563 p_networkAddress = (GtkEntry*) lookup_widget( GTK_WIDGET(editable), "entryNetworkAddress" );
00564 p_networkPort = (GtkSpinButton*) lookup_widget( GTK_WIDGET(editable), "entryNetworkPort" );
00565 p_networkProtocol = (GtkEntry*) lookup_widget( GTK_WIDGET(editable), "entryNetworkProtocolType" );
00566
00567 psz_mrlNetworkType = gtk_entry_get_text(GTK_ENTRY(p_networkType));
00568 psz_mrlAddress = gtk_entry_get_text(GTK_ENTRY(p_networkAddress));
00569 i_mrlPort = gtk_spin_button_get_value_as_int(p_networkPort);
00570 psz_mrlProtocol = gtk_entry_get_text(GTK_ENTRY(p_networkProtocol));
00571
00572
00573 i_pos = snprintf( &text[0], VLC_MAX_MRL, "%s://", (char*)psz_mrlProtocol);
00574 if (strncasecmp( (char*)psz_mrlNetworkType, "multicast",9)==0)
00575 {
00576 i_pos += snprintf( &text[i_pos], VLC_MAX_MRL - i_pos, "@" );
00577 }
00578 i_pos += snprintf( &text[i_pos], VLC_MAX_MRL - i_pos, "%s:%d", (char*)psz_mrlAddress, (int)i_mrlPort );
00579
00580 if (i_pos >= VLC_MAX_MRL)
00581 {
00582 text[VLC_MAX_MRL-1]='\0';
00583 msg_Err( p_intf, "Media Resource Locator is truncated to: %s", text);
00584 }
00585
00586 gtk_entry_set_text(p_entryMRL,text);
00587 }
00588
00589 void onAddNetworkPlaylist(GtkButton *button, gpointer user_data)
00590 {
00591 intf_thread_t *p_intf = GtkGetIntf( button );
00592
00593 GtkEntry *p_mrl = NULL;
00594 GtkCheckButton *p_network_transcode = NULL;
00595 gboolean b_network_transcode;
00596 const gchar *psz_mrl_name;
00597
00598 p_mrl = (GtkEntry*) lookup_widget(GTK_WIDGET(button),"entryMRL" );
00599 psz_mrl_name = gtk_entry_get_text(p_mrl);
00600
00601 p_network_transcode = (GtkCheckButton*) lookup_widget(GTK_WIDGET(button), "checkNetworkTranscode" );
00602 b_network_transcode = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(p_network_transcode));
00603 if (b_network_transcode)
00604 {
00605 msg_Dbg( p_intf, "Network transcode option selected." );
00606 onAddTranscodeToPlaylist(GTK_WIDGET(button), (gchar *)psz_mrl_name);
00607 }
00608 else
00609 {
00610 msg_Dbg( p_intf, "Network receiving selected." );
00611 PlaylistAddItem(GTK_WIDGET(button), (gchar *)psz_mrl_name, 0, 0);
00612 }
00613 }
00614
00615
00616 void onAddCameraToPlaylist(GtkButton *button, gpointer user_data)
00617 {
00618 intf_thread_t *p_intf = GtkGetIntf( button );
00619
00620 GtkSpinButton *entryV4LChannel = NULL;
00621 GtkSpinButton *entryV4LFrequency = NULL;
00622 GtkSpinButton *entryV4LSampleRate = NULL;
00623 GtkSpinButton *entryV4LQuality = NULL;
00624 GtkSpinButton *entryV4LTuner = NULL;
00625 gint i_v4l_channel;
00626 gint i_v4l_frequency;
00627 gint i_v4l_samplerate;
00628 gint i_v4l_quality;
00629 gint i_v4l_tuner;
00630
00631 GtkEntry *entryV4LVideoDevice = NULL;
00632 GtkEntry *entryV4LAudioDevice = NULL;
00633 GtkEntry *entryV4LNorm = NULL;
00634 GtkEntry *entryV4LSize = NULL;
00635 GtkEntry *entryV4LSoundDirection = NULL;
00636 const gchar *p_v4l_video_device;
00637 const gchar *p_v4l_audio_device;
00638 const gchar *p_v4l_norm;
00639 const gchar *p_v4l_size;
00640 const gchar *p_v4l_sound_direction;
00641
00642
00643 GtkCheckButton *checkV4LMJPEG = NULL;
00644 GtkSpinButton *entryV4LDecimation = NULL;
00645 gboolean b_v4l_mjpeg;
00646 gint i_v4l_decimation;
00647
00648
00649 GtkCheckButton *p_check_v4l_transcode = NULL;
00650 gboolean b_v4l_transcode;
00651
00652 char **ppsz_options = NULL;
00653 int i_options=0;
00654 char v4l_mrl[6];
00655 int i_pos;
00656 int i;
00657
00658 ppsz_options = (char **) malloc(11 *sizeof(char*));
00659 if (ppsz_options == NULL)
00660 {
00661 msg_Err(p_intf, "No memory to allocate for v4l options.");
00662 return;
00663 }
00664 for (i=0; i<11; i++)
00665 {
00666 ppsz_options[i] = (char *) malloc(VLC_MAX_MRL * sizeof(char));
00667 if (ppsz_options[i] == NULL)
00668 {
00669 msg_Err(p_intf, "No memory to allocate for v4l options string %i.", i);
00670 for (i-=1; i>=0; i--)
00671 free(ppsz_options[i]);
00672 free(ppsz_options);
00673 return;
00674 }
00675 }
00676
00677 i_pos = snprintf( &v4l_mrl[0], 6, "v4l");
00678 v4l_mrl[5]='\0';
00679
00680 entryV4LChannel = (GtkSpinButton*) lookup_widget( GTK_WIDGET(button), "entryV4LChannel" );
00681 entryV4LFrequency = (GtkSpinButton*) lookup_widget( GTK_WIDGET(button), "entryV4LFrequency" );
00682 entryV4LSampleRate = (GtkSpinButton*) lookup_widget( GTK_WIDGET(button), "entryV4LSampleRate" );
00683 entryV4LQuality = (GtkSpinButton*) lookup_widget( GTK_WIDGET(button), "entryV4LQuality" );
00684 entryV4LTuner = (GtkSpinButton*) lookup_widget( GTK_WIDGET(button), "entryV4LTuner" );
00685
00686 entryV4LVideoDevice = (GtkEntry*) lookup_widget( GTK_WIDGET(button), "entryV4LVideoDevice" );
00687 entryV4LAudioDevice = (GtkEntry*) lookup_widget( GTK_WIDGET(button), "entryV4LAudioDevice" );
00688 entryV4LNorm = (GtkEntry*) lookup_widget( GTK_WIDGET(button), "entryV4LNorm" );
00689 entryV4LSize = (GtkEntry*) lookup_widget( GTK_WIDGET(button), "entryV4LSize" );
00690 entryV4LSoundDirection = (GtkEntry*) lookup_widget( GTK_WIDGET(button), "entryV4LSoundDirection" );
00691
00692 i_v4l_channel = gtk_spin_button_get_value_as_int(entryV4LChannel);
00693 i_v4l_frequency = gtk_spin_button_get_value_as_int(entryV4LFrequency);
00694 i_v4l_samplerate = gtk_spin_button_get_value_as_int(entryV4LSampleRate);
00695 i_v4l_quality = gtk_spin_button_get_value_as_int(entryV4LQuality);
00696 i_v4l_tuner = gtk_spin_button_get_value_as_int(entryV4LTuner);
00697
00698 p_v4l_video_device = gtk_entry_get_text(GTK_ENTRY(entryV4LVideoDevice));
00699 p_v4l_audio_device = gtk_entry_get_text(GTK_ENTRY(entryV4LAudioDevice));
00700 p_v4l_norm = gtk_entry_get_text(GTK_ENTRY(entryV4LNorm));
00701 p_v4l_size = gtk_entry_get_text(GTK_ENTRY(entryV4LSize));
00702 p_v4l_sound_direction = gtk_entry_get_text(GTK_ENTRY(entryV4LSoundDirection));
00703
00704 i_pos = snprintf( &ppsz_options[i_options++][0], VLC_MAX_MRL, "%s", (char*)p_v4l_video_device );
00705 if (i_pos>=VLC_MAX_MRL) ppsz_options[i_options][VLC_MAX_MRL-1] = '\0';
00706 i_pos = snprintf( &ppsz_options[i_options++][0], VLC_MAX_MRL, "adev=%s", (char*)p_v4l_audio_device );
00707 if (i_pos>=VLC_MAX_MRL) ppsz_options[i_options][VLC_MAX_MRL-1] = '\0';
00708 i_pos = snprintf( &ppsz_options[i_options++][0], VLC_MAX_MRL, "norm=%s", (char*)p_v4l_norm );
00709 if (i_pos>=VLC_MAX_MRL) ppsz_options[i_options][VLC_MAX_MRL-1] = '\0';
00710 i_pos = snprintf( &ppsz_options[i_options++][0], VLC_MAX_MRL, "size=%s", (char*)p_v4l_size );
00711 if (i_pos>=VLC_MAX_MRL) ppsz_options[i_options][VLC_MAX_MRL-1] = '\0';
00712 i_pos = snprintf( &ppsz_options[i_options++][0], VLC_MAX_MRL, "%s", (char*)p_v4l_sound_direction );
00713 if (i_pos>=VLC_MAX_MRL) ppsz_options[i_options][VLC_MAX_MRL-1] = '\0';
00714
00715 i_pos = snprintf( &ppsz_options[i_options++][0], VLC_MAX_MRL, "channel=%d", (int)i_v4l_channel );
00716 if (i_pos>=VLC_MAX_MRL) ppsz_options[i_options][VLC_MAX_MRL-1] = '\0';
00717 i_pos = snprintf( &ppsz_options[i_options++][0], VLC_MAX_MRL, "frequency=%d", (int)i_v4l_frequency );
00718 if (i_pos>=VLC_MAX_MRL) ppsz_options[i_options][VLC_MAX_MRL-1] = '\0';
00719 i_pos = snprintf( &ppsz_options[i_options++][0], VLC_MAX_MRL, "samplerate=%d", (int)i_v4l_samplerate );
00720 if (i_pos>=VLC_MAX_MRL) ppsz_options[i_options][VLC_MAX_MRL-1] = '\0';
00721 i_pos = snprintf( &ppsz_options[i_options++][0], VLC_MAX_MRL, "quality=%d", (int)i_v4l_quality );
00722 if (i_pos>=VLC_MAX_MRL) ppsz_options[i_options][VLC_MAX_MRL-1] = '\0';
00723 i_pos = snprintf( &ppsz_options[i_options++][0], VLC_MAX_MRL, "tuner=%d", (int)i_v4l_tuner );
00724 if (i_pos>=VLC_MAX_MRL) ppsz_options[i_options][VLC_MAX_MRL-1] = '\0';
00725
00726
00727 checkV4LMJPEG = (GtkCheckButton*) lookup_widget( GTK_WIDGET(button), "checkV4LMJPEG" );
00728 b_v4l_mjpeg = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkV4LMJPEG));
00729 if (b_v4l_mjpeg)
00730 {
00731 entryV4LDecimation = (GtkSpinButton*) lookup_widget( GTK_WIDGET(button), "entryV4LDecimation" );
00732 i_v4l_decimation = gtk_spin_button_get_value_as_int(entryV4LDecimation);
00733
00734 i_pos = snprintf( &ppsz_options[i_options++][0], VLC_MAX_MRL, "mjpeg:%d", (int)i_v4l_decimation );
00735 if (i_pos>=VLC_MAX_MRL) ppsz_options[i_options][VLC_MAX_MRL-1] = '\0';
00736 }
00737
00738
00739 p_check_v4l_transcode = (GtkCheckButton*) lookup_widget(GTK_WIDGET(button), "checkV4LTranscode" );
00740 b_v4l_transcode = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(p_check_v4l_transcode));
00741 if (b_v4l_transcode)
00742 {
00743 msg_Dbg( p_intf, "Camera transcode option selected." );
00744 onAddTranscodeToPlaylist(GTK_WIDGET(button), (gchar *)v4l_mrl);
00745 }
00746 else
00747 {
00748 msg_Dbg( p_intf, "Camera reception option selected." );
00749 PlaylistAddItem(GTK_WIDGET(button), (gchar*) &v4l_mrl, ppsz_options, i_options);
00750 }
00751 }
00752
00753
00754 gboolean PlaylistEvent(GtkWidget *widget, GdkEvent *event, gpointer user_data)
00755 {
00756 return FALSE;
00757 }
00758
00759
00760 void onPlaylistColumnsChanged(GtkTreeView *treeview, gpointer user_data)
00761 {
00762 }
00763
00764
00765 gboolean onPlaylistRowSelected(GtkTreeView *treeview, gboolean start_editing, gpointer user_data)
00766 {
00767 return FALSE;
00768 }
00769
00770
00771 void onPlaylistRow(GtkTreeView *treeview, GtkTreePath *path,
00772 GtkTreeViewColumn *column, gpointer user_data)
00773 {
00774 intf_thread_t *p_intf = GtkGetIntf( GTK_WIDGET(treeview) );
00775 GtkTreeSelection *p_selection = gtk_tree_view_get_selection(treeview);
00776 playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
00777 FIND_ANYWHERE );
00778
00779 if( p_playlist == NULL )
00780 {
00781 return;
00782 }
00783
00784 if (gtk_tree_selection_count_selected_rows(p_selection) == 1)
00785 {
00786 GtkTreeModel *p_model;
00787 GtkTreeIter iter;
00788 int i_row;
00789
00790
00791 p_model = gtk_tree_view_get_model(treeview);
00792 if (!p_model)
00793 {
00794 msg_Err(p_intf, "PDA: Playlist model contains a NULL pointer\n" );
00795 return;
00796 }
00797 if (!gtk_tree_model_get_iter(p_model, &iter, path))
00798 {
00799 msg_Err( p_intf, "PDA: Playlist could not get iter from model" );
00800 return;
00801 }
00802
00803 gtk_tree_model_get(p_model, &iter, 2, &i_row, -1);
00804 playlist_Goto( p_playlist, i_row );
00805 }
00806 vlc_object_release( p_playlist );
00807 }
00808
00809
00810 void onUpdatePlaylist(GtkButton *button, gpointer user_data)
00811 {
00812 intf_thread_t * p_intf = GtkGetIntf( button );
00813 playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
00814 FIND_ANYWHERE );
00815 GtkTreeView *p_tvplaylist = NULL;
00816
00817 if( p_playlist == NULL )
00818 {
00819 return;
00820 }
00821
00822 p_tvplaylist = (GtkTreeView*) lookup_widget( GTK_WIDGET(button), "tvPlaylist");
00823 if (p_tvplaylist)
00824 {
00825 GtkListStore *p_model = NULL;
00826
00827
00828 p_model = gtk_list_store_new (3,
00829 G_TYPE_STRING,
00830 G_TYPE_STRING,
00831 G_TYPE_UINT);
00832 if (p_model)
00833 {
00834 PlaylistRebuildListStore(p_model, p_playlist);
00835 gtk_tree_view_set_model(GTK_TREE_VIEW(p_tvplaylist), GTK_TREE_MODEL(p_model));
00836 g_object_unref(p_model);
00837 }
00838 }
00839 vlc_object_release( p_playlist );
00840 }
00841
00842 void deleteItemFromPlaylist(gpointer data, gpointer user_data)
00843 {
00844 gtk_tree_path_free((GtkTreePath*) data);
00845 }
00846
00847 void onDeletePlaylist(GtkButton *button, gpointer user_data)
00848 {
00849 intf_thread_t *p_intf = GtkGetIntf( button );
00850 playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
00851 FIND_ANYWHERE );
00852 GtkTreeView *p_tvplaylist;
00853
00854
00855 p_tvplaylist = (GtkTreeView *) lookup_widget( GTK_WIDGET(button), "tvPlaylist" );
00856 if (p_tvplaylist != NULL)
00857 {
00858 GList *p_rows = NULL;
00859 GList *p_node;
00860 GtkTreeModel *p_model = NULL;
00861 GtkListStore *p_store = NULL;
00862 GtkTreeSelection *p_selection = gtk_tree_view_get_selection(p_tvplaylist);
00863
00864 p_model = gtk_tree_view_get_model(p_tvplaylist);
00865 if (p_model)
00866 {
00867 p_rows = gtk_tree_selection_get_selected_rows(p_selection, &p_model);
00868
00869 if( g_list_length( p_rows ) )
00870 {
00871
00872
00873
00874 p_rows = g_list_reverse( p_rows );
00875 }
00876
00877 for (p_node=p_rows; p_node!=NULL; p_node = p_node->next)
00878 {
00879 GtkTreeIter iter;
00880 GtkTreePath *p_path = NULL;
00881
00882 p_path = (GtkTreePath *)p_node->data;
00883 if (p_path)
00884 {
00885 if (gtk_tree_model_get_iter(p_model, &iter, p_path))
00886 {
00887 gint item;
00888
00889 gtk_tree_model_get(p_model, &iter, 2, &item, -1);
00890 playlist_LockDelete(p_playlist, item);
00891 }
00892 }
00893 }
00894 #if 0
00895 g_list_foreach (p_rows, (GFunc*)gtk_tree_path_free, NULL);
00896 #endif
00897 g_list_foreach (p_rows, deleteItemFromPlaylist, NULL);
00898 g_list_free (p_rows);
00899 }
00900
00901
00902 p_store = gtk_list_store_new (3,
00903 G_TYPE_STRING,
00904 G_TYPE_STRING,
00905 G_TYPE_UINT);
00906 if (p_store)
00907 {
00908 PlaylistRebuildListStore(p_store, p_playlist);
00909 gtk_tree_view_set_model(GTK_TREE_VIEW(p_tvplaylist), GTK_TREE_MODEL(p_store));
00910 g_object_unref(p_store);
00911 }
00912 }
00913 vlc_object_release( p_playlist );
00914 }
00915
00916
00917 void onClearPlaylist(GtkButton *button, gpointer user_data)
00918 {
00919 intf_thread_t *p_intf = GtkGetIntf( button );
00920 playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
00921 FIND_ANYWHERE );
00922 GtkTreeView *p_tvplaylist;
00923 int item;
00924
00925 if( p_playlist == NULL )
00926 {
00927 return;
00928 }
00929
00930 for(item = p_playlist->i_size - 1; item >= 0 ;item-- )
00931 {
00932 playlist_LockDelete( p_playlist, item);
00933 }
00934 vlc_object_release( p_playlist );
00935
00936
00937 p_tvplaylist = (GtkTreeView*) lookup_widget( GTK_WIDGET(button), "tvPlaylist");
00938 if (p_tvplaylist)
00939 {
00940 GtkTreeModel *p_play_model;
00941
00942 p_play_model = gtk_tree_view_get_model(p_tvplaylist);
00943 if (p_play_model)
00944 {
00945 gtk_list_store_clear(GTK_LIST_STORE(p_play_model));
00946 }
00947 }
00948 }
00949
00950
00951 void onPreferenceSave(GtkButton *button, gpointer user_data)
00952 {
00953 #if 0
00954 intf_thread_t *p_intf = GtkGetIntf( button );
00955
00956 msg_Dbg(p_intf, "Preferences Save" );
00957 config_SaveConfigFile( p_intf, NULL );
00958 #endif
00959 }
00960
00961
00962 void onPreferenceApply(GtkButton *button, gpointer user_data)
00963 {
00964 #if 0
00965 intf_thread_t *p_intf = GtkGetIntf( button );
00966
00967 msg_Dbg(p_intf, "Preferences Apply" );
00968 #endif
00969 }
00970
00971
00972 void onPreferenceCancel(GtkButton *button, gpointer user_data)
00973 {
00974 #if 0
00975 intf_thread_t *p_intf = GtkGetIntf( button );
00976
00977 msg_Dbg(p_intf, "Preferences Cancel" );
00978 config_ResetAll( p_intf );
00979
00980 config_SaveConfigFile( p_intf, NULL );
00981 #endif
00982 }
00983
00984
00985 void onAddTranscodeToPlaylist(GtkButton *button, gpointer user_data)
00986 {
00987 intf_thread_t *p_intf = GtkGetIntf( button );
00988
00989 GtkEntry *p_entryVideoCodec = NULL;
00990 GtkSpinButton *p_entryVideoBitrate = NULL;
00991 GtkSpinButton *p_entryVideoBitrateTolerance = NULL;
00992 GtkSpinButton *p_entryVideoKeyFrameInterval = NULL;
00993 GtkCheckButton *p_checkVideoDeinterlace = NULL;
00994 GtkEntry *p_entryAudioCodec = NULL;
00995 GtkSpinButton *p_entryAudioBitrate = NULL;
00996 const gchar *p_video_codec;
00997 gint i_video_bitrate;
00998 gint i_video_bitrate_tolerance;
00999 gint i_video_keyframe_interval;
01000 gboolean b_video_deinterlace;
01001 const gchar *p_audio_codec;
01002 gint i_audio_bitrate;
01003
01004 GtkEntry *p_entryStdAccess = NULL;
01005 GtkEntry *p_entryStdMuxer = NULL;
01006 GtkEntry *p_entryStdURL = NULL;
01007 GtkEntry *p_entryStdAnnounce = NULL;
01008 GtkSpinButton *p_entryStdTTL = NULL;
01009 GtkCheckButton *p_checkSAP = NULL;
01010 GtkCheckButton *p_checkSLP = NULL;
01011 const gchar *p_std_announce;
01012 const gchar *p_std_access;
01013 const gchar *p_std_muxer;
01014 const gchar *p_std_url;
01015 gboolean b_sap_announce;
01016 gboolean b_slp_announce;
01017 gint i_std_ttl;
01018
01019 char **ppsz_options = NULL;
01020 int i_options=0;
01021 int i;
01022
01023 gchar mrl[7];
01024 int i_pos;
01025
01026 ppsz_options = (char **) malloc(3 *sizeof(char*));
01027 if (ppsz_options == NULL)
01028 {
01029 msg_Err(p_intf, "No memory to allocate for v4l options.");
01030 return;
01031 }
01032 for (i=0; i<3; i++)
01033 {
01034 ppsz_options[i] = (char *) malloc(VLC_MAX_MRL * sizeof(char));
01035 if (ppsz_options[i] == NULL)
01036 {
01037 msg_Err(p_intf, "No memory to allocate for v4l options string %i.", i);
01038 for (i-=1; i>=0; i--)
01039 free(ppsz_options[i]);
01040 free(ppsz_options);
01041 return;
01042 }
01043 }
01044
01045
01046 playlist_t *p_playlist = (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
01047 if( p_playlist == NULL ) return;
01048
01049
01050 i_pos = snprintf( &mrl[0], VLC_MAX_MRL, "sout");
01051 mrl[6] = '\0';
01052
01053 i_pos = snprintf( &ppsz_options[i_options][0], VLC_MAX_MRL, "sout='#transcode{");
01054 if (i_pos>=VLC_MAX_MRL) ppsz_options[i_options][VLC_MAX_MRL-1] = '\0';
01055
01056 p_entryVideoCodec = (GtkEntry*) lookup_widget( GTK_WIDGET(button), "entryVideoCodec" );
01057 p_entryVideoBitrate = (GtkSpinButton*) lookup_widget( GTK_WIDGET(button), "entryVideoBitrate" );
01058 p_entryVideoBitrateTolerance = (GtkSpinButton*) lookup_widget( GTK_WIDGET(button), "entryVideoBitrateTolerance" );
01059 p_entryVideoKeyFrameInterval = (GtkSpinButton*) lookup_widget( GTK_WIDGET(button), "entryVideoKeyFrameInterval" );
01060
01061 p_video_codec = gtk_entry_get_text(GTK_ENTRY(p_entryVideoCodec));
01062 i_video_bitrate = gtk_spin_button_get_value_as_int(p_entryVideoBitrate);
01063 i_video_bitrate_tolerance = gtk_spin_button_get_value_as_int(p_entryVideoBitrateTolerance);
01064 i_video_keyframe_interval = gtk_spin_button_get_value_as_int(p_entryVideoKeyFrameInterval);
01065
01066 i_pos += snprintf( &ppsz_options[i_options][i_pos], VLC_MAX_MRL - i_pos, "vcodec=%s,", (char*)p_video_codec );
01067 if (i_pos>=VLC_MAX_MRL) ppsz_options[i_options][VLC_MAX_MRL-1] = '\0';
01068 i_pos += snprintf( &ppsz_options[i_options][i_pos], VLC_MAX_MRL - i_pos, "vb=%d,", (int)i_video_bitrate );
01069 if (i_pos>=VLC_MAX_MRL) ppsz_options[i_options][VLC_MAX_MRL-1] = '\0';
01070 i_pos += snprintf( &ppsz_options[i_options][i_pos], VLC_MAX_MRL - i_pos, "vt=%d,", (int)i_video_bitrate_tolerance );
01071 if (i_pos>=VLC_MAX_MRL) ppsz_options[i_options][VLC_MAX_MRL-1] = '\0';
01072 i_pos += snprintf( &ppsz_options[i_options][i_pos], VLC_MAX_MRL - i_pos, "keyint=%d,", (int)i_video_keyframe_interval );
01073 if (i_pos>=VLC_MAX_MRL) ppsz_options[i_options][VLC_MAX_MRL-1] = '\0';
01074
01075 p_checkVideoDeinterlace = (GtkCheckButton*) lookup_widget( GTK_WIDGET(button), "checkVideoDeinterlace" );
01076 b_video_deinterlace = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(p_checkVideoDeinterlace));
01077 if (b_video_deinterlace)
01078 {
01079 i_pos += snprintf( &ppsz_options[i_options][i_pos], VLC_MAX_MRL - i_pos, "deinterlace," );
01080 if (i_pos>=VLC_MAX_MRL) ppsz_options[i_options][VLC_MAX_MRL-1] = '\0';
01081 }
01082 p_entryAudioCodec = (GtkEntry*) lookup_widget( GTK_WIDGET(button), "entryAudioCodec" );
01083 p_entryAudioBitrate = (GtkSpinButton*) lookup_widget( GTK_WIDGET(button), "entryAudioBitrate" );
01084
01085 p_audio_codec = gtk_entry_get_text(GTK_ENTRY(p_entryAudioCodec));
01086 i_audio_bitrate = gtk_spin_button_get_value_as_int(p_entryAudioBitrate);
01087
01088 i_pos += snprintf( &ppsz_options[i_options][i_pos], VLC_MAX_MRL - i_pos, "acodec=%s,", (char*)p_audio_codec );
01089 if (i_pos>=VLC_MAX_MRL) ppsz_options[i_options][VLC_MAX_MRL-1] = '\0';
01090 i_pos += snprintf( &ppsz_options[i_options][i_pos], VLC_MAX_MRL - i_pos, "ab=%d,", (int)i_audio_bitrate );
01091 if (i_pos>=VLC_MAX_MRL) ppsz_options[i_options][VLC_MAX_MRL-1] = '\0';
01092 i_pos += snprintf( &ppsz_options[i_options][i_pos], VLC_MAX_MRL - i_pos, "channels=1}" );
01093 if (i_pos>=VLC_MAX_MRL) ppsz_options[i_options][VLC_MAX_MRL-1] = '\0';
01094
01095
01096 i_pos = 0;
01097 i_pos = snprintf( &ppsz_options[i_options++][i_pos], VLC_MAX_MRL - i_pos, "#" );
01098 if (i_pos>=VLC_MAX_MRL) ppsz_options[i_options][VLC_MAX_MRL-1] = '\0';
01099
01100 p_entryStdAccess = (GtkEntry*) lookup_widget( GTK_WIDGET(button), "entryStdAccess" );
01101 p_entryStdMuxer = (GtkEntry*) lookup_widget( GTK_WIDGET(button), "entryStdMuxer" );
01102 p_entryStdURL = (GtkEntry*) lookup_widget( GTK_WIDGET(button), "entryStdURL" );
01103 p_entryStdAnnounce = (GtkEntry*) lookup_widget( GTK_WIDGET(button), "entryAnnounceChannel" );
01104 p_entryStdTTL = (GtkSpinButton*) lookup_widget( GTK_WIDGET(button), "entryStdTTL" );
01105
01106 p_std_access = gtk_entry_get_text(GTK_ENTRY(p_entryStdAccess));
01107 p_std_muxer = gtk_entry_get_text(GTK_ENTRY(p_entryStdMuxer));
01108 p_std_url = gtk_entry_get_text(GTK_ENTRY(p_entryStdURL));
01109 p_std_announce = gtk_entry_get_text(GTK_ENTRY(p_entryStdAnnounce));
01110 b_sap_announce = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(p_checkSAP));
01111 b_slp_announce = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(p_checkSLP));
01112
01113 i_pos += snprintf( &ppsz_options[i_options][i_pos], VLC_MAX_MRL - i_pos, "std{access=%s,", (char*)p_std_access);
01114 if (i_pos>=VLC_MAX_MRL) ppsz_options[i_options][VLC_MAX_MRL-1] = '\0';
01115 i_pos += snprintf( &ppsz_options[i_options][i_pos], VLC_MAX_MRL - i_pos, "mux=%s,", (char*)p_std_muxer);
01116 if (i_pos>=VLC_MAX_MRL) ppsz_options[i_options][VLC_MAX_MRL-1] = '\0';
01117 i_pos += snprintf( &ppsz_options[i_options][i_pos], VLC_MAX_MRL - i_pos, "url=%s", (char*)p_std_url);
01118 if (i_pos>=VLC_MAX_MRL) ppsz_options[i_options][VLC_MAX_MRL-1] = '\0';
01119
01120 if (strncasecmp( (const char*)p_std_access, "udp", 3)==0)
01121 {
01122 if (b_sap_announce)
01123 {
01124 i_pos += snprintf( &ppsz_options[i_options][i_pos], VLC_MAX_MRL - i_pos, "sap=%s", (char*)p_std_announce);
01125 if (i_pos>=VLC_MAX_MRL) ppsz_options[i_options][VLC_MAX_MRL-1] = '\0';
01126 }
01127 if (b_slp_announce)
01128 {
01129 i_pos += snprintf( &ppsz_options[i_options][i_pos], VLC_MAX_MRL - i_pos, "slp=%s", (char*)p_std_announce);
01130 if (i_pos>=VLC_MAX_MRL) ppsz_options[i_options][VLC_MAX_MRL-1] = '\0';
01131 }
01132 }
01133
01134 i_std_ttl = gtk_spin_button_get_value_as_int(p_entryStdTTL);
01135
01136 i_pos += snprintf( &ppsz_options[i_options++][i_pos], VLC_MAX_MRL - i_pos, "ttl=%d}", (int)i_std_ttl);
01137 if (i_pos>=VLC_MAX_MRL) ppsz_options[i_options][VLC_MAX_MRL-1] = '\0';
01138
01139 if (user_data != NULL)
01140 {
01141 msg_Dbg(p_intf, "Adding transcoding options to playlist item." );
01142 }
01143 else
01144 {
01145 msg_Dbg(p_intf, "Adding --sout to playlist." );
01146 PlaylistAddItem(GTK_WIDGET(button), (gchar*) &mrl, ppsz_options, i_options);
01147 }
01148 }
01149
01150 void onEntryStdAccessChanged(GtkEditable *editable, gpointer user_data)
01151 {
01152 intf_thread_t *p_intf = GtkGetIntf( editable );
01153
01154 GtkCheckButton *p_checkSAP = NULL;
01155 GtkCheckButton *p_checkSLP = NULL;
01156 GtkEntry *p_entryStdAccess = NULL;
01157 const gchar *p_std_access = NULL;
01158 gboolean b_announce = FALSE;
01159
01160 p_entryStdAccess = (GtkEntry*) lookup_widget( GTK_WIDGET(editable), "entryStdAccess" );
01161 p_checkSAP = (GtkCheckButton*) lookup_widget( GTK_WIDGET(editable), "checkSAP" );
01162 p_checkSLP = (GtkCheckButton*) lookup_widget( GTK_WIDGET(editable), "checkSLP" );
01163
01164 if ( (p_std_access == NULL) || (p_checkSAP == NULL) || (p_checkSLP == NULL))
01165 {
01166 msg_Err( p_intf, "Access, SAP and SLP widgets not found." );
01167 return;
01168 }
01169 p_std_access = gtk_entry_get_text(GTK_ENTRY(p_entryStdAccess));
01170
01171 b_announce = (strncasecmp( (const char*)p_std_access, "udp", 3) == 0);
01172 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p_checkSAP), b_announce);
01173 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(p_checkSLP), b_announce);
01174 }
01175