| 207 | } |
| 208 | |
| 209 | QByteArray AVDecoder::getThumbnail(int &width, int &height) |
| 210 | { |
| 211 | QByteArray data; |
| 212 | |
| 213 | if(!loadCodec(CODEC_VIDEO)) { |
| 214 | return data; |
| 215 | } |
| 216 | |
| 217 | AVFrame *pFrame = getDecodedFrame(pCodecCtx, stream_index); |
| 218 | |
| 219 | if(pFrame != NULL) { |
| 220 | |
| 221 | calculate_thumbnail_dimensions(pCodecCtx->width, pCodecCtx->height, |
| 222 | pCodecCtx->sample_aspect_ratio.num, |
| 223 | pCodecCtx->sample_aspect_ratio.den, |
| 224 | width, height); |
| 225 | |
| 226 | data = WriteJPEG(pCodecCtx, pFrame, width, height); |
| 227 | av_frame_free(&pFrame); |
| 228 | } |
| 229 | |
| 230 | return data; |
| 231 | } |
| 232 | |
| 233 | QByteArray AVDecoder::WriteJPEG(AVCodecContext *pCodecCtx, AVFrame *pFrame, int width, int height) |
| 234 | { |
no test coverage detected