-
Notifications
You must be signed in to change notification settings - Fork 10
feat: play audio and video in the browser, and open the media formats we only named #649
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| #include <odr/internal/common/media_file.hpp> | ||
|
|
||
| #include <odr/odr.hpp> | ||
|
|
||
| namespace odr::internal { | ||
|
|
||
| MediaFile::MediaFile(std::shared_ptr<abstract::File> file, | ||
| const FileType file_type) | ||
| : m_file{std::move(file)}, m_file_type{file_type} {} | ||
|
|
||
| std::shared_ptr<abstract::File> MediaFile::file() const noexcept { | ||
| return m_file; | ||
| } | ||
|
|
||
| FileType MediaFile::file_type() const noexcept { return m_file_type; } | ||
|
|
||
| FileCategory MediaFile::file_category() const noexcept { | ||
| return file_category_by_file_type(m_file_type); | ||
| } | ||
|
|
||
| FileMeta MediaFile::file_meta() const noexcept { | ||
| FileMeta result; | ||
| result.type = file_type(); | ||
| result.mimetype = mimetype(); | ||
| return result; | ||
| } | ||
|
|
||
| std::string_view MediaFile::mimetype() const noexcept { | ||
| // not `mimetype_by_file_type` β that throws, and this is `noexcept` | ||
| const std::span<const std::string_view> mimetypes = | ||
| mimetypes_by_file_type(m_file_type); | ||
| return mimetypes.empty() ? "" : mimetypes.front(); | ||
| } | ||
|
|
||
| bool MediaFile::is_decodable() const noexcept { return false; } | ||
|
|
||
| } // namespace odr::internal |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| #pragma once | ||
|
|
||
| #include <odr/internal/abstract/file.hpp> | ||
|
|
||
| namespace odr::internal { | ||
|
|
||
| /// Audio and video: nothing is decoded, the bytes are handed to the browser as | ||
| /// they are. One class covers both, the category coming from the file type | ||
| /// table rather than from the class. | ||
| class MediaFile final : public abstract::DecodedFile { | ||
| public: | ||
| MediaFile(std::shared_ptr<abstract::File> file, FileType file_type); | ||
|
|
||
| [[nodiscard]] std::shared_ptr<abstract::File> file() const noexcept override; | ||
|
|
||
| [[nodiscard]] FileType file_type() const noexcept override; | ||
| [[nodiscard]] FileCategory file_category() const noexcept override; | ||
| [[nodiscard]] FileMeta file_meta() const noexcept override; | ||
| [[nodiscard]] std::string_view mimetype() const noexcept override; | ||
|
|
||
| [[nodiscard]] bool is_decodable() const noexcept override; | ||
|
|
||
| private: | ||
| std::shared_ptr<abstract::File> m_file; | ||
| FileType m_file_type; | ||
| }; | ||
|
|
||
| } // namespace odr::internal |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.