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 3 // found in the LICENSE file. 4 5 // This file contains declarations for deleters for use with |scoped_ptr|. To 6 // avoid requiring additional #includes, the (inline) definitions are in 7 // ffmpeg_common.h. (Forward declarations of deleters aren't sufficient for 8 // |scoped_ptr|.) 9 10 #ifndef MEDIA_FFMPEG_FFMPEG_DELETERS_H_ 11 #define MEDIA_FFMPEG_FFMPEG_DELETERS_H_ 12 13 namespace media { 14 15 // Wraps FFmpeg's av_free() in a class that can be passed as a template argument 16 // to scoped_ptr_malloc. 17 struct ScopedPtrAVFree { 18 void operator()(void* x) const; 19 }; 20 21 // This assumes that the AVPacket being captured was allocated outside of 22 // FFmpeg via the new operator. Do not use this with AVPacket instances that 23 // are allocated via malloc() or av_malloc(). 24 struct ScopedPtrAVFreePacket { 25 void operator()(void* x) const; 26 }; 27 28 // Frees an AVCodecContext object in a class that can be passed as a Deleter 29 // argument to scoped_ptr_malloc. 30 struct ScopedPtrAVFreeContext { 31 void operator()(void* x) const; 32 }; 33 34 // Frees an AVFrame object in a class that can be passed as a Deleter argument 35 // to scoped_ptr_malloc. 36 struct ScopedPtrAVFreeFrame { 37 void operator()(void* x) const; 38 }; 39 40 } // namespace media 41 42 #endif // MEDIA_FFMPEG_FFMPEG_DELETERS_H_ 43