summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorReinhard Nißl <rnissl@gmx.de>2008-05-11 17:42:59 +0200
committerReinhard Nißl <rnissl@gmx.de>2008-05-11 17:42:59 +0200
commit9c1ca7282eba7499c604a5bdaa27b635261025a9 (patch)
tree1838f0f4ef1742d9547d55389090ac51de80fc9b /src
parent8ff78df42588e88762aaf1581f0e86a270f4a59d (diff)
downloadxine-lib-9c1ca7282eba7499c604a5bdaa27b635261025a9.tar.gz
xine-lib-9c1ca7282eba7499c604a5bdaa27b635261025a9.tar.bz2
Extend xine_get_current_frame to provide cropping and interlacing information.
Cropping information is necessary for frame formats like 1920x1080 which are coded as 1920x1088, i. e. 8 lines are cropped away at the bottom. The information whether a frame is interlaced is necessary for proper upscaling of 4:2:0 frame formats as it must be done per field when the frame is interlaced. Otherwise choma and luma won't match. Make input_vdr.c compile again due to changed xine_get_current_frame.
Diffstat (limited to 'src')
-rw-r--r--src/vdr/input_vdr.c21
-rw-r--r--src/xine-engine/xine.c32
2 files changed, 39 insertions, 14 deletions
diff --git a/src/vdr/input_vdr.c b/src/vdr/input_vdr.c
index ade2ecfa1..5a2b70568 100644
--- a/src/vdr/input_vdr.c
+++ b/src/vdr/input_vdr.c
@@ -964,16 +964,21 @@ fprintf(stderr, "ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß\n");
READ_DATA_OR_FAIL(grab_image, lprintf("got GRABIMAGE\n"));
{
- off_t ret_val = -1;
+ off_t ret_val = -1;
- uint8_t *img = 0;
- int frame_size = 0;
- int width = 0;
- int height = 0;
- int ratio_code = 0;
- int format = 0;
+ uint8_t *img = 0;
+ int frame_size = 0;
+ int width = 0;
+ int height = 0;
+ int ratio_code = 0;
+ int format = 0;
+ int interlaced = 0;
+ int crop_left = 0;
+ int crop_right = 0;
+ int crop_top = 0;
+ int crop_bottom = 0;
- if (xine_get_current_frame_alloc(this->stream, &width, &height, &ratio_code, &format, &img, &frame_size))
+ if (xine_get_current_frame_alloc(this->stream, &width, &height, &ratio_code, &format, &img, &frame_size, &interlaced, &crop_left, &crop_right, &crop_top, &crop_bottom))
{
if (ratio_code == XINE_VO_ASPECT_SQUARE)
ratio_code = 10000;
diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c
index c51fdaaf7..7078a2e2c 100644
--- a/src/xine-engine/xine.c
+++ b/src/xine-engine/xine.c
@@ -1983,7 +1983,10 @@ int xine_get_pos_length (xine_stream_t *stream, int *pos_stream,
static int _x_get_current_frame_impl (xine_stream_t *stream, int *width, int *height,
int *ratio_code, int *format,
- uint8_t **img, int *size, int alloc_img) {
+ uint8_t **img, int *size, int alloc_img,
+ int *interlaced,
+ int *crop_left, int *crop_right,
+ int *crop_top, int *crop_bottom) {
vo_frame_t *frame;
int required_size;
@@ -2012,6 +2015,17 @@ static int _x_get_current_frame_impl (xine_stream_t *stream, int *width, int *he
*format = frame->format;
+ if (interlaced)
+ *interlaced = frame->progressive_frame ? 0 : (2 - frame->top_field_first);
+ if (crop_left)
+ *crop_left = frame->crop_left;
+ if (crop_right)
+ *crop_right = frame->crop_right;
+ if (crop_top)
+ *crop_top = frame->crop_top;
+ if (crop_bottom)
+ *crop_bottom = frame->crop_bottom;
+
switch (*format) {
case XINE_IMGFMT_YV12:
@@ -2093,21 +2107,27 @@ static int _x_get_current_frame_impl (xine_stream_t *stream, int *width, int *he
int xine_get_current_frame_alloc (xine_stream_t *stream, int *width, int *height,
int *ratio_code, int *format,
- uint8_t **img, int *size) {
+ uint8_t **img, int *size,
+ int *interlaced,
+ int *crop_left, int *crop_right,
+ int *crop_top, int *crop_bottom) {
uint8_t *no_img = NULL;
- return _x_get_current_frame_impl(stream, width, height, ratio_code, format, img ? img : &no_img, size, img != NULL);
+ return _x_get_current_frame_impl(stream, width, height, ratio_code, format, img ? img : &no_img, size, img != NULL, interlaced, crop_left, crop_right, crop_top, crop_bottom);
}
int xine_get_current_frame_s (xine_stream_t *stream, int *width, int *height,
int *ratio_code, int *format,
- uint8_t *img, int *size) {
- return (!img || size) && _x_get_current_frame_impl(stream, width, height, ratio_code, format, &img, size, 0);
+ uint8_t *img, int *size,
+ int *interlaced,
+ int *crop_left, int *crop_right,
+ int *crop_top, int *crop_bottom) {
+ return (!img || size) && _x_get_current_frame_impl(stream, width, height, ratio_code, format, &img, size, 0, interlaced, crop_left, crop_right, crop_top, crop_bottom);
}
int xine_get_current_frame (xine_stream_t *stream, int *width, int *height,
int *ratio_code, int *format,
uint8_t *img) {
- return _x_get_current_frame_impl(stream, width, height, ratio_code, format, &img, NULL, 0);
+ return _x_get_current_frame_impl(stream, width, height, ratio_code, format, &img, NULL, 0, NULL, NULL, NULL, NULL, NULL);
}
int xine_get_spu_lang (xine_stream_t *stream, int channel, char *lang) {