diff options
author | arpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-12-14 17:12:40 +0000 |
---|---|---|
committer | arpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-12-14 17:12:40 +0000 |
commit | bbeb54d80aa6d1d6945ce3b6461b7d24c57841e9 (patch) | |
tree | 7ca9df3369887ec50986b765b77de1a864132b05 /libvo | |
parent | 3eb3af54f3a05879a3c13ff065462e6f5897fe21 (diff) | |
download | mpv-bbeb54d80aa6d1d6945ce3b6461b7d24c57841e9.tar.bz2 mpv-bbeb54d80aa6d1d6945ce3b6461b7d24c57841e9.tar.xz |
notice vo driver about skipped/dropped frames
patch by Alvaro Lopes <alvieboy@alvie.com>
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@8451 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo')
-rw-r--r-- | libvo/video_out.h | 5 | ||||
-rw-r--r-- | libvo/vo_yuv4mpeg.c | 52 |
2 files changed, 56 insertions, 1 deletions
diff --git a/libvo/video_out.h b/libvo/video_out.h index 118b14e65b..33cda1b1de 100644 --- a/libvo/video_out.h +++ b/libvo/video_out.h @@ -49,7 +49,10 @@ /* equalizer controls */ #define VOCTRL_SET_EQUALIZER 17 #define VOCTRL_GET_EQUALIZER 18 -// ... 20 +//#define VOCTRL_GUI_NOWINDOW 19 +/* Frame duplication */ +#define VOCTRL_DUPLICATE_FRAME 20 +// ... 21 #define VO_TRUE 1 diff --git a/libvo/vo_yuv4mpeg.c b/libvo/vo_yuv4mpeg.c index 8d4f40227e..61116ba4ff 100644 --- a/libvo/vo_yuv4mpeg.c +++ b/libvo/vo_yuv4mpeg.c @@ -222,6 +222,56 @@ static void vo_y4m_write(const void *ptr, const size_t num_bytes) perror("yuv4mpeg: Error writing image to output!"); } +static int write_last_frame(void) +{ + + uint8_t *upper_y, *upper_u, *upper_v, *rgb_buffer_lower; + int rgb_stride, uv_stride, field_height; + unsigned int i, low_ofs; + + fprintf(yuv_out, "FRAME\n"); + + if (using_format != IMGFMT_YV12) + { + rgb_stride = image_width * 3; + uv_stride = image_width / 2; + + if (Y4M_IS_INTERLACED) + { + field_height = image_height / 2; + + upper_y = image; + upper_u = upper_y + image_width * field_height; + upper_v = upper_u + image_width * field_height / 4; + low_ofs = image_width * field_height * 3 / 2; + rgb_buffer_lower = rgb_buffer + rgb_stride * field_height; + + /* Write Y plane */ + for(i = 0; i < field_height; i++) + { + vo_y4m_write(upper_y + image_width * i, image_width); + vo_y4m_write(upper_y + image_width * i + low_ofs, image_width); + } + + /* Write U and V plane */ + for(i = 0; i < field_height / 2; i++) + { + vo_y4m_write(upper_u + uv_stride * i, uv_stride); + vo_y4m_write(upper_u + uv_stride * i + low_ofs, uv_stride); + } + for(i = 0; i < field_height / 2; i++) + { + vo_y4m_write(upper_v + uv_stride * i, uv_stride); + vo_y4m_write(upper_v + uv_stride * i + low_ofs, uv_stride); + } + return VO_TRUE; /* Image written; We have to stop here */ + } + } + /* Write progressive frame */ + vo_y4m_write(image, write_bytes); + return VO_TRUE; +} + static void flip_page (void) { uint8_t *upper_y, *upper_u, *upper_v, *rgb_buffer_lower; @@ -455,6 +505,8 @@ static uint32_t control(uint32_t request, void *data, ...) switch (request) { case VOCTRL_QUERY_FORMAT: return query_format(*((uint32_t*)data)); + case VOCTRL_DUPLICATE_FRAME: + return write_last_frame(); } return VO_NOTIMPL; } |