Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(735)

Side by Side Diff: services/media/framework/packet.h

Issue 1577953002: Motown in-proc streaming framework used to implement media services. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Changed lpcm input/output to use packets for supplying frames. Some name changes. Synced to master. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef SERVICES_MEDIA_FRAMEWORK_PACKET_H_
6 #define SERVICES_MEDIA_FRAMEWORK_PACKET_H_
7
8 #include <memory>
9
10 #include "base/logging.h"
11 #include "services/media/framework/allocator.h"
12 #include "services/media/framework/ptr.h"
13
14 namespace mojo {
15 namespace media {
16
17 class Packet;
18
19 // Used for PacketPtr.
20 struct PacketDeleter {
21 void operator()(Packet* ptr) const;
22 };
23
24 // Unique pointer for packets.
25 typedef UniquePtr<Packet, PacketDeleter> PacketPtr;
26
27 // Media packet abstract base class. Subclasses may be defined as needed.
28 // Packet::Create and Packet::CreateEndOfStream use an implementation with
29 // no special behavior.
30 class Packet {
31 public:
32 // Creates a packet. If size is 0, payload must be nullptr and vice-versa.
33 // If payload is not nullptr, an allocator must be provided.
34 static PacketPtr Create(
35 int64_t presentation_time,
36 uint64_t duration,
37 bool end_of_stream,
johngro 2016/01/26 01:32:39 <design_point note="No code change requested> PTS,
dalesat 2016/01/26 21:17:51 Ack comments about more metadata. Are you concern
johngro 2016/01/27 22:35:22 mildly; its one of those things which feel like a
dalesat 2016/01/28 18:49:15 Looking at my ffmpeg code, it appears that demuxes
johngro 2016/02/01 22:38:16 so I went ahead and checked in the current ffmpeg
dalesat 2016/02/01 23:01:28 Acknowledged.
38 uint64_t size,
39 void* payload,
40 Allocator* allocator);
johngro 2016/01/26 01:32:39 Looking at the implementation (next file), it seem
dalesat 2016/01/26 21:17:51 That's a worthy design idea. Can we save it for an
johngro 2016/01/27 22:35:22 sure, if you are serious about implementing it, yo
dalesat 2016/01/28 18:49:15 Acknowledged.
41
42 // Creates an end-of-stream packet with no payload.
43 static PacketPtr CreateEndOfStream(int64_t presentation_time);
44
45 virtual int64_t presentation_time() const = 0;
46
47 virtual uint64_t duration() const = 0;
48
49 virtual bool end_of_stream() const = 0;
50
51 virtual uint64_t size() const = 0;
52
53 virtual void* payload() const = 0;
54
55 protected:
56 virtual ~Packet() {}
57
58 virtual void release() = 0;
59
60 friend PacketDeleter;
61 };
62
63 inline void PacketDeleter::operator()(Packet* ptr) const {
64 DCHECK(ptr);
65 ptr->release();
66 }
67
68 } // namespace media
69 } // namespace mojo
70
71 #endif // SERVICES_MEDIA_FRAMEWORK_PACKET_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698