本文整理汇总了C++中put_be32函数的典型用法代码示例。如果您正苦于以下问题:C++ put_be32函数的具体用法?C++ put_be32怎么用?C++ put_be32使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了put_be32函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: aiff_write_trailer
static int aiff_write_trailer(AVFormatContext *s)
{
ByteIOContext *pb = s->pb;
AIFFOutputContext *aiff = s->priv_data;
AVCodecContext *enc = s->streams[0]->codec;
/* Chunks sizes must be even */
int64_t file_size, end_size;
end_size = file_size = url_ftell(pb);
if (file_size & 1) {
put_byte(pb, 0);
end_size++;
}
if (!url_is_streamed(s->pb)) {
/* File length */
url_fseek(pb, aiff->form, SEEK_SET);
put_be32(pb, file_size - aiff->form - 4);
/* Number of sample frames */
url_fseek(pb, aiff->frames, SEEK_SET);
put_be32(pb, (file_size-aiff->ssnd-12)/enc->block_align);
/* Sound Data chunk size */
url_fseek(pb, aiff->ssnd, SEEK_SET);
put_be32(pb, file_size - aiff->ssnd - 4);
/* return to the end */
url_fseek(pb, end_size, SEEK_SET);
put_flush_packet(pb);
}
return 0;
}
示例2: rm_write_trailer
static int rm_write_trailer(AVFormatContext *s)
{
RMMuxContext *rm = s->priv_data;
int data_size, index_pos, i;
ByteIOContext *pb = s->pb;
if (!url_is_streamed(s->pb)) {
/* end of file: finish to write header */
index_pos = url_fseek(pb, 0, SEEK_CUR);
data_size = index_pos - rm->data_pos;
/* FIXME: write index */
/* undocumented end header */
put_be32(pb, 0);
put_be32(pb, 0);
url_fseek(pb, 0, SEEK_SET);
for(i=0;i<s->nb_streams;i++)
rm->streams[i].total_frames = rm->streams[i].nb_frames;
rv10_write_header(s, data_size, 0);
} else {
/* undocumented end header */
put_be32(pb, 0);
put_be32(pb, 0);
}
put_flush_packet(pb);
return 0;
}
示例3: write_sgi_header
static void write_sgi_header(ByteIOContext *f, const SGIInfo *info)
{
int i;
put_be16(f, SGI_MAGIC);
put_byte(f, info->rle);
put_byte(f, info->bytes_per_channel);
put_be16(f, info->dimension);
put_be16(f, info->xsize);
put_be16(f, info->ysize);
put_be16(f, info->zsize);
/* The rest are constant in this implementation */
put_be32(f, 0L); /* pixmin */
put_be32(f, 255L); /* pixmax */
put_be32(f, 0L); /* dummy */
/* name */
for (i = 0; i < 80; i++) {
put_byte(f, 0);
}
put_be32(f, 0L); /* colormap */
/* The rest of the 512 byte header is unused. */
for (i = 0; i < 404; i++) {
put_byte(f, 0);
}
}
示例4: write_fsmonitor_extension
void write_fsmonitor_extension(struct strbuf *sb, struct index_state *istate)
{
uint32_t hdr_version;
uint64_t tm;
uint32_t ewah_start;
uint32_t ewah_size = 0;
int fixup = 0;
put_be32(&hdr_version, INDEX_EXTENSION_VERSION);
strbuf_add(sb, &hdr_version, sizeof(uint32_t));
put_be64(&tm, istate->fsmonitor_last_update);
strbuf_add(sb, &tm, sizeof(uint64_t));
fixup = sb->len;
strbuf_add(sb, &ewah_size, sizeof(uint32_t)); /* we'll fix this up later */
ewah_start = sb->len;
ewah_serialize_strbuf(istate->fsmonitor_dirty, sb);
ewah_free(istate->fsmonitor_dirty);
istate->fsmonitor_dirty = NULL;
/* fix up size field */
put_be32(&ewah_size, sb->len - ewah_start);
memcpy(sb->buf + fixup, &ewah_size, sizeof(uint32_t));
trace_printf_key(&trace_fsmonitor, "write fsmonitor extension successful");
}
示例5: flv_write_packet
static int flv_write_packet(AVFormatContext *s, AVPacket *pkt)
{
ByteIOContext *pb = &s->pb;
AVCodecContext *enc = s->streams[pkt->stream_index]->codec;
FLVContext *flv = s->priv_data;
int size= pkt->size;
int flags;
// av_log(s, AV_LOG_DEBUG, "type:%d pts: %"PRId64" size:%d\n", enc->codec_type, timestamp, size);
if (enc->codec_type == CODEC_TYPE_VIDEO) {
put_byte(pb, 9);
flags = 2; // choose h263
flags |= pkt->flags & PKT_FLAG_KEY ? 0x10 : 0x20; // add keyframe indicator
} else {
assert(enc->codec_type == CODEC_TYPE_AUDIO);
flags = get_audio_flags(enc);
assert(size);
put_byte(pb, 8);
}
put_be24(pb,size+1); // include flags
put_be24(pb,pkt->pts);
put_be32(pb,flv->reserved);
put_byte(pb,flags);
put_buffer(pb, pkt->data, size);
put_be32(pb,size+1+11); // previous tag size
flv->duration = pkt->pts + pkt->duration;
put_flush_packet(pb);
return 0;
}
示例6: gxf_write_media_preamble
static int gxf_write_media_preamble(ByteIOContext *pb, GXFContext *ctx, AVPacket *pkt, int size)
{
GXFStreamContext *sc = &ctx->streams[pkt->stream_index];
int64_t dts = av_rescale_rnd(pkt->dts, ctx->sample_rate, sc->codec->time_base.den, AV_ROUND_UP);
put_byte(pb, sc->media_type);
put_byte(pb, sc->index);
put_be32(pb, dts);
if (sc->codec->codec_type == CODEC_TYPE_AUDIO) {
put_be16(pb, 0);
put_be16(pb, size / 2);
} else if (sc->codec->codec_id == CODEC_ID_MPEG2VIDEO) {
int frame_type = gxf_parse_mpeg_frame(sc, pkt->data, pkt->size);
if (frame_type == FF_I_TYPE) {
put_byte(pb, 0x0d);
sc->iframes++;
} else if (frame_type == FF_B_TYPE) {
put_byte(pb, 0x0f);
sc->bframes++;
} else {
put_byte(pb, 0x0e);
sc->pframes++;
}
put_be24(pb, size);
} else if (sc->codec->codec_id == CODEC_ID_DVVIDEO) {
put_byte(pb, size / 4096);
put_be24(pb, 0);
} else
put_be32(pb, size);
put_be32(pb, dts);
put_byte(pb, 1); /* flags */
put_byte(pb, 0); /* reserved */
return 16;
}
示例7: gxf_write_packet_header
static void gxf_write_packet_header(ByteIOContext *pb, GXFPktType type)
{
put_be32(pb, 0); /* packet leader for synchro */
put_byte(pb, 1);
put_byte(pb, type); /* map packet */
put_be32(pb, 0); /* size */
put_be32(pb, 0); /* reserved */
put_byte(pb, 0xE1); /* trailer 1 */
put_byte(pb, 0xE2); /* trailer 2 */
}
示例8: gxf_write_track_description
static int gxf_write_track_description(AVFormatContext *s, GXFStreamContext *sc, int index)
{
ByteIOContext *pb = s->pb;
int64_t pos;
int mpeg = sc->track_type == 4 || sc->track_type == 9;
/* track description section */
put_byte(pb, sc->media_type + 0x80);
put_byte(pb, index + 0xC0);
pos = url_ftell(pb);
put_be16(pb, 0); /* size */
/* media file name */
put_byte(pb, TRACK_NAME);
put_byte(pb, strlen(ES_NAME_PATTERN) + 3);
put_tag(pb, ES_NAME_PATTERN);
put_be16(pb, sc->media_info);
put_byte(pb, 0);
if (!mpeg) {
/* auxiliary information */
put_byte(pb, TRACK_AUX);
put_byte(pb, 8);
if (sc->track_type == 3)
gxf_write_timecode_auxiliary(pb, sc);
else
put_le64(pb, 0);
}
/* file system version */
put_byte(pb, TRACK_VER);
put_byte(pb, 4);
put_be32(pb, 0);
if (mpeg)
gxf_write_mpeg_auxiliary(pb, s->streams[index]);
/* frame rate */
put_byte(pb, TRACK_FPS);
put_byte(pb, 4);
put_be32(pb, sc->frame_rate_index);
/* lines per frame */
put_byte(pb, TRACK_LINES);
put_byte(pb, 4);
put_be32(pb, sc->lines_index);
/* fields per frame */
put_byte(pb, TRACK_FPF);
put_byte(pb, 4);
put_be32(pb, sc->fields);
return updateSize(pb, pos);
}
示例9: gxf_write_track_description
static int gxf_write_track_description(ByteIOContext *pb, GXFStreamContext *stream)
{
int64_t pos;
/* track description section */
put_byte(pb, stream->media_type + 0x80);
put_byte(pb, stream->index + 0xC0);
pos = url_ftell(pb);
put_be16(pb, 0); /* size */
/* media file name */
put_byte(pb, TRACK_NAME);
put_byte(pb, strlen(ES_NAME_PATTERN) + 3);
put_tag(pb, ES_NAME_PATTERN);
put_be16(pb, stream->media_info);
put_byte(pb, 0);
if (stream->codec->codec_id != CODEC_ID_MPEG2VIDEO) {
/* auxiliary information */
put_byte(pb, TRACK_AUX);
put_byte(pb, 8);
if (stream->codec->codec_id == CODEC_ID_NONE)
gxf_write_timecode_auxiliary(pb, stream);
else
put_le64(pb, 0);
}
/* file system version */
put_byte(pb, TRACK_VER);
put_byte(pb, 4);
put_be32(pb, 0);
if (stream->codec->codec_id == CODEC_ID_MPEG2VIDEO)
gxf_write_mpeg_auxiliary(pb, stream);
/* frame rate */
put_byte(pb, TRACK_FPS);
put_byte(pb, 4);
put_be32(pb, stream->frame_rate_index);
/* lines per frame */
put_byte(pb, TRACK_LINES);
put_byte(pb, 4);
put_be32(pb, stream->lines_index);
/* fields per frame */
put_byte(pb, TRACK_FPF);
put_byte(pb, 4);
put_be32(pb, stream->fields);
return updateSize(pb, pos);
}
示例10: put_au_header
/* AUDIO_FILE header */
static int put_au_header(ByteIOContext *pb, AVCodecContext *enc)
{
if(!enc->codec_tag)
return -1;
put_tag(pb, ".snd"); /* magic number */
put_be32(pb, 24); /* header size */
put_be32(pb, AU_UNKNOWN_SIZE); /* data size */
put_be32(pb, (uint32_t)enc->codec_tag); /* codec ID */
put_be32(pb, enc->sample_rate);
put_be32(pb, (uint32_t)enc->channels);
return 0;
}
示例11: AM_ENSURE_OK_
AM_ERR CMp4Builder::put_FileTypeBox()
{
PRINT_FUNCTION_NAME;
AM_ENSURE_OK_(put_be32(FileTypeBox_SIZE)); //uint32 size
AM_ENSURE_OK_(put_boxtype("ftyp"));
AM_ENSURE_OK_(put_boxtype("mp42")); //uint32 major_brand
AM_ENSURE_OK_(put_be32(0)); //uint32 minor_version
AM_ENSURE_OK_(put_boxtype("mp42")); //uint32 compatible_brands[]
AM_ENSURE_OK_(put_boxtype("isom"));
return ME_OK;
}
示例12: mmf_write_header
static int mmf_write_header(AVFormatContext *s)
{
MMFContext *mmf = s->priv_data;
ByteIOContext *pb = s->pb;
int64_t pos;
int rate;
rate = mmf_rate_code(s->streams[0]->codec->sample_rate);
if(rate < 0) {
av_log(s, AV_LOG_ERROR, "Unsupported sample rate %d\n", s->streams[0]->codec->sample_rate);
return -1;
}
put_tag(pb, "MMMD");
put_be32(pb, 0);
pos = ff_start_tag(pb, "CNTI");
put_byte(pb, 0); /* class */
put_byte(pb, 0); /* type */
put_byte(pb, 0); /* code type */
put_byte(pb, 0); /* status */
put_byte(pb, 0); /* counts */
put_tag(pb, "VN:libavcodec,"); /* metadata ("ST:songtitle,VN:version,...") */
end_tag_be(pb, pos);
put_buffer(pb, "ATR\x00", 4);
put_be32(pb, 0);
mmf->atrpos = url_ftell(pb);
put_byte(pb, 0); /* format type */
put_byte(pb, 0); /* sequence type */
put_byte(pb, (0 << 7) | (1 << 4) | rate); /* (channel << 7) | (format << 4) | rate */
put_byte(pb, 0); /* wave base bit */
put_byte(pb, 2); /* time base d */
put_byte(pb, 2); /* time base g */
put_tag(pb, "Atsq");
put_be32(pb, 16);
mmf->atsqpos = url_ftell(pb);
/* Will be filled on close */
put_buffer(pb, "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 16);
mmf->awapos = ff_start_tag(pb, "Awa\x01");
av_set_pts_info(s->streams[0], 64, 1, s->streams[0]->codec->sample_rate);
put_flush_packet(pb);
return 0;
}
示例13: put_byte
void
RTMPSession::sendSetChunkSize(int32_t chunkSize)
{
m_jobQueue.enqueue([&, chunkSize] {
int streamId = 0;
std::vector<uint8_t> buff;
put_byte(buff, 2); // chunk stream ID 2
put_be24(buff, 0); // ts
put_be24(buff, 4); // size (4 bytes)
put_byte(buff, RTMP_PT_CHUNK_SIZE); // chunk type
put_buff(buff, (uint8_t*)&streamId, sizeof(int32_t)); // msg stream id is little-endian
put_be32(buff, chunkSize);
write(&buff[0], buff.size());
m_outChunkSize = chunkSize;
});
}
示例14: xcalloc
static void *generate_fake_oid(const void *old, size_t *len)
{
static uint32_t counter = 1; /* avoid null sha1 */
unsigned char *out = xcalloc(GIT_SHA1_RAWSZ, 1);
put_be32(out + GIT_SHA1_RAWSZ - 4, counter++);
return out;
}
示例15: xcalloc
static void *generate_fake_sha1(const void *old, size_t *len)
{
static uint32_t counter = 1; /* avoid null sha1 */
unsigned char *out = xcalloc(20, 1);
put_be32(out + 16, counter++);
return out;
}