changeset 2112:e6b06336f94b libavformat

get rid of one layer of callback obfuscation
author michael
date Sat, 02 Jun 2007 23:11:17 +0000
parents 4aafc6050f39
children eb0513a0c1b6
files mpegts.c
diffstat 1 files changed, 4 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/mpegts.c	Sat Jun 02 23:04:46 2007 +0000
+++ b/mpegts.c	Sat Jun 02 23:11:17 2007 +0000
@@ -111,9 +111,6 @@
     /** list of PMTs in the last PAT seen                    */
     MpegTSService **services;
 
-    /* set service context (XXX: allocated it ?) */
-    SetServiceCallback *set_service_cb;
-    void *set_service_opaque;
     /** filter for the PAT                                   */
     MpegTSFilter *pat_filter;
     /** filter for the PMT for the MPEG program number specified by req_sid */
@@ -529,7 +526,7 @@
         }
     }
     /* all parameters are there */
-    ts->set_service_cb(ts->set_service_opaque, 0);
+    ts->stop_parse=1;
     mpegts_close_filter(ts, ts->pmt_filter);
     ts->pmt_filter = NULL;
 }
@@ -573,7 +570,7 @@
         }
     }
     /* not found */
-    ts->set_service_cb(ts->set_service_opaque, -1);
+    ts->stop_parse=1;
 
  found:
     mpegts_close_filter(ts, ts->pat_filter);
@@ -633,11 +630,8 @@
     ts->pat_filter = NULL;
 }
 
-static void mpegts_set_service(MpegTSContext *ts, int sid,
-                        SetServiceCallback *set_service_cb, void *opaque)
+static void mpegts_set_service(MpegTSContext *ts, int sid)
 {
-    ts->set_service_cb = set_service_cb;
-    ts->set_service_opaque = opaque;
     ts->req_sid = sid;
     ts->pat_filter = mpegts_open_section_filter(ts, PAT_PID,
                                                 pat_cb, ts, 1);
@@ -1158,12 +1152,6 @@
 #endif
 }
 
-static void set_service_cb(void *opaque, int ret)
-{
-    MpegTSContext *ts = opaque;
-    ts->stop_parse = 1;
-}
-
 /* return the 90 kHz PCR and the extension for the 27 MHz PCR. return
    (-1) if not available */
 static int parse_pcr(int64_t *ppcr_high, int *ppcr_low,
@@ -1266,7 +1254,7 @@
                 otherwise try to filter all PATs */
 
                 url_fseek(pb, pos, SEEK_SET);
-                mpegts_set_service(ts, sid, set_service_cb, ts);
+                mpegts_set_service(ts, sid);
 
                 handle_packets(ts, s->probesize);
             }