本文整理匯總了Golang中github.com/acolwell/mse-tools/webm.IdToName函數的典型用法代碼示例。如果您正苦於以下問題:Golang IdToName函數的具體用法?Golang IdToName怎麽用?Golang IdToName使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了IdToName函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: OnListStart
func (c *DemuxerClient) OnListStart(offset int64, id int) bool {
//log.Printf("OnListStart(%d, %s)\n", offset, webm.IdToName(id))
if !c.readEBMLHeader {
log.Printf("Unexpected element %s before EBMLHeader\n", webm.IdToName(id))
return false
}
if id == webm.IdSegment {
c.segmentOffset = offset
c.writer.WriteListStart(webm.IdSegment)
c.outputSegmentOffset = c.writer.Offset()
c.writer.WriteVoid(SEEK_HEAD_RESERVE_SIZE)
return true
}
if id == webm.IdCluster {
c.clusterTimecode = -1
if c.outputClusterOffset == -1 {
c.outputClusterOffset = c.writer.Offset()
}
return true
}
log.Printf("OnListStart() : Unexpected element %s\n", webm.IdToName(id))
return false
}
示例2: OnString
func (c *DemuxerClient) OnString(id int, value string) bool {
if !c.readEBMLHeader {
log.Printf("Unexpected element %s before EBMLHeader\n", webm.IdToName(id))
return false
}
log.Printf("OnString() : Unexpected element %s\n", webm.IdToName(id))
return false
}
示例3: OnUint
func (c *TestClient) OnUint(id int, value uint64) bool {
if id != webm.IdSeekID {
fmt.Printf("%s<%s type=\"uint\" value=\"%d\"/>\n", c.indent(), webm.IdToName(id), value)
} else {
fmt.Printf("%s<%s type=\"uint\" id_name=\"%s\" value=\"%d\"/>\n", c.indent(), webm.IdToName(id), webm.IdToName(int(value)), value)
}
if id == webm.IdTimecode {
c.clusterTimecode = value
}
return true
}
示例4: OnUint
func (c *DemuxerClient) OnUint(id int, value uint64) bool {
if !c.readEBMLHeader {
log.Printf("Unexpected element %s before EBMLHeader\n", webm.IdToName(id))
return false
}
if id == webm.IdTimecode {
c.clusterTimecode = int64(value)
//log.Printf("Input Cluster timecode %d\n", c.clusterTimecode)
return true
}
log.Printf("OnUint() : Unexpected element %s\n", webm.IdToName(id))
return false
}
示例5: OnBinary
func (c *TestClient) OnBinary(id int, value []byte) bool {
if id != webm.IdSimpleBlock {
fmt.Printf("%s<%s type=\"binary\" size=\"%d\"/>\n", c.indent(), webm.IdToName(id), len(value))
} else {
blockInfo := webm.ParseSimpleBlock(value)
presentationTimecode := int64(c.clusterTimecode) + int64(blockInfo.Timecode)
if blockInfo != nil {
fmt.Printf("%s<%s type=\"binary\" size=\"%d\" trackNum=\"%d\" timecode=\"%d\" presentationTimecode=\"%d\" flags=\"%x\"/>\n",
c.indent(), webm.IdToName(id), len(value), blockInfo.Id, blockInfo.Timecode, presentationTimecode, blockInfo.Flags)
} else {
fmt.Printf("%s<%s type=\"binary\" size=\"%d\" invalid=\"true\"/>\n", c.indent(), webm.IdToName(id), len(value))
}
}
return true
}
示例6: OnInt
func (c *BlockGroupClient) OnInt(id int, value int64) bool {
if id == webm.IdDiscardPadding || id == webm.IdReferenceBlock {
c.writer.Write(id, value)
return true
}
log.Printf("OnInt() : Unexpected element %s %d\n", webm.IdToName(id), value)
return false
}
示例7: OnUint
func (c *BlockGroupClient) OnUint(id int, value uint64) bool {
if id == webm.IdBlockDuration {
c.writer.Write(id, value)
return true
}
log.Printf("OnUint() : Unexpected element %s %u\n", webm.IdToName(id), value)
return false
}
示例8: OnBinary
func (c *BlockGroupClient) OnBinary(id int, value []byte) bool {
if id == webm.IdBlock {
blockInfo := webm.ParseSimpleBlock(value)
c.id = blockInfo.Id
c.rawTimecode = int64(blockInfo.Timecode)
c.flags = blockInfo.Flags & 0x0f
c.blockData = value[blockInfo.HeaderSize:]
c.parsedBlock = true
return true
} else if id == webm.IdBlockAdditions {
c.writer.Write(id, value)
return true
}
log.Printf("OnBinary() : Unexpected element %s size %d\n", webm.IdToName(id), len(value))
return false
}
示例9: OnListEnd
func (c *DemuxerClient) OnListEnd(offset int64, id int) bool {
//log.Printf("OnListEnd(%d, %s)\n", offset, webm.IdToName(id))
if id == webm.IdSegment {
if c.outputClusterTimecode != -1 {
c.writeRemainingBlocks()
c.writer.WriteListEnd(webm.IdCluster)
}
if c.writer.CanSeek() {
c.writeCues()
}
// Rewrite seek head.
oldOffset := c.writer.Offset()
if c.writer.SetOffset(c.outputSegmentOffset) {
c.writeSeekHead()
if c.writer.Offset() < c.outputInfoOffset {
c.writer.WriteVoid(int(c.outputInfoOffset - c.writer.Offset()))
}
c.writer.SetOffset(oldOffset)
}
c.writer.WriteListEnd(webm.IdSegment)
return true
}
if id == webm.IdCluster {
return true
}
log.Printf("OnListEnd() : Unexpected element %s\n", webm.IdToName(id))
return false
}
示例10: OnInt
func (c *DemuxerClient) OnInt(id int, value int64) bool {
log.Printf("OnInt() : Unexpected element %s\n", webm.IdToName(id))
return false
}
示例11: OnInt
func (c *TestClient) OnInt(id int, value int64) bool {
fmt.Printf("%<%s type=\"int\" value=\"%d\"/>\n", c.indent(), webm.IdToName(id), value)
return true
}
示例12: OnListEnd
func (c *TestClient) OnListEnd(offset int64, id int) bool {
c.depth--
fmt.Printf("%s</%s>\n", c.indent(), webm.IdToName(id))
return true
}
示例13: OnListStart
func (c *TestClient) OnListStart(offset int64, id int) bool {
fmt.Printf("%s<%s type=\"list\" offset=\"%d\">\n", c.indent(), webm.IdToName(id), offset)
c.depth++
return true
}
示例14: OnFloat
func (c *TestClient) OnFloat(id int, value float64) bool {
fmt.Printf("%s<%s type=\"float\" value=\"%f\"/>\n", c.indent(), webm.IdToName(id), value)
return true
}
示例15: OnBinary
func (c *DemuxerClient) OnBinary(id int, value []byte) bool {
if id == ebml.IdHeader {
if c.readEBMLHeader {
log.Printf("Already read an EBMLHeader\n")
return false
}
if !c.ParseEBMLHeader(value) {
return false
}
c.readEBMLHeader = true
webm.WriteHeader(c.writer)
//c.writer.Write(id, value)
return true
}
if !c.readEBMLHeader {
log.Printf("Unexpected element %s before EBMLHeader\n", webm.IdToName(id))
return false
}
if id == ebml.IdVoid {
return true
}
if id == webm.IdSeekHead {
return true
}
if id == webm.IdInfo {
if !c.ParseInfo(value) {
return false
}
c.outputInfoOffset = c.writer.Offset()
c.writer.Write(id, value)
return true
}
if id == webm.IdTracks {
if !c.ParseTracks(value) {
return false
}
c.outputTracksOffset = c.writer.Offset()
// Filter out deprecated values.
filteredValue := webm.Filter(value, []int{webm.IdFrameRate})
c.writer.Write(id, filteredValue)
return true
}
if id == webm.IdSimpleBlock {
return c.ParseSimpleBlock(value)
}
switch id {
case webm.IdCues,
webm.IdPrevSize,
webm.IdPosition:
return true
}
log.Printf("OnBinary() : Unexpected element %s\n", webm.IdToName(id))
return false
}