Skip to content
Permalink
Browse files

VideoPlayer: fix aspect ratio for matroska containers for stereo modes

  • Loading branch information...
FernetMenta authored and popcornmix committed Oct 19, 2016
1 parent 70afe1c commit 762a727cfc6669796573312a5f06020717ddfc15
Showing with 11 additions and 9 deletions.
  1. +11 −9 xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
@@ -1250,19 +1250,21 @@ int CDVDDemuxFFmpeg::GetNrOfStreams() const

double CDVDDemuxFFmpeg::SelectAspect(AVStream* st, bool& forced)
{
// for stereo modes, use codec aspect ratio
AVDictionaryEntry *entry = av_dict_get(st->metadata, "stereo_mode", NULL, 0);
if (entry)
{
forced = false;
return av_q2d(st->codecpar->sample_aspect_ratio);
}

// trust matroshka container
if (m_bMatroska && st->sample_aspect_ratio.num != 0)
{
forced = true;
return av_q2d(st->sample_aspect_ratio);
double dar = av_q2d(st->sample_aspect_ratio);
// for stereo modes, use codec aspect ratio
AVDictionaryEntry *entry = av_dict_get(st->metadata, "stereo_mode", NULL, 0);
if (entry)
{
if (strcmp(entry->value, "left_right") == 0 || strcmp(entry->value, "right_left") == 0)
dar /= 2;
else if (strcmp(entry->value, "top_bottom") == 0 || strcmp(entry->value, "bottom_top") == 0)
dar *= 2;
}
return dar;
}

forced = false;

0 comments on commit 762a727

Please sign in to comment.
You can’t perform that action at this time.