| 2374 | } |
| 2375 | |
| 2376 | static int attach_displaymatrix(AVCodecContext *avctx, AVFrame *frame, int orientation) |
| 2377 | { |
| 2378 | AVFrameSideData *sd = NULL; |
| 2379 | int32_t *matrix; |
| 2380 | int ret; |
| 2381 | /* invalid orientation */ |
| 2382 | if (orientation < 1 || orientation > 8) |
| 2383 | return AVERROR_INVALIDDATA; |
| 2384 | ret = ff_frame_new_side_data(avctx, frame, AV_FRAME_DATA_DISPLAYMATRIX, sizeof(int32_t) * 9, &sd); |
| 2385 | if (ret < 0) { |
| 2386 | av_log(avctx, AV_LOG_ERROR, "Could not allocate frame side data: %s\n", av_err2str(ret)); |
| 2387 | return ret; |
| 2388 | } |
| 2389 | if (sd) { |
| 2390 | matrix = (int32_t *) sd->data; |
| 2391 | ret = av_exif_orientation_to_matrix(matrix, orientation); |
| 2392 | } |
| 2393 | |
| 2394 | return ret; |
| 2395 | } |
| 2396 | |
| 2397 | static int exif_attach_ifd(AVCodecContext *avctx, AVFrame *frame, const AVExifMetadata *ifd, AVBufferRef **pbuf) |
| 2398 | { |
no test coverage detected