From 351e2803fd969a77e02674fcfb0e9dcd7cd5f8fd Mon Sep 17 00:00:00 2001 From: James Stembridge Date: Sat, 14 Feb 2004 20:29:53 +0000 Subject: Read aspect when BUF_FLAG_ASPECT is set CVS patchset: 6156 CVS date: 2004/02/14 20:29:53 --- src/libffmpeg/video_decoder.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src/libffmpeg/video_decoder.c') diff --git a/src/libffmpeg/video_decoder.c b/src/libffmpeg/video_decoder.c index 7ece3413c..2111d4130 100644 --- a/src/libffmpeg/video_decoder.c +++ b/src/libffmpeg/video_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_decoder.c,v 1.7 2004/02/14 19:52:41 jstembridge Exp $ + * $Id: video_decoder.c,v 1.8 2004/02/14 20:32:12 jstembridge Exp $ * * xine video decoder plugin using ffmpeg * @@ -221,9 +221,12 @@ static void init_video_codec (ff_video_decoder_t *this, xine_bmiheader *bih) { } this->decoder_ok = 1; + + this->aspect_ratio = (double)this->bih.biWidth / (double)this->bih.biHeight; - _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_WIDTH, this->context->width); - _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_HEIGHT, this->context->height); + _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_WIDTH, this->context->width); + _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_HEIGHT, this->context->height); + _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_RATIO, this->aspect_ratio*10000); this->stream->video_out->open (this->stream->video_out, this->stream); @@ -933,6 +936,12 @@ static void ff_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { _x_stream_info_set(this->stream, XINE_STREAM_INFO_FRAME_DURATION, this->video_step); } + if (buf->decoder_flags & BUF_FLAG_ASPECT) { + this->aspect_ratio = (double)buf->decoder_info[1] / (double)buf->decoder_info[2]; + _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_RATIO, + this->aspect_ratio*10000); + } + if (this->decoder_ok && this->size) { if ( (buf->decoder_flags & BUF_FLAG_FRAME_END) || this->is_continous ) { -- cgit v1.2.3