On Sat, Jan 12, 2013 at 05:49:41PM +0100, Alexandra Khirnova wrote:
> From: Joakim Plate <[email protected]>
> 
> This is how mkvs store palette information for vobsubs

This is how Matroska stores palette information for vobsubs.

> --- a/libavcodec/dvdsubdec.c
> +++ b/libavcodec/dvdsubdec.c
> @@ -25,6 +25,12 @@
>  
>  //#define DEBUG
>  
> +typedef struct DVDSubContext
> +{

typedef struct DVDSubContext {

> @@ -123,6 +130,13 @@ static void guess_palette(uint32_t *rgba_palette,
>  
> +    if(ctx->has_palette) {
> +        for(i = 0; i < 4; i++)
> +            rgba_palette[i] = (ctx->palette[colormap[i]] & 0x00ffffff)
> +                              | ((alpha[i] * 17) << 24);
> +        return;
> +    }

if (, for (

> @@ -456,12 +470,13 @@ static int dvdsub_decode(AVCodecContext *avctx,
>                           void *data, int *data_size,
>                           AVPacket *avpkt)
>  {
> +    DVDSubContext *ctx = (DVDSubContext*) avctx->priv_data;

priv_data is void*, which is compatible with any pointer, so no need
for the cast.

> @@ -484,10 +499,56 @@ static int dvdsub_decode(AVCodecContext *avctx,
> +    while (!(*pos == 0)) {
> +        if (strncmp("palette:", pos, 8) == 0) {
> +            int i;
> +            char *p = pos + 8;
> +            ctx->has_palette = 1;
> +            for(i = 0; i < 16; i++) {

for (

> +    if (ctx->has_palette) {
> +        int i;
> +        av_log(avctx, AV_LOG_DEBUG, "palette:");
> +        for(i = 0; i < 16; i++)
> +            av_log(avctx, AV_LOG_DEBUG, " 0x%06x", ctx->palette[i]);
> +        av_log(avctx, AV_LOG_DEBUG, "\n");
> +    }

for (

I think this whole block should probably use av_dlog instead of av_log.

Diego
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to