]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/pgssubdec.c
Remove misplaced Doxygen comment.
[ffmpeg] / libavcodec / pgssubdec.c
index a27e5f9d808fdcfa92c94f5aaf6e2c39fdcbf465..bf2de6ace22254b9adf3b99361fd7e969c732bc1 100644 (file)
  */
 
 /**
- * @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
 
@@ -80,7 +80,7 @@ static av_cold int close_decoder(AVCodecContext *avctx)
 }
 
 /**
- * Decodes the RLE data.
+ * Decode the RLE data.
  *
  * The subtitle is stored as an Run Length Encoded image.
  *
@@ -141,7 +141,7 @@ static int decode_rle(AVCodecContext *avctx, AVSubtitle *sub,
 }
 
 /**
- * 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.
@@ -205,7 +205,7 @@ static int parse_picture_segment(AVCodecContext *avctx,
 }
 
 /**
- * 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.
@@ -246,7 +246,7 @@ static void parse_palette_segment(AVCodecContext *avctx,
 }
 
 /**
- * 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.
@@ -317,7 +317,7 @@ static void parse_presentation_segment(AVCodecContext *avctx,
 }
 
 /**
- * Parses the display segment packet.
+ * Parse the display segment packet.
  *
  * The display segment controls the updating of the display.
  *
@@ -343,15 +343,14 @@ static int display_end_segment(AVCodecContext *avctx, void *data,
      *      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;
@@ -368,7 +367,7 @@ static int display_end_segment(AVCodecContext *avctx, void *data,
 
     /* 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));
 
@@ -455,7 +454,7 @@ static int decode(AVCodecContext *avctx, void *data, int *data_size,
 
 AVCodec pgssub_decoder = {
     "pgssub",
-    CODEC_TYPE_SUBTITLE,
+    AVMEDIA_TYPE_SUBTITLE,
     CODEC_ID_HDMV_PGS_SUBTITLE,
     sizeof(PGSSubContext),
     init_decoder,