Go to the documentation of this file.
21 const char *sink_name;
42 int main(
int argc,
char **argv)
44 char *in_graph_desc, **out_dev_name;
55 "Usage: %s filter_graph dev:out [dev2:out2...]\n\n"
57 "%s movie=file.nut:s=v+a xv:- alsa:default\n"
58 "%s movie=file.nut:s=v+a uncodedframecrc:pipe:0\n",
59 argv[0], argv[0], argv[0]);
62 in_graph_desc = argv[1];
63 out_dev_name = argv + 2;
64 nb_out_dev = argc - 2;
84 for (j = 0; j <
f->nb_inputs; j++) {
91 for (j = 0; j <
f->nb_outputs; j++)
100 if (nb_out_dev != 1 && nb_out_dev !=
nb_streams) {
102 "Graph has %d output streams, %d devices given\n",
115 for (j = 0; j <
f->nb_outputs; j++) {
116 if (!
f->outputs[j]) {
129 for (
i = 0;
i < nb_out_dev;
i++) {
130 char *fmt =
NULL, *dev = out_dev_name[
i];
132 if ((dev = strchr(dev,
':'))) {
134 fmt = out_dev_name[
i];
153 streams[
i].mux = streams[0].mux;
168 st->stream->avg_frame_rate =
181 st->stream->codecpar->codec_id =
av_get_pcm_codec(st->stream->codecpar->format, -1);
189 for (
i = 0;
i < nb_out_dev;
i++) {
204 "Uncoded frames not supported on stream #%d: %s\n",
240 st->stream->time_base);
255 for (
i = 0;
i < nb_out_dev;
i++) {
264 for (
i = 0;
i < nb_out_dev;
i++) {
#define AV_LOG_WARNING
Something somehow does not look correct.
int av_buffersink_get_ch_layout(const AVFilterContext *ctx, AVChannelLayout *out)
AVRational av_buffersink_get_sample_aspect_ratio(const AVFilterContext *ctx)
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
AVStream * avformat_new_stream(AVFormatContext *s, const struct AVCodec *c)
Add a new stream to a media file.
#define AVERROR_EOF
End of file.
int attribute_align_arg av_buffersink_get_frame_flags(AVFilterContext *ctx, AVFrame *frame, int flags)
Get a frame with filtered data from sink and put it in frame.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
This structure describes decoded (raw) audio or video data.
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
int av_write_uncoded_frame_query(AVFormatContext *s, int stream_index)
Test whether a muxer supports uncoded frame.
void avfilter_graph_free(AVFilterGraph **graph)
Free a graph, destroy its links, and set *graph to NULL.
int avfilter_graph_create_filter(AVFilterContext **filt_ctx, const AVFilter *filt, const char *name, const char *args, void *opaque, AVFilterGraph *graph_ctx)
Create and add a filter instance into an existing graph.
int avio_open2(AVIOContext **s, const char *url, int flags, const AVIOInterruptCB *int_cb, AVDictionary **options)
Create and initialize a AVIOContext for accessing the resource indicated by url.
AVFilterGraph * avfilter_graph_alloc(void)
Allocate a filter graph.
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
AVRational av_buffersink_get_frame_rate(const AVFilterContext *ctx)
int av_buffersink_get_format(const AVFilterContext *ctx)
AVRational av_buffersink_get_time_base(const AVFilterContext *ctx)
#define av_assert0(cond)
assert() equivalent, that is always enabled.
#define AVIO_FLAG_WRITE
write-only
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
av_warn_unused_result int avformat_write_header(AVFormatContext *s, AVDictionary **options)
Allocate the stream private data and write the stream header to an output media file.
const AVFilter * avfilter_get_by_name(const char *name)
Get a filter definition matching the given name.
int avfilter_graph_config(AVFilterGraph *graphctx, void *log_ctx)
Check validity and configure all the links and formats in the graph.
AVFilterContext ** filters
int avfilter_graph_request_oldest(AVFilterGraph *graph)
Request a frame on the oldest sink link.
static int create_sink(Stream *st, AVFilterGraph *graph, AVFilterContext *f, int idx)
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
int avfilter_link(AVFilterContext *src, unsigned srcpad, AVFilterContext *dst, unsigned dstpad)
Link two filters together.
#define AV_NOPTS_VALUE
Undefined timestamp value.
enum AVMediaType av_buffersink_get_type(const AVFilterContext *ctx)
int av_buffersink_get_w(const AVFilterContext *ctx)
int avio_closep(AVIOContext **s)
Close the resource accessed by the AVIOContext *s, free it and set the pointer pointing to it to NULL...
int av_write_trailer(AVFormatContext *s)
Write the stream trailer to an output media file and free the file private data.
#define i(width, name, range_min, range_max)
int avfilter_graph_parse_ptr(AVFilterGraph *graph, const char *filters, AVFilterInOut **inputs, AVFilterInOut **outputs, void *log_ctx)
Add a graph described by a string to a graph.
void * av_calloc(size_t nmemb, size_t size)
int av_buffersink_get_h(const AVFilterContext *ctx)
#define AV_BUFFERSINK_FLAG_NO_REQUEST
Tell av_buffersink_get_buffer_ref() not to request a frame from its input.
enum AVMediaType avfilter_pad_get_type(const AVFilterPad *pads, int pad_idx)
Get the type of an AVFilterPad.
int av_buffersink_get_sample_rate(const AVFilterContext *ctx)
int main(int argc, char **argv)
void avformat_free_context(AVFormatContext *s)
Free an AVFormatContext and all its streams.
enum AVCodecID av_get_pcm_codec(enum AVSampleFormat fmt, int be)
Return the PCM codec associated with a sample format.
int av_interleaved_write_uncoded_frame(AVFormatContext *s, int stream_index, struct AVFrame *frame)
Write an uncoded frame to an output media file.
void avdevice_register_all(void)
Initialize libavdevice and register all the input and output devices.