Changeset 3590


Ignore:
Timestamp:
Jun 20, 2011 6:16:08 AM (13 years ago)
Author:
ming
Message:

Closed #1309: Add video device capability to support changing position and hiding of renderer window.

Provide SDL implementation for both capabilities.

Location:
pjproject/branches/projects/2.0-dev/pjmedia
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • pjproject/branches/projects/2.0-dev/pjmedia/include/pjmedia-videodev/videodev.h

    r3579 r3590  
    110110     */ 
    111111    PJMEDIA_VID_DEV_CAP_OUTPUT_RESIZE = 8, 
     112 
     113    /** 
     114     * Support for setting the video window's position. 
     115     * Value is pjmedia_coord specifying the window's new coordinate. 
     116     */ 
     117    PJMEDIA_VID_DEV_CAP_OUTPUT_POSITION = 16, 
     118 
     119    /** 
     120     * Support for setting the video output's visibility. 
     121     * The value of this capability is a pj_bool_t containing boolean 
     122     * PJ_TRUE or PJ_FALSE. 
     123     */ 
     124    PJMEDIA_VID_DEV_CAP_OUTPUT_HIDE = 32, 
    112125 
    113126    /** 
     
    299312    pjmedia_rect_size disp_size; 
    300313 
     314    /** 
     315     * Video window position. This setting is optional, and will only be used 
     316     * if PJMEDIA_VID_DEV_CAP_OUTPUT_POSITION is set in the flags. 
     317     */ 
     318    pjmedia_coord window_pos; 
     319 
     320    /** 
     321     * Video window's visibility. This setting is optional, and will only be 
     322     * used if PJMEDIA_VID_DEV_CAP_OUTPUT_HIDE is set in the flags. 
     323     */ 
     324    pj_bool_t window_hide; 
     325 
    301326} pjmedia_vid_param; 
    302327 
  • pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia-videodev/sdl_dev.c

    r3580 r3590  
    10511051            goto on_error; 
    10521052        } 
    1053  
    1054         pjmedia_format_copy(&strm->conv_param.src, &param->fmt); 
    1055         pjmedia_format_copy(&strm->conv_param.dst, &param->fmt); 
    1056         /* 
    1057         status = pjmedia_converter_create(NULL, pool, &strm->conv_param, 
    1058                                           &strm->conv); 
    1059          */ 
    10601053    } 
    10611054 
    10621055    /* Apply the remaining settings */ 
    1063     if (param->flags & PJMEDIA_VID_DEV_CAP_OUTPUT_WINDOW) { 
     1056    if (param->flags & PJMEDIA_VID_DEV_CAP_OUTPUT_POSITION) { 
    10641057        sdl_stream_set_cap(&strm->base, 
    1065                            PJMEDIA_VID_DEV_CAP_OUTPUT_WINDOW, 
    1066                            &param->window); 
     1058                           PJMEDIA_VID_DEV_CAP_OUTPUT_POSITION, 
     1059                           &param->window_pos); 
     1060    } 
     1061    if (param->flags & PJMEDIA_VID_DEV_CAP_OUTPUT_HIDE) { 
     1062        sdl_stream_set_cap(&strm->base, 
     1063                           PJMEDIA_VID_DEV_CAP_OUTPUT_HIDE, 
     1064                           &param->window_hide); 
    10671065    } 
    10681066 
     
    11111109    if (cap == PJMEDIA_VID_DEV_CAP_OUTPUT_WINDOW) 
    11121110    { 
     1111        pval = strm->window; 
    11131112        return PJ_SUCCESS; 
    1114     } else if (cap == PJMEDIA_VID_DEV_CAP_FORMAT) { 
     1113    } else if (cap == PJMEDIA_VID_DEV_CAP_OUTPUT_POSITION) { 
     1114        SDL_GetWindowPosition(strm->window, &((pjmedia_coord *)pval)->x, 
     1115                              &((pjmedia_coord *)pval)->y); 
    11151116        return PJ_SUCCESS; 
    11161117    } else { 
     
    11301131    PJ_ASSERT_RETURN(s && pval, PJ_EINVAL); 
    11311132 
    1132     if (cap == PJMEDIA_VID_DEV_CAP_OUTPUT_WINDOW) { 
     1133    if (cap == PJMEDIA_VID_DEV_CAP_OUTPUT_POSITION) { 
     1134        SDL_SetWindowPosition(strm->window, ((pjmedia_coord *)pval)->x, 
     1135                              ((pjmedia_coord *)pval)->y); 
     1136        return PJ_SUCCESS; 
     1137    } else if (cap == PJMEDIA_VID_DEV_CAP_OUTPUT_HIDE) { 
     1138        if (*(pj_bool_t *)pval) 
     1139            SDL_HideWindow(strm->window); 
     1140        else 
     1141            SDL_ShowWindow(strm->window); 
    11331142        return PJ_SUCCESS; 
    11341143    } else if (cap == PJMEDIA_VID_DEV_CAP_FORMAT) { 
Note: See TracChangeset for help on using the changeset viewer.