[FFmpeg-devel] [PATCH 2/3] textdec: Rename all generic parts from srt to text.
Philip Langdale
philipl at overt.org
Wed Aug 1 18:14:30 CEST 2012
Now that the file is renamed, let's rename functions and types to
reflect that this code is generic and not srt specific.
Signed-off-by: Philip Langdale <philipl at overt.org>
---
libavcodec/textdec.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/libavcodec/textdec.c b/libavcodec/textdec.c
index ed6909b..6acecc1 100644
--- a/libavcodec/textdec.c
+++ b/libavcodec/textdec.c
@@ -1,5 +1,5 @@
/*
- * SubRip subtitle decoder
+ * Text subtitle decoder (formerly SubRip-specific)
* Copyright (c) 2010 Aurelien Jacobs <aurel at gnuage.org>
*
* This file is part of FFmpeg.
@@ -43,14 +43,14 @@ enum {
typedef struct {
char tag[128];
char param[PARAM_NUMBER][128];
-} SrtStack;
+} TagStack;
-static const char *srt_to_ass(AVCodecContext *avctx, char *out, char *out_end,
- const char *in, int x1, int y1, int x2, int y2)
+static const char *text_to_ass(AVCodecContext *avctx, char *out, char *out_end,
+ const char *in, int x1, int y1, int x2, int y2)
{
char c, *param, buffer[128], tmp[128];
int len, tag_close, sptr = 1, line_start = 1, an = 0, end = 0;
- SrtStack stack[16];
+ TagStack stack[16];
stack[0].tag[0] = 0;
strcpy(stack[0].param[PARAM_SIZE], "{\\fs}");
@@ -204,8 +204,8 @@ static const char *read_ts(const char *buf, int *ts_start, int *ts_end,
return NULL;
}
-static int srt_decode_frame(AVCodecContext *avctx,
- void *data, int *got_sub_ptr, AVPacket *avpkt)
+static int text_decode_frame(AVCodecContext *avctx,
+ void *data, int *got_sub_ptr, AVPacket *avpkt)
{
AVSubtitle *sub = data;
int ts_start, ts_end, x1 = -1, y1 = -1, x2 = -1, y2 = -1;
@@ -220,8 +220,8 @@ static int srt_decode_frame(AVCodecContext *avctx,
ptr = read_ts(ptr, &ts_start, &ts_end, &x1, &y1, &x2, &y2);
if (!ptr)
break;
- ptr = srt_to_ass(avctx, buffer, buffer+sizeof(buffer), ptr,
- x1, y1, x2, y2);
+ ptr = text_to_ass(avctx, buffer, buffer+sizeof(buffer), ptr,
+ x1, y1, x2, y2);
ff_ass_add_rect(sub, buffer, ts_start, ts_end-ts_start, 0);
}
@@ -235,5 +235,5 @@ AVCodec ff_srt_decoder = {
.type = AVMEDIA_TYPE_SUBTITLE,
.id = CODEC_ID_SRT,
.init = ff_ass_subtitle_header_default,
- .decode = srt_decode_frame,
+ .decode = text_decode_frame,
};
--
1.7.9.5
More information about the ffmpeg-devel
mailing list