| 209 | } |
| 210 | |
| 211 | int av_timecode_init_from_components(AVTimecode *tc, AVRational rate, int flags, int hh, int mm, int ss, int ff, void *log_ctx) |
| 212 | { |
| 213 | int ret; |
| 214 | int64_t s; |
| 215 | |
| 216 | memset(tc, 0, sizeof(*tc)); |
| 217 | tc->flags = flags; |
| 218 | tc->rate = rate; |
| 219 | tc->fps = fps_from_frame_rate(rate); |
| 220 | |
| 221 | ret = check_timecode(log_ctx, tc); |
| 222 | if (ret < 0) |
| 223 | return ret; |
| 224 | |
| 225 | s = hh*3600LL + mm*60LL + ss; |
| 226 | if (s != (int32_t)s) |
| 227 | return AVERROR(EINVAL); |
| 228 | |
| 229 | s = s * tc->fps + ff; |
| 230 | if (s != (int32_t)s) |
| 231 | return AVERROR(EINVAL); |
| 232 | tc->start = s; |
| 233 | |
| 234 | if (tc->flags & AV_TIMECODE_FLAG_DROPFRAME) { /* adjust frame number */ |
| 235 | int tmins = 60*hh + mm; |
| 236 | tc->start -= (tc->fps / 30 * 2) * (tmins - tmins/10); |
| 237 | } |
| 238 | return 0; |
| 239 | } |
| 240 | |
| 241 | int av_timecode_init_from_string(AVTimecode *tc, AVRational rate, const char *str, void *log_ctx) |
| 242 | { |
no test coverage detected