}
// Retrieve the parameters of the output filter
- AVFilterLink *link = pv->graph->output->inputs[0];
- init->geometry.width = link->w;
- init->geometry.height = link->h;
- init->geometry.par.num = link->sample_aspect_ratio.num;
- init->geometry.par.den = link->sample_aspect_ratio.den;
- init->pix_fmt = link->format;
- // avfilter can generate "unknown" framerates. If this happens
- // just pass along the source framerate.
- if (link->frame_rate.num > 0 && link->frame_rate.den > 0)
- {
- init->vrate.num = link->frame_rate.num;
- init->vrate.den = link->frame_rate.den;
- }
+ hb_avfilter_graph_update_init(pv->graph, init);
pv->output = *init;
hb_buffer_list_clear(&pv->list);
}
// Retrieve the parameters of the output filter
- hb_filter_init_t * init = &pv->output;
- AVFilterLink *link = pv->graph->output->inputs[0];
- *init = pv->input;
- init->geometry.width = link->w;
- init->geometry.height = link->h;
- init->geometry.par.num = link->sample_aspect_ratio.num;
- init->geometry.par.den = link->sample_aspect_ratio.den;
- init->pix_fmt = link->format;
- // avfilter can generate "unknown" framerates. If this happens
- // just pass along the source framerate.
- if (link->frame_rate.num > 0 && link->frame_rate.den > 0)
- {
- init->vrate.num = link->frame_rate.num;
- init->vrate.den = link->frame_rate.den;
- }
+ pv->output = pv->input;
+ hb_avfilter_graph_update_init(pv->graph, &pv->output);
hb_buffer_list_clear(&pv->list);
}
info->human_readable_desc[0] = 0;
- char * dst = info->human_readable_desc;
- char * start = pv->graph->settings;
+ char * dst = info->human_readable_desc;
+ const char * start = hb_avfilter_graph_settings(pv->graph);
while (start != NULL && *start != 0)
{
// Find end of a filter
#include "libavfilter/avfilter.h"
#include "hbavfilter.h"
-struct hb_avfilter_graph_s
-{
- AVFilterGraph * avgraph;
- AVFilterContext * last;
- AVFilterContext * input;
- AVFilterContext * output;
- char * settings;
- AVFrame * frame;
- AVRational out_time_base;
-};
-
struct hb_filter_private_s
{
int initialized;
#include "hbavfilter.h"
#include "avfilter_priv.h"
+struct hb_avfilter_graph_s
+{
+ AVFilterGraph * avgraph;
+ AVFilterContext * last;
+ AVFilterContext * input;
+ AVFilterContext * output;
+ char * settings;
+ AVFrame * frame;
+ AVRational out_time_base;
+};
+
static AVFilterContext * append_filter( hb_avfilter_graph_t * graph,
const char * name, const char * args)
{
return NULL;
}
+const char * hb_avfilter_graph_settings(hb_avfilter_graph_t * graph)
+{
+ return graph->settings;
+}
+
void hb_avfilter_graph_close(hb_avfilter_graph_t ** _g)
{
hb_avfilter_graph_t * graph = *_g;
*_g = NULL;
}
+void hb_avfilter_graph_update_init(hb_avfilter_graph_t * graph,
+ hb_filter_init_t * init)
+{
+ // Retrieve the parameters of the output filter
+ AVFilterLink *link = graph->output->inputs[0];
+ init->geometry.width = link->w;
+ init->geometry.height = link->h;
+ init->geometry.par.num = link->sample_aspect_ratio.num;
+ init->geometry.par.den = link->sample_aspect_ratio.den;
+ init->pix_fmt = link->format;
+ // avfilter can generate "unknown" framerates. If this happens
+ // just pass along the source framerate.
+ if (link->frame_rate.num > 0 && link->frame_rate.den > 0)
+ {
+ init->vrate.num = link->frame_rate.num;
+ init->vrate.den = link->frame_rate.den;
+ }
+}
+
int hb_avfilter_add_frame(hb_avfilter_graph_t * graph, AVFrame * frame)
{
return av_buffersrc_add_frame(graph->input, frame);
typedef struct hb_avfilter_graph_s hb_avfilter_graph_t;
-hb_avfilter_graph_t * hb_avfilter_graph_init(hb_value_t * settings,
- hb_filter_init_t * init);
-void hb_avfilter_graph_close(hb_avfilter_graph_t ** _g);
+hb_avfilter_graph_t *
+hb_avfilter_graph_init(hb_value_t * settings, hb_filter_init_t * init);
-int hb_avfilter_add_frame(hb_avfilter_graph_t * graph, AVFrame * frame);
-int hb_avfilter_get_frame(hb_avfilter_graph_t * graph, AVFrame * frame);
-int hb_avfilter_add_buf(hb_avfilter_graph_t * graph, hb_buffer_t * in);
-hb_buffer_t * hb_avfilter_get_buf(hb_avfilter_graph_t * graph);
+void hb_avfilter_graph_close(hb_avfilter_graph_t ** _g);
-void hb_avfilter_append_dict(hb_value_array_t * filters,
- const char * name, hb_dict_t * settings);
+const char *
+hb_avfilter_graph_settings(hb_avfilter_graph_t * graph);
-void hb_avfilter_combine(hb_list_t * list);
+void hb_avfilter_graph_update_init(hb_avfilter_graph_t * graph,
+ hb_filter_init_t * init);
+
+int hb_avfilter_add_frame(hb_avfilter_graph_t * graph, AVFrame * frame);
+
+int hb_avfilter_get_frame(hb_avfilter_graph_t * graph, AVFrame * frame);
+
+int hb_avfilter_add_buf(hb_avfilter_graph_t * graph, hb_buffer_t * in);
+
+hb_buffer_t *
+hb_avfilter_get_buf(hb_avfilter_graph_t * graph);
+
+void hb_avfilter_append_dict(hb_value_array_t * filters,
+ const char * name, hb_dict_t * settings);
+
+void hb_avfilter_combine(hb_list_t * list);
#endif // HB_AVFILTER_H