[FFmpeg-devel,v2,2/8] avformat/internal: Improve documentation of ff_packet_list_get

Submitted by Andreas Rheinhardt on Aug. 19, 2019, 9:56 p.m.

Details

Message ID 20190819215624.49795-2-andreas.rheinhardt@gmail.com
State New
Headers show

Commit Message

Andreas Rheinhardt Aug. 19, 2019, 9:56 p.m.
The documentation of ff_packet_list_get currently didn't match the
actual usage:
1. It said that the destination packet is supposed to be initialized.
But this makes no sense given that it will be overwritten completely and
flacenc, mp3enc and ttaenc ignored this.
2. ff_packet_list_get returns an int, although it can't fail in case the
packet list is not empty (for which there is an assert). Again, several
callers didn't check for any return value.
In both cases, the documentation has been adapted to match actual usage.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
No changes since last time.

 libavformat/internal.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Michael Niedermayer Sept. 18, 2019, 8:57 p.m.
On Mon, Aug 19, 2019 at 11:56:18PM +0200, Andreas Rheinhardt wrote:
> The documentation of ff_packet_list_get currently didn't match the
> actual usage:
> 1. It said that the destination packet is supposed to be initialized.
> But this makes no sense given that it will be overwritten completely and
> flacenc, mp3enc and ttaenc ignored this.
> 2. ff_packet_list_get returns an int, although it can't fail in case the
> packet list is not empty (for which there is an assert). Again, several
> callers didn't check for any return value.
> In both cases, the documentation has been adapted to match actual usage.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
> No changes since last time.
> 
>  libavformat/internal.h | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)

will apply

thx

[...]

Patch hide | download patch | download mbox

diff --git a/libavformat/internal.h b/libavformat/internal.h
index d6a039c497..163587f416 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -773,13 +773,16 @@  int ff_packet_list_put(AVPacketList **head, AVPacketList **tail,
 
 /**
  * Remove the oldest AVPacket in the list and return it.
+ * The behaviour is undefined if the packet list is empty.
  *
  * @note The pkt will be overwritten completely. The caller owns the
  *       packet and must unref it by itself.
  *
  * @param head List head element
  * @param tail List tail element
- * @param pkt  Pointer to an initialized AVPacket struct
+ * @param pkt  Pointer to an AVPacket struct
+ * @return 0 on success. Success is guaranteed
+ *         if the packet list is not empty.
  */
 int ff_packet_list_get(AVPacketList **head, AVPacketList **tail,
                        AVPacket *pkt);