summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiguel Freitas <miguelfreitas@users.sourceforge.net>2003-06-11 23:08:54 +0000
committerMiguel Freitas <miguelfreitas@users.sourceforge.net>2003-06-11 23:08:54 +0000
commit04dd7cc6866e3946cae1c3ad1b3b221ed8a27930 (patch)
treeecce2340c229a6b310f51c2bad90237be1246d34
parent7ed53e0ca4f460146aeab7ea7db5f6db1a147885 (diff)
downloadxine-lib-04dd7cc6866e3946cae1c3ad1b3b221ed8a27930.tar.gz
xine-lib-04dd7cc6866e3946cae1c3ad1b3b221ed8a27930.tar.bz2
- add VO_INTERLACED_FLAG to get_frame
- do not trust progressive_frame for detecting NTSC 3:2, quote: 'the alternating progressive_frame encoding problem. This is a problem where the progressive_frame flag alternates between true and false every frame, when it really should have been set to "true" all the time.' 'There is a lot of content that is affected by this issue, because it's caused by a dumb decision by a very big company that made a very popular MPEG encoder. They've since fixed the encoder, but there are apparently still authoring companies that use it, because the problem is on a lot of high-profile current discs, like Disney's "Monsters Inc." and "Beauty and the Beast".' http://www.hometheaterhifi.com/volume_8_2/dvd-benchmark-special-report-chroma-bug-4-2001.html CVS patchset: 5025 CVS date: 2003/06/11 23:08:54
-rw-r--r--src/libffmpeg/xine_decoder.c37
-rw-r--r--src/libmpeg2/decode.c7
-rw-r--r--src/libxinevdec/yuv_frames.c6
-rw-r--r--src/xine-engine/video_out.c5
-rw-r--r--src/xine-engine/video_out.h6
5 files changed, 36 insertions, 25 deletions
diff --git a/src/libffmpeg/xine_decoder.c b/src/libffmpeg/xine_decoder.c
index 63a853558..50ca720be 100644
--- a/src/libffmpeg/xine_decoder.c
+++ b/src/libffmpeg/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.123 2003/06/06 19:42:04 miguelfreitas Exp $
+ * $Id: xine_decoder.c,v 1.124 2003/06/11 23:08:56 miguelfreitas Exp $
*
* xine decoder plugin using ffmpeg
*
@@ -101,6 +101,7 @@ struct ff_video_decoder_s {
float aspect_ratio;
int xine_aspect_ratio;
+ int frame_flags;
int output_format;
yuv_planes_t yuv;
@@ -166,7 +167,7 @@ static int get_buffer(AVCodecContext *context, AVFrame *av_frame){
height,
this->xine_aspect_ratio,
this->output_format,
- VO_BOTH_FIELDS);
+ VO_BOTH_FIELDS|this->frame_flags);
/* use drawn as a decoder flag.
* if true: free this frame on release_buffer.
@@ -804,6 +805,26 @@ static void ff_decode_data (video_decoder_t *this_gen, buf_element_t *buf) {
/* decode video frame(s) */
+
+ /* flag for interlaced streams */
+ this->frame_flags = 0;
+ /* FIXME: which codecs can be interlaced?
+ FIXME: check interlaced DCT and other codec specific info. */
+ switch( codec_type ) {
+ case BUF_VIDEO_DV:
+ this->frame_flags |= VO_INTERLACED_FLAG;
+ break;
+ case BUF_VIDEO_MPEG:
+ this->frame_flags |= VO_INTERLACED_FLAG;
+ break;
+ case BUF_VIDEO_MJPEG:
+ this->frame_flags |= VO_INTERLACED_FLAG;
+ break;
+ case BUF_VIDEO_HUFFYUV:
+ this->frame_flags |= VO_INTERLACED_FLAG;
+ break;
+ }
+
/* skip decoding b frames if too late */
this->context->hurry_up = (this->skipframes > 2) ? 1:0;
@@ -888,7 +909,7 @@ static void ff_decode_data (video_decoder_t *this_gen, buf_element_t *buf) {
this->context->height,
this->xine_aspect_ratio,
this->output_format,
- VO_BOTH_FIELDS);
+ VO_BOTH_FIELDS|this->frame_flags);
free_img = 1;
}
@@ -911,7 +932,7 @@ static void ff_decode_data (video_decoder_t *this_gen, buf_element_t *buf) {
img->height,
this->xine_aspect_ratio,
this->output_format,
- VO_BOTH_FIELDS);
+ VO_BOTH_FIELDS|this->frame_flags);
free_img = 1;
img->bad_frame = 0;
}
@@ -938,14 +959,6 @@ static void ff_decode_data (video_decoder_t *this_gen, buf_element_t *buf) {
buf->pts = 0;
img->duration = this->video_step;
- /* FIXME: which codecs can be interlaced?
- FIXME: check interlaced DCT and other codec specific info. */
- if( codec_type == BUF_VIDEO_DV ||
- codec_type == BUF_VIDEO_MPEG ||
- codec_type == BUF_VIDEO_MJPEG ||
- codec_type == BUF_VIDEO_HUFFYUV )
- img->progressive_frame = 0;
-
this->skipframes = img->draw(img, this->stream);
if( this->skipframes < 0 )
this->skipframes = 0;
diff --git a/src/libmpeg2/decode.c b/src/libmpeg2/decode.c
index 0f2c1d0bd..783ae944c 100644
--- a/src/libmpeg2/decode.c
+++ b/src/libmpeg2/decode.c
@@ -129,8 +129,7 @@ static inline void get_frame_duration (mpeg2dec_t * mpeg2dec, vo_frame_t *frame)
if( ((mpeg2dec->rff_pattern & 0xff) == 0xaa ||
(mpeg2dec->rff_pattern & 0xff) == 0x55) &&
- !mpeg2dec->picture->progressive_sequence &&
- mpeg2dec->picture->progressive_frame ) {
+ !mpeg2dec->picture->progressive_sequence ) {
/* special case for ntsc 3:2 pulldown */
frame->duration += frame->duration/4;
}
@@ -465,7 +464,7 @@ static inline int parse_chunk (mpeg2dec_t * mpeg2dec, int code,
picture->coded_picture_height,
picture->aspect_ratio_information,
XINE_IMGFMT_YV12,
- picture->picture_structure);
+ VO_INTERLACED_FLAG | picture->picture_structure);
else {
picture->current_frame =
mpeg2dec->stream->video_out->get_frame (mpeg2dec->stream->video_out,
@@ -473,7 +472,7 @@ static inline int parse_chunk (mpeg2dec_t * mpeg2dec, int code,
picture->coded_picture_height,
picture->aspect_ratio_information,
XINE_IMGFMT_YV12,
- (VO_PREDICTION_FLAG | picture->picture_structure));
+ (VO_INTERLACED_FLAG | VO_PREDICTION_FLAG | picture->picture_structure));
if (picture->forward_reference_frame &&
picture->forward_reference_frame != picture->backward_reference_frame)
picture->forward_reference_frame->free (picture->forward_reference_frame);
diff --git a/src/libxinevdec/yuv_frames.c b/src/libxinevdec/yuv_frames.c
index 6571aa12f..7f4ab6c2c 100644
--- a/src/libxinevdec/yuv_frames.c
+++ b/src/libxinevdec/yuv_frames.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: yuv_frames.c,v 1.3 2003/06/06 19:42:04 miguelfreitas Exp $
+ * $Id: yuv_frames.c,v 1.4 2003/06/11 23:08:55 miguelfreitas Exp $
*
* dummy video decoder for uncompressed video frames as delivered by v4l
*/
@@ -63,7 +63,7 @@ static void yuv_frames_decode_data (video_decoder_t *this_gen, buf_element_t *bu
buf->decoder_info[1],
ASPECT_FULL,
XINE_IMGFMT_YV12,
- VO_BOTH_FIELDS);
+ VO_BOTH_FIELDS | VO_INTERLACED_FLAG);
img->duration = 3600;
img->pts = buf->pts;
@@ -74,8 +74,6 @@ static void yuv_frames_decode_data (video_decoder_t *this_gen, buf_element_t *bu
xine_fast_memcpy (img->base[1], buf->content+frame_size, frame_size/4);
xine_fast_memcpy (img->base[2], buf->content+frame_size*5/4, frame_size/4);
- img->progressive_frame = 0;
-
img->draw (img, this->stream);
img->free (img);
diff --git a/src/xine-engine/video_out.c b/src/xine-engine/video_out.c
index 2abf037ca..585a40d57 100644
--- a/src/xine-engine/video_out.c
+++ b/src/xine-engine/video_out.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_out.c,v 1.161 2003/06/06 19:42:05 miguelfreitas Exp $
+ * $Id: video_out.c,v 1.162 2003/06/11 23:08:54 miguelfreitas Exp $
*
* frame allocation / queuing / scheduling / output functions
*/
@@ -284,7 +284,8 @@ static vo_frame_t *vo_get_frame (xine_video_port_t *this_gen,
img->format = format;
img->copy_called = 0;
img->bad_frame = 0;
- img->progressive_frame = 2; /* progressive by default */
+ img->progressive_frame = 0;
+ img->repeat_first_field = 0;
extra_info_reset ( img->extra_info );
/* let driver ensure this image has the right format */
diff --git a/src/xine-engine/video_out.h b/src/xine-engine/video_out.h
index be3c120f7..5184413fe 100644
--- a/src/xine-engine/video_out.h
+++ b/src/xine-engine/video_out.h
@@ -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_out.h,v 1.90 2003/06/06 19:42:05 miguelfreitas Exp $
+ * $Id: video_out.h,v 1.91 2003/06/11 23:08:55 miguelfreitas Exp $
*
*
* xine version of video_out.h
@@ -116,8 +116,7 @@ struct vo_frame_s {
int top_field_first;
int repeat_first_field;
/* note: progressive_frame is set wrong on many mpeg2 streams. for
- * that reason, values 0 and 1 should be interpreted as "hints"
- * while 2 means "progressive for sure", -1 = "interlaced for sure".
+ * that reason, this flag should be interpreted as a "hint".
*/
int progressive_frame;
@@ -262,6 +261,7 @@ struct xine_video_port_s {
#define VO_BOTTOM_FIELD 2
#define VO_BOTH_FIELDS (VO_TOP_FIELD | VO_BOTTOM_FIELD)
#define VO_PREDICTION_FLAG 4
+#define VO_INTERLACED_FLAG 8
/* video driver capabilities */