mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-05-21 00:46:44 +08:00
Combine deprecation guards where appropriate
Some code blocks use multiple bits of deprecated API.
This commit is contained in:
@ -853,7 +853,7 @@ static int v4l2_read_header(AVFormatContext *s1)
|
|||||||
|
|
||||||
static int v4l2_read_packet(AVFormatContext *s1, AVPacket *pkt)
|
static int v4l2_read_packet(AVFormatContext *s1, AVPacket *pkt)
|
||||||
{
|
{
|
||||||
#if FF_API_CODED_FRAME
|
#if FF_API_CODED_FRAME && FF_API_LAVF_AVCTX
|
||||||
FF_DISABLE_DEPRECATION_WARNINGS
|
FF_DISABLE_DEPRECATION_WARNINGS
|
||||||
struct video_data *s = s1->priv_data;
|
struct video_data *s = s1->priv_data;
|
||||||
AVFrame *frame = s1->streams[0]->codec->coded_frame;
|
AVFrame *frame = s1->streams[0]->codec->coded_frame;
|
||||||
@ -866,7 +866,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if FF_API_CODED_FRAME
|
#if FF_API_CODED_FRAME && FF_API_LAVF_AVCTX
|
||||||
FF_DISABLE_DEPRECATION_WARNINGS
|
FF_DISABLE_DEPRECATION_WARNINGS
|
||||||
if (frame && s->interlaced) {
|
if (frame && s->interlaced) {
|
||||||
frame->interlaced_frame = 1;
|
frame->interlaced_frame = 1;
|
||||||
|
@ -99,7 +99,7 @@ static int init_muxer(AVFormatContext *s, AVDictionary **options)
|
|||||||
if ((ret = av_opt_set_dict(s, &tmp)) < 0)
|
if ((ret = av_opt_set_dict(s, &tmp)) < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
#if FF_API_LAVF_BITEXACT
|
#if FF_API_LAVF_BITEXACT && FF_API_LAVF_AVCTX
|
||||||
FF_DISABLE_DEPRECATION_WARNINGS
|
FF_DISABLE_DEPRECATION_WARNINGS
|
||||||
if (s->nb_streams && s->streams[0]->codec->flags & AV_CODEC_FLAG_BITEXACT)
|
if (s->nb_streams && s->streams[0]->codec->flags & AV_CODEC_FLAG_BITEXACT)
|
||||||
s->flags |= AVFMT_FLAG_BITEXACT;
|
s->flags |= AVFMT_FLAG_BITEXACT;
|
||||||
@ -117,7 +117,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
|||||||
st = s->streams[i];
|
st = s->streams[i];
|
||||||
par = st->codecpar;
|
par = st->codecpar;
|
||||||
|
|
||||||
#if FF_API_LAVF_CODEC_TB
|
#if FF_API_LAVF_CODEC_TB && FF_API_LAVF_AVCTX
|
||||||
FF_DISABLE_DEPRECATION_WARNINGS
|
FF_DISABLE_DEPRECATION_WARNINGS
|
||||||
if (!st->time_base.num && st->codec->time_base.num) {
|
if (!st->time_base.num && st->codec->time_base.num) {
|
||||||
av_log(s, AV_LOG_WARNING, "Using AVStream.codec.time_base as a "
|
av_log(s, AV_LOG_WARNING, "Using AVStream.codec.time_base as a "
|
||||||
@ -272,7 +272,7 @@ int avformat_write_header(AVFormatContext *s, AVDictionary **options)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if FF_API_COMPUTE_PKT_FIELDS2
|
#if FF_API_COMPUTE_PKT_FIELDS2 && FF_API_LAVF_AVCTX
|
||||||
FF_DISABLE_DEPRECATION_WARNINGS
|
FF_DISABLE_DEPRECATION_WARNINGS
|
||||||
//FIXME merge with compute_pkt_fields
|
//FIXME merge with compute_pkt_fields
|
||||||
static int compute_pkt_fields2(AVFormatContext *s, AVStream *st, AVPacket *pkt)
|
static int compute_pkt_fields2(AVFormatContext *s, AVStream *st, AVPacket *pkt)
|
||||||
@ -417,7 +417,7 @@ static int prepare_input_packet(AVFormatContext *s, AVPacket *pkt)
|
|||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
#if !FF_API_COMPUTE_PKT_FIELDS2
|
#if !FF_API_COMPUTE_PKT_FIELDS2 && FF_API_LAVF_AVCTX
|
||||||
/* sanitize the timestamps */
|
/* sanitize the timestamps */
|
||||||
if (!(s->oformat->flags & AVFMT_NOTIMESTAMPS)) {
|
if (!(s->oformat->flags & AVFMT_NOTIMESTAMPS)) {
|
||||||
AVStream *st = s->streams[pkt->stream_index];
|
AVStream *st = s->streams[pkt->stream_index];
|
||||||
@ -475,7 +475,7 @@ int av_write_frame(AVFormatContext *s, AVPacket *pkt)
|
|||||||
return 1;
|
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_pkt_fields2(s, s->streams[pkt->stream_index], pkt);
|
||||||
|
|
||||||
if (ret < 0 && !(s->oformat->flags & AVFMT_NOTIMESTAMPS))
|
if (ret < 0 && !(s->oformat->flags & AVFMT_NOTIMESTAMPS))
|
||||||
@ -639,7 +639,7 @@ int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt)
|
|||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if (pkt) {
|
if (pkt) {
|
||||||
#if FF_API_COMPUTE_PKT_FIELDS2
|
#if FF_API_COMPUTE_PKT_FIELDS2 && FF_API_LAVF_AVCTX
|
||||||
AVStream *st = s->streams[pkt->stream_index];
|
AVStream *st = s->streams[pkt->stream_index];
|
||||||
|
|
||||||
av_log(s, AV_LOG_TRACE, "av_interleaved_write_frame size:%d dts:%" PRId64 " pts:%" PRId64 "\n",
|
av_log(s, AV_LOG_TRACE, "av_interleaved_write_frame size:%d dts:%" PRId64 " pts:%" PRId64 "\n",
|
||||||
|
Reference in New Issue
Block a user