aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil/file.c
Commit message (Collapse)AuthorAgeFilesLines
* avutil/file: fix av_file_map file mapping on WindowsKacper Michajłow2024-12-151-1/+1
| | | | | | | | | | | | | This makes the behavior of av_file_map() the same on Windows as it is on other platforms. The file is opened as read-only, but the mapping is copy-on-write, allowing the user to write to the memory pages returned by av_file_map(). This commit fixes libavutil\tests\file.c test, which would crash when trying to write to a read-only memory page. Signed-off-by: Kacper Michajłow <kasper93@gmail.com> Signed-off-by: Anton Khirnov <anton@khirnov.net>
* avutil/file: use av_err2str to simplify codeMarvin Scholz2024-09-131-7/+3
| | | | | No need to explicitly specify the buffer here as it is only ever passed to av_log, so av_err2str can be used.
* avutil: remove deprecated FF_API_AV_FOPEN_UTF8James Almer2024-03-071-6/+0
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* Revert "all: Don't set AVClass.item_name to its default value"Anton Khirnov2024-01-201-0/+1
| | | | | | | Some callers assume that item_name is always set, so this may be considered an API break. This reverts commit 0c6203c97a99f69dbaa6e4011d48c331e1111f5e.
* all: Don't set AVClass.item_name to its default valueAndreas Rheinhardt2023-12-221-1/+0
| | | | | | | | Unnecessary since acf63d5350adeae551d412db699f8ca03f7e76b9; also avoids relocations. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/mem: Don't include avutil.hAndreas Rheinhardt2023-09-071-0/+1
| | | | | | | | | It is not necessary at all. So remove it. This also breaks an inclusion cycle mem.h->avutil.h->common.h->mem.h. Reviewed-by: Paul B Mahol <onemda@gmail.com> Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/file: Properly deprecate av_tempfile()Andreas Rheinhardt2022-09-031-0/+2
| | | | | | | | | | It has been deprecated in b4f59beeb4c2171879d0d7607a4a7d6165f07791, but the attribute_deprecated was not set and there was no entry in APIchanges. This commit adds these and schedules it for removal. Given that the reason behind the deprecation is exactly the same as in av_fopen_utf8(), reuse its FF_API_AV_FOPEN_UTF8. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/internal: Move avpriv-file API to a header of its ownAndreas Rheinhardt2022-09-031-0/+1
| | | | | | | It is not used by the large majority of files that include lavu/internal.h. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avutil/file: add more check befor destory the bufferJun Zhao2019-08-301-1/+1
| | | | | | | add more check befor destory the buffer Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
* avutil/file: always set *size to zero if *bufptr is NULLJun Zhao2019-08-301-0/+5
| | | | | | | | | Always set *size to zero if *bufptr is NULL, it's more make sence. fix #8095 Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
* avutil/file: allow mapping 0 byte files with av_file_mapMarton Balint2018-09-091-0/+8
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* Merge commit '97cfe1d8bd1968143e2ba9aa46ebe9504a835e24'James Almer2017-11-011-2/+6
|\ | | | | | | | | | | | | * commit '97cfe1d8bd1968143e2ba9aa46ebe9504a835e24': Convert all AVClass struct declarations to designated initializers. Merged-by: James Almer <jamrial@gmail.com>
| * Convert all AVClass struct declarations to designated initializers.Diego Biurrun2017-06-121-2/+6
| |
* | Merge commit 'd12b5b2f135aade4099f4b26b0fe678656158c13'Derek Buitenhuis2016-05-111-19/+0
|\| | | | | | | | | | | | | | | * commit 'd12b5b2f135aade4099f4b26b0fe678656158c13': build: Split test programs off into separate files Some conversions done by: James Almer <jamrial@gmail.com> Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
* | avutil/file: Move av_tempfile() to avutil/file_open ff_tempfile()Michael Niedermayer2016-03-121-46/+2
| | | | | | | | | | | | | | document the issue with av_tempfile() Tested-by: Hendrik Leppkes <h.leppkes@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | Merge commit 'bf704132a51f5d838365158331d4e535e1df4c8e'Michael Niedermayer2015-02-141-1/+1
|\| | | | | | | | | | | | | | | | | | | | | * commit 'bf704132a51f5d838365158331d4e535e1df4c8e': Don't anonymously typedef structs Conflicts: avprobe.c libavutil/parseutils.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * Don't anonymously typedef structsDiego Biurrun2015-02-141-1/+1
| |
* | Merge commit '0a024268261d05ccdcf7e03c85fb78d22037a464'Michael Niedermayer2014-08-261-3/+4
|\| | | | | | | | | | | | | | | | | | | | | * commit '0a024268261d05ccdcf7e03c85fb78d22037a464': libxvid: K&R formatting cosmetics Conflicts: libavcodec/libxvid.c libavcodec/libxvid_rc.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge commit 'f929ab0569ff31ed5a59b0b0adb7ce09df3fca39'Michael Niedermayer2014-08-151-1/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit 'f929ab0569ff31ed5a59b0b0adb7ce09df3fca39': cosmetics: Write NULL pointer equality checks more compactly Conflicts: cmdutils.c ffmpeg_opt.c ffplay.c libavcodec/dvbsub.c libavcodec/dvdsubdec.c libavcodec/dvdsubenc.c libavcodec/dxa.c libavcodec/libxvid_rc.c libavcodec/mpegvideo.c libavcodec/mpegvideo_enc.c libavcodec/rv10.c libavcodec/tiffenc.c libavcodec/utils.c libavcodec/vc1dec.c libavcodec/zmbv.c libavdevice/v4l2.c libavformat/matroskadec.c libavformat/movenc.c libavformat/sdp.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge commit 'a76d0cdf21c3d9e464623cc0ad1c005abf952afa'Michael Niedermayer2013-08-101-64/+0
|\| | | | | | | | | | | | | * commit 'a76d0cdf21c3d9e464623cc0ad1c005abf952afa': libavutil: Move avpriv_open to a new file, file_open.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * libavutil: Move avpriv_open to a new file, file_open.cMartin Storsjö2013-08-101-64/+0
| | | | | | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* | Merge commit 'dfc6b5c81491abf7effb97b23af17ccf7adcd132'Michael Niedermayer2013-08-091-0/+39
|\| | | | | | | | | | | | | * commit 'dfc6b5c81491abf7effb97b23af17ccf7adcd132': file: Move win32 utf8->wchar open wrapper to libavutil Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * file: Move win32 utf8->wchar open wrapper to libavutilMartin Storsjö2013-08-081-0/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | When libavformat was changed to use the new avpriv_open function in 51eb213d001, this silently bypassed the existing wrapper for win32. Move the win32 wrapper into libavutil/file.c to make sure it gets called everywhere (not just in the libavformat case). This makes sure that non-ascii file names gets opened properly (where file names internally are stored as utf8, but they get converted to wchar_t and opened with _wsopen). Signed-off-by: Martin Storsjö <martin@martin.st>
| * libavutil: Don't use fcntl if the function does not existDerek Buitenhuis2013-08-081-0/+3
| | | | | | | | | | | | | | Not all platforms have the function. Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com> Signed-off-by: Martin Storsjö <martin@martin.st>
* | libavutil: Don't use fcntl if the function does not existDerek Buitenhuis2013-08-081-0/+3
| | | | | | | | | | | | | | Not all platforms have the function. Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com> Signed-off-by: Martin Storsjö <martin@martin.st>
* | Merge commit '869b04e89154cd92d2bcfdabcecbe3217864c099'Michael Niedermayer2013-08-081-1/+24
|\| | | | | | | | | | | | | * commit '869b04e89154cd92d2bcfdabcecbe3217864c099': libavutil: add avpriv_open() to open files with close-on-exec flag Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * libavutil: add avpriv_open() to open files with close-on-exec flagRémi Denis-Courmont2013-08-071-1/+24
| | | | | | | | Signed-off-by: Anton Khirnov <anton@khirnov.net>
* | Merge remote-tracking branch 'qatar/master'Michael Niedermayer2012-11-301-1/+3
|\| | | | | | | | | | | | | | | * qatar/master: avutil: Include io.h with a separate condition from MapViewOfFile cmdutils: Use a configure check for enabling CommandLineToArgvW Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * avutil: Include io.h with a separate condition from MapViewOfFileMartin Storsjö2012-11-291-1/+3
| | | | | | | | | | | | | | | | | | | | | | The existence of MapViewOfFile isn't linked to the existence of io.h. Not all versions of windows have MapViewOfFile (in particular, Windows Phone 8 and the "metro" windows 8 API subset don't), while they still have io.h (and need it for open/read/close). Signed-off-by: Martin Storsjö <martin@martin.st>
* | av_tempfile: fix leak in error caseMichael Niedermayer2012-10-111-0/+1
| | | | | | | | | | Fixes CID733796 Part2 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge remote-tracking branch 'qatar/master'Michael Niedermayer2012-08-161-0/+2
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * qatar/master: Fix even more missing includes after the common.h removal build: Factor out rangecoder dependencies to CONFIG_RANGECODER build: Factor out error resilience dependencies to CONFIG_ERROR_RESILIENCE x86: avcodec: Consistently name all init files Add more missing includes after removing the implicit common.h Add some more missing includes after removing the implicit common.h Don't include common.h from avutil.h rtmp: Automatically compute the hash for SWFVerification Conflicts: configure doc/APIchanges doc/examples/decoding_encoding.c libavcodec/Makefile libavcodec/assdec.c libavcodec/audio_frame_queue.c libavcodec/avpacket.c libavcodec/dv_profile.c libavcodec/dwt.c libavcodec/libtheoraenc.c libavcodec/rawdec.c libavcodec/rv40dsp.c libavcodec/tiff.c libavcodec/tiffenc.c libavcodec/v210dec.h libavcodec/vc1dsp.c libavcodec/x86/Makefile libavfilter/asrc_anullsrc.c libavfilter/avfilter.c libavfilter/buffer.c libavfilter/formats.c libavfilter/vf_ass.c libavfilter/vf_drawtext.c libavfilter/vf_fade.c libavfilter/vf_select.c libavfilter/video.c libavfilter/vsrc_testsrc.c libavformat/version.h libavutil/audioconvert.c libavutil/error.h libavutil/version.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * Add some more missing includes after removing the implicit common.hMartin Storsjö2012-08-151-0/+1
| | | | | | | | Signed-off-by: Martin Storsjö <martin@martin.st>
| * Don't include common.h from avutil.hMartin Storsjö2012-08-151-0/+1
| | | | | | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* | Merge remote-tracking branch 'qatar/master'Michael Niedermayer2012-06-221-0/+2
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * qatar/master: libspeexenc: add supported sample rates and channel layouts. Replace usleep() calls with av_usleep() lavu: add av_usleep() function utvideo: mark interlaced frames as such utvideo: Fix interlaced prediction for RGB utvideo. cosmetics: do not use full path for local headers lavu/file: include unistd.h only when available configure: check for unistd.h log: include unistd.h only when needed lavf: include libavutil/time.h instead of redeclaring av_gettime() Conflicts: configure doc/APIchanges ffmpeg.c ffplay.c libavcodec/utvideo.c libavutil/avutil.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * lavu/file: include unistd.h only when availableMans Rullgard2012-06-211-0/+2
| | | | | | | | | | | | | | | | The unistd.h header is only needed for the close() declaration. If this header is not available, the close() declaration may be provided by another header, e.g. io.h. Signed-off-by: Mans Rullgard <mans@mansr.com>
* | Merge remote-tracking branch 'qatar/master'Michael Niedermayer2012-01-281-0/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * qatar/master: (71 commits) movenc: Allow writing to a non-seekable output if using empty moov movenc: Support adding isml (smooth streaming live) metadata libavcodec: Don't crash in avcodec_encode_audio if time_base isn't set sunrast: Document the different Sun Raster file format types. sunrast: Add a check for experimental type. libspeexenc: use AVSampleFormat instead of deprecated/removed SampleFormat lavf: remove disabled FF_API_SET_PTS_INFO cruft lavf: remove disabled FF_API_OLD_INTERRUPT_CB cruft lavf: remove disabled FF_API_REORDER_PRIVATE cruft lavf: remove disabled FF_API_SEEK_PUBLIC cruft lavf: remove disabled FF_API_STREAM_COPY cruft lavf: remove disabled FF_API_PRELOAD cruft lavf: remove disabled FF_API_NEW_STREAM cruft lavf: remove disabled FF_API_RTSP_URL_OPTIONS cruft lavf: remove disabled FF_API_MUXRATE cruft lavf: remove disabled FF_API_FILESIZE cruft lavf: remove disabled FF_API_TIMESTAMP cruft lavf: remove disabled FF_API_LOOP_OUTPUT cruft lavf: remove disabled FF_API_LOOP_INPUT cruft lavf: remove disabled FF_API_AVSTREAM_QUALITY cruft ... Conflicts: doc/APIchanges libavcodec/8bps.c libavcodec/avcodec.h libavcodec/libx264.c libavcodec/mjpegbdec.c libavcodec/options.c libavcodec/sunrast.c libavcodec/utils.c libavcodec/version.h libavcodec/x86/h264_deblock.asm libavdevice/libdc1394.c libavdevice/v4l2.c libavformat/avformat.h libavformat/avio.c libavformat/avio.h libavformat/aviobuf.c libavformat/dv.c libavformat/mov.c libavformat/utils.c libavformat/version.h libavformat/wtv.c libavutil/Makefile libavutil/file.c libswscale/x86/input.asm libswscale/x86/swscale_mmx.c libswscale/x86/swscale_template.c tests/ref/lavf/ffm Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * libavutil: Remove pointless file test program.Diego Biurrun2012-01-261-18/+0
| |
* | av_tempfile: dont try the current directory with mkstemp() unless we are on ↵Michael Niedermayer2011-10-161-0/+2
| | | | | | | | | | | | windows Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | av_tempfile: change mode for fallback to 0600 to match mkstemp()Michael Niedermayer2011-10-161-1/+1
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | av_tempfile: Pass int log_offset, void *log_ctxMichael Niedermayer2011-10-161-3/+4
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | av_tempfile: fix error codesMichael Niedermayer2011-10-161-2/+3
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | av_tempfile: use O_EXCLMichael Niedermayer2011-10-161-1/+4
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | av_tempfile: try tempnam(NULL) firstMichael Niedermayer2011-10-161-1/+3
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | av_tempfile: handle missing O_BINARYMichael Niedermayer2011-10-161-0/+3
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | av_tempfile: fix alloc type for !HAVE_MKSTEMPMichael Niedermayer2011-10-161-1/+4
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Move av_tempfile() into libavutil, it is a generically usefull thing and its ↵Michael Niedermayer2011-10-161-0/+31
| | | | | | | | | | | | small. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge remote-tracking branch 'qatar/master'Michael Niedermayer2011-07-041-0/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * qatar/master: (40 commits) H.264: template left MB handling H.264: faster fill_decode_caches H.264: faster write_back_* H.264: faster fill_filter_caches H.264: make filter_mb_fast support the case of unavailable top mb Do not include log.h in avutil.h Do not include pixfmt.h in avutil.h Do not include rational.h in avutil.h Do not include mathematics.h in avutil.h Do not include intfloat_readwrite.h in avutil.h Remove return statements following infinite loops without break RTSP: Doxygen comment cleanup doxygen: Escape '\' in Doxygen documentation. md5: cosmetics md5: use AV_WL32 to write result md5: add fate test md5: include correct headers md5: fix test program doxygen: Drop array size declarations from Doxygen parameter names. doxygen: Fix parameter names to match the function prototypes. ... Conflicts: libavcodec/x86/dsputil_mmx.c libavformat/flvenc.c libavformat/oggenc.c libavformat/wtv.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * Do not include log.h in avutil.hMans Rullgard2011-07-031-0/+1
| | | | | | | | Signed-off-by: Mans Rullgard <mans@mansr.com>
| * Fix error check in av_file_map()Mans Rullgard2011-06-041-1/+1
| | | | | | | | | | | | On failure, mmap() returns MAP_FAILED, which may or may not be -1. Signed-off-by: Mans Rullgard <mans@mansr.com>
* | Use MAP_FAILED to check for mmap failure instead of manuallyReimar Döffinger2011-05-071-1/+1
| | | | | | | | recreating the value.