Ignore:
Timestamp:
Nov 13, 2019 9:11:04 AM (4 years ago)
Author:
nanang
Message:

Close #1437: Video keyframe request/response using RTCP-FB PLI.

File:
1 edited

Legend:

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

    r4411 r6106  
    2020#include <pjmedia/types.h> 
    2121#include <pj/assert.h> 
     22#include <pj/string.h> 
    2223 
    23 /** 
     24 
     25/* Map structure for pjmedia type names */ 
     26typedef struct pjmedia_type_map { 
     27    pjmedia_type type; 
     28    const char* name; 
     29} pjmedia_type_map; 
     30 
     31/* Internal mapping for pjmedia type names */ 
     32static pjmedia_type_map media_type_names[] = { 
     33    {PJMEDIA_TYPE_NONE,         "none"}, 
     34    {PJMEDIA_TYPE_AUDIO,        "audio"}, 
     35    {PJMEDIA_TYPE_VIDEO,        "video"}, 
     36    {PJMEDIA_TYPE_APPLICATION,  "application"}, 
     37    {PJMEDIA_TYPE_UNKNOWN,      "unknown"} 
     38}; 
     39 
     40/* 
    2441 * Utility function to return the string name for a pjmedia_type. 
    25  * 
    26  * @param t             The media type. 
    27  * 
    28  * @return              String. 
    2942 */ 
    3043PJ_DEF(const char*) pjmedia_type_name(pjmedia_type t) 
    3144{ 
    32     const char *type_names[] = { 
    33         "none", 
    34         "audio", 
    35         "video", 
    36         "application", 
    37         "unknown" 
    38     }; 
    39  
    40     pj_assert(t < (int)PJ_ARRAY_SIZE(type_names)); 
     45    pj_assert(t < (int)PJ_ARRAY_SIZE(media_type_names)); 
    4146    pj_assert(PJMEDIA_TYPE_UNKNOWN == 4); 
    4247 
    43     if (t < (int)PJ_ARRAY_SIZE(type_names)) 
    44         return type_names[t]; 
     48    if (t < (int)PJ_ARRAY_SIZE(media_type_names)) 
     49        return media_type_names[t].name; 
    4550    else 
    4651        return "??"; 
    4752} 
     53 
     54/* 
     55 * Utility function to return the media type for a media name string. 
     56 */ 
     57PJ_DEF(pjmedia_type) pjmedia_get_type(const pj_str_t *name) 
     58{ 
     59    int i; 
     60    for (i = 0; i < PJ_ARRAY_SIZE(media_type_names); ++i) { 
     61        if (pj_stricmp2(name, media_type_names[i].name)==0) 
     62            return media_type_names[i].type; 
     63    } 
     64    return PJMEDIA_TYPE_UNKNOWN; 
     65} 
Note: See TracChangeset for help on using the changeset viewer.