OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef MEDIA_FILTERS_LEGACY_FRAME_PROCESSOR_H_ | 5 #ifndef MEDIA_FILTERS_LEGACY_FRAME_PROCESSOR_H_ |
6 #define MEDIA_FILTERS_LEGACY_FRAME_PROCESSOR_H_ | 6 #define MEDIA_FILTERS_LEGACY_FRAME_PROCESSOR_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "media/base/media_export.h" | 10 #include "media/base/media_export.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 virtual ~LegacyFrameProcessor(); | 25 virtual ~LegacyFrameProcessor(); |
26 | 26 |
27 // FrameProcessorBase implementation | 27 // FrameProcessorBase implementation |
28 virtual void SetSequenceMode(bool sequence_mode) OVERRIDE; | 28 virtual void SetSequenceMode(bool sequence_mode) OVERRIDE; |
29 virtual bool ProcessFrames(const StreamParser::BufferQueue& audio_buffers, | 29 virtual bool ProcessFrames(const StreamParser::BufferQueue& audio_buffers, |
30 const StreamParser::BufferQueue& video_buffers, | 30 const StreamParser::BufferQueue& video_buffers, |
31 const StreamParser::TextBufferQueueMap& text_map, | 31 const StreamParser::TextBufferQueueMap& text_map, |
32 base::TimeDelta append_window_start, | 32 base::TimeDelta append_window_start, |
33 base::TimeDelta append_window_end, | 33 base::TimeDelta append_window_end, |
34 bool* new_media_segment, | 34 bool* new_media_segment, |
35 base::TimeDelta* timestamp_offset) OVERRIDE; | 35 base::TimeDelta* timestamp_offset, |
| 36 base::TimeDelta media_time) OVERRIDE; |
36 | 37 |
37 private: | 38 private: |
38 // Helper function that adds |timestamp_offset| to each buffer in |buffers|. | 39 // Helper function that adds |timestamp_offset| to each buffer in |buffers|. |
39 void AdjustBufferTimestamps(const StreamParser::BufferQueue& buffers, | 40 void AdjustBufferTimestamps(const StreamParser::BufferQueue& buffers, |
40 base::TimeDelta timestamp_offset); | 41 base::TimeDelta timestamp_offset); |
41 | 42 |
42 // Filters out buffers that are outside of the append window | 43 // Filters out buffers that are outside of the append window |
43 // [|append_window_start|, |append_window_end|). |track|'s | 44 // [|append_window_start|, |append_window_end|). |track|'s |
44 // "needs random access point" is read and updated as this method filters | 45 // "needs random access point" is read and updated as this method filters |
45 // |buffers|. Buffers that are inside the append window are appended to the | 46 // |buffers|. Buffers that are inside the append window are appended to the |
46 // end of |filtered_buffers|. |track| must be the track associated with all | 47 // end of |filtered_buffers|. |track| must be the track associated with all |
47 // items in |buffers|. |*new_media_segment| is set true if any of |buffers| | 48 // items in |buffers|. |*new_media_segment| is set true if any of |buffers| |
48 // are filtered out. | 49 // are filtered out. |
49 void FilterWithAppendWindow(base::TimeDelta append_window_start, | 50 void FilterWithAppendWindow(base::TimeDelta append_window_start, |
50 base::TimeDelta append_window_end, | 51 base::TimeDelta append_window_end, |
51 const StreamParser::BufferQueue& buffers, | 52 const StreamParser::BufferQueue& buffers, |
52 MseTrackBuffer* track, | 53 MseTrackBuffer* track, |
53 bool* new_media_segment, | 54 bool* new_media_segment, |
54 StreamParser::BufferQueue* filtered_buffers); | 55 StreamParser::BufferQueue* filtered_buffers); |
55 | 56 |
56 // Helper function that appends |buffers| to |stream| and calls | 57 // Helper function that appends |buffers| to |stream| and calls |
57 // |increase_duration_cb_| to potentially update the duration. | 58 // |increase_duration_cb_| to potentially update the duration. |
58 // Returns true if the append was successful. Returns false if | 59 // Returns true if the append was successful. Returns false if |
59 // |stream| is NULL or something in |buffers| caused the append to fail. | 60 // |stream| is NULL or something in |buffers| caused the append to fail. |
60 bool AppendAndUpdateDuration(ChunkDemuxerStream* stream, | 61 bool AppendAndUpdateDuration(ChunkDemuxerStream* stream, |
61 const StreamParser::BufferQueue& buffers); | 62 const StreamParser::BufferQueue& buffers, |
| 63 base::TimeDelta media_time); |
62 | 64 |
63 // Helper function for Legacy ProcessFrames() when new text buffers have been | 65 // Helper function for Legacy ProcessFrames() when new text buffers have been |
64 // parsed. | 66 // parsed. |
65 // Applies |timestamp_offset| to all buffers in |buffers|, filters |buffers| | 67 // Applies |timestamp_offset| to all buffers in |buffers|, filters |buffers| |
66 // with append window, and stores those filtered buffers into |filtered_text| | 68 // with append window, and stores those filtered buffers into |filtered_text| |
67 // based on |text_track_id|. If any of |buffers| are filtered out by append | 69 // based on |text_track_id|. If any of |buffers| are filtered out by append |
68 // window, then |*new_media_segment| is set true. | 70 // window, then |*new_media_segment| is set true. |
69 // Updates |lowest_segment_timestamp| to be the earliest decode timestamp of | 71 // Updates |lowest_segment_timestamp| to be the earliest decode timestamp of |
70 // all buffers in |filtered_text|. | 72 // all buffers in |filtered_text|. |
71 // Returns true on a successful call. Returns false if an error occurred while | 73 // Returns true on a successful call. Returns false if an error occurred while |
72 // processing the buffers. | 74 // processing the buffers. |
73 bool FilterTextBuffers(StreamParser::TrackId text_track_id, | 75 bool FilterTextBuffers(StreamParser::TrackId text_track_id, |
74 base::TimeDelta append_window_start, | 76 base::TimeDelta append_window_start, |
75 base::TimeDelta append_window_end, | 77 base::TimeDelta append_window_end, |
76 base::TimeDelta timestamp_offset, | 78 base::TimeDelta timestamp_offset, |
77 const StreamParser::BufferQueue& buffers, | 79 const StreamParser::BufferQueue& buffers, |
78 bool* new_media_segment, | 80 bool* new_media_segment, |
79 base::TimeDelta* lowest_segment_timestamp, | 81 base::TimeDelta* lowest_segment_timestamp, |
80 StreamParser::TextBufferQueueMap* filtered_text); | 82 StreamParser::TextBufferQueueMap* filtered_text); |
81 | 83 |
82 IncreaseDurationCB increase_duration_cb_; | 84 IncreaseDurationCB increase_duration_cb_; |
83 | 85 |
84 DISALLOW_COPY_AND_ASSIGN(LegacyFrameProcessor); | 86 DISALLOW_COPY_AND_ASSIGN(LegacyFrameProcessor); |
85 }; | 87 }; |
86 | 88 |
87 } // namespace media | 89 } // namespace media |
88 | 90 |
89 #endif // MEDIA_FILTERS_LEGACY_FRAME_PROCESSOR_H_ | 91 #endif // MEDIA_FILTERS_LEGACY_FRAME_PROCESSOR_H_ |
OLD | NEW |