On Wed, Nov 01, 2017 at 02:40:27PM +0100, Paul B Mahol wrote: > Signed-off-by: Paul B Mahol <one...@gmail.com> > --- > libavformat/Makefile | 1 + > libavformat/allformats.c | 1 + > libavformat/ty.c | 775 > +++++++++++++++++++++++++++++++++++++++++++++++ > 3 files changed, 777 insertions(+) > create mode 100644 libavformat/ty.c
[...] > +static int64_t get_pts(const uint8_t *buf) > +{ > + int a = buf[0] & 0xe >> 1; > + int b = AV_RB16(buf + 1); > + int c = AV_RB16(buf + 3); > + > + if (!(1 & a & b & c)) > + return AV_NOPTS_VALUE; > + > + a >>= 1; > + b >>= 1; > + c >>= 1; > + return (((uint64_t)a) << 30) | (b << 15) | c; > +} duplicate of ff_parse_pes_pts() i didnt check most of the code but seeing this, i wonder how much more mpeg demuxing this duplicates ? > + > +static int DemuxRecVideo(AVFormatContext *s, TyRecHdr *rec_hdr, AVPacket > *pkt) > +{ > + TYDemuxContext *ty = s->priv_data; > + AVIOContext *pb = s->pb; > + const int subrec_type = rec_hdr->subrec_type; > + const int64_t rec_size = rec_hdr->rec_size; > + int esOffset1; > + int got_packet = 0; > + > + avio_read(pb, ty->chunk, 32); > + avio_seek(pb, -32, SEEK_CUR); > + > + if (subrec_type != 0x02 && subrec_type != 0x0c && > + subrec_type != 0x08 && rec_size > 4) { > + /* get the PTS from this packet if it has one. > + * on S1, only 0x06 has PES. On S2, however, most all do. > + * Do NOT Pass the PES Header to the MPEG2 codec */ > + esOffset1 = find_es_header(ty_VideoPacket, ty->chunk, 5); > + if (esOffset1 != -1) { > + ty->last_video_pts = get_pts( > + &ty->chunk[ esOffset1 + VIDEO_PTS_OFFSET ] ); > + if (subrec_type != 0x06) { > + /* if we found a PES, and it's not type 6, then we're S2 */ > + /* The packet will have video data (& other headers) so we > + * chop out the PES header and send the rest */ > + if (rec_size >= VIDEO_PES_LENGTH + esOffset1) { > + int size = rec_hdr->rec_size - VIDEO_PES_LENGTH - > esOffset1; > + avio_skip(pb, VIDEO_PES_LENGTH + esOffset1); > + av_get_packet(pb, pkt, size); this and other av_get_packet() calls lack error handling [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Complexity theory is the science of finding the exact solution to an approximation. Benchmarking OTOH is finding an approximation of the exact
signature.asc
Description: Digital signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel