Esempio n. 1
0
func (this *FmtCtx) GetBestStream(typ int32) (*Stream, error) {
	idx := C.av_find_best_stream(this.avCtx, typ, -1, -1, nil, 0)
	if int(idx) < 0 {
		return nil, errors.New(fmt.Sprintf("stream type %d not found", typ))
	}

	return this.GetStream(int(idx))
}
Esempio n. 2
0
func open_codec_context(stream_idx *C.int, fmt_ctx *C.AVFormatContext, mtype C.enum_AVMediaType) C.int {
	if ret := C.av_find_best_stream(fmt_ctx, mtype, -1, -1, nil, 0); ret < 0 {
		log.Printf("Could not find %s stream in input file", C.GoString(C.av_get_media_type_string(mtype)))
		return ret
	} else {
		*stream_idx = ret
	}
	return 0
}
Esempio n. 3
0
File: context.go Progetto: ovr/goav
//Find the "best" stream in the file.
func AvFindBestStream(ic *Context, t avutil.MediaType, ws, rs int, c **AvCodec, f int) int {
	return int(C.av_find_best_stream((*C.struct_AVFormatContext)(ic), (C.enum_AVMediaType)(t), C.int(ws), C.int(rs), (**C.struct_AVCodec)(unsafe.Pointer(c)), C.int(f)))
}
Esempio n. 4
0
func (file *MediaFile) IndexBestStream(mediaType MediaType) int {
	return int(C.av_find_best_stream(file.fmtctx, C.enum_AVMediaType(mediaType), -1, -1, nil, 0))
}