blob: 578a97919bf7e552b1421c713c2969fd7f8f55b4 [file] [edit]
/*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <stdio.h>
#include "libavcodec/hw_base_encode.c"
int main(void)
{
AVCodecContext avctx = { 0 };
for (int delay = 0; delay <= 3; delay++) {
for (int count = 0; count <= 4; count++) {
FFHWBaseEncodePicture pic = { 0 };
FFHWBaseEncodeContext ctx = { 0 };
int ret;
ctx.decode_delay = delay;
ctx.input_order = count;
ctx.first_pts = 100;
if (count) {
pic.pts = ctx.first_pts + 10 * (count - 1);
ctx.pic_end = &pic;
}
if (count > delay)
ctx.dts_pts_diff = 10 * delay;
ret = hw_base_encode_send_frame(&avctx, &ctx, NULL);
printf("delay=%d frames=%d return=%d eof=%d pts_diff=%"PRId64"\n",
delay, count, ret, ctx.end_of_stream, ctx.dts_pts_diff);
}
}
return 0;
}