本文整理汇总了C++中BitstreamReader::unmark方法的典型用法代码示例。如果您正苦于以下问题:C++ BitstreamReader::unmark方法的具体用法?C++ BitstreamReader::unmark怎么用?C++ BitstreamReader::unmark使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BitstreamReader
的用法示例。
在下文中一共展示了BitstreamReader::unmark方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fprintf
//.........这里部分代码省略.........
self->channel_count);
buf_extend(packet_data, self->frames);
} else if (next_packet.codec_ID == MLP_CODEC_ID) {
/*if the packet is MLP,
check if the first frame starts with a major sync*/
enum {PACKET_DATA};
BitstreamReader* r = br_open_buffer(packet_data, BS_BIG_ENDIAN);
r->mark(r, PACKET_DATA);
if (!setjmp(*br_try(r))) {
unsigned sync_words;
unsigned stream_type;
r->parse(r, "32p 24u 8u", &sync_words, &stream_type);
if ((sync_words == 0xF8726F) && (stream_type == 0xBB)) {
/*if so, discard any unconsumed packet data
and initialize Title's stream attributes
with values taken from the major sync*/
unsigned group_1_bps;
unsigned group_2_bps;
unsigned group_1_rate;
unsigned group_2_rate;
r->parse(r, "4u 4u 4u 4u 11p 5u 48p",
&group_1_bps, &group_2_bps,
&group_1_rate, &group_2_rate,
&(self->channel_assignment));
self->bits_per_sample =
dvda_bits_per_sample(group_1_bps);
self->sample_rate =
dvda_sample_rate(group_1_rate);
self->channel_count =
dvda_channel_count(self->channel_assignment);
self->channel_mask =
dvda_channel_mask(self->channel_assignment);
self->frame_codec = MLP;
self->mlp_decoder->major_sync_read = 0;
r->rewind(r, PACKET_DATA);
r->unmark(r, PACKET_DATA);
br_etry(r);
r->close(r);
buf_reset(self->frames);
buf_extend(packet_data, self->frames);
} else {
/*if not, append packet data to any unconsumed data
and leave Title's stream attributes as they were*/
r->rewind(r, PACKET_DATA);
r->unmark(r, PACKET_DATA);
br_etry(r);
r->close(r);
buf_extend(packet_data, self->frames);
}
} else {
/*if I/O error reading major sync,
append packet data to any unconsumed data
and leave Title's stream attributes as they were*/
r->rewind(r, PACKET_DATA);
r->unmark(r, PACKET_DATA);
br_etry(r);
r->close(r);
buf_extend(packet_data, self->frames);
}
} else {
#ifndef STANDALONE
PyErr_SetString(PyExc_ValueError, "unknown codec ID");
return NULL;
#else
return 0;
#endif
}
/*convert PTS ticks to PCM frames based on sample rate*/
self->pcm_frames_remaining = (unsigned)round((double)PTS_ticks *
(double)self->sample_rate /
(double)PTS_PER_SECOND);
/*initalize codec's framelist with the proper number of channels*/
if (self->codec_framelist->len != self->channel_count) {
self->codec_framelist->reset(self->codec_framelist);
for (i = 0; i < self->channel_count; i++)
self->codec_framelist->append(self->codec_framelist);
}
#ifndef STANDALONE
Py_INCREF(Py_None);
return Py_None;
#else
return 1;
#endif
}