diff options
author | Jan Schmidt <thaytan@noraisin.net> | 2009-09-22 12:16:37 +0100 |
---|---|---|
committer | Jan Schmidt <thaytan@noraisin.net> | 2009-09-28 10:32:02 +0100 |
commit | 25837289c4cbf5381e40bcb80e94cf14f57e9f59 (patch) | |
tree | c94c83b37820ba8147ac3a9d55b69f75c24b5f44 | |
parent | f248986ba4f2f979dc289e2a3593d010f5333397 (diff) |
dvdspu: Improve PGS parsing
Improve (slightly) the interpretation of PGS set-window blocks
to avoid printing warnings about unused bytes when there are multiple
window definitions.
-rw-r--r-- | gst/dvdspu/gstspu-pgs.c | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/gst/dvdspu/gstspu-pgs.c b/gst/dvdspu/gstspu-pgs.c index fc5a0bbf5..365e0c81a 100644 --- a/gst/dvdspu/gstspu-pgs.c +++ b/gst/dvdspu/gstspu-pgs.c | |||
@@ -520,25 +520,32 @@ parse_set_window (GstDVDSpu * dvdspu, guint8 type, guint8 * payload, | |||
520 | { | 520 | { |
521 | SpuState *state = &dvdspu->spu_state; | 521 | SpuState *state = &dvdspu->spu_state; |
522 | guint8 *end = payload + len; | 522 | guint8 *end = payload + len; |
523 | guint8 win_id, win_ver; | 523 | guint8 win_count, win_id; |
524 | gint i; | ||
524 | 525 | ||
525 | if (payload + 10 > end) | 526 | if (payload + 1 > end) |
526 | return 0; | 527 | return 0; |
527 | 528 | ||
528 | dump_bytes (payload, len); | 529 | dump_bytes (payload, len); |
529 | 530 | ||
530 | /* FIXME: This is just a guess as to what the numbers mean: */ | 531 | win_count = payload[0]; |
531 | win_id = payload[0]; | 532 | |
532 | win_ver = payload[1]; | 533 | for (i = 0; i < win_count; i++) { |
533 | state->pgs.win_x = GST_READ_UINT16_BE (payload + 2); | 534 | if (payload + 9 > end) |
534 | state->pgs.win_y = GST_READ_UINT16_BE (payload + 4); | 535 | return 0; |
535 | state->pgs.win_w = GST_READ_UINT16_BE (payload + 6); | 536 | |
536 | state->pgs.win_h = GST_READ_UINT16_BE (payload + 8); | 537 | /* FIXME: Store each window ID separately into an array */ |
537 | payload += 10; | 538 | win_id = payload[0]; |
538 | 539 | state->pgs.win_x = GST_READ_UINT16_BE (payload + 1); | |
539 | PGS_DUMP ("Win ID %u version %d x %d y %d w %d h %d\n", | 540 | state->pgs.win_y = GST_READ_UINT16_BE (payload + 3); |
540 | win_id, win_ver, state->pgs.win_x, state->pgs.win_y, state->pgs.win_w, | 541 | state->pgs.win_w = GST_READ_UINT16_BE (payload + 5); |
541 | state->pgs.win_h); | 542 | state->pgs.win_h = GST_READ_UINT16_BE (payload + 7); |
543 | payload += 9; | ||
544 | |||
545 | PGS_DUMP ("Win ID %u x %d y %d w %d h %d\n", | ||
546 | win_id, state->pgs.win_x, state->pgs.win_y, state->pgs.win_w, | ||
547 | state->pgs.win_h); | ||
548 | } | ||
542 | 549 | ||
543 | if (payload != end) { | 550 | if (payload != end) { |
544 | GST_ERROR ("PGS Set Window: %" G_GSSIZE_FORMAT " bytes not consumed", | 551 | GST_ERROR ("PGS Set Window: %" G_GSSIZE_FORMAT " bytes not consumed", |