diff options
author | Michael Roitzsch <mroi@users.sourceforge.net> | 2002-07-10 14:07:33 +0000 |
---|---|---|
committer | Michael Roitzsch <mroi@users.sourceforge.net> | 2002-07-10 14:07:33 +0000 |
commit | 24c9de726cc5040869cdcd58fdf2e66949a682d3 (patch) | |
tree | 90c2cf3fc965d719bbf47b748da4642a3a8de64e | |
parent | c636a67577b49a714e4f5919ab1073b79979de37 (diff) | |
download | xine-lib-24c9de726cc5040869cdcd58fdf2e66949a682d3.tar.gz xine-lib-24c9de726cc5040869cdcd58fdf2e66949a682d3.tar.bz2 |
* handle aspect special buffers and force the aspect to the mode requested
by the input plugin (currently only xine-dvdnav forces aspects)
* detect pan&scan material by examining the streams scale prohibitions
CVS patchset: 2248
CVS date: 2002/07/10 14:07:33
-rw-r--r-- | src/libmpeg2/decode.c | 6 | ||||
-rw-r--r-- | src/libmpeg2/mpeg2.h | 1 | ||||
-rw-r--r-- | src/libmpeg2/xine_decoder.c | 17 |
3 files changed, 21 insertions, 3 deletions
diff --git a/src/libmpeg2/decode.c b/src/libmpeg2/decode.c index 7c46f70f3..35b3f15e0 100644 --- a/src/libmpeg2/decode.c +++ b/src/libmpeg2/decode.c @@ -288,7 +288,10 @@ static inline int parse_chunk (mpeg2dec_t * mpeg2dec, int code, if (mpeg2_header_sequence (picture, buffer)) { fprintf (stderr, "bad sequence header\n"); /* abort(); */ - } else if (mpeg2dec->is_sequence_needed + break; + } + if (mpeg2dec->force_aspect) picture->aspect_ratio_information = mpeg2dec->force_aspect; + if (mpeg2dec->is_sequence_needed || (picture->frame_width != picture->coded_picture_width) || (picture->frame_height != picture->coded_picture_height)) { xine_frame_change_event_t notify_event; @@ -632,6 +635,7 @@ void mpeg2_find_sequence_header (mpeg2dec_t * mpeg2dec, printf ("libmpeg2: bad sequence header\n"); continue; } + if (mpeg2dec->force_aspect) picture->aspect_ratio_information = mpeg2dec->force_aspect; if (mpeg2dec->is_sequence_needed) { xine_frame_change_event_t notify_event; diff --git a/src/libmpeg2/mpeg2.h b/src/libmpeg2/mpeg2.h index a3994930e..723066891 100644 --- a/src/libmpeg2/mpeg2.h +++ b/src/libmpeg2/mpeg2.h @@ -45,6 +45,7 @@ typedef struct mpeg2dec_s { int64_t pts; uint32_t rff_pattern; + int force_aspect; xine_t *xine; } mpeg2dec_t ; diff --git a/src/libmpeg2/xine_decoder.c b/src/libmpeg2/xine_decoder.c index bce1513c3..1b53d0717 100644 --- a/src/libmpeg2/xine_decoder.c +++ b/src/libmpeg2/xine_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: xine_decoder.c,v 1.35 2002/07/05 17:32:03 mroi Exp $ + * $Id: xine_decoder.c,v 1.36 2002/07/10 14:07:33 mroi Exp $ * * stuff needed to turn libmpeg2 into a xine decoder plugin */ @@ -64,6 +64,7 @@ static void mpeg2dec_init (video_decoder_t *this_gen, vo_instance_t *video_out) mpeg2_init (&this->mpeg2, video_out); video_out->open(video_out); this->video_out = video_out; + this->mpeg2.force_aspect = 0; pthread_mutex_unlock (&this->lock); @@ -80,7 +81,19 @@ static void mpeg2dec_decode_data (video_decoder_t *this_gen, buf_element_t *buf) #endif pthread_mutex_lock (&this->lock); - + + /* handle aspect hints from xine-dvdnav */ + if (buf->decoder_flags & BUF_FLAG_SPECIAL) { + if (buf->decoder_info[1] == BUF_SPECIAL_ASPECT) { + this->mpeg2.force_aspect = buf->decoder_info[2]; + if (buf->decoder_info[3] == 0x1 && buf->decoder_info[2] == XINE_ASPECT_RATIO_ANAMORPHIC) + /* letterboxing is denied, we have to do pan&scan */ + this->mpeg2.force_aspect = XINE_ASPECT_RATIO_PAN_SCAN; + } + pthread_mutex_unlock (&this->lock); + return; + } + if (buf->decoder_flags & BUF_FLAG_PREVIEW) { mpeg2_find_sequence_header (&this->mpeg2, buf->content, buf->content + buf->size); } else { |