def _make_rtmp_video_simple(self, gst_buf): flags = 0x10 if gst_buf.flags & gst.BUFFER_FLAG_DELTA_UNIT: flags = 0x20 return VecBuf( [_s_uchar.pack(flags | self.video_codec.codecId), buffer(gst_buf)])
def prepare_audio(self): log.info('prepare_audio, caps: "%s"', self.audio_caps) if self.audio_codec.codecId in (10, 11): # aac and speex are always # marked 44kHz, stereo rate = 44100 channels = 2 else: rate = self.audio_rate channels = self.channels h1 = self.audio_codec.codecId << 4 h1 |= {44100: 3, 22050: 2, 11025: 1}.get(rate, 3) << 2 h1 |= 1 << 1 # always 16-bit size h1 |= int(channels == 2) self._ah1 = h1 if self.complex_audio_header: self._header_audio = _s_double_uchar.pack(h1, 1) # h1 | "keyframe" else: self._header_audio = _s_uchar.pack(h1)
def _make_rtmp_video_simple(self, gst_buf): flags = 0x10 if gst_buf.flags & gst.BUFFER_FLAG_DELTA_UNIT: flags = 0x20 return VecBuf([_s_uchar.pack(flags | self.video_codec.codecId), buffer(gst_buf)])