diff options
author | wm4 <wm4@nowhere> | 2013-06-01 19:44:55 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-06-03 02:09:07 +0200 |
commit | 3000df35d31f09f13a7c662e2f96bcd7d0f6ac13 (patch) | |
tree | 64ce19abc28e21cc9a17ed66045433de0342221b /sub/sd.h | |
parent | 02ce316ade9ba932ad405383278d6b01c54e5fc4 (diff) | |
download | mpv-3000df35d31f09f13a7c662e2f96bcd7d0f6ac13.tar.bz2 mpv-3000df35d31f09f13a7c662e2f96bcd7d0f6ac13.tar.xz |
sub: basic subtitle converters
Add a basic infrastructure for subtitle converters. These converters
work sort-of like decoders, except that they produce packets instead
of subtitle bitmaps. They are put in front of actual decoders.
Start with sd_movtext. 4 lines of code are blown up to a 55 lines file,
but fortunately this is not going to be that bad for the following
converters.
Diffstat (limited to 'sub/sd.h')
-rw-r--r-- | sub/sd.h | 23 |
1 files changed, 21 insertions, 2 deletions
@@ -26,6 +26,14 @@ struct sd { // Shared renderer for ASS - done to avoid reloading embedded fonts. struct ass_library *ass_library; struct ass_renderer *ass_renderer; + + // Set by sub converter + const char *output_codec; + char *output_extradata; + int output_extradata_len; + + // Internal buffer for sd_conv_* functions + struct sd_conv_buffer *sd_conv_buffer; }; struct sd_functions { @@ -33,11 +41,22 @@ struct sd_functions { bool (*supports_format)(const char *format); int (*init)(struct sd *sd); void (*decode)(struct sd *sd, struct demux_packet *packet); + void (*reset)(struct sd *sd); + void (*uninit)(struct sd *sd); + + // decoder void (*get_bitmaps)(struct sd *sd, struct mp_osd_res dim, double pts, struct sub_bitmaps *res); char *(*get_text)(struct sd *sd, double pts); - void (*reset)(struct sd *sd); - void (*uninit)(struct sd *sd); + + // converter + struct demux_packet *(*get_converted)(struct sd *sd); }; +void sd_conv_add_packet(struct sd *sd, void *data, int data_len, double pts, + double duration); +struct demux_packet *sd_conv_def_get_converted(struct sd *sd); +void sd_conv_def_reset(struct sd *sd); +void sd_conv_def_uninit(struct sd *sd); + #endif |