mirror of https://github.com/mpv-player/mpv
demux: export video rotation parameter
Now the rotation hint is propagated everywhere. It just isn't used anywhere yet.
This commit is contained in:
parent
3b5a331c40
commit
fd2f40762f
|
@ -478,6 +478,14 @@ static void handle_stream(demuxer_t *demuxer, int i)
|
|||
/ (float)(codec->height * codec->sample_aspect_ratio.den);
|
||||
sh_video->i_bps = codec->bit_rate / 8;
|
||||
|
||||
AVDictionaryEntry *rot = av_dict_get(st->metadata, "rotate", NULL, 0);
|
||||
if (rot && rot->value) {
|
||||
char *end = NULL;
|
||||
long int r = strtol(rot->value, &end, 10);
|
||||
if (end && !end[0])
|
||||
sh_video->rotate = ((r % 360) + 360) % 360;
|
||||
}
|
||||
|
||||
// This also applies to vfw-muxed mkv, but we can't detect these easily.
|
||||
sh_video->avi_dts = matches_avinputformat_name(priv, "avi");
|
||||
|
||||
|
|
|
@ -81,6 +81,7 @@ typedef struct sh_video {
|
|||
float aspect; // aspect ratio stored in the file (for prescaling)
|
||||
int i_bps; // == bitrate (compressed bytes/sec)
|
||||
int disp_w, disp_h; // display size
|
||||
int rotate; // intended display rotation, in degrees, [0, 359]
|
||||
MP_BITMAPINFOHEADER *bih;
|
||||
} sh_video_t;
|
||||
|
||||
|
|
|
@ -444,6 +444,7 @@ static void update_image_params(struct dec_video *vd, AVFrame *frame,
|
|||
.colorlevels = avcol_range_to_mp_csp_levels(ctx->avctx->color_range),
|
||||
.chroma_location =
|
||||
avchroma_location_to_mp(ctx->avctx->chroma_sample_location),
|
||||
.rotate = vd->header->video->rotate,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue