[FFmpeg-devel] [Patch] Topfield 58XXPVR and 68XXPVR file support

Måns Rullgård mans
Tue Feb 3 03:40:25 CET 2009


Michael Niedermayer <michaelni at gmx.at> writes:

> On Sun, Nov 30, 2008 at 10:13:52AM +0000, M?ns Rullg?rd wrote:
>> "James Marsh" <doctorjames at gmail.com> writes:
>> 
>> > Topfield make a variety of personal video recorders that allow for the
>> > transfer of recorded programmes via an onboard USB port. The ".rec"
>> > files they produce are MPEG2 transport streams with a 3760 byte header
>> > containing archive information for the PVR. The attached patch checks
>> > for the presence of "TFrc" in the first four bytes of a file and
>> > identifies it as an mpeg transport stream if present. It subsequently
>> > skips this header when the services are probed. With the patch in
>> > place these files are then fully supported by ffmpeg.
>> 
>> Please upload a sample.
>
> heres a better patch that fixes this.
>
> can i apply it?
>
> Index: libavformat/mpegts.c
> ===================================================================
> --- libavformat/mpegts.c	(revision 16868)
> +++ libavformat/mpegts.c	(working copy)
> @@ -1177,14 +1177,15 @@
>  #if 1
>      const int size= p->buf_size;
>      int score, fec_score, dvhs_score;
> +    int check_count= size / TS_FEC_PACKET_SIZE;
>  #define CHECK_COUNT 10
>
> -    if (size < (TS_FEC_PACKET_SIZE * CHECK_COUNT))
> +    if (check_count < CHECK_COUNT)
>          return -1;
>
> -    score    = analyze(p->buf, TS_PACKET_SIZE    *CHECK_COUNT, TS_PACKET_SIZE, NULL);
> -    dvhs_score  = analyze(p->buf, TS_DVHS_PACKET_SIZE    *CHECK_COUNT, TS_DVHS_PACKET_SIZE, NULL);
> -    fec_score= analyze(p->buf, TS_FEC_PACKET_SIZE*CHECK_COUNT, TS_FEC_PACKET_SIZE, NULL);
> +    score     = analyze(p->buf, TS_PACKET_SIZE     *check_count, TS_PACKET_SIZE     , NULL)*CHECK_COUNT/check_count;
> +    dvhs_score= analyze(p->buf, TS_DVHS_PACKET_SIZE*check_count, TS_DVHS_PACKET_SIZE, NULL)*CHECK_COUNT/check_count;
> +    fec_score = analyze(p->buf, TS_FEC_PACKET_SIZE *check_count, TS_FEC_PACKET_SIZE , NULL)*CHECK_COUNT/check_count;
>  //    av_log(NULL, AV_LOG_DEBUG, "score: %d, dvhs_score: %d, fec_score: %d \n", score, dvhs_score, fec_score);
>
>  // we need a clear definition for the returned score otherwise things will become messy sooner or later
> @@ -1235,7 +1236,7 @@
>  {
>      MpegTSContext *ts = s->priv_data;
>      ByteIOContext *pb = s->pb;
> -    uint8_t buf[1024];
> +    uint8_t buf[5*1024];
>      int len;
>      int64_t pos;

OK

-- 
M?ns Rullg?rd
mans at mansr.com




More information about the ffmpeg-devel mailing list