summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKieran Kunhya <kieran@kunhya.com>2011-03-11 12:39:55 +0000
committerMichael Niedermayer <michaelni@gmx.at>2011-05-28 04:11:26 +0200
commit5501afa6ee857693bf4fe745792ab7b79477f731 (patch)
tree112a88b867333f07c7987fef7a1d2ebfd494da13
parent24adef142f4901abf7e92e79d20b79f332d5c54f (diff)
Export PCR pid
-rw-r--r--libavformat/avformat.h1
-rw-r--r--libavformat/mpegts.c12
2 files changed, 13 insertions, 0 deletions
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 783039bcb2..292479e3d6 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -650,6 +650,7 @@ typedef struct AVProgram {
int program_num;
int pmt_pid;
+ int pcr_pid;
} AVProgram;
#define AVFMTCTX_NOHEADER 0x0001 /**< signal that no header is present
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index b5f25aa40d..df7a89979d 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -221,6 +221,17 @@ static void add_pid_to_pmt(MpegTSContext *ts, unsigned int programid, unsigned i
p->pids[p->nb_pids++] = pid;
}
+static void set_pcr_pid(AVFormatContext *s, unsigned int programid, unsigned int pid)
+{
+ int i;
+ for(i=0; i<s->nb_programs; i++) {
+ if(s->programs[i]->id == programid) {
+ s->programs[i]->pcr_pid = pid;
+ break;
+ }
+ }
+}
+
/**
* \brief discard_pid() decides if the pid is to be discarded according
* to caller's programs selection
@@ -1039,6 +1050,7 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
if (pcr_pid < 0)
return;
add_pid_to_pmt(ts, h->id, pcr_pid);
+ set_pcr_pid(ts->stream, h->id, pcr_pid);
av_dlog(ts->stream, "pcr_pid=0x%x\n", pcr_pid);