summaryrefslogtreecommitdiff
path: root/src/libffmpeg
diff options
context:
space:
mode:
authorDarren Salt <linux@youmustbejoking.demon.co.uk>2007-10-31 23:53:37 +0000
committerDarren Salt <linux@youmustbejoking.demon.co.uk>2007-10-31 23:53:37 +0000
commit753da2c501c6840ab50deaae1dd169f3feaf8f4d (patch)
tree6ad36a6015b45370480d19e005e1aa4485f708f9 /src/libffmpeg
parentbe3bdd90aff7622e81c51f81f7f21ea0685d73e2 (diff)
parente2aafb0f72934a33a9318faf411c79b4cf170428 (diff)
downloadxine-lib-753da2c501c6840ab50deaae1dd169f3feaf8f4d.tar.gz
xine-lib-753da2c501c6840ab50deaae1dd169f3feaf8f4d.tar.bz2
Merge from 1.1.
Diffstat (limited to 'src/libffmpeg')
-rw-r--r--src/libffmpeg/ff_video_decoder.c45
1 files changed, 31 insertions, 14 deletions
diff --git a/src/libffmpeg/ff_video_decoder.c b/src/libffmpeg/ff_video_decoder.c
index 3c69e360d..69a0feec1 100644
--- a/src/libffmpeg/ff_video_decoder.c
+++ b/src/libffmpeg/ff_video_decoder.c
@@ -1155,6 +1155,7 @@ static void ff_handle_buffer (ff_video_decoder_t *this, buf_element_t *buf) {
int offset = 0;
int codec_type = buf->type & 0xFFFF0000;
int video_step_to_use;
+ int frame_flags_to_use;
/* pad input data */
/* note: bitstream, alt bitstream reader or something will cause
@@ -1198,6 +1199,12 @@ static void ff_handle_buffer (ff_video_decoder_t *this, buf_element_t *buf) {
/* use externally provided video_step or fall back to stream's time_base otherwise */
video_step_to_use = (this->video_step || !this->context->time_base.den) ? this->video_step : (int)(90000ll * this->context->time_base.num / this->context->time_base.den);
+ frame_flags_to_use = this->frame_flags;
+
+ /* adjust frame flags for interlaced frames when running in demux_mpeg_pes context */
+ if (!this->video_step && this->av_frame->interlaced_frame)
+ frame_flags_to_use |= VO_INTERLACED_FLAG;
+
/* aspect ratio provided by ffmpeg, override previous setting */
if ((this->aspect_ratio_prio < 2) &&
av_cmp_q(this->context->sample_aspect_ratio, avr00)) {
@@ -1244,10 +1251,10 @@ static void ff_handle_buffer (ff_video_decoder_t *this, buf_element_t *buf) {
img = this->stream->video_out->get_frame (this->stream->video_out,
this->bih.biWidth,
- this->bih.biHeight,
+ (this->bih.biHeight + 31) & ~31,
this->aspect_ratio,
this->output_format,
- VO_BOTH_FIELDS|this->frame_flags);
+ VO_BOTH_FIELDS|frame_flags_to_use);
free_img = 1;
} else {
/* DR1 */
@@ -1265,10 +1272,10 @@ static void ff_handle_buffer (ff_video_decoder_t *this, buf_element_t *buf) {
/* DR1 */
img = this->stream->video_out->get_frame (this->stream->video_out,
img->width,
- img->height,
+ (img->height + 31) & ~31,
this->aspect_ratio,
this->output_format,
- VO_BOTH_FIELDS|this->frame_flags);
+ VO_BOTH_FIELDS|frame_flags_to_use);
free_img = 1;
}
@@ -1287,10 +1294,6 @@ static void ff_handle_buffer (ff_video_decoder_t *this, buf_element_t *buf) {
img->pts = this->pts;
this->pts = 0;
- /* workaround for demux_mpeg_pes sending fields as frames */
- if (!this->video_step && this->av_frame->interlaced_frame)
- video_step_to_use /= 2;
-
/* workaround for weird 120fps streams */
if( video_step_to_use == 750 ) {
/* fallback to the VIDEO_PTS_MODE */
@@ -1303,8 +1306,14 @@ static void ff_handle_buffer (ff_video_decoder_t *this, buf_element_t *buf) {
img->duration = video_step_to_use;
img->crop_right = this->crop_right;
- img->crop_bottom = this->crop_bottom;
-
+ img->crop_bottom = this->crop_bottom + (img->height - this->bih.biHeight);
+
+ /* transfer some more frame settings when running in demux_mpeg_pes context */
+ if (!this->video_step) {
+ img->progressive_frame = !this->av_frame->interlaced_frame;
+ img->top_field_first = this->av_frame->top_field_first;
+ }
+
this->skipframes = img->draw(img, this->stream);
if(free_img)
@@ -1312,19 +1321,27 @@ static void ff_handle_buffer (ff_video_decoder_t *this, buf_element_t *buf) {
}
}
- if (!got_one_picture) {
+ /* workaround for demux_mpeg_pes sending fields as frames:
+ * do not generate a bad frame for the first field picture
+ */
+ if (!got_one_picture && (this->size || this->video_step || !this->av_frame->interlaced_frame)) {
/* skipped frame, output a bad frame (of size 1x1 when size still uninitialized) */
img = this->stream->video_out->get_frame (this->stream->video_out,
- (this->bih.biWidth <= 0) ? 1 : this->bih.biWidth,
- (this->bih.biHeight <= 0) ? 1 : this->bih.biHeight,
+ (this->bih.biWidth <= 0) ? 16 : this->bih.biWidth,
+ (this->bih.biHeight <= 0) ? 32 : this->bih.biHeight,
this->aspect_ratio,
this->output_format,
- VO_BOTH_FIELDS|this->frame_flags);
+ VO_BOTH_FIELDS|frame_flags_to_use);
/* set PTS to allow early syncing */
img->pts = this->pts;
this->pts = 0;
img->duration = video_step_to_use;
+ /* transfer some more frame settings when running in demux_mpeg_pes context */
+ if (!this->video_step) {
+ img->progressive_frame = !this->av_frame->interlaced_frame;
+ img->top_field_first = this->av_frame->top_field_first;
+ }
img->bad_frame = 1;
this->skipframes = img->draw(img, this->stream);
img->free(img);