History

lavfi/buffersink: add accessors for the stream properties.

av_buffersink_get_frame_rate() did already exist; its argument becomes const.

Nicolas George committed 9 years ago

Commit dbe9dbe1 parent 0b66c454 files · +43 −9Browse files

Unified · Split

4 files
  1. doc/APIchanges +3 −0
  2. libavfilter/buffersink.c +19 −6
  3. libavfilter/buffersink.h +20 −2
  4. libavfilter/version.h +1 −1
doc/APIchanges+3−0
@@ -15,6 +15,9 @@ libavutil: 2015-08-28 · 14 unmodified lines
1515
1616 API changes, most recent first:
1717
18+2017-01-12 - xxxxxxx - lavfi 6.69.100- buffersink.h
19+ Add av_buffersink_get_*() functions.
20+
1821 2017-01-06 - xxxxxxx - lavf 57.62.100- avio.h
1922 Add avio_get_dyn_buf()
2023
libavfilter/buffersink.c+19−6
@@ -279,14 +279,27 @@ void av_buffersink_set_frame_size(AVFilterContext *ctx, unsigned frame_size) · 278 unmodified lines
279279 inlink->partial_buf_size = frame_size;
280280 }
281281
282−AVRational av_buffersink_get_frame_rate(AVFilterContext *ctx)
283−{
284− av_assert0( !strcmp(ctx->filter->name, "buffersink")
285− || !strcmp(ctx->filter->name, "ffbuffersink"));
286−
287− return ctx->inputs[0]->frame_rate;
282+#define MAKE_AVFILTERLINK_ACCESSOR(type, field) \
283+type av_buffersink_get_##field(const AVFilterContext *ctx) { \
284+ av_assert0(ctx->filter->uninit == uninit); \
285+ return ctx->inputs[0]->field; \
288286 }
289287
288+MAKE_AVFILTERLINK_ACCESSOR(enum AVMediaType , type );
289+MAKE_AVFILTERLINK_ACCESSOR(AVRational , time_base );
290+MAKE_AVFILTERLINK_ACCESSOR(int , format );
291+
292+MAKE_AVFILTERLINK_ACCESSOR(AVRational , frame_rate );
293+MAKE_AVFILTERLINK_ACCESSOR(int , w );
294+MAKE_AVFILTERLINK_ACCESSOR(int , h );
295+MAKE_AVFILTERLINK_ACCESSOR(AVRational , sample_aspect_ratio);
296+
297+MAKE_AVFILTERLINK_ACCESSOR(int , channels );
298+MAKE_AVFILTERLINK_ACCESSOR(uint64_t , channel_layout );
299+MAKE_AVFILTERLINK_ACCESSOR(int , sample_rate );
300+
301+MAKE_AVFILTERLINK_ACCESSOR(AVBufferRef * , hw_frames_ctx );
302+
290303 static av_cold int vsink_init(AVFilterContext *ctx, void *opaque)
291304 {
292305 BufferSinkContext *buf = ctx->priv;
libavfilter/buffersink.h+20−2
@@ -101,9 +101,27 @@ AVABufferSinkParams *av_abuffersink_params_alloc(void); · 100 unmodified lines
101101 void av_buffersink_set_frame_size(AVFilterContext *ctx, unsigned frame_size);
102102
103103 /**
104− * Get the frame rate of the input.
104+ * @defgroup lavfi_buffersink_accessors Buffer sink accessors
105+ * Get the properties of the stream
106+ * @{
105107 */
106−AVRational av_buffersink_get_frame_rate(AVFilterContext *ctx);
108+
109+enum AVMediaType av_buffersink_get_type (const AVFilterContext *ctx);
110+AVRational av_buffersink_get_time_base (const AVFilterContext *ctx);
111+int av_buffersink_get_format (const AVFilterContext *ctx);
112+
113+AVRational av_buffersink_get_frame_rate (const AVFilterContext *ctx);
114+int av_buffersink_get_w (const AVFilterContext *ctx);
115+int av_buffersink_get_h (const AVFilterContext *ctx);
116+AVRational av_buffersink_get_sample_aspect_ratio (const AVFilterContext *ctx);
117+
118+int av_buffersink_get_channels (const AVFilterContext *ctx);
119+uint64_t av_buffersink_get_channel_layout (const AVFilterContext *ctx);
120+int av_buffersink_get_sample_rate (const AVFilterContext *ctx);
121+
122+AVBufferRef * av_buffersink_get_hw_frames_ctx (const AVFilterContext *ctx);
123+
124+/** @} */
107125
108126 /**
109127 * Get a frame with filtered data from sink and put it in frame.
libavfilter/version.h+1−1
@@ -30,7 +30,7 @@ · 29 unmodified lines
3030 #include "libavutil/version.h"
3131
3232 #define LIBAVFILTER_VERSION_MAJOR 6
33−#define LIBAVFILTER_VERSION_MINOR 68
33+#define LIBAVFILTER_VERSION_MINOR 69
3434 #define LIBAVFILTER_VERSION_MICRO 100
3535
3636 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_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