aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/utils.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-07-17 22:30:54 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-07-23 03:07:30 +0200
commitb7397857e20d5ad25e6c59a7d052bd61fe224e10 (patch)
treea2ce9e434b4757bac0bb81c2e29b53e43ceda40d /libavcodec/utils.c
parent4443213d2ea42fdf66a90c8d3b25293622d2c90a (diff)
downloadffmpeg-b7397857e20d5ad25e6c59a7d052bd61fe224e10.tar.gz
avcodec: add avcodec_enum_to_chroma_pos()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r--libavcodec/utils.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index ff26c5810c..0b33170079 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -338,6 +338,18 @@ void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height)
*width = FFALIGN(*width, align);
}
+int avcodec_enum_to_chroma_pos(int *xpos, int *ypos, enum AVChromaLocation pos)
+{
+ if (pos <= AVCHROMA_LOC_UNSPECIFIED || pos >= AVCHROMA_LOC_NB)
+ return AVERROR(EINVAL);
+ pos--;
+
+ *xpos = (pos&1) * 128;
+ *ypos = ((pos>>1)^(pos<4)) * 128;
+
+ return 0;
+}
+
int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels,
enum AVSampleFormat sample_fmt, const uint8_t *buf,
int buf_size, int align)