Browse code

lavc: make codec_is_decoder/encoder() public.

Anton Khirnov authored on 2012/03/03 01:00:53
Showing 4 changed files
... ...
@@ -12,6 +12,9 @@ libavutil:   2011-04-18
12 12
 
13 13
 API changes, most recent first:
14 14
 
15
+2012-03-xx - xxxxxxx - lavc 54.7.0 - avcodec.h
16
+  Add av_codec_is_encoder/decoder().
17
+
15 18
 2012-xx-xx - xxxxxxx - lavc 54.3.0 - avcodec.h
16 19
   Add av_packet_shrink_side_data.
17 20
 
... ...
@@ -4297,4 +4297,14 @@ const AVClass *avcodec_get_class(void);
4297 4297
  */
4298 4298
 int avcodec_is_open(AVCodecContext *s);
4299 4299
 
4300
+/**
4301
+ * @return a non-zero number if codec is an encoder, zero otherwise
4302
+ */
4303
+int av_codec_is_encoder(AVCodec *codec);
4304
+
4305
+/**
4306
+ * @return a non-zero number if codec is a decoder, zero otherwise
4307
+ */
4308
+int av_codec_is_decoder(AVCodec *codec);
4309
+
4300 4310
 #endif /* AVCODEC_AVCODEC_H */
... ...
@@ -112,12 +112,12 @@ static void avcodec_init(void)
112 112
     ff_dsputil_static_init();
113 113
 }
114 114
 
115
-static av_always_inline int codec_is_encoder(AVCodec *codec)
115
+int av_codec_is_encoder(AVCodec *codec)
116 116
 {
117 117
     return codec && (codec->encode || codec->encode2);
118 118
 }
119 119
 
120
-static av_always_inline int codec_is_decoder(AVCodec *codec)
120
+int av_codec_is_decoder(AVCodec *codec)
121 121
 {
122 122
     return codec && codec->decode;
123 123
 }
... ...
@@ -704,7 +704,7 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVD
704 704
 
705 705
     /* if the decoder init function was already called previously,
706 706
        free the already allocated subtitle_header before overwriting it */
707
-    if (codec_is_decoder(codec))
707
+    if (av_codec_is_decoder(codec))
708 708
         av_freep(&avctx->subtitle_header);
709 709
 
710 710
 #define SANE_NB_CHANNELS 128U
... ...
@@ -748,7 +748,7 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVD
748 748
         ret = AVERROR(EINVAL);
749 749
         goto free_and_end;
750 750
     }
751
-    if (codec_is_encoder(avctx->codec)) {
751
+    if (av_codec_is_encoder(avctx->codec)) {
752 752
         int i;
753 753
         if (avctx->codec->sample_fmts) {
754 754
             for (i = 0; avctx->codec->sample_fmts[i] != AV_SAMPLE_FMT_NONE; i++)
... ...
@@ -1367,7 +1367,7 @@ av_cold int avcodec_close(AVCodecContext *avctx)
1367 1367
         av_opt_free(avctx->priv_data);
1368 1368
     av_opt_free(avctx);
1369 1369
     av_freep(&avctx->priv_data);
1370
-    if (codec_is_encoder(avctx->codec))
1370
+    if (av_codec_is_encoder(avctx->codec))
1371 1371
         av_freep(&avctx->extradata);
1372 1372
     avctx->codec = NULL;
1373 1373
     avctx->active_thread_type = 0;
... ...
@@ -1385,7 +1385,7 @@ AVCodec *avcodec_find_encoder(enum CodecID id)
1385 1385
     AVCodec *p, *experimental=NULL;
1386 1386
     p = first_avcodec;
1387 1387
     while (p) {
1388
-        if (codec_is_encoder(p) && p->id == id) {
1388
+        if (av_codec_is_encoder(p) && p->id == id) {
1389 1389
             if (p->capabilities & CODEC_CAP_EXPERIMENTAL && !experimental) {
1390 1390
                 experimental = p;
1391 1391
             } else
... ...
@@ -1403,7 +1403,7 @@ AVCodec *avcodec_find_encoder_by_name(const char *name)
1403 1403
         return NULL;
1404 1404
     p = first_avcodec;
1405 1405
     while (p) {
1406
-        if (codec_is_encoder(p) && strcmp(name,p->name) == 0)
1406
+        if (av_codec_is_encoder(p) && strcmp(name,p->name) == 0)
1407 1407
             return p;
1408 1408
         p = p->next;
1409 1409
     }
... ...
@@ -1415,7 +1415,7 @@ AVCodec *avcodec_find_decoder(enum CodecID id)
1415 1415
     AVCodec *p;
1416 1416
     p = first_avcodec;
1417 1417
     while (p) {
1418
-        if (codec_is_decoder(p) && p->id == id)
1418
+        if (av_codec_is_decoder(p) && p->id == id)
1419 1419
             return p;
1420 1420
         p = p->next;
1421 1421
     }
... ...
@@ -1429,7 +1429,7 @@ AVCodec *avcodec_find_decoder_by_name(const char *name)
1429 1429
         return NULL;
1430 1430
     p = first_avcodec;
1431 1431
     while (p) {
1432
-        if (codec_is_decoder(p) && strcmp(name,p->name) == 0)
1432
+        if (av_codec_is_decoder(p) && strcmp(name,p->name) == 0)
1433 1433
             return p;
1434 1434
         p = p->next;
1435 1435
     }
... ...
@@ -21,7 +21,7 @@
21 21
 #define AVCODEC_VERSION_H
22 22
 
23 23
 #define LIBAVCODEC_VERSION_MAJOR 54
24
-#define LIBAVCODEC_VERSION_MINOR  6
24
+#define LIBAVCODEC_VERSION_MINOR  7
25 25
 #define LIBAVCODEC_VERSION_MICRO  0
26 26
 
27 27
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \