History

lavc: add avcodec_free_frame().

Since an AVFrame now has malloced members (extended_data), it must have a destructor.

Anton Khirnov committed 14 years ago

Commit a42aada1 parent b437cec4 files · +33 −2Browse files

Unified · Split

4 files
  1. doc/APIchanges +4 −0
  2. libavcodec/avcodec.h +13 −1
  3. libavcodec/utils.c +15 −0
  4. libavcodec/version.h +1 −1
doc/APIchanges+4−0
@@ -13,6 +13,10 @@ libavutil: 2011-04-18 · 12 unmodified lines
13 13
14API changes, most recent first:14API changes, most recent first:
15 15
162012-09-23 - xxxxxxx - lavc 54.28.0 - avcodec.h
17 Add avcodec_free_frame(). This function must now
18 be used for freeing an AVFrame.
19
162012-09-12 - xxxxxxx - lavu 51.41.0 - audioconvert.h202012-09-12 - xxxxxxx - lavu 51.41.0 - audioconvert.h
17 Added AV_CH_LOW_FREQUENCY_2 channel mask value.21 Added AV_CH_LOW_FREQUENCY_2 channel mask value.
18 22
libavcodec/avcodec.h+13−1
@@ -3257,7 +3257,7 @@ int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src); · 3256 unmodified lines
3257 3257
3258/**3258/**
3259 * Allocate an AVFrame and set its fields to default values. The resulting3259 * Allocate an AVFrame and set its fields to default values. The resulting
3260 * struct can be deallocated by simply calling av_free().3260 * struct must be freed using avcodec_free_frame().
3261 *3261 *
3262 * @return An AVFrame filled with default values or NULL on failure.3262 * @return An AVFrame filled with default values or NULL on failure.
3263 * @see avcodec_get_frame_defaults3263 * @see avcodec_get_frame_defaults
@@ -3271,6 +3271,18 @@ AVFrame *avcodec_alloc_frame(void); · 7 unmodified lines
3271 */3271 */
3272void avcodec_get_frame_defaults(AVFrame *frame);3272void avcodec_get_frame_defaults(AVFrame *frame);
3273 3273
3274/**
3275 * Free the frame and any dynamically allocated objects in it,
3276 * e.g. extended_data.
3277 *
3278 * @param frame frame to be freed. The pointer will be set to NULL.
3279 *
3280 * @warning this function does NOT free the data buffers themselves
3281 * (it does not know how, since they might have been allocated with
3282 * a custom get_buffer()).
3283 */
3284void avcodec_free_frame(AVFrame **frame);
3285
3274/**3286/**
3275 * Initialize the AVCodecContext to use the given AVCodec. Prior to using this3287 * Initialize the AVCodecContext to use the given AVCodec. Prior to using this
3276 * function the context has to be allocated with avcodec_alloc_context3().3288 * function the context has to be allocated with avcodec_alloc_context3().
libavcodec/utils.c+15−0
@@ -659,6 +659,21 @@ AVFrame *avcodec_alloc_frame(void) · 658 unmodified lines
659 return frame;659 return frame;
660}660}
661 661
662void avcodec_free_frame(AVFrame **frame)
663{
664 AVFrame *f;
665
666 if (!frame || !*frame)
667 return;
668
669 f = *frame;
670
671 if (f->extended_data != f->data)
672 av_freep(&f->extended_data);
673
674 av_freep(frame);
675}
676
662int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options)677int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options)
663{678{
664 int ret = 0;679 int ret = 0;
libavcodec/version.h+1−1
@@ -27,7 +27,7 @@ · 26 unmodified lines
27 */27 */
28 28
29#define LIBAVCODEC_VERSION_MAJOR 5429#define LIBAVCODEC_VERSION_MAJOR 54
30#define LIBAVCODEC_VERSION_MINOR 2730#define LIBAVCODEC_VERSION_MINOR 28
31#define LIBAVCODEC_VERSION_MICRO 031#define LIBAVCODEC_VERSION_MICRO 0
32 32
33#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \33#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t