[FFmpeg-devel] [PATCH 1/2] lavc: add av_get_profile_name() to get profile names

Michael Niedermayer michaelni
Fri Jan 7 16:22:35 CET 2011


On Fri, Jan 07, 2011 at 05:15:10PM +0200, Anssi Hannula wrote:
> ---
>  doc/APIchanges        |    3 ++
>  libavcodec/Makefile   |    1 +
>  libavcodec/avcodec.h  |   13 ++++++++-
>  libavcodec/profiles.c |   68 +++++++++++++++++++++++++++++++++++++++++++++++++
>  4 files changed, 83 insertions(+), 2 deletions(-)
>  create mode 100644 libavcodec/profiles.c
> 
> diff --git a/doc/APIchanges b/doc/APIchanges
> index bf9d11d..46a82ff 100644
> --- a/doc/APIchanges
> +++ b/doc/APIchanges
> @@ -13,6 +13,9 @@ libavutil:   2009-03-08
>  
>  API changes, most recent first:
>  
> +2010-01-XX - r26XXX - lavc 52.104.0 - av_get_profile_name()
> +  Add av_get_profile_name to libavcodec/avcodec.h.
> +
>  2010-12-27 - r26108 - lavfi 1.71.0 - AV_PERM_NEG_LINESIZES
>    Add AV_PERM_NEG_LINESIZES in avfilter.h.
>  
> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
> index ee16b91..c1d5f7b 100644
> --- a/libavcodec/Makefile
> +++ b/libavcodec/Makefile
> @@ -17,6 +17,7 @@ OBJS = allcodecs.o                                                      \
>         opt.o                                                            \
>         options.o                                                        \
>         parser.o                                                         \
> +       profiles.o                                                       \
>         raw.o                                                            \
>         resample.o                                                       \
>         resample2.o                                                      \
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index 7850e1d..5b20e27 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -32,8 +32,8 @@
>  #include "libavutil/cpu.h"
>  
>  #define LIBAVCODEC_VERSION_MAJOR 52
> -#define LIBAVCODEC_VERSION_MINOR 103
> -#define LIBAVCODEC_VERSION_MICRO  1
> +#define LIBAVCODEC_VERSION_MINOR 104
> +#define LIBAVCODEC_VERSION_MICRO  0
>  
>  #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
>                                                 LIBAVCODEC_VERSION_MINOR, \
> @@ -3394,6 +3394,15 @@ AVCodec *avcodec_find_decoder_by_name(const char *name);
>  void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode);
>  
>  /**
> + * Return the name of the specified profile.
> + *
> + * @param codec_id CodecID of the specified profile
> + * @param profile the specified profile
> + * @return A name for the profile if found, NULL otherwise.
> + */
> +const char *av_get_profile_name(enum CodecID codec_id, int profile);
> +
> +/**
>   * Set the fields of the given AVCodecContext to default values.
>   *
>   * @param s The AVCodecContext of which the fields should be set to default values.
> diff --git a/libavcodec/profiles.c b/libavcodec/profiles.c
> new file mode 100644
> index 0000000..0a47c60
> --- /dev/null
> +++ b/libavcodec/profiles.c
> @@ -0,0 +1,68 @@
> +/*
> + * Codec profile names
> + * Copyright (c) 2010 Anssi Hannula <anssi.hannula at iki.fi>
> + *
> + * This file is part of FFmpeg.
> + *
> + * FFmpeg is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * FFmpeg is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with FFmpeg; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
> + */
> +
> +/**
> + * @file
> + * Codec profile names
> + * @author Anssi Hannula
> + */
> +
> +#include "avcodec.h"
> +
> +struct profile {
> +    enum CodecID codec_id;
> +    int profile;
> +    const char *name;
> +};
> +
> +static const struct profile profiles[] = {
> +    { CODEC_ID_AAC,     FF_PROFILE_AAC_MAIN,         "Main"          },
> +    { CODEC_ID_AAC,     FF_PROFILE_AAC_LOW,          "LC"            },
> +    { CODEC_ID_AAC,     FF_PROFILE_AAC_SSR,          "SSR"           },
> +    { CODEC_ID_AAC,     FF_PROFILE_AAC_LTP,          "LTP"           },
> +    { CODEC_ID_DTS,     FF_PROFILE_DTS,              "DTS"           },
> +    { CODEC_ID_DTS,     FF_PROFILE_DTS_ES,           "DTS-ES"        },
> +    { CODEC_ID_DTS,     FF_PROFILE_DTS_96_24,        "DTS 96/24"     },
> +    { CODEC_ID_DTS,     FF_PROFILE_DTS_HD_HRA,       "DTS-HD HRA"    },
> +    { CODEC_ID_DTS,     FF_PROFILE_DTS_HD_MA,        "DTS-HD MA"     },
> +    { CODEC_ID_H264,    FF_PROFILE_H264_BASELINE,    "Baseline"      },
> +    { CODEC_ID_H264,    FF_PROFILE_H264_MAIN,        "Main"          },
> +    { CODEC_ID_H264,    FF_PROFILE_H264_EXTENDED,    "Extended"      },
> +    { CODEC_ID_H264,    FF_PROFILE_H264_HIGH,        "High"          },
> +    { CODEC_ID_H264,    FF_PROFILE_H264_HIGH_10,     "High 10"       },
> +    { CODEC_ID_H264,    FF_PROFILE_H264_HIGH_422,    "High 4:2:2"    },
> +    { CODEC_ID_H264,    FF_PROFILE_H264_HIGH_444,    "High 4:4:4"    },
> +    { CODEC_ID_H264,    FF_PROFILE_H264_CAVLC_444,   "CAVLC 4:4:4"   },
> +    { CODEC_ID_NONE },
> +};

Maybe we should add such tables to a new AVCodec.profiles ?


[...]
--
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The real ebay dictionary, page 3
"Rare item" - "Common item with rare defect or maybe just a lie"
"Professional" - "'Toy' made in china, not functional except as doorstop"
"Experts will know" - "The seller hopes you are not an expert"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20110107/4022cee1/attachment.pgp>



More information about the ffmpeg-devel mailing list