Ignore:
Timestamp:
Oct 18, 2011 1:51:01 AM (8 years ago)
Author:
nanang
Message:

Reenable ffmpeg H264 (re #1390):

  • Review H264 codec settings such as profile, level, NAL unit size, bitrate, quality, latency.
  • Added new format PJMEDIA_FORMAT_GBRP, 24 bits planar RGB, one of the formats outputted by the latest ffmpeg H264 decoder.
  • Fixed format change detection bug in ffmpeg wrapper, decoder didn't update its internal state with the new format so format change event was generated in every decoding operation.
  • Added compile time configurations for enabling/disabling ffmpeg codec H263+ & H264.
  • Updated pjsua app to adjust window size to original video size. With H264, default window size will be too big as it is init'd with default H264 video size, e.g: 720x480 for profile level 30.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/src/pjmedia/format.c

    r3715 r3819  
    7979                                    pjmedia_video_apply_fmt_param *aparam); 
    8080 
     81static pj_status_t apply_planar_444(const pjmedia_video_format_info *fi, 
     82                                    pjmedia_video_apply_fmt_param *aparam); 
     83 
    8184struct pjmedia_video_format_mgr 
    8285{ 
     
    9396    {PJMEDIA_FORMAT_BGRA,  "BGRA", PJMEDIA_COLOR_MODEL_RGB, 32, 1, &apply_packed_fmt}, 
    9497    {PJMEDIA_FORMAT_DIB ,  "DIB ", PJMEDIA_COLOR_MODEL_RGB, 24, 1, &apply_packed_fmt}, 
     98    {PJMEDIA_FORMAT_GBRP,  "GBRP", PJMEDIA_COLOR_MODEL_RGB, 24, 3, &apply_planar_444}, 
    9599    {PJMEDIA_FORMAT_AYUV,  "AYUV", PJMEDIA_COLOR_MODEL_YUV, 32, 1, &apply_packed_fmt}, 
    96100    {PJMEDIA_FORMAT_YUY2,  "YUY2", PJMEDIA_COLOR_MODEL_YUV, 16, 1, &apply_packed_fmt}, 
     
    241245} 
    242246 
     247static pj_status_t apply_planar_444(const pjmedia_video_format_info *fi, 
     248                                    pjmedia_video_apply_fmt_param *aparam) 
     249{ 
     250    unsigned i; 
     251    pj_size_t Y_bytes; 
     252 
     253    PJ_UNUSED_ARG(fi); 
     254 
     255    /* Calculate memsize */ 
     256    Y_bytes = (pj_size_t)(aparam->size.w * aparam->size.h); 
     257    aparam->framebytes = (Y_bytes * 3); 
     258 
     259    /* Planar formats use 3 plane */ 
     260    aparam->strides[0] = aparam->strides[1] =  
     261                         aparam->strides[2] = aparam->size.w; 
     262 
     263    aparam->planes[0] = aparam->buffer; 
     264    aparam->planes[1] = aparam->planes[0] + Y_bytes; 
     265    aparam->planes[2] = aparam->planes[1] + Y_bytes; 
     266 
     267    aparam->plane_bytes[0] = aparam->plane_bytes[1] = 
     268                             aparam->plane_bytes[2] = Y_bytes; 
     269 
     270    /* Zero unused planes */ 
     271    for (i=3; i<PJMEDIA_MAX_VIDEO_PLANES; ++i) { 
     272        aparam->strides[i] = 0; 
     273        aparam->planes[i] = NULL; 
     274        aparam->plane_bytes[i] = 0; 
     275    } 
     276 
     277    return PJ_SUCCESS; 
     278} 
     279 
    243280PJ_DEF(pj_status_t) 
    244281pjmedia_video_format_mgr_create(pj_pool_t *pool, 
Note: See TracChangeset for help on using the changeset viewer.