summaryrefslogtreecommitdiff
path: root/libavformat/avformat.h
diff options
context:
space:
mode:
authorMarton Balint <cus@passwd.hu>2012-05-07 20:27:08 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-05-14 23:40:46 +0200
commit94a9ac127703eb6af25dd474b0f6ce5e2b54bdee (patch)
tree5ae694935d3c12ad39a833196c460a8b07a4ddee /libavformat/avformat.h
parent9cf5bcded074cf3294ee1bd4800ec54f1a09a979 (diff)
lavf: add av_guess_frame_sample_aspect_ratio function
Guesses the sample aspect ratio of a frame, based on both the stream and the frame aspect ratio. Since the frame aspect ratio is set by the codec but the stream aspect ratio is set by the demuxer, these two may not be equal. This function tries to return the value that you should use if you would like to display the frame. Basic logic is to use the stream aspect ratio if it is set to something sane otherwise use the frame aspect ratio. This way a container setting, which is usually easy to modify can override the coded value in the frames. Signed-off-by: Marton Balint <cus@passwd.hu> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/avformat.h')
-rw-r--r--libavformat/avformat.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index ce9d70a8ad..9f520e7215 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1911,6 +1911,26 @@ const struct AVCodecTag *avformat_get_riff_video_tags(void);
* @return the table mapping RIFF FourCCs for audio to CodecID.
*/
const struct AVCodecTag *avformat_get_riff_audio_tags(void);
+
+/**
+ * Guesses the sample aspect ratio of a frame, based on both the stream and the
+ * frame aspect ratio.
+ *
+ * Since the frame aspect ratio is set by the codec but the stream aspect ratio
+ * is set by the demuxer, these two may not be equal. This function tries to
+ * return the value that you should use if you would like to display the frame.
+ *
+ * Basic logic is to use the stream aspect ratio if it is set to something sane
+ * otherwise use the frame aspect ratio. This way a container setting, which is
+ * usually easy to modify can override the coded value in the frames.
+ *
+ * @param format the format context which the stream is part of
+ * @param stream the stream which the frame is part of
+ * @param frame the frame with the aspect ratio to be determined
+ * @return the guessed (valid) sample_aspect_ratio, 0/1 if no idea
+ */
+AVRational av_guess_sample_aspect_ratio(AVFormatContext *format, AVStream *stream, AVFrame *frame);
+
/**
* @}
*/