1
0
Fork 0

HACK: store dvd palette info for user-app use

This commit is contained in:
Hendrik Leppkes 2012-12-31 15:04:21 +01:00
parent 0c36516659
commit 637a926e74
Signed by: hendrik
GPG Key ID: 846079A4B0A7C1B5
2 changed files with 18 additions and 1 deletions

View File

@ -2224,6 +2224,12 @@ typedef struct AVSubtitleRect {
char *ass;
} AVSubtitleRect;
typedef struct AVSubtitleDVDPalette {
uint32_t start_display_time;
uint8_t colormap[4];
uint8_t alpha[4];
} AVSubtitleDVDPalette;
typedef struct AVSubtitle {
uint16_t format; /* 0 = graphics */
uint32_t start_display_time; /* relative to packet pts, in ms */
@ -2231,6 +2237,9 @@ typedef struct AVSubtitle {
unsigned num_rects;
AVSubtitleRect **rects;
int64_t pts; ///< Same as packet pts, in AV_TIME_BASE
unsigned num_dvd_palette;
AVSubtitleDVDPalette **dvd_palette;
} AVSubtitle;
/**

View File

@ -324,7 +324,7 @@ static int decode_dvd_subtitles(DVDSubContext *ctx, AVSubtitle *sub_header,
case 0xff:
goto the_end;
default:
ff_dlog(NULL, "unrecognised subpicture command 0x%x\n", cmd);
av_log(ctx, AV_LOG_WARNING, "unrecognised subpicture command 0x%x\n", cmd);
goto the_end;
}
}
@ -332,6 +332,14 @@ static int decode_dvd_subtitles(DVDSubContext *ctx, AVSubtitle *sub_header,
if (offset1 >= buf_size || offset2 >= buf_size)
goto fail;
/* store dvd palette info in subtitle struct for use by caller */
i = sub_header->num_dvd_palette++;
sub_header->dvd_palette = av_realloc(sub_header->dvd_palette, sizeof(AVSubtitleDVDPalette *) * (i+1));
sub_header->dvd_palette[i] = av_mallocz(sizeof(AVSubtitleDVDPalette));
sub_header->dvd_palette[i]->start_display_time = (date << 10) / 90;
memcpy(sub_header->dvd_palette[i]->colormap, colormap, 4);
memcpy(sub_header->dvd_palette[i]->alpha, alpha, 4);
/* parse rle subtitles */
if (offset1 >= 0 && offset2 >= 0) {
int w, h;
uint8_t *bitmap;