diff options
author | wm4 <wm4@nowhere> | 2017-01-10 14:03:41 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2017-01-10 15:43:02 +0100 |
commit | 4e25feda0d5e084761a9935de7c1e592e86de94f (patch) | |
tree | cacddbd4921351f06810e6182d2c55b3e0545e2c /video | |
parent | 334cad57c63d31a346b1457ae92dbb0b64938016 (diff) | |
download | mpv-4e25feda0d5e084761a9935de7c1e592e86de94f.tar.bz2 mpv-4e25feda0d5e084761a9935de7c1e592e86de94f.tar.xz |
player: change aspects of cover art handling
Cover art handling is a disgusting hack that causes a mess in all
components. And this will stay this way. This is the Xth time I've
changed cover art handling, and that will probably also continue.
But change the code such that cover art is injected into the demux
packet stream, instead of having an explicit special case it in the
decoder glue code. (This is somewhat more similar to the cover art hack
in libavformat.)
To avoid that the over art picture is decoded again on each seek, we
need some additional "caching" in player/video.c. Decoding it after each
seek would work as well, but since cover art pictures can be pretty
huge, it's probably ok to invest some lines of code into caching it.
One weird thing is that the cover art packet will remain queued after
seeks, but that is probably not an issue.
In exchange, we can drop the dec_video.c code, which is pretty
convenient for one of the following commits. This code duplicates a
bunch of lower-level decode calls and does icky messing with this weird
state stuff, so I'm glad it goes away.
Diffstat (limited to 'video')
-rw-r--r-- | video/decode/dec_video.c | 17 | ||||
-rw-r--r-- | video/decode/dec_video.h | 1 |
2 files changed, 0 insertions, 18 deletions
diff --git a/video/decode/dec_video.c b/video/decode/dec_video.c index d9dbf0f326..95ca49250b 100644 --- a/video/decode/dec_video.c +++ b/video/decode/dec_video.c @@ -89,7 +89,6 @@ void video_uninit(struct dec_video *d_video) if (!d_video) return; mp_image_unrefp(&d_video->current_mpi); - mp_image_unrefp(&d_video->cover_art_mpi); if (d_video->vd_driver) { MP_VERBOSE(d_video, "Uninit video.\n"); d_video->vd_driver->uninit(d_video); @@ -382,22 +381,6 @@ void video_work(struct dec_video *d_video) if (d_video->current_mpi) return; - if (d_video->header->attached_picture) { - if (d_video->current_state == DATA_AGAIN && !d_video->cover_art_mpi) { - struct demux_packet *packet = - demux_copy_packet(d_video->header->attached_picture); - 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); - talloc_free(packet); - } - if (d_video->current_state != DATA_EOF) - d_video->current_mpi = mp_image_new_ref(d_video->cover_art_mpi); - d_video->current_state = DATA_EOF; - return; - } - if (!d_video->packet && !d_video->new_segment && demux_read_packet_async(d_video->header, &d_video->packet) == 0) { diff --git a/video/decode/dec_video.h b/video/decode/dec_video.h index 1d2b3f087e..9155a76155 100644 --- a/video/decode/dec_video.h +++ b/video/decode/dec_video.h @@ -75,7 +75,6 @@ struct dec_video { struct demux_packet *new_segment; struct demux_packet *packet; bool framedrop_enabled; - struct mp_image *cover_art_mpi; struct mp_image *current_mpi; int current_state; }; |