diff options
Diffstat (limited to 'xine')
-rw-r--r-- | xine/vo_lastpts.c | 63 | ||||
-rw-r--r-- | xine/vo_lastpts.h | 16 |
2 files changed, 79 insertions, 0 deletions
diff --git a/xine/vo_lastpts.c b/xine/vo_lastpts.c new file mode 100644 index 00000000..0acdf95e --- /dev/null +++ b/xine/vo_lastpts.c @@ -0,0 +1,63 @@ +/* + * vo_lastpts.c: + * + * See the main source file 'xineliboutput.c' for copyright information and + * how to reach the author. + * + * $Id: vo_lastpts.c,v 1.1 2010-01-26 11:36:21 phintuka Exp $ + * + */ + +#include <stdlib.h> + +#include <xine/video_out.h> + +#include "vo_hook.h" + +/* + * lastpts_hook_t + */ +typedef struct { + vo_driver_hook_t h; + + /* PTS of last displayed video frame */ + int64_t last_pts; + +} lastpts_hook_t; + + +/* next symbol is dynamically linked from input plugin */ +int64_t vo_last_video_pts __attribute__((visibility("default"))) = INT64_C(-1); + + +/* + * interface + */ + +/* + * override display_frame() + */ + +static void lastpts_display_frame(vo_driver_t *self, vo_frame_t *vo_img) +{ + lastpts_hook_t *this = (lastpts_hook_t*)self; + + if (vo_img->pts > 0) + vo_last_video_pts = vo_img->pts; + + this->h.orig_driver->display_frame(this->h.orig_driver, vo_img); +} + + +/* + * init() + */ +vo_driver_t *vo_lastpts_init(void) +{ + lastpts_hook_t *this = calloc(1, sizeof(lastpts_hook_t)); + + this->h.vo.display_frame = lastpts_display_frame; + + return &this->h.vo; +} + diff --git a/xine/vo_lastpts.h b/xine/vo_lastpts.h new file mode 100644 index 00000000..a65a584b --- /dev/null +++ b/xine/vo_lastpts.h @@ -0,0 +1,16 @@ +/* + * vo_lastpts.h: + * + * See the main source file 'xineliboutput.c' for copyright information and + * how to reach the author. + * + * $Id: vo_lastpts.h,v 1.1 2010-01-26 11:36:21 phintuka Exp $ + * + */ + +#ifndef _XINELIBOUTPUT_VO_LASTPTS_H +#define _XINELIBOUTPUT_VO_LASTPTS_H + +vo_driver_t *vo_lastpts_init(void); + +#endif /* _XINELIBOUTPUT_VO_LASTPTS_H */ |