summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-03-07 15:00:08 +0100
committerwm4 <wm4@nowhere>2016-03-07 15:00:08 +0100
commitc53c6bbd387ca582091a8bfca33140d65c200be0 (patch)
tree23fe97bdb4d08857145859168dff5fcff833f95c
parent11d0290543bcaddd09fdf4793d5a5b002d2b4178 (diff)
downloadmpv-c53c6bbd387ca582091a8bfca33140d65c200be0.tar.bz2
mpv-c53c6bbd387ca582091a8bfca33140d65c200be0.tar.xz
video: fix coverart decoding
Deselecting cover art and then reselecting it did not work. The second time the cover art picture is not displayed again. (This seems to break every other month...) The reason is commit 6640b22a. It mutates the input packet. And it is correct that we don't own d_video->header->attached_picture at this point. Fix it by creating a new packet reference.
-rw-r--r--video/decode/dec_video.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/video/decode/dec_video.c b/video/decode/dec_video.c
index e8a57749ab..fc0b090962 100644
--- a/video/decode/dec_video.c
+++ b/video/decode/dec_video.c
@@ -363,9 +363,10 @@ void video_work(struct dec_video *d_video)
return;
if (d_video->header->attached_picture) {
+ struct demux_packet *packet =
+ demux_copy_packet(d_video->header->attached_picture);
if (d_video->current_state == DATA_AGAIN && !d_video->cover_art_mpi) {
- d_video->cover_art_mpi =
- decode_packet(d_video, d_video->header->attached_picture, 0);
+ d_video->cover_art_mpi = decode_packet(d_video, packet, 0);
// Might need flush.
if (!d_video->cover_art_mpi)
d_video->cover_art_mpi = decode_packet(d_video, NULL, 0);
@@ -375,6 +376,7 @@ void video_work(struct dec_video *d_video)
d_video->current_mpi = mp_image_new_ref(d_video->cover_art_mpi);
// (DATA_OK is returned the first time, when current_mpi is sill set)
d_video->current_state = DATA_EOF;
+ talloc_free(packet);
return;
}