Ignore:
Timestamp:
Oct 26, 2011 9:01:53 AM (13 years ago)
Author:
ming
Message:

Fixed #1401: Add support for video device's window flags

Now support flags PJMEDIA_VID_DEV_WND_BORDER and PJMEDIA_VID_DEV_WND_RESIZABLE.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/src/pjmedia-videodev/sdl_dev.c

    r3794 r3864  
    494494                         PJMEDIA_VID_DEV_CAP_OUTPUT_RESIZE; 
    495495        ddi->info.caps |= PJMEDIA_VID_DEV_CAP_OUTPUT_WINDOW; 
     496        ddi->info.caps |= PJMEDIA_VID_DEV_CAP_OUTPUT_WINDOW_FLAGS; 
    496497 
    497498        for (j = 0; j < ddi->info.fmt_cnt; j++) { 
     
    700701 
    701702    if (!strm->window) { 
    702         Uint32 flags = /*SDL_WINDOW_RESIZABLE; */ SDL_WINDOW_BORDERLESS; 
     703        Uint32 flags = 0; 
     704         
     705        if (strm->param.flags & PJMEDIA_VID_DEV_CAP_OUTPUT_WINDOW_FLAGS) { 
     706            if (!(strm->param.window_flags & PJMEDIA_VID_DEV_WND_BORDER)) 
     707                flags |= SDL_WINDOW_BORDERLESS; 
     708            if (strm->param.window_flags & PJMEDIA_VID_DEV_WND_RESIZABLE) 
     709                flags |= SDL_WINDOW_RESIZABLE; 
     710        } else { 
     711            flags |= SDL_WINDOW_BORDERLESS; 
     712        } 
    703713 
    704714        if (!((strm->param.flags & PJMEDIA_VID_DEV_CAP_OUTPUT_HIDE) && 
     
    971981    { 
    972982        pi->flags |= PJMEDIA_VID_DEV_CAP_OUTPUT_HIDE; 
     983    } 
     984    if (sdl_stream_get_cap(s, PJMEDIA_VID_DEV_CAP_OUTPUT_WINDOW_FLAGS, 
     985                           &pi->window_flags) == PJ_SUCCESS) 
     986    { 
     987        pi->flags |= PJMEDIA_VID_DEV_CAP_OUTPUT_WINDOW_FLAGS; 
    973988    } 
    974989 
     
    10381053    } else if (cap == PJMEDIA_VID_DEV_CAP_OUTPUT_HIDE) { 
    10391054        Uint32 flag = SDL_GetWindowFlags(strm->window); 
    1040         *((pj_bool_t *)pval) = (flag | SDL_WINDOW_HIDDEN)? PJ_TRUE: PJ_FALSE; 
     1055        *((pj_bool_t *)pval) = (flag & SDL_WINDOW_HIDDEN)? PJ_TRUE: PJ_FALSE; 
     1056        return PJ_SUCCESS; 
     1057    } else if (cap == PJMEDIA_VID_DEV_CAP_OUTPUT_WINDOW_FLAGS) { 
     1058        Uint32 flag = SDL_GetWindowFlags(strm->window); 
     1059        unsigned *wnd_flags = (unsigned *)pval; 
     1060        if (!(flag & SDL_WINDOW_BORDERLESS)) 
     1061            *wnd_flags |= PJMEDIA_VID_DEV_WND_BORDER; 
     1062        if (flag & SDL_WINDOW_RESIZABLE) 
     1063            *wnd_flags |= PJMEDIA_VID_DEV_WND_RESIZABLE; 
    10411064        return PJ_SUCCESS; 
    10421065    } 
Note: See TracChangeset for help on using the changeset viewer.