Include two values for it, a default one that sets/keeps the current behavior, where the frame event generated by the primary input will have a timestamp equal or higher than frames in secondary input, plus a new one where the secondary input frame will be that with the absolute closest timestamp to that of the frame event one. Addresses ticket #9689, where the new optional behavior produces better frame syncronization.
Showing the changes to libavfilter/framesync.h (1 of 2 files). Show all
Unified · Split
| @@ -75,6 +75,27 @@ enum FFFrameSyncExtMode { · 74 unmodified lines | ||
| 75 | 75 | EXT_INFINITY, |
| 76 | 76 | }; |
| 77 | 77 | |
| 78 | +/** | |
| 79 | + * Timestamp syncronization mode | |
| 80 | + * | |
| 81 | + * Describe how the frames of a stream are syncronized based on timestamp | |
| 82 | + * distance. | |
| 83 | + */ | |
| 84 | +enum FFFrameTSSyncMode { | |
| 85 | + | |
| 86 | + /** | |
| 87 | + * Sync to frames from secondary input with the nearest, lower or equal | |
| 88 | + * timestamp to the frame event one. | |
| 89 | + */ | |
| 90 | + TS_DEFAULT, | |
| 91 | + | |
| 92 | + /** | |
| 93 | + * Sync to frames from secondary input with the absolute nearest timestamp | |
| 94 | + * to the frame event one. | |
| 95 | + */ | |
| 96 | + TS_NEAREST, | |
| 97 | +}; | |
| 98 | + | |
| 78 | 99 | /** |
| 79 | 100 | * Input stream structure |
| 80 | 101 | */ |
| @@ -138,6 +159,7 @@ typedef struct FFFrameSyncIn { · 57 unmodified lines | ||
| 138 | 159 | */ |
| 139 | 160 | unsigned sync; |
| 140 | 161 | |
| 162 | + enum FFFrameTSSyncMode ts_mode; | |
| 141 | 163 | } FFFrameSyncIn; |
| 142 | 164 | |
| 143 | 165 | /** |
| @@ -205,6 +227,7 @@ typedef struct FFFrameSync { · 61 unmodified lines | ||
| 205 | 227 | int opt_repeatlast; |
| 206 | 228 | int opt_shortest; |
| 207 | 229 | int opt_eof_action; |
| 230 | + int opt_ts_sync_mode; | |
| 208 | 231 | |
| 209 | 232 | } FFFrameSync; |
| 210 | 233 | |