X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fpgssubdec.c;h=315dbbd779c3bfc7543a851da0f4781b0ffc11a8;hb=c137fdd778e1bb82c2f0d7fa4a88adc97058d6d4;hp=4e02dea167def2d6c3b3704640ab9cc4d4478450;hpb=e7e2df27f85f35dba262f3681c7dc92e32d921d0;p=ffmpeg diff --git a/libavcodec/pgssubdec.c b/libavcodec/pgssubdec.c index 4e02dea167d..315dbbd779c 100644 --- a/libavcodec/pgssubdec.c +++ b/libavcodec/pgssubdec.c @@ -28,9 +28,7 @@ #include "dsputil.h" #include "bytestream.h" #include "libavutil/colorspace.h" -#include "libavcore/imgutils.h" - -//#define DEBUG_PACKET_CONTENTS +#include "libavutil/imgutils.h" #define RGBA(r,g,b,a) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b)) @@ -141,7 +139,7 @@ static int decode_rle(AVCodecContext *avctx, AVSubtitle *sub, return -1; } - dprintf(avctx, "Pixel Count = %d, Area = %d\n", pixel_count, sub->rects[0]->w * sub->rects[0]->h); + av_dlog(avctx, "Pixel Count = %d, Area = %d\n", pixel_count, sub->rects[0]->w * sub->rects[0]->h); return 0; } @@ -246,14 +244,14 @@ static void parse_palette_segment(AVCodecContext *avctx, while (buf < buf_end) { color_id = bytestream_get_byte(&buf); y = bytestream_get_byte(&buf); - cb = bytestream_get_byte(&buf); cr = bytestream_get_byte(&buf); + cb = bytestream_get_byte(&buf); alpha = bytestream_get_byte(&buf); YUV_TO_RGB1(cb, cr); YUV_TO_RGB2(r, g, b, y); - dprintf(avctx, "Color %d := (%d,%d,%d,%d)\n", color_id, r, g, b, alpha); + av_dlog(avctx, "Color %d := (%d,%d,%d,%d)\n", color_id, r, g, b, alpha); /* Store color in palette */ ctx->clut[color_id] = RGBA(r,g,b,alpha); @@ -282,7 +280,7 @@ static void parse_presentation_segment(AVCodecContext *avctx, int w = bytestream_get_be16(&buf); int h = bytestream_get_be16(&buf); - dprintf(avctx, "Video Dimensions %dx%d\n", + av_dlog(avctx, "Video Dimensions %dx%d\n", w, h); if (av_image_check_size(w, h, 0, avctx) >= 0) avcodec_set_dimensions(avctx, w, h); @@ -317,7 +315,7 @@ static void parse_presentation_segment(AVCodecContext *avctx, /* TODO If cropping, cropping_x, cropping_y, cropping_width, cropping_height (all 2 bytes).*/ - dprintf(avctx, "Subtitle Placement x=%d, y=%d\n", x, y); + av_dlog(avctx, "Subtitle Placement x=%d, y=%d\n", x, y); if (x > avctx->width || y > avctx->height) { av_log(avctx, AV_LOG_ERROR, "Subtitle out of video bounds. x = %d, y = %d, video width = %d, video height = %d.\n", @@ -357,7 +355,6 @@ static int display_end_segment(AVCodecContext *avctx, void *data, * not been cleared by a subsequent empty display command. */ - memset(sub, 0, sizeof(*sub)); // Blank if last object_number was 0. // Note that this may be wrong for more complex subtitles. if (!ctx->presentation.object_number) @@ -404,21 +401,18 @@ static int decode(AVCodecContext *avctx, void *data, int *data_size, const uint8_t *buf_end; uint8_t segment_type; int segment_length; - -#ifdef DEBUG_PACKET_CONTENTS int i; - av_log(avctx, AV_LOG_INFO, "PGS sub packet:\n"); + av_dlog(avctx, "PGS sub packet:\n"); for (i = 0; i < buf_size; i++) { - av_log(avctx, AV_LOG_INFO, "%02x ", buf[i]); + av_dlog(avctx, "%02x ", buf[i]); if (i % 16 == 15) - av_log(avctx, AV_LOG_INFO, "\n"); + av_dlog(avctx, "\n"); } if (i & 15) - av_log(avctx, AV_LOG_INFO, "\n"); -#endif + av_dlog(avctx, "\n"); *data_size = 0; @@ -433,7 +427,7 @@ static int decode(AVCodecContext *avctx, void *data, int *data_size, segment_type = bytestream_get_byte(&buf); segment_length = bytestream_get_be16(&buf); - dprintf(avctx, "Segment Length %d, Segment Type %x\n", segment_length, segment_type); + av_dlog(avctx, "Segment Length %d, Segment Type %x\n", segment_length, segment_type); if (segment_type != DISPLAY_SEGMENT && segment_length > buf_end - buf) break;