From 0e32d4e3a46c1154b9eaeb2cf0e3787dc76b8436 Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Sat, 25 Mar 2006 16:03:42 +0000 Subject: [PATCH] Patch for avoiding incorrect aspect switches --- demuxer.cc | 12 ++++++++++-- demuxer.h | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/demuxer.cc b/demuxer.cc index 1f553ae..be11edb 100644 --- a/demuxer.cc +++ b/demuxer.cc @@ -30,6 +30,7 @@ Demuxer::Demuxer() instance = this; initted = 0; callback = NULL; + arcnt = 0; } Demuxer::~Demuxer() @@ -113,9 +114,16 @@ void Demuxer::setAspectRatio(enum AspectRatio ar) { if (aspect_ratio != ar) { - aspect_ratio = ar; - callback->call(this); + Log::getInstance()->log("Demux", Log::DEBUG, "Aspect ratio difference signalled"); + if (++arcnt > 3) // avoid changing aspect ratio if glitch in signal + { + arcnt = 0; + aspect_ratio = ar; + callback->call(this); + } } + else + arcnt = 0; } int Demuxer::writeAudio(int fd) diff --git a/demuxer.h b/demuxer.h index 29930b5..f8e6e61 100644 --- a/demuxer.h +++ b/demuxer.h @@ -156,6 +156,7 @@ class Demuxer int horizontal_size; int vertical_size; enum AspectRatio aspect_ratio; + int arcnt; int frame_rate; int bit_rate; ULLONG video_pts; -- 2.39.5