1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-15 14:13:16 +02:00

Merge commit '8a273a746061a112e5e35066a8fd8e146d821a62'

* commit '8a273a746061a112e5e35066a8fd8e146d821a62':
  avio: Add an internal utility function for freeing dynamic buffers

Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer
2015-02-25 00:32:57 +01:00
2 changed files with 17 additions and 0 deletions

View File

@@ -150,4 +150,11 @@ int ffio_open_null_buf(AVIOContext **s);
*/
int ffio_close_null_buf(AVIOContext *s);
/**
* Free a dynamic buffer.
*
* @param s a pointer to an IO context opened by avio_open_dyn_buf()
*/
void ffio_free_dyn_buf(AVIOContext **s);
#endif /* AVFORMAT_AVIO_INTERNAL_H */

View File

@@ -1117,6 +1117,16 @@ int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer)
return size - padding;
}
void ffio_free_dyn_buf(AVIOContext **s)
{
uint8_t *tmp;
if (!*s)
return;
avio_close_dyn_buf(*s, &tmp);
av_free(tmp);
*s = NULL;
}
static int null_buf_write(void *opaque, uint8_t *buf, int buf_size)
{
DynBuffer *d = opaque;