*/
/**
- * @file libavcodec/pgssubdec.c
+ * @file
* PGS subtitle decoder
*/
#include "avcodec.h"
#include "dsputil.h"
-#include "colorspace.h"
#include "bytestream.h"
+#include "libavutil/colorspace.h"
//#define DEBUG_PACKET_CONTENTS
}
/**
- * Decodes the RLE data.
+ * Decode the RLE data.
*
* The subtitle is stored as an Run Length Encoded image.
*
}
/**
- * Parses the picture segment packet.
+ * Parse the picture segment packet.
*
* The picture segment contains details on the sequence id,
* width, height and Run Length Encoded (RLE) bitmap data.
}
/**
- * Parses the palette segment packet.
+ * Parse the palette segment packet.
*
* The palette segment contains details of the palette,
* a maximum of 256 colors can be defined.
}
/**
- * Parses the presentation segment packet.
+ * Parse the presentation segment packet.
*
* The presentation segment contains details on the video
* width, video height, x & y subtitle position.
}
/**
- * Parses the display segment packet.
+ * Parse the display segment packet.
*
* The display segment controls the updating of the display.
*
* not been cleared by a subsequent empty display command.
*/
+ memset(sub, 0, sizeof(*sub));
sub->start_display_time = 0;
sub->end_display_time = 20000;
sub->format = 0;
- if (!sub->rects) {
- sub->rects = av_mallocz(sizeof(*sub->rects));
- sub->rects[0] = av_mallocz(sizeof(*sub->rects[0]));
- sub->num_rects = 1;
- }
+ sub->rects = av_mallocz(sizeof(*sub->rects));
+ sub->rects[0] = av_mallocz(sizeof(*sub->rects[0]));
+ sub->num_rects = 1;
sub->rects[0]->x = ctx->presentation.x;
sub->rects[0]->y = ctx->presentation.y;
/* Allocate memory for colors */
sub->rects[0]->nb_colors = 256;
- sub->rects[0]->pict.data[1] = av_malloc(sub->rects[0]->nb_colors * sizeof(uint32_t));
+ sub->rects[0]->pict.data[1] = av_mallocz(AVPALETTE_SIZE);
memcpy(sub->rects[0]->pict.data[1], ctx->clut, sub->rects[0]->nb_colors * sizeof(uint32_t));
AVCodec pgssub_decoder = {
"pgssub",
- CODEC_TYPE_SUBTITLE,
+ AVMEDIA_TYPE_SUBTITLE,
CODEC_ID_HDMV_PGS_SUBTITLE,
sizeof(PGSSubContext),
init_decoder,