diff options
author | Nicolas George <nicolas.george@normalesup.org> | 2012-04-29 11:10:17 +0200 |
---|---|---|
committer | Nicolas George <nicolas.george@normalesup.org> | 2012-05-03 18:47:16 +0200 |
commit | e296f1b1c4f0b8d4d33f83036a80fd602aca7dea (patch) | |
tree | 3ea33fc4d2cc8b9bf5e2663f0b3fd56669ba7c4a /libavcodec/utils.c | |
parent | c1fe2db3769d1a9e2e8d3ea718e4306648bafede (diff) | |
download | ffmpeg-e296f1b1c4f0b8d4d33f83036a80fd602aca7dea.tar.gz |
lavc: implement accessors for some AVFrame fields.
Compared to av_opt_ptr, accessors bring:
- better performance (negligible);
- compile-time type check;
- link-time existence check
(or at worst, a dynamic linker error instead of a NULL dereference).
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r-- | libavcodec/utils.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 4b6ddeae1c..71227e942a 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -672,6 +672,15 @@ AVFrame *avcodec_alloc_frame(void){ return pic; } +#define MAKE_ACCESSORS(str, name, type, field) \ + type av_##name##_get_##field(const str *s) { return s->field; } \ + void av_##name##_set_##field(str *s, type v) { s->field = v; } + +MAKE_ACCESSORS(AVFrame, frame, int64_t, best_effort_timestamp) +MAKE_ACCESSORS(AVFrame, frame, int64_t, pkt_pos) +MAKE_ACCESSORS(AVFrame, frame, int64_t, channel_layout) +MAKE_ACCESSORS(AVFrame, frame, int, sample_rate) + static void avcodec_get_subtitle_defaults(AVSubtitle *sub) { memset(sub, 0, sizeof(*sub)); |