@@ -301,7 +301,7 @@ bmf_sdk::CBytes TranscoderBMF::encoder_callback(bmf_sdk::CBytes input) {
301301 }
302302
303303 } else {
304- BMFLOG (BMF_WARNING) << " Failed to extract frame number" ;
304+ BMFLOG (BMF_WARNING) << " Failed to extract frame number from: " << str_info ;
305305 }
306306
307307 uint8_t bytes[] = {97 , 98 , 99 , 100 , 101 , 0 };
@@ -448,7 +448,7 @@ bool TranscoderBMF::transcode(std::string input_path, std::string output_path) {
448448 auto graph = bmf::builder::Graph (bmf::builder::NormalMode);
449449
450450 auto decoder =
451- graph.Decode (bmf_sdk::JsonParam (decoder_para), " " , scheduler_cnt++ );
451+ graph.Decode (bmf_sdk::JsonParam (decoder_para), " " , scheduler_cnt);
452452
453453 if (algo_mode == AlgoMode::Upscale) {
454454 int upscale_factor = encode_parameter->get_upscale_factor ();
@@ -467,13 +467,13 @@ bool TranscoderBMF::transcode(std::string input_path, std::string output_path) {
467467 module_path,
468468 " enhance_module.EnhanceModule" ,
469469 bmf::builder::Immediate,
470- scheduler_cnt++ ));
470+ scheduler_cnt));
471471 }
472472
473473 auto encoder =
474474 graph.Encode (algo_mode == AlgoMode::Upscale ? *algo_node : decoder[" video" ],
475475 decoder[" audio" ],
476- bmf_sdk::JsonParam (encoder_para), " " , scheduler_cnt++ );
476+ bmf_sdk::JsonParam (encoder_para), " " , scheduler_cnt);
477477
478478 auto de_callback = std::bind (&TranscoderBMF::decoder_callback, this ,
479479 std::placeholders::_1);
@@ -482,8 +482,13 @@ bool TranscoderBMF::transcode(std::string input_path, std::string output_path) {
482482
483483 decoder.AddCallback (
484484 0 , std::function<bmf_sdk::CBytes (bmf_sdk::CBytes)>(de_callback));
485- encoder.AddCallback (
486- 0 , std::function<bmf_sdk::CBytes (bmf_sdk::CBytes)>(en_callback));
485+ if (algo_mode != AlgoMode::None) {
486+ algo_node->AddCallback (
487+ 0 , std::function<bmf_sdk::CBytes (bmf_sdk::CBytes)>(en_callback));
488+ } else {
489+ encoder.AddCallback (
490+ 0 , std::function<bmf_sdk::CBytes (bmf_sdk::CBytes)>(en_callback));
491+ }
487492
488493 nlohmann::json graph_para = {{" dump_graph" , 1 }};
489494 graph.SetOption (bmf_sdk::JsonParam (graph_para));
0 commit comments