comparison asf-enc.c @ 1887:490aa34aef0f libavformat

move preroll_time from static variable into definition, might be a good idea moving this into the context and making user-settable
author alex
date Wed, 07 Mar 2007 02:03:32 +0000
parents 54f814d6708c
children 87148b96d649
comparison
equal deleted inserted replaced
1886:cf8db4fe9efa 1887:490aa34aef0f
192 { CODEC_ID_MPEG4, MKTAG('M', '4', 'S', '2') }, 192 { CODEC_ID_MPEG4, MKTAG('M', '4', 'S', '2') },
193 { CODEC_ID_MSMPEG4V3, MKTAG('M', 'P', '4', '3') }, 193 { CODEC_ID_MSMPEG4V3, MKTAG('M', 'P', '4', '3') },
194 { CODEC_ID_NONE, 0 }, 194 { CODEC_ID_NONE, 0 },
195 }; 195 };
196 196
197 static int preroll_time = 3100; 197 #define PREROLL_TIME 3100
198 198
199 static void put_guid(ByteIOContext *s, const GUID *g) 199 static void put_guid(ByteIOContext *s, const GUID *g)
200 { 200 {
201 assert(sizeof(*g) == 16); 201 assert(sizeof(*g) == 16);
202 put_buffer(s, g, sizeof(*g)); 202 put_buffer(s, g, sizeof(*g));
276 AVCodecContext *enc; 276 AVCodecContext *enc;
277 int64_t header_offset, cur_pos, hpos; 277 int64_t header_offset, cur_pos, hpos;
278 int bit_rate; 278 int bit_rate;
279 int64_t duration; 279 int64_t duration;
280 280
281 duration = asf->duration + preroll_time * 10000; 281 duration = asf->duration + PREROLL_TIME * 10000;
282 has_title = (s->title[0] || s->author[0] || s->copyright[0] || s->comment[0]); 282 has_title = (s->title[0] || s->author[0] || s->copyright[0] || s->comment[0]);
283 283
284 bit_rate = 0; 284 bit_rate = 0;
285 for(n=0;n<s->nb_streams;n++) { 285 for(n=0;n<s->nb_streams;n++) {
286 enc = s->streams[n]->codec; 286 enc = s->streams[n]->codec;
308 file_time = 0; 308 file_time = 0;
309 put_le64(pb, unix_to_file_time(file_time)); 309 put_le64(pb, unix_to_file_time(file_time));
310 put_le64(pb, asf->nb_packets); /* number of packets */ 310 put_le64(pb, asf->nb_packets); /* number of packets */
311 put_le64(pb, duration); /* end time stamp (in 100ns units) */ 311 put_le64(pb, duration); /* end time stamp (in 100ns units) */
312 put_le64(pb, asf->duration); /* duration (in 100ns units) */ 312 put_le64(pb, asf->duration); /* duration (in 100ns units) */
313 put_le64(pb, preroll_time); /* start time stamp */ 313 put_le64(pb, PREROLL_TIME); /* start time stamp */
314 put_le32(pb, asf->is_streamed ? 3 : 2); /* ??? */ 314 put_le32(pb, asf->is_streamed ? 3 : 2); /* ??? */
315 put_le32(pb, asf->packet_size); /* packet size */ 315 put_le32(pb, asf->packet_size); /* packet size */
316 put_le32(pb, asf->packet_size); /* packet size */ 316 put_le32(pb, asf->packet_size); /* packet size */
317 put_le32(pb, bit_rate); /* Nominal data rate in bps */ 317 put_le32(pb, bit_rate); /* Nominal data rate in bps */
318 end_header(pb, hpos); 318 end_header(pb, hpos);
688 if (payload_len > frag_len1) 688 if (payload_len > frag_len1)
689 payload_len = frag_len1; 689 payload_len = frag_len1;
690 else if (payload_len == (frag_len1 - 1)) 690 else if (payload_len == (frag_len1 - 1))
691 payload_len = frag_len1 - 2; //additional byte need to put padding length 691 payload_len = frag_len1 - 2; //additional byte need to put padding length
692 692
693 put_payload_header(s, stream, timestamp+preroll_time, m_obj_size, m_obj_offset, payload_len, flags); 693 put_payload_header(s, stream, timestamp+PREROLL_TIME, m_obj_size, m_obj_offset, payload_len, flags);
694 put_buffer(&asf->pb, buf, payload_len); 694 put_buffer(&asf->pb, buf, payload_len);
695 695
696 if (asf->multi_payloads_present) 696 if (asf->multi_payloads_present)
697 asf->packet_size_left -= (payload_len + PAYLOAD_HEADER_SIZE_MULTIPLE_PAYLOADS); 697 asf->packet_size_left -= (payload_len + PAYLOAD_HEADER_SIZE_MULTIPLE_PAYLOADS);
698 else 698 else