lavf: replace remaining uses of put_tag with avio_write

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
oldabi
Anton Khirnov 14 years ago committed by Ronald S. Bultje
parent 99f42c27ab
commit bbc413f943
  1. 4
      libavformat/amr.c
  2. 6
      libavformat/ffmetaenc.c
  3. 2
      libavformat/flvenc.c
  4. 6
      libavformat/gif.c
  5. 11
      libavformat/gxfenc.c
  6. 2
      libavformat/mmf.c
  7. 2
      libavformat/rmenc.c
  8. 4
      libavformat/swfenc.c

@ -40,11 +40,11 @@ static int amr_write_header(AVFormatContext *s)
if (enc->codec_id == CODEC_ID_AMR_NB)
{
put_tag(pb, AMR_header); /* magic number */
avio_write(pb, AMR_header, sizeof(AMR_header) - 1); /* magic number */
}
else if(enc->codec_id == CODEC_ID_AMR_WB)
{
put_tag(pb, AMRWB_header); /* magic number */
avio_write(pb, AMRWB_header, sizeof(AMRWB_header) - 1); /* magic number */
}
else
{

@ -50,7 +50,7 @@ static void write_tags(AVIOContext *s, AVMetadata *m)
static int write_header(AVFormatContext *s)
{
put_tag(s->pb, ID_STRING);
avio_write(s->pb, ID_STRING, sizeof(ID_STRING) - 1);
avio_w8(s->pb, '1'); // version
avio_w8(s->pb, '\n');
put_flush_packet(s->pb);
@ -64,14 +64,14 @@ static int write_trailer(AVFormatContext *s)
write_tags(s->pb, s->metadata);
for (i = 0; i < s->nb_streams; i++) {
put_tag(s->pb, ID_STREAM);
avio_write(s->pb, ID_STREAM, sizeof(ID_STREAM) - 1);
avio_w8(s->pb, '\n');
write_tags(s->pb, s->streams[i]->metadata);
}
for (i = 0; i < s->nb_chapters; i++) {
AVChapter *ch = s->chapters[i];
put_tag(s->pb, ID_CHAPTER);
avio_write(s->pb, ID_CHAPTER, sizeof(ID_CHAPTER) - 1);
avio_w8(s->pb, '\n');
url_fprintf(s->pb, "TIMEBASE=%d/%d\n", ch->time_base.num, ch->time_base.den);
url_fprintf(s->pb, "START=%"PRId64"\n", ch->start);

@ -199,7 +199,7 @@ static int flv_write_header(AVFormatContext *s)
}
av_set_pts_info(s->streams[i], 32, 1, 1000); /* 32 bit pts in ms */
}
put_tag(pb,"FLV");
avio_write(pb, "FLV", 3);
avio_w8(pb,1);
avio_w8(pb, FLV_HEADER_FLAG_HASAUDIO * !!audio_enc
+ FLV_HEADER_FLAG_HASVIDEO * !!video_enc);

@ -114,8 +114,8 @@ static int gif_image_write_header(AVIOContext *pb,
int i;
unsigned int v;
put_tag(pb, "GIF");
put_tag(pb, "89a");
avio_write(pb, "GIF", 3);
avio_write(pb, "89a", 3);
avio_wl16(pb, width);
avio_wl16(pb, height);
@ -162,7 +162,7 @@ static int gif_image_write_header(AVIOContext *pb,
avio_w8(pb, 0x21);
avio_w8(pb, 0xff);
avio_w8(pb, 0x0b);
put_tag(pb, "NETSCAPE2.0"); // bytes 4 to 14
avio_write(pb, "NETSCAPE2.0", sizeof("NETSCAPE2.0") - 1); // bytes 4 to 14
avio_w8(pb, 0x03); // byte 15
avio_w8(pb, 0x01); // byte 16
avio_wl16(pb, (uint16_t)loop_count);

@ -224,7 +224,7 @@ static int gxf_write_track_description(AVFormatContext *s, GXFStreamContext *sc,
/* media file name */
avio_w8(pb, TRACK_NAME);
avio_w8(pb, strlen(ES_NAME_PATTERN) + 3);
put_tag(pb, ES_NAME_PATTERN);
avio_write(pb, ES_NAME_PATTERN, sizeof(ES_NAME_PATTERN) - 1);
avio_wb16(pb, sc->media_info);
avio_w8(pb, 0);
@ -269,6 +269,7 @@ static int gxf_write_material_data_section(AVFormatContext *s)
GXFContext *gxf = s->priv_data;
AVIOContext *pb = s->pb;
int64_t pos;
int len;
const char *filename = strrchr(s->filename, '/');
pos = url_ftell(pb);
@ -279,10 +280,12 @@ static int gxf_write_material_data_section(AVFormatContext *s)
filename++;
else
filename = s->filename;
len = strlen(filename);
avio_w8(pb, MAT_NAME);
avio_w8(pb, strlen(SERVER_PATH) + strlen(filename) + 1);
put_tag(pb, SERVER_PATH);
put_tag(pb, filename);
avio_w8(pb, strlen(SERVER_PATH) + len + 1);
avio_write(pb, SERVER_PATH, sizeof(SERVER_PATH) - 1);
avio_write(pb, filename, len);
avio_w8(pb, 0);
/* first field */

@ -79,7 +79,7 @@ static int mmf_write_header(AVFormatContext *s)
avio_w8(pb, 0); /* code type */
avio_w8(pb, 0); /* status */
avio_w8(pb, 0); /* counts */
put_tag(pb, "VN:libavcodec,"); /* metadata ("ST:songtitle,VN:version,...") */
avio_write(pb, "VN:libavcodec,", sizeof("VN:libavcodec,") -1); /* metadata ("ST:songtitle,VN:version,...") */
end_tag_be(pb, pos);
avio_write(pb, "ATR\x00", 4);

@ -184,7 +184,7 @@ static int rv10_write_header(AVFormatContext *ctx,
coded_frame_size = (stream->enc->bit_rate *
stream->enc->frame_size) / (8 * sample_rate);
/* audio codec info */
put_tag(s, ".ra");
avio_write(s, ".ra", 3);
avio_w8(s, 0xfd);
avio_wb32(s, 0x00040000); /* version */
ffio_wfourcc(s, ".ra4");

@ -229,7 +229,7 @@ static int swf_write_header(AVFormatContext *s)
else
swf->samples_per_frame = (swf->audio_enc->sample_rate * rate_base) / rate;
put_tag(pb, "FWS");
avio_write(pb, "FWS", 3);
if (!strcmp("avm2", s->oformat->name))
version = 9;
@ -361,7 +361,7 @@ static int swf_write_video(AVFormatContext *s,
avio_wl16(pb, VIDEO_ID);
put_swf_matrix(pb, 1 << FRAC_BITS, 0, 0, 1 << FRAC_BITS, 0, 0);
avio_wl16(pb, swf->video_frame_number);
put_tag(pb, "video");
avio_write(pb, "video", 5);
avio_w8(pb, 0x00);
put_swf_end_tag(s);
} else {

Loading…
Cancel
Save