aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
Commit message (Collapse)AuthorAgeFilesLines
* avcodec/defs: Add AV_PROFILE_* defines, deprecate FF_PROFILE_* definesAndreas Rheinhardt2023-09-0710-47/+49
| | | | | | | | | These defines are also used in other contexts than just AVCodecContext ones, e.g. in libavformat. Furthermore, given that these defines are public, the AV-prefix is the right one, so deprecate (and not just move) the FF-macros. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/avformat: Avoid including codec.h, frame.hAndreas Rheinhardt2023-09-0721-16/+43
| | | | | | | | | | | | | | | | AVCodec is only ever used as an incomplete type (i.e. via a pointer to an AVCodec) in avformat.h and it is not really part of the core of avformat.h or libavformat; almost none of our internal users make use of it (and none make use of hwcontext.h, which is implicitly included). So switch to use struct AVCodec, but continue to include codec.h for external users for compatibility. Also, do the same for AVFrame and frame.h, which is implicitly included by codec.h (via lavu/hwcontext.h). Also, remove an unnecessary inclusion of <time.h>. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/matroskadec: Factor parsing content encodings outAndreas Rheinhardt2023-09-071-67/+79
| | | | | | Namely, out of matroska_parse_tracks(). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/matroskadec: Move WEBVTT code to mkv_parse_subtitle_codec()Andreas Rheinhardt2023-09-071-22/+27
| | | | | | | and also perform the remainder of the subtitle parsing directly after mkv_parse_subtitle_codec(). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/matroskdec: Reindent after the previous commitAndreas Rheinhardt2023-09-071-26/+26
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/matroskadec: Factor generic parsing of audio tracks outAndreas Rheinhardt2023-09-071-32/+47
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/matroskadec: Reindent after the previous commitAndreas Rheinhardt2023-09-071-78/+79
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/matroskadec: Factor generic parsing of video tracks outAndreas Rheinhardt2023-09-071-86/+102
| | | | | | Out of matroska_parse_tracks(), that is. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/matroskadec: Factor parsing subtitle codecs outAndreas Rheinhardt2023-09-071-29/+46
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/matroskadec: Use av_dict_set_int() where appropriateAndreas Rheinhardt2023-09-071-1/+1
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/matroskadec: Avoid clobbering CodecPrivate sizeAndreas Rheinhardt2023-09-071-3/+2
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/matroskadec: Move reading color space to a better placeAndreas Rheinhardt2023-09-071-4/+3
| | | | | | | Namely to a place after the AVStream has already been created, so that it can be directly attached to it. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/matroskadec: Reindent after the previous commitAndreas Rheinhardt2023-09-071-43/+43
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/matroskadec: Factor video parsing out of matroska_parse_tracks()Andreas Rheinhardt2023-09-071-48/+72
| | | | | | | More exactly, factor codec-specific video parsing out of matroska_parse_tracks(). This is intended to improve readability. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/matroskadec: Reindent after the previous commitAndreas Rheinhardt2023-09-071-126/+125
| | | | | | Also fix a variable shadowing. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/matroskadec: Remove redundant checksAndreas Rheinhardt2023-09-071-8/+4
| | | | | | | | If the size of the data of an EbmlBin is > 0, its data is always present, as ebml_read_binary() always leaves the buffer in a consistent state (even on error). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/matroskdec: Factor audio parsing out of matroska_parse_tracks()Andreas Rheinhardt2023-09-071-181/+243
| | | | | | | More exactly, factor codec-specific audio parsing out of matroska_parse_tracks(). This is intended to improve readability. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/matroskadec: Set AVCodecParameters earlierAndreas Rheinhardt2023-09-071-27/+28
| | | | | | This is in preparation for future commits. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/matroskadec: Redo handling extradata allocationAndreas Rheinhardt2023-09-071-33/+27
| | | | | | | | | | | | | | | | | | | Up until now, matroska_parse_tracks() has two main ways to set AVCodecParameters.extradata: A generic way via CodecPrivate (possibly with an offset) and by allocating a buffer manually; the pointer to this buffer is stored in a stack pointer. In particular, the latter method is problematic, as the buffer needs to be freed manually in case of error (currently there are no error conditions between the place where it is set to AVCodecParameters.extradata). Most of these buffers are very small (<= 22B), so replace the pointer to an allocated buffer with a stack buffer and set the extradata directly for the one place where the buffer may not be small. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/matroskadec: Use dedicated pointer for access to codecparAndreas Rheinhardt2023-09-071-48/+50
| | | | | | Shortens code and improves readability. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/matroskadec: Set several stream parameters earlierAndreas Rheinhardt2023-09-071-32/+32
| | | | | | Don't do it in between parsing and setting extradata. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/demux: propagate the internal decoder's bitrate propertiesJames Almer2023-09-061-0/+17
| | | | | | | Muxers may access this information through cpb properties within the stream's side data. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/rtmpproto: support enhanced rtmpSteven Liu2023-09-051-0/+34
| | | | | | | | add option named rtmp_enhanced_codec, it would support hvc1,av01,vp09 now, the fourcc is using Array of strings. Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avformat/rtmppkt: add ff_amf_write_array for writeSteven Liu2023-09-052-0/+14
| | | | Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avformat/vpcc: fix VP9 metadata in FLV and RTMPAlessandro Ros2023-09-042-3/+2
| | | | | | | | | | | | | | In order to send VP9 tracks with FLV or RTMP, the enhanced RTMP specification tells that VPCodecConfigurationRecord, a.k.a. vpcC ISO-BMFF box, must be inserted into a metadata message. However, the function responsible for generating vpcCs currently returns invalid boxes, that are lacking the Version and Flag fields, inherited from FullBox. For some reason, both flags were being added manually in movenc. This patch fixes the issue. Signed-off-by: Alessandro Ros <aler9.dev@gmail.com> Reviewed-by: Steven Liu <lingjiujianke@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/wavarc: fix data end calculationPaul B Mahol2023-09-021-2/+3
|
* avformat/matroska(dec|enc): Rename macro to avoid clash with winbase.hAndreas Rheinhardt2023-09-022-4/+4
| | | | | | | | winbase.h defines IGNORE and is included via bzlib.h when compiling for Windows. So rename this macro to NOTHING. Also rename the muxer macro for consistency. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/internal: Don't auto-include os_support.hAndreas Rheinhardt2023-09-024-1/+3
| | | | | | | | | | | | | | | | | | | | It includes various Windows-specific headers when compiling for Windows and these sometimes cause issues: E.g. winbase.h defines IGNORE, which clashes with a macro used in the Matroska muxer (since 884653ee5be03ed38db957c14fad51b300611c8c) and demuxer. This header provides fallback defines for various stuff that is mostly not used directly by (de)muxers at all: mkdir, rename, rmdir, unlink, access, poll, pollfd, nfds_t, closesocket, socklen_t, fstat, stat, lseek, SHUT_(RD|WR|RDWR) and various POLL* constants. Ergo fix this issue by not auto-including this header in lots of places via an inclusion in internal.h and instead include it everywhere where the above stuff is used (most of these translation units already included os_support.h). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat: add OSQ demuxerPaul B Mahol2023-09-014-2/+122
|
* avformat/riffdec: Pass logctx as void* instead of AVFormatContext*Andreas Rheinhardt2023-08-302-13/+16
| | | | | | Also stop second-guessing error codes from ff_get_extradata(). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/matroskadec: Use named constants instead of their valueAndreas Rheinhardt2023-08-301-1/+2
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/matroskadec: Replace switch with arrayAndreas Rheinhardt2023-08-301-36/+11
| | | | | | | | | This simplification reduces codesize. (It even reduces the size of .rodata here, because the jump table used by the compiler is bigger than the actual array.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/matroska: Move ff_mkv_stereo3d_conv() to demuxerAndreas Rheinhardt2023-08-303-62/+57
| | | | | | It is now its only user; also make it static. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/matroskaenc: Improve message for WebM-incompatible StereoModesAndreas Rheinhardt2023-08-301-1/+4
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/matroskaenc: Don't add side-data to input streamAndreas Rheinhardt2023-08-301-65/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When muxing, the AVStreams' side-data is typically set by the caller before avformat_write_header(); it is not documented to be else. Yet the Matroska muxer added an AVStereo3D side data if certain metadata was present: Since commit 4d686fb721b485ebbc4c7779d927d876c1e630f7 (adding support for AVStereo3D stream side-data), the Matroska muxer checked certain stream tags that contain Matroska's StereoMode and (if they are present) converted this value into an AVStereo3D struct that gets attached to the AVStream (reusing a function from the demuxer). Afterwards the AVStereo3D side data struct (whether it has just been added by the muxer or not) gets parsed and converted back into a Matroska StereoMode. Besides being an API violation this change broke StereoMode values without a corresponding AVStereo3D (namely the anaglyph ones). This commit fixes this: A StereoMode given via tags is now used-as-is; if no such tag exists and an AVStereo3D side data exists, it is converted into the corresponding StereoMode (if possible). This approach also fixes handling of the anaglyph ones; the changes to the matroska-stereo_mode are due to this. The new STEREOMODE_STEREO3D_MAPPING has been put to good use for this. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/matroska: Add macro for stereomode<->AVStereo3D correspondenceAndreas Rheinhardt2023-08-301-0/+37
| | | | | | | | It will allow to create tables for easy conversion from AVStereo3D to stereomode and back again as well as derive the properties of a given stereomode. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/matroska: Move ff_matroska_video_stereo_plane to demuxerAndreas Rheinhardt2023-08-303-8/+7
| | | | | | Only used there. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/matroskaenc: Avoid atoi()Andreas Rheinhardt2023-08-301-6/+5
| | | | | | | | | | It has undefined behaviour in case the value does not fit into an int. Also stop allowing to override a stream level "alpha_mode" tag by an AVFormatContext one and properly check that the stereo_mode number given via a tag is actually in the range 0..14: Negative values would have been treated as zero before this patch. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/matroskaenc: Fix writing of markersSteinar H. Gunderson2023-08-291-1/+1
| | | | | | | | | | | | | When the marker writing code was merged from libav to FFmpeg in dc62016c, it failed to take into account that the meaning of cluster_pos had changed in bda5b662; in particular, the special value for “I'm not currently working on a cluster” had changed from 0 to -1. This makes the avio_write_marker() call never be called. Update the if statement to fix it. Fixes: Ticket9843 Signed-off-by: Steinar H. Gunderson <steinar+ffmpeg@gunderson.no> Signed-off-by: Martin Storsjö <martin@martin.st>
* avformat/jpegxl: remove jpegxl_probe, instead call avcodec/jpegxl_parseLeo Izen2023-08-276-536/+41
| | | | | | | | | This prevents code duplication in the source form by calling the parse code that was moved to avcodec last commit. The code will be duplicated in binary form for shared builds (it's not that large), but for source code it will only exist in one location now. Signed-off-by: Leo Izen <leo.izen@gmail.com>
* avformat/hls: reset the playlist init segment on seekTimo Rothenpieler2023-08-221-0/+3
| | | | | The mp4 demuxer gets very upset when it gets flushed and not re-fed this data.
* avformat/sox*: extend long namePaul B Mahol2023-08-152-2/+2
|
* avformat/soxdec: improve probe a littlePaul B Mahol2023-08-151-3/+7
|
* configure: Set WIN32_LEAN_AND_MEAN at configure timeL. E. Segovia2023-08-141-4/+2
| | | | | | | | | | | | | Including winsock2.h or windows.h without WIN32_LEAN_AND_MEAN cause bzlib.h to parse as nonsense, due to an instance of #define char small in rpcndr.h. See: https://stackoverflow.com/a/27794577 Signed-off-by: L. E. Segovia <amy@amyspark.me> Signed-off-by: Martin Storsjö <martin@martin.st>
* avformat/flv: correct the video frametype mask to 0x70Steven Liu2023-08-141-1/+1
| | | | | | | | | | | because the flv specification said the video frametype should use value range from 0x00 to 0x70, so use 0xF0 have no problem before support enhanced flv, but the 0xF0 will get incorrect result after support enhanced flv, so should set the video frametype mask 0x70 to make it correct now. Reported-By: flvAnalyser <hybase@qq.com> Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avformat/flvdec: remove unused context member of flvSteven Liu2023-08-141-5/+4
| | | | | | | The exheader is unnecessary after 207e9f4e505d969d6ff7545b449295a1b88d6d1c Iust use local varible can do the same function. Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avformat/au: improve au_probe()Paul B Mahol2023-08-111-4/+9
|
* avformat/matroskaenc: Don't write \0 unnecessarilyAndreas Rheinhardt2023-08-101-5/+10
| | | | | | | | | | | | | | | | | | | | | | | | Writing the duration SimpleTag is special: It's size is reserved in advance via an EBML Void element (if seekable) and this reserved space is overwritten when writing the trailer; it does not use put_ebml_string(). The string to write is created via snprintf on a buffer of size 20; this buffer is then written via put_ebml_binary() with a size of 20. EBML strings need not be zero-terminated; if not, they are implicitly terminated by the element's length field. snprintf() always zero-terminates the buffer, i.e. the last byte can be discarded when using an EBML string. This patch does this. The FATE changes are as expected: One byte saved for every track; the only exception is the matroska-qt-mode test: An additional byte is saved because an additional byte could be saved from the enclosing Tags length field. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/matroskaenc: Reindent after the previous commitAndreas Rheinhardt2023-08-101-24/+25
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/matroskaenc: Don't reserve space for HDR10+ when unnecessaryAndreas Rheinhardt2023-08-101-2/+7
| | | | | | | | | | Do it only for video (the only thing for type for which HDR10+ makes sense). This effectively reverts changes to several FATE ref-files made in bda44f0f39e8ee646e54f15989d7845f4bf58d26. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>