Changeset 3641 for pjproject


Ignore:
Timestamp:
Jul 14, 2011 6:34:29 AM (13 years ago)
Author:
bennylp
Message:

More re #1325 (pjmedia signature): invented pjmedia PJMEDIA_FOURCC macro, and change signature and pjmedia_format_id to use this object. Added pjmedia_fourcc_name( ) too

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

Legend:

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

    r3493 r3641  
    4141 * enumeration. 
    4242 */ 
    43 #define PJMEDIA_FORMAT_PACK(C1, C2, C3, C4) ( C4<<24 | C3<<16 | C2<<8 | C1 ) 
     43#define PJMEDIA_FORMAT_PACK(C1, C2, C3, C4) PJMEDIA_FOURCC(C1, C2, C3, C4) 
    4444 
    4545/** 
  • pjproject/branches/projects/2.0-dev/pjmedia/include/pjmedia/signatures.h

    r3640 r3641  
    105105 * @return              The string. 
    106106 */ 
    107 PJ_INLINE(const char*) pjmedia_sig_to_str(pjmedia_obj_sig sig, char buf[]) 
     107PJ_INLINE(const char*) pjmedia_sig_name(pjmedia_obj_sig sig, char buf[]) 
    108108{ 
    109     buf[0] = (char)((sig >> 24) & 0xFF); 
    110     buf[1] = (char)((sig >> 16) & 0xFF); 
    111     buf[2] = (char)((sig >>  8) & 0xFF); 
    112     buf[3] = (char)((sig >>  0) & 0xFF); 
    113     buf[4] = '\0'; 
    114     return buf; 
     109    return pjmedia_fourcc_name(sig, buf); 
    115110} 
    116111 
     
    118113 * Macro to generate signature from four ASCII letters. 
    119114 */ 
    120 #define PJMEDIA_SIGNATURE(a,b,c,d)      (a<<24 | b<<16 | c<<8 | d) 
     115#define PJMEDIA_SIGNATURE(a,b,c,d)      PJMEDIA_FOURCC(a,b,c,d) 
    121116 
    122117/************************************************************************* 
  • pjproject/branches/projects/2.0-dev/pjmedia/include/pjmedia/types.h

    r3606 r3641  
    192192} pjmedia_rect; 
    193193 
     194/** 
     195 * Macro for packing format from a four character code, similar to FOURCC. 
     196 */ 
     197#define PJMEDIA_FOURCC(C1, C2, C3, C4) ( C4<<24 | C3<<16 | C2<<8 | C1 ) 
     198 
    194199 
    195200/** 
     
    203208 
    204209/** 
     210 * A utility function to convert fourcc type of value to four letters string. 
     211 * 
     212 * @param sig           The fourcc value. 
     213 * @param buf           Buffer to store the string, which MUST be at least 
     214 *                      five bytes long. 
     215 * 
     216 * @return              The string. 
     217 */ 
     218PJ_INLINE(const char*) pjmedia_fourcc_name(pj_uint32_t sig, char buf[]) 
     219{ 
     220    buf[3] = (char)((sig >> 24) & 0xFF); 
     221    buf[2] = (char)((sig >> 16) & 0xFF); 
     222    buf[1] = (char)((sig >>  8) & 0xFF); 
     223    buf[0] = (char)((sig >>  0) & 0xFF); 
     224    buf[4] = '\0'; 
     225    return buf; 
     226} 
     227 
     228 
     229/** 
    205230 * @} 
    206231 */ 
  • pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia/vid_stream.c

    r3640 r3641  
    310310{ 
    311311    const pjmedia_port_info *pi = &chan->port.info; 
     312    char fourcc_name[5]; 
    312313 
    313314    PJ_LOG(5, (pi->name.ptr, 
    314                " %s format %s: %dx%d %c%c%c%c%s %d/%d(~%d)fps", 
     315               " %s format %s: %dx%d %s%s %d/%d(~%d)fps", 
    315316               (chan->dir==PJMEDIA_DIR_DECODING? "Decoding":"Encoding"), 
    316317               event_name, 
    317318               pi->fmt.det.vid.size.w, pi->fmt.det.vid.size.h, 
    318                ((pi->fmt.id & 0x000000FF) >> 0), 
    319                ((pi->fmt.id & 0x0000FF00) >> 8), 
    320                ((pi->fmt.id & 0x00FF0000) >> 16), 
    321                ((pi->fmt.id & 0xFF000000) >> 24), 
     319               pjmedia_fourcc_name(pi->fmt.id, fourcc_name), 
    322320               (chan->dir==PJMEDIA_DIR_ENCODING?"->":"<-"), 
    323321               pi->fmt.det.vid.fps.num, pi->fmt.det.vid.fps.denum, 
     
    10501048    const char *type_name; 
    10511049    pjmedia_format *fmt; 
     1050    char fourcc_name[5]; 
    10521051    pjmedia_port_info *pi; 
    10531052     
     
    11221121 
    11231122    PJ_LOG(5, (name.ptr, 
    1124                "%s channel created %dx%d %c%c%c%c%s%.*s %d/%d(~%d)fps", 
     1123               "%s channel created %dx%d %s%s%.*s %d/%d(~%d)fps", 
    11251124               (dir==PJMEDIA_DIR_ENCODING?"Encoding":"Decoding"), 
    11261125               pi->fmt.det.vid.size.w, pi->fmt.det.vid.size.h, 
    1127                ((pi->fmt.id & 0x000000FF) >> 0), 
    1128                ((pi->fmt.id & 0x0000FF00) >> 8), 
    1129                ((pi->fmt.id & 0x00FF0000) >> 16), 
    1130                ((pi->fmt.id & 0xFF000000) >> 24), 
     1126               pjmedia_fourcc_name(pi->fmt.id, fourcc_name), 
    11311127               (dir==PJMEDIA_DIR_ENCODING?"->":"<-"), 
    11321128               info->codec_info.encoding_name.slen, 
Note: See TracChangeset for help on using the changeset viewer.