Commit a48979d7 authored by Reimar Döffinger's avatar Reimar Döffinger

Reduce MAKE_ACCESSORS code duplication via a new header.

Signed-off-by: 's avatarReimar Döffinger <Reimar.Doeffinger@gmx.de>
parent 55a88daf
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
*/ */
#include "config.h" #include "config.h"
#include "libavutil/accessors.h"
#include "libavutil/atomic.h" #include "libavutil/atomic.h"
#include "libavutil/attributes.h" #include "libavutil/attributes.h"
#include "libavutil/avassert.h" #include "libavutil/avassert.h"
...@@ -1029,10 +1030,6 @@ void avcodec_free_frame(AVFrame **frame) ...@@ -1029,10 +1030,6 @@ void avcodec_free_frame(AVFrame **frame)
av_freep(frame); av_freep(frame);
} }
#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(AVCodecContext, codec, AVRational, pkt_timebase) MAKE_ACCESSORS(AVCodecContext, codec, AVRational, pkt_timebase)
MAKE_ACCESSORS(AVCodecContext, codec, const AVCodecDescriptor *, codec_descriptor) MAKE_ACCESSORS(AVCodecContext, codec, const AVCodecDescriptor *, codec_descriptor)
MAKE_ACCESSORS(AVCodecContext, codec, int, lowres) MAKE_ACCESSORS(AVCodecContext, codec, int, lowres)
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include "libavcodec/internal.h" #include "libavcodec/internal.h"
#include "libavcodec/raw.h" #include "libavcodec/raw.h"
#include "libavcodec/bytestream.h" #include "libavcodec/bytestream.h"
#include "libavutil/accessors.h"
#include "libavutil/avassert.h" #include "libavutil/avassert.h"
#include "libavutil/opt.h" #include "libavutil/opt.h"
#include "libavutil/dict.h" #include "libavutil/dict.h"
...@@ -98,10 +99,6 @@ static int64_t wrap_timestamp(AVStream *st, int64_t timestamp) ...@@ -98,10 +99,6 @@ static int64_t wrap_timestamp(AVStream *st, int64_t timestamp)
return timestamp; return timestamp;
} }
#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(AVStream, stream, AVRational, r_frame_rate) MAKE_ACCESSORS(AVStream, stream, AVRational, r_frame_rate)
/* an arbitrarily chosen "sane" max packet size -- 50M */ /* an arbitrarily chosen "sane" max packet size -- 50M */
......
#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; }
...@@ -27,9 +27,7 @@ ...@@ -27,9 +27,7 @@
#include "mem.h" #include "mem.h"
#include "samplefmt.h" #include "samplefmt.h"
#define MAKE_ACCESSORS(str, name, type, field) \ #include "accessors.h"
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, best_effort_timestamp)
MAKE_ACCESSORS(AVFrame, frame, int64_t, pkt_duration) MAKE_ACCESSORS(AVFrame, frame, int64_t, pkt_duration)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment