Unified · Split
| @@ -15,6 +15,9 @@ libavutil: 2017-10-21 · 14 unmodified lines | ||
| 15 | 15 | |
| 16 | 16 | API changes, most recent first: |
| 17 | 17 | |
| 18 | +2020-09-xx - xxxxxxxxxx - lavu 56.59.100 - timecode.h | |
| 19 | + Add av_timecode_make_smpte_tc_string2. | |
| 20 | + | |
| 18 | 21 | 2020-08-21 - xxxxxxxxxx - lavu 56.58.100 - avstring.h |
| 19 | 22 | Deprecate av_d2str(). Use av_asprintf() instead. |
| 20 | 23 | |
| @@ -136,16 +136,33 @@ static unsigned bcd2uint(uint8_t bcd) · 135 unmodified lines | ||
| 136 | 136 | return low + 10*high; |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | −char *av_timecode_make_smpte_tc_string(char *buf, uint32_t tcsmpte, int prevent_df) | |
| 139 | +char *av_timecode_make_smpte_tc_string2(char *buf, AVRational rate, uint32_t tcsmpte, int prevent_df, int skip_field) | |
| 140 | 140 | { |
| 141 | 141 | unsigned hh = bcd2uint(tcsmpte & 0x3f); // 6-bit hours |
| 142 | 142 | unsigned mm = bcd2uint(tcsmpte>>8 & 0x7f); // 7-bit minutes |
| 143 | 143 | unsigned ss = bcd2uint(tcsmpte>>16 & 0x7f); // 7-bit seconds |
| 144 | 144 | unsigned ff = bcd2uint(tcsmpte>>24 & 0x3f); // 6-bit frames |
| 145 | 145 | unsigned drop = tcsmpte & 1<<30 && !prevent_df; // 1-bit drop if not arbitrary bit |
| 146 | + | |
| 147 | + if (av_cmp_q(rate, (AVRational) {30, 1}) == 1) { | |
| 148 | + ff <<= 1; | |
| 149 | + if (!skip_field) { | |
| 150 | + if (av_cmp_q(rate, (AVRational) {50, 1}) == 0) | |
| 151 | + ff += !!(tcsmpte & 1 << 7); | |
| 152 | + else | |
| 153 | + ff += !!(tcsmpte & 1 << 23); | |
| 154 | + } | |
| 155 | + } | |
| 156 | + | |
| 146 | 157 | snprintf(buf, AV_TIMECODE_STR_SIZE, "%02u:%02u:%02u%c%02u", |
| 147 | 158 | hh, mm, ss, drop ? ';' : ':', ff); |
| 148 | 159 | return buf; |
| 160 | + | |
| 161 | +} | |
| 162 | + | |
| 163 | +char *av_timecode_make_smpte_tc_string(char *buf, uint32_t tcsmpte, int prevent_df) | |
| 164 | +{ | |
| 165 | + return av_timecode_make_smpte_tc_string2(buf, (AVRational){30, 1}, tcsmpte, prevent_df, 1); | |
| 149 | 166 | } |
| 150 | 167 | |
| 151 | 168 | char *av_timecode_make_mpeg_tc_string(char *buf, uint32_t tc25bit) |
| @@ -109,6 +109,23 @@ uint32_t av_timecode_get_smpte(AVRational rate, int drop, int hh, int mm, int ss · 108 unmodified lines | ||
| 109 | 109 | */ |
| 110 | 110 | char *av_timecode_make_string(const AVTimecode *tc, char *buf, int framenum); |
| 111 | 111 | |
| 112 | +/** | |
| 113 | + * Get the timecode string from the SMPTE timecode format. | |
| 114 | + * | |
| 115 | + * In contrast to av_timecode_make_smpte_tc_string this function supports 50/60 | |
| 116 | + * fps timecodes by using the field bit. | |
| 117 | + * | |
| 118 | + * @param buf destination buffer, must be at least AV_TIMECODE_STR_SIZE long | |
| 119 | + * @param rate frame rate of the timecode | |
| 120 | + * @param tcsmpte the 32-bit SMPTE timecode | |
| 121 | + * @param prevent_df prevent the use of a drop flag when it is known the DF bit | |
| 122 | + * is arbitrary | |
| 123 | + * @param skip_field prevent the use of a field flag when it is known the field | |
| 124 | + * bit is arbitrary (e.g. because it is used as PC flag) | |
| 125 | + * @return the buf parameter | |
| 126 | + */ | |
| 127 | +char *av_timecode_make_smpte_tc_string2(char *buf, AVRational rate, uint32_t tcsmpte, int prevent_df, int skip_field); | |
| 128 | + | |
| 112 | 129 | /** |
| 113 | 130 | * Get the timecode string from the SMPTE timecode format. |
| 114 | 131 | * |
| @@ -79,7 +79,7 @@ · 78 unmodified lines | ||
| 79 | 79 | */ |
| 80 | 80 | |
| 81 | 81 | #define LIBAVUTIL_VERSION_MAJOR 56 |
| 82 | −#define LIBAVUTIL_VERSION_MINOR 58 | |
| 82 | +#define LIBAVUTIL_VERSION_MINOR 59 | |
| 83 | 83 | #define LIBAVUTIL_VERSION_MICRO 100 |
| 84 | 84 | |
| 85 | 85 | #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ |