@@ -2329,43 +2329,6 @@ fail:
return err < 0 ? err : ret;
}
-static void print_subtitle(AVSubtitle sub)
-{
- printf("sub.format: %u\n", sub.format);
- printf("sub.start_display_time: %u\n", sub.start_display_time);
- printf("sub.end_display_time: %u\n", sub.end_display_time);
- printf("sub.num_rects: %u\n", sub.num_rects);
- printf("sub.pts: %ld\n", sub.pts);
- for (int i = 0; i < sub.num_rects; i++)
- {
- printf("sub.rects[%d]->type: %d\n", i, sub.rects[i]->type);
- printf("sub.rects[%d]->nb_colors: %d\n", i, sub.rects[i]->nb_colors);
- printf("sub.rects[%d]->(x,y,w,h): (%d,%d,%d,%d)\n", i, sub.rects[i]->x, sub.rects[i]->y, sub.rects[i]->w, sub.rects[i]->h);
- printf("sub.rects[%d]->linesize: [%d,%d,%d,%d]\n", i, sub.rects[i]->linesize[0], sub.rects[i]->linesize[1], sub.rects[i]->linesize[1], sub.rects[i]->linesize[1]);
- switch (sub.rects[i]->type)
- {
- case SUBTITLE_TEXT:
- printf("sub.rects[%d]->text: %s\n", i, sub.rects[i]->text);
- break;
- case SUBTITLE_ASS:
- printf("sub.rects[%d]->ass: %s\n", i, sub.rects[i]->ass);
- break;
- case SUBTITLE_BITMAP:
- for (int c = 0; c < sub.rects[i]->nb_colors; c++)
- printf("color %d: [%u,%u,%u,%u]\n", c,
- sub.rects[i]->data[1][c * 4 + 0],
- sub.rects[i]->data[1][c * 4 + 1],
- sub.rects[i]->data[1][c * 4 + 2],
- sub.rects[i]->data[1][c * 4 + 3]);
- for (int y = 0; y < sub.rects[i]->h; y++, printf("\n"))
- for (int x = 0; x < sub.rects[i]->w; x++)
- printf("%d", sub.rects[i]->data[0][y * sub.rects[i]->w + x]);
- break;
- }
- }
- printf("\n");
-}
-
static int transcode_subtitles(InputStream *ist, AVPacket *pkt, int *got_output,
int *decode_failed)
{
@@ -2433,6 +2396,7 @@ static int transcode_subtitles(InputStream *ist, AVPacket *pkt, int *got_output,
|| ost->enc->type != AVMEDIA_TYPE_SUBTITLE)
continue;
+#if CONFIG_LIBASS
// Support text to bitmap
if (avcodec_descriptor_get(ost->enc_ctx->codec_id)->props & AV_CODEC_PROP_BITMAP_SUB)
if (avcodec_descriptor_get(ist->dec_ctx->codec_id)->props & AV_CODEC_PROP_TEXT_SUB)
@@ -2442,6 +2406,7 @@ static int transcode_subtitles(InputStream *ist, AVPacket *pkt, int *got_output,
subtitle.rects[r]->type = SUBTITLE_BITMAP;
rendered = 1;
}
+#endif
do_subtitle_out(output_files[ost->file_index], ost, &subtitle);
}
@@ -94,7 +94,6 @@ void free_ass_context(ASS_Context *context) {
void render_avsub_ass(ASS_Context *context, AVSubtitle *sub)
{
- printf("render_avsub_ass\n");
for (int r = 0; r < sub->num_rects; r++)
{
AVSubtitleRect *rect = sub->rects[r];
@@ -167,4 +166,59 @@ void render_avsub_ass(ASS_Context *context, AVSubtitle *sub)
}
}
}
-}
\ No newline at end of file
+}
+
+static void print_ass_image(const ASS_Image *image)
+{
+ int index = 0;
+ for (; image != NULL; image = image->next, index++)
+ {
+ printf("index: %d\n", index);
+ printf("image->(dst_x,dst_y): (%d,%d)\n", image->dst_x, image->dst_y);
+ printf("image->(w,h): (%d,%d)\n", image->w, image->h);
+ printf("image->stride: %d\n", image->stride);
+ printf("image->type: %d\n", image->type);
+ printf("image->color: [%u,%u,%u,%u]\n", AR(image->color), AG(image->color), AB(image->color), AA(image->color));
+ for (int y = 0; y < image->h; y++, printf("\n"))
+ for (int x = 0; x < image->w; x++)
+ printf("%02X", image->bitmap[y * image->stride + x]);
+ printf("\n");
+ }
+}
+
+static void print_subtitle(AVSubtitle sub)
+{
+ printf("sub.format: %u\n", sub.format);
+ printf("sub.start_display_time: %u\n", sub.start_display_time);
+ printf("sub.end_display_time: %u\n", sub.end_display_time);
+ printf("sub.num_rects: %u\n", sub.num_rects);
+ printf("sub.pts: %ld\n", sub.pts);
+ for (int i = 0; i < sub.num_rects; i++)
+ {
+ printf("sub.rects[%d]->type: %d\n", i, sub.rects[i]->type);
+ printf("sub.rects[%d]->nb_colors: %d\n", i, sub.rects[i]->nb_colors);
+ printf("sub.rects[%d]->(x,y,w,h): (%d,%d,%d,%d)\n", i, sub.rects[i]->x, sub.rects[i]->y, sub.rects[i]->w, sub.rects[i]->h);
+ printf("sub.rects[%d]->linesize: [%d,%d,%d,%d]\n", i, sub.rects[i]->linesize[0], sub.rects[i]->linesize[1], sub.rects[i]->linesize[1], sub.rects[i]->linesize[1]);
+ switch (sub.rects[i]->type)
+ {
+ case SUBTITLE_TEXT:
+ printf("sub.rects[%d]->text: %s\n", i, sub.rects[i]->text);
+ break;
+ case SUBTITLE_ASS:
+ printf("sub.rects[%d]->ass: %s\n", i, sub.rects[i]->ass);
+ break;
+ case SUBTITLE_BITMAP:
+ for (int c = 0; c < sub.rects[i]->nb_colors; c++)
+ printf("color %d: [%u,%u,%u,%u]\n", c,
+ sub.rects[i]->data[1][c * 4 + 0],
+ sub.rects[i]->data[1][c * 4 + 1],
+ sub.rects[i]->data[1][c * 4 + 2],
+ sub.rects[i]->data[1][c * 4 + 3]);
+ for (int y = 0; y < sub.rects[i]->h; y++, printf("\n"))
+ for (int x = 0; x < sub.rects[i]->w; x++)
+ printf("%d", sub.rects[i]->data[0][y * sub.rects[i]->w + x]);
+ break;
+ }
+ }
+ printf("\n");
+}
@@ -181,24 +181,6 @@ static void overlay_ass_image(AssContext *ass, AVFrame *picref,
}
}
-static void print_ass_image(const ASS_Image *image)
-{
- int index = 0;
- for (; image != NULL; image = image->next, index++)
- {
- printf("index: %d\n", index);
- printf("image->(dst_x,dst_y): (%d,%d)\n", image->dst_x, image->dst_y);
- printf("image->(w,h): (%d,%d)\n", image->w, image->h);
- printf("image->stride: %d\n", image->stride);
- printf("image->type: %d\n", image->type);
- printf("image->color: [%u,%u,%u,%u]\n", AR(image->color), AG(image->color), AB(image->color), AA(image->color));
- for (int y = 0; y < image->h; y++, printf("\n"))
- for (int x = 0; x < image->w; x++)
- printf("%02X", image->bitmap[y * image->stride + x]);
- printf("\n");
- }
-}
-
static int filter_frame(AVFilterLink *inlink, AVFrame *picref)
{
AVFilterContext *ctx = inlink->dst;