mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
set the previous tag size correctly in flv files
Originally committed as revision 9919 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
48a59dfe8e
commit
f683dbdc6a
@ -275,10 +275,15 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt)
|
|||||||
AVCodecContext *enc = s->streams[pkt->stream_index]->codec;
|
AVCodecContext *enc = s->streams[pkt->stream_index]->codec;
|
||||||
FLVContext *flv = s->priv_data;
|
FLVContext *flv = s->priv_data;
|
||||||
int size= pkt->size;
|
int size= pkt->size;
|
||||||
int flags;
|
int flags, flags_size;
|
||||||
|
|
||||||
// av_log(s, AV_LOG_DEBUG, "type:%d pts: %"PRId64" size:%d\n", enc->codec_type, timestamp, size);
|
// av_log(s, AV_LOG_DEBUG, "type:%d pts: %"PRId64" size:%d\n", enc->codec_type, timestamp, size);
|
||||||
|
|
||||||
|
if(enc->codec_id == CODEC_ID_VP6 || enc->codec_id == CODEC_ID_VP6F)
|
||||||
|
flags_size= 2;
|
||||||
|
else
|
||||||
|
flags_size= 1;
|
||||||
|
|
||||||
if (enc->codec_type == CODEC_TYPE_VIDEO) {
|
if (enc->codec_type == CODEC_TYPE_VIDEO) {
|
||||||
put_byte(pb, FLV_TAG_TYPE_VIDEO);
|
put_byte(pb, FLV_TAG_TYPE_VIDEO);
|
||||||
|
|
||||||
@ -298,10 +303,7 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt)
|
|||||||
put_byte(pb, FLV_TAG_TYPE_AUDIO);
|
put_byte(pb, FLV_TAG_TYPE_AUDIO);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((enc->codec_id == CODEC_ID_VP6) || (enc->codec_id == CODEC_ID_VP6F))
|
put_be24(pb,size + flags_size);
|
||||||
put_be24(pb,size+2); // include the extra byte needed for VP6 in flv and flags
|
|
||||||
else
|
|
||||||
put_be24(pb,size+1); // include flags
|
|
||||||
put_be24(pb,pkt->pts);
|
put_be24(pb,pkt->pts);
|
||||||
put_be32(pb,flv->reserved);
|
put_be32(pb,flv->reserved);
|
||||||
put_byte(pb,flags);
|
put_byte(pb,flags);
|
||||||
@ -310,7 +312,7 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt)
|
|||||||
if (enc->codec_id == CODEC_ID_VP6F)
|
if (enc->codec_id == CODEC_ID_VP6F)
|
||||||
put_byte(pb, enc->extradata_size ? enc->extradata[0] : 0);
|
put_byte(pb, enc->extradata_size ? enc->extradata[0] : 0);
|
||||||
put_buffer(pb, pkt->data, size);
|
put_buffer(pb, pkt->data, size);
|
||||||
put_be32(pb,size+1+11); // previous tag size
|
put_be32(pb,size+flags_size+11); // previous tag size
|
||||||
flv->duration = pkt->pts + pkt->duration;
|
flv->duration = pkt->pts + pkt->duration;
|
||||||
|
|
||||||
put_flush_packet(pb);
|
put_flush_packet(pb);
|
||||||
|
Loading…
Reference in New Issue
Block a user