delete flow_lock;
delete mux_lock;
av_dict_free(&opts);
- delete opt_video_filter;
- delete opt_audio_filter;
+ delete [] opt_video_filter;
+ delete [] opt_audio_filter;
}
int FFMPEG::check_sample_rate(AVCodec *codec, int sample_rate)
}
}
if( !ret ) {
+ if( fmt_ctx->oformat->flags & AVFMT_GLOBALHEADER )
+ st->codec->flags |= CODEC_FLAG_GLOBAL_HEADER;
+
ret = avcodec_open2(st->codec, codec, &sopts);
if( ret < 0 ) {
ff_err(ret,"FFMPEG::open_encoder");
ret = 0;
}
if( !ret ) {
- if( fmt_ctx->oformat->flags & AVFMT_GLOBALHEADER )
- st->codec->flags |= CODEC_FLAG_GLOBAL_HEADER;
if( fst && bsfilter[0] )
fst->add_bsfilter(bsfilter, !bsargs[0] ? 0 : bsargs);
}
AVCodecContext *src_ctx, AVCodecContext *sink_ctx)
{
avfilter_register_all();
+ AVFilter *filter = avfilter_get_by_name(filter_spec);
+ if( !filter || filter->inputs->type != AVMEDIA_TYPE_VIDEO ) {
+ ff_err(AVERROR(EINVAL), "FFVideoStream::create_filter: %s\n", filter_spec);
+ return -1;
+ }
filter_graph = avfilter_graph_alloc();
AVFilter *buffersrc = avfilter_get_by_name("buffer");
AVFilter *buffersink = avfilter_get_by_name("buffersink");
AVCodecContext *src_ctx, AVCodecContext *sink_ctx)
{
avfilter_register_all();
+ AVFilter *filter = avfilter_get_by_name(filter_spec);
+ if( !filter || filter->inputs->type != AVMEDIA_TYPE_AUDIO ) {
+ ff_err(AVERROR(EINVAL), "FFAudioStream::create_filter: %s\n", filter_spec);
+ return -1;
+ }
filter_graph = avfilter_graph_alloc();
AVFilter *buffersrc = avfilter_get_by_name("abuffer");
AVFilter *buffersink = avfilter_get_by_name("abuffersink");