Lines Matching defs:avctx
102 static void flush_cache(AVCodecContext *avctx)
104 PGSSubContext *ctx = avctx->priv_data;
138 static av_cold int init_decoder(AVCodecContext *avctx)
140 avctx->pix_fmt = AV_PIX_FMT_PAL8;
145 static av_cold int close_decoder(AVCodecContext *avctx)
147 flush_cache(avctx);
157 * @param avctx contains the current codec context
162 static int decode_rle(AVCodecContext *avctx, AVSubtitleRect *rect,
202 av_log(avctx, AV_LOG_ERROR, "Decoded %d pixels, when line should be %d pixels\n",
204 if (avctx->err_recognition & AV_EF_EXPLODE) {
213 av_log(avctx, AV_LOG_ERROR, "Insufficient RLE data for subtitle\n");
217 ff_dlog(avctx, "Pixel Count = %d, Area = %d\n", pixel_count, rect->w * rect->h);
228 * @param avctx contains the current codec context
232 static int parse_object_segment(AVCodecContext *avctx,
235 PGSSubContext *ctx = avctx->priv_data;
250 av_log(avctx, AV_LOG_ERROR, "Too many objects in epoch\n");
283 av_log(avctx, AV_LOG_ERROR,
294 if (avctx->width < width || avctx->height < height || !width || !height) {
295 av_log(avctx, AV_LOG_ERROR, "Bitmap dimensions (%dx%d) invalid.\n", width, height);
323 * @param avctx contains the current codec context
327 static int parse_palette_segment(AVCodecContext *avctx,
330 PGSSubContext *ctx = avctx->priv_data;
344 av_log(avctx, AV_LOG_ERROR, "Too many palettes in epoch\n");
362 if (avctx->height <= 0 || avctx->height > 576) {
370 ff_dlog(avctx, "Color %d := (%d,%d,%d,%d)\n", color_id, r, g, b, alpha);
384 * @param avctx contains the current codec context
389 static int parse_presentation_segment(AVCodecContext *avctx,
393 PGSSubContext *ctx = avctx->priv_data;
403 ff_dlog(avctx, "Video Dimensions %dx%d\n",
405 ret = ff_set_dimensions(avctx, w, h);
425 flush_cache(avctx);
435 av_log(avctx, AV_LOG_ERROR,
439 if (avctx->err_recognition & AV_EF_EXPLODE) {
450 av_log(avctx, AV_LOG_ERROR, "Insufficent space for object\n");
470 ff_dlog(avctx, "Subtitle Placement x=%d, y=%d\n",
473 if (object->x > avctx->width || object->y > avctx->height) {
474 av_log(avctx, AV_LOG_ERROR, "Subtitle out of video bounds. x = %d, y = %d, video width = %d, video height = %d.\n",
476 avctx->width, avctx->height);
478 if (avctx->err_recognition & AV_EF_EXPLODE) {
492 * @param avctx contains the current codec context
497 static int display_end_segment(AVCodecContext *avctx, AVSubtitle *sub,
500 PGSSubContext *ctx = avctx->priv_data;
526 av_log(avctx, AV_LOG_ERROR, "Invalid palette id %d\n",
544 av_log(avctx, AV_LOG_ERROR, "Invalid object id %d\n",
546 if (avctx->err_recognition & AV_EF_EXPLODE)
564 av_log(avctx, AV_LOG_ERROR, "RLE data length %u is %u bytes shorter than expected\n",
566 if (avctx->err_recognition & AV_EF_EXPLODE)
569 ret = decode_rle(avctx, rect, object->rle, object->rle_data_len);
571 if ((avctx->err_recognition & AV_EF_EXPLODE) ||
592 static int decode(AVCodecContext *avctx, AVSubtitle *sub,
603 ff_dlog(avctx, "PGS sub packet:\n");
606 ff_dlog(avctx, "%02x ", buf[i]);
608 ff_dlog(avctx, "\n");
612 ff_dlog(avctx, "\n");
627 ff_dlog(avctx, "Segment Length %d, Segment Type %x\n", segment_length, segment_type);
635 ret = parse_palette_segment(avctx, buf, segment_length);
638 ret = parse_object_segment(avctx, buf, segment_length);
641 ret = parse_presentation_segment(avctx, buf, segment_length, sub->pts);
655 av_log(avctx, AV_LOG_ERROR, "Duplicate display segment\n");
659 ret = display_end_segment(avctx, sub, buf, segment_length);
664 av_log(avctx, AV_LOG_ERROR, "Unknown subtitle segment type 0x%x, length %d\n",
670 avctx->err_recognition & AV_EF_EXPLODE))