| 171 | |
| 172 | |
| 173 | bool AVDecoder::seekVideo(int percentage) |
| 174 | { |
| 175 | if(!loadCodec(CODEC_VIDEO)) { |
| 176 | return false; |
| 177 | } |
| 178 | |
| 179 | qint64 seek_pos = pFormatCtx->duration * percentage / (AV_TIME_BASE * 100); |
| 180 | qint64 frame = av_rescale(seek_pos, av_stream->time_base.den, av_stream->time_base.num); |
| 181 | |
| 182 | return avformat_seek_file(pFormatCtx, stream_index, 0, frame, frame, AVSEEK_FLAG_FRAME) >= 0; |
| 183 | } |
| 184 | |
| 185 | static void calculate_thumbnail_dimensions(int src_width, int src_height, |
| 186 | int src_sar_num, int src_sar_den, |