* commit 'fd056029f45a9f6d213d9fce8165632042511d4f': lavc: add avcodec_free_context(). Conflicts: doc/APIchanges libavcodec/version.h
Unified · Split
| @@ -15,6 +15,10 @@ libavutil: 2012-10-22 · 14 unmodified lines | ||
| 15 | 15 | |
| 16 | 16 | API changes, most recent first: |
| 17 | 17 | |
| 18 | +2014-04-xx - xxxxxxx - lavc 55.52.0 - avcodec.h | |
| 19 | + Add avcodec_free_context(). From now on it should be used for freeing | |
| 20 | + AVCodecContext. | |
| 21 | + | |
| 18 | 22 | 2014-05-xx - xxxxxxx - lavu 52.84.100 - time.h |
| 19 | 23 | Add av_gettime_relative() av_gettime_relative_is_monotonic() |
| 20 | 24 | |
| @@ -3455,9 +3455,8 @@ void avcodec_register(AVCodec *codec); · 3454 unmodified lines | ||
| 3455 | 3455 | void avcodec_register_all(void); |
| 3456 | 3456 | |
| 3457 | 3457 | /** |
| 3458 | − * Allocate an AVCodecContext and set its fields to default values. The | |
| 3459 | − * resulting struct can be deallocated by calling avcodec_close() on it followed | |
| 3460 | − * by av_free(). | |
| 3458 | + * Allocate an AVCodecContext and set its fields to default values. The | |
| 3459 | + * resulting struct should be freed with avcodec_free_context(). | |
| 3461 | 3460 | * |
| 3462 | 3461 | * @param codec if non-NULL, allocate private data and initialize defaults |
| 3463 | 3462 | * for the given codec. It is illegal to then call avcodec_open2() |
| @@ -3471,6 +3470,12 @@ void avcodec_register_all(void); · 7 unmodified lines | ||
| 3471 | 3470 | */ |
| 3472 | 3471 | AVCodecContext *avcodec_alloc_context3(const AVCodec *codec); |
| 3473 | 3472 | |
| 3473 | +/** | |
| 3474 | + * Free the codec context and everything associated with it and write NULL to | |
| 3475 | + * the provided pointer. | |
| 3476 | + */ | |
| 3477 | +void avcodec_free_context(AVCodecContext **avctx); | |
| 3478 | + | |
| 3474 | 3479 | /** |
| 3475 | 3480 | * Set the fields of the given AVCodecContext to default values corresponding |
| 3476 | 3481 | * to the given codec (defaults may be codec-dependent). |
| @@ -154,6 +154,21 @@ AVCodecContext *avcodec_alloc_context3(const AVCodec *codec) · 153 unmodified lines | ||
| 154 | 154 | return avctx; |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | +void avcodec_free_context(AVCodecContext **pavctx) | |
| 158 | +{ | |
| 159 | + AVCodecContext *avctx = *pavctx; | |
| 160 | + | |
| 161 | + if (!avctx) | |
| 162 | + return; | |
| 163 | + | |
| 164 | + avcodec_close(avctx); | |
| 165 | + | |
| 166 | + av_freep(&avctx->extradata); | |
| 167 | + av_freep(&avctx->subtitle_header); | |
| 168 | + | |
| 169 | + av_freep(pavctx); | |
| 170 | +} | |
| 171 | + | |
| 157 | 172 | int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src) |
| 158 | 173 | { |
| 159 | 174 | const AVCodec *orig_codec = dest->codec; |
| @@ -29,7 +29,7 @@ · 28 unmodified lines | ||
| 29 | 29 | #include "libavutil/version.h" |
| 30 | 30 | |
| 31 | 31 | #define LIBAVCODEC_VERSION_MAJOR 55 |
| 32 | −#define LIBAVCODEC_VERSION_MINOR 62 | |
| 32 | +#define LIBAVCODEC_VERSION_MINOR 63 | |
| 33 | 33 | #define LIBAVCODEC_VERSION_MICRO 100 |
| 34 | 34 | |
| 35 | 35 | #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ |