diff options
author | Anton Khirnov <anton@khirnov.net> | 2014-07-05 09:09:15 +0000 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2014-07-09 13:35:07 +0000 |
commit | f6ee61fb05482c617f5deee29a190d8ff483b3d1 (patch) | |
tree | d2d6d3d48c986270164e280c06deadd724bc5b24 /libavcodec/dv_profile.c | |
parent | 3f3232a371cc88696184d9aef1f812656264e56c (diff) | |
download | ffmpeg-f6ee61fb05482c617f5deee29a190d8ff483b3d1.tar.gz |
lavc: export DV profile API used by muxer/demuxer as public
Diffstat (limited to 'libavcodec/dv_profile.c')
-rw-r--r-- | libavcodec/dv_profile.c | 57 |
1 files changed, 41 insertions, 16 deletions
diff --git a/libavcodec/dv_profile.c b/libavcodec/dv_profile.c index 7ceffa4a51..686632d89e 100644 --- a/libavcodec/dv_profile.c +++ b/libavcodec/dv_profile.c @@ -18,11 +18,16 @@ #include <stdint.h> +#include "config.h" + #include "libavutil/common.h" #include "libavutil/log.h" #include "libavutil/pixdesc.h" #include "avcodec.h" #include "dv_profile.h" +#include "dv_profile_internal.h" + +#if CONFIG_DVPROFILE static const uint8_t dv_audio_shuffle525[10][9] = { { 0, 30, 60, 20, 50, 80, 10, 40, 70 }, /* 1st channel */ @@ -63,7 +68,7 @@ static const uint8_t block_sizes_dv100[8] = { 80, 80, 80, 80, 80, 80, 64, 64, }; -static const DVprofile dv_profiles[] = { +static const AVDVProfile dv_profiles[] = { { .dsf = 0, .video_stype = 0x0, .frame_size = 120000, /* IEC 61834, SMPTE-314M - 525/60 (NTSC) */ @@ -246,9 +251,23 @@ static const DVprofile dv_profiles[] = { } }; -const DVprofile* avpriv_dv_frame_profile(const DVprofile *sys, - const uint8_t* frame, unsigned buf_size) +void ff_dv_print_profiles(void *logctx, int loglevel) { + int i; + for (i = 0; i < FF_ARRAY_ELEMS(dv_profiles); i++) { + const AVDVProfile *p = &dv_profiles[i]; + av_log(logctx, loglevel, "Frame size: %dx%d; pixel format: %s, " + "framerate: %d/%d\n", p->width, p->height, av_get_pix_fmt_name(p->pix_fmt), + p->time_base.den, p->time_base.num); + } +} + +#endif /* CONFIG_DVPROFILE */ + +const AVDVProfile *av_dv_frame_profile(const AVDVProfile *sys, + const uint8_t* frame, unsigned buf_size) +{ +#if CONFIG_DVPROFILE int i, dsf, stype; if (buf_size < 80 * 5 + 48 + 4) @@ -269,30 +288,36 @@ const DVprofile* avpriv_dv_frame_profile(const DVprofile *sys, /* check if old sys matches and assumes corrupted input */ if (sys && buf_size == sys->frame_size) return sys; +#endif return NULL; } -const DVprofile* avpriv_dv_codec_profile(AVCodecContext* codec) +const AVDVProfile *av_dv_codec_profile(int width, int height, + enum AVPixelFormat pix_fmt) { +#if CONFIG_DVPROFILE int i; for (i=0; i<FF_ARRAY_ELEMS(dv_profiles); i++) - if (codec->height == dv_profiles[i].height && - codec->pix_fmt == dv_profiles[i].pix_fmt && - codec->width == dv_profiles[i].width) - return &dv_profiles[i]; + if (height == dv_profiles[i].height && + pix_fmt == dv_profiles[i].pix_fmt && + width == dv_profiles[i].width) + return &dv_profiles[i]; +#endif return NULL; } -void ff_dv_print_profiles(void *logctx, int loglevel) +#if LIBAVCODEC_VERSION_MAJOR < 56 +const AVDVProfile *avpriv_dv_frame_profile(const AVDVProfile *sys, + const uint8_t* frame, unsigned buf_size) { - int i; - for (i = 0; i < FF_ARRAY_ELEMS(dv_profiles); i++) { - const DVprofile *p = &dv_profiles[i]; - av_log(logctx, loglevel, "Frame size: %dx%d; pixel format: %s, " - "framerate: %d/%d\n", p->width, p->height, av_get_pix_fmt_name(p->pix_fmt), - p->time_base.den, p->time_base.num); - } + return av_dv_frame_profile(sys, frame, buf_size); +} + +const AVDVProfile *avpriv_dv_codec_profile(AVCodecContext *codec) +{ + return av_dv_codec_profile(codec->width, codec->height, codec->pix_fmt); } +#endif |