Revision 80a07f6e libavcodec/imgconvert.c

View differences:

libavcodec/imgconvert.c
391 391
        return av_pix_fmt_descriptors[pix_fmt].name;
392 392
}
393 393

  
394
static enum PixelFormat avcodec_get_pix_fmt_internal(const char *name)
395
{
396
    int i;
397

  
398
    for (i=0; i < PIX_FMT_NB; i++)
399
        if (av_pix_fmt_descriptors[i].name && !strcmp(av_pix_fmt_descriptors[i].name, name))
400
            return i;
401
    return PIX_FMT_NONE;
402
}
403

  
404
#if HAVE_BIGENDIAN
405
#   define X_NE(be, le) be
406
#else
407
#   define X_NE(be, le) le
408
#endif
409

  
394
#if LIBAVCODEC_VERSION_MAJOR < 53
410 395
enum PixelFormat avcodec_get_pix_fmt(const char *name)
411 396
{
412
    enum PixelFormat pix_fmt;
413

  
414
    if (!strcmp(name, "rgb32"))
415
        name = X_NE("argb", "bgra");
416
    else if (!strcmp(name, "bgr32"))
417
        name = X_NE("abgr", "rgba");
418

  
419
    pix_fmt = avcodec_get_pix_fmt_internal(name);
420
    if (pix_fmt == PIX_FMT_NONE) {
421
        char name2[32];
422
        snprintf(name2, sizeof(name2), "%s%s", name, X_NE("be", "le"));
423
        pix_fmt = avcodec_get_pix_fmt_internal(name2);
424
    }
425
    return pix_fmt;
397
    return av_get_pix_fmt(name);
426 398
}
399
#endif
427 400

  
428 401
void avcodec_pix_fmt_string (char *buf, int buf_size, enum PixelFormat pix_fmt)
429 402
{

Also available in: Unified diff