static void __fill_rotate_in_context(AVStream *st, MMFileFormatContext *formatContext)
{
- uint8_t *matrix = NULL;
+ int i;
double rotate = 0.0;
+ bool found = false;
- matrix = av_stream_get_side_data(st, AV_PKT_DATA_DISPLAYMATRIX, NULL);
- if (!matrix) {
- debug_log(DEBUG, "matrix is empty");
- return;
+ for (i = 0; i < st->codecpar->nb_coded_side_data; i++) {
+ const AVPacketSideData *sd = &st->codecpar->coded_side_data[i];
+ if (sd->type == AV_PKT_DATA_DISPLAYMATRIX) {
+ found = true;
+ rotate = av_display_rotation_get((const int32_t *)sd->data);
+ break;
+ }
}
- // from ffmpeg's code
- rotate = av_display_rotation_get((int32_t *)matrix);
+ if (!found)
+ return;
+
rotate = -rotate;
if (rotate < 0) // for backward compatibility
rotate += 360;
/* debug_msg(RELEASE, " SMALL_LAST_FRAME: %d", pVideoCodec->capabilities & CODEC_CAP_SMALL_LAST_FRAME ? 1 : 0); */
/* debug_msg(RELEASE, " HWACCEL_VDPAU : %d", pVideoCodec->capabilities & CODEC_CAP_HWACCEL_VDPAU ? 1 : 0); */
- if (pVideoCodec->capabilities & AV_CODEC_CAP_TRUNCATED)
- pVideoCodecCtx->flags |= AV_CODEC_FLAG_TRUNCATED;
-
/*set workaround bug flag*/
pVideoCodecCtx->workaround_bugs = FF_BUG_AUTODETECT;
goto NEXT;
}
- if (!frame->key_frame) {
+ if (!(frame->flags & AV_FRAME_FLAG_KEY)) {
debug_msg(RELEASE, "skip (not key frame).");
#ifdef MMFILE_FORMAT_DEBUG_DUMP
memset(pgm_name, 0x00, sizeof(pgm_name));
first_seek is used when accurate mode and when time stamp's frame is not key frame.
Go back to previousto Key frame and decode frame until time stamp's frame*/
- if (pFrame->key_frame) {
+ if (pFrame->flags & AV_FRAME_FLAG_KEY) {
debug_msg(RELEASE, "find Video Stream+++++++Find key frame");
} else {
debug_msg(RELEASE, "find Video Stream+++++++ not key frame");