[Libav-user] Insert an AVFrame into another AVFrame
Thomas Seilund
tps at netmaster.dk
Fri Oct 12 13:57:09 CEST 2012
Hi All
I am writing a video filter that implements a scoreboard.
I have a number of bitmap files that act as scoreboard background and
different numbers for the scoreboard.
All the bitmap files are read by the filter init function and stored in
the filter private data as AVFrames.
The idea is to insert the scoreboard background on the current frame and
also insert the relevant parts of the scoreboard giving a frame that
holds a scoreboard with game time and game score.
The frames representing the scoreboard will be inserted in the current
frame in the filter draw_slice function.
My problem is that I don’t know how to traverse the data element of the
AVFrames in order to insert the parts of the scoreboard on the current
frame.
This is illustrated below:
// Called once for each frame the filter handles.
static int draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
{
AVFilterContext *ctx = link->dst;
scoreboardContext *scoreboard = ctx->priv;
int bitmap = 123;
AVFrame *frame = scoreboard->pFrameInserts[bitmap];
av_log(NULL, AV_LOG_INFO, "draw_slice() canvas: %dx%d %s -.\n", link->w,
link->h, av_get_pix_fmt_name(link->format));
/*
*
* Code to insert an AVFrame in the frame that the filter currently handles.
*
*/
return ff_draw_slice(link->dst->outputs[0], y, h, slice_dir);
}
Any help would be appreciated.
Thanks
Thomas S
More information about the Libav-user
mailing list