示例#1
0
static void handle_streamstart_req(struct unix_client *client,
					struct bt_start_stream_req *req)
{
	if (!client->dev)
		goto failed;

	start_resume(client->dev, client);

	return;

failed:
	unix_ipc_error(client, BT_START_STREAM, EIO);
}
示例#2
0
文件: ZOOM.C 项目: mmammel/projects
static int check_pan(void) /* return 0 if can't, alignment requirement if can */
{   int i,j;
    if (calc_status != 2 && calc_status != 4)
        return(0); /* not resumable, not complete */
    if ( curfractalspecific->calctype != StandardFractal
      && curfractalspecific->calctype != calcmand
      && curfractalspecific->calctype != calcmandfp
      && curfractalspecific->calctype != lyapunov
      && curfractalspecific->calctype != calcfroth)
        return(0); /* not a worklist-driven type */
    if (zwidth != 1.0 || zdepth != 1.0 || zskew != 0.0 || zrotate != 0.0)
        return(0); /* not a full size unrotated unskewed zoombox */
    /* can pan if we get this far */
    if (calc_status == 4)
        return(1); /* image completed, align on any pixel */
    if (potflag && pot16bit)
        return(1); /* 1 pass forced so align on any pixel */
    if (stdcalcmode == 'b')
        return(1); /* btm, align on any pixel */
    if (stdcalcmode == 't')
        return(0); /* tesselate, can't do it */
    if (stdcalcmode != 'g' || (curfractalspecific->flags&NOGUESS)) {
        if (stdcalcmode == '2' || stdcalcmode == '3') /* align on even pixel for 2pass */
           return(2);
        return(1); /* assume 1pass */
        }
    /* solid guessing */
    start_resume();
    get_resume(sizeof(int),&num_worklist,sizeof(worklist),worklist,0);
    /* don't do end_resume! we're just looking */
    i = 9;
    for (j=0; j<num_worklist; ++j) /* find lowest pass in any pending window */
        if (worklist[j].pass < i)
            i = worklist[j].pass;
    j = ssg_blocksize(); /* worst-case alignment requirement */
    while (--i >= 0)
        j = j>>1; /* reduce requirement */
    return(j);
    }
示例#3
0
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	switch(message)
	{	
		case WM_FOO_GET_ACTIVE_PLAYLIST_COUNT:
			if(plist_api) return activeplaylist_get_item_count(&plist_api);
			return P_ERROR;

		case WM_FOO_GET_PLAYLIST_ITEM:
		{
			char title[512];
			wchar_t w_title[512];
			if(!ptcomp_api || !plist_api || !pback_api) return P_ERROR;
			if(wParam == -1 && !is_playing(&pback_api)) return P_ERROR;
			int tracknumb = (wParam==-1)?(int)get_playing_item_location(&plist_api):wParam;
			PTITLEFORMAT_OBJECT *t_obj=0;	// Must be 0!!!
			if(!GetWindowText(p_hWnd, title, 512)) return P_ERROR;

			if(compile(&ptcomp_api, &t_obj, title))
			{
				string_free();
				playlist_item_format_title(&plist_api, get_active_playlist(&plist_api), tracknumb, 0, &str,
								&t_obj, 0, display_level_all);
				MultiByteToWideChar(CP_UTF8, 0, str.data, -1, w_title, 512);
				SetWindowTextW(p_hWnd, w_title);
				service_release((PSERVICE_BASE*)t_obj);
				return 0;
			}
			return P_ERROR;
		}

		case WM_FOO_GET_CURRENT_TRACK:
			if(plist_api) return get_playing_item_location(&plist_api);
			return P_ERROR;

		case WM_FOO_ORDER:
			if(plist_api) {playback_order_set_active(&plist_api, wParam); return 0;}
			return P_ERROR;

		case WM_FOO_OPEN:	return main_open(&g_api);
		case WM_FOO_ADD:	return main_add_files(&g_api);
		case WM_FOO_ADDDIR:	return main_add_directory(&g_api);

		case WM_FOO_PLAY:
			if(pback_api) {start_resume(&pback_api); return 0;}
			return P_ERROR;

		case WM_FOO_STOP:
			if(pback_api) {stop(&pback_api); return 0;}
			return P_ERROR;

		case WM_FOO_PLAY_NEXT:
			if(pback_api) {start(&pback_api, track_command_next); return 0;}
			return P_ERROR;

		case WM_FOO_PLAY_PREV:
			if(pback_api) {start(&pback_api, track_command_prev); return 0;}
			return P_ERROR;

		case WM_FOO_PLAY_RANDOM:
			if(pback_api) {start(&pback_api, track_command_rand); return 0;}
			return P_ERROR;

		case WM_FOO_PAUSE:
			if(pback_api) {pause(&pback_api, true); return 0;}
			return P_ERROR;

		case WM_FOO_PLAY_PAUSE:
			if(pback_api) {play_pause(&pback_api); return 0;}
			return P_ERROR;

		case WM_FOO_VOLUME_UP:
			if(pback_api) {volume_up(&pback_api); return 0;}
			return P_ERROR;

		case WM_FOO_VOLUME_DOWN:
			if(pback_api) {volume_down(&pback_api); return 0;}
			return P_ERROR;

		case WM_FOO_GET_VOLUME:
			if(pback_api) return get_volume(&pback_api);
			return P_ERROR;

		case WM_FOO_SET_VOLUME:
			if(pback_api) {set_volume(&pback_api, wParam); return 0;}
			return P_ERROR;

		case WM_FOO_MUTE:
			if(pback_api) {mute(&pback_api); return 0;}
			return P_ERROR;

		case WM_FOO_IS_PLAYING:
			if(pback_api) return (is_playing(&pback_api) && !is_paused(&pback_api));
			return P_ERROR;

		case WM_FOOL_IS_PAUSED:
			if(pback_api) return is_paused(&pback_api);
			return P_ERROR;

		case WM_FOO_GET_STOP_AFTER_CURRENT:
			if(pback_api) return get_stop_after_current(&pback_api);
			return P_ERROR;

		case WM_FOO_SET_STOP_AFTER_CURRENT:
			if(pback_api) {set_stop_after_current(&pback_api, wParam); return 0;}
			return P_ERROR;

		case WM_FOO_PLAYBACK_CAN_SEEK:
			if(pback_api) return playback_can_seek(&pback_api);
			return P_ERROR;

		case WM_FOO_PLAYBACK_SEEK:
			if(pback_api) {playback_seek(&pback_api, wParam); return 0;}
			return P_ERROR;

		case WM_FOO_PLAYBACK_SEEK_DELTA:
			if(pback_api) {playback_seek_delta(&pback_api, wParam); return 0;}
			return P_ERROR;

		case WM_FOO_GET_POSITION:
			if(pback_api) return playback_get_position(&pback_api);
			return P_ERROR;

		case WM_FOO_GET_LENGTH:
			if(pback_api) return playback_get_length(&pback_api);
			return P_ERROR;

		case WM_FOO_EXIT:	return main_exit(&g_api);
		case WM_FOO_ACTIVATE:	return main_activate(&g_api);
		case WM_FOO_HIDE:	return main_hide(&g_api);

		case WM_FOO_PLAY_TRACK:
			if(plist_api) {playlist_execute_default_action(&plist_api, get_active_playlist(&plist_api), wParam); return 0;}
			return P_ERROR;

		case WM_FOO_REGISTER_CALLBACK:
			if(wParam & PLAYBACK_START)			AddCallback((PFCALLBACK)&callbacks, CSTARTING, (HWND)lParam, 0);
			if(wParam & PLAYBACK_DYNAMIC_INFO) 		AddCallback((PFCALLBACK)&callbacks, CDYNAMIC_INFO, (HWND)lParam, 0);
			if(wParam & PLAYBACK_DYNAMIC_INFO_TRACK)	AddCallback((PFCALLBACK)&callbacks, CDYNAMIC_INFO_TRACK, (HWND)lParam, 0);
			if(wParam & PLAYBACK_TIME)			AddCallback((PFCALLBACK)&callbacks, CTIME, (HWND)lParam, 0);
			if(wParam & PLAYBACK_VOLUME_CHANGE)		AddCallback((PFCALLBACK)&callbacks, CVOLUME_CHANGE, (HWND)lParam, 0);
			if(wParam & PLAYBACK_STOP)			AddCallback((PFCALLBACK)&callbacks, CSTOP, (HWND)lParam, 0);
			if(wParam & PLAYBACK_SEEK)			AddCallback((PFCALLBACK)&callbacks, CSEEK, (HWND)lParam, 0);
			if(wParam & PLAYBACK_PAUSE)			AddCallback((PFCALLBACK)&callbacks, CPAUSE, (HWND)lParam, 0);
			if(wParam & PLAYBACK_NEW_TRACK)
			{
				char caption[512];
				if(GetWindowText(p_hWnd, caption, 512))	AddCallback((PFCALLBACK)&callbacks, CNEW_TRACK, (HWND)lParam, caption);
			}
			
			if(wParam & PLAYBACK_EDITED)
			{
				char caption[512];
				if(GetWindowText(p_hWnd, caption, 512))	AddCallback((PFCALLBACK)&callbacks, CEDITED, (HWND)lParam, caption);
			}
			return 0;

		case WM_FOO_UNREGISTER_CALLBACK:
			if(wParam & PLAYBACK_START)			RemoveCallback((PFCALLBACK)&callbacks, CSTARTING, (HWND)lParam);
			if(wParam & PLAYBACK_NEW_TRACK) 		RemoveCallback((PFCALLBACK)&callbacks, CNEW_TRACK, (HWND)lParam);
			if(wParam & PLAYBACK_STOP)			RemoveCallback((PFCALLBACK)&callbacks, CSTOP, (HWND)lParam);
			if(wParam & PLAYBACK_SEEK)			RemoveCallback((PFCALLBACK)&callbacks, CSEEK, (HWND)lParam);
			if(wParam & PLAYBACK_PAUSE)			RemoveCallback((PFCALLBACK)&callbacks, CPAUSE, (HWND)lParam);
			if(wParam & PLAYBACK_EDITED)			RemoveCallback((PFCALLBACK)&callbacks, CEDITED, (HWND)lParam);
			if(wParam & PLAYBACK_DYNAMIC_INFO) 		RemoveCallback((PFCALLBACK)&callbacks, CDYNAMIC_INFO, (HWND)lParam);
			if(wParam & PLAYBACK_DYNAMIC_INFO_TRACK)	RemoveCallback((PFCALLBACK)&callbacks, CDYNAMIC_INFO_TRACK, (HWND)lParam);
			if(wParam & PLAYBACK_TIME)			RemoveCallback((PFCALLBACK)&callbacks, CTIME, (HWND)lParam);
			if(wParam & PLAYBACK_VOLUME_CHANGE)		RemoveCallback((PFCALLBACK)&callbacks, CVOLUME_CHANGE, (HWND)lParam);
			return 0;

		default:		return DefWindowProc(hWnd, message, wParam, lParam);
	}
}
示例#4
0
文件: ZOOM.C 项目: mmammel/projects
int init_pan_or_recalc(int do_zoomout) /* decide to recalc, or to chg worklist & pan */
{   int i,j,row,col,y,alignmask,listfull;
    if (zwidth == 0.0)
        return(0); /* no zoombox, leave calc_status as is */
    /* got a zoombox */
    if ((alignmask=check_pan()-1) < 0) {
        calc_status = 0; /* can't pan, trigger recalc */
        return(0); }
    if (zbx == 0.0 && zby == 0.0) {
        clearbox();
        return(0); } /* box is full screen, leave calc_status as is */
    col = (int)(zbx*(dxsize+PIXELROUND)); /* calc dest col,row of topleft pixel */
    row = (int)(zby*(dysize+PIXELROUND));
    if (do_zoomout) { /* invert row and col */
        row = 0-row;
        col = 0-col; }
    if ((row&alignmask) != 0 || (col&alignmask) != 0) {
        calc_status = 0; /* not on useable pixel alignment, trigger recalc */
        return(0); }
    /* pan */
    num_worklist = 0;
    if (calc_status == 2) {
       start_resume();
       get_resume(sizeof(int),&num_worklist,sizeof(worklist),worklist,0);
       } /* don't do end_resume! we might still change our mind */
    /* adjust existing worklist entries */
    for (i=0; i<num_worklist; ++i) {
        worklist[i].yystart -= row;
        worklist[i].yystop  -= row;
        worklist[i].yybegin -= row;
        worklist[i].xxstart -= col;
        worklist[i].xxstop  -= col;
        }
    /* add worklist entries for the new edges */
    listfull = i = 0;
    j = ydots-1;
    if (row < 0) {
        listfull |= add_worklist(0,xdots-1,0,0-row-1,0,0,0);
        i = 0 - row; }
    if (row > 0) {
        listfull |= add_worklist(0,xdots-1,ydots-row,ydots-1,ydots-row,0,0);
        j = ydots - row - 1; }
    if (col < 0)
        listfull |= add_worklist(0,0-col-1,i,j,i,0,0);
    if (col > 0)
        listfull |= add_worklist(xdots-col,xdots-1,i,j,i,0,0);
    if (listfull != 0) {
    static FCODE msg[] = {"\
Tables full, can't pan current image.\n\
Cancel resumes old image, continue pans and calculates a new one."};
        if (stopmsg(2,msg)) {
            zwidth = 0; /* cancel the zoombox */
            drawbox(1); }
        else
            calc_status = 0; /* trigger recalc */
        return(0); }
    /* now we're committed */
    calc_status = 2;
    clearbox();
    if (row > 0) /* move image up */
        for (y=0; y<ydots; ++y) move_row(y+row,y,col);
    else         /* move image down */
        for (y=ydots; --y>=0;)  move_row(y+row,y,col);
    fix_worklist(); /* fixup any out of bounds worklist entries */
    alloc_resume(sizeof(worklist)+10,1); /* post the new worklist */
    put_resume(sizeof(int),&num_worklist,sizeof(worklist),worklist,0);
    return(0);
    }