changeset 891:6e45fbd73a52 libavformat

added support for DVHS (192) packet size
author nicodvb
date Mon, 02 Jan 2006 20:13:24 +0000
parents 1e49bfea0ffb
children 1917a1f7d223
files mpegts.c mpegts.h
diffstat 2 files changed, 12 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mpegts.c	Fri Dec 30 20:34:08 2005 +0000
+++ b/mpegts.c	Mon Jan 02 20:13:24 2006 +0000
@@ -246,17 +246,19 @@
 /* autodetect fec presence. Must have at least 1024 bytes  */
 static int get_packet_size(const uint8_t *buf, int size)
 {
-    int score, fec_score;
+    int score, fec_score, dvhs_score;
 
     if (size < (TS_FEC_PACKET_SIZE * 5 + 1))
         return -1;
 
     score    = analyze(buf, size, TS_PACKET_SIZE, NULL);
+    dvhs_score    = analyze(buf, size, TS_DVHS_PACKET_SIZE, NULL);
     fec_score= analyze(buf, size, TS_FEC_PACKET_SIZE, NULL);
-//    av_log(NULL, AV_LOG_DEBUG, "score: %d, fec_score: %d \n", score, fec_score);
+//    av_log(NULL, AV_LOG_DEBUG, "score: %d, dvhs_score: %d, fec_score: %d \n", score, dvhs_score, fec_score);
 
-    if     (score > fec_score) return TS_PACKET_SIZE;
-    else if(score < fec_score) return TS_FEC_PACKET_SIZE;
+    if     (score > fec_score && score > dvhs_score) return TS_PACKET_SIZE;
+    else if(dvhs_score > score && dvhs_score > fec_score) return TS_DVHS_PACKET_SIZE;
+    else if(score < fec_score && dvhs_score < fec_score) return TS_FEC_PACKET_SIZE;
     else                       return -1;
 }
 
@@ -1094,18 +1096,20 @@
 {
 #if 1
     const int size= p->buf_size;
-    int score, fec_score;
+    int score, fec_score, dvhs_score;
 #define CHECK_COUNT 10
 
     if (size < (TS_FEC_PACKET_SIZE * 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);
-//    av_log(NULL, AV_LOG_DEBUG, "score: %d, fec_score: %d \n", score, fec_score);
+//    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
-    if     (score > fec_score && score > 6) return AVPROBE_SCORE_MAX + score     - CHECK_COUNT;
+    if     (score > fec_score && score > dvhs_score && score > 6) return AVPROBE_SCORE_MAX + score     - CHECK_COUNT;
+    else if(dvhs_score > score && dvhs_score > fec_score && dvhs_score > 6) return AVPROBE_SCORE_MAX + dvhs_score  - CHECK_COUNT;
     else if(                 fec_score > 6) return AVPROBE_SCORE_MAX + fec_score - CHECK_COUNT;
     else                                    return -1;
 #else
--- a/mpegts.h	Fri Dec 30 20:34:08 2005 +0000
+++ b/mpegts.h	Mon Jan 02 20:13:24 2006 +0000
@@ -18,6 +18,7 @@
  */
 
 #define TS_FEC_PACKET_SIZE 204
+#define TS_DVHS_PACKET_SIZE 192
 #define TS_PACKET_SIZE 188
 #define NB_PID_MAX 8192
 #define MAX_SECTION_SIZE 4096