コード例 #1
0
ファイル: muxer.go プロジェクト: qianbo0423/media-muxer
func (m *Muxer) Open() bool {
	w, h := m.capture.Resolution()
	if !m.AddVideoStream(C.AV_CODEC_ID_H264, w, h) {
		return false
	}
	if !m.AddAudioStream(C.AV_CODEC_ID_AAC) {
		return false
	}
	if m.context.oformat.flags&C.AVFMT_NOFILE == 0 {
		if C.avio_open(&m.context.pb, &m.context.filename[0], C.AVIO_FLAG_WRITE) < 0 {
			return false
		}
		m.recl = append(m.recl, func() {
			C.avio_close(m.context.pb)
		})
	}
	C.av_dump_format(m.context, 0, &m.context.filename[0], 1)
	if C.avformat_write_header(m.context, (**C.AVDictionary)(null)) < 0 {
		return false
	}
	m.recl = append(m.recl, func() {
		C.av_write_trailer(m.context)
	})
	m.loop = true
	go m.routine()
	if m.display != nil {
		m.display.Open()
	}
	return true
}
コード例 #2
0
ファイル: avformat.go プロジェクト: codesuki/go-libav
func (ctx *Context) WriteTrailer() error {
	code := C.av_write_trailer(ctx.CAVFormatContext)
	if code < 0 {
		return avutil.NewErrorFromCode(avutil.ErrorCode(code))
	}
	return nil
}
コード例 #3
0
ファイル: format.go プロジェクト: 0x46616c6b/gmf
func (this *FmtCtx) CloseOutput() {
	if this.avCtx == nil {
		return
	}

	if this.avCtx.pb != nil {
		C.av_write_trailer(this.avCtx)
		C.avio_close(this.avCtx.pb)
	}

	this.Free()
}
コード例 #4
0
func av_write_trailer(ctx *FormatContext) int {
	return int(C.av_write_trailer(ctx.ctx))
}
コード例 #5
0
ファイル: format.go プロジェクト: Dim0N22/gmf
func (this *FmtCtx) WriteTrailer() {
	C.av_write_trailer(this.avCtx)
}
コード例 #6
0
ファイル: context.go プロジェクト: ovr/goav
//Write the stream trailer to an output media file and free the file private data.
func (s *Context) AvWriteTrailer() int {
	return int(C.av_write_trailer((*C.struct_AVFormatContext)(s)))
}
コード例 #7
0
ファイル: avformat.go プロジェクト: hyhy01/goav
//int av_write_trailer (AVFormatContext *s)
//Write the stream trailer to an output media file and free the file private data.
func Av_write_trailer(s *AVFormatContext) int {
	return int(C.av_write_trailer((*C.struct_AVFormatContext)(s)))
}