Browse code

Deprecate avcodec_pix_fmt_string() in favor of av_get_pix_fmt_string(), added to libavutil/pixdesc.h.

Originally committed as revision 25879 to svn://svn.ffmpeg.org/ffmpeg/trunk

Stefano Sabatini authored on 2010/12/04 21:56:21
Showing 6 changed files
... ...
@@ -12,6 +12,10 @@ libavutil:   2009-03-08
12 12
 
13 13
 
14 14
 API changes, most recent first:
15
+2010-12-04 - r25879 - lavu 50.34.0 - av_get_pix_fmt_string()
16
+  Deprecate avcodec_pix_fmt_string() in favor of
17
+  pixdesc.h/av_get_pix_fmt_string().
18
+
15 19
 2010-12-04 - r25878 - lavcore 1.15.0 - av_image_alloc()
16 20
   Add av_image_alloc() to libavcore/imgutils.h.
17 21
 
... ...
@@ -33,7 +33,7 @@
33 33
 
34 34
 #define LIBAVCODEC_VERSION_MAJOR 52
35 35
 #define LIBAVCODEC_VERSION_MINOR 97
36
-#define LIBAVCODEC_VERSION_MICRO  2
36
+#define LIBAVCODEC_VERSION_MICRO  3
37 37
 
38 38
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
39 39
                                                LIBAVCODEC_VERSION_MINOR, \
... ...
@@ -3285,18 +3285,12 @@ int avcodec_get_pix_fmt_loss(enum PixelFormat dst_pix_fmt, enum PixelFormat src_
3285 3285
 enum PixelFormat avcodec_find_best_pix_fmt(int64_t pix_fmt_mask, enum PixelFormat src_pix_fmt,
3286 3286
                               int has_alpha, int *loss_ptr);
3287 3287
 
3288
-
3288
+#if LIBAVCODEC_VERSION_MAJOR < 53
3289 3289
 /**
3290
- * Print in buf the string corresponding to the pixel format with
3291
- * number pix_fmt, or an header if pix_fmt is negative.
3292
- *
3293
- * @param[in] buf the buffer where to write the string
3294
- * @param[in] buf_size the size of buf
3295
- * @param[in] pix_fmt the number of the pixel format to print the corresponding info string, or
3296
- * a negative value to print the corresponding header.
3297
- * Meaningful values for obtaining a pixel format info vary from 0 to PIX_FMT_NB -1.
3290
+ * @deprecated Use av_get_pix_fmt_string() instead.
3298 3291
  */
3299 3292
 void avcodec_pix_fmt_string (char *buf, int buf_size, enum PixelFormat pix_fmt);
3293
+#endif
3300 3294
 
3301 3295
 #define FF_ALPHA_TRANSP       0x0001 /* image has some totally transparent pixels */
3302 3296
 #define FF_ALPHA_SEMI_TRANSP  0x0002 /* image has some transparent pixels */
... ...
@@ -431,25 +431,12 @@ enum PixelFormat avcodec_get_pix_fmt(const char *name)
431 431
 {
432 432
     return av_get_pix_fmt(name);
433 433
 }
434
-#endif
435 434
 
436 435
 void avcodec_pix_fmt_string (char *buf, int buf_size, enum PixelFormat pix_fmt)
437 436
 {
438
-    /* print header */
439
-    if (pix_fmt < 0)
440
-        snprintf (buf, buf_size,
441
-                  "name      " " nb_components" " nb_bits"
442
-            );
443
-    else{
444
-        const AVPixFmtDescriptor *pixdesc = &av_pix_fmt_descriptors[pix_fmt];
445
-        snprintf (buf, buf_size,
446
-                  "%-11s %7d %10d",
447
-                  pixdesc->name,
448
-                  pixdesc->nb_components,
449
-                  av_get_bits_per_pixel(pixdesc)
450
-            );
451
-    }
437
+    av_get_pix_fmt_string(buf, buf_size, pix_fmt);
452 438
 }
439
+#endif
453 440
 
454 441
 int ff_is_hwaccel_pix_fmt(enum PixelFormat pix_fmt)
455 442
 {
... ...
@@ -40,7 +40,7 @@
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 33
43
+#define LIBAVUTIL_VERSION_MINOR 34
44 44
 #define LIBAVUTIL_VERSION_MICRO  0
45 45
 
46 46
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
... ...
@@ -851,3 +851,17 @@ int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
851 851
 
852 852
     return bits >> log2_pixels;
853 853
 }
854
+
855
+char *av_get_pix_fmt_string (char *buf, int buf_size, enum PixelFormat pix_fmt)
856
+{
857
+    /* print header */
858
+    if (pix_fmt < 0) {
859
+        snprintf (buf, buf_size, "name      " " nb_components" " nb_bits");
860
+    } else {
861
+        const AVPixFmtDescriptor *pixdesc = &av_pix_fmt_descriptors[pix_fmt];
862
+        snprintf(buf, buf_size, "%-11s %7d %10d",
863
+                 pixdesc->name, pixdesc->nb_components, av_get_bits_per_pixel(pixdesc));
864
+    }
865
+
866
+    return buf;
867
+}
... ...
@@ -142,6 +142,18 @@ void av_write_image_line(const uint16_t *src, uint8_t *data[4], const int linesi
142 142
 enum PixelFormat av_get_pix_fmt(const char *name);
143 143
 
144 144
 /**
145
+ * Print in buf the string corresponding to the pixel format with
146
+ * number pix_fmt, or an header if pix_fmt is negative.
147
+ *
148
+ * @param buf the buffer where to write the string
149
+ * @param buf_size the size of buf
150
+ * @param pix_fmt the number of the pixel format to print the
151
+ * corresponding info string, or a negative value to print the
152
+ * corresponding header.
153
+ */
154
+char *av_get_pix_fmt_string (char *buf, int buf_size, enum PixelFormat pix_fmt);
155
+
156
+/**
145 157
  * Return the number of bits per pixel used by the pixel format
146 158
  * described by pixdesc.
147 159
  *