From 727e49c611a2682cca39783a687efcdad22b913e Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Fri, 12 Jul 2019 21:46:31 +0200 Subject: [PATCH] Media Kit: remove MediaExtractor::Source MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The idea was that the Media Extractor could wrap the original source given by BMediaTrack, but all operations on the data go through MediaExtractor anyway. We could probably move ownership of the BDataIO completely into MediaExtractor instead. Change-Id: I846b34b543fb983e60f6adf86cb17e835303267b Reviewed-on: https://review.haiku-os.org/c/1587 Reviewed-by: Stephan Aßmus --- headers/private/media/MediaExtractor.h | 2 -- src/kits/media/MediaExtractor.cpp | 7 ------- src/kits/media/MediaFile.cpp | 5 ++--- 3 files changed, 2 insertions(+), 12 deletions(-) diff --git a/headers/private/media/MediaExtractor.h b/headers/private/media/MediaExtractor.h index eeefca70bb..5f58b02d40 100644 --- a/headers/private/media/MediaExtractor.h +++ b/headers/private/media/MediaExtractor.h @@ -42,8 +42,6 @@ public: status_t InitCheck(); - BDataIO* Source() const; - void GetFileFormatInfo( media_file_format* fileFormat) const; status_t GetMetaData(BMessage* _data) const; diff --git a/src/kits/media/MediaExtractor.cpp b/src/kits/media/MediaExtractor.cpp index 1241e76152..058f6afeb0 100644 --- a/src/kits/media/MediaExtractor.cpp +++ b/src/kits/media/MediaExtractor.cpp @@ -173,13 +173,6 @@ MediaExtractor::InitCheck() } -BDataIO* -MediaExtractor::Source() const -{ - return fSource; -} - - void MediaExtractor::GetFileFormatInfo(media_file_format* fileFormat) const { diff --git a/src/kits/media/MediaFile.cpp b/src/kits/media/MediaFile.cpp index ffde93f9d2..0a6ba56b06 100644 --- a/src/kits/media/MediaFile.cpp +++ b/src/kits/media/MediaFile.cpp @@ -479,9 +479,9 @@ BMediaFile::_UnInit() if (fDeleteSource) { delete fSource; - fSource = NULL; fDeleteSource = false; } + fSource = NULL; // Deleting the extractor or writer can cause unloading of the plugins. // The source must be deleted before that, because it can come from a @@ -523,8 +523,7 @@ BMediaFile::_InitReader(BDataIO* source, const BUrl* url, int32 flags) if (fErr != B_OK) return; - // Get the actual source from the extractor - fSource = fExtractor->Source(); + fSource = source; fExtractor->GetFileFormatInfo(&fMFI); fTrackNum = fExtractor->StreamCount();