Mercurial > libavcodec.hg
comparison imgconvert.c @ 9242:3153dcc9f8d0 libavcodec
Factorize: use the X_NE() macro in avcodec_get_pix_fmt().
author | stefano |
---|---|
date | Sun, 22 Mar 2009 22:13:10 +0000 |
parents | 4b74d02db3df |
children | b5d1395879a0 |
comparison
equal
deleted
inserted
replaced
9241:4f827ca90571 | 9242:3153dcc9f8d0 |
---|---|
505 # define X_NE(be, le) le | 505 # define X_NE(be, le) le |
506 #endif | 506 #endif |
507 | 507 |
508 enum PixelFormat avcodec_get_pix_fmt(const char *name) | 508 enum PixelFormat avcodec_get_pix_fmt(const char *name) |
509 { | 509 { |
510 #ifdef WORDS_BIGENDIAN | |
511 # define NE "be" | |
512 #else | |
513 # define NE "le" | |
514 #endif | |
515 enum PixelFormat pix_fmt = avcodec_get_pix_fmt_internal(name); | 510 enum PixelFormat pix_fmt = avcodec_get_pix_fmt_internal(name); |
516 | 511 |
517 if (pix_fmt == PIX_FMT_NONE) { | 512 if (pix_fmt == PIX_FMT_NONE) { |
518 char name2[32]; | 513 char name2[32]; |
519 snprintf(name2, sizeof(name2), "%s%s", name, NE); | 514 snprintf(name2, sizeof(name2), "%s%s", name, X_NE("be", "le")); |
520 pix_fmt = avcodec_get_pix_fmt_internal(name2); | 515 pix_fmt = avcodec_get_pix_fmt_internal(name2); |
521 } | 516 } |
522 return pix_fmt; | 517 return pix_fmt; |
523 #undef NE | |
524 } | 518 } |
525 | 519 |
526 void avcodec_pix_fmt_string (char *buf, int buf_size, enum PixelFormat pix_fmt) | 520 void avcodec_pix_fmt_string (char *buf, int buf_size, enum PixelFormat pix_fmt) |
527 { | 521 { |
528 /* print header */ | 522 /* print header */ |