OLD | NEW |
(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_FFMPEG_AV_PACKET_H_ |
| 6 #define SERVICES_MEDIA_FRAMEWORK_FFMPEG_AV_PACKET_H_ |
| 7 |
| 8 extern "C" { |
| 9 #include "third_party/ffmpeg/libavcodec/avcodec.h" |
| 10 #include "third_party/ffmpeg/libavformat/avformat.h" |
| 11 } |
| 12 |
| 13 namespace mojo { |
| 14 namespace media { |
| 15 namespace ffmpeg { |
| 16 |
| 17 struct AVPacketDeleter { |
| 18 inline void operator()(AVPacket* ptr) const { |
| 19 av_free_packet(ptr); |
| 20 } |
| 21 }; |
| 22 |
| 23 using AvPacketPtr = std::unique_ptr<AVPacket, AVPacketDeleter>; |
| 24 |
| 25 struct AvPacket{ |
| 26 static AvPacketPtr Create() { |
| 27 AVPacket* av_packet = new AVPacket(); |
| 28 av_init_packet(av_packet); |
| 29 return AvPacketPtr(av_packet); |
| 30 } |
| 31 }; |
| 32 |
| 33 } // namespace ffmpeg |
| 34 } // namespace media |
| 35 } // namespace mojo |
| 36 |
| 37 #endif // SERVICES_MEDIA_FRAMEWORK_FFMPEG_AV_PACKET_H_ |
OLD | NEW |