comparison avcodec.h @ 9221:a15ec86bf752 libavcodec

Globally prefer enum PixelFormat over int when it makes sense.
author stefano
date Sat, 21 Mar 2009 22:24:44 +0000
parents 18dffa8f2382
children e314914641bc
comparison
equal deleted inserted replaced
9220:cb62e27e2c07 9221:a15ec86bf752
29 #include <errno.h> 29 #include <errno.h>
30 #include "libavutil/avutil.h" 30 #include "libavutil/avutil.h"
31 31
32 #define LIBAVCODEC_VERSION_MAJOR 52 32 #define LIBAVCODEC_VERSION_MAJOR 52
33 #define LIBAVCODEC_VERSION_MINOR 22 33 #define LIBAVCODEC_VERSION_MINOR 22
34 #define LIBAVCODEC_VERSION_MICRO 0 34 #define LIBAVCODEC_VERSION_MICRO 1
35 35
36 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ 36 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
37 LIBAVCODEC_VERSION_MINOR, \ 37 LIBAVCODEC_VERSION_MINOR, \
38 LIBAVCODEC_VERSION_MICRO) 38 LIBAVCODEC_VERSION_MICRO)
39 #define LIBAVCODEC_VERSION AV_VERSION(LIBAVCODEC_VERSION_MAJOR, \ 39 #define LIBAVCODEC_VERSION AV_VERSION(LIBAVCODEC_VERSION_MAJOR, \
2659 * @param pix_fmt the format of the picture 2659 * @param pix_fmt the format of the picture
2660 * @param width the width of the picture 2660 * @param width the width of the picture
2661 * @param height the height of the picture 2661 * @param height the height of the picture
2662 * @return zero if successful, a negative value if not 2662 * @return zero if successful, a negative value if not
2663 */ 2663 */
2664 int avpicture_alloc(AVPicture *picture, int pix_fmt, int width, int height); 2664 int avpicture_alloc(AVPicture *picture, enum PixelFormat pix_fmt, int width, int height);
2665 2665
2666 /** 2666 /**
2667 * Free a picture previously allocated by avpicture_alloc(). 2667 * Free a picture previously allocated by avpicture_alloc().
2668 * 2668 *
2669 * @param picture the AVPicture to be freed 2669 * @param picture the AVPicture to be freed
2687 * @param height the height of the image in pixels 2687 * @param height the height of the image in pixels
2688 * @return size of the image data in bytes 2688 * @return size of the image data in bytes
2689 */ 2689 */
2690 int avpicture_fill(AVPicture *picture, uint8_t *ptr, 2690 int avpicture_fill(AVPicture *picture, uint8_t *ptr,
2691 int pix_fmt, int width, int height); 2691 int pix_fmt, int width, int height);
2692 int avpicture_layout(const AVPicture* src, int pix_fmt, int width, int height, 2692 int avpicture_layout(const AVPicture* src, enum PixelFormat pix_fmt, int width, int height,
2693 unsigned char *dest, int dest_size); 2693 unsigned char *dest, int dest_size);
2694 2694
2695 /** 2695 /**
2696 * Calculate the size in bytes that a picture of the given width and height 2696 * Calculate the size in bytes that a picture of the given width and height
2697 * would occupy if stored in the given picture format. 2697 * would occupy if stored in the given picture format.
2702 * @param pix_fmt the given picture format 2702 * @param pix_fmt the given picture format
2703 * @param width the width of the image 2703 * @param width the width of the image
2704 * @param height the height of the image 2704 * @param height the height of the image
2705 * @return Image data size in bytes or -1 on error (e.g. too large dimensions). 2705 * @return Image data size in bytes or -1 on error (e.g. too large dimensions).
2706 */ 2706 */
2707 int avpicture_get_size(int pix_fmt, int width, int height); 2707 int avpicture_get_size(enum PixelFormat pix_fmt, int width, int height);
2708 void avcodec_get_chroma_sub_sample(int pix_fmt, int *h_shift, int *v_shift); 2708 void avcodec_get_chroma_sub_sample(enum PixelFormat pix_fmt, int *h_shift, int *v_shift);
2709 const char *avcodec_get_pix_fmt_name(int pix_fmt); 2709 const char *avcodec_get_pix_fmt_name(enum PixelFormat pix_fmt);
2710 void avcodec_set_dimensions(AVCodecContext *s, int width, int height); 2710 void avcodec_set_dimensions(AVCodecContext *s, int width, int height);
2711 enum PixelFormat avcodec_get_pix_fmt(const char* name); 2711 enum PixelFormat avcodec_get_pix_fmt(const char* name);
2712 unsigned int avcodec_pix_fmt_to_codec_tag(enum PixelFormat p); 2712 unsigned int avcodec_pix_fmt_to_codec_tag(enum PixelFormat p);
2713 2713
2714 #define FF_LOSS_RESOLUTION 0x0001 /**< loss due to resolution change */ 2714 #define FF_LOSS_RESOLUTION 0x0001 /**< loss due to resolution change */
2733 * @param[in] dst_pix_fmt destination pixel format 2733 * @param[in] dst_pix_fmt destination pixel format
2734 * @param[in] src_pix_fmt source pixel format 2734 * @param[in] src_pix_fmt source pixel format
2735 * @param[in] has_alpha Whether the source pixel format alpha channel is used. 2735 * @param[in] has_alpha Whether the source pixel format alpha channel is used.
2736 * @return Combination of flags informing you what kind of losses will occur. 2736 * @return Combination of flags informing you what kind of losses will occur.
2737 */ 2737 */
2738 int avcodec_get_pix_fmt_loss(int dst_pix_fmt, int src_pix_fmt, 2738 int avcodec_get_pix_fmt_loss(enum PixelFormat dst_pix_fmt, enum PixelFormat src_pix_fmt,
2739 int has_alpha); 2739 int has_alpha);
2740 2740
2741 /** 2741 /**
2742 * Finds the best pixel format to convert to given a certain source pixel 2742 * Finds the best pixel format to convert to given a certain source pixel
2743 * format. When converting from one pixel format to another, information loss 2743 * format. When converting from one pixel format to another, information loss
2758 * @param[in] src_pix_fmt source pixel format 2758 * @param[in] src_pix_fmt source pixel format
2759 * @param[in] has_alpha Whether the source pixel format alpha channel is used. 2759 * @param[in] has_alpha Whether the source pixel format alpha channel is used.
2760 * @param[out] loss_ptr Combination of flags informing you what kind of losses will occur. 2760 * @param[out] loss_ptr Combination of flags informing you what kind of losses will occur.
2761 * @return The best pixel format to convert to or -1 if none was found. 2761 * @return The best pixel format to convert to or -1 if none was found.
2762 */ 2762 */
2763 int avcodec_find_best_pix_fmt(int64_t pix_fmt_mask, int src_pix_fmt, 2763 enum PixelFormat avcodec_find_best_pix_fmt(int64_t pix_fmt_mask, enum PixelFormat src_pix_fmt,
2764 int has_alpha, int *loss_ptr); 2764 int has_alpha, int *loss_ptr);
2765 2765
2766 2766
2767 /** 2767 /**
2768 * Print in buf the string corresponding to the pixel format with 2768 * Print in buf the string corresponding to the pixel format with
2772 * @param[in] buf_size the size of buf 2772 * @param[in] buf_size the size of buf
2773 * @param[in] pix_fmt the number of the pixel format to print the corresponding info string, or 2773 * @param[in] pix_fmt the number of the pixel format to print the corresponding info string, or
2774 * a negative value to print the corresponding header. 2774 * a negative value to print the corresponding header.
2775 * Meaningful values for obtaining a pixel format info vary from 0 to PIX_FMT_NB -1. 2775 * Meaningful values for obtaining a pixel format info vary from 0 to PIX_FMT_NB -1.
2776 */ 2776 */
2777 void avcodec_pix_fmt_string (char *buf, int buf_size, int pix_fmt); 2777 void avcodec_pix_fmt_string (char *buf, int buf_size, enum PixelFormat pix_fmt);
2778 2778
2779 #define FF_ALPHA_TRANSP 0x0001 /* image has some totally transparent pixels */ 2779 #define FF_ALPHA_TRANSP 0x0001 /* image has some totally transparent pixels */
2780 #define FF_ALPHA_SEMI_TRANSP 0x0002 /* image has some transparent pixels */ 2780 #define FF_ALPHA_SEMI_TRANSP 0x0002 /* image has some transparent pixels */
2781 2781
2782 /** 2782 /**
2783 * Tell if an image really has transparent alpha values. 2783 * Tell if an image really has transparent alpha values.
2784 * @return ored mask of FF_ALPHA_xxx constants 2784 * @return ored mask of FF_ALPHA_xxx constants
2785 */ 2785 */
2786 int img_get_alpha_info(const AVPicture *src, 2786 int img_get_alpha_info(const AVPicture *src,
2787 int pix_fmt, int width, int height); 2787 enum PixelFormat pix_fmt, int width, int height);
2788 2788
2789 /* deinterlace a picture */ 2789 /* deinterlace a picture */
2790 /* deinterlace - if not supported return -1 */ 2790 /* deinterlace - if not supported return -1 */
2791 int avpicture_deinterlace(AVPicture *dst, const AVPicture *src, 2791 int avpicture_deinterlace(AVPicture *dst, const AVPicture *src,
2792 int pix_fmt, int width, int height); 2792 enum PixelFormat pix_fmt, int width, int height);
2793 2793
2794 /* external high level API */ 2794 /* external high level API */
2795 2795
2796 /** 2796 /**
2797 * If c is NULL, returns the first registered codec, 2797 * If c is NULL, returns the first registered codec,
3363 3363
3364 /** 3364 /**
3365 * Copy image 'src' to 'dst'. 3365 * Copy image 'src' to 'dst'.
3366 */ 3366 */
3367 void av_picture_copy(AVPicture *dst, const AVPicture *src, 3367 void av_picture_copy(AVPicture *dst, const AVPicture *src,
3368 int pix_fmt, int width, int height); 3368 enum PixelFormat pix_fmt, int width, int height);
3369 3369
3370 /** 3370 /**
3371 * Crop image top and left side. 3371 * Crop image top and left side.
3372 */ 3372 */
3373 int av_picture_crop(AVPicture *dst, const AVPicture *src, 3373 int av_picture_crop(AVPicture *dst, const AVPicture *src,
3374 int pix_fmt, int top_band, int left_band); 3374 enum PixelFormat pix_fmt, int top_band, int left_band);
3375 3375
3376 /** 3376 /**
3377 * Pad image. 3377 * Pad image.
3378 */ 3378 */
3379 int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, int pix_fmt, 3379 int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, enum PixelFormat pix_fmt,
3380 int padtop, int padbottom, int padleft, int padright, int *color); 3380 int padtop, int padbottom, int padleft, int padright, int *color);
3381 3381
3382 unsigned int av_xiphlacing(unsigned char *s, unsigned int v); 3382 unsigned int av_xiphlacing(unsigned char *s, unsigned int v);
3383 3383
3384 /** 3384 /**