Re: [FFmpeg-devel] MpegTS contribution question

2019-08-08 Thread Phil Burr
Hello Anthony,

I'm not really the best to answer your questions, as I'm also a fairly new
contributor (my patches seem to be languishing due to a lack of feedback
and a lack of time on my part pushing the issue).  I've been working on
getting support into mpegts for ATSC compliant descriptors of which EIT
tables are a glaring omission in large part due to the amount of work
needed to support them.  So to say the least, I'm excited about your
patches!  I'll take a look at your patches but one thing I would like to
know if you've considered, is whether or not your code supports modifying
the EIT tables, ie updating tables_version when the tables are modified?

Thanks,
Phil

On Thu, Aug 8, 2019 at 4:13 AM Anthony Delannoy 
wrote:

> Hi,
>
> I'm currently doing my first contribution to ffmpeg by adding EPG support
> in the mpegts format.
> For now, i succeeded to add support for EIT table and majority of its
> descriptors and can read/export EPG
> events in a .csv file.
> But I don't know on how to organize it now. Do I make a new codec for epg
> and a data stream? Do I keep those
> information « hidden » and present them only in metadatas plus functions
> api to export them?
>
> For those who wants to see where I am at:
> https://github.com/spnngl/FFmpeg/tree/epg2
>
> Some remarks:
>   * For now I use linked list to store EPG events but I may change for
> something simpler.
>   * I made separate descriptors code to be able to use it on others tables
> later. I want to add NIT table
>   support and maybe others if i succeed to finish EPG.
>   * EPG/descriptors files are all in libavformat for now, they need to be
> moved
>
> Thanks
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v4] libavformat/mpegtsenc: Add minimal support for ATSC PSIP tables

2019-06-25 Thread Phil Burr
It's been a month, no replies.  Is this commit going to be committed, or is
there something further I need to do to move this along?  Should I post a
rebased version?

Thanks,
Phil

On Tue, May 21, 2019 at 8:40 AM Phillip Burr  wrote:

> Minimal support for ATSC PSIP tables.  Does not support STT or
> EIT tables and so is not compliant with terrestrial ATSC.
> ATSC tables are not created by default, and will only be transmitted
> if either "atsc_name" or "atsc_channel" metadata is supplied.
>
> Signed-off-by: Phillip Burr 
> ---
>  doc/muxers.texi |  33 ++-
>  libavformat/mpegts.h|   8 +
>  libavformat/mpegtsenc.c | 468 
>  3 files changed, 415 insertions(+), 94 deletions(-)
>
> diff --git a/doc/muxers.texi b/doc/muxers.texi
> index 83ae017d6c..dd68eec362 100644
> --- a/doc/muxers.texi
> +++ b/doc/muxers.texi
> @@ -1500,10 +1500,35 @@ MPEG transport stream muxer.
>
>  This muxer implements ISO 13818-1 and part of ETSI EN 300 468.
>
> -The recognized metadata settings in mpegts muxer are
> @code{service_provider}
> -and @code{service_name}. If they are not set the default for
> -@code{service_provider} is @samp{FFmpeg} and the default for
> -@code{service_name} is @samp{Service01}.
> +@subsection Metadata
> +
> +The recognized metadata settings in this muxer are:
> +
> +@table @option
> +@item service_name @var{string}
> +Set the @code{service_provider}.  Default is @samp{FFmpeg}.
> +
> +@item service_name @var{string}
> +Set the @code{service_name}. Default is @samp{Service01}.
> +
> +@item atsc_name @var{string}
> +Set the @code{atsc_name} for the stream.  This is the ATSC short
> +channel name for the stream.
> +
> +@item atsc_channel @var{string}
> +Set the @code{atsc_channel} virtual channel for the stream.  This
> +is parsed as @samp{Channel[.SubChannel]} format where the subchannel
> +is optional and defaults to @code{1}.
> +
> +@end table
> +
> +ATSC tables will @emph{not} be generated unless either @code{atsc_name}
> +or @code{atsc_channel} are provided @emph{and} @code{muxrate} is provided.
> +In the event that either @code{atsc_name} or @code{atsc_channel} is
> provided
> +but not both, the default for @code{atsc_name} is @samp{FFmpeg}
> +and the default for @code{atsc_channel} is @samp{1.1}.
> +ATSC tables generated include @code{MGT} and @code{TVCT} tables but are
> lacking the mandatory
> +@code{STT}, @code{EIT0}, @code{EIT1}, @code{EIT2} and @code{EIT3} tables
> needed for terrestrial ATC compliance.
>
>  @subsection Options
>
> diff --git a/libavformat/mpegts.h b/libavformat/mpegts.h
> index 272e2be4f7..ca6943b1ba 100644
> --- a/libavformat/mpegts.h
> +++ b/libavformat/mpegts.h
> @@ -35,12 +35,20 @@
>  /* pids */
>  #define PAT_PID 0x
>  #define SDT_PID 0x0011
> +#define ATSC_PID0x1ffb
>
>  /* table ids */
>  #define PAT_TID   0x00
>  #define PMT_TID   0x02
>  #define M4OD_TID  0x05
>  #define SDT_TID   0x42
> +#define MGT_TID   0xc7
> +#define TVCT_TID  0xc8
> +#define CVCT_TID  0xc9
> +#define RRT_TID   0xca
> +#define EIT_TID   0xcb
> +#define ETT_TID   0xcc
> +#define STT_TID   0xcd
>
>  #define STREAM_TYPE_VIDEO_MPEG1 0x01
>  #define STREAM_TYPE_VIDEO_MPEG2 0x02
> diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
> index fc0ea225c6..335ff254d8 100644
> --- a/libavformat/mpegtsenc.c
> +++ b/libavformat/mpegtsenc.c
> @@ -56,12 +56,40 @@ typedef struct MpegTSService {
>  int sid;   /* service ID */
>  uint8_t name[256];
>  uint8_t provider_name[256];
> +
> +uint16_t atsc_name[7]; /* ATSC VCT fields */
> +int atsc_mj_channel;
> +int atsc_mn_channel;
> +
>  int pcr_pid;
>  int pcr_packet_count;
>  int pcr_packet_period;
>  AVProgram *program;
>  } MpegTSService;
>
> +/* The section length is 12 bits. The first 2 are set to 0, the remaining
> + * 10 bits should not exceed 1021. */
> +#define SECTION_LENGTH 1020
> +
> +typedef struct MpegTSAtsc {
> +int enabled;
> +int regenerate;
> +
> +MpegTSSection section; /* ATSC tables */
> +
> +int mgt_packet_count;
> +int mgt_packet_period;
> +int tvct_packet_count;
> +int tvct_packet_period;
> +int64_t last_mgt_ts;
> +int64_t last_tvct_ts;
> +
> +uint32_t tvct_length;
> +uint32_t mgt_length;
> +uint8_t tvct_data[SECTION_LENGTH];
> +uint8_t mgt_data[SECTION_LENGTH];
> +} MpegTSAtsc;
> +
>  // service_type values as defined in ETSI 300 468
>  enum {
>  MPEGTS_SERVICE_TYPE_DIGITAL_TV   = 0x01,
> @@ -78,6 +106,7 @@ typedef struct MpegTSWrite {
>  MpegTSSection pat; /* MPEG-2 PAT table */
>  MpegTSSection sdt; /* MPEG-2 SDT table context */
>  MpegTSService **services;
> +MpegTSAtsc atsc;
>  int sdt_packet_count;
>  int sdt_packet_period;
>  int pat_packet_count;
> @@ -121,10 +150,6 @@ typedef struct MpegTSWrite {
>  #define DEFAULT_PES_HEADER_FREQ  16
>  #define DEFAULT_PES_PAYLOAD_SIZE 

Re: [FFmpeg-devel] [PATCH v4] libavformat/mpegtsenc: Add minimal support for ATSC PSIP tables

2019-05-21 Thread Phil Burr
This patch has a bit more restructuring to consolidate the ATSC specific
fields.  I fixed some bugs where a few fields were set incorrectly.
Specifically, the MGT transmits the length of each table it describes and
so each table it describes is pre-populated.  Testing last night involved
taking an OTA ATSC broadcast, remuxing with ffmpeg and transmitting to a TV
for two hours.

On Tue, May 21, 2019 at 8:40 AM Phillip Burr  wrote:

> Minimal support for ATSC PSIP tables.  Does not support STT or
> EIT tables and so is not compliant with terrestrial ATSC.
> ATSC tables are not created by default, and will only be transmitted
> if either "atsc_name" or "atsc_channel" metadata is supplied.
>
> Signed-off-by: Phillip Burr 
> ---
>  doc/muxers.texi |  33 ++-
>  libavformat/mpegts.h|   8 +
>  libavformat/mpegtsenc.c | 468 
>  3 files changed, 415 insertions(+), 94 deletions(-)
>
> diff --git a/doc/muxers.texi b/doc/muxers.texi
> index 83ae017d6c..dd68eec362 100644
> --- a/doc/muxers.texi
> +++ b/doc/muxers.texi
> @@ -1500,10 +1500,35 @@ MPEG transport stream muxer.
>
>  This muxer implements ISO 13818-1 and part of ETSI EN 300 468.
>
> -The recognized metadata settings in mpegts muxer are
> @code{service_provider}
> -and @code{service_name}. If they are not set the default for
> -@code{service_provider} is @samp{FFmpeg} and the default for
> -@code{service_name} is @samp{Service01}.
> +@subsection Metadata
> +
> +The recognized metadata settings in this muxer are:
> +
> +@table @option
> +@item service_name @var{string}
> +Set the @code{service_provider}.  Default is @samp{FFmpeg}.
> +
> +@item service_name @var{string}
> +Set the @code{service_name}. Default is @samp{Service01}.
> +
> +@item atsc_name @var{string}
> +Set the @code{atsc_name} for the stream.  This is the ATSC short
> +channel name for the stream.
> +
> +@item atsc_channel @var{string}
> +Set the @code{atsc_channel} virtual channel for the stream.  This
> +is parsed as @samp{Channel[.SubChannel]} format where the subchannel
> +is optional and defaults to @code{1}.
> +
> +@end table
> +
> +ATSC tables will @emph{not} be generated unless either @code{atsc_name}
> +or @code{atsc_channel} are provided @emph{and} @code{muxrate} is provided.
> +In the event that either @code{atsc_name} or @code{atsc_channel} is
> provided
> +but not both, the default for @code{atsc_name} is @samp{FFmpeg}
> +and the default for @code{atsc_channel} is @samp{1.1}.
> +ATSC tables generated include @code{MGT} and @code{TVCT} tables but are
> lacking the mandatory
> +@code{STT}, @code{EIT0}, @code{EIT1}, @code{EIT2} and @code{EIT3} tables
> needed for terrestrial ATC compliance.
>
>  @subsection Options
>
> diff --git a/libavformat/mpegts.h b/libavformat/mpegts.h
> index 272e2be4f7..ca6943b1ba 100644
> --- a/libavformat/mpegts.h
> +++ b/libavformat/mpegts.h
> @@ -35,12 +35,20 @@
>  /* pids */
>  #define PAT_PID 0x
>  #define SDT_PID 0x0011
> +#define ATSC_PID0x1ffb
>
>  /* table ids */
>  #define PAT_TID   0x00
>  #define PMT_TID   0x02
>  #define M4OD_TID  0x05
>  #define SDT_TID   0x42
> +#define MGT_TID   0xc7
> +#define TVCT_TID  0xc8
> +#define CVCT_TID  0xc9
> +#define RRT_TID   0xca
> +#define EIT_TID   0xcb
> +#define ETT_TID   0xcc
> +#define STT_TID   0xcd
>
>  #define STREAM_TYPE_VIDEO_MPEG1 0x01
>  #define STREAM_TYPE_VIDEO_MPEG2 0x02
> diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
> index fc0ea225c6..335ff254d8 100644
> --- a/libavformat/mpegtsenc.c
> +++ b/libavformat/mpegtsenc.c
> @@ -56,12 +56,40 @@ typedef struct MpegTSService {
>  int sid;   /* service ID */
>  uint8_t name[256];
>  uint8_t provider_name[256];
> +
> +uint16_t atsc_name[7]; /* ATSC VCT fields */
> +int atsc_mj_channel;
> +int atsc_mn_channel;
> +
>  int pcr_pid;
>  int pcr_packet_count;
>  int pcr_packet_period;
>  AVProgram *program;
>  } MpegTSService;
>
> +/* The section length is 12 bits. The first 2 are set to 0, the remaining
> + * 10 bits should not exceed 1021. */
> +#define SECTION_LENGTH 1020
> +
> +typedef struct MpegTSAtsc {
> +int enabled;
> +int regenerate;
> +
> +MpegTSSection section; /* ATSC tables */
> +
> +int mgt_packet_count;
> +int mgt_packet_period;
> +int tvct_packet_count;
> +int tvct_packet_period;
> +int64_t last_mgt_ts;
> +int64_t last_tvct_ts;
> +
> +uint32_t tvct_length;
> +uint32_t mgt_length;
> +uint8_t tvct_data[SECTION_LENGTH];
> +uint8_t mgt_data[SECTION_LENGTH];
> +} MpegTSAtsc;
> +
>  // service_type values as defined in ETSI 300 468
>  enum {
>  MPEGTS_SERVICE_TYPE_DIGITAL_TV   = 0x01,
> @@ -78,6 +106,7 @@ typedef struct MpegTSWrite {
>  MpegTSSection pat; /* MPEG-2 PAT table */
>  MpegTSSection sdt; /* MPEG-2 SDT table context */
>  MpegTSService **services;
> +MpegTSAtsc atsc;
>  int 

Re: [FFmpeg-devel] [PATCH v3] libavformat/mpegtsenc: Add minimal support for ATSC PSIP tables

2019-05-20 Thread Phil Burr
I've found some fields that aren't being set correctly.  I've corrected
those and I'll push a new patch after I've done proper testing.

Phil

On Mon, May 20, 2019 at 11:03 AM Thomas Volkert  wrote:

>
> On 20.05.2019 18:56, Phil Burr wrote:
> > Besides passing `make fate` locally, I have manually inspected data
> streams
> > to look at my packets
>
> Okay, that is standard.
>
>
> >  and I've used SDR software to transmit to various TV
> > sets I own and have verified correct virtual channel and channel name on
> > those receivers.
>
> That is what I wanted to know - that is really good!
> Thanks for your efforts.
>
> Best regards,
> Thomas.
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v3] libavformat/mpegtsenc: Add minimal support for ATSC PSIP tables

2019-05-20 Thread Phil Burr
Besides passing `make fate` locally, I have manually inspected data streams
to look at my packets and I've used SDR software to transmit to various TV
sets I own and have verified correct virtual channel and channel name on
those receivers.

On Mon, May 20, 2019 at 10:44 AM Thomas Volkert  wrote:

>
> On 20.05.2019 18:09, Phillip Burr wrote:
> > Minimal support for ATSC PSIP tables.  Does not support STT or
> > EIT tables and so is not compliant with terrestrial ATSC.
> > ATSC tables are not created by default, and will only be transmitted
> > if either "atsc_name" or "atsc_channel" metadata is supplied.
> >
> > [..]
>
>
> Good work!
> How have you verified your patch?
>
>
> Best regards,
> Thomas.
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v2] libavformat/mpegtsenc: Add minimal support for ATSC PSIP tables

2019-05-20 Thread Phil Burr
Thank you for your suggestions.  I will push an update to the patch with
documentation and will hold off on STT and EIT[0-3] tables for a later
patch.

On Mon, May 20, 2019 at 7:24 AM Devin Heitmueller <
dheitmuel...@kernellabs.com> wrote:

> On Mon, May 20, 2019 at 8:36 AM Phil Burr  wrote:
> >
> > Thank you for the feedback.  I will look into adding documentation for
> the
> > atsc metadata.  ATSC requires in addition to the tables I've added, the
> STT
> > and EIT0-EIT3 tables.  I'm thinking of adding support for STT and at
> least
> > producing empty EIT tables so that the stream would be minimally
> compliant.
>
> I would have no problem with them being excluded in a first version of
> the patch, as long as it's documented that they are not expected to be
> present in the resulting streams.
>
> Your patch is already a huge improvement over the current state of
> affairs, and I don't want to see your patch not get merged because it
> lacks two features that I think the vast majority of people won't care
> about.
>
> Devin
>
> --
> Devin J. Heitmueller - Kernel Labs
> http://www.kernellabs.com
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v2] libavformat/mpegtsenc: Add minimal support for ATSC PSIP tables

2019-05-20 Thread Phil Burr
Thank you for the feedback.  I will look into adding documentation for the
atsc metadata.  ATSC requires in addition to the tables I've added, the STT
and EIT0-EIT3 tables.  I'm thinking of adding support for STT and at least
producing empty EIT tables so that the stream would be minimally compliant.

Phil

On Sun, May 19, 2019 at 11:08 AM Devin Heitmueller <
dheitmuel...@kernellabs.com> wrote:

> Hello Phillip,
>
> On Thu, May 16, 2019 at 9:32 AM Phillip Burr  wrote:
> >
> > Minimal support for ATSC PSIP tables.  Does not support STT or
> > EIT tables and so is not compliant with terrestrial ATSC.
> > ATSC tables are not created by default, and will only be transmitted
> > if either "atsc_name" or "atsc_channel" metadata is supplied.
>
> In general I am supportive of this effort (producing ATSC compliant
> streams).  Thanks for your work to improve the TS mux support in this
> area.
>
> While I haven't looked that closely at your implementation, one key
> thing missing is updated documentation that describes the new
> parameters, and in particular something that notes that streams
> generated are currently not fully compliant with the spec (as you
> noted, the lack of STT).  While it's good to have that in the patch
> description, that's something that really needs to be known to end
> users who might try to use the functionality.
>
> Regards,
>
> Devin
>
> --
> Devin J. Heitmueller - Kernel Labs
> http://www.kernellabs.com
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".