diff options
author | matthewjheaney@chromium.org <matthewjheaney@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-23 06:47:53 +0000 |
---|---|---|
committer | matthewjheaney@chromium.org <matthewjheaney@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-23 06:47:53 +0000 |
commit | 71537725fccd65a9c4c009d500276f63424a8710 (patch) | |
tree | 48793d06b87a67b4c6a75285db7d06f6ffa0ca66 /media/base | |
parent | 8e7d0b47e587935ff8172520b4778979db2a17a8 (diff) | |
download | chromium_src-71537725fccd65a9c4c009d500276f63424a8710.zip chromium_src-71537725fccd65a9c4c009d500276f63424a8710.tar.gz chromium_src-71537725fccd65a9c4c009d500276f63424a8710.tar.bz2 |
Media Source dispatches inband text tracks
The Media Source (WebM) parser now detects the presence of inband text
tracks. As frames of inband text (WebVTT cues) are found in the
network stream, they are pushed up the media stack.
BUG=230708
Review URL: https://chromiumcodereview.appspot.com/13419002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@201716 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/base')
-rw-r--r-- | media/base/stream_parser.h | 11 | ||||
-rw-r--r-- | media/base/text_track.h | 42 |
2 files changed, 53 insertions, 0 deletions
diff --git a/media/base/stream_parser.h b/media/base/stream_parser.h index a4a8105..c006471a 100644 --- a/media/base/stream_parser.h +++ b/media/base/stream_parser.h @@ -14,6 +14,7 @@ #include "base/time.h" #include "media/base/media_export.h" #include "media/base/media_log.h" +#include "media/base/text_track.h" namespace media { @@ -55,6 +56,14 @@ class MEDIA_EXPORT StreamParser { // error should be signalled. typedef base::Callback<bool(const BufferQueue&)> NewBuffersCB; + // New stream buffers of inband text have been parsed. + // First parameter - The text track to which these cues will be added. + // Second parameter - A queue of newly parsed buffers. + // Return value - True indicates that the buffers are accepted. + // False if something was wrong with the buffers and a parsing + // error should be signalled. + typedef base::Callback<bool(TextTrack*, const BufferQueue&)> NewTextBuffersCB; + // Signals the beginning of a new media segment. // First parameter - The earliest timestamp of all the streams in the segment. typedef base::Callback<void(base::TimeDelta)> NewMediaSegmentCB; @@ -78,7 +87,9 @@ class MEDIA_EXPORT StreamParser { const NewConfigCB& config_cb, const NewBuffersCB& audio_cb, const NewBuffersCB& video_cb, + const NewTextBuffersCB& text_cb, const NeedKeyCB& need_key_cb, + const AddTextTrackCB& add_text_track_cb, const NewMediaSegmentCB& new_segment_cb, const base::Closure& end_of_segment_cb, const LogCB& log_cb) = 0; diff --git a/media/base/text_track.h b/media/base/text_track.h new file mode 100644 index 0000000..b249e54 --- /dev/null +++ b/media/base/text_track.h @@ -0,0 +1,42 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef MEDIA_BASE_TEXT_TRACK_H_ +#define MEDIA_BASE_TEXT_TRACK_H_ + +#include <string> + +#include "base/callback.h" +#include "base/memory/scoped_ptr.h" +#include "base/time.h" + +namespace media { + +// Specifies the varieties of text tracks. +enum TextKind { + kTextSubtitles, + kTextCaptions, + kTextDescriptions, + kTextMetadata, + kTextNone +}; + +class TextTrack { + public: + virtual ~TextTrack() {} + virtual void addWebVTTCue(const base::TimeDelta& start, + const base::TimeDelta& end, + const std::string& id, + const std::string& content, + const std::string& settings) = 0; +}; + +typedef base::Callback<scoped_ptr<TextTrack> + (TextKind kind, + const std::string& label, + const std::string& language)> AddTextTrackCB; + +} // namespace media + +#endif // MEDIA_BASE_TEXT_TRACK_H_ |