summaryrefslogtreecommitdiff
path: root/src/libspucc/cc_decoder.h
blob: bf8210ad77e5ac62ec0c7874c29053a880f1a0b9 (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
typedef struct cc_decoder_s cc_decoder_t;

#define CC_FONT_MAX 256

typedef struct cc_confvar_s {
  int cc_enabled;             /* true if closed captions are enabled */
  char font[CC_FONT_MAX + 1];          /* standard captioning font & size */
  int font_size;
  char italic_font[CC_FONT_MAX + 1];   /* italic captioning font & size */
  int center;                 /* true if captions should be centered */
                              /* according to text width */

  /* the following variables are not controlled by configuration files; they */
  /* are intrinsic to the properties of the configuration options and the */
  /* currently played video */
  int x;                      /* coordinates of the captioning area */
  int y;
  int width;
  int height;
  int max_char_height;        /* captioning font properties */
  int max_char_width;
  int video_width;            /* video dimensions */
  int video_height;
  int can_cc;                 /* true if captions can be displayed */
                              /* (i.e., font fits on screen) */

  cc_decoder_t *decoder;      /* back pointer to decoder (necessary for */
                              /* sending some messages after config changes) */
} cc_confvar_t;


typedef struct cc_config_s {
  cc_confvar_t vars;
  pthread_mutex_t cc_mutex;  
} cc_config_t;


cc_decoder_t *cc_decoder_open(osd_renderer_t *renderer, metronom_t *metronom,
                              config_values_t *cfg, cc_config_t *cc_cfg);
void cc_decoder_close(cc_decoder_t *this_obj);
void cc_decoder_init(config_values_t *cfg, cc_config_t *cc_cfg);
void cc_notify_frame_change(cc_decoder_t *this, int width, int height);
void decode_cc(cc_decoder_t *this, uint8_t *buffer, uint32_t buf_len,
	       uint32_t pts, uint32_t scr);