Originally committed as revision 9919 to svn://svn.ffmpeg.org/ffmpeg/trunk
Michael Niedermayer authored on 2007/08/05 08:03:17... | ... |
@@ -275,10 +275,15 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) |
275 | 275 |
AVCodecContext *enc = s->streams[pkt->stream_index]->codec; |
276 | 276 |
FLVContext *flv = s->priv_data; |
277 | 277 |
int size= pkt->size; |
278 |
- int flags; |
|
278 |
+ int flags, flags_size; |
|
279 | 279 |
|
280 | 280 |
// av_log(s, AV_LOG_DEBUG, "type:%d pts: %"PRId64" size:%d\n", enc->codec_type, timestamp, size); |
281 | 281 |
|
282 |
+ if(enc->codec_id == CODEC_ID_VP6 || enc->codec_id == CODEC_ID_VP6F) |
|
283 |
+ flags_size= 2; |
|
284 |
+ else |
|
285 |
+ flags_size= 1; |
|
286 |
+ |
|
282 | 287 |
if (enc->codec_type == CODEC_TYPE_VIDEO) { |
283 | 288 |
put_byte(pb, FLV_TAG_TYPE_VIDEO); |
284 | 289 |
|
... | ... |
@@ -298,10 +303,7 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) |
298 | 298 |
put_byte(pb, FLV_TAG_TYPE_AUDIO); |
299 | 299 |
} |
300 | 300 |
|
301 |
- if ((enc->codec_id == CODEC_ID_VP6) || (enc->codec_id == CODEC_ID_VP6F)) |
|
302 |
- put_be24(pb,size+2); // include the extra byte needed for VP6 in flv and flags |
|
303 |
- else |
|
304 |
- put_be24(pb,size+1); // include flags |
|
301 |
+ put_be24(pb,size + flags_size); |
|
305 | 302 |
put_be24(pb,pkt->pts); |
306 | 303 |
put_be32(pb,flv->reserved); |
307 | 304 |
put_byte(pb,flags); |
... | ... |
@@ -310,7 +312,7 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) |
310 | 310 |
if (enc->codec_id == CODEC_ID_VP6F) |
311 | 311 |
put_byte(pb, enc->extradata_size ? enc->extradata[0] : 0); |
312 | 312 |
put_buffer(pb, pkt->data, size); |
313 |
- put_be32(pb,size+1+11); // previous tag size |
|
313 |
+ put_be32(pb,size+flags_size+11); // previous tag size |
|
314 | 314 |
flv->duration = pkt->pts + pkt->duration; |
315 | 315 |
|
316 | 316 |
put_flush_packet(pb); |