libavcodec/tests/hw_base_encode.c
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /* | ||
| 2 | * This file is part of FFmpeg. | ||
| 3 | * | ||
| 4 | * FFmpeg is free software; you can redistribute it and/or | ||
| 5 | * modify it under the terms of the GNU Lesser General Public | ||
| 6 | * License as published by the Free Software Foundation; either | ||
| 7 | * version 2.1 of the License, or (at your option) any later version. | ||
| 8 | * | ||
| 9 | * FFmpeg is distributed in the hope that it will be useful, | ||
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 12 | * Lesser General Public License for more details. | ||
| 13 | * | ||
| 14 | * You should have received a copy of the GNU Lesser General Public | ||
| 15 | * License along with FFmpeg; if not, write to the Free Software | ||
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 17 | */ | ||
| 18 | |||
| 19 | #include <stdio.h> | ||
| 20 | |||
| 21 | #include "libavcodec/hw_base_encode.c" | ||
| 22 | |||
| 23 | 1 | int main(void) | |
| 24 | { | ||
| 25 | 1 | AVCodecContext avctx = { 0 }; | |
| 26 | |||
| 27 | 5 | for (int delay = 0; delay <= 3; delay++) { | |
| 28 | 24 | for (int count = 0; count <= 4; count++) { | |
| 29 | 20 | FFHWBaseEncodePicture pic = { 0 }; | |
| 30 | 20 | FFHWBaseEncodeContext ctx = { 0 }; | |
| 31 | int ret; | ||
| 32 | |||
| 33 | 20 | ctx.decode_delay = delay; | |
| 34 | 20 | ctx.input_order = count; | |
| 35 | 20 | ctx.first_pts = 100; | |
| 36 | 20 | if (count) { | |
| 37 | 16 | pic.pts = ctx.first_pts + 10 * (count - 1); | |
| 38 | 16 | ctx.pic_end = &pic; | |
| 39 | } | ||
| 40 | 20 | if (count > delay) | |
| 41 | 10 | ctx.dts_pts_diff = 10 * delay; | |
| 42 | |||
| 43 | 20 | ret = hw_base_encode_send_frame(&avctx, &ctx, NULL); | |
| 44 | 20 | printf("delay=%d frames=%d return=%d eof=%d pts_diff=%"PRId64"\n", | |
| 45 | delay, count, ret, ctx.end_of_stream, ctx.dts_pts_diff); | ||
| 46 | } | ||
| 47 | } | ||
| 48 | 1 | return 0; | |
| 49 | } | ||
| 50 |