Commit 3c90cc2e authored by Anton Khirnov's avatar Anton Khirnov
Browse files

lavf: deprecate av_read_packet().

The caller can achieve the same effect (i.e. getting raw unparsed/mangled
packets) with av_read_frame() and AVFMT_FLAG_NOPARSE |
AVFMT_FLAG_NOFILLIN
parent f63412fc
......@@ -1185,7 +1185,11 @@ int av_find_best_stream(AVFormatContext *ic,
AVCodec **decoder_ret,
int flags);
#if FF_API_READ_PACKET
/**
* @deprecated use AVFMT_FLAG_NOFILLIN | AVFMT_FLAG_NOPARSE to read raw
* unprocessed packets
*
* Read a transport packet from a media file.
*
* This function is obsolete and should never be used.
......@@ -1195,7 +1199,9 @@ int av_find_best_stream(AVFormatContext *ic,
* @param pkt is filled
* @return 0 if OK, AVERROR_xxx on error
*/
attribute_deprecated
int av_read_packet(AVFormatContext *s, AVPacket *pkt);
#endif
/**
* Return the next frame of a stream.
......
......@@ -782,7 +782,7 @@ static int read_gab2_sub(AVStream *st, AVPacket *pkt) {
ast->sub_ctx->pb = pb;
if (!avformat_open_input(&ast->sub_ctx, "", sub_demuxer, NULL)) {
av_read_packet(ast->sub_ctx, &ast->sub_pkt);
ff_read_packet(ast->sub_ctx, &ast->sub_pkt);
*st->codec = *ast->sub_ctx->streams[0]->codec;
ast->sub_ctx->streams[0]->codec->extradata = NULL;
time_base = ast->sub_ctx->streams[0]->time_base;
......@@ -824,7 +824,7 @@ static AVStream *get_subtitle_pkt(AVFormatContext *s, AVStream *next_st,
ast = sub_st->priv_data;
*pkt = ast->sub_pkt;
pkt->stream_index = sub_st->index;
if (av_read_packet(ast->sub_ctx, &ast->sub_pkt) < 0)
if (ff_read_packet(ast->sub_ctx, &ast->sub_pkt) < 0)
ast->sub_pkt.data = NULL;
}
return sub_st;
......@@ -1268,7 +1268,7 @@ static void seek_subtitle(AVStream *st, AVStream *st2, int64_t timestamp)
av_free_packet(&ast2->sub_pkt);
if (avformat_seek_file(ast2->sub_ctx, 0, INT64_MIN, ts2, ts2, 0) >= 0 ||
avformat_seek_file(ast2->sub_ctx, 0, ts2, ts2, INT64_MAX, 0) >= 0)
av_read_packet(ast2->sub_ctx, &ast2->sub_pkt);
ff_read_packet(ast2->sub_ctx, &ast2->sub_pkt);
}
static int avi_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
......
......@@ -318,4 +318,13 @@ int ff_add_param_change(AVPacket *pkt, int32_t channels,
*/
int ff_framehash_write_header(AVFormatContext *s);
/**
* Read a transport packet from a media file.
*
* @param s media file handle
* @param pkt is filled
* @return 0 if OK, AVERROR_xxx on error
*/
int ff_read_packet(AVFormatContext *s, AVPacket *pkt);
#endif /* AVFORMAT_INTERNAL_H */
......@@ -256,7 +256,7 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf,
for (;;) {
int i;
res = av_read_packet(rt->asf_ctx, pkt);
res = ff_read_packet(rt->asf_ctx, pkt);
rt->asf_pb_pos = avio_tell(pb);
if (res != 0)
break;
......
......@@ -612,7 +612,7 @@ fail:
/*******************************************************/
int av_read_packet(AVFormatContext *s, AVPacket *pkt)
int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
{
int ret, i;
AVStream *st;
......@@ -698,6 +698,14 @@ int av_read_packet(AVFormatContext *s, AVPacket *pkt)
}
}
#if FF_API_READ_PACKET
int av_read_packet(AVFormatContext *s, AVPacket *pkt)
{
return ff_read_packet(s, pkt);
}
#endif
/**********************************************************/
/**
......@@ -1156,7 +1164,7 @@ static int read_frame_internal(AVFormatContext *s, AVPacket *pkt)
AVPacket cur_pkt;
/* read next packet */
ret = av_read_packet(s, &cur_pkt);
ret = ff_read_packet(s, &cur_pkt);
if (ret < 0) {
if (ret == AVERROR(EAGAIN))
return ret;
......@@ -1183,7 +1191,7 @@ static int read_frame_internal(AVFormatContext *s, AVPacket *pkt)
cur_pkt.size);
}
if (s->debug & FF_FDEBUG_TS)
av_log(s, AV_LOG_DEBUG, "av_read_packet stream=%d, pts=%"PRId64", dts=%"PRId64", size=%d, duration=%d, flags=%d\n",
av_log(s, AV_LOG_DEBUG, "ff_read_packet stream=%d, pts=%"PRId64", dts=%"PRId64", size=%d, duration=%d, flags=%d\n",
cur_pkt.stream_index,
cur_pkt.pts,
cur_pkt.dts,
......@@ -1956,7 +1964,7 @@ static void estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset)
break;
do {
ret = av_read_packet(ic, pkt);
ret = ff_read_packet(ic, pkt);
} while(ret == AVERROR(EAGAIN));
if (ret != 0)
break;
......
......@@ -53,5 +53,8 @@
#ifndef FF_API_APPLEHTTP_PROTO
#define FF_API_APPLEHTTP_PROTO (LIBAVFORMAT_VERSION_MAJOR < 55)
#endif
#ifndef FF_API_READ_PACKET
#define FF_API_READ_PACKET (LIBAVFORMAT_VERSION_MAJOR < 55)
#endif
#endif /* AVFORMAT_VERSION_H */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment