Revision 80a07f6e

View differences:

libavcodec/avcodec.h
2995 2995
const char *avcodec_get_pix_fmt_name(enum PixelFormat pix_fmt);
2996 2996
void avcodec_set_dimensions(AVCodecContext *s, int width, int height);
2997 2997

  
2998
#if LIBAVCODEC_VERSION_MAJOR < 53
2998 2999
/**
2999 3000
 * Returns the pixel format corresponding to the name name.
3000 3001
 *
......
3005 3006
 * then for "gray16le".
3006 3007
 *
3007 3008
 * Finally if no pixel format has been found, returns PIX_FMT_NONE.
3009
 *
3010
 * @deprecated Deprecated in favor of av_get_pix_fmt().
3008 3011
 */
3009
enum PixelFormat avcodec_get_pix_fmt(const char* name);
3012
attribute_deprecated enum PixelFormat avcodec_get_pix_fmt(const char* name);
3013
#endif
3010 3014

  
3011 3015
/**
3012 3016
 * Returns a value representing the fourCC code associated to the
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
{
libavutil/avutil.h
40 40
#define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c)
41 41

  
42 42
#define LIBAVUTIL_VERSION_MAJOR 50
43
#define LIBAVUTIL_VERSION_MINOR  7
43
#define LIBAVUTIL_VERSION_MINOR  8
44 44
#define LIBAVUTIL_VERSION_MICRO  0
45 45

  
46 46
#define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
libavutil/pixdesc.c
654 654
    },
655 655
};
656 656

  
657
static enum PixelFormat get_pix_fmt_internal(const char *name)
658
{
659
    enum PixelFormat pix_fmt;
660

  
661
    for (pix_fmt = 0; pix_fmt < PIX_FMT_NB; pix_fmt++)
662
        if (av_pix_fmt_descriptors[pix_fmt].name &&
663
            !strcmp(av_pix_fmt_descriptors[pix_fmt].name, name))
664
            return pix_fmt;
665

  
666
    return PIX_FMT_NONE;
667
}
668

  
669
#if HAVE_BIGENDIAN
670
#   define X_NE(be, le) be
671
#else
672
#   define X_NE(be, le) le
673
#endif
674

  
675
enum PixelFormat av_get_pix_fmt(const char *name)
676
{
677
    enum PixelFormat pix_fmt;
678

  
679
    if (!strcmp(name, "rgb32"))
680
        name = X_NE("argb", "bgra");
681
    else if (!strcmp(name, "bgr32"))
682
        name = X_NE("abgr", "rgba");
683

  
684
    pix_fmt = get_pix_fmt_internal(name);
685
    if (pix_fmt == PIX_FMT_NONE) {
686
        char name2[32];
687

  
688
        snprintf(name2, sizeof(name2), "%s%s", name, X_NE("be", "le"));
689
        pix_fmt = get_pix_fmt_internal(name2);
690
    }
691
    return pix_fmt;
692
}
693

  
657 694
int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
658 695
{
659 696
    int c, bits = 0;
libavutil/pixdesc.h
203 203
}
204 204

  
205 205
/**
206
 * Returns the pixel format corresponding to name.
207
 *
208
 * If there is no pixel format with name name, then looks for a
209
 * pixel format with the name corresponding to the native endian
210
 * format of name.
211
 * For example in a little-endian system, first looks for "gray16",
212
 * then for "gray16le".
213
 *
214
 * Finally if no pixel format has been found, returns PIX_FMT_NONE.
215
 */
216
enum PixelFormat av_get_pix_fmt(const char *name);
217

  
218
/**
206 219
 * Returns the number of bits per pixel used by the pixel format
207 220
 * described by pixdesc.
208 221
 *

Also available in: Unified diff