summaryrefslogtreecommitdiff
path: root/libavcodec/bsf.c
Commit message (Collapse)AuthorAge
* avcodec/bsf: Add FFBitStreamFilter, hide internals of BSFsAndreas Rheinhardt2022-03-23
| | | | | | | | | | 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>
* 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>
* avcodec/bsf: Unref the packet when flushingAndreas Rheinhardt2021-09-14
| | | | | | | | The documentation does not require the packet to be blank in this case (i.e. it can now contain opaque_ref), but it does contain that the contents will be reset upon success. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/bsf: Use null-bsf for passthrough when availableAndreas Rheinhardt2021-09-14
| | | | | | | | When an empty list bsf is used for passthrough, there is a check for every packet in bsf_list_filter() before ff_bsf_get_packet_ref() is called. Directly using the null bsf avoids that. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/bsf: ff_list_bsf staticAndreas Rheinhardt2021-09-08
| | | | | | | | It is a special BSF that is only available via the av_bsf_list-API; it is not part of the list generated from the declarations in bitstream_filters.c and therefore needn't have external linkage. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/bsf: Avoid allocation for AVBSFInternalAndreas Rheinhardt2021-08-25
| | | | | | | | | | Do this by allocating AVBSFContext together with the data that is currently in AVBSFInternal; or rather: Put AVBSFContext at the beginning of a new structure called FFBSFContext (which encompasses more than just the internal fields and is a proper context in its own right, hence the name) and remove the AVBSFInternal altogether. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/bsf: switch to av_get_token to parse bsf list stringGyan Doshi2021-07-04
| | | | | | | | | | The recently added setts bsf makes use of the eval API whose expressions can contain commas. The existing parsing in av_bsf_list_parse_str() uses av_strtok to naively split the string at commas, thus preventing the use of setts filter with expressions containing commas. av_get_token can work with escaped commas, allowing full use of setts.
* avutil: remove deprecated AVClass.child_class_nextJames Almer2021-04-27
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/bsf: Simplify getting codec nameAndreas Rheinhardt2021-04-06
| | | | | | | | All codec ids on BSF whitelists have a codec descriptor, so one can just use avcodec_get_name() without worrying about the case of what happens when no codec descriptor is found. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/bsf: Fix segfault when freeing half-allocated BSFAndreas Rheinhardt2021-04-02
| | | | | | | When allocating a BSF fails, it could happen that the BSF's close function has been called despite a failure to allocate the private data. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* bsf: switch to child_class_iterate()Anton Khirnov2020-06-10
|
* avcodec.h: split bitstream filters API into its own headerAnton Khirnov2020-05-22
|
* lavc: rename bsf.h to bsf_internal.hAnton Khirnov2020-05-22
| | | | This will allow adding a public header named bsf.h
* avcodec/bsf: support shorthand options for av_bsf_list_parse_strMarton Balint2020-05-02
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* avcodec/bsf: simplify the codeLimin Wang2020-04-25
| | | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com> Signed-off-by: Marton Balint <cus@passwd.hu>
* avcodec/bsf: Use macro for "packet is empty"Andreas Rheinhardt2020-04-20
| | | | | Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/bsf: use simplified algorithm for bsf_list chained filteringMarton Balint2020-04-17
| | | | | | Based on the one in ffmpeg.c and it is not using an extra flush_idx variable. Signed-off-by: Marton Balint <cus@passwd.hu>
* avcodec/bsf: Beautify log messages from bitstream filtersAndreas Rheinhardt2020-03-21
| | | | | | | | | | | | | | | | Up until now, the name of every AVBSFContext for logging purposes was "AVBSFContext", so that the default logging callback produced output like "[AVBSFContext @ 0x55813bae92c0] Extradata". This has been changed to "[trace_headers @ 0x60a000000700] Extradata" by adding an item_name- function to the AVClass for bitstream filters. Furthermore, the correct category has been set so that the introductory part before the actual message (everything before "Extradata" in the above examples) are displayed in a different colour than the rest. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/bsf: Don't set defaults for AVClass without optionsAndreas Rheinhardt2020-03-21
| | | | | | | | This happened for AVBSFContext. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/bsf: replace ctx->internal-> with bsfi-> for better readabilityLimin Wang2020-01-04
| | | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavc/bsf: fix memory leak after av_dict_parse_string failJun Zhao2020-01-04
| | | | | | | | | In case of failure, all the successfully set entries are stored in *pm. We need to manually free the created dictionary to avoid memory leak. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
* avcodec/bsf: check that AVBSFInternal was allocated before dereferencing itJames Almer2019-09-23
| | | | | | | This can happen when av_bsf_free() is called on av_bsf_alloc() failure. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec: remove some dead assignmentsMarton Balint2019-08-22
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* avcodec/bsf_list: implement a AVBSFContext.flush callbackJames Almer2019-01-06
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/bsf: add a flushing mechanism to AVBSFContextJames Almer2018-08-16
| | | | | | Meant to reset the internal bsf state without the need to reinitialize it. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/bsf: use av_packet_make_refcounted to ensure packets are ref countedJames Almer2018-04-02
| | | | | | Simplifies code. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/bsf: make sure the AVBSFInternal stored packet is reference countedJames Almer2018-03-23
| | | | | | | | | | | | | | | | | | Some bitstream filters may buffer said packet in their own contexts for latter use. The documentation for av_bsf_send_packet() doesn't forbid feeding it non-reference counted packets, which depending on the way said packets were internally buffered by the bsf it may result in the data described in them becoming invalid or unavailable at any time. This was the case with vp9_superframe after commit e1bc3f4396, which was then promptly fixed in 37f4a093f7 and 7a02b364b6. It is still the case even today with vp9_reorder_raw. With this change the bitstream filters will not have to worry how to store or consume the packets fed to them. Reviewed-by: wm4 <nfxjfg@googlemail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/bsf: Check for packet payload when setting BSF EOF flag.Jan Sebechlebsky2017-04-22
| | | | | | | | Set BSF EOF flag only if pkt == NULL or both data and side data are not present in packet. Signed-off-by: Jan Sebechlebsky <sebechlebskyjan@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* Revert "avcodec/bsf: Forbid packet without payload in av_bsf_send_packet"James Almer2017-04-22
| | | | | | | | | This reverts commit bfdca87ab55c7f69087d962dc47aa45c8c6436fb. Packets with no data or side data will be valid EOF signal in an upcoming merge. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/bsf: fix resource leak in av_bsf_list_parse_strSteven Liu2017-01-11
| | | | | | | | cid: 1396268 when av_strdup(str) error, the lst need release Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avcodec/bsf: Fix av_bsf_list_free()Michael Niedermayer2017-01-08
| | | | | | | Negate null check Fixes CID1396248 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* libavcodec/bsfs: Fix bsf option settingJan Sebechlebsky2016-08-26
| | | | | | | | AV_OPT_SEARCH_CHILDREN flag must be passed to av_opt_set_dict() to set options for private context. Signed-off-by: Jan Sebechlebsky <sebechlebskyjan@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/bsf: Add custom item name function for bsf listJan Sebechlebsky2016-08-21
| | | | | | | | | which will construct string description of filter chain. This is done using lazy-initialization, so there is no overhead if item name is never accessed. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/bsf: Add list BSF APIJan Sebechlebsky2016-08-15
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/bsf: Add ff_bsf_get_packet_ref() functionJan Sebechlebsky2016-08-13
| | | | | | | | Use of this function can save unnecessary malloc operation in bitstream filter. Signed-off-by: Jan Sebechlebsky <sebechlebskyjan@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/bsf: Forbid packet without payload in av_bsf_send_packetJan Sebechlebsky2016-08-13
| | | | | Signed-off-by: Jan Sebechlebsky <sebechlebskyjan@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/bsf: Set EOF flag only in pkt == NULLJan Sebechlebsky2016-08-13
| | | | | | | Set BSF EOF flag only if pkt == NULL in av_bsf_send_packet(). Signed-off-by: Jan Sebechlebsky <sebechlebskyjan@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Merge commit '33d18982fa03feb061c8f744a4f0a9175c1f63ab'Derek Buitenhuis2016-04-17
| | | | | | | | | * commit '33d18982fa03feb061c8f744a4f0a9175c1f63ab': lavc: add a new bitstream filtering API Conversions-by: Hendrik Leppkes <h.leppkes@gmail.com> Conversions-by: Derek Buitenguis <derek.buitenhuis@gmail.com> Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
* lavc: add a new bitstream filtering APIAnton Khirnov2016-03-20
Deprecate the current bitstream filtering API.