annotate ffmpeg/libavutil/file.h @ 13:844d341cf643 tip

Back up before ISMIR
author Yading Song <yading.song@eecs.qmul.ac.uk>
date Thu, 31 Oct 2013 13:17:06 +0000
parents f445c3017523
children
rev   line source
yading@11 1 /*
yading@11 2 * This file is part of FFmpeg.
yading@11 3 *
yading@11 4 * FFmpeg is free software; you can redistribute it and/or
yading@11 5 * modify it under the terms of the GNU Lesser General Public
yading@11 6 * License as published by the Free Software Foundation; either
yading@11 7 * version 2.1 of the License, or (at your option) any later version.
yading@11 8 *
yading@11 9 * FFmpeg is distributed in the hope that it will be useful,
yading@11 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
yading@11 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
yading@11 12 * Lesser General Public License for more details.
yading@11 13 *
yading@11 14 * You should have received a copy of the GNU Lesser General Public
yading@11 15 * License along with FFmpeg; if not, write to the Free Software
yading@11 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
yading@11 17 */
yading@11 18
yading@11 19 #ifndef AVUTIL_FILE_H
yading@11 20 #define AVUTIL_FILE_H
yading@11 21
yading@11 22 #include <stdint.h>
yading@11 23
yading@11 24 #include "avutil.h"
yading@11 25
yading@11 26 /**
yading@11 27 * @file
yading@11 28 * Misc file utilities.
yading@11 29 */
yading@11 30
yading@11 31 /**
yading@11 32 * Read the file with name filename, and put its content in a newly
yading@11 33 * allocated buffer or map it with mmap() when available.
yading@11 34 * In case of success set *bufptr to the read or mmapped buffer, and
yading@11 35 * *size to the size in bytes of the buffer in *bufptr.
yading@11 36 * The returned buffer must be released with av_file_unmap().
yading@11 37 *
yading@11 38 * @param log_offset loglevel offset used for logging
yading@11 39 * @param log_ctx context used for logging
yading@11 40 * @return a non negative number in case of success, a negative value
yading@11 41 * corresponding to an AVERROR error code in case of failure
yading@11 42 */
yading@11 43 int av_file_map(const char *filename, uint8_t **bufptr, size_t *size,
yading@11 44 int log_offset, void *log_ctx);
yading@11 45
yading@11 46 /**
yading@11 47 * Unmap or free the buffer bufptr created by av_file_map().
yading@11 48 *
yading@11 49 * @param size size in bytes of bufptr, must be the same as returned
yading@11 50 * by av_file_map()
yading@11 51 */
yading@11 52 void av_file_unmap(uint8_t *bufptr, size_t size);
yading@11 53
yading@11 54 /**
yading@11 55 * Wrapper to work around the lack of mkstemp() on mingw.
yading@11 56 * Also, tries to create file in /tmp first, if possible.
yading@11 57 * *prefix can be a character constant; *filename will be allocated internally.
yading@11 58 * @return file descriptor of opened file (or -1 on error)
yading@11 59 * and opened file name in **filename.
yading@11 60 * @note On very old libcs it is necessary to set a secure umask before
yading@11 61 * calling this, av_tempfile() cant call umask itself as it is used in
yading@11 62 * libraries and could interfere with the calling application.
yading@11 63 */
yading@11 64 int av_tempfile(const char *prefix, char **filename, int log_offset, void *log_ctx);
yading@11 65
yading@11 66 #endif /* AVUTIL_FILE_H */