History

lavc: make codec_is_decoder/encoder() public.

Anton Khirnov committed 14 years ago

Commit 44fe77b1 parent 02beb984 files · +23 −10Browse files

Unified · Split

4 files
  1. doc/APIchanges +3 −0
  2. libavcodec/avcodec.h +10 −0
  3. libavcodec/utils.c +9 −9
  4. libavcodec/version.h +1 −1
doc/APIchanges+3−0
@@ -12,6 +12,9 @@ libavutil: 2011-04-18 · 11 unmodified lines
1212
1313 API changes, most recent first:
1414
15+2012-03-xx - xxxxxxx - lavc 54.7.0 - avcodec.h
16+ Add av_codec_is_encoder/decoder().
17+
1518 2012-xx-xx - xxxxxxx - lavc 54.3.0 - avcodec.h
1619 Add av_packet_shrink_side_data.
1720
libavcodec/avcodec.h+10−0
@@ -4297,4 +4297,14 @@ const AVClass *avcodec_get_class(void); · 4296 unmodified lines
42974297 */
42984298 int avcodec_is_open(AVCodecContext *s);
42994299
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+
43004310 #endif /* AVCODEC_AVCODEC_H */
libavcodec/utils.c+9−9
@@ -112,12 +112,12 @@ static void avcodec_init(void) · 111 unmodified lines
112112 ff_dsputil_static_init();
113113 }
114114
115−static av_always_inline int codec_is_encoder(AVCodec *codec)
115+int av_codec_is_encoder(AVCodec *codec)
116116 {
117117 return codec && (codec->encode || codec->encode2);
118118 }
119119
120−static av_always_inline int codec_is_decoder(AVCodec *codec)
120+int av_codec_is_decoder(AVCodec *codec)
121121 {
122122 return codec && codec->decode;
123123 }
@@ -704,7 +704,7 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVD · 580 unmodified lines
704704
705705 /* if the decoder init function was already called previously,
706706 free the already allocated subtitle_header before overwriting it */
707− if (codec_is_decoder(codec))
707+ if (av_codec_is_decoder(codec))
708708 av_freep(&avctx->subtitle_header);
709709
710710 #define SANE_NB_CHANNELS 128U
@@ -748,7 +748,7 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVD · 37 unmodified lines
748748 ret = AVERROR(EINVAL);
749749 goto free_and_end;
750750 }
751− if (codec_is_encoder(avctx->codec)) {
751+ if (av_codec_is_encoder(avctx->codec)) {
752752 int i;
753753 if (avctx->codec->sample_fmts) {
754754 for (i = 0; avctx->codec->sample_fmts[i] != AV_SAMPLE_FMT_NONE; i++)
@@ -1367,7 +1367,7 @@ av_cold int avcodec_close(AVCodecContext *avctx) · 612 unmodified lines
13671367 av_opt_free(avctx->priv_data);
13681368 av_opt_free(avctx);
13691369 av_freep(&avctx->priv_data);
1370− if (codec_is_encoder(avctx->codec))
1370+ if (av_codec_is_encoder(avctx->codec))
13711371 av_freep(&avctx->extradata);
13721372 avctx->codec = NULL;
13731373 avctx->active_thread_type = 0;
@@ -1385,7 +1385,7 @@ AVCodec *avcodec_find_encoder(enum CodecID id) · 11 unmodified lines
13851385 AVCodec *p, *experimental=NULL;
13861386 p = first_avcodec;
13871387 while (p) {
1388− if (codec_is_encoder(p) && p->id == id) {
1388+ if (av_codec_is_encoder(p) && p->id == id) {
13891389 if (p->capabilities & CODEC_CAP_EXPERIMENTAL && !experimental) {
13901390 experimental = p;
13911391 } else
@@ -1403,7 +1403,7 @@ AVCodec *avcodec_find_encoder_by_name(const char *name) · 11 unmodified lines
14031403 return NULL;
14041404 p = first_avcodec;
14051405 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)
14071407 return p;
14081408 p = p->next;
14091409 }
@@ -1415,7 +1415,7 @@ AVCodec *avcodec_find_decoder(enum CodecID id) · 5 unmodified lines
14151415 AVCodec *p;
14161416 p = first_avcodec;
14171417 while (p) {
1418− if (codec_is_decoder(p) && p->id == id)
1418+ if (av_codec_is_decoder(p) && p->id == id)
14191419 return p;
14201420 p = p->next;
14211421 }
@@ -1429,7 +1429,7 @@ AVCodec *avcodec_find_decoder_by_name(const char *name) · 7 unmodified lines
14291429 return NULL;
14301430 p = first_avcodec;
14311431 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)
14331433 return p;
14341434 p = p->next;
14351435 }
libavcodec/version.h+1−1
@@ -21,7 +21,7 @@ · 20 unmodified lines
2121 #define AVCODEC_VERSION_H
2222
2323 #define LIBAVCODEC_VERSION_MAJOR 54
24−#define LIBAVCODEC_VERSION_MINOR 6
24+#define LIBAVCODEC_VERSION_MINOR 7
2525 #define LIBAVCODEC_VERSION_MICRO 0
2626
2727 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t