mirror of
				https://github.com/Monibuca/plugin-rtmp.git
				synced 2025-10-31 18:52:40 +08:00 
			
		
		
		
	适配2.0
This commit is contained in:
		
							
								
								
									
										1
									
								
								go.mod
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								go.mod
									
									
									
									
									
								
							| @@ -3,6 +3,7 @@ module github.com/Monibuca/plugin-rtmp | |||||||
| go 1.13 | go 1.13 | ||||||
|  |  | ||||||
| require ( | require ( | ||||||
|  | 	github.com/Monibuca/engine v1.2.2 // indirect | ||||||
| 	github.com/Monibuca/engine/v2 v2.0.0-alpha1 | 	github.com/Monibuca/engine/v2 v2.0.0-alpha1 | ||||||
| 	github.com/logrusorgru/aurora v0.0.0-20200102142835-e9ef32dff381 | 	github.com/logrusorgru/aurora v0.0.0-20200102142835-e9ef32dff381 | ||||||
| ) | ) | ||||||
|   | |||||||
							
								
								
									
										4
									
								
								go.sum
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								go.sum
									
									
									
									
									
								
							| @@ -1,5 +1,9 @@ | |||||||
| github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= | github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= | ||||||
| github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= | github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= | ||||||
|  | github.com/Monibuca/engine v1.2.2 h1:hNjsrZpOmui8lYhgCJ5ltJU8g/k0Rrdysx2tHNGGnbI= | ||||||
|  | github.com/Monibuca/engine v1.2.2/go.mod h1:WbDkXENLjcPjyjCR1Mix1GA+uAlwORkv/+8aMVrDX2g= | ||||||
|  | github.com/Monibuca/engine/v2 v2.0.0-alpha1 h1:RT+rKOJC1MdFNZp6gADGdzGLxEhYN35MKEAx7FwHtps= | ||||||
|  | github.com/Monibuca/engine/v2 v2.0.0-alpha1/go.mod h1:34EYjjV15G6myuHOKaJkO7y5tJ1Arq/NfC9Weacr2mc= | ||||||
| github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d h1:G0m3OIz70MZUWq3EgK3CesDbo8upS2Vm9/P3FtgI+Jk= | github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d h1:G0m3OIz70MZUWq3EgK3CesDbo8upS2Vm9/P3FtgI+Jk= | ||||||
| github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= | github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= | ||||||
| github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= | github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= | ||||||
|   | |||||||
| @@ -13,7 +13,7 @@ import ( | |||||||
| ) | ) | ||||||
|  |  | ||||||
| type RTMP struct { | type RTMP struct { | ||||||
| 	InputStream | 	Publisher | ||||||
| } | } | ||||||
|  |  | ||||||
| func ListenRtmp(addr string) error { | func ListenRtmp(addr string) error { | ||||||
| @@ -167,7 +167,7 @@ func processRtmp(conn net.Conn) { | |||||||
| 					err = nc.SendMessage(SEND_PLAY_RESPONSE_MESSAGE, newPlayResponseMessageData(nc.streamID, NetStream_Play_Start, Level_Status)) | 					err = nc.SendMessage(SEND_PLAY_RESPONSE_MESSAGE, newPlayResponseMessageData(nc.streamID, NetStream_Play_Start, Level_Status)) | ||||||
| 					if err == nil { | 					if err == nil { | ||||||
| 						streams[nc.streamID] = stream | 						streams[nc.streamID] = stream | ||||||
| 						go stream.Play(streamPath) | 						go stream.Subscribe(streamPath) | ||||||
| 					} else { | 					} else { | ||||||
| 						return | 						return | ||||||
| 					} | 					} | ||||||
| @@ -185,7 +185,7 @@ func processRtmp(conn net.Conn) { | |||||||
| 				} else { | 				} else { | ||||||
| 					totalDuration += msg.Timestamp // 绝对时间戳 | 					totalDuration += msg.Timestamp // 绝对时间戳 | ||||||
| 				} | 				} | ||||||
| 				Stream.PushAudio(totalDuration, msg.Body) | 				stream.PushAudio(totalDuration, msg.Body) | ||||||
| 			case RTMP_MSG_VIDEO: | 			case RTMP_MSG_VIDEO: | ||||||
| 				// pkt := avformat.NewAVPacket(RTMP_MSG_VIDEO) | 				// pkt := avformat.NewAVPacket(RTMP_MSG_VIDEO) | ||||||
| 				if msg.Timestamp == 0xffffff { | 				if msg.Timestamp == 0xffffff { | ||||||
| @@ -193,7 +193,7 @@ func processRtmp(conn net.Conn) { | |||||||
| 				} else { | 				} else { | ||||||
| 					totalDuration += msg.Timestamp // 绝对时间戳 | 					totalDuration += msg.Timestamp // 绝对时间戳 | ||||||
| 				} | 				} | ||||||
| 				Stream.PushVideo(totalDuration, msg.Body) | 				stream.PushVideo(totalDuration, msg.Body) | ||||||
| 			} | 			} | ||||||
| 			msg.Recycle() | 			msg.Recycle() | ||||||
| 		} else { | 		} else { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 李宇翔
					李宇翔