[FFmpeg-devel,1/2] avcodec/avcodec: Adapt the doc of av_bsf_send_packet

Submitted by Andreas Rheinhardt on Nov. 14, 2019, 2:06 p.m.

Details

Message ID 20191114140627.21943-1-andreas.rheinhardt@gmail.com
State New
Headers show

Commit Message

Andreas Rheinhardt Nov. 14, 2019, 2:06 p.m.
to match its actual implementation.

Explicitly allowing empty packets to signal flushing helps getting rid
of special cases. It does not hinder the ability to send i.e.
timing-only packets, because one can send packets with zero size and
pkt->data set.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavcodec/avcodec.h | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

Comments

James Almer Nov. 14, 2019, 2:22 p.m.
On 11/14/2019 11:06 AM, Andreas Rheinhardt wrote:
> to match its actual implementation.
> 
> Explicitly allowing empty packets to signal flushing helps getting rid
> of special cases. It does not hinder the ability to send i.e.
> timing-only packets, because one can send packets with zero size and
> pkt->data set.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
>  libavcodec/avcodec.h | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index bcb931f0dd..93ab04104a 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -5946,11 +5946,13 @@ int av_bsf_init(AVBSFContext *ctx);
>   *
>   * @param pkt the packet to filter. The bitstream filter will take ownership of
>   * the packet and reset the contents of pkt. pkt is not touched if an error occurs.
> - * This parameter may be NULL, which signals the end of the stream (i.e. no more
> - * packets will be sent). That will cause the filter to output any packets it
> - * may have buffered internally.
> + * If pkt is empty (i.e. NULL or pkt->data and pkt->side_data_elems vanish),

I'm not sure about "vanish". English is not my first language and it was
not clear at first glance that you meant both being NULL.

It's the first time that word is used in the codebase as well, so i
think it's best if we're consistent with the doxy from similar functions.

> + * it signals the end of the stream (i.e. no more non-empty packets will be sent;
> + * sending more empty packets does nothing and will cause the filter to output
> + * any packets it may have buffered internally.
>   *
> - * @return 0 on success, a negative AVERROR on error.
> + * @return 0 on success, a negative AVERROR on error.  This function never fails

Extra blank space.

> + * if pkt is empty.
>   */
>  int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt);
>  
>

Patch hide | download patch | download mbox

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index bcb931f0dd..93ab04104a 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -5946,11 +5946,13 @@  int av_bsf_init(AVBSFContext *ctx);
  *
  * @param pkt the packet to filter. The bitstream filter will take ownership of
  * the packet and reset the contents of pkt. pkt is not touched if an error occurs.
- * This parameter may be NULL, which signals the end of the stream (i.e. no more
- * packets will be sent). That will cause the filter to output any packets it
- * may have buffered internally.
+ * If pkt is empty (i.e. NULL or pkt->data and pkt->side_data_elems vanish),
+ * it signals the end of the stream (i.e. no more non-empty packets will be sent;
+ * sending more empty packets does nothing and will cause the filter to output
+ * any packets it may have buffered internally.
  *
- * @return 0 on success, a negative AVERROR on error.
+ * @return 0 on success, a negative AVERROR on error.  This function never fails
+ * if pkt is empty.
  */
 int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt);