[FFmpeg-devel] [PATCH] libavformat: forced PCR pid in mpegts muxer

Andreas Håkon andreas.hakon at protonmail.com
Tue Apr 23 15:34:02 EEST 2019


‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Tuesday, 23 de April de 2019 14:20, Moritz Barsnick <barsnick at gmx.net> wrote:

> On Tue, Apr 23, 2019 at 12:03:11 +0000, Andreas Håkon wrote:
>
> > In addition, one correction regarding the initialization.
> > Sorry, but first version has an error. This is clean!
>
> I had seen that the option got initialized to 0x0000, but checked that
> that is never a legally assigned pid (there's a "< 16" check
> somewhere), so figured it would be okay as a default.
>
> >          ts_st->discontinuity   = ts->flags & MPEGTS_FLAG_DISCONT;
> >
> >
> > -          /* update PCR pid by using the first video stream */
> >
> >
> > -          if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO &&
> >
> >
> > -              service->pcr_pid == 0x1fff) {
> >
> >
> >
> > -          /* update PCR pid by: forced pid or using the first video stream */
> >
> >
> > -          if ((ts->pcr_forced_pid != 0x0010 && ts_st->pid == ts->pcr_forced_pid) ||
> >
> >
> > -              (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && service->pcr_pid == 0x1fff)) {
> >                service->pcr_pid = ts_st->pid;
> >
> >
>
> Okay if pid 0x0010 shall actually never carry the PCR. (Probably
> 0x0010-0x001F if I guess by Wikipedia's list of PIDs properly, but
> then, the article isn't very well written for my understanding, and I
> have no idea about PIDs.)

Hi Moritz,

Pids 0x00-0x10 (0-16 in decimal values) are reserved. So pid 0x10 can't carry PCR marks.
Then I use this value as the "empty" (aka NOT_SET) value for the parameter. In this case the
default behaviour is used: that's auto-select first video, or first stream if no video.

Regards.
A.H.



More information about the ffmpeg-devel mailing list