# HG changeset patch # User atmos4 # Date 1018543852 0 # Node ID 71372b7125cf6d7f41609d81b47838045ae6bc59 # Parent e7619ffa73037c55eb77e1cdde65450136e0528c Sorry, fix vobsub duration the arpi way. Also added origin parsing, those values are to adjust subtitle placement, they should be added to start_row and end_row and start_col and end_col, but haven't yet found the proper place to hook them in. diff -r e7619ffa7303 -r 71372b7125cf vobsub.c --- a/vobsub.c Thu Apr 11 15:41:40 2002 +0000 +++ b/vobsub.c Thu Apr 11 16:50:52 2002 +0000 @@ -410,6 +410,7 @@ void *spudec; unsigned int palette[16]; unsigned int orig_frame_width, orig_frame_height; + unsigned int origin_x, origin_y; /* index */ packet_queue_t *spu_streams; unsigned int spu_streams_size; @@ -481,7 +482,7 @@ if (packet_queue_grow(queue) >= 0) { pkt = queue->packets + (queue->packets_size - 1); pkt->filepos = filepos; - pkt->pts100 = ms / 10; + pkt->pts100 = ms * 90; return 0; } return -1; @@ -588,6 +589,23 @@ } static int +vobsub_parse_origin(vobsub_t *vob, const char *line) +{ + // org: X,Y + char *p; + while (isspace(*line)) + ++line; + if (!isdigit(*line)) + return -1; + vob->origin_x = strtoul(line, &p, 10); + if (*p != ',') + return -1; + ++p; + vob->origin_y = strtoul(p, NULL, 10); + return 0; +} + +static int vobsub_parse_palette(vobsub_t *vob, const char *line) { // palette: XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX, XXXXXX @@ -634,6 +652,8 @@ res = vobsub_parse_palette(vob, line + 8); else if (strncmp("size:", line, 5) == 0) res = vobsub_parse_size(vob, line + 5); + else if (strncmp("org:", line, 4) == 0) + res = vobsub_parse_origin(vob, line + 4); else if (strncmp("timestamp:", line, 10) == 0) res = vobsub_parse_timestamp(vob, line + 10); else { @@ -822,15 +842,16 @@ void vobsub_draw(void *this, int dxs, int dys, void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)) { vobsub_t *vob = (vobsub_t *)this; - if (vob->spudec) + if (vob->spudec) { spudec_draw_scaled(vob->spudec, dxs, dys, draw_alpha); + } } void vobsub_process(void *vobhandle, float pts) { vobsub_t *vob = (vobsub_t *)vobhandle; - unsigned int pts100 = 100 * pts; + unsigned int pts100 = 90000 * pts; if (vob->spudec) { spudec_heartbeat(vob->spudec, pts100); if (vob->spu_streams && 0 <= vobsub_id && (unsigned) vobsub_id < vob->spu_streams_size) {