Commit 2c681139 authored by Anton Khirnov's avatar Anton Khirnov

lavc: add profiles to AVCodecDescriptor

The profiles are a property of the codec, so it makes sense to export
them through AVCodecDescriptors, not just the codec implementations.
parent cdc9ce09
...@@ -13,6 +13,9 @@ libavutil: 2015-08-28 ...@@ -13,6 +13,9 @@ libavutil: 2015-08-28
API changes, most recent first: API changes, most recent first:
2015-xx-xx - xxxxxxx - lavc 57.12.0 - avcodec.h
Add AVCodecDescriptor.profiles and avcodec_profile_name().
2015-xx-xx - xxxxxxx - lavc 57.11.0 - avcodec.h dirac.h 2015-xx-xx - xxxxxxx - lavc 57.11.0 - avcodec.h dirac.h
xxxxxxx - Add av_packet_add_side_data(). xxxxxxx - Add av_packet_add_side_data().
xxxxxxx - Add AVCodecContext.coded_side_data. xxxxxxx - Add AVCodecContext.coded_side_data.
......
...@@ -28,6 +28,7 @@ OBJS = allcodecs.o \ ...@@ -28,6 +28,7 @@ OBJS = allcodecs.o \
mathtables.o \ mathtables.o \
options.o \ options.o \
parser.o \ parser.o \
profiles.o \
qsv_api.o \ qsv_api.o \
raw.o \ raw.o \
utils.o \ utils.o \
......
...@@ -503,6 +503,11 @@ typedef struct AVCodecDescriptor { ...@@ -503,6 +503,11 @@ typedef struct AVCodecDescriptor {
* Codec properties, a combination of AV_CODEC_PROP_* flags. * Codec properties, a combination of AV_CODEC_PROP_* flags.
*/ */
int props; int props;
/**
* If non-NULL, an array of profiles recognized for this codec.
* Terminated with FF_PROFILE_UNKNOWN.
*/
const struct AVProfile *profiles;
} AVCodecDescriptor; } AVCodecDescriptor;
/** /**
...@@ -4454,6 +4459,19 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode); ...@@ -4454,6 +4459,19 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode);
*/ */
const char *av_get_profile_name(const AVCodec *codec, int profile); const char *av_get_profile_name(const AVCodec *codec, int profile);
/**
* Return a name for the specified profile, if available.
*
* @param codec_id the ID of the codec to which the requested profile belongs
* @param profile the profile value for which a name is requested
* @return A name for the profile if found, NULL otherwise.
*
* @note unlike av_get_profile_name(), which searches a list of profiles
* supported by a specific decoder or encoder implementation, this
* function searches the list of profiles from the AVCodecDescriptor
*/
const char *avcodec_profile_name(enum AVCodecID codec_id, int profile);
int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size); int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size);
int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2, int, int),void *arg, int *ret, int count); int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2, int, int),void *arg, int *ret, int count);
//FIXME func typedef //FIXME func typedef
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "libavutil/common.h" #include "libavutil/common.h"
#include "libavutil/internal.h" #include "libavutil/internal.h"
#include "avcodec.h" #include "avcodec.h"
#include "profiles.h"
#include "version.h" #include "version.h"
static const AVCodecDescriptor codec_descriptors[] = { static const AVCodecDescriptor codec_descriptors[] = {
...@@ -38,6 +39,7 @@ static const AVCodecDescriptor codec_descriptors[] = { ...@@ -38,6 +39,7 @@ static const AVCodecDescriptor codec_descriptors[] = {
.name = "mpeg2video", .name = "mpeg2video",
.long_name = NULL_IF_CONFIG_SMALL("MPEG-2 video"), .long_name = NULL_IF_CONFIG_SMALL("MPEG-2 video"),
.props = AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_REORDER, .props = AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_REORDER,
.profiles = NULL_IF_CONFIG_SMALL(ff_mpeg2_video_profiles),
}, },
#if FF_API_XVMC #if FF_API_XVMC
{ {
...@@ -96,6 +98,7 @@ static const AVCodecDescriptor codec_descriptors[] = { ...@@ -96,6 +98,7 @@ static const AVCodecDescriptor codec_descriptors[] = {
.name = "mpeg4", .name = "mpeg4",
.long_name = NULL_IF_CONFIG_SMALL("MPEG-4 part 2"), .long_name = NULL_IF_CONFIG_SMALL("MPEG-4 part 2"),
.props = AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_REORDER, .props = AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_REORDER,
.profiles = NULL_IF_CONFIG_SMALL(ff_mpeg4_video_profiles),
}, },
{ {
.id = AV_CODEC_ID_RAWVIDEO, .id = AV_CODEC_ID_RAWVIDEO,
...@@ -201,6 +204,7 @@ static const AVCodecDescriptor codec_descriptors[] = { ...@@ -201,6 +204,7 @@ static const AVCodecDescriptor codec_descriptors[] = {
.name = "h264", .name = "h264",
.long_name = NULL_IF_CONFIG_SMALL("H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10"), .long_name = NULL_IF_CONFIG_SMALL("H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10"),
.props = AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_LOSSLESS | AV_CODEC_PROP_REORDER, .props = AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_LOSSLESS | AV_CODEC_PROP_REORDER,
.profiles = NULL_IF_CONFIG_SMALL(ff_h264_profiles),
}, },
{ {
.id = AV_CODEC_ID_INDEO3, .id = AV_CODEC_ID_INDEO3,
...@@ -460,6 +464,7 @@ static const AVCodecDescriptor codec_descriptors[] = { ...@@ -460,6 +464,7 @@ static const AVCodecDescriptor codec_descriptors[] = {
.name = "vc1", .name = "vc1",
.long_name = NULL_IF_CONFIG_SMALL("SMPTE VC-1"), .long_name = NULL_IF_CONFIG_SMALL("SMPTE VC-1"),
.props = AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_REORDER, .props = AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_REORDER,
.profiles = NULL_IF_CONFIG_SMALL(ff_vc1_profiles),
}, },
{ {
.id = AV_CODEC_ID_WMV3, .id = AV_CODEC_ID_WMV3,
...@@ -467,6 +472,7 @@ static const AVCodecDescriptor codec_descriptors[] = { ...@@ -467,6 +472,7 @@ static const AVCodecDescriptor codec_descriptors[] = {
.name = "wmv3", .name = "wmv3",
.long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 9"), .long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 9"),
.props = AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_REORDER, .props = AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_REORDER,
.profiles = NULL_IF_CONFIG_SMALL(ff_vc1_profiles),
}, },
{ {
.id = AV_CODEC_ID_LOCO, .id = AV_CODEC_ID_LOCO,
...@@ -587,6 +593,7 @@ static const AVCodecDescriptor codec_descriptors[] = { ...@@ -587,6 +593,7 @@ static const AVCodecDescriptor codec_descriptors[] = {
.long_name = NULL_IF_CONFIG_SMALL("JPEG 2000"), .long_name = NULL_IF_CONFIG_SMALL("JPEG 2000"),
.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY | .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY |
AV_CODEC_PROP_LOSSLESS, AV_CODEC_PROP_LOSSLESS,
.profiles = NULL_IF_CONFIG_SMALL(ff_jpeg2000_profiles),
}, },
{ {
.id = AV_CODEC_ID_VMNC, .id = AV_CODEC_ID_VMNC,
...@@ -1098,6 +1105,7 @@ static const AVCodecDescriptor codec_descriptors[] = { ...@@ -1098,6 +1105,7 @@ static const AVCodecDescriptor codec_descriptors[] = {
.name = "hevc", .name = "hevc",
.long_name = NULL_IF_CONFIG_SMALL("HEVC (High Efficiency Video Coding)"), .long_name = NULL_IF_CONFIG_SMALL("HEVC (High Efficiency Video Coding)"),
.props = AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_REORDER, .props = AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_REORDER,
.profiles = NULL_IF_CONFIG_SMALL(ff_hevc_profiles),
}, },
{ {
.id = AV_CODEC_ID_FIC, .id = AV_CODEC_ID_FIC,
...@@ -1912,6 +1920,7 @@ static const AVCodecDescriptor codec_descriptors[] = { ...@@ -1912,6 +1920,7 @@ static const AVCodecDescriptor codec_descriptors[] = {
.name = "aac", .name = "aac",
.long_name = NULL_IF_CONFIG_SMALL("AAC (Advanced Audio Coding)"), .long_name = NULL_IF_CONFIG_SMALL("AAC (Advanced Audio Coding)"),
.props = AV_CODEC_PROP_LOSSY, .props = AV_CODEC_PROP_LOSSY,
.profiles = NULL_IF_CONFIG_SMALL(ff_aac_profiles),
}, },
{ {
.id = AV_CODEC_ID_AC3, .id = AV_CODEC_ID_AC3,
...@@ -1926,6 +1935,7 @@ static const AVCodecDescriptor codec_descriptors[] = { ...@@ -1926,6 +1935,7 @@ static const AVCodecDescriptor codec_descriptors[] = {
.name = "dts", .name = "dts",
.long_name = NULL_IF_CONFIG_SMALL("DCA (DTS Coherent Acoustics)"), .long_name = NULL_IF_CONFIG_SMALL("DCA (DTS Coherent Acoustics)"),
.props = AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_LOSSLESS, .props = AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_LOSSLESS,
.profiles = NULL_IF_CONFIG_SMALL(ff_dca_profiles),
}, },
{ {
.id = AV_CODEC_ID_VORBIS, .id = AV_CODEC_ID_VORBIS,
......
...@@ -49,6 +49,7 @@ ...@@ -49,6 +49,7 @@
#include "get_bits.h" #include "get_bits.h"
#include "internal.h" #include "internal.h"
#include "mathops.h" #include "mathops.h"
#include "profiles.h"
#include "put_bits.h" #include "put_bits.h"
#include "synth_filter.h" #include "synth_filter.h"
...@@ -1566,15 +1567,6 @@ static av_cold int dca_decode_end(AVCodecContext *avctx) ...@@ -1566,15 +1567,6 @@ static av_cold int dca_decode_end(AVCodecContext *avctx)
return 0; return 0;
} }
static const AVProfile profiles[] = {
{ FF_PROFILE_DTS, "DTS" },
{ FF_PROFILE_DTS_ES, "DTS-ES" },
{ FF_PROFILE_DTS_96_24, "DTS 96/24" },
{ FF_PROFILE_DTS_HD_HRA, "DTS-HD HRA" },
{ FF_PROFILE_DTS_HD_MA, "DTS-HD MA" },
{ FF_PROFILE_UNKNOWN },
};
static const AVOption options[] = { static const AVOption options[] = {
{ "disable_xch", "disable decoding of the XCh extension", offsetof(DCAContext, xch_disable), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM }, { "disable_xch", "disable decoding of the XCh extension", offsetof(DCAContext, xch_disable), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM },
{ "disable_xll", "disable decoding of the XLL extension", offsetof(DCAContext, xll_disable), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM }, { "disable_xll", "disable decoding of the XLL extension", offsetof(DCAContext, xll_disable), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM },
...@@ -1600,6 +1592,6 @@ AVCodec ff_dca_decoder = { ...@@ -1600,6 +1592,6 @@ AVCodec ff_dca_decoder = {
.capabilities = AV_CODEC_CAP_CHANNEL_CONF | AV_CODEC_CAP_DR1, .capabilities = AV_CODEC_CAP_CHANNEL_CONF | AV_CODEC_CAP_DR1,
.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP, .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
AV_SAMPLE_FMT_NONE }, AV_SAMPLE_FMT_NONE },
.profiles = NULL_IF_CONFIG_SMALL(profiles), .profiles = NULL_IF_CONFIG_SMALL(ff_dca_profiles),
.priv_class = &dca_decoder_class, .priv_class = &dca_decoder_class,
}; };
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
#include "mathops.h" #include "mathops.h"
#include "me_cmp.h" #include "me_cmp.h"
#include "mpegutils.h" #include "mpegutils.h"
#include "profiles.h"
#include "rectangle.h" #include "rectangle.h"
#include "svq3.h" #include "svq3.h"
#include "thread.h" #include "thread.h"
...@@ -1771,23 +1772,6 @@ static const AVClass h264_class = { ...@@ -1771,23 +1772,6 @@ static const AVClass h264_class = {
.version = LIBAVUTIL_VERSION_INT, .version = LIBAVUTIL_VERSION_INT,
}; };
static const AVProfile profiles[] = {
{ FF_PROFILE_H264_BASELINE, "Baseline" },
{ FF_PROFILE_H264_CONSTRAINED_BASELINE, "Constrained Baseline" },
{ FF_PROFILE_H264_MAIN, "Main" },
{ FF_PROFILE_H264_EXTENDED, "Extended" },
{ FF_PROFILE_H264_HIGH, "High" },
{ FF_PROFILE_H264_HIGH_10, "High 10" },
{ FF_PROFILE_H264_HIGH_10_INTRA, "High 10 Intra" },
{ FF_PROFILE_H264_HIGH_422, "High 4:2:2" },
{ FF_PROFILE_H264_HIGH_422_INTRA, "High 4:2:2 Intra" },
{ FF_PROFILE_H264_HIGH_444, "High 4:4:4" },
{ FF_PROFILE_H264_HIGH_444_PREDICTIVE, "High 4:4:4 Predictive" },
{ FF_PROFILE_H264_HIGH_444_INTRA, "High 4:4:4 Intra" },
{ FF_PROFILE_H264_CAVLC_444, "CAVLC 4:4:4" },
{ FF_PROFILE_UNKNOWN },
};
AVCodec ff_h264_decoder = { AVCodec ff_h264_decoder = {
.name = "h264", .name = "h264",
.long_name = NULL_IF_CONFIG_SMALL("H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10"), .long_name = NULL_IF_CONFIG_SMALL("H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10"),
...@@ -1804,6 +1788,6 @@ AVCodec ff_h264_decoder = { ...@@ -1804,6 +1788,6 @@ AVCodec ff_h264_decoder = {
.flush = flush_dpb, .flush = flush_dpb,
.init_thread_copy = ONLY_IF_THREADS_ENABLED(decode_init_thread_copy), .init_thread_copy = ONLY_IF_THREADS_ENABLED(decode_init_thread_copy),
.update_thread_context = ONLY_IF_THREADS_ENABLED(ff_h264_update_thread_context), .update_thread_context = ONLY_IF_THREADS_ENABLED(ff_h264_update_thread_context),
.profiles = NULL_IF_CONFIG_SMALL(profiles), .profiles = NULL_IF_CONFIG_SMALL(ff_h264_profiles),
.priv_class = &h264_class, .priv_class = &h264_class,
}; };
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include "cabac_functions.h" #include "cabac_functions.h"
#include "golomb.h" #include "golomb.h"
#include "hevc.h" #include "hevc.h"
#include "profiles.h"
const uint8_t ff_hevc_qpel_extra_before[4] = { 0, 3, 3, 3 }; const uint8_t ff_hevc_qpel_extra_before[4] = { 0, 3, 3, 3 };
const uint8_t ff_hevc_qpel_extra_after[4] = { 0, 4, 4, 4 }; const uint8_t ff_hevc_qpel_extra_after[4] = { 0, 4, 4, 4 };
...@@ -3027,13 +3028,6 @@ static void hevc_decode_flush(AVCodecContext *avctx) ...@@ -3027,13 +3028,6 @@ static void hevc_decode_flush(AVCodecContext *avctx)
#define OFFSET(x) offsetof(HEVCContext, x) #define OFFSET(x) offsetof(HEVCContext, x)
#define PAR (AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_VIDEO_PARAM) #define PAR (AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_VIDEO_PARAM)
static const AVProfile profiles[] = {
{ FF_PROFILE_HEVC_MAIN, "Main" },
{ FF_PROFILE_HEVC_MAIN_10, "Main 10" },
{ FF_PROFILE_HEVC_MAIN_STILL_PICTURE, "Main Still Picture" },
{ FF_PROFILE_UNKNOWN },
};
static const AVOption options[] = { static const AVOption options[] = {
{ "apply_defdispwin", "Apply default display window from VUI", OFFSET(apply_defdispwin), { "apply_defdispwin", "Apply default display window from VUI", OFFSET(apply_defdispwin),
AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, PAR }, AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, PAR },
...@@ -3062,5 +3056,5 @@ AVCodec ff_hevc_decoder = { ...@@ -3062,5 +3056,5 @@ AVCodec ff_hevc_decoder = {
.init_thread_copy = hevc_init_thread_copy, .init_thread_copy = hevc_init_thread_copy,
.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY | .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY |
AV_CODEC_CAP_FRAME_THREADS, AV_CODEC_CAP_FRAME_THREADS,
.profiles = NULL_IF_CONFIG_SMALL(profiles), .profiles = NULL_IF_CONFIG_SMALL(ff_hevc_profiles),
}; };
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include "thread.h" #include "thread.h"
#include "jpeg2000.h" #include "jpeg2000.h"
#include "jpeg2000dsp.h" #include "jpeg2000dsp.h"
#include "profiles.h"
#define JP2_SIG_TYPE 0x6A502020 #define JP2_SIG_TYPE 0x6A502020
#define JP2_SIG_VALUE 0x0D0A870A #define JP2_SIG_VALUE 0x0D0A870A
...@@ -1457,15 +1458,6 @@ static const AVOption options[] = { ...@@ -1457,15 +1458,6 @@ static const AVOption options[] = {
{ NULL }, { NULL },
}; };
static const AVProfile profiles[] = {
{ FF_PROFILE_JPEG2000_CSTREAM_RESTRICTION_0, "JPEG 2000 codestream restriction 0" },
{ FF_PROFILE_JPEG2000_CSTREAM_RESTRICTION_1, "JPEG 2000 codestream restriction 1" },
{ FF_PROFILE_JPEG2000_CSTREAM_NO_RESTRICTION, "JPEG 2000 no codestream restrictions" },
{ FF_PROFILE_JPEG2000_DCINEMA_2K, "JPEG 2000 digital cinema 2K" },
{ FF_PROFILE_JPEG2000_DCINEMA_4K, "JPEG 2000 digital cinema 4K" },
{ FF_PROFILE_UNKNOWN },
};
static const AVClass class = { static const AVClass class = {
.class_name = "jpeg2000", .class_name = "jpeg2000",
.item_name = av_default_item_name, .item_name = av_default_item_name,
...@@ -1484,5 +1476,5 @@ AVCodec ff_jpeg2000_decoder = { ...@@ -1484,5 +1476,5 @@ AVCodec ff_jpeg2000_decoder = {
.init = jpeg2000_decode_init, .init = jpeg2000_decode_init,
.decode = jpeg2000_decode_frame, .decode = jpeg2000_decode_frame,
.priv_class = &class, .priv_class = &class,
.profiles = NULL_IF_CONFIG_SMALL(profiles) .profiles = NULL_IF_CONFIG_SMALL(ff_jpeg2000_profiles)
}; };
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
#include "mpegutils.h" #include "mpegutils.h"
#include "mpegvideo.h" #include "mpegvideo.h"
#include "mpegvideodata.h" #include "mpegvideodata.h"
#include "profiles.h"
#include "thread.h" #include "thread.h"
#include "version.h" #include "version.h"
#include "xvmc_internal.h" #include "xvmc_internal.h"
...@@ -2680,18 +2681,6 @@ static av_cold int mpeg_decode_end(AVCodecContext *avctx) ...@@ -2680,18 +2681,6 @@ static av_cold int mpeg_decode_end(AVCodecContext *avctx)
return 0; return 0;
} }
static const AVProfile mpeg2_video_profiles[] = {
{ FF_PROFILE_MPEG2_422, "4:2:2" },
{ FF_PROFILE_MPEG2_HIGH, "High" },
{ FF_PROFILE_MPEG2_SS, "Spatially Scalable" },
{ FF_PROFILE_MPEG2_SNR_SCALABLE, "SNR Scalable" },
{ FF_PROFILE_MPEG2_MAIN, "Main" },
{ FF_PROFILE_MPEG2_SIMPLE, "Simple" },
{ FF_PROFILE_RESERVED, "Reserved" },
{ FF_PROFILE_RESERVED, "Reserved" },
{ FF_PROFILE_UNKNOWN },
};
AVCodec ff_mpeg1video_decoder = { AVCodec ff_mpeg1video_decoder = {
.name = "mpeg1video", .name = "mpeg1video",
.long_name = NULL_IF_CONFIG_SMALL("MPEG-1 video"), .long_name = NULL_IF_CONFIG_SMALL("MPEG-1 video"),
...@@ -2721,7 +2710,7 @@ AVCodec ff_mpeg2video_decoder = { ...@@ -2721,7 +2710,7 @@ AVCodec ff_mpeg2video_decoder = {
AV_CODEC_CAP_TRUNCATED | AV_CODEC_CAP_DELAY | AV_CODEC_CAP_TRUNCATED | AV_CODEC_CAP_DELAY |
AV_CODEC_CAP_SLICE_THREADS, AV_CODEC_CAP_SLICE_THREADS,
.flush = flush, .flush = flush,
.profiles = NULL_IF_CONFIG_SMALL(mpeg2_video_profiles), .profiles = NULL_IF_CONFIG_SMALL(ff_mpeg2_video_profiles),
}; };
#if FF_API_XVMC #if FF_API_XVMC
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "mpegvideodata.h" #include "mpegvideodata.h"
#include "mpeg4video.h" #include "mpeg4video.h"
#include "h263.h" #include "h263.h"
#include "profiles.h"
#include "thread.h" #include "thread.h"
#include "xvididct.h" #include "xvididct.h"
...@@ -2599,25 +2600,6 @@ static av_cold int decode_init(AVCodecContext *avctx) ...@@ -2599,25 +2600,6 @@ static av_cold int decode_init(AVCodecContext *avctx)
return 0; return 0;
} }
static const AVProfile mpeg4_video_profiles[] = {
{ FF_PROFILE_MPEG4_SIMPLE, "Simple Profile" },
{ FF_PROFILE_MPEG4_SIMPLE_SCALABLE, "Simple Scalable Profile" },
{ FF_PROFILE_MPEG4_CORE, "Core Profile" },
{ FF_PROFILE_MPEG4_MAIN, "Main Profile" },
{ FF_PROFILE_MPEG4_N_BIT, "N-bit Profile" },
{ FF_PROFILE_MPEG4_SCALABLE_TEXTURE, "Scalable Texture Profile" },
{ FF_PROFILE_MPEG4_SIMPLE_FACE_ANIMATION, "Simple Face Animation Profile" },
{ FF_PROFILE_MPEG4_BASIC_ANIMATED_TEXTURE, "Basic Animated Texture Profile" },
{ FF_PROFILE_MPEG4_HYBRID, "Hybrid Profile" },
{ FF_PROFILE_MPEG4_ADVANCED_REAL_TIME, "Advanced Real Time Simple Profile" },
{ FF_PROFILE_MPEG4_CORE_SCALABLE, "Code Scalable Profile" },
{ FF_PROFILE_MPEG4_ADVANCED_CODING, "Advanced Coding Profile" },
{ FF_PROFILE_MPEG4_ADVANCED_CORE, "Advanced Core Profile" },
{ FF_PROFILE_MPEG4_ADVANCED_SCALABLE_TEXTURE, "Advanced Scalable Texture Profile" },
{ FF_PROFILE_MPEG4_SIMPLE_STUDIO, "Simple Studio Profile" },
{ FF_PROFILE_MPEG4_ADVANCED_SIMPLE, "Advanced Simple Profile" },
};
AVCodec ff_mpeg4_decoder = { AVCodec ff_mpeg4_decoder = {
.name = "mpeg4", .name = "mpeg4",
.long_name = NULL_IF_CONFIG_SMALL("MPEG-4 part 2"), .long_name = NULL_IF_CONFIG_SMALL("MPEG-4 part 2"),
...@@ -2632,6 +2614,6 @@ AVCodec ff_mpeg4_decoder = { ...@@ -2632,6 +2614,6 @@ AVCodec ff_mpeg4_decoder = {
AV_CODEC_CAP_FRAME_THREADS, AV_CODEC_CAP_FRAME_THREADS,
.flush = ff_mpeg_flush, .flush = ff_mpeg_flush,
.pix_fmts = ff_h263_hwaccel_pixfmt_list_420, .pix_fmts = ff_h263_hwaccel_pixfmt_list_420,
.profiles = NULL_IF_CONFIG_SMALL(mpeg4_video_profiles), .profiles = NULL_IF_CONFIG_SMALL(ff_mpeg4_video_profiles),
.update_thread_context = ONLY_IF_THREADS_ENABLED(mpeg4_update_thread_context), .update_thread_context = ONLY_IF_THREADS_ENABLED(mpeg4_update_thread_context),
}; };
/*
*
* This file is part of Libav.
*
* Libav 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.
*
* Libav 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 Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "config.h"
#include "avcodec.h"
#include "profiles.h"
#if !CONFIG_SMALL
const AVProfile ff_aac_profiles[] = {
{ FF_PROFILE_AAC_LOW, "LC" },
{ FF_PROFILE_AAC_HE, "HE-AAC" },
{ FF_PROFILE_AAC_HE_V2, "HE-AACv2" },
{ FF_PROFILE_AAC_LD, "LD" },
{ FF_PROFILE_AAC_ELD, "ELD" },
{ FF_PROFILE_AAC_MAIN, "Main" },
{ FF_PROFILE_AAC_LOW, "LC" },
{ FF_PROFILE_AAC_SSR, "SSR" },
{ FF_PROFILE_AAC_LTP, "LTP" },
{ FF_PROFILE_UNKNOWN },
};
const AVProfile ff_dca_profiles[] = {
{ FF_PROFILE_DTS, "DTS" },
{ FF_PROFILE_DTS_ES, "DTS-ES" },
{ FF_PROFILE_DTS_96_24, "DTS 96/24" },
{ FF_PROFILE_DTS_HD_HRA, "DTS-HD HRA" },
{ FF_PROFILE_DTS_HD_MA, "DTS-HD MA" },
{ FF_PROFILE_UNKNOWN },
};
const AVProfile ff_h264_profiles[] = {
{ FF_PROFILE_H264_BASELINE, "Baseline" },
{ FF_PROFILE_H264_CONSTRAINED_BASELINE, "Constrained Baseline" },
{ FF_PROFILE_H264_MAIN, "Main" },
{ FF_PROFILE_H264_EXTENDED, "Extended" },
{ FF_PROFILE_H264_HIGH, "High" },
{ FF_PROFILE_H264_HIGH_10, "High 10" },
{ FF_PROFILE_H264_HIGH_10_INTRA, "High 10 Intra" },
{ FF_PROFILE_H264_HIGH_422, "High 4:2:2" },
{ FF_PROFILE_H264_HIGH_422_INTRA, "High 4:2:2 Intra" },
{ FF_PROFILE_H264_HIGH_444, "High 4:4:4" },
{ FF_PROFILE_H264_HIGH_444_PREDICTIVE, "High 4:4:4 Predictive" },
{ FF_PROFILE_H264_HIGH_444_INTRA, "High 4:4:4 Intra" },
{ FF_PROFILE_H264_CAVLC_444, "CAVLC 4:4:4" },
{ FF_PROFILE_UNKNOWN },
};
const AVProfile ff_hevc_profiles[] = {
{ FF_PROFILE_HEVC_MAIN, "Main" },
{ FF_PROFILE_HEVC_MAIN_10, "Main 10" },
{ FF_PROFILE_HEVC_MAIN_STILL_PICTURE, "Main Still Picture" },
{ FF_PROFILE_UNKNOWN },
};
const AVProfile ff_jpeg2000_profiles[] = {
{ FF_PROFILE_JPEG2000_CSTREAM_RESTRICTION_0, "JPEG 2000 codestream restriction 0" },
{ FF_PROFILE_JPEG2000_CSTREAM_RESTRICTION_1, "JPEG 2000 codestream restriction 1" },
{ FF_PROFILE_JPEG2000_CSTREAM_NO_RESTRICTION, "JPEG 2000 no codestream restrictions" },
{ FF_PROFILE_JPEG2000_DCINEMA_2K, "JPEG 2000 digital cinema 2K" },
{ FF_PROFILE_JPEG2000_DCINEMA_4K, "JPEG 2000 digital cinema 4K" },
{ FF_PROFILE_UNKNOWN },
};
const AVProfile ff_mpeg2_video_profiles[] = {
{ FF_PROFILE_MPEG2_422, "4:2:2" },
{ FF_PROFILE_MPEG2_HIGH, "High" },
{ FF_PROFILE_MPEG2_SS, "Spatially Scalable" },
{ FF_PROFILE_MPEG2_SNR_SCALABLE, "SNR Scalable" },
{ FF_PROFILE_MPEG2_MAIN, "Main" },
{ FF_PROFILE_MPEG2_SIMPLE, "Simple" },
{ FF_PROFILE_RESERVED, "Reserved" },
{ FF_PROFILE_RESERVED, "Reserved" },
{ FF_PROFILE_UNKNOWN },
};
const AVProfile ff_mpeg4_video_profiles[] = {
{ FF_PROFILE_MPEG4_SIMPLE, "Simple Profile" },
{ FF_PROFILE_MPEG4_SIMPLE_SCALABLE, "Simple Scalable Profile" },
{ FF_PROFILE_MPEG4_CORE, "Core Profile" },
{ FF_PROFILE_MPEG4_MAIN, "Main Profile" },
{ FF_PROFILE_MPEG4_N_BIT, "N-bit Profile" },
{ FF_PROFILE_MPEG4_SCALABLE_TEXTURE, "Scalable Texture Profile" },
{ FF_PROFILE_MPEG4_SIMPLE_FACE_ANIMATION, "Simple Face Animation Profile" },
{ FF_PROFILE_MPEG4_BASIC_ANIMATED_TEXTURE, "Basic Animated Texture Profile" },
{ FF_PROFILE_MPEG4_HYBRID, "Hybrid Profile" },
{ FF_PROFILE_MPEG4_ADVANCED_REAL_TIME, "Advanced Real Time Simple Profile" },
{ FF_PROFILE_MPEG4_CORE_SCALABLE, "Code Scalable Profile" },
{ FF_PROFILE_MPEG4_ADVANCED_CODING, "Advanced Coding Profile" },
{ FF_PROFILE_MPEG4_ADVANCED_CORE, "Advanced Core Profile" },
{ FF_PROFILE_MPEG4_ADVANCED_SCALABLE_TEXTURE, "Advanced Scalable Texture Profile" },
{ FF_PROFILE_MPEG4_SIMPLE_STUDIO, "Simple Studio Profile" },
{ FF_PROFILE_MPEG4_ADVANCED_SIMPLE, "Advanced Simple Profile" },
{ FF_PROFILE_UNKNOWN },
};
const AVProfile ff_vc1_profiles[] = {
{ FF_PROFILE_VC1_SIMPLE, "Simple" },
{ FF_PROFILE_VC1_MAIN, "Main" },
{ FF_PROFILE_VC1_COMPLEX, "Complex" },
{ FF_PROFILE_VC1_ADVANCED, "Advanced" },
{ FF_PROFILE_UNKNOWN },
};
#endif /* !CONFIG_SMALL */
/*
*
* This file is part of Libav.
*
* Libav 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.
*
* Libav 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 Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVCODEC_PROFILES_H
#define AVCODEC_PROFILES_H
#include "avcodec.h"
extern const AVProfile ff_aac_profiles[];
extern const AVProfile ff_dca_profiles[];
extern const AVProfile ff_h264_profiles[];
extern const AVProfile ff_hevc_profiles[];
extern const AVProfile ff_jpeg2000_profiles[];
extern const AVProfile ff_mpeg2_video_profiles[];
extern const AVProfile ff_mpeg4_video_profiles[];
extern const AVProfile ff_vc1_profiles[];
#endif
...@@ -1918,6 +1918,21 @@ const char *av_get_profile_name(const AVCodec *codec, int profile) ...@@ -1918,6 +1918,21 @@ const char *av_get_profile_name(const AVCodec *codec, int profile)
return NULL; return NULL;
} }
const char *avcodec_profile_name(enum AVCodecID codec_id, int profile)
{
const AVCodecDescriptor *desc = avcodec_descriptor_get(codec_id);
const AVProfile *p;
if (profile == FF_PROFILE_UNKNOWN || !desc || !desc->profiles)
return NULL;
for (p = desc->profiles; p->profile != FF_PROFILE_UNKNOWN; p++)
if (p->profile == profile)
return p->name;
return NULL;
}
unsigned avcodec_version(void) unsigned avcodec_version(void)
{ {
return LIBAVCODEC_VERSION_INT; return LIBAVCODEC_VERSION_INT;
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include "mpegvideo.h" #include "mpegvideo.h"
#include "msmpeg4.h" #include "msmpeg4.h"
#include "msmpeg4data.h" #include "msmpeg4data.h"
#include "profiles.h"
#include "vc1.h" #include "vc1.h"
#include "vc1data.h" #include "vc1data.h"
...@@ -943,14 +944,6 @@ err: ...@@ -943,14 +944,6 @@ err:
} }
static const AVProfile profiles[] = {
{ FF_PROFILE_VC1_SIMPLE, "Simple" },
{ FF_PROFILE_VC1_MAIN, "Main" },
{ FF_PROFILE_VC1_COMPLEX, "Complex" },
{ FF_PROFILE_VC1_ADVANCED, "Advanced" },
{ FF_PROFILE_UNKNOWN },
};
static const enum AVPixelFormat vc1_hwaccel_pixfmt_list_420[] = { static const enum AVPixelFormat vc1_hwaccel_pixfmt_list_420[] = {
#if CONFIG_VC1_DXVA2_HWACCEL #if CONFIG_VC1_DXVA2_HWACCEL
AV_PIX_FMT_DXVA2_VLD, AV_PIX_FMT_DXVA2_VLD,
...@@ -980,7 +973,7 @@ AVCodec ff_vc1_decoder = { ...@@ -980,7 +973,7 @@ AVCodec ff_vc1_decoder = {
.flush = ff_mpeg_flush, .flush = ff_mpeg_flush,
.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY, .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY,
.pix_fmts = vc1_hwaccel_pixfmt_list_420, .pix_fmts = vc1_hwaccel_pixfmt_list_420,
.profiles = NULL_IF_CONFIG_SMALL(profiles) .profiles = NULL_IF_CONFIG_SMALL(ff_vc1_profiles)
}; };
#if CONFIG_WMV3_DECODER #if CONFIG_WMV3_DECODER
...@@ -996,7 +989,7 @@ AVCodec ff_wmv3_decoder = { ...@@ -996,7 +989,7 @@ AVCodec ff_wmv3_decoder = {
.flush = ff_mpeg_flush, .flush = ff_mpeg_flush,
.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY, .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY,
.pix_fmts = vc1_hwaccel_pixfmt_list_420, .pix_fmts = vc1_hwaccel_pixfmt_list_420,
.profiles = NULL_IF_CONFIG_SMALL(profiles) .profiles = NULL_IF_CONFIG_SMALL(ff_vc1_profiles)
}; };
#endif #endif
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include "libavutil/version.h" #include "libavutil/version.h"
#define LIBAVCODEC_VERSION_MAJOR 57 #define LIBAVCODEC_VERSION_MAJOR 57
#define LIBAVCODEC_VERSION_MINOR 11 #define LIBAVCODEC_VERSION_MINOR 12
#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, \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment