summaryrefslogtreecommitdiff
path: root/src/libmpeg2
diff options
context:
space:
mode:
Diffstat (limited to 'src/libmpeg2')
-rw-r--r--src/libmpeg2/decode.c18
-rw-r--r--src/libmpeg2/header.c7
-rw-r--r--src/libmpeg2/mpeg2_internal.h3
3 files changed, 18 insertions, 10 deletions
diff --git a/src/libmpeg2/decode.c b/src/libmpeg2/decode.c
index 40f182599..bb5076489 100644
--- a/src/libmpeg2/decode.c
+++ b/src/libmpeg2/decode.c
@@ -203,8 +203,8 @@ static void remember_metainfo (mpeg2dec_t *mpeg2dec) {
picture_t * picture = mpeg2dec->picture;
- _x_stream_info_set(mpeg2dec->stream, XINE_STREAM_INFO_VIDEO_WIDTH, picture->frame_width);
- _x_stream_info_set(mpeg2dec->stream, XINE_STREAM_INFO_VIDEO_HEIGHT, picture->frame_height);
+ _x_stream_info_set(mpeg2dec->stream, XINE_STREAM_INFO_VIDEO_WIDTH, picture->display_width);
+ _x_stream_info_set(mpeg2dec->stream, XINE_STREAM_INFO_VIDEO_HEIGHT, picture->display_height);
_x_stream_info_set(mpeg2dec->stream, XINE_STREAM_INFO_VIDEO_RATIO,
((double)10000 * get_aspect_ratio(mpeg2dec)));
@@ -421,9 +421,9 @@ static inline int parse_chunk (mpeg2dec_t * mpeg2dec, int code,
xine_event_send(mpeg2dec->stream, &event);
_x_stream_info_set(mpeg2dec->stream,XINE_STREAM_INFO_VIDEO_WIDTH,
- picture->coded_picture_width);
+ picture->display_width);
_x_stream_info_set(mpeg2dec->stream,XINE_STREAM_INFO_VIDEO_HEIGHT,
- picture->coded_picture_height);
+ picture->display_height);
if (picture->forward_reference_frame &&
picture->forward_reference_frame != picture->current_frame &&
@@ -521,6 +521,8 @@ static inline int parse_chunk (mpeg2dec_t * mpeg2dec, int code,
picture->current_frame->top_field_first = picture->top_field_first;
picture->current_frame->repeat_first_field = picture->repeat_first_field;
picture->current_frame->progressive_frame = picture->progressive_frame;
+ picture->current_frame->crop_right = picture->coded_picture_width - picture->display_width;
+ picture->current_frame->crop_bottom = picture->coded_picture_height - picture->display_height;
switch( picture->picture_coding_type ) {
case I_TYPE:
@@ -841,9 +843,9 @@ void mpeg2_find_sequence_header (mpeg2dec_t * mpeg2dec,
xine_event_send(mpeg2dec->stream, &event);
_x_stream_info_set(mpeg2dec->stream, XINE_STREAM_INFO_VIDEO_WIDTH,
- picture->coded_picture_width);
+ picture->display_width);
_x_stream_info_set(mpeg2dec->stream, XINE_STREAM_INFO_VIDEO_HEIGHT,
- picture->coded_picture_height);
+ picture->display_height);
}
} else if (code == 0xb5) { /* extension_start_code */
if (mpeg2_header_extension (picture, mpeg2dec->chunk_buffer)) {
@@ -890,9 +892,9 @@ static void process_userdata(mpeg2dec_t *mpeg2dec, uint8_t *buffer)
xine_event_send(mpeg2dec->stream, &event);
_x_stream_info_set(mpeg2dec->stream, XINE_STREAM_INFO_VIDEO_WIDTH,
- mpeg2dec->picture->coded_picture_width);
+ mpeg2dec->picture->display_width);
_x_stream_info_set(mpeg2dec->stream, XINE_STREAM_INFO_VIDEO_HEIGHT,
- mpeg2dec->picture->coded_picture_height);
+ mpeg2dec->picture->display_height);
}
if (mpeg2dec->cc_dec) {
diff --git a/src/libmpeg2/header.c b/src/libmpeg2/header.c
index c68ee5165..0f10588b0 100644
--- a/src/libmpeg2/header.c
+++ b/src/libmpeg2/header.c
@@ -116,8 +116,11 @@ int mpeg2_header_sequence (picture_t * picture, uint8_t * buffer)
height = (buffer[0] << 16) | (buffer[1] << 8) | buffer[2];
- width = ((height >> 12) + 15) & ~15;
- height = ((height & 0xfff) + 15) & ~15;
+ picture->display_width = width = (height >> 12);
+ picture->display_height = height = (height & 0xfff);
+
+ width = (width + 15) & ~15;
+ height = (height + 15) & ~15;
if ((width > 1920) || (height > 1152))
return 1; /* size restrictions for MP@HL */
diff --git a/src/libmpeg2/mpeg2_internal.h b/src/libmpeg2/mpeg2_internal.h
index 28bd60645..6ec414789 100644
--- a/src/libmpeg2/mpeg2_internal.h
+++ b/src/libmpeg2/mpeg2_internal.h
@@ -112,6 +112,9 @@ typedef struct picture_s {
/* The width and height of the picture snapped to macroblock units */
int coded_picture_width;
int coded_picture_height;
+
+ /* The width and height as it appears on header sequence */
+ unsigned int display_width, display_height;
/* picture header stuff */