summaryrefslogtreecommitdiff
path: root/libavcodec/mpeg2_metadata_bsf.c
Commit message (Collapse)AuthorAgeFilesLines
* avcodec/bsf: Add FFBitStreamFilter, hide internals of BSFsAndreas Rheinhardt2022-03-231-5/+5
| | | | | | | | | | This patch is analogous to 20f972701806be20a77f808db332d9489343bb78: It hides the internal part of AVBitStreamFilter by adding a new internal structure FFBitStreamFilter (declared in bsf_internal.h) that has an AVBitStreamFilter as its first member; the internal part of AVBitStreamFilter is moved to this new structure. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* mpeg2_metadata_bsf: Use common cbs bsf implementationMark Thompson2021-01-211-82/+12
| | | | This also adds support for updating new extradata.
* avcodec/cbs: Remove unused function parametersAndreas Rheinhardt2020-07-071-4/+4
| | | | | | | | Several cbs-functions had an unused CodedBitstreamContext parameter. This commit removes these. Reviewed-by: Mark Thompson <sw@jkqxz.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec.h: split bitstream filters API into its own headerAnton Khirnov2020-05-221-0/+1
|
* lavc: rename bsf.h to bsf_internal.hAnton Khirnov2020-05-221-1/+1
| | | | This will allow adding a public header named bsf.h
* mpeg2_metadata, cbs_mpeg2: Fix handling of colour_descriptionAndreas Rheinhardt2019-07-271-0/+12
| | | | | | | | | | | | | | If a sequence display extension is read with colour_description equal to zero, but a user wants to add one or more of the colour_description elements, then the colour_description elements the user did not explicitly request to be set are set to zero and not to the value equal to unknown/unspecified (namely 2). A value of zero is not only inappropriate, but explicitly forbidden. This is fixed by inferring the right default values during the reading process if the elements are absent; moreover, changing any of the colour_description elements to zero is now no longer possible. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* mpeg2_metadata: Localize inserting of sequence display extensionsAndreas Rheinhardt2019-07-071-22/+12
| | | | | | | | | | | | | | If a new sequence display extension had to be added, this was up until now done at two places: One where a sequence display extension was initialized with default values and one where the actual sequence display extension was inserted into the fragment. This division of labour is unnecessary and pointless; it has been changed. Furthermore, if a sequence display extension has to be added, the earlier code set some fields to their default value twice. This has been changed, too. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* mpeg2_metadata: Avoid allocations and copies of packet structuresAndreas Rheinhardt2019-07-071-11/+5
| | | | | | | | | | | This commit changes mpeg2_metadata to (a) use ff_bsf_get_packet_ref instead of ff_bsf_get_packet (thereby avoiding one malloc and free per filtered packet) and (b) to use only one packet structure at all, thereby avoiding a call to av_packet_copy_props. (b) has been made possible by the recent changes to ff_cbs_write_packet. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* libavcodec/cbs: Stop needlessly reallocating the units arrayAndreas Rheinhardt2019-02-251-2/+4
| | | | | | | | | | | | | | | | | Currently, a fragment's unit array is constantly reallocated during splitting of a packet. This commit changes this: One can keep the units array by distinguishing between the number of allocated and the number of valid units in the units array. The more units a packet is split into, the bigger the benefit. So MPEG-2 benefits the most; for a video coming from an NTSC-DVD (usually 32 units per frame) the average cost of cbs_insert_unit (for a single unit) went down from 6717 decicycles to 450 decicycles (based upon 10 runs with 4194304 runs each); if each packet consists of only one unit, it went down from 2425 to 448; for a H.264 video where most packets contain nine units, it went from 4431 to 450. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@googlemail.com>
* avcodec/mpeg2_metadata: unref output packet on failureJames Almer2018-03-201-4/+4
| | | | | | | | Move the check and unref call to the end to be consistent with other bsfs. Reviewed-by: jkqxz Signed-off-by: James Almer <jamrial@gmail.com>
* lavc/mpeg2_metadata_bsf: support dump options.Jun Zhao2018-03-181-6/+7
| | | | | Signed-off-by: Jun Zhao <mypopydev@gmail.com> Signed-off-by: Mark Thompson <sw@jkqxz.net>
* Merge commit 'ce5870a3a8f2b10668ee4f04c2ae0287f66f31b2'Mark Thompson2018-02-211-1/+2
|\ | | | | | | | | | | | | | | | | * commit 'ce5870a3a8f2b10668ee4f04c2ae0287f66f31b2': cbs: Refcount all the things! Some changes for bitstream API. Merged-by: Mark Thompson <sw@jkqxz.net>
| * cbs: Refcount all the things!Mark Thompson2018-02-201-1/+2
| | | | | | | | | | | | | | | | This makes it easier for users of the CBS API to get alloc/free right - all subelements use the buffer API so that it's clear how to free them. It also allows eliding some redundant copies: the packet -> fragment copy disappears after this change if the input packet is refcounted, and more codec-specific cases are now possible (but not included in this patch).
| * cbs: Allocate the context inside the init functionMark Thompson2018-02-201-8/+8
| | | | | | | | | | ... instead of making callers allocate it themselves. This is more consistent with other APIs in libav.
| * mpeg12: Move finding the best frame rate to common codeMark Thompson2017-09-121-53/+5
| | | | | | | | Previously in the mpeg2_metadata filter. Also adds a test.
| * lavc: Add mpeg2_metadata bitstream filterMark Thompson2017-08-201-0/+360
|
* avcodec/mpeg2_metadata_bsf: fix the AVClass version numberJames Almer2017-11-121-1/+1
| | | | | | Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Reviewed-by: jkqxz Signed-off-by: James Almer <jamrial@gmail.com>
* lavc: Add mpeg2_metadata bitstream filterMark Thompson2017-10-171-0/+312
(cherry picked from commit b78c30d7ec26af67c00ce2002709a189f6a87a7e)