Ignore:
Timestamp:
Jul 7, 2011 7:34:26 AM (13 years ago)
Author:
bennylp
Message:

Misc (re #1320): added pjmedia_type_name() API

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia/types.c

    r3392 r3606  
    1818 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
    1919 */ 
    20 #include <pjmedia/frame.h> 
    21 #include <pjmedia/port.h> 
    2220#include <pjmedia/types.h> 
    23 #include <pj/pool.h> 
     21#include <pj/assert.h> 
    2422 
     23/** 
     24 * Utility function to return the string name for a pjmedia_type. 
     25 * 
     26 * @param t             The media type. 
     27 * 
     28 * @return              String. 
     29 */ 
     30PJ_DEF(const char*) pjmedia_type_name(pjmedia_type t) 
     31{ 
     32    const char *type_names[] = { 
     33        "none", 
     34        "audio", 
     35        "video", 
     36        "application", 
     37        "unknown" 
     38    }; 
     39 
     40    pj_assert(t < PJ_ARRAY_SIZE(type_names)); 
     41    pj_assert(PJMEDIA_TYPE_UNKNOWN == 4); 
     42 
     43    if (t < PJ_ARRAY_SIZE(type_names)) 
     44        return type_names[t]; 
     45    else 
     46        return "??"; 
     47} 
Note: See TracChangeset for help on using the changeset viewer.