[FFmpeg-cvslog] Merge commit '11de006babf735aafa3462d43dd2c02bb6ac6e2f'

Clément Bœsch git at videolan.org
Wed Jun 22 17:36:50 CEST 2016


ffmpeg | branch: master | Clément Bœsch <clement at stupeflix.com> | Wed Jun 22 17:36:42 2016 +0200| [a444a50510e76a87f34d5b2e6d4f696b6af7e79b] | committer: Clément Bœsch

Merge commit '11de006babf735aafa3462d43dd2c02bb6ac6e2f'

* commit '11de006babf735aafa3462d43dd2c02bb6ac6e2f':
  Combine deprecation guards where appropriate

Merged-by: Clément Bœsch <clement at stupeflix.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a444a50510e76a87f34d5b2e6d4f696b6af7e79b
---

 libavdevice/v4l2.c |    4 ++--
 libavformat/mux.c  |   10 +++++-----
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
index 9153ad4..ddf331d 100644
--- a/libavdevice/v4l2.c
+++ b/libavdevice/v4l2.c
@@ -971,7 +971,7 @@ fail:
 
 static int v4l2_read_packet(AVFormatContext *ctx, AVPacket *pkt)
 {
-#if FF_API_CODED_FRAME
+#if FF_API_CODED_FRAME && FF_API_LAVF_AVCTX
 FF_DISABLE_DEPRECATION_WARNINGS
     struct video_data *s = ctx->priv_data;
     AVFrame *frame = ctx->streams[0]->codec->coded_frame;
@@ -984,7 +984,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
         return res;
     }
 
-#if FF_API_CODED_FRAME
+#if FF_API_CODED_FRAME && FF_API_LAVF_AVCTX
 FF_DISABLE_DEPRECATION_WARNINGS
     if (frame && s->interlaced) {
         frame->interlaced_frame = 1;
diff --git a/libavformat/mux.c b/libavformat/mux.c
index f21b4dd..76db607 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -284,7 +284,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
         st  = s->streams[i];
         par = st->codecpar;
 
-#if FF_API_LAVF_CODEC_TB
+#if FF_API_LAVF_CODEC_TB && FF_API_LAVF_AVCTX
 FF_DISABLE_DEPRECATION_WARNINGS
         if (!st->time_base.num && st->codec->time_base.num) {
             av_log(s, AV_LOG_WARNING, "Using AVStream.codec.time_base as a "
@@ -530,7 +530,7 @@ fail:
 #define UNCODED_FRAME_PACKET_SIZE (INT_MIN / 3 * 2 + (int)sizeof(AVFrame))
 
 
-#if FF_API_COMPUTE_PKT_FIELDS2
+#if FF_API_COMPUTE_PKT_FIELDS2 && FF_API_LAVF_AVCTX
 FF_DISABLE_DEPRECATION_WARNINGS
 //FIXME merge with compute_pkt_fields
 static int compute_muxer_pkt_fields(AVFormatContext *s, AVStream *st, AVPacket *pkt)
@@ -769,7 +769,7 @@ static int prepare_input_packet(AVFormatContext *s, AVPacket *pkt)
     if (ret < 0)
         return ret;
 
-#if !FF_API_COMPUTE_PKT_FIELDS2
+#if !FF_API_COMPUTE_PKT_FIELDS2 && FF_API_LAVF_AVCTX
     /* sanitize the timestamps */
     if (!(s->oformat->flags & AVFMT_NOTIMESTAMPS)) {
         AVStream *st = s->streams[pkt->stream_index];
@@ -838,7 +838,7 @@ int av_write_frame(AVFormatContext *s, AVPacket *pkt)
         return 1;
     }
 
-#if FF_API_COMPUTE_PKT_FIELDS2
+#if FF_API_COMPUTE_PKT_FIELDS2 && FF_API_LAVF_AVCTX
     ret = compute_muxer_pkt_fields(s, s->streams[pkt->stream_index], pkt);
 
     if (ret < 0 && !(s->oformat->flags & AVFMT_NOTIMESTAMPS))
@@ -1092,7 +1092,7 @@ int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt)
             av_log(s, AV_LOG_TRACE, "av_interleaved_write_frame size:%d dts:%s pts:%s\n",
                 pkt->size, av_ts2str(pkt->dts), av_ts2str(pkt->pts));
 
-#if FF_API_COMPUTE_PKT_FIELDS2
+#if FF_API_COMPUTE_PKT_FIELDS2 && FF_API_LAVF_AVCTX
         if ((ret = compute_muxer_pkt_fields(s, st, pkt)) < 0 && !(s->oformat->flags & AVFMT_NOTIMESTAMPS))
             goto fail;
 #endif


======================================================================

diff --cc libavdevice/v4l2.c
index 9153ad4,74fec51..ddf331d
--- a/libavdevice/v4l2.c
+++ b/libavdevice/v4l2.c
@@@ -950,31 -844,19 +950,31 @@@ static int v4l2_read_header(AVFormatCon
      if (codec_id == AV_CODEC_ID_RAWVIDEO)
          st->codecpar->codec_tag =
              avcodec_pix_fmt_to_codec_tag(st->codecpar->format);
 +    else if (codec_id == AV_CODEC_ID_H264) {
 +        st->need_parsing = AVSTREAM_PARSE_FULL_ONCE;
 +    }
 +    if (desired_format == V4L2_PIX_FMT_YVU420)
 +        st->codecpar->codec_tag = MKTAG('Y', 'V', '1', '2');
 +    else if (desired_format == V4L2_PIX_FMT_YVU410)
 +        st->codecpar->codec_tag = MKTAG('Y', 'V', 'U', '9');
      st->codecpar->width = s->width;
      st->codecpar->height = s->height;
 -    st->codecpar->bit_rate = s->frame_size * av_q2d(st->avg_frame_rate) * 8;
 +    if (st->avg_frame_rate.den)
 +        st->codecpar->bit_rate = s->frame_size * av_q2d(st->avg_frame_rate) * 8;
  
      return 0;
 +
 +fail:
 +    v4l2_close(s->fd);
 +    return res;
  }
  
 -static int v4l2_read_packet(AVFormatContext *s1, AVPacket *pkt)
 +static int v4l2_read_packet(AVFormatContext *ctx, AVPacket *pkt)
  {
- #if FF_API_CODED_FRAME
+ #if FF_API_CODED_FRAME && FF_API_LAVF_AVCTX
  FF_DISABLE_DEPRECATION_WARNINGS
 -    struct video_data *s = s1->priv_data;
 -    AVFrame *frame = s1->streams[0]->codec->coded_frame;
 +    struct video_data *s = ctx->priv_data;
 +    AVFrame *frame = ctx->streams[0]->codec->coded_frame;
  FF_ENABLE_DEPRECATION_WARNINGS
  #endif
      int res;
diff --cc libavformat/mux.c
index f21b4dd,0761a93..76db607
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@@ -514,30 -270,15 +514,30 @@@ int avformat_write_header(AVFormatConte
      }
  
      return 0;
 +
 +fail:
 +    if (s->oformat->deinit)
 +        s->oformat->deinit(s);
 +    return ret;
  }
  
 +#define AV_PKT_FLAG_UNCODED_FRAME 0x2000
 +
 +/* Note: using sizeof(AVFrame) from outside lavu is unsafe in general, but
 +   it is only being used internally to this file as a consistency check.
 +   The value is chosen to be very unlikely to appear on its own and to cause
 +   immediate failure if used anywhere as a real size. */
 +#define UNCODED_FRAME_PACKET_SIZE (INT_MIN / 3 * 2 + (int)sizeof(AVFrame))
 +
 +
- #if FF_API_COMPUTE_PKT_FIELDS2
+ #if FF_API_COMPUTE_PKT_FIELDS2 && FF_API_LAVF_AVCTX
  FF_DISABLE_DEPRECATION_WARNINGS
  //FIXME merge with compute_pkt_fields
 -static int compute_pkt_fields2(AVFormatContext *s, AVStream *st, AVPacket *pkt)
 +static int compute_muxer_pkt_fields(AVFormatContext *s, AVStream *st, AVPacket *pkt)
  {
 -    int delay = FFMAX(st->codec->has_b_frames, !!st->codec->max_b_frames);
 +    int delay = FFMAX(st->codecpar->video_delay, st->internal->avctx->max_b_frames > 0);
      int num, den, i;
 +    int frame_size;
  
      if (!s->internal->missing_ts_warning &&
          !(s->oformat->flags & AVFMT_NOTIMESTAMPS) &&
@@@ -838,8 -475,8 +838,8 @@@ int av_write_frame(AVFormatContext *s, 
          return 1;
      }
  
- #if FF_API_COMPUTE_PKT_FIELDS2
+ #if FF_API_COMPUTE_PKT_FIELDS2 && FF_API_LAVF_AVCTX
 -    ret = compute_pkt_fields2(s, s->streams[pkt->stream_index], pkt);
 +    ret = compute_muxer_pkt_fields(s, s->streams[pkt->stream_index], pkt);
  
      if (ret < 0 && !(s->oformat->flags & AVFMT_NOTIMESTAMPS))
          return ret;
@@@ -1066,34 -639,12 +1066,34 @@@ int av_interleaved_write_frame(AVFormat
          goto fail;
  
      if (pkt) {
 -#if FF_API_COMPUTE_PKT_FIELDS2 && FF_API_LAVF_AVCTX
          AVStream *st = s->streams[pkt->stream_index];
  
 -        av_log(s, AV_LOG_TRACE, "av_interleaved_write_frame size:%d dts:%" PRId64 " pts:%" PRId64 "\n",
 -                pkt->size, pkt->dts, pkt->pts);
 -        if ((ret = compute_pkt_fields2(s, st, pkt)) < 0 && !(s->oformat->flags & AVFMT_NOTIMESTAMPS))
 +        if (s->oformat->check_bitstream) {
 +            if (!st->internal->bitstream_checked) {
 +                if ((ret = s->oformat->check_bitstream(s, pkt)) < 0)
 +                    goto fail;
 +                else if (ret == 1)
 +                    st->internal->bitstream_checked = 1;
 +            }
 +        }
 +
 +        av_apply_bitstream_filters(st->internal->avctx, pkt, st->internal->bsfc);
 +        if (pkt->size == 0 && pkt->side_data_elems == 0)
 +            return 0;
 +        if (!st->codecpar->extradata && st->internal->avctx->extradata) {
 +            int eret = ff_alloc_extradata(st->codecpar, st->internal->avctx->extradata_size);
 +            if (eret < 0)
 +                return AVERROR(ENOMEM);
 +            st->codecpar->extradata_size = st->internal->avctx->extradata_size;
 +            memcpy(st->codecpar->extradata, st->internal->avctx->extradata, st->internal->avctx->extradata_size);
 +        }
 +
 +        if (s->debug & FF_FDEBUG_TS)
 +            av_log(s, AV_LOG_TRACE, "av_interleaved_write_frame size:%d dts:%s pts:%s\n",
 +                pkt->size, av_ts2str(pkt->dts), av_ts2str(pkt->pts));
 +
- #if FF_API_COMPUTE_PKT_FIELDS2
++#if FF_API_COMPUTE_PKT_FIELDS2 && FF_API_LAVF_AVCTX
 +        if ((ret = compute_muxer_pkt_fields(s, st, pkt)) < 0 && !(s->oformat->flags & AVFMT_NOTIMESTAMPS))
              goto fail;
  #endif
  



More information about the ffmpeg-cvslog mailing list