[vlc-commits] [Git][videolan/vlc][master] contrib: taglib: Update patch from upstream
Hugo Beauzée-Luyssen (@chouquette)
gitlab at videolan.org
Tue Mar 1 12:43:32 UTC 2022
Hugo Beauzée-Luyssen pushed to branch master at VideoLAN / VLC
Commits:
c5893a22 by Hugo Beauzée-Luyssen at 2022-03-01T09:41:52+00:00
contrib: taglib: Update patch from upstream
This is the version that was merged upstream so it makes sense to use it
to facilitate future rebases
upstream PR: https://github.com/taglib/taglib/pull/1040
- - - - -
1 changed file:
- contrib/src/taglib/0001-FileTypeResolver-Fix-IOStream-usage-with-custom-reso.patch
Changes:
=====================================
contrib/src/taglib/0001-FileTypeResolver-Fix-IOStream-usage-with-custom-reso.patch
=====================================
@@ -1,35 +1,34 @@
-From cb9b013217b2e77066141656029cf92cf854054d Mon Sep 17 00:00:00 2001
+From 62fdfd554aaa68fe765afd873e225d583cd31c29 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Hugo=20Beauz=C3=A9e-Luyssen?= <hugo at beauzee.fr>
Date: Wed, 9 Feb 2022 13:51:42 +0100
Subject: [PATCH] FileTypeResolver: Add a StreamTypeResolver interface
---
- taglib/fileref.cpp | 19 ++++++++++++++++++-
+ taglib/fileref.cpp | 22 ++++++++++++++++++++++
taglib/fileref.h | 10 ++++++++++
taglib/toolkit/taglib.h | 2 ++
- tests/test_fileref.cpp | 4 ++++
- 4 files changed, 34 insertions(+), 1 deletion(-)
+ tests/test_fileref.cpp | 23 +++++++++++++++++++++++
+ 4 files changed, 57 insertions(+)
diff --git a/taglib/fileref.cpp b/taglib/fileref.cpp
-index f91209a0..88e53ed1 100644
+index f91209a0..b71d6571 100644
--- a/taglib/fileref.cpp
+++ b/taglib/fileref.cpp
-@@ -84,6 +84,23 @@ namespace
+@@ -84,6 +84,22 @@ namespace
return 0;
}
+ File *detectByResolvers(IOStream* stream, bool readAudioProperties,
+ AudioProperties::ReadStyle audioPropertiesStyle)
+ {
-+ ResolverList::ConstIterator it = fileTypeResolvers.begin();
-+ for(; it != fileTypeResolvers.end(); ++it) {
-+ const FileRef::StreamTypeResolver* streamResolver =
-+ dynamic_cast<const FileRef::StreamTypeResolver*>(*it);
-+ if (!streamResolver)
-+ continue;
-+ File *file = streamResolver->createFileFromStream(stream, readAudioProperties, audioPropertiesStyle);
-+ if(file)
-+ return file;
++ for(ResolverList::ConstIterator it = fileTypeResolvers.begin();
++ it != fileTypeResolvers.end(); ++it) {
++ if(const FileRef::StreamTypeResolver *streamResolver =
++ dynamic_cast<const FileRef::StreamTypeResolver*>(*it)) {
++ if(File *file = streamResolver->createFileFromStream(
++ stream, readAudioProperties, audioPropertiesStyle))
++ return file;
++ }
+ }
+
+ return 0;
@@ -38,17 +37,21 @@ index f91209a0..88e53ed1 100644
// Detect the file type based on the file extension.
File* detectByExtension(IOStream *stream, bool readAudioProperties,
-@@ -482,7 +499,7 @@ void FileRef::parse(IOStream *stream, bool readAudioProperties,
+@@ -480,6 +496,12 @@ void FileRef::parse(FileName fileName, bool readAudioProperties,
+ void FileRef::parse(IOStream *stream, bool readAudioProperties,
+ AudioProperties::ReadStyle audioPropertiesStyle)
{
- // Try user-defined resolvers.
-
-- d->file = detectByResolvers(stream->name(), readAudioProperties, audioPropertiesStyle);
++ // Try user-defined stream resolvers.
++
+ d->file = detectByResolvers(stream, readAudioProperties, audioPropertiesStyle);
- if(d->file)
- return;
++ if(d->file)
++ return;
++
+ // Try user-defined resolvers.
+ d->file = detectByResolvers(stream->name(), readAudioProperties, audioPropertiesStyle);
diff --git a/taglib/fileref.h b/taglib/fileref.h
-index 76e694e4..37f44a0e 100644
+index 76e694e4..75d14926 100644
--- a/taglib/fileref.h
+++ b/taglib/fileref.h
@@ -108,6 +108,16 @@ namespace TagLib {
@@ -57,12 +60,12 @@ index 76e694e4..37f44a0e 100644
+ class TAGLIB_EXPORT StreamTypeResolver : public FileTypeResolver
+ {
-+ TAGLIB_IGNORE_MISSING_DESTRUCTOR
-+ public:
-+ virtual File *createFileFromStream(IOStream* stream,
-+ bool readAudioProperties = true,
-+ AudioProperties::ReadStyle
-+ audioPropertiesStyle = AudioProperties::Average) const = 0;
++ TAGLIB_IGNORE_MISSING_DESTRUCTOR
++ public:
++ virtual File *createFileFromStream(IOStream *stream,
++ bool readAudioProperties = true,
++ AudioProperties::ReadStyle
++ audioPropertiesStyle = AudioProperties::Average) const = 0;
+ };
+
/*!
@@ -82,20 +85,46 @@ index ffce61f7..2bb56994 100644
//! A namespace for all TagLib related classes and functions
diff --git a/tests/test_fileref.cpp b/tests/test_fileref.cpp
-index 1fc5def9..c8136129 100644
+index 1fc5def9..b2631827 100644
--- a/tests/test_fileref.cpp
+++ b/tests/test_fileref.cpp
-@@ -59,6 +59,10 @@ namespace
- {
+@@ -60,6 +60,20 @@ namespace
return new Ogg::Vorbis::File(fileName);
}
-+ virtual File *createFile(IOStream* s, bool, AudioProperties::ReadStyle) const
+ };
++
++ class DummyStreamResolver : public FileRef::StreamTypeResolver
++ {
++ public:
++ virtual File *createFile(FileName, bool, AudioProperties::ReadStyle) const
+ {
-+ return new Ogg::Vorbis::File(s);
++ return 0;
+ }
- };
++
++ virtual File *createFileFromStream(IOStream *s, bool, AudioProperties::ReadStyle) const
++ {
++ return new MP4::File(s);
++ }
++ };
}
+ class TestFileRef : public CppUnit::TestFixture
+@@ -387,6 +401,15 @@ public:
+ FileRef f(TEST_FILE_PATH_C("xing.mp3"));
+ CPPUNIT_ASSERT(dynamic_cast<Ogg::Vorbis::File *>(f.file()) != NULL);
+ }
++
++ DummyStreamResolver streamResolver;
++ FileRef::addFileTypeResolver(&streamResolver);
++
++ {
++ FileStream s(TEST_FILE_PATH_C("xing.mp3"));
++ FileRef f(&s);
++ CPPUNIT_ASSERT(dynamic_cast<MP4::File *>(f.file()) != NULL);
++ }
+ }
+
+ };
--
2.34.1
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/c5893a223668fd9d0085c03998ceb9055a7ccede
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/c5893a223668fd9d0085c03998ceb9055a7ccede
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list