void add_video_streams(mvp_widget_t *widget, mvpw_menu_item_attr_t *item_attr) { demux_attr_t *attr; int i; char buf[32]; unsigned long id; stream_type_t type; char *str = ""; mvpw_clear_menu(widget); attr = demux_get_attr(handle); for (i=0; i<attr->video.existing; i++) { id = attr->video.ids[i].id; type = attr->video.ids[i].type; if (type == STREAM_MPEG) str = "MPEG"; snprintf(buf, sizeof(buf), "Stream ID 0x%lx - %s", id, str); mvpw_add_menu_item(widget, buf, (void*)id, item_attr); } mvpw_check_menu_item(widget, (void*)(long)attr->video.current, 1); }
void add_subtitle_streams(mvp_widget_t *widget, mvpw_menu_item_attr_t *item_attr) { demux_attr_t *attr; long i; int current; char buf[32]; mvpw_clear_menu(widget); attr = demux_get_attr(handle); current = demux_spu_get_id(handle); for (i=0; i<32; i++) { if (attr->spu[i].bytes > 0) { snprintf(buf, sizeof(buf), "Stream ID 0x%lx", i); mvpw_add_menu_item(widget, buf, (void*)i, item_attr); if (current == i) mvpw_check_menu_item(widget, (void*)i, 1); else mvpw_check_menu_item(widget, (void*)i, 0); } } }
void add_audio_streams(mvp_widget_t *widget, mvpw_menu_item_attr_t *item_attr) { demux_attr_t *attr; int i; char buf[32]; unsigned long id; stream_type_t type; char *str = ""; mvpw_clear_menu(widget); attr = demux_get_attr(handle); for (i=0; i<attr->audio.existing; i++) { id = attr->audio.ids[i].id; type = attr->audio.ids[i].type; switch (type) { case STREAM_MPEG: str = "MPEG"; break; case STREAM_AC3: str = "AC3"; break; case STREAM_PCM: str = "PCM"; break; } snprintf(buf, sizeof(buf), "Stream ID 0x%lx - %s", id, str); mvpw_add_menu_item(widget, buf, (void*)id, item_attr); } mvpw_check_menu_item(widget, (void*)(long)attr->audio.current, 1); }
int fb_update(mvp_widget_t *fb) { mvpw_show(root); mvpw_expose(root); mvpw_clear_menu(fb); mvpw_set_menu_title(fb, cwd); busy_start(); if (strstr(cwd,"/uPnP")!=NULL ){ mount_djmount(cwd); } add_dirs(fb); add_files(fb); busy_end(); return 0; }
static void select_callback(mvp_widget_t *widget, char *item, void *key) { char path[1024], *ptr; struct stat64 sb; sprintf(path, "%s/%s", cwd, item); if (stat64(path, &sb)!=0) { printf("Could not stat %s error %d\n",item,errno); if (strcmp(item,"../")==0 ) { // probably lost network put you back in root strcpy(cwd,"/"); strcpy(path,"/"); stat64(path, &sb); } } if (current_pl && !is_playlist(item)) { free(current_pl); current_pl = NULL; } if (current_pl && (playlist == NULL)) { free(current_pl); current_pl = NULL; } printf("%s(): path '%s'\n", __FUNCTION__, path); if (current && (strcmp(path, current) == 0)) { printf("selected current item\n"); if (is_video(item) || (is_streaming(item) > 100)) { mvpw_hide(widget); mvpw_hide(fb_progress); av_move(0, 0, 0); screensaver_disable(); return; } } if (current_pl && (strcmp(path, current_pl) == 0)) { if (is_playlist(item)) { mvpw_show(fb_progress); mvpw_set_timer(fb_progress, fb_osd_update, 500); mvpw_hide(widget); printf("Show playlist menu\n"); mvpw_show(playlist_widget); mvpw_focus(playlist_widget); return; } } if (S_ISDIR(sb.st_mode)) { if (strcmp(item, "../") == 0) { strcpy(path, cwd); if (path[strlen(path)-1] == '/') path[strlen(path)-1] = '\0'; if ((ptr=strrchr(path, '/')) != NULL) *ptr = '\0'; if (path[0] == '\0') sprintf(path, "/"); } else { if ((ptr=strrchr(path, '/')) != NULL) *ptr = '\0'; } if (strstr(path,"/uPnP")!=NULL && strstr(cwd,"/uPnP")==NULL ){ mount_djmount(path); } else if (strstr(path,"/uPnP")==NULL && strstr(cwd,"/uPnP")!=NULL ) { unmount_djmount(); } strncpy(cwd, path, sizeof(cwd)); while ((cwd[0] == '/') && (cwd[1] == '/')) memmove(cwd, cwd+1, strlen(cwd)); mvpw_clear_menu(widget); mvpw_set_menu_title(widget, cwd); busy_start(); add_dirs(widget); add_files(widget); busy_end(); mvpw_expose(widget); } else { switch_hw_state(MVPMC_STATE_FILEBROWSER); if (current) free(current); current = NULL; audio_stop = 1; pthread_kill(audio_thread, SIGURG); while (audio_playing) usleep(1000); current = strdup(path); if (is_streaming(item) > 100) { // Use VLC callbacks for streaming items video_functions = &vlc_functions; // Allow broadcast messages to be sent so // we can tell VLC to start the stream vlc_broadcast_enabled = 1; } else { video_functions = &file_functions; } add_osd_widget(fb_program_widget, OSD_PROGRAM, osd_settings.program, NULL); mvpw_set_text_str(fb_name, item); /* * This code sends the currently playing file name to the display. */ snprintf(display_message, sizeof(display_message), "File:%s\n", item); display_send(display_message); audio_clear(); video_clear(); playlist_clear(); if (is_video(item)) { if (key != NULL) { mvpw_hide(widget); mvpw_hide(fb_progress); av_move(0, 0, 0); } else { mvpw_show(fb_progress); } mvpw_set_timer(fb_progress, fb_osd_update, 500); video_play(NULL); mvpw_show(root); mvpw_expose(root); mvpw_focus(root); } else if (is_audio(item) || is_streaming(item)>=0 ) { mvpw_show(fb_progress); mvpw_set_timer(fb_progress, fb_osd_update, 500); audio_play(NULL); } else if (is_image(item)) { mvpw_hide(widget); printf("Displaying image '%s'\n", path); if (mvpw_load_image_jpeg(iw, path) == 0) { mvpw_show_image_jpeg(iw); av_wss_update_aspect(WSS_ASPECT_UNKNOWN); } else { mvpw_set_image(iw, path); } mvpw_show(iw); mvpw_focus(iw); loaded_offset = 0; loaded_status = 0; fb_next_image(1); } else if (is_playlist(item)) { if (current_pl) free(current_pl); current_pl = strdup(path); mvpw_show(fb_progress); mvpw_set_timer(fb_progress, fb_osd_update, 500); mvpw_hide(widget); printf("Show playlist menu\n"); mvpw_show(playlist_widget); mvpw_focus(playlist_widget); playlist_clear(); playlist_play(NULL); } } }