diff options
author | Miguel Freitas <miguelfreitas@users.sourceforge.net> | 2004-09-22 20:29:13 +0000 |
---|---|---|
committer | Miguel Freitas <miguelfreitas@users.sourceforge.net> | 2004-09-22 20:29:13 +0000 |
commit | fa11460bbd06540d43ffe53d047f25639a0a6b83 (patch) | |
tree | 15c95a55bb4fbb9ea3a586f2bc171a33f787033a /src/libffmpeg/video_decoder.c | |
parent | e115a32802f4284912a2833c04c06d65270cfdef (diff) | |
download | xine-lib-fa11460bbd06540d43ffe53d047f25639a0a6b83.tar.gz xine-lib-fa11460bbd06540d43ffe53d047f25639a0a6b83.tar.bz2 |
- added cropping capability (thanks James Stembridge)
- some vo drivers support cropping natively.
(only xv and xvmc have been tested)
- add software crop fallback to video_out.c
- skip yuv2rgb processing at xshm for not yet cropped frames
(these frames are never shown)
- libmpeg2 and ffmpeg now may use crop support
- bump vo api. (changes to xvmc/xxmc will follow)
CVS patchset: 6991
CVS date: 2004/09/22 20:29:13
Diffstat (limited to 'src/libffmpeg/video_decoder.c')
-rw-r--r-- | src/libffmpeg/video_decoder.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/libffmpeg/video_decoder.c b/src/libffmpeg/video_decoder.c index e4e279bd4..a74886fab 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.33 2004/09/20 22:52:04 tmattern Exp $ + * $Id: video_decoder.c,v 1.34 2004/09/22 20:29:14 miguelfreitas Exp $ * * xine video decoder plugin using ffmpeg * @@ -104,6 +104,7 @@ struct ff_video_decoder_s { double aspect_ratio; int frame_flags; + int crop_right, crop_bottom; int output_format; yuv_planes_t yuv; @@ -134,8 +135,7 @@ static int get_buffer(AVCodecContext *context, AVFrame *av_frame){ avcodec_align_dimensions(context, &width, &height); - if( (this->context->pix_fmt != PIX_FMT_YUV420P) || - (width != this->bih.biWidth) || (height != this->bih.biHeight) ) { + if( this->context->pix_fmt != PIX_FMT_YUV420P ) { xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("ffmpeg_video_dec: unsupported frame format, DR1 disabled.\n")); @@ -143,6 +143,20 @@ static int get_buffer(AVCodecContext *context, AVFrame *av_frame){ this->context->release_buffer = avcodec_default_release_buffer; return avcodec_default_get_buffer(context, av_frame); } + + if((width != context->width) || (height != context->height)) { + if(this->stream->video_out->get_capabilities(this->stream->video_out) & VO_CAP_CROP) { + this->crop_right = width - context->width; + this->crop_bottom = height - context->height; + } else { + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + _("ffmpeg_video_dec: unsupported frame dimensions, DR1 disabled.\n")); + + this->context->get_buffer = avcodec_default_get_buffer; + this->context->release_buffer = avcodec_default_release_buffer; + return avcodec_default_get_buffer(context, av_frame); + } + } img = this->stream->video_out->get_frame (this->stream->video_out, width, @@ -1085,6 +1099,9 @@ static void ff_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { else img->duration = this->video_step * 3 / 2; + img->crop_right = this->crop_right; + img->crop_bottom = this->crop_bottom; + this->skipframes = img->draw(img, this->stream); if( this->skipframes < 0 ) this->skipframes = 0; |