summaryrefslogtreecommitdiff
path: root/libavformat/oggenc.c
Commit message (Collapse)AuthorAge
* av(format|device): Add const to muxer packet data pointersAndreas Rheinhardt2022-07-09
| | | | | | | The packets given to muxers need not be writable, so it is best to access them via const uint8_t*. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* configure: Use a separate config_components.h header for $ALL_COMPONENTSMartin Storsjö2022-03-16
| | | | | | | | This avoids unnecessary rebuilds of most source files if only the list of enabled components has changed, but not the other properties of the build, set in config.h. Signed-off-by: Martin Storsjö <martin@martin.st>
* libavformat: Split version.hMartin Storsjö2022-03-16
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* avformat/avio: Move internal AVIOContext fields to avio_internal.hAndreas Rheinhardt2021-08-25
| | | | | | | | | | | | | | Currently AVIOContext's private fields are all over AVIOContext. This commit moves them into a new structure in avio_internal.h instead. Said structure contains the public AVIOContext as its first element in order to avoid having to allocate a separate AVIOContextInternal which is costly for those use cases where one just wants to access an already existing buffer via the AVIOContext-API. For these cases ffio_init_context() can't fail and always returned zero, which was typically not checked. Therefore it has been made to not return anything. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/oggenc: Deduplicate AVClassesAndreas Rheinhardt2021-07-08
| | | | | | | | The child_class_next API relied on different (de)muxers to use different AVClasses; yet this API has been replaced by child_class_iterate. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat: Constify all muxer/demuxersAndreas Rheinhardt2021-04-27
| | | | | | | This is possible now that the next-API is gone. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/oggenc: Avoid allocating and copying when writing page dataAndreas Rheinhardt2020-05-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | When the Ogg muxer writes a page, it has to do three things: It needs to write a page header, then it has to actually copy the page data and then it has to calculate and write a CRC checksum of both header as well as data at a certain position in the page header. To do this, the muxer used a dynamic buffer for both writing as well as calculating the checksum via an AVIOContext's feature to automatically calculate checksums on the data it writes. This entails an allocation of an AVIOContext, of the opaque specific to dynamic buffers and of the buffer itself (which may be reallocated multiple times) as well as memcopying the data (first into the AVIOContext's small write buffer, then into the dynamic buffer's big buffer). This commit changes this: The page header is no longer written into a dynamic buffer any more; instead the (small) page header is written into a small buffer on the stack. The CRC is then calculated directly via av_crc() on both the page header as well as the page data. Then both the page header and the page data are written. Finally, ogg_write_page() can now no longer fail, so it has been modified to return nothing; this also fixed a bug in the only caller of this function: It didn't check the return value. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/vorbiscomment: Switch to AVIOContext from bytestream APIAndreas Rheinhardt2020-05-03
| | | | | | | | | | | | | | | | Up until now ff_vorbiscomment_write() used the bytestream API to write VorbisComments. Therefore the caller had to provide a sufficiently large buffer to write the output. Yet two of the three callers (namely the FLAC and the Matroska muxer) actually want the output to be written via an AVIOContext; therefore they allocated buffers of the right size just for this purpose (i.e. they get freed immediately afterwards). Only the Ogg muxer actually wants a buffer. But given that it is easy to wrap a buffer into an AVIOContext this commit changes ff_vorbiscomment_write() to use an AVIOContext for its output. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/vorbiscomment: Replace AVDictionary ** by const AVDictionary *Andreas Rheinhardt2020-05-03
| | | | | | | | | | | ff_vorbiscomment_write() used an AVDictionary ** parameter for a dictionary whose contents ought to be written; yet this can be replaced by AVDictionary * since commit 042ca05f0fdc5f4d56a3e9b94bc9cd67bca9a4bc; and this in turn can be replaced by const AVDictionary * to indicate that the dictionary isn't modified; the latter also applies to ff_vorbiscomment_length(). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/oggenc: Don't free AVStream's priv_data, fix memleakAndreas Rheinhardt2020-04-20
| | | | | | | | | | | | | | | | | | For FLAC, Speex, Opus and VP8 the Ogg muxer allocates two buffers for building the headers: The first for extradata in an Ogg-specific format and the second contains a Vorbiscomment. These buffers are reachable via pointers in the corresponding AVStream's priv_data. If an error happens during building the headers, the AVStream's priv_data would be freed. This is pointless in general as it would be freed generically anyway, but here it is actively harmful: If the second of the aforementioned allocations fails, the first buffer would leak upon freeing priv_data. This commit stops freeing priv_data manually, which allows the muxer to properly clean up in the deinit function. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat: convert some avio_flush() calls to ↵Marton Balint2020-01-07
| | | | | | | | | | | | | | | | | avio_write_marker(AVIO_DATA_MARKER_FLUSH_POINT) Converting explicit avio_flush() calls helps us to buffer more data and avoid flushing the IO context too often which causes reduced IO throughput for non-streamed file output. The user can control FLUSH_POINT flushing behaviour using the -flush_packets option, the default typically means to flush unless a non-streamed file output is used, so this change should have no adverse effect on streaming even if it is assumed that after an avio_flush() the output buffer is clean so small seekbacks within the output buffer will work even when the IO context is not seekable. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat: remove unneeded avio_flush() calls before calling avio_close_dyn_buf()Marton Balint2020-01-07
| | | | | | avio_close_dyn_buf() also does avio_flush(). Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/oggenc: free buffered page lists while uninitializing the muxerJames Almer2019-10-21
| | | | | | | If the trailer is never writen, there could be buffered pages that would leak. Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/vorbiscomment: add support for writing chaptersPaul B Mahol2018-12-18
| | | | Fixes #7532.
* avformat/oggenc: check for stream private data in ogg_free()James Almer2017-06-22
| | | | | | | | | | Fixes a NULL pointer derefence when ogg_init() returns a failure and a stream's private data was not yet allocated. This is a regression since 3c5a53cdfa099bba8bd951f95b85727b4b3b5d68 Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/oggenc: add ogg_init() and ogg_free()James Almer2017-06-18
| | | | | Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/oggenc: add vp8 muxing supportJames Almer2016-07-20
| | | | | | Addresses ticket #5687 Signed-off-by: James Almer <jamrial@gmail.com>
* avformat: add an Ogg Video muxerJames Almer2016-07-20
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/oggenc: fix page duration calculation when granule differs from ↵James Almer2016-07-19
| | | | | | | timestamp Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/oggenc: always use the time base stored in the theora headerJames Almer2016-07-12
| | | | | | | Fixes ticket #5704 Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/oggenc: make flac the default for oga muxerJames Almer2016-07-11
| | | | | | | | | | This allows simpler selection of flac in ogg from the command line, while following the RFC 5334 recommendation[1] for the oga extension. [1] https://tools.ietf.org/html/rfc5334#section-10.3 Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: James Almer <jamrial@gmail.com>
* Merge commit '9200514ad8717c63f82101dc394f4378854325bf'Derek Buitenhuis2016-04-10
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit '9200514ad8717c63f82101dc394f4378854325bf': lavf: replace AVStream.codec with AVStream.codecpar This has been a HUGE effort from: - Derek Buitenhuis <derek.buitenhuis@gmail.com> - Hendrik Leppkes <h.leppkes@gmail.com> - wm4 <nfxjfg@googlemail.com> - Clément Bœsch <clement@stupeflix.com> - James Almer <jamrial@gmail.com> - Michael Niedermayer <michael@niedermayer.cc> - Rostislav Pehlivanov <atomnuker@gmail.com> Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
| * lavf: replace AVStream.codec with AVStream.codecparAnton Khirnov2016-02-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, AVStream contains an embedded AVCodecContext instance, which is used by demuxers to export stream parameters to the caller and by muxers to receive stream parameters from the caller. It is also used internally as the codec context that is passed to parsers. In addition, it is also widely used by the callers as the decoding (when demuxer) or encoding (when muxing) context, though this has been officially discouraged since Libav 11. There are multiple important problems with this approach: - the fields in AVCodecContext are in general one of * stream parameters * codec options * codec state However, it's not clear which ones are which. It is consequently unclear which fields are a demuxer allowed to set or a muxer allowed to read. This leads to erratic behaviour depending on whether decoding or encoding is being performed or not (and whether it uses the AVStream embedded codec context). - various synchronization issues arising from the fact that the same context is used by several different APIs (muxers/demuxers, parsers, bitstream filters and encoders/decoders) simultaneously, with there being no clear rules for who can modify what and the different processes being typically delayed with respect to each other. - avformat_find_stream_info() making it necessary to support opening and closing a single codec context multiple times, thus complicating the semantics of freeing various allocated objects in the codec context. Those problems are resolved by replacing the AVStream embedded codec context with a newly added AVCodecParameters instance, which stores only the stream parameters exported by the demuxers or read by the muxers.
| * ogg: check memory allocationsFederico Tomassetti2015-02-15
| | | | | | | | | | | | | | Bug-Id: CID 1257795 CC: libav-stable@libav.org Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* | avformat/oggenc: Check segments_count for headers tooMichael Niedermayer2015-08-27
| | | | | | | | | | | | | | Fixes infinite loop and segfault in ogg_buffer_data() Fixes Ticket4806 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avformat/oggenc: Fix return code in case of flushingMichael Niedermayer2015-06-09
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avformat/oggenc: Check ff_vorbiscomment_length in ogg_write_vorbiscomment()Michael Niedermayer2015-05-11
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge commit 'daf8cf358a098a903d59adb6c0d0cc3262a8c93e'Michael Niedermayer2015-02-14
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit 'daf8cf358a098a903d59adb6c0d0cc3262a8c93e': avformat: Don't anonymously typedef structs Conflicts: libavformat/adtsenc.c libavformat/aiffenc.c libavformat/avidec.c libavformat/gif.c libavformat/iff.c libavformat/img2dec.c libavformat/jvdec.c libavformat/matroskadec.c libavformat/udp.c libavformat/wtvdec.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * avformat: Don't anonymously typedef structsDiego Biurrun2015-02-14
| |
* | avformat/oggenc: Simplify by using OFFSET and PARAMMichael Niedermayer2015-02-01
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge commit 'f726fc21ef76a8ba3445448066f7b2a687fbca16'Michael Niedermayer2015-02-01
|\| | | | | | | | | | | | | | | | | | | * commit 'f726fc21ef76a8ba3445448066f7b2a687fbca16': ogg: Provide an option to offset the serial number Conflicts: libavformat/oggenc.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * ogg: Provide an option to offset the serial numberLuca Barbato2015-02-01
| | | | | | | | | | The ogg serial number doubles as codec id and sequence value for concatenated samples.
* | avcodec/xiph: mark returned header pointers const from ↵Michael Niedermayer2014-12-14
| | | | | | | | | | | | | | avpriv_split_xiph_headers() Reviewed-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | lavf/oggenc: use meaningful error codesLukasz Marek2014-12-03
| | | | | | | | Signed-off-by: Lukasz Marek <lukasz.m.luki2@gmail.com>
* | Merge commit 'e839de0f851535b5e19256b52f9865f0cb768a7c'Michael Niedermayer2014-11-06
|\| | | | | | | | | | | | | * commit 'e839de0f851535b5e19256b52f9865f0cb768a7c': oggenc: accept only STREAMINFO extradata Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * oggenc: accept only STREAMINFO extradataAnton Khirnov2014-11-06
| | | | | | | | | | The reasoning is the same as for 0097cbea695e534fce39958ccd103af2fbf65831.
| * oggenc: remove unneeded null checkMichael Niedermayer2014-10-29
| | | | | | | | | | | | | | The code would have segfaulted before if oggstream were NULL. CC: libav-stable@libav.org Bug-Id: CID 732218
* | Merge commit 'eabdc2a830f1ab1a3f12243eb7e2fba801cb81f0'Michael Niedermayer2014-10-14
|\| | | | | | | | | | | | | | | | | | | * commit 'eabdc2a830f1ab1a3f12243eb7e2fba801cb81f0': lavf: use initial_padding instead of deprecated delay Conflicts: libavformat/matroskaenc.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * lavf: use initial_padding instead of deprecated delayAnton Khirnov2014-10-13
| |
* | Merge commit 'f9f34cb9983ec6f4ef119c34b726d3b39c143110'Michael Niedermayer2014-08-23
|\| | | | | | | | | | | | | | | | | | | | | * commit 'f9f34cb9983ec6f4ef119c34b726d3b39c143110': ogg: Use separate classes for the aliases Conflicts: libavformat/oggenc.c See: 2ccc6ff03acc3ca31db1aeb828c747d05b5cb6aa Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * ogg: Use separate classes for the aliasesLuca Barbato2014-08-23
| | | | | | | | Unbreak 051aadeed104ecbe8ee4850ec2d7e5394f5e1ccd
* | Merge commit '051aadeed104ecbe8ee4850ec2d7e5394f5e1ccd'Michael Niedermayer2014-08-22
|\| | | | | | | | | | | | | | | | | | | | | | | | | * commit '051aadeed104ecbe8ee4850ec2d7e5394f5e1ccd': ogg: Provide aliases for Speex, Opus and audio-only ogg Conflicts: Changelog libavformat/oggenc.c libavformat/version.h See: 2ccc6ff03acc3ca31db1aeb828c747d05b5cb6aa Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * ogg: Provide aliases for Speex, Opus and audio-only oggLuca Barbato2014-08-22
| | | | | | | | Since they are aliases for ogg enabling any of them enables ogg as well.
* | Merge commit '194be1f43ea391eb986732707435176e579265aa'Michael Niedermayer2014-06-18
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit '194be1f43ea391eb986732707435176e579265aa': lavf: switch to AVStream.time_base as the hint for the muxer timebase Conflicts: doc/APIchanges libavformat/filmstripenc.c libavformat/movenc.c libavformat/mxfenc.c libavformat/oggenc.c libavformat/swf.h libavformat/version.h tests/ref/lavf/mkv Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * lavf: switch to AVStream.time_base as the hint for the muxer timebaseAnton Khirnov2014-06-18
| | | | | | | | | | | | | | | | | | | | | | | | Previously, AVStream.codec.time_base was used for that purpose, which was quite confusing for the callers. This change also opens the path for removing AVStream.codec. The change in the lavf-mkv test is due to the native timebase (1/1000) being used instead of the default one (1/90000), so the packets are now sent to the crc muxer in the same order in which they are demuxed (previously some of them got reordered because of inexact timestamp conversion).
| * oggenc: Set the right AVOption size for the pref_duration optionMartin Storsjö2014-06-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On big endian machines, the default value set via the faulty AVOption ended up as 2^32 times too big. This fixes the fate-lavf-ogg test which currently is broken on big endian machines, broken since 3831362. Since that commit, a final zero-sized packet is written to the ogg muxer in that test, which caused different flushing behaviour on little and big endian depending on whether the pref_duration option was handled as it should or not. CC: libav-stable@libav.org Signed-off-by: Martin Storsjö <martin@martin.st>
* | Merge commit '95b7fa1729b93bbb3f4fb85a5c0cb53cf970c3c7'Michael Niedermayer2014-06-04
|\| | | | | | | | | | | | | | | | | | | * commit '95b7fa1729b93bbb3f4fb85a5c0cb53cf970c3c7': oggenc: Support flushing the muxer Conflicts: libavformat/version.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * oggenc: Support flushing the muxerMartin Storsjö2014-06-04
| | | | | | | | | | | | | | | | | | This allows the caller to write all buffered data to disk, allowing the caller to know at what byte position in the file a certain packet starts (any packet written after the flush will be located after that byte position). Signed-off-by: Martin Storsjö <martin@martin.st>
| * oggenc: Fix the EOS flagMichael Niedermayer2014-05-28
| | | | | | | | | | | | | | | | | | | | | | This corrects the bug that caused the checksums to change in 9767d7c092c890ecc5953452e8a951fd902dd67b. It caused the EOS flag to be set incorrectly; the ogg spec does not allow it to be set in the middle of a logical bitstream. Signed-off-by: Andrew Kelley <superjoe30@gmail.com> Signed-off-by: Martin Storsjö <martin@martin.st>
* | Merge commit 'efcde917af407a6031ecff68edd51fce7b83d104'Michael Niedermayer2014-05-28
|\| | | | | | | | | | | | | | | | | | | * commit 'efcde917af407a6031ecff68edd51fce7b83d104': vorbiscomment: simplify API by using av_dict_count() Conflicts: libavformat/flacenc.c Merged-by: Michael Niedermayer <michaelni@gmx.at>