Skip to content

Commit

Permalink
AvFormatDecoder: Reset the video codec on stream changes.
Browse files Browse the repository at this point in the history
I've been staring blankly at this trying to figure out why it hasn't
caused problems before - only to realise that live tv changes always
force a full teardown of the decoder and the codec never changes for dvd
playback.

Should, and appears to, fix a number of blu ray playback issues when the
bd library switches to a title with a different codec.
  • Loading branch information
Mark Kendall committed Jun 29, 2011
1 parent 073bad3 commit 9591fe9
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions mythtv/libs/libmythtv/avformatdecoder.cpp
Expand Up @@ -1793,8 +1793,12 @@ int AvFormatDecoder::ScanStreams(bool novideo)
}
}

bool handled = false;
if (!using_null_videoout && mpeg_version(enc->codec_id))
video_codec_id = kCodec_NONE;
int version = mpeg_version(enc->codec_id);
if (version)
video_codec_id = (MythCodecID)(kCodec_MPEG1 + version - 1);

if (!using_null_videoout && version)
{
#if defined(USING_VDPAU)
// HACK -- begin
Expand All @@ -1816,7 +1820,6 @@ int AvFormatDecoder::ScanStreams(bool novideo)
{
enc->codec_id = (CodecID) myth2av_codecid(vdpau_mcid);
video_codec_id = vdpau_mcid;
handled = true;
}
#endif // USING_VDPAU
#ifdef USING_VAAPI
Expand All @@ -1830,7 +1833,6 @@ int AvFormatDecoder::ScanStreams(bool novideo)
{
enc->codec_id = (CodecID)myth2av_codecid(vaapi_mcid);
video_codec_id = vaapi_mcid;
handled = true;
if (!no_hardware_decoders &&
codec_is_vaapi(video_codec_id))
{
Expand All @@ -1849,7 +1851,6 @@ int AvFormatDecoder::ScanStreams(bool novideo)
{
enc->codec_id = (CodecID)myth2av_codecid(dxva2_mcid);
video_codec_id = dxva2_mcid;
handled = true;
if (!no_hardware_decoders &&
codec_is_dxva2(video_codec_id))
{
Expand All @@ -1859,12 +1860,12 @@ int AvFormatDecoder::ScanStreams(bool novideo)
#endif // USING_DXVA2
}

if (!handled)
// default to mpeg2
if (video_codec_id == kCodec_NONE)
{
if (CODEC_IS_H264(enc->codec_id))
video_codec_id = kCodec_H264;
else
video_codec_id = kCodec_MPEG2; // default to MPEG2
VERBOSE(VB_IMPORTANT, LOC +
"Unknown video codec - defaulting to MPEG2");
video_codec_id = kCodec_MPEG2;
}

if (enc->codec)
Expand Down

0 comments on commit 9591fe9

Please sign in to comment.