////////////////////////////////////////////////////////// // GENERATED BY FLUTTIFY. DO NOT EDIT IT. ////////////////////////////////////////////////////////// #import "TencentLiveFluttifyPlugin.h" #import #import "SubHandler/SubHandler0.h" #import "SubHandler/SubHandler1.h" #import "SubHandler/SubHandler2.h" #import "SubHandler/SubHandler3.h" #import "SubHandler/SubHandler4.h" #import "SubHandler/Custom/SubHandlerCustom.h" #import "FluttifyMessageCodec.h" // Dart端一次方法调用所存在的栈, 只有当MethodChannel传递参数受限时, 再启用这个容器 extern NSMutableDictionary* STACK; // Dart端随机存取对象的容器 extern NSMutableDictionary* HEAP; // 日志打印开关 extern BOOL enableLog; @implementation TencentLiveFluttifyPlugin { NSMutableDictionary* _handlerMap; } - (instancetype) initWithFlutterPluginRegistrar: (NSObject *) registrar { self = [super init]; if (self) { _registrar = registrar; // 处理方法们 _handlerMap = @{}.mutableCopy; [_handlerMap addEntriesFromDictionary: [self getSubHandler0]]; [_handlerMap addEntriesFromDictionary: [self getSubHandler1]]; [_handlerMap addEntriesFromDictionary: [self getSubHandler2]]; [_handlerMap addEntriesFromDictionary: [self getSubHandler3]]; [_handlerMap addEntriesFromDictionary: [self getSubHandler4]]; [_handlerMap addEntriesFromDictionary: [self getSubHandlerCustom]]; } return self; } + (void)registerWithRegistrar:(NSObject *)registrar { FlutterMethodChannel *channel = [FlutterMethodChannel methodChannelWithName:@"com.fluttify/tencent_live_fluttify" binaryMessenger:[registrar messenger] codec:[FlutterStandardMethodCodec codecWithReaderWriter:[[FluttifyReaderWriter alloc] init]]]; [registrar addMethodCallDelegate:[[TencentLiveFluttifyPlugin alloc] initWithFlutterPluginRegistrar:registrar] channel:channel]; // 注册View } // Method Handlers - (void)handleMethodCall:(FlutterMethodCall *)methodCall result:(FlutterResult)methodResult { if (_handlerMap[methodCall.method] != nil) { _handlerMap[methodCall.method](_registrar, [methodCall arguments], methodResult); } else { methodResult(FlutterMethodNotImplemented); } } // 委托方法们 - (void)onLog : (NSString*)log LogLevel: (int)level WhichModule: (NSString*)module { FlutterMethodChannel *channel = [FlutterMethodChannel methodChannelWithName:@"TXLiveBaseDelegate::Callback" binaryMessenger:[_registrar messenger] codec:[FlutterStandardMethodCodec codecWithReaderWriter:[[FluttifyReaderWriter alloc] init]]]; // print log if (enableLog) { NSLog(@"TXLiveBaseDelegate::onLog_LogLevel_WhichModule"); } // convert to jsonable arg // ref callback arg NSString* arglog = log; // primitive callback arg NSNumber* arglevel = @(level); // ref callback arg NSString* argmodule = module; dispatch_async(dispatch_get_main_queue(), ^{ [channel invokeMethod:@"Callback::TXLiveBaseDelegate::onLog_LogLevel_WhichModule" arguments:@{@"log": arglog == nil ? [NSNull null] : arglog, @"level": arglevel == nil ? [NSNull null] : arglevel, @"module": argmodule == nil ? [NSNull null] : argmodule}]; }); } - (void)onPreviewProgress : (CGFloat)time { FlutterMethodChannel *channel = [FlutterMethodChannel methodChannelWithName:@"TXVideoPreviewListener::Callback" binaryMessenger:[_registrar messenger] codec:[FlutterStandardMethodCodec codecWithReaderWriter:[[FluttifyReaderWriter alloc] init]]]; // print log if (enableLog) { NSLog(@"TXVideoPreviewListener::onPreviewProgress"); } // convert to jsonable arg // primitive callback arg NSNumber* argtime = @(time); dispatch_async(dispatch_get_main_queue(), ^{ [channel invokeMethod:@"Callback::TXVideoPreviewListener::onPreviewProgress" arguments:@{@"time": argtime == nil ? [NSNull null] : argtime}]; }); } - (void)onPreviewFinished { FlutterMethodChannel *channel = [FlutterMethodChannel methodChannelWithName:@"TXVideoPreviewListener::Callback" binaryMessenger:[_registrar messenger] codec:[FlutterStandardMethodCodec codecWithReaderWriter:[[FluttifyReaderWriter alloc] init]]]; // print log if (enableLog) { NSLog(@"TXVideoPreviewListener::onPreviewFinished"); } // convert to jsonable arg dispatch_async(dispatch_get_main_queue(), ^{ [channel invokeMethod:@"Callback::TXVideoPreviewListener::onPreviewFinished" arguments:@{}]; }); } - (void)onTextureDestoryed { FlutterMethodChannel *channel = [FlutterMethodChannel methodChannelWithName:@"TXVideoCustomProcessListener::Callback" binaryMessenger:[_registrar messenger] codec:[FlutterStandardMethodCodec codecWithReaderWriter:[[FluttifyReaderWriter alloc] init]]]; // print log if (enableLog) { NSLog(@"TXVideoCustomProcessListener::onTextureDestoryed"); } // convert to jsonable arg dispatch_async(dispatch_get_main_queue(), ^{ [channel invokeMethod:@"Callback::TXVideoCustomProcessListener::onTextureDestoryed" arguments:@{}]; }); } - (void)onGenerateProgress : (float)progress { FlutterMethodChannel *channel = [FlutterMethodChannel methodChannelWithName:@"TXVideoGenerateListener::Callback" binaryMessenger:[_registrar messenger] codec:[FlutterStandardMethodCodec codecWithReaderWriter:[[FluttifyReaderWriter alloc] init]]]; // print log if (enableLog) { NSLog(@"TXVideoGenerateListener::onGenerateProgress"); } // convert to jsonable arg // primitive callback arg NSNumber* argprogress = @(progress); dispatch_async(dispatch_get_main_queue(), ^{ [channel invokeMethod:@"Callback::TXVideoGenerateListener::onGenerateProgress" arguments:@{@"progress": argprogress == nil ? [NSNull null] : argprogress}]; }); } - (void)onGenerateComplete : (TXGenerateResult*)result { FlutterMethodChannel *channel = [FlutterMethodChannel methodChannelWithName:@"TXVideoGenerateListener::Callback" binaryMessenger:[_registrar messenger] codec:[FlutterStandardMethodCodec codecWithReaderWriter:[[FluttifyReaderWriter alloc] init]]]; // print log if (enableLog) { NSLog(@"TXVideoGenerateListener::onGenerateComplete"); } // convert to jsonable arg // ref callback arg TXGenerateResult* argresult = result; dispatch_async(dispatch_get_main_queue(), ^{ [channel invokeMethod:@"Callback::TXVideoGenerateListener::onGenerateComplete" arguments:@{@"result": argresult == nil ? [NSNull null] : argresult}]; }); } - (void)onJoinProgress : (float)progress { FlutterMethodChannel *channel = [FlutterMethodChannel methodChannelWithName:@"TXVideoJoinerListener::Callback" binaryMessenger:[_registrar messenger] codec:[FlutterStandardMethodCodec codecWithReaderWriter:[[FluttifyReaderWriter alloc] init]]]; // print log if (enableLog) { NSLog(@"TXVideoJoinerListener::onJoinProgress"); } // convert to jsonable arg // primitive callback arg NSNumber* argprogress = @(progress); dispatch_async(dispatch_get_main_queue(), ^{ [channel invokeMethod:@"Callback::TXVideoJoinerListener::onJoinProgress" arguments:@{@"progress": argprogress == nil ? [NSNull null] : argprogress}]; }); } - (void)onJoinComplete : (TXJoinerResult*)result { FlutterMethodChannel *channel = [FlutterMethodChannel methodChannelWithName:@"TXVideoJoinerListener::Callback" binaryMessenger:[_registrar messenger] codec:[FlutterStandardMethodCodec codecWithReaderWriter:[[FluttifyReaderWriter alloc] init]]]; // print log if (enableLog) { NSLog(@"TXVideoJoinerListener::onJoinComplete"); } // convert to jsonable arg // ref callback arg TXJoinerResult* argresult = result; dispatch_async(dispatch_get_main_queue(), ^{ [channel invokeMethod:@"Callback::TXVideoJoinerListener::onJoinComplete" arguments:@{@"result": argresult == nil ? [NSNull null] : argresult}]; }); } - (void)onRecordProgress : (NSInteger)milliSecond { FlutterMethodChannel *channel = [FlutterMethodChannel methodChannelWithName:@"TXLiveRecordListener::Callback" binaryMessenger:[_registrar messenger] codec:[FlutterStandardMethodCodec codecWithReaderWriter:[[FluttifyReaderWriter alloc] init]]]; // print log if (enableLog) { NSLog(@"TXLiveRecordListener::onRecordProgress"); } // convert to jsonable arg // primitive callback arg NSNumber* argmilliSecond = @(milliSecond); dispatch_async(dispatch_get_main_queue(), ^{ [channel invokeMethod:@"Callback::TXLiveRecordListener::onRecordProgress" arguments:@{@"milliSecond": argmilliSecond == nil ? [NSNull null] : argmilliSecond}]; }); } - (void)onRecordComplete : (TXRecordResult*)result { FlutterMethodChannel *channel = [FlutterMethodChannel methodChannelWithName:@"TXLiveRecordListener::Callback" binaryMessenger:[_registrar messenger] codec:[FlutterStandardMethodCodec codecWithReaderWriter:[[FluttifyReaderWriter alloc] init]]]; // print log if (enableLog) { NSLog(@"TXLiveRecordListener::onRecordComplete"); } // convert to jsonable arg // ref callback arg TXRecordResult* argresult = result; dispatch_async(dispatch_get_main_queue(), ^{ [channel invokeMethod:@"Callback::TXLiveRecordListener::onRecordComplete" arguments:@{@"result": argresult == nil ? [NSNull null] : argresult}]; }); } - (void)onRecordEvent : (NSDictionary*)evt { FlutterMethodChannel *channel = [FlutterMethodChannel methodChannelWithName:@"TXLiveRecordListener::Callback" binaryMessenger:[_registrar messenger] codec:[FlutterStandardMethodCodec codecWithReaderWriter:[[FluttifyReaderWriter alloc] init]]]; // print log if (enableLog) { NSLog(@"TXLiveRecordListener::onRecordEvent"); } // convert to jsonable arg // ref callback arg NSDictionary* argevt = evt; dispatch_async(dispatch_get_main_queue(), ^{ [channel invokeMethod:@"Callback::TXLiveRecordListener::onRecordEvent" arguments:@{@"evt": argevt == nil ? [NSNull null] : argevt}]; }); } - (void)onAVRoomStatus : (NSArray*)array { FlutterMethodChannel *channel = [FlutterMethodChannel methodChannelWithName:@"TXCAVRoomListener::Callback" binaryMessenger:[_registrar messenger] codec:[FlutterStandardMethodCodec codecWithReaderWriter:[[FluttifyReaderWriter alloc] init]]]; // print log if (enableLog) { NSLog(@"TXCAVRoomListener::onAVRoomStatus"); } // convert to jsonable arg // ref callback arg NSArray* argarray = array; dispatch_async(dispatch_get_main_queue(), ^{ [channel invokeMethod:@"Callback::TXCAVRoomListener::onAVRoomStatus" arguments:@{@"array": argarray == nil ? [NSNull null] : argarray}]; }); } - (void)onRecordRawPcmData : (NSData*)data timeStamp: (unsigned long long)timeStamp sampleRate: (int)sampleRate channels: (int)channels withBgm: (BOOL)withBgm { FlutterMethodChannel *channel = [FlutterMethodChannel methodChannelWithName:@"TXAudioCustomProcessDelegate::Callback" binaryMessenger:[_registrar messenger] codec:[FlutterStandardMethodCodec codecWithReaderWriter:[[FluttifyReaderWriter alloc] init]]]; // print log if (enableLog) { NSLog(@"TXAudioCustomProcessDelegate::onRecordRawPcmData_timeStamp_sampleRate_channels_withBgm"); } // convert to jsonable arg // ref callback arg NSData* argdata = data; // primitive callback arg NSNumber* argtimeStamp = @(timeStamp); // primitive callback arg NSNumber* argsampleRate = @(sampleRate); // primitive callback arg NSNumber* argchannels = @(channels); // primitive callback arg NSNumber* argwithBgm = @(withBgm); dispatch_async(dispatch_get_main_queue(), ^{ [channel invokeMethod:@"Callback::TXAudioCustomProcessDelegate::onRecordRawPcmData_timeStamp_sampleRate_channels_withBgm" arguments:@{@"data": argdata == nil ? [NSNull null] : argdata, @"timeStamp": argtimeStamp == nil ? [NSNull null] : argtimeStamp, @"sampleRate": argsampleRate == nil ? [NSNull null] : argsampleRate, @"channels": argchannels == nil ? [NSNull null] : argchannels, @"withBgm": argwithBgm == nil ? [NSNull null] : argwithBgm}]; }); } - (void)onRecordPcmData : (NSData*)data timeStamp: (unsigned long long)timeStamp sampleRate: (int)sampleRate channels: (int)channels { FlutterMethodChannel *channel = [FlutterMethodChannel methodChannelWithName:@"TXAudioCustomProcessDelegate::Callback" binaryMessenger:[_registrar messenger] codec:[FlutterStandardMethodCodec codecWithReaderWriter:[[FluttifyReaderWriter alloc] init]]]; // print log if (enableLog) { NSLog(@"TXAudioCustomProcessDelegate::onRecordPcmData_timeStamp_sampleRate_channels"); } // convert to jsonable arg // ref callback arg NSData* argdata = data; // primitive callback arg NSNumber* argtimeStamp = @(timeStamp); // primitive callback arg NSNumber* argsampleRate = @(sampleRate); // primitive callback arg NSNumber* argchannels = @(channels); dispatch_async(dispatch_get_main_queue(), ^{ [channel invokeMethod:@"Callback::TXAudioCustomProcessDelegate::onRecordPcmData_timeStamp_sampleRate_channels" arguments:@{@"data": argdata == nil ? [NSNull null] : argdata, @"timeStamp": argtimeStamp == nil ? [NSNull null] : argtimeStamp, @"sampleRate": argsampleRate == nil ? [NSNull null] : argsampleRate, @"channels": argchannels == nil ? [NSNull null] : argchannels}]; }); } - (void)onPlayEvent : (int)EvtID withParam: (NSDictionary*)param { FlutterMethodChannel *channel = [FlutterMethodChannel methodChannelWithName:@"TXLivePlayListener::Callback" binaryMessenger:[_registrar messenger] codec:[FlutterStandardMethodCodec codecWithReaderWriter:[[FluttifyReaderWriter alloc] init]]]; // print log if (enableLog) { NSLog(@"TXLivePlayListener::onPlayEvent_withParam"); } // convert to jsonable arg // primitive callback arg NSNumber* argEvtID = @(EvtID); // ref callback arg NSDictionary* argparam = param; dispatch_async(dispatch_get_main_queue(), ^{ [channel invokeMethod:@"Callback::TXLivePlayListener::onPlayEvent_withParam" arguments:@{@"EvtID": argEvtID == nil ? [NSNull null] : argEvtID, @"param": argparam == nil ? [NSNull null] : argparam}]; }); } - (void)onNetStatus : (NSDictionary*)param { FlutterMethodChannel *channel = [FlutterMethodChannel methodChannelWithName:@"TXLivePlayListener::Callback" binaryMessenger:[_registrar messenger] codec:[FlutterStandardMethodCodec codecWithReaderWriter:[[FluttifyReaderWriter alloc] init]]]; // print log if (enableLog) { NSLog(@"TXLivePlayListener::onNetStatus"); } // convert to jsonable arg // ref callback arg NSDictionary* argparam = param; dispatch_async(dispatch_get_main_queue(), ^{ [channel invokeMethod:@"Callback::TXLivePlayListener::onNetStatus" arguments:@{@"param": argparam == nil ? [NSNull null] : argparam}]; }); } - (void)onAudioInfoChanged : (int)sampleRate channels: (int)channels { FlutterMethodChannel *channel = [FlutterMethodChannel methodChannelWithName:@"TXAudioRawDataDelegate::Callback" binaryMessenger:[_registrar messenger] codec:[FlutterStandardMethodCodec codecWithReaderWriter:[[FluttifyReaderWriter alloc] init]]]; // print log if (enableLog) { NSLog(@"TXAudioRawDataDelegate::onAudioInfoChanged_channels"); } // convert to jsonable arg // primitive callback arg NSNumber* argsampleRate = @(sampleRate); // primitive callback arg NSNumber* argchannels = @(channels); dispatch_async(dispatch_get_main_queue(), ^{ [channel invokeMethod:@"Callback::TXAudioRawDataDelegate::onAudioInfoChanged_channels" arguments:@{@"sampleRate": argsampleRate == nil ? [NSNull null] : argsampleRate, @"channels": argchannels == nil ? [NSNull null] : argchannels}]; }); } - (void)onPcmDataAvailable : (NSData*)data pts: (unsigned long long)timestamp { FlutterMethodChannel *channel = [FlutterMethodChannel methodChannelWithName:@"TXAudioRawDataDelegate::Callback" binaryMessenger:[_registrar messenger] codec:[FlutterStandardMethodCodec codecWithReaderWriter:[[FluttifyReaderWriter alloc] init]]]; // print log if (enableLog) { NSLog(@"TXAudioRawDataDelegate::onPcmDataAvailable_pts"); } // convert to jsonable arg // ref callback arg NSData* argdata = data; // primitive callback arg NSNumber* argtimestamp = @(timestamp); dispatch_async(dispatch_get_main_queue(), ^{ [channel invokeMethod:@"Callback::TXAudioRawDataDelegate::onPcmDataAvailable_pts" arguments:@{@"data": argdata == nil ? [NSNull null] : argdata, @"timestamp": argtimestamp == nil ? [NSNull null] : argtimestamp}]; }); } - (GLuint)onPreProcessTexture : (GLuint)texture width: (CGFloat)width height: (CGFloat)height { FlutterMethodChannel *channel = [FlutterMethodChannel methodChannelWithName:@"TXVideoCustomProcessDelegate::Callback" binaryMessenger:[_registrar messenger] codec:[FlutterStandardMethodCodec codecWithReaderWriter:[[FluttifyReaderWriter alloc] init]]]; // print log if (enableLog) { NSLog(@"TXVideoCustomProcessDelegate::onPreProcessTexture_width_height"); } // convert to jsonable arg // primitive callback arg NSNumber* argtexture = @(texture); // primitive callback arg NSNumber* argwidth = @(width); // primitive callback arg NSNumber* argheight = @(height); dispatch_async(dispatch_get_main_queue(), ^{ [channel invokeMethod:@"Callback::TXVideoCustomProcessDelegate::onPreProcessTexture_width_height" arguments:@{@"texture": argtexture == nil ? [NSNull null] : argtexture, @"width": argwidth == nil ? [NSNull null] : argwidth, @"height": argheight == nil ? [NSNull null] : argheight} result:^(id result) {}]; // 由于结果是异步返回, 这里用不上, 所以就不生成代码了 }); // 由于flutter无法同步调用method channel, 所以暂不支持有返回值的回调方法 // 相关issue https://github.com/flutter/flutter/issues/28310 NSLog(@"暂不支持有返回值的回调方法"); ////////////////////////////如果需要手写代码, 请写在这里///////////////////////////// //////////////////////////////////////////////////////////////////////////////// GLuint result = 0; return result; } - (void)onDetectFacePoints : (NSArray*)points { FlutterMethodChannel *channel = [FlutterMethodChannel methodChannelWithName:@"TXVideoCustomProcessDelegate::Callback" binaryMessenger:[_registrar messenger] codec:[FlutterStandardMethodCodec codecWithReaderWriter:[[FluttifyReaderWriter alloc] init]]]; // print log if (enableLog) { NSLog(@"TXVideoCustomProcessDelegate::onDetectFacePoints"); } // convert to jsonable arg // ref callback arg NSArray* argpoints = points; dispatch_async(dispatch_get_main_queue(), ^{ [channel invokeMethod:@"Callback::TXVideoCustomProcessDelegate::onDetectFacePoints" arguments:@{@"points": argpoints == nil ? [NSNull null] : argpoints}]; }); } - (BOOL)onPlayerPixelBuffer : (CVPixelBufferRef)pixelBuffer { FlutterMethodChannel *channel = [FlutterMethodChannel methodChannelWithName:@"TXVideoCustomProcessDelegate::Callback" binaryMessenger:[_registrar messenger] codec:[FlutterStandardMethodCodec codecWithReaderWriter:[[FluttifyReaderWriter alloc] init]]]; // print log if (enableLog) { NSLog(@"TXVideoCustomProcessDelegate::onPlayerPixelBuffer"); } // convert to jsonable arg // value pointer callback arg NSValue* argpixelBuffer = [NSValue valueWithPointer:pixelBuffer]; dispatch_async(dispatch_get_main_queue(), ^{ [channel invokeMethod:@"Callback::TXVideoCustomProcessDelegate::onPlayerPixelBuffer" arguments:@{@"pixelBuffer": argpixelBuffer == nil ? [NSNull null] : argpixelBuffer} result:^(id result) {}]; // 由于结果是异步返回, 这里用不上, 所以就不生成代码了 }); // 由于flutter无法同步调用method channel, 所以暂不支持有返回值的回调方法 // 相关issue https://github.com/flutter/flutter/issues/28310 NSLog(@"暂不支持有返回值的回调方法"); ////////////////////////////如果需要手写代码, 请写在这里///////////////////////////// //////////////////////////////////////////////////////////////////////////////// return NO; } - (void)onPushEvent : (int)EvtID withParam: (NSDictionary*)param { FlutterMethodChannel *channel = [FlutterMethodChannel methodChannelWithName:@"TXLivePushListener::Callback" binaryMessenger:[_registrar messenger] codec:[FlutterStandardMethodCodec codecWithReaderWriter:[[FluttifyReaderWriter alloc] init]]]; // print log if (enableLog) { NSLog(@"TXLivePushListener::onPushEvent_withParam"); } // convert to jsonable arg // primitive callback arg NSNumber* argEvtID = @(EvtID); // ref callback arg NSDictionary* argparam = param; dispatch_async(dispatch_get_main_queue(), ^{ [channel invokeMethod:@"Callback::TXLivePushListener::onPushEvent_withParam" arguments:@{@"EvtID": argEvtID == nil ? [NSNull null] : argEvtID, @"param": argparam == nil ? [NSNull null] : argparam}]; }); } @end