diff --git a/mythtv/libs/libavcodec/pcm.c b/mythtv/libs/libavcodec/pcm.c
index b16f663..572ee94 100644
--- a/mythtv/libs/libavcodec/pcm.c
+++ b/mythtv/libs/libavcodec/pcm.c
@@ -373,7 +373,7 @@ static int pcm_decode_frame(AVCodecContext *avctx,
 
     n = buf_size/sample_size;
 
-    switch(avctx->codec_id) {
+    switch(avctx->codec->id) {
     case CODEC_ID_PCM_U32LE:
         DECODE(uint32_t, le32, src, samples, n, 0, 0x80000000)
         break;
diff --git a/mythtv/libs/libavformat/mpeg.c b/mythtv/libs/libavformat/mpeg.c
index 436480a..e9ecc9f 100644
--- a/mythtv/libs/libavformat/mpeg.c
+++ b/mythtv/libs/libavformat/mpeg.c
@@ -560,8 +560,18 @@ static int mpegps_read_packet(AVFormatContext *s,
         st->codec->bit_rate = st->codec->channels *
                               st->codec->sample_rate *
                               st->codec->bits_per_coded_sample;
-        if (st->codec->bits_per_coded_sample == 16)
+        if (st->codec->bits_per_coded_sample == 16) {
             st->codec->codec_id = CODEC_ID_PCM_S16BE;
+            st->codec->sample_fmt = SAMPLE_FMT_S16;
+            if (st->codec->codec) {
+                AVCodec *pcm_s16be_codec;
+                avcodec_close(st->codec);
+                pcm_s16be_codec = avcodec_find_decoder(CODEC_ID_PCM_S16BE);
+                if (pcm_s16be_codec) {
+                    st->codec->codec = pcm_s16be_codec;
+                }
+            } 
+        }
         else if (st->codec->bits_per_coded_sample == 28)
             return AVERROR(EINVAL);
     }
