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 ++++++++++++--- src/libxinevdec/yuv.c | 18 +++++++++++------- 2 files changed, 23 insertions(+), 10 deletions(-) (limited to 'src') 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 ) { diff --git a/src/libxinevdec/yuv.c b/src/libxinevdec/yuv.c index f9aa79274..aac77710a 100644 --- a/src/libxinevdec/yuv.c +++ b/src/libxinevdec/yuv.c @@ -21,7 +21,7 @@ * Actually, this decoder just reorganizes chunks of raw YUV data in such * a way that xine can display them. * - * $Id: yuv.c,v 1.30 2004/02/09 22:04:11 jstembridge Exp $ + * $Id: yuv.c,v 1.31 2004/02/14 20:29:53 jstembridge Exp $ */ #include @@ -101,14 +101,14 @@ static void yuv_decode_data (video_decoder_t *this_gen, this->width = (bih->biWidth + 3) & ~0x03; this->height = (bih->biHeight + 3) & ~0x03; - this->progressive = buf->decoder_info[1]; - this->top_field_first = buf->decoder_info[2]; - - if(buf->decoder_info[3] && buf->decoder_info[4]) - this->ratio = (double)buf->decoder_info[3]/(double)buf->decoder_info[4]; + if (buf->decoder_flags & BUF_FLAG_ASPECT) + this->ratio = (double)buf->decoder_info[1] / (double)buf->decoder_info[2]; else - this->ratio = (double)this->width/(double)this->height; + this->ratio = (double)this->width / (double)this->height; + this->progressive = buf->decoder_info[3]; + this->top_field_first = buf->decoder_info[4]; + if (this->buf) free (this->buf); this->bufsize = VIDEOBUFSIZE; @@ -138,6 +138,10 @@ static void yuv_decode_data (video_decoder_t *this_gen, } + _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_WIDTH, this->width); + _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_HEIGHT, this->height); + _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_RATIO, this->ratio*10000); + return; } else if (this->decoder_ok && !(buf->decoder_flags & BUF_FLAG_SPECIAL)) { -- cgit v1.2.3