Message ID | 20230514213741.34312-1-toots@rastageeks.org |
---|---|
State | New |
Headers | show |
Series | [FFmpeg-devel,v3,1/2] libavformat/oggparseflac: Decode metadata packets. Fixes: #10364 | expand |
Context | Check | Description |
---|---|---|
yinshiyou/make_loongarch64 | success | Make finished |
yinshiyou/make_fate_loongarch64 | success | Make fate finished |
andriy/make_x86 | success | Make finished |
andriy/make_fate_x86 | success | Make fate finished |
Le dim. 14 mai 2023 à 16:40, <toots@rastageeks.org> a écrit : > > From: Romain Beauxis <toots@rastageeks.org> > > This is the third version on a series of patches improving ffmpeg support for > ogg chained streams. > > Reproduction steps for the issue fixed with patch are included in this bug > report: https://trac.ffmpeg.org/ticket/10363 Sorry correct link is: https://trac.ffmpeg.org/ticket/10364 > > --- > libavformat/oggparseflac.c | 20 ++++++++++++++++++++ > 1 file changed, 20 insertions(+) > > diff --git a/libavformat/oggparseflac.c b/libavformat/oggparseflac.c > index eef6e09927..1dd292483d 100644 > --- a/libavformat/oggparseflac.c > +++ b/libavformat/oggparseflac.c > @@ -126,10 +126,30 @@ fail: > return ret; > } > > +static int flac_packet(AVFormatContext *s, int idx) > +{ > + struct ogg *ogg = s->priv_data; > + struct ogg_stream *os = ogg->streams + idx; > + int ret; > + > + if (os->psize > 4 && (*(os->buf + os->pstart) & 0x7F) == FLAC_METADATA_TYPE_VORBIS_COMMENT) { > + AVStream *st = s->streams[idx]; > + av_dict_free(&st->metadata); > + ret = ff_vorbis_stream_comment(s, st, os->buf + os->pstart + 4, > + os->psize - 4); > + > + if (ret < 0) return ret; > + } > + > + return 0; > +} > + > + > const struct ogg_codec ff_flac_codec = { > .magic = "\177FLAC", > .magicsize = 5, > .header = flac_header, > + .packet = flac_packet, > .nb_header = 2, > }; > > -- > 2.37.1 (Apple Git-137.1) >
diff --git a/libavformat/oggparseflac.c b/libavformat/oggparseflac.c index eef6e09927..1dd292483d 100644 --- a/libavformat/oggparseflac.c +++ b/libavformat/oggparseflac.c @@ -126,10 +126,30 @@ fail: return ret; } +static int flac_packet(AVFormatContext *s, int idx) +{ + struct ogg *ogg = s->priv_data; + struct ogg_stream *os = ogg->streams + idx; + int ret; + + if (os->psize > 4 && (*(os->buf + os->pstart) & 0x7F) == FLAC_METADATA_TYPE_VORBIS_COMMENT) { + AVStream *st = s->streams[idx]; + av_dict_free(&st->metadata); + ret = ff_vorbis_stream_comment(s, st, os->buf + os->pstart + 4, + os->psize - 4); + + if (ret < 0) return ret; + } + + return 0; +} + + const struct ogg_codec ff_flac_codec = { .magic = "\177FLAC", .magicsize = 5, .header = flac_header, + .packet = flac_packet, .nb_header = 2, };
From: Romain Beauxis <toots@rastageeks.org> This is the third version on a series of patches improving ffmpeg support for ogg chained streams. Reproduction steps for the issue fixed with patch are included in this bug report: https://trac.ffmpeg.org/ticket/10363 --- libavformat/oggparseflac.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)