Mercurial > libavformat.hg
comparison mpegtsenc.c @ 5219:583eb737b1c4 libavformat
fix pes overhead computation, patch by Niobos, niobos at dest-unreach dot be
author | bcoudurier |
---|---|
date | Thu, 17 Sep 2009 19:07:09 +0000 |
parents | 640c875b3bfe |
children | 95a0faec0218 |
comparison
equal
deleted
inserted
replaced
5218:ebbaf1c20a84 | 5219:583eb737b1c4 |
---|---|
426 service->pcr_pid == 0x1fff) | 426 service->pcr_pid == 0x1fff) |
427 service->pcr_pid = ts_st->pid; | 427 service->pcr_pid = ts_st->pid; |
428 total_bit_rate += st->codec->bit_rate; | 428 total_bit_rate += st->codec->bit_rate; |
429 /* PES header size */ | 429 /* PES header size */ |
430 if (st->codec->codec_type == CODEC_TYPE_VIDEO || | 430 if (st->codec->codec_type == CODEC_TYPE_VIDEO || |
431 st->codec->codec_type == CODEC_TYPE_SUBTITLE) | 431 st->codec->codec_type == CODEC_TYPE_SUBTITLE) { |
432 total_bit_rate += 25 * 8 / av_q2d(st->codec->time_base); | 432 /* 1 PES per frame |
433 else | 433 * 19 bytes of PES header |
434 total_bit_rate += total_bit_rate * 25 / DEFAULT_PES_PAYLOAD_SIZE; | 434 * on average a half TS-packet (184/2) of padding-overhead every PES */ |
435 total_bit_rate += (19 + 184/2)*8 / av_q2d(st->codec->time_base); | |
436 } else { | |
437 /* 1 PES per DEFAULT_PES_PAYLOAD_SIZE bytes of audio data | |
438 * 14 bytes of PES header | |
439 * on average a half TS-packet (184/2) of padding-overhead every PES */ | |
440 total_bit_rate += (14 + 184/2) * | |
441 st->codec->bit_rate / DEFAULT_PES_PAYLOAD_SIZE; | |
442 } | |
435 } | 443 } |
436 | 444 |
437 /* if no video stream, use the first stream as PCR */ | 445 /* if no video stream, use the first stream as PCR */ |
438 if (service->pcr_pid == 0x1fff && s->nb_streams > 0) { | 446 if (service->pcr_pid == 0x1fff && s->nb_streams > 0) { |
439 ts_st = s->streams[0]->priv_data; | 447 ts_st = s->streams[0]->priv_data; |