本文整理汇总了C++中bytestream_put_le32函数的典型用法代码示例。如果您正苦于以下问题:C++ bytestream_put_le32函数的具体用法?C++ bytestream_put_le32怎么用?C++ bytestream_put_le32使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bytestream_put_le32函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: ogg_build_flac_headers
static int ogg_build_flac_headers(const uint8_t *extradata, int extradata_size,
OGGStreamContext *oggstream, int bitexact)
{
const char *vendor = bitexact ? "ffmpeg" : LIBAVFORMAT_IDENT;
uint8_t *p;
if (extradata_size != 34)
return -1;
oggstream->header_len[0] = 51;
oggstream->header[0] = av_mallocz(51); // per ogg flac specs
p = oggstream->header[0];
bytestream_put_byte(&p, 0x7F);
bytestream_put_buffer(&p, "FLAC", 4);
bytestream_put_byte(&p, 1); // major version
bytestream_put_byte(&p, 0); // minor version
bytestream_put_be16(&p, 1); // headers packets without this one
bytestream_put_buffer(&p, "fLaC", 4);
bytestream_put_byte(&p, 0x00); // streaminfo
bytestream_put_be24(&p, 34);
bytestream_put_buffer(&p, extradata, 34);
oggstream->header_len[1] = 1+3+4+strlen(vendor)+4;
oggstream->header[1] = av_mallocz(oggstream->header_len[1]);
p = oggstream->header[1];
bytestream_put_byte(&p, 0x84); // last metadata block and vorbis comment
bytestream_put_be24(&p, oggstream->header_len[1] - 4);
bytestream_put_le32(&p, strlen(vendor));
bytestream_put_buffer(&p, vendor, strlen(vendor));
bytestream_put_le32(&p, 0); // user comment list length
return 0;
}
开发者ID:Haaaaaank,项目名称:avbin,代码行数:29,代码来源:oggenc.c
示例2: send_media_file_request
static int send_media_file_request(MMSContext *mms)
{
start_command_packet(mms, CS_PKT_MEDIA_FILE_REQUEST);
insert_command_prefixes(mms, 1, 0xffffffff);
bytestream_put_le32(&mms->write_out_ptr, 0);
bytestream_put_le32(&mms->write_out_ptr, 0);
mms_put_utf16(mms, mms->path + 1); // +1 for skip "/"
return send_command_packet(mms);
}
开发者ID:Akuaksh,项目名称:FFmpeg-alsenc,代码行数:10,代码来源:mmst.c
示例3: read_packet
static int read_packet(AVFormatContext *s, AVPacket *pkt)
{
IcoDemuxContext *ico = s->priv_data;
IcoImage *image;
AVIOContext *pb = s->pb;
AVStream *st = s->streams[0];
int ret;
if (ico->current_image >= ico->nb_images)
return AVERROR(EIO);
image = &ico->images[ico->current_image];
if ((ret = avio_seek(pb, image->offset, SEEK_SET)) < 0)
return ret;
if (s->streams[ico->current_image]->codec->codec_id == AV_CODEC_ID_PNG) {
if ((ret = av_get_packet(pb, pkt, image->size)) < 0)
return ret;
} else {
uint8_t *buf;
if ((ret = av_new_packet(pkt, 14 + image->size)) < 0)
return ret;
buf = pkt->data;
/* add BMP header */
bytestream_put_byte(&buf, 'B');
bytestream_put_byte(&buf, 'M');
bytestream_put_le32(&buf, pkt->size);
bytestream_put_le16(&buf, 0);
bytestream_put_le16(&buf, 0);
bytestream_put_le32(&buf, 0);
if ((ret = avio_read(pb, buf, image->size)) < 0)
return ret;
st->codec->bits_per_coded_sample = AV_RL16(buf + 14);
if (AV_RL32(buf + 32))
image->nb_pal = AV_RL32(buf + 32);
if (st->codec->bits_per_coded_sample <= 8 && !image->nb_pal) {
image->nb_pal = 1 << st->codec->bits_per_coded_sample;
AV_WL32(buf + 32, image->nb_pal);
}
AV_WL32(buf - 4, 14 + 40 + image->nb_pal * 4);
AV_WL32(buf + 8, AV_RL32(buf + 8) / 2);
}
pkt->stream_index = ico->current_image++;
pkt->flags |= AV_PKT_FLAG_KEY;
return 0;
}
开发者ID:26mansi,项目名称:FFmpeg,代码行数:55,代码来源:icodec.c
示例4: send_media_file_request
static int send_media_file_request(MMSTContext *mmst)
{
int ret;
MMSContext *mms = &mmst->mms;
start_command_packet(mmst, CS_PKT_MEDIA_FILE_REQUEST);
insert_command_prefixes(mms, 1, 0xffffffff);
bytestream_put_le32(&mms->write_out_ptr, 0);
bytestream_put_le32(&mms->write_out_ptr, 0);
if ((ret = mms_put_utf16(mms, mmst->path + 1)) < 0) // +1 for skip "/"
return ret;
return send_command_packet(mmst);
}
开发者ID:AirStash,项目名称:AirStashPlayer,代码行数:13,代码来源:mmst.c
示例5: roq_dpcm_encode_frame
static int roq_dpcm_encode_frame(AVCodecContext *avctx,
unsigned char *frame, int buf_size, void *data)
{
int i, samples, stereo, ch;
short *in;
unsigned char *out;
ROQDPCMContext *context = avctx->priv_data;
stereo = (avctx->channels == 2);
if (stereo) {
context->lastSample[0] &= 0xFF00;
context->lastSample[1] &= 0xFF00;
}
out = frame;
in = data;
bytestream_put_byte(&out, stereo ? 0x21 : 0x20);
bytestream_put_byte(&out, 0x10);
bytestream_put_le32(&out, avctx->frame_size*avctx->channels);
if (stereo) {
bytestream_put_byte(&out, (context->lastSample[1])>>8);
bytestream_put_byte(&out, (context->lastSample[0])>>8);
} else
开发者ID:WangCrystal,项目名称:FFplayer,代码行数:27,代码来源:roqaudioenc.c
示例6: send_media_packet_request
static int send_media_packet_request(MMSContext *mms)
{
start_command_packet(mms, CS_PKT_START_FROM_PKT_ID);
insert_command_prefixes(mms, 1, 0x0001FFFF);
bytestream_put_le64(&mms->write_out_ptr, 0); // seek timestamp
bytestream_put_le32(&mms->write_out_ptr, 0xffffffff); // unknown
bytestream_put_le32(&mms->write_out_ptr, 0xffffffff); // packet offset
bytestream_put_byte(&mms->write_out_ptr, 0xff); // max stream time limit
bytestream_put_byte(&mms->write_out_ptr, 0xff); // max stream time limit
bytestream_put_byte(&mms->write_out_ptr, 0xff); // max stream time limit
bytestream_put_byte(&mms->write_out_ptr, 0x00); // stream time limit flag
mms->packet_id++; // new packet_id
bytestream_put_le32(&mms->write_out_ptr, mms->packet_id);
return send_command_packet(mms);
}
开发者ID:Akuaksh,项目名称:FFmpeg-alsenc,代码行数:16,代码来源:mmst.c
示例7: ff_rtmp_packet_write
int ff_rtmp_packet_write(URLContext *h, RTMPPacket *pkt,
int chunk_size, RTMPPacket *prev_pkt)
{
uint8_t pkt_hdr[16], *p = pkt_hdr;
int mode = RTMP_PS_TWELVEBYTES;
int off = 0;
//TODO: header compression
bytestream_put_byte(&p, pkt->channel_id | (mode << 6));
if (mode != RTMP_PS_ONEBYTE) {
bytestream_put_be24(&p, pkt->timestamp);
if (mode != RTMP_PS_FOURBYTES) {
bytestream_put_be24(&p, pkt->data_size);
bytestream_put_byte(&p, pkt->type);
if (mode == RTMP_PS_TWELVEBYTES)
bytestream_put_le32(&p, pkt->extra);
}
}
url_write(h, pkt_hdr, p-pkt_hdr);
while (off < pkt->data_size) {
int towrite = FFMIN(chunk_size, pkt->data_size - off);
url_write(h, pkt->data + off, towrite);
off += towrite;
if (off < pkt->data_size) {
uint8_t marker = 0xC0 | pkt->channel_id;
url_write(h, &marker, 1);
}
}
return 0;
}
开发者ID:mrtos,项目名称:Logitech-Revue,代码行数:30,代码来源:rtmppkt.c
示例8: send_media_header_request
static int send_media_header_request(MMSContext *mms)
{
start_command_packet(mms, CS_PKT_MEDIA_HEADER_REQUEST);
insert_command_prefixes(mms, 1, 0);
bytestream_put_le32(&mms->write_out_ptr, 0);
bytestream_put_le32(&mms->write_out_ptr, 0x00800000);
bytestream_put_le32(&mms->write_out_ptr, 0xffffffff);
bytestream_put_le32(&mms->write_out_ptr, 0);
bytestream_put_le32(&mms->write_out_ptr, 0);
bytestream_put_le32(&mms->write_out_ptr, 0);
// the media preroll value in milliseconds?
bytestream_put_le32(&mms->write_out_ptr, 0);
bytestream_put_le32(&mms->write_out_ptr, 0x40AC2000);
bytestream_put_le32(&mms->write_out_ptr, 2);
bytestream_put_le32(&mms->write_out_ptr, 0);
return send_command_packet(mms);
}
开发者ID:Akuaksh,项目名称:FFmpeg-alsenc,代码行数:19,代码来源:mmst.c
示例9: send_protocol_select
static int send_protocol_select(MMSContext *mms)
{
char data_string[256];
start_command_packet(mms, CS_PKT_PROTOCOL_SELECT);
insert_command_prefixes(mms, 0, 0xffffffff);
bytestream_put_le32(&mms->write_out_ptr, 0); // maxFunnelBytes
bytestream_put_le32(&mms->write_out_ptr, 0x00989680); // maxbitRate
bytestream_put_le32(&mms->write_out_ptr, 2); // funnelMode
snprintf(data_string, sizeof(data_string), "\\\\%d.%d.%d.%d\\%s\\%d",
(LOCAL_ADDRESS>>24)&0xff,
(LOCAL_ADDRESS>>16)&0xff,
(LOCAL_ADDRESS>>8)&0xff,
LOCAL_ADDRESS&0xff,
"TCP", // or UDP
LOCAL_PORT);
mms_put_utf16(mms, data_string);
return send_command_packet(mms);
}
开发者ID:Akuaksh,项目名称:FFmpeg-alsenc,代码行数:20,代码来源:mmst.c
示例10: ff_vorbiscomment_write
int ff_vorbiscomment_write(uint8_t **p, AVDictionary **m,
const char *vendor_string, const unsigned count)
{
bytestream_put_le32(p, strlen(vendor_string));
bytestream_put_buffer(p, vendor_string, strlen(vendor_string));
if (*m) {
AVDictionaryEntry *tag = NULL;
bytestream_put_le32(p, count);
while ((tag = av_dict_get(*m, "", tag, AV_DICT_IGNORE_SUFFIX))) {
unsigned int len1 = strlen(tag->key);
unsigned int len2 = strlen(tag->value);
bytestream_put_le32(p, len1+1+len2);
bytestream_put_buffer(p, tag->key, len1);
bytestream_put_byte(p, '=');
bytestream_put_buffer(p, tag->value, len2);
}
} else
bytestream_put_le32(p, 0);
return 0;
}
开发者ID:AVbin,项目名称:libav,代码行数:20,代码来源:vorbiscomment.c
示例11: strlen
static uint8_t *ogg_write_vorbiscomment(int offset, int bitexact,
int *header_len)
{
const char *vendor = bitexact ? "ffmpeg" : LIBAVFORMAT_IDENT;
int size;
uint8_t *p, *p0;
size = offset + 4 + strlen(vendor) + 4;
p = av_mallocz(size);
if (!p)
return NULL;
p0 = p;
p += offset;
bytestream_put_le32(&p, strlen(vendor));
bytestream_put_buffer(&p, vendor, strlen(vendor));
bytestream_put_le32(&p, 0); // user comment list length
*header_len = size;
return p0;
}
开发者ID:BigBadOwl,项目名称:iPhone-Ffmpeg,代码行数:21,代码来源:oggenc.c
示例12: roq_dpcm_encode_frame
static int roq_dpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
const AVFrame *frame, int *got_packet_ptr)
{
int i, stereo, data_size, ret;
const int16_t *in = frame ? (const int16_t *)frame->data[0] : NULL;
uint8_t *out;
ROQDPCMContext *context = avctx->priv_data;
stereo = (avctx->channels == 2);
if (!in && context->input_frames >= 8)
return 0;
if (in && context->input_frames < 8) {
memcpy(&context->frame_buffer[context->buffered_samples * avctx->channels],
in, avctx->frame_size * avctx->channels * sizeof(*in));
context->buffered_samples += avctx->frame_size;
if (context->input_frames == 0)
context->first_pts = frame->pts;
if (context->input_frames < 7) {
context->input_frames++;
return 0;
}
}
if (context->input_frames < 8)
in = context->frame_buffer;
if (stereo) {
context->lastSample[0] &= 0xFF00;
context->lastSample[1] &= 0xFF00;
}
if (context->input_frames == 7)
data_size = avctx->channels * context->buffered_samples;
else
data_size = avctx->channels * avctx->frame_size;
if ((ret = ff_alloc_packet(avpkt, ROQ_HEADER_SIZE + data_size))) {
av_log(avctx, AV_LOG_ERROR, "Error getting output packet\n");
return ret;
}
out = avpkt->data;
bytestream_put_byte(&out, stereo ? 0x21 : 0x20);
bytestream_put_byte(&out, 0x10);
bytestream_put_le32(&out, data_size);
if (stereo) {
bytestream_put_byte(&out, (context->lastSample[1])>>8);
bytestream_put_byte(&out, (context->lastSample[0])>>8);
} else
开发者ID:AVLeo,项目名称:libav,代码行数:51,代码来源:roqaudioenc.c
示例13: send_stream_selection_request
/** Send MMST stream selection command based on the AVStream->discard values. */
static int send_stream_selection_request(MMSTContext *mmst)
{
int i;
MMSContext *mms = &mmst->mms;
// send the streams we want back...
start_command_packet(mmst, CS_PKT_STREAM_ID_REQUEST);
bytestream_put_le32(&mms->write_out_ptr, mms->stream_num); // stream nums
for(i= 0; i<mms->stream_num; i++) {
bytestream_put_le16(&mms->write_out_ptr, 0xffff); // flags
bytestream_put_le16(&mms->write_out_ptr, mms->streams[i].id); // stream id
bytestream_put_le16(&mms->write_out_ptr, 0); // selection
}
return send_command_packet(mmst);
}
开发者ID:AirStash,项目名称:AirStashPlayer,代码行数:15,代码来源:mmst.c
示例14: send_startup_packet
/** Send the initial handshake. */
static int send_startup_packet(MMSContext *mms)
{
char data_string[256];
// SubscriberName is defined in MS specification linked below.
// The guid value can be any valid value.
// http://download.microsoft.com/
// download/9/5/E/95EF66AF-9026-4BB0-A41D-A4F81802D92C/%5BMS-WMSP%5D.pdf
snprintf(data_string, sizeof(data_string),
"NSPlayer/7.0.0.1956; {%s}; Host: %s",
"7E667F5D-A661-495E-A512-F55686DDA178", mms->host);
start_command_packet(mms, CS_PKT_INITIAL);
insert_command_prefixes(mms, 0, 0x0004000b);
bytestream_put_le32(&mms->write_out_ptr, 0x0003001c);
mms_put_utf16(mms, data_string);
return send_command_packet(mms);
}
开发者ID:Akuaksh,项目名称:FFmpeg-alsenc,代码行数:18,代码来源:mmst.c
示例15: start_command_packet
/** Create MMST command packet header */
static void start_command_packet(MMSContext *mms, MMSCSPacketType packet_type)
{
mms->write_out_ptr = mms->out_buffer;
bytestream_put_le32(&mms->write_out_ptr, 1); // start sequence
bytestream_put_le32(&mms->write_out_ptr, 0xb00bface);
bytestream_put_le32(&mms->write_out_ptr, 0); // Length starts from after the protocol type bytes
bytestream_put_le32(&mms->write_out_ptr, MKTAG('M','M','S',' '));
bytestream_put_le32(&mms->write_out_ptr, 0);
bytestream_put_le32(&mms->write_out_ptr, mms->outgoing_packet_seq++);
bytestream_put_le64(&mms->write_out_ptr, 0); // timestamp
bytestream_put_le32(&mms->write_out_ptr, 0);
bytestream_put_le16(&mms->write_out_ptr, packet_type);
bytestream_put_le16(&mms->write_out_ptr, 3); // direction to server
}
开发者ID:Akuaksh,项目名称:FFmpeg-alsenc,代码行数:16,代码来源:mmst.c
示例16: encode_frame
static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
const AVFrame *pic, int *got_packet)
{
int i, j, ret;
int aligned_width = FFALIGN(avctx->width,
avctx->codec_id == AV_CODEC_ID_R10K ? 1 : 64);
int pad = (aligned_width - avctx->width) * 4;
uint8_t *src_line;
uint8_t *dst;
if ((ret = ff_alloc_packet2(avctx, pkt, 4 * aligned_width * avctx->height)) < 0)
return ret;
avctx->coded_frame->key_frame = 1;
avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
src_line = pic->data[0];
dst = pkt->data;
for (i = 0; i < avctx->height; i++) {
uint16_t *src = (uint16_t *)src_line;
for (j = 0; j < avctx->width; j++) {
uint32_t pixel;
uint16_t r = *src++ >> 6;
uint16_t g = *src++ >> 6;
uint16_t b = *src++ >> 6;
if (avctx->codec_id == AV_CODEC_ID_R210)
pixel = (r << 20) | (g << 10) | b;
else
pixel = (r << 22) | (g << 12) | (b << 2);
if (avctx->codec_id == AV_CODEC_ID_AVRP)
bytestream_put_le32(&dst, pixel);
else
bytestream_put_be32(&dst, pixel);
}
memset(dst, 0, pad);
dst += pad;
src_line += pic->linesize[0];
}
pkt->flags |= AV_PKT_FLAG_KEY;
*got_packet = 1;
return 0;
}
开发者ID:FatCat1411,项目名称:opencvr,代码行数:43,代码来源:r210enc.c
示例17: write_codebooks
/**
* Write codebook chunk
*/
static void write_codebooks(RoqContext *enc, RoqTempdata *tempData)
{
int i, j;
uint8_t **outp= &enc->out_buf;
if (tempData->numCB2) {
bytestream_put_le16(outp, RoQ_QUAD_CODEBOOK);
bytestream_put_le32(outp, tempData->numCB2*6 + tempData->numCB4*4);
bytestream_put_byte(outp, tempData->numCB4);
bytestream_put_byte(outp, tempData->numCB2);
for (i=0; i<tempData->numCB2; i++) {
bytestream_put_buffer(outp, enc->cb2x2[tempData->f2i2[i]].y, 4);
bytestream_put_byte(outp, enc->cb2x2[tempData->f2i2[i]].u);
bytestream_put_byte(outp, enc->cb2x2[tempData->f2i2[i]].v);
}
for (i=0; i<tempData->numCB4; i++)
for (j=0; j<4; j++)
bytestream_put_byte(outp, tempData->i2f2[enc->cb4x4[tempData->f2i4[i]].idx[j]]);
}
}
开发者ID:119,项目名称:dropcam_for_iphone,代码行数:26,代码来源:roqvideoenc.c
示例18: roq_write_video_info_chunk
static void roq_write_video_info_chunk(RoqContext *enc)
{
/* ROQ info chunk */
bytestream_put_le16(&enc->out_buf, RoQ_INFO);
/* Size: 8 bytes */
bytestream_put_le32(&enc->out_buf, 8);
/* Unused argument */
bytestream_put_byte(&enc->out_buf, 0x00);
bytestream_put_byte(&enc->out_buf, 0x00);
/* Width */
bytestream_put_le16(&enc->out_buf, enc->width);
/* Height */
bytestream_put_le16(&enc->out_buf, enc->height);
/* Unused in Quake 3, mimics the output of the real encoder */
bytestream_put_byte(&enc->out_buf, 0x08);
bytestream_put_byte(&enc->out_buf, 0x00);
bytestream_put_byte(&enc->out_buf, 0x04);
bytestream_put_byte(&enc->out_buf, 0x00);
}
开发者ID:119,项目名称:dropcam_for_iphone,代码行数:24,代码来源:roqvideoenc.c
示例19: gif_put_bits_rev
static void gif_put_bits_rev(PutBitContext *s, int n, unsigned int value)
{
unsigned int bit_buf;
int bit_cnt;
// printf("put_bits=%d %x\n", n, value);
assert(n == 32 || value < (1U << n));
bit_buf = s->bit_buf;
bit_cnt = 32 - s->bit_left; /* XXX:lazyness... was = s->bit_cnt; */
// printf("n=%d value=%x cnt=%d buf=%x\n", n, value, bit_cnt, bit_buf);
/* XXX: optimize */
if (n < (32-bit_cnt)) {
bit_buf |= value << (bit_cnt);
bit_cnt+=n;
} else {
bit_buf |= value << (bit_cnt);
bytestream_put_le32(&s->buf_ptr, bit_buf);
//printf("bitbuf = %08x\n", bit_buf);
if (s->buf_ptr >= s->buf_end)
puts("bit buffer overflow !!"); // should never happen ! who got rid of the callback ???
// flush_buffer_rev(s);
bit_cnt=bit_cnt + n - 32;
if (bit_cnt == 0) {
bit_buf = 0;
} else {
bit_buf = value >> (n - bit_cnt);
}
}
s->bit_buf = bit_buf;
s->bit_left = 32 - bit_cnt;
}
开发者ID:DanielGit,项目名称:Intrisit201202,代码行数:36,代码来源:gif.c
示例20: bmp_encode_frame
static int bmp_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
const AVFrame *pict, int *got_packet)
{
BMPContext *s = avctx->priv_data;
AVFrame * const p = &s->picture;
int n_bytes_image, n_bytes_per_row, n_bytes, i, n, hsize, ret;
const uint32_t *pal = NULL;
uint32_t palette256[256];
int pad_bytes_per_row, pal_entries = 0, compression = BMP_RGB;
int bit_count = avctx->bits_per_coded_sample;
uint8_t *ptr, *buf;
*p = *pict;
p->pict_type= AV_PICTURE_TYPE_I;
p->key_frame= 1;
switch (avctx->pix_fmt) {
case AV_PIX_FMT_RGB444:
compression = BMP_BITFIELDS;
pal = rgb444_masks; // abuse pal to hold color masks
pal_entries = 3;
break;
case AV_PIX_FMT_RGB565:
compression = BMP_BITFIELDS;
pal = rgb565_masks; // abuse pal to hold color masks
pal_entries = 3;
break;
case AV_PIX_FMT_RGB8:
case AV_PIX_FMT_BGR8:
case AV_PIX_FMT_RGB4_BYTE:
case AV_PIX_FMT_BGR4_BYTE:
case AV_PIX_FMT_GRAY8:
av_assert1(bit_count == 8);
ff_set_systematic_pal2(palette256, avctx->pix_fmt);
pal = palette256;
break;
case AV_PIX_FMT_PAL8:
pal = (uint32_t *)p->data[1];
break;
case AV_PIX_FMT_MONOBLACK:
pal = monoblack_pal;
break;
}
if (pal && !pal_entries) pal_entries = 1 << bit_count;
n_bytes_per_row = ((int64_t)avctx->width * (int64_t)bit_count + 7LL) >> 3LL;
pad_bytes_per_row = (4 - n_bytes_per_row) & 3;
n_bytes_image = avctx->height * (n_bytes_per_row + pad_bytes_per_row);
// STRUCTURE.field refer to the MSVC documentation for BITMAPFILEHEADER
// and related pages.
#define SIZE_BITMAPFILEHEADER 14
#define SIZE_BITMAPINFOHEADER 40
hsize = SIZE_BITMAPFILEHEADER + SIZE_BITMAPINFOHEADER + (pal_entries << 2);
n_bytes = n_bytes_image + hsize;
if ((ret = ff_alloc_packet2(avctx, pkt, n_bytes)) < 0)
return ret;
buf = pkt->data;
bytestream_put_byte(&buf, 'B'); // BITMAPFILEHEADER.bfType
bytestream_put_byte(&buf, 'M'); // do.
bytestream_put_le32(&buf, n_bytes); // BITMAPFILEHEADER.bfSize
bytestream_put_le16(&buf, 0); // BITMAPFILEHEADER.bfReserved1
bytestream_put_le16(&buf, 0); // BITMAPFILEHEADER.bfReserved2
bytestream_put_le32(&buf, hsize); // BITMAPFILEHEADER.bfOffBits
bytestream_put_le32(&buf, SIZE_BITMAPINFOHEADER); // BITMAPINFOHEADER.biSize
bytestream_put_le32(&buf, avctx->width); // BITMAPINFOHEADER.biWidth
bytestream_put_le32(&buf, avctx->height); // BITMAPINFOHEADER.biHeight
bytestream_put_le16(&buf, 1); // BITMAPINFOHEADER.biPlanes
bytestream_put_le16(&buf, bit_count); // BITMAPINFOHEADER.biBitCount
bytestream_put_le32(&buf, compression); // BITMAPINFOHEADER.biCompression
bytestream_put_le32(&buf, n_bytes_image); // BITMAPINFOHEADER.biSizeImage
bytestream_put_le32(&buf, 0); // BITMAPINFOHEADER.biXPelsPerMeter
bytestream_put_le32(&buf, 0); // BITMAPINFOHEADER.biYPelsPerMeter
bytestream_put_le32(&buf, 0); // BITMAPINFOHEADER.biClrUsed
bytestream_put_le32(&buf, 0); // BITMAPINFOHEADER.biClrImportant
for (i = 0; i < pal_entries; i++)
bytestream_put_le32(&buf, pal[i] & 0xFFFFFF);
// BMP files are bottom-to-top so we start from the end...
ptr = p->data[0] + (avctx->height - 1) * p->linesize[0];
buf = pkt->data + hsize;
for(i = 0; i < avctx->height; i++) {
if (bit_count == 16) {
const uint16_t *src = (const uint16_t *) ptr;
uint16_t *dst = (uint16_t *) buf;
for(n = 0; n < avctx->width; n++)
AV_WL16(dst + n, src[n]);
} else {
memcpy(buf, ptr, n_bytes_per_row);
}
buf += n_bytes_per_row;
memset(buf, 0, pad_bytes_per_row);
buf += pad_bytes_per_row;
ptr -= p->linesize[0]; // ... and go back
}
pkt->flags |= AV_PKT_FLAG_KEY;
*got_packet = 1;
return 0;
}
开发者ID:dotscreen,项目名称:FFmpeg,代码行数:96,代码来源:bmpenc.c
注:本文中的bytestream_put_le32函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论