コード例 #1
0
ファイル: capture.cpp プロジェクト: AchillesL/ARM
void Capture::paintEvent(QPaintEvent *)
{
    if(open_cam_flag==1)
    video_play();
    else
    {
        ui->video_label->setPixmap(QPixmap(":/Image/black.jpg"));
    }
}
コード例 #2
0
ファイル: fb.c プロジェクト: gettler/mvpmc
void
fb_thruput(void)
{
	char path[256];

	switch_hw_state(MVPMC_STATE_FILEBROWSER);

	sprintf(path, "%s/%s", cwd, current_hilite);

	if (current)
		free(current);
	current = strdup(path);

	video_functions = &file_functions;

	demux_reset(handle);
	demux_attr_reset(handle);
	video_play(NULL);
}
コード例 #3
0
ファイル: fb.c プロジェクト: gettler/mvpmc
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);
		}
	}
}
コード例 #4
0
ファイル: main.c プロジェクト: Cpasjuste/pmenu
void handle_dpad()
{
    GLES2D_HandleEvents( 90 );

    if ( GLES2D_PadPressed ( MENU ) || GLES2D_KeyboardPressed( XK_Escape ) )
    {
        do_quit = 1;
    }

    else if ( GLES2D_PadPressed ( L ) || GLES2D_KeyboardPressed( XK_F1 ) )
    {
        if( category > 0) gui_change_category( category - 1 );
            else gui_change_category( CATEGORY_COUNT - 1 );

        if ( !pmenu->effect )
        {
            gui_draw();
            GLES2D_SwapBuffers();
        }
    }

    else if ( GLES2D_PadPressed ( R ) || GLES2D_KeyboardPressed( XK_F2 ) )
    {
        if( category < CATEGORY_COUNT - 1) gui_change_category( category + 1 );
            else gui_change_category( 0 );

        if ( !pmenu->effect )
        {
            gui_draw();
            GLES2D_SwapBuffers();
        }
    }

    else if( GLES2D_PadHold ( PAD_LEFT ) )
    {
        if ( category == SETTINGS )
        {
            if ( setting_current == MENU_CPU )
            {
                if ( pmenu->cpu_mhz > 30 )
                {
                    pmenu->cpu_mhz-=5;
                    set_cpu( pmenu->cpu_mhz );
                }
            }
            else if ( setting_current == MENU_BRIGHTNESS )
            {
                if ( pmenu->brightness > 10 )
                {
                    pmenu->brightness -= 5;
                    set_brightness( pmenu->brightness );
                }
            }
            else if ( setting_current == MENU_EFFECT )
            {
                pmenu->effect = !pmenu->effect;
            }
        }

        if ( !pmenu->effect )
        {
            gui_draw();
            GLES2D_SwapBuffers();
        }
    }

    else if( GLES2D_PadPressed ( PAD_LEFT ) || GLES2D_KeyboardPressed( XK_Left ) )
    {
        gui_pad_left();

        if ( !pmenu->effect )
        {
            gui_draw();
            GLES2D_SwapBuffers();
        }
    }

    else if( GLES2D_PadHold ( PAD_RIGHT ) )
    {
        if ( category == SETTINGS )
        {
            if ( setting_current == MENU_CPU )
            {
                if ( pmenu->cpu_mhz < 800 )
                {
                    pmenu->cpu_mhz += 5;
                    set_cpu( pmenu->cpu_mhz );
                }
            }
            else if ( setting_current == MENU_BRIGHTNESS )
            {
                if ( pmenu->brightness < 56 )
                {
                    pmenu->brightness += 5;
                    set_brightness( pmenu->brightness );
                }
            }
            else if ( setting_current == MENU_EFFECT )
            {
                pmenu->effect = !pmenu->effect;
            }
        }

        if ( !pmenu->effect )
        {
            gui_draw();
            GLES2D_SwapBuffers();
        }
    }

    else if( GLES2D_PadPressed ( PAD_RIGHT ) || GLES2D_KeyboardPressed( XK_Right ) )
    {
        gui_pad_right();

        if ( !pmenu->effect )
        {
            gui_draw();
            GLES2D_SwapBuffers();
        }
    }

    else if( GLES2D_PadHold ( PAD_UP ) || GLES2D_KeyboardPressed( XK_Up ) )
    {
        gui_pad_up();

        if ( !pmenu->effect )
        {
            gui_draw();
            GLES2D_SwapBuffers();
        }
    }

    else if( GLES2D_PadHold ( PAD_DOWN ) || GLES2D_KeyboardPressed( XK_Down ) )
    {
        gui_pad_down();

        if ( !pmenu->effect )
        {
            gui_draw();
            GLES2D_SwapBuffers();
        }
    }

    else if ( GLES2D_PadPressed ( X ) || GLES2D_KeyboardPressed( XK_l ) )
    {
        GLES2D_Pad[ A ] = 0;

        if( ( category != SETTINGS ) && ( category != MEDIA ) )
        {
            if ( list_num[category] )
                gui_app_exec( list_curpos[ category ] );
        }
        else if ( category == SETTINGS  )
        {
            if ( setting_current == MENU_SKIN )
            {
                gui_change_skin();
            }
            else if ( setting_current == MENU_CPU )
            {
                cfg_pmenu_update_cpu_mhz( pmenu->cpu_mhz );
                set_cpu( pmenu->cpu_mhz );
            }
            else if ( setting_current == MENU_EFFECT )
            {
                cfg_pmenu_update_effect( pmenu->effect );
            }
            else if ( setting_current == MENU_EXIT )
            {
                do_quit = 1;
            }
            else if ( setting_current == MENU_POWEROFF )
            {
                int ret;
                ret = system( "poweroff" );
            }
        }
        else if ( category == MEDIA )
        {
            if ( now_depth < MAX_DEPTH )
            {
                if ( applications[MEDIA]->type[list_curpos[MEDIA]] == IS_DIR )
                {
                    if ( list_num[MEDIA] )
                    {
                        strcat( now_path, "/" );
                        strcat( now_path, applications[MEDIA]->name[list_curpos[MEDIA]] );
                        now_depth++;
                        get_media_list( now_path );
                    }
                }
                else if ( is_avi( applications[MEDIA]->name[list_curpos[MEDIA]] ) )
                {
                    char video_path[1024];
                    strcpy( video_path, now_path );
                    strcat( video_path, "/" );
                    strcat( video_path, applications[MEDIA]->name[list_curpos[MEDIA]] );
                    video_play( video_path );
                }
            }
        }

        if ( !pmenu->effect )
        {
            gui_draw();
            GLES2D_SwapBuffers();
        }
    }

    else if ( GLES2D_PadPressed ( B ) )
    {
        if( category == MEDIA )
        {
            if ( now_depth > 0 )
            {
                int i;

                for( i = 0; i < MAX_PATH; i++ )
                    if ( now_path[i] == 0 ) break;

                i--;

                while( i > 4 )
                {
                    if ( now_path[i] == '/' )
                    {
                        now_path[i] = 0;
                        break;
                    }
                    i--;
                }
                now_depth--;
                get_media_list( now_path );
            }
        }
    }

    else if ( GLES2D_PadPressed ( Y ) || GLES2D_KeyboardPressed( XK_space ) )
    {
        if ( category == FAVORITES )
        {
                if ( list_num[category] )
                {
                    char tmpStr[512];
                    sprintf(tmpStr, "Do you want to remove %s from your favourite applications ?", applications[category]->name[list_curpos[ category ]] );

                    if( gui_confirm_box( tmpStr ) )
                    {
                        cfg_fav_del( applications[category]->id[list_curpos[ category ]] );
                        pnd_app_clean_list();
                        pnd_app_get_list();
                    }

                }
        }
        else
        {
            if ( ( category != MEDIA ) && ( category != SETTINGS ) )
            {
                if ( list_num[category] )
                {
                    if ( applications_count[FAVORITES] < FAV_MAX )
                    {
                        char tmpString[256];
                        sprintf(tmpString, "Do you want to add %s to your favourite applications ?", applications[category]->name[list_curpos[ category ]] );

                        if (  gui_confirm_box( tmpString ) )
                        {
                            cfg_fav_add( applications[category]->id[list_curpos[ category ]] );
                            pnd_app_clean_list();
                            pnd_app_get_list();
                        }
                    }
                    else
                    {
                        gui_confirm_box("Favorites are full, please remove a favourite before adding one by going under the favourite screen.");
                    }
                }
            }
        }

        if ( !pmenu->effect )
        {
            gui_draw();
            GLES2D_SwapBuffers();
        }
    }
}