VBV delay is useful for T-STD compliance in some TS muxers. It is certainly possible to retrieve it by parsing the output of FFmpeg, but getting it from the context makes it simpler and less error-prone.
Unified · Split
| @@ -32,7 +32,7 @@ · 31 unmodified lines | ||
| 32 | 32 | #include "libavutil/cpu.h" |
| 33 | 33 | |
| 34 | 34 | #define LIBAVCODEC_VERSION_MAJOR 52 |
| 35 | −#define LIBAVCODEC_VERSION_MINOR 112 | |
| 35 | +#define LIBAVCODEC_VERSION_MINOR 113 | |
| 36 | 36 | #define LIBAVCODEC_VERSION_MICRO 1 |
| 37 | 37 | |
| 38 | 38 | #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ |
| @@ -2892,6 +2892,14 @@ typedef struct AVCodecContext { · 2853 unmodified lines | ||
| 2892 | 2892 | * - decoding: Set by user. |
| 2893 | 2893 | */ |
| 2894 | 2894 | int thread_safe_callbacks; |
| 2895 | + | |
| 2896 | + /** | |
| 2897 | + * VBV delay coded in the last frame (in periods of a 27 MHz clock). | |
| 2898 | + * Used for compliant TS muxing. | |
| 2899 | + * - encoding: Set by libavcodec. | |
| 2900 | + * - decoding: unused. | |
| 2901 | + */ | |
| 2902 | + uint64_t vbv_delay; | |
| 2895 | 2903 | } AVCodecContext; |
| 2896 | 2904 | |
| 2897 | 2905 | /** |
| @@ -1381,6 +1381,7 @@ vbv_retry: · 1380 unmodified lines | ||
| 1381 | 1381 | s->vbv_delay_ptr[1] = vbv_delay>>5; |
| 1382 | 1382 | s->vbv_delay_ptr[2] &= 0x07; |
| 1383 | 1383 | s->vbv_delay_ptr[2] |= vbv_delay<<3; |
| 1384 | + avctx->vbv_delay = vbv_delay*300; | |
| 1384 | 1385 | } |
| 1385 | 1386 | s->total_bits += s->frame_bits; |
| 1386 | 1387 | avctx->frame_bits = s->frame_bits; |