aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/utils.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-07-17 22:41:39 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-07-23 03:11:28 +0200
commitabc8110f7e54fc009895c659ce2a977fb0d697c5 (patch)
treec6861fd1376876d78bdfb177853673c1d80073f4 /libavcodec/utils.c
parentb7397857e20d5ad25e6c59a7d052bd61fe224e10 (diff)
downloadffmpeg-abc8110f7e54fc009895c659ce2a977fb0d697c5.tar.gz
avcodec: add avcodec_chroma_pos_to_enum()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r--libavcodec/utils.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 0b33170079..64bae3eea5 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -350,6 +350,17 @@ int avcodec_enum_to_chroma_pos(int *xpos, int *ypos, enum AVChromaLocation pos)
return 0;
}
+enum AVChromaLocation avcodec_chroma_pos_to_enum(int xpos, int ypos)
+{
+ int pos, xout, yout;
+
+ for (pos = AVCHROMA_LOC_UNSPECIFIED + 1; pos < AVCHROMA_LOC_NB; pos++) {
+ if (avcodec_enum_to_chroma_pos(&xout, &yout, pos) == 0 && xout == xpos && yout == ypos)
+ return pos;
+ }
+ return AVCHROMA_LOC_UNSPECIFIED;
+}
+
int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels,
enum AVSampleFormat sample_fmt, const uint8_t *buf,
int buf_size, int align)