From f6bed9d65c097ab2be742d03c4f624a72cdc7fe9 Mon Sep 17 00:00:00 2001
From: Richard <peper03@yahoo.com>
Date: Wed, 5 Dec 2012 19:40:04 +0100
Subject: [PATCH] kDecodeAudio is now re-enabled if an audio stream becomes
available
---
mythtv/libs/libmythtv/avformatdecoder.cpp | 32 +++++++++++++++++++++--------
1 file changed, 23 insertions(+), 9 deletions(-)
diff --git a/mythtv/libs/libmythtv/avformatdecoder.cpp b/mythtv/libs/libmythtv/avformatdecoder.cpp
index 8b2d351..7a3996f 100644
a
|
b
|
bool AvFormatDecoder::GetFrame(DecodeType decodetype) |
4445 | 4445 | AVPacket *pkt = NULL; |
4446 | 4446 | bool have_err = false; |
4447 | 4447 | |
| 4448 | const DecodeType origDecodetype = decodetype; |
| 4449 | |
4448 | 4450 | gotVideoFrame = false; |
4449 | 4451 | |
4450 | 4452 | frame_decoded = 0; |
… |
… |
bool AvFormatDecoder::GetFrame(DecodeType decodetype) |
4488 | 4490 | |
4489 | 4491 | while (!allowedquit) |
4490 | 4492 | { |
4491 | | if ((decodetype & kDecodeAudio) && |
4492 | | ((currentTrack[kTrackTypeAudio] < 0) || |
4493 | | (selectedTrack[kTrackTypeAudio].av_stream_index < 0))) |
| 4493 | if (decodetype & kDecodeAudio) |
4494 | 4494 | { |
4495 | | // disable audio request if there are no audio streams anymore |
4496 | | // and we have video, otherwise allow decoding to stop |
4497 | | if (hasVideo) |
4498 | | decodetype = (DecodeType)((int)decodetype & ~kDecodeAudio); |
4499 | | else |
4500 | | allowedquit = true; |
| 4495 | if (((currentTrack[kTrackTypeAudio] < 0) || |
| 4496 | (selectedTrack[kTrackTypeAudio].av_stream_index < 0))) |
| 4497 | { |
| 4498 | // disable audio request if there are no audio streams anymore |
| 4499 | // and we have video, otherwise allow decoding to stop |
| 4500 | if (hasVideo) |
| 4501 | decodetype = (DecodeType)((int)decodetype & ~kDecodeAudio); |
| 4502 | else |
| 4503 | allowedquit = true; |
| 4504 | } |
| 4505 | } |
| 4506 | else |
| 4507 | if ((origDecodetype & kDecodeAudio) && |
| 4508 | (currentTrack[kTrackTypeAudio] >= 0) && |
| 4509 | (selectedTrack[kTrackTypeAudio].av_stream_index >= 0)) |
| 4510 | { |
| 4511 | // Turn on audio decoding again if it was on originally |
| 4512 | // and an audio stream has now appeared. This can happen |
| 4513 | // in still DVD menus with audio |
| 4514 | decodetype = (DecodeType)((int)decodetype | kDecodeAudio); |
4501 | 4515 | } |
4502 | 4516 | |
4503 | 4517 | StreamChangeCheck(); |