...
|
...
|
@@ -157,8 +157,6 @@ static int config_input(AVFilterLink *inlink)
|
157
|
157
|
return 0;
|
158
|
158
|
}
|
159
|
159
|
|
160
|
|
-static int null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir) { return 0; }
|
161
|
|
-
|
162
|
160
|
/* libass stores an RGBA color in the format RRGGBBTT, where TT is the transparency level */
|
163
|
161
|
#define AR(c) ( (c)>>24)
|
164
|
162
|
#define AG(c) (((c)>>16)&0xFF)
|
...
|
...
|
@@ -180,12 +178,11 @@ static void overlay_ass_image(AssContext *ass, AVFilterBufferRef *picref,
|
180
|
180
|
}
|
181
|
181
|
}
|
182
|
182
|
|
183
|
|
-static int end_frame(AVFilterLink *inlink)
|
|
183
|
+static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *picref)
|
184
|
184
|
{
|
185
|
185
|
AVFilterContext *ctx = inlink->dst;
|
186
|
186
|
AVFilterLink *outlink = ctx->outputs[0];
|
187
|
187
|
AssContext *ass = ctx->priv;
|
188
|
|
- AVFilterBufferRef *picref = inlink->cur_buf;
|
189
|
188
|
int detect_change = 0;
|
190
|
189
|
double time_ms = picref->pts * av_q2d(inlink->time_base) * 1000;
|
191
|
190
|
ASS_Image *image = ass_render_frame(ass->renderer, ass->track,
|
...
|
...
|
@@ -196,20 +193,16 @@ static int end_frame(AVFilterLink *inlink)
|
196
|
196
|
|
197
|
197
|
overlay_ass_image(ass, picref, image);
|
198
|
198
|
|
199
|
|
- ff_draw_slice(outlink, 0, picref->video->h, 1);
|
200
|
|
- return ff_end_frame(outlink);
|
|
199
|
+ return ff_filter_frame(outlink, picref);
|
201
|
200
|
}
|
202
|
201
|
|
203
|
202
|
static const AVFilterPad ass_inputs[] = {
|
204
|
203
|
{
|
205
|
204
|
.name = "default",
|
206
|
205
|
.type = AVMEDIA_TYPE_VIDEO,
|
207
|
|
- .get_video_buffer = ff_null_get_video_buffer,
|
208
|
|
- .start_frame = ff_null_start_frame,
|
209
|
|
- .draw_slice = null_draw_slice,
|
210
|
|
- .end_frame = end_frame,
|
|
206
|
+ .filter_frame = filter_frame,
|
211
|
207
|
.config_props = config_input,
|
212
|
|
- .min_perms = AV_PERM_WRITE | AV_PERM_READ,
|
|
208
|
+ .min_perms = AV_PERM_READ | AV_PERM_WRITE,
|
213
|
209
|
},
|
214
|
210
|
{ NULL }
|
215
|
211
|
};
|