Ignore IPv6 settings value if it’s invalid

This would otherwise cause the backend to always believe the requested host was local

Fixes #12172

(cherry picked from commit de991d98754bd50045d65080592828631786e161)
Don’t attempt to play the video streams for mp3, flac, off and m4a container.

FFmpeg incorrectly detects the artwork in those file as MJPEG, which myth would then attempt to play.
A nicer fix would be to display that image instead.

Fixes #11597

(cherry picked from commit 9df8bb364ba56cc34d34af40e5980110193bd334)
Properly allocate VDPAU PiP video buffers and fix memory leak

The video buffers were never freed

(cherry picked from commit 548aaf78373cf0360b759b633df10c3690e3f06b)
Fix memory leak

Coverity CID 1224482

(cherry picked from commit e16a9b0072c068a42759a78b4633d656b3627453)
Audio: Abort Drain if audio device is in pause

Prevent deadlock in MythMusic

(cherry picked from commit d6663a5498f1ba1147a801dd4902b779b3afd1f8)
Sync minilzo from 2.03 to 2.07.

This commit is UNTESTED. I don't have any framegrabbers. However
there's no reason it shouldn't work as it's just a minor version bump.

Refs LMS-2014-06-16-1, CVE-2014-4607

(cherry picked from commit b99f21b2791c4685fb48460a165a7cd804256f03)
Signed-off-by: Stuart Morgan <smorgan@mythtv.org>
Player: Don't call DoneDisplayingFrame for PiP until next frame is ready

When displaying 'pictute in picture' (PiP), VideoOutput::ShowPIP
composites the PiP windows onto the main video frame.  To do so, it uses
the player's GetCurrentFrame method to obtain the most recently displayed
PiP frame.  However, MythPlayer::DisplayNormalFrames immediately releases
the last frame displayed back to the decoding queue.  Consequently when
GetCurrentFrame calls GetLastShownFrame to obtain that frame it may have been
overwritten by the decoder thread.

This patch defers calling DoneDisplayingFrame if the player is a PiP
player so that future calls to GetLastShownFrame return an intact frame.

Fixes #10878

Signed-off-by: Lawrence Rust <lvr@softsystem.co.uk>
Signed-off-by: Jean-Yves Avenard <jyavenard@mythtv.org>
(cherry picked from commit 49df62f1a76f0e617208e261a09f5f8a634b3ce9)

Conflicts:
	mythtv/libs/libmythtv/mythplayer.cpp
Fix 0b9470c Fix fileringbuffer locking...

Commit 0b9470c (Fix fileringbuffer locking up on read()) modified
FileRingBuffer::safe_read to use fstat() to check the file size
before reading.  The new code compares (internalreadpos + tot)
with the reported size.  This is mostly correct except when
MythPlayer::SwitchProgram detects the transition across a livetv
programme boundary.  In this case internalreadpos holds the read
position for the old file until the decoder calls FileChanged().

This patch includes readAdjust (set by SetAdjustFilesize()) to
correctly determine the current read position in the file.

Signed-off-by: Lawrence Rust <lvr@softsystem.co.uk>
Signed-off-by: Jean-Yves Avenard <jyavenard@mythtv.org>
(cherry picked from commit 363361a9e26322d9e6a87e17effc50add8653533)
avformat/avidec: allow rounding errors between scale/rate and timebase

Fixes Ticket3670

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 571ab8344a9a2864d22d01af41283cee9328b927)

Conflicts:
	libavformat/avidec.c
Signed-off-by: Jean-Yves Avenard <jyavenard@mythtv.org>
avcodec/utvideodec: Increase vlc len

Fixes a regression since fb3e380 similar to ticket #2661,
reported by fluffrabbit at aol dot com.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 673716c54b39eba9579a38ad222130e3f9549167)

Conflicts:
	libavcodec/utvideodec.c
Signed-off-by: Jean-Yves Avenard <jyavenard@mythtv.org>
adpcm: Fix trellis encoding of IMA QT

This was broken in 095be4fb - samples+ch (for the previous
non-planar case) equals &samples_p[ch][0]. The confusion
probably stemmed from the IMA WAV case where it originally
was &samples[avctx->channels + ch], which was correctly
changed into &samples_p[ch][1].

Fixes part of Ticket3701

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit a32765c4252eb106a2ade543026ef6f59e699bfa)
Signed-off-by: Jean-Yves Avenard <jyavenard@mythtv.org>
adpcm: Write the proper predictor in trellis mode in IMA QT

The actual predictor value, set by the trellis code, never
was written back into the variable that was written into
the block header. This was accidentally removed in b304244b.

This significantly improves the audio quality of the trellis
case, which was plain broken since b304244b.

Encoding IMA QT with trellis still actually gives a slightly
worse quality than without trellis, since the trellis encoder
doesn't use the exact same way of rounding as in
adpcm_ima_qt_compress_sample and adpcm_ima_qt_expand_nibble.

Fixes part of Ticket3701

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit fa8f060b75bf9074792a0f9ff4ed002652ef62b8)

Conflicts:
	tests/ref/acodec/adpcm-ima_qt-trellis
Signed-off-by: Jean-Yves Avenard <jyavenard@mythtv.org>
Revert two backports to release/1.2 that broke fate.

Revert "ff_id3v2_read: add option to limit ID3 magic number search"
Revert "ff_id3v2_free_extra_meta: set the pointer pointing to extra_meta to NULL"

This reverts commit 7f8aa37bc3666d060b3eb2baa02fcea3597a22fd.
This reverts commit 5219e20d58e15305e188ba60a75bfc37a1f82341.

Signed-off-by: Jean-Yves Avenard <jyavenard@mythtv.org>
Show duration for large asf files as written in the file header.

Fixes ticket #3428.
(cherry picked from commit e3fd263f0b73e4425192d6dd1ab18027ecaa35db)

Signed-off-by: Jean-Yves Avenard <jyavenard@mythtv.org>
swscale/swscale: fix integer overflow

Should fix fate failure with clang ftrapv

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit c9c0451224fd7bc38b4e135e99f114f80c1ae67f)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Jean-Yves Avenard <jyavenard@mythtv.org>
avcodec/x86/mpegvideoenc_template: fix integer overflow

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Jean-Yves Avenard <jyavenard@mythtv.org>
avcodec/h264_mp4toannexb_bsf: prepend global headers before any in stream parameter sets

Fixes h264_mp4toannexb_bsf_failure.mkv

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 289b149cecb381522cc9ccdf382825330169c655)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Jean-Yves Avenard <jyavenard@mythtv.org>
avcodec/libx264: move where x264opts is applied down so it isnt overridden by avctx & defaults

fixes x264opts opengop=1

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 64b79141bdfdffaa9fda69eecce140473d0a9a18)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Jean-Yves Avenard <jyavenard@mythtv.org>
lavu/opt: validate range before dereference

This change make error handling simplier.
av_opt_freep_ranges may be called when some ranges are NULL,
for example after memory allocation fail.

Signed-off-by: Lukasz Marek <lukasz.m.luki@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 3aac5fcfa9d3748659d78ab2a66d0ccce22cfd4f)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Jean-Yves Avenard <jyavenard@mythtv.org>
avcodec/wma: use av_freep(), do not leave stale pointers in memory

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit d167faafe9dfa0b82bebb267c3c4e5fa5286bd67)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Jean-Yves Avenard <jyavenard@mythtv.org>