History

Merge commit 'fd056029f45a9f6d213d9fce8165632042511d4f'

* commit 'fd056029f45a9f6d213d9fce8165632042511d4f': lavc: add avcodec_free_context(). Conflicts: doc/APIchanges libavcodec/version.h

Michael Niedermayer committed 12 years ago

Commit 68c05182 parents ff17d8b fd056024 files · +28 −4Browse files

Unified · Split

4 files
  1. doc/APIchanges +4 −0
  2. libavcodec/avcodec.h +8 −3
  3. libavcodec/options.c +15 −0
  4. libavcodec/version.h +1 −1
doc/APIchanges+4−0
@@ -15,6 +15,10 @@ libavutil: 2012-10-22 · 14 unmodified lines
1515
1616 API changes, most recent first:
1717
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+
1822 2014-05-xx - xxxxxxx - lavu 52.84.100 - time.h
1923 Add av_gettime_relative() av_gettime_relative_is_monotonic()
2024
libavcodec/avcodec.h+8−3
@@ -3455,9 +3455,8 @@ void avcodec_register(AVCodec *codec); · 3454 unmodified lines
34553455 void avcodec_register_all(void);
34563456
34573457 /**
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().
34613460 *
34623461 * @param codec if non-NULL, allocate private data and initialize defaults
34633462 * for the given codec. It is illegal to then call avcodec_open2()
@@ -3471,6 +3470,12 @@ void avcodec_register_all(void); · 7 unmodified lines
34713470 */
34723471 AVCodecContext *avcodec_alloc_context3(const AVCodec *codec);
34733472
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+
34743479 /**
34753480 * Set the fields of the given AVCodecContext to default values corresponding
34763481 * to the given codec (defaults may be codec-dependent).
libavcodec/options.c+15−0
@@ -154,6 +154,21 @@ AVCodecContext *avcodec_alloc_context3(const AVCodec *codec) · 153 unmodified lines
154154 return avctx;
155155 }
156156
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+
157172 int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src)
158173 {
159174 const AVCodec *orig_codec = dest->codec;
libavcodec/version.h+1−1
@@ -29,7 +29,7 @@ · 28 unmodified lines
2929 #include "libavutil/version.h"
3030
3131 #define LIBAVCODEC_VERSION_MAJOR 55
32−#define LIBAVCODEC_VERSION_MINOR 62
32+#define LIBAVCODEC_VERSION_MINOR 63
3333 #define LIBAVCODEC_VERSION_MICRO 100
3434
3535 #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