summaryrefslogtreecommitdiff
path: root/xine/vo_frameoutput.c
blob: eee27b6c0961543be4084cca837f04806fb0b86b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*
 * vo_frameoutput.c:
 *
 * See the main source file 'xineliboutput.c' for copyright information and
 * how to reach the author.
 *
 * $Id: vo_frameoutput.c,v 1.1 2012-03-07 08:27:40 phintuka Exp $
 *
 */

#include <stdlib.h>

#include <xine/xine_internal.h>
#include <xine/video_out.h>

#include "vo_hook.h"

#define LOG_MODULENAME "[frame_out] "
#include "../logdefs.h"

#include "vo_frameoutput.h"


/*
 *  frameoutput_hook_t
 */
typedef struct {
  vo_driver_hook_t h;

  /* callback */
  void *handle;
  void (*cb)(void *, vo_frame_t *);

} frameoutput_hook_t;

/*
 * interface
 */

/*
 * override display_frame()
 */

static void display_frame(vo_driver_t *self, vo_frame_t *vo_img)
{
  frameoutput_hook_t *this = (frameoutput_hook_t*)self;

  ASSERT_RET(self,   return);
  ASSERT_RET(vo_img, return);

  if (this->cb)
    this->cb(this->handle, vo_img);

  this->h.orig_driver->display_frame(this->h.orig_driver, vo_img);
}


/*
 * init()
 */
vo_driver_t *vo_frameoutput_init(void *handle, void (*cb)(void*, vo_frame_t*))
{
  frameoutput_hook_t *this = calloc(1, sizeof(frameoutput_hook_t));

  this->h.vo.display_frame = display_frame;

  this->handle = handle;
  this->cb     = cb;

  return &this->h.vo;
}