You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
lavc: make codec_is_decoder/encoder() public.
This commit is contained in:
@@ -12,6 +12,9 @@ libavutil: 2011-04-18
|
|||||||
|
|
||||||
API changes, most recent first:
|
API changes, most recent first:
|
||||||
|
|
||||||
|
2012-03-xx - xxxxxxx - lavc 54.7.0 - avcodec.h
|
||||||
|
Add av_codec_is_encoder/decoder().
|
||||||
|
|
||||||
2012-xx-xx - xxxxxxx - lavc 54.3.0 - avcodec.h
|
2012-xx-xx - xxxxxxx - lavc 54.3.0 - avcodec.h
|
||||||
Add av_packet_shrink_side_data.
|
Add av_packet_shrink_side_data.
|
||||||
|
|
||||||
|
@@ -4297,4 +4297,14 @@ const AVClass *avcodec_get_class(void);
|
|||||||
*/
|
*/
|
||||||
int avcodec_is_open(AVCodecContext *s);
|
int avcodec_is_open(AVCodecContext *s);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return a non-zero number if codec is an encoder, zero otherwise
|
||||||
|
*/
|
||||||
|
int av_codec_is_encoder(AVCodec *codec);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return a non-zero number if codec is a decoder, zero otherwise
|
||||||
|
*/
|
||||||
|
int av_codec_is_decoder(AVCodec *codec);
|
||||||
|
|
||||||
#endif /* AVCODEC_AVCODEC_H */
|
#endif /* AVCODEC_AVCODEC_H */
|
||||||
|
@@ -112,12 +112,12 @@ static void avcodec_init(void)
|
|||||||
ff_dsputil_static_init();
|
ff_dsputil_static_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
static av_always_inline int codec_is_encoder(AVCodec *codec)
|
int av_codec_is_encoder(AVCodec *codec)
|
||||||
{
|
{
|
||||||
return codec && (codec->encode || codec->encode2);
|
return codec && (codec->encode || codec->encode2);
|
||||||
}
|
}
|
||||||
|
|
||||||
static av_always_inline int codec_is_decoder(AVCodec *codec)
|
int av_codec_is_decoder(AVCodec *codec)
|
||||||
{
|
{
|
||||||
return codec && codec->decode;
|
return codec && codec->decode;
|
||||||
}
|
}
|
||||||
@@ -704,7 +704,7 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVD
|
|||||||
|
|
||||||
/* if the decoder init function was already called previously,
|
/* if the decoder init function was already called previously,
|
||||||
free the already allocated subtitle_header before overwriting it */
|
free the already allocated subtitle_header before overwriting it */
|
||||||
if (codec_is_decoder(codec))
|
if (av_codec_is_decoder(codec))
|
||||||
av_freep(&avctx->subtitle_header);
|
av_freep(&avctx->subtitle_header);
|
||||||
|
|
||||||
#define SANE_NB_CHANNELS 128U
|
#define SANE_NB_CHANNELS 128U
|
||||||
@@ -748,7 +748,7 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVD
|
|||||||
ret = AVERROR(EINVAL);
|
ret = AVERROR(EINVAL);
|
||||||
goto free_and_end;
|
goto free_and_end;
|
||||||
}
|
}
|
||||||
if (codec_is_encoder(avctx->codec)) {
|
if (av_codec_is_encoder(avctx->codec)) {
|
||||||
int i;
|
int i;
|
||||||
if (avctx->codec->sample_fmts) {
|
if (avctx->codec->sample_fmts) {
|
||||||
for (i = 0; avctx->codec->sample_fmts[i] != AV_SAMPLE_FMT_NONE; i++)
|
for (i = 0; avctx->codec->sample_fmts[i] != AV_SAMPLE_FMT_NONE; i++)
|
||||||
@@ -1367,7 +1367,7 @@ av_cold int avcodec_close(AVCodecContext *avctx)
|
|||||||
av_opt_free(avctx->priv_data);
|
av_opt_free(avctx->priv_data);
|
||||||
av_opt_free(avctx);
|
av_opt_free(avctx);
|
||||||
av_freep(&avctx->priv_data);
|
av_freep(&avctx->priv_data);
|
||||||
if (codec_is_encoder(avctx->codec))
|
if (av_codec_is_encoder(avctx->codec))
|
||||||
av_freep(&avctx->extradata);
|
av_freep(&avctx->extradata);
|
||||||
avctx->codec = NULL;
|
avctx->codec = NULL;
|
||||||
avctx->active_thread_type = 0;
|
avctx->active_thread_type = 0;
|
||||||
@@ -1385,7 +1385,7 @@ AVCodec *avcodec_find_encoder(enum CodecID id)
|
|||||||
AVCodec *p, *experimental=NULL;
|
AVCodec *p, *experimental=NULL;
|
||||||
p = first_avcodec;
|
p = first_avcodec;
|
||||||
while (p) {
|
while (p) {
|
||||||
if (codec_is_encoder(p) && p->id == id) {
|
if (av_codec_is_encoder(p) && p->id == id) {
|
||||||
if (p->capabilities & CODEC_CAP_EXPERIMENTAL && !experimental) {
|
if (p->capabilities & CODEC_CAP_EXPERIMENTAL && !experimental) {
|
||||||
experimental = p;
|
experimental = p;
|
||||||
} else
|
} else
|
||||||
@@ -1403,7 +1403,7 @@ AVCodec *avcodec_find_encoder_by_name(const char *name)
|
|||||||
return NULL;
|
return NULL;
|
||||||
p = first_avcodec;
|
p = first_avcodec;
|
||||||
while (p) {
|
while (p) {
|
||||||
if (codec_is_encoder(p) && strcmp(name,p->name) == 0)
|
if (av_codec_is_encoder(p) && strcmp(name,p->name) == 0)
|
||||||
return p;
|
return p;
|
||||||
p = p->next;
|
p = p->next;
|
||||||
}
|
}
|
||||||
@@ -1415,7 +1415,7 @@ AVCodec *avcodec_find_decoder(enum CodecID id)
|
|||||||
AVCodec *p;
|
AVCodec *p;
|
||||||
p = first_avcodec;
|
p = first_avcodec;
|
||||||
while (p) {
|
while (p) {
|
||||||
if (codec_is_decoder(p) && p->id == id)
|
if (av_codec_is_decoder(p) && p->id == id)
|
||||||
return p;
|
return p;
|
||||||
p = p->next;
|
p = p->next;
|
||||||
}
|
}
|
||||||
@@ -1429,7 +1429,7 @@ AVCodec *avcodec_find_decoder_by_name(const char *name)
|
|||||||
return NULL;
|
return NULL;
|
||||||
p = first_avcodec;
|
p = first_avcodec;
|
||||||
while (p) {
|
while (p) {
|
||||||
if (codec_is_decoder(p) && strcmp(name,p->name) == 0)
|
if (av_codec_is_decoder(p) && strcmp(name,p->name) == 0)
|
||||||
return p;
|
return p;
|
||||||
p = p->next;
|
p = p->next;
|
||||||
}
|
}
|
||||||
|
@@ -21,7 +21,7 @@
|
|||||||
#define AVCODEC_VERSION_H
|
#define AVCODEC_VERSION_H
|
||||||
|
|
||||||
#define LIBAVCODEC_VERSION_MAJOR 54
|
#define LIBAVCODEC_VERSION_MAJOR 54
|
||||||
#define LIBAVCODEC_VERSION_MINOR 6
|
#define LIBAVCODEC_VERSION_MINOR 7
|
||||||
#define LIBAVCODEC_VERSION_MICRO 0
|
#define LIBAVCODEC_VERSION_MICRO 0
|
||||||
|
|
||||||
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
|
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
|
||||||
|
Reference in New Issue
Block a user