Line data Source code
1 : /* 2 : * Copyright (C) 2004-2024 Savoir-faire Linux Inc. 3 : * 4 : * Author: Guillaume Roguez <Guillaume.Roguez@savoirfairelinux.com> 5 : * 6 : * This program is free software; you can redistribute it and/or modify 7 : * it under the terms of the GNU General Public License as published by 8 : * the Free Software Foundation; either version 3 of the License, or 9 : * (at your option) any later version. 10 : * 11 : * This program is distributed in the hope that it will be useful, 12 : * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 : * GNU General Public License for more details. 15 : * 16 : * You should have received a copy of the GNU General Public License 17 : * along with this program; if not, write to the Free Software 18 : * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 : */ 20 : 21 : #ifndef __MEDIA_IO_HANDLE_H__ 22 : #define __MEDIA_IO_HANDLE_H__ 23 : 24 : #include "noncopyable.h" 25 : 26 : #include <cstdlib> 27 : #include <cstdint> 28 : #include <vector> 29 : 30 : #ifndef AVFORMAT_AVIO_H 31 : struct AVIOContext; 32 : #endif 33 : 34 : typedef int (*io_readcallback)(void* opaque, uint8_t* buf, int buf_size); 35 : typedef int (*io_writecallback)(void* opaque, uint8_t* buf, int buf_size); 36 : typedef int64_t (*io_seekcallback)(void* opaque, int64_t offset, int whence); 37 : 38 : namespace jami { 39 : 40 : class MediaIOHandle 41 : { 42 : public: 43 : MediaIOHandle(std::size_t buffer_size, 44 : bool writeable, 45 : io_readcallback read_cb, 46 : io_writecallback write_cb, 47 : io_seekcallback seek_cb, 48 : void* opaque); 49 : ~MediaIOHandle(); 50 : 51 995 : AVIOContext* getContext() { return ctx_; } 52 : 53 : private: 54 : NON_COPYABLE(MediaIOHandle); 55 : AVIOContext* ctx_; 56 : }; 57 : 58 : } // namespace jami 59 : 60 : #endif // __MEDIA_DECODER_H__