On date Tuesday 2011-05-24 07:34:59 +0200, Anton Khirnov encoded:
> Deprecate the corresponding AVFormatParameters field.
> ---
>  libavformat/avformat.h |    7 ++++---
>  libavformat/mpegts.c   |   22 +++++++++++++++++++++-
>  libavformat/version.h  |    3 +++
>  3 files changed, 28 insertions(+), 4 deletions(-)
> 
> diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> index c29f9ba..7e8cd80 100644
> --- a/libavformat/avformat.h
> +++ b/libavformat/avformat.h
> @@ -236,9 +236,10 @@ typedef struct AVFormatParameters {
>      int channel; /**< Used to select DV channel. */
>      const char *standard; /**< TV standard, NTSC, PAL, SECAM */
>      unsigned int mpeg2ts_raw:1;  /**< Force raw MPEG-2 transport stream 
> output, if possible. */
> -    unsigned int mpeg2ts_compute_pcr:1; /**< Compute exact PCR for each 
> transport
> -                                            stream packet (only meaningful if
> -                                            mpeg2ts_raw is TRUE). */
> +#if FF_API_FORMAT_PARAMETERS
> +    /**< deprecated, use mpegtsraw demuxer-specific options instead */
> +    attribute_deprecated unsigned int mpeg2ts_compute_pcr:1;
> +#endif
>      unsigned int initial_pause:1;       /**< Do not begin to play the stream
>                                              immediately (RTSP only). */
>      unsigned int prealloced_context:1;
> diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
> index e20d696..bfaf7b5 100644
> --- a/libavformat/mpegts.c
> +++ b/libavformat/mpegts.c
> @@ -25,6 +25,8 @@
>  
>  #include "libavutil/crc.h"
>  #include "libavutil/intreadwrite.h"
> +#include "libavutil/log.h"
> +#include "libavutil/opt.h"
>  #include "libavcodec/bytestream.h"
>  #include "avformat.h"
>  #include "mpegts.h"
> @@ -86,6 +88,7 @@ struct Program {
>  };
>  
>  struct MpegTSContext {
> +    const AVClass *class;
>      /* user data */
>      AVFormatContext *stream;
>      /** raw packet size, including FEC if present            */
> @@ -122,6 +125,19 @@ struct MpegTSContext {
>      MpegTSFilter *pids[NB_PID_MAX];
>  };
>  
> +static const AVOption options[] = {
> +    {"compute_pcr", "Compute exact PCR for each transport stream packet.", 
> offsetof(MpegTSContext, mpeg2ts_compute_pcr), FF_OPT_TYPE_INT,
> +     {.dbl = 0}, 0, 1, AV_OPT_FLAG_DECODING_PARAM },
> +    { NULL },
> +};
> +

> +static const AVClass mpegtsraw_class = {
> +    .class_name = "MPEG-TS raw demuxer",

Nit: maybe this should be the name of the demuxer (rather than the
long_name), for consistency with what is done in libavcodec.

> +    .item_name  = av_default_item_name,
> +    .option     = options,
> +    .version    = LIBAVUTIL_VERSION_INT,
> +};
> +
>  /* TS stream handling */
>  
>  enum MpegTSState {
> @@ -1455,7 +1471,10 @@ static int mpegts_read_header(AVFormatContext *s,
>      int64_t pos;
>  
>      if (ap) {
> -        ts->mpeg2ts_compute_pcr = ap->mpeg2ts_compute_pcr;
> +#if FF_API_FORMAT_PARAMETERS
> +        if (ap->mpeg2ts_compute_pcr)
> +            ts->mpeg2ts_compute_pcr = ap->mpeg2ts_compute_pcr;
> +#endif
>          if(ap->mpeg2ts_raw){
>              av_log(s, AV_LOG_ERROR, "use mpegtsraw_demuxer!\n");
>              return -1;
> @@ -1878,4 +1897,5 @@ AVInputFormat ff_mpegtsraw_demuxer = {
>  #ifdef USE_SYNCPOINT_SEARCH
>      .read_seek2 = read_seek2,
>  #endif
> +    .priv_class = &mpegtsraw_class,
>  };
> diff --git a/libavformat/version.h b/libavformat/version.h
> index 63f4191..b4fdb6f 100644
> --- a/libavformat/version.h
> +++ b/libavformat/version.h
> @@ -68,5 +68,8 @@
>  #ifndef FF_API_SDP_CREATE
>  #define FF_API_SDP_CREATE              (LIBAVFORMAT_VERSION_MAJOR < 54)
>  #endif
> +#ifndef FF_API_FORMAT_PARAMETERS
> +#define FF_API_FORMAT_PARAMETERS       (LIBAVFORMAT_VERSION_MAJOR < 54)
> +#endif

Looks fine otherwise.
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to