mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
lavf/id3v2enc: fix cover art display on some software
Adding an arbitrary amount of padding bytes at the end of the ID3 metadata fixes cover art display for some software (iTunes, Traktor, Serato, Torq). For reference (ID3 metadata): [ Apic frames ] -> cover doesn't show up [ Apic frames, Padding ] -> ok [ Apic frames, ID3 frames ] -> ok [ ID3 frames, Apic frames ] -> cover doesn't show up [ ID3 frames, Apic frames, Padding ] -> ok
This commit is contained in:
parent
c4e0e31424
commit
f468325d34
@ -26,8 +26,11 @@
|
|||||||
#include "libavutil/intreadwrite.h"
|
#include "libavutil/intreadwrite.h"
|
||||||
#include "avformat.h"
|
#include "avformat.h"
|
||||||
#include "avio.h"
|
#include "avio.h"
|
||||||
|
#include "avio_internal.h"
|
||||||
#include "id3v2.h"
|
#include "id3v2.h"
|
||||||
|
|
||||||
|
#define PADDING_BYTES 10
|
||||||
|
|
||||||
static void id3v2_put_size(AVIOContext *pb, int size)
|
static void id3v2_put_size(AVIOContext *pb, int size)
|
||||||
{
|
{
|
||||||
avio_w8(pb, size >> 21 & 0x7f);
|
avio_w8(pb, size >> 21 & 0x7f);
|
||||||
@ -319,7 +322,15 @@ int ff_id3v2_write_apic(AVFormatContext *s, ID3v2EncContext *id3, AVPacket *pkt)
|
|||||||
|
|
||||||
void ff_id3v2_finish(ID3v2EncContext *id3, AVIOContext *pb)
|
void ff_id3v2_finish(ID3v2EncContext *id3, AVIOContext *pb)
|
||||||
{
|
{
|
||||||
int64_t cur_pos = avio_tell(pb);
|
int64_t cur_pos;
|
||||||
|
|
||||||
|
/* adding an arbitrary amount of padding bytes at the end of the
|
||||||
|
* ID3 metadata fixes cover art display for some software (iTunes,
|
||||||
|
* Traktor, Serato, Torq) */
|
||||||
|
ffio_fill(pb, 0, PADDING_BYTES);
|
||||||
|
id3->len += PADDING_BYTES;
|
||||||
|
|
||||||
|
cur_pos = avio_tell(pb);
|
||||||
avio_seek(pb, id3->size_pos, SEEK_SET);
|
avio_seek(pb, id3->size_pos, SEEK_SET);
|
||||||
id3v2_put_size(pb, id3->len);
|
id3v2_put_size(pb, id3->len);
|
||||||
avio_seek(pb, cur_pos, SEEK_SET);
|
avio_seek(pb, cur_pos, SEEK_SET);
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
#define LIBAVFORMAT_VERSION_MAJOR 55
|
#define LIBAVFORMAT_VERSION_MAJOR 55
|
||||||
#define LIBAVFORMAT_VERSION_MINOR 8
|
#define LIBAVFORMAT_VERSION_MINOR 8
|
||||||
#define LIBAVFORMAT_VERSION_MICRO 101
|
#define LIBAVFORMAT_VERSION_MICRO 102
|
||||||
|
|
||||||
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
|
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
|
||||||
LIBAVFORMAT_VERSION_MINOR, \
|
LIBAVFORMAT_VERSION_MINOR, \
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
7fcf80c2059b5c058a6cdd2e2f798b6c *./tests/data/lavf-fate/lavf.mp3
|
6bdea919dc6856d76ef2553698e2b0d3 *./tests/data/lavf-fate/lavf.mp3
|
||||||
96366 ./tests/data/lavf-fate/lavf.mp3
|
96376 ./tests/data/lavf-fate/lavf.mp3
|
||||||
./tests/data/lavf-fate/lavf.mp3 CRC=0x6c9850fe
|
./tests/data/lavf-fate/lavf.mp3 CRC=0x6c9850fe
|
||||||
|
Loading…
Reference in New Issue
Block a user