Changeset 4808 for pjproject


Ignore:
Timestamp:
Apr 1, 2014 9:47:15 AM (8 years ago)
Author:
nanang
Message:

Re #1750:

  • Replaced "enum CodecID" with "unsigned" (previous fix raised compile error for some older ffmpeg versions).
  • Handled PIX_FMT_GBR24P hassle.
Location:
pjproject/trunk/pjmedia/src/pjmedia
Files:
2 edited

Legend:

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

    r4613 r4808  
    2727#include <libavformat/avformat.h> 
    2828 
    29 #define MAKE_VER(mj,mn,mi)      ((mj << 16) | (mn << 8) | (mi << 0)) 
    30 #define VER_AT_LEAST(mj,mn,mi)  (MAKE_VER(LIBAVUTIL_VERSION_MAJOR, \ 
    31                                           LIBAVUTIL_VERSION_MINOR, \ 
    32                                           LIBAVUTIL_VERSION_MICRO) >= \ 
    33                                  MAKE_VER(mj,mn,mi)) 
    34  
    35  
     29/* PIX_FMT_GBR24P hassle: 
     30 * - PIX_FMT_GBR24P is introduced (perhaps in avutil 51.20.1) 
     31 * - suddenly PIX_FMT_GBR24P is replaced by PIX_FMT_GBRP, no alias defined, 
     32 *   so PIX_FMT_GBR24P is just gone! (perhaps in avutil 51.42.0) 
     33 * - then lately PIX_FMT_GBR24P is defined as PIX_FMT_GBRP 
     34 */ 
     35#if !defined(PIX_FMT_GBR24P) && \ 
     36    LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(51,42,0) 
     37#  define PIX_FMT_GBR24P PIX_FMT_GBRP 
     38#endif 
    3639 
    3740/* Conversion table between pjmedia_format_id and PixelFormat */ 
     
    4548    { PJMEDIA_FORMAT_RGB24,PIX_FMT_BGR24}, 
    4649    { PJMEDIA_FORMAT_BGRA, PIX_FMT_BGRA}, 
    47 #if VER_AT_LEAST(51,20,1) 
     50#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(51, 20, 1) 
    4851    { PJMEDIA_FORMAT_GBRP, PIX_FMT_GBR24P}, 
    4952#endif 
     
    6366{ 
    6467    pjmedia_format_id   id; 
    65     enum CodecID        codec_id; 
     68    unsigned            codec_id; 
    6669} ffmpeg_codec_table[] = 
    6770{ 
     
    168171 
    169172pj_status_t pjmedia_format_id_to_CodecID(pjmedia_format_id fmt_id, 
    170                                          enum CodecID *codec_id) 
     173                                         unsigned *codec_id) 
    171174{ 
    172175    unsigned i; 
     
    179182    } 
    180183 
    181     *codec_id = PIX_FMT_NONE; 
    182     return PJ_ENOTFOUND; 
    183 } 
    184  
    185 pj_status_t CodecID_to_pjmedia_format_id(enum CodecID codec_id, 
     184    *codec_id = (unsigned)PIX_FMT_NONE; 
     185    return PJ_ENOTFOUND; 
     186} 
     187 
     188pj_status_t CodecID_to_pjmedia_format_id(unsigned codec_id, 
    186189                                         pjmedia_format_id *fmt_id) 
    187190{ 
     
    189192    for (i=0; i<PJ_ARRAY_SIZE(ffmpeg_codec_table); ++i) { 
    190193        const struct ffmpeg_codec_table_t *t = &ffmpeg_codec_table[i]; 
    191         if (t->codec_id == codec_id) { 
     194        if ((unsigned)t->codec_id == codec_id) { 
    192195            if (fmt_id) *fmt_id = t->id; 
    193196            return PJ_SUCCESS; 
  • pjproject/trunk/pjmedia/src/pjmedia/ffmpeg_util.h

    r4801 r4808  
    3838#include <libavcodec/avcodec.h> 
    3939 
    40 #ifndef CodecID 
    41   #define CodecID AVCodecID 
    42 #endif 
    43  
    4440void pjmedia_ffmpeg_add_ref(); 
    4541void pjmedia_ffmpeg_dec_ref(); 
     
    5248 
    5349pj_status_t pjmedia_format_id_to_CodecID(pjmedia_format_id fmt_id, 
    54                                          enum CodecID *codec_id); 
     50                                         unsigned *codec_id); 
    5551 
    56 pj_status_t CodecID_to_pjmedia_format_id(enum CodecID codec_id, 
     52pj_status_t CodecID_to_pjmedia_format_id(unsigned codec_id, 
    5753                                         pjmedia_format_id *fmt_id); 
    5854 
Note: See TracChangeset for help on using the changeset viewer.