Signed-off-by: Vasyl' Vavrychuk <vvavrychuk@gmail.com>
Signed-off-by: Mans Rullgard <mans@mansr.com>
(cherry picked from commit 665132e6204766b1d43ce413d6b1cc2a1d34ea29)
... | ... |
@@ -63,7 +63,7 @@ static const int lpcm_freq_tab[4] = { 48000, 96000, 44100, 32000 }; |
63 | 63 |
/** |
64 | 64 |
* Parse MPEG-PES five-byte timestamp |
65 | 65 |
*/ |
66 |
-static inline int64_t ff_parse_pes_pts(uint8_t *buf) { |
|
66 |
+static inline int64_t ff_parse_pes_pts(const uint8_t *buf) { |
|
67 | 67 |
return (int64_t)(*buf & 0x0e) << 29 | |
68 | 68 |
(AV_RB16(buf+1) >> 1) << 15 | |
69 | 69 |
AV_RB16(buf+3) >> 1; |
... | ... |
@@ -30,6 +30,7 @@ |
30 | 30 |
#include "mpegts.h" |
31 | 31 |
#include "internal.h" |
32 | 32 |
#include "seek.h" |
33 |
+#include "mpeg.h" |
|
33 | 34 |
#include "isom.h" |
34 | 35 |
|
35 | 36 |
/* 1.0 second at 24Mbit/s */ |
... | ... |
@@ -601,14 +602,6 @@ static int mpegts_set_stream_info(AVStream *st, PESContext *pes, |
601 | 601 |
return 0; |
602 | 602 |
} |
603 | 603 |
|
604 |
-static int64_t get_pts(const uint8_t *p) |
|
605 |
-{ |
|
606 |
- int64_t pts = (int64_t)((p[0] >> 1) & 0x07) << 30; |
|
607 |
- pts |= (AV_RB16(p + 1) >> 1) << 15; |
|
608 |
- pts |= AV_RB16(p + 3) >> 1; |
|
609 |
- return pts; |
|
610 |
-} |
|
611 |
- |
|
612 | 604 |
static void new_pes_packet(PESContext *pes, AVPacket *pkt) |
613 | 605 |
{ |
614 | 606 |
av_init_packet(pkt); |
... | ... |
@@ -767,12 +760,12 @@ static int mpegts_push_data(MpegTSFilter *filter, |
767 | 767 |
pes->pts = AV_NOPTS_VALUE; |
768 | 768 |
pes->dts = AV_NOPTS_VALUE; |
769 | 769 |
if ((flags & 0xc0) == 0x80) { |
770 |
- pes->dts = pes->pts = get_pts(r); |
|
770 |
+ pes->dts = pes->pts = ff_parse_pes_pts(r); |
|
771 | 771 |
r += 5; |
772 | 772 |
} else if ((flags & 0xc0) == 0xc0) { |
773 |
- pes->pts = get_pts(r); |
|
773 |
+ pes->pts = ff_parse_pes_pts(r); |
|
774 | 774 |
r += 5; |
775 |
- pes->dts = get_pts(r); |
|
775 |
+ pes->dts = ff_parse_pes_pts(r); |
|
776 | 776 |
r += 5; |
777 | 777 |
} |
778 | 778 |
pes->extended_stream_id = -1; |