diff --git a/ffmpeg/decoder.c b/ffmpeg/decoder.c index 67123c5f92..8fd0fa3dd3 100755 --- a/ffmpeg/decoder.c +++ b/ffmpeg/decoder.c @@ -335,7 +335,7 @@ int open_input(input_params *params, struct input_ctx *ctx) char *inp = params->fname; int ret = 0; - ctx->transmuxing = params->transmuxe; + ctx->transmuxing = params->transmuxing; // open demuxer ret = avformat_open_input(&ic, inp, NULL, NULL); @@ -343,16 +343,15 @@ int open_input(input_params *params, struct input_ctx *ctx) ctx->ic = ic; ret = avformat_find_stream_info(ic, NULL); if (ret < 0) LPMS_ERR(open_input_err, "Unable to find input info"); - if (params->transmuxe == 0) { - ret = open_video_decoder(params, ctx); - if (ret < 0) LPMS_ERR(open_input_err, "Unable to open video decoder") - ret = open_audio_decoder(params, ctx); - if (ret < 0) LPMS_ERR(open_input_err, "Unable to open audio decoder") - ctx->last_frame_v = av_frame_alloc(); - if (!ctx->last_frame_v) LPMS_ERR(open_input_err, "Unable to alloc last_frame_v"); - ctx->last_frame_a = av_frame_alloc(); - if (!ctx->last_frame_a) LPMS_ERR(open_input_err, "Unable to alloc last_frame_a"); - } + if (params->transmuxing) return 0; + ret = open_video_decoder(params, ctx); + if (ret < 0) LPMS_ERR(open_input_err, "Unable to open video decoder") + ret = open_audio_decoder(params, ctx); + if (ret < 0) LPMS_ERR(open_input_err, "Unable to open audio decoder") + ctx->last_frame_v = av_frame_alloc(); + if (!ctx->last_frame_v) LPMS_ERR(open_input_err, "Unable to alloc last_frame_v"); + ctx->last_frame_a = av_frame_alloc(); + if (!ctx->last_frame_a) LPMS_ERR(open_input_err, "Unable to alloc last_frame_a"); return 0; diff --git a/ffmpeg/ffmpeg.go b/ffmpeg/ffmpeg.go index b9d3aa9c3b..4625b5a21a 100755 --- a/ffmpeg/ffmpeg.go +++ b/ffmpeg/ffmpeg.go @@ -945,7 +945,7 @@ func (t *Transcoder) Transcode(input *TranscodeOptionsIn, ps []TranscodeOptions) inp := &C.input_params{fname: fname, hw_type: hw_type, device: device, xcoderParams: xcoderParams, handle: t.handle} if input.Transmuxing { - inp.transmuxe = 1 + inp.transmuxing = 1 } results := make([]C.output_results, len(ps)) decoded := &C.output_results{} diff --git a/ffmpeg/transcoder.h b/ffmpeg/transcoder.h index 89ac66c029..846dce1b6e 100755 --- a/ffmpeg/transcoder.h +++ b/ffmpeg/transcoder.h @@ -54,7 +54,8 @@ typedef struct { // Optional video decoder + opts component_opts video; - int transmuxe; + // concatenates multiple inputs into the same output + int transmuxing; } input_params; #define MAX_CLASSIFY_SIZE 10