fix, supplement to fb13b064fb8eb58c500e38698ebedc8b47c25108

Origin commit data
------------------
Branch: master
Commit: c35b633e1d
Author: Jacek Jendrzej <overx300@gmail.com>
Date: 2021-10-27 (Wed, 27 Oct 2021)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
Jacek Jendrzej
2021-10-27 21:25:30 +02:00
committed by vanhofen
parent 5a8bbae8bd
commit 048116d7cc
5 changed files with 69 additions and 0 deletions

View File

@@ -206,7 +206,16 @@ static const char *vid_modes[] =
#define VIDEO_STREAMTYPE_MPEG1 6 #define VIDEO_STREAMTYPE_MPEG1 6
#define VIDEO_STREAMTYPE_H265_HEVC 7 #define VIDEO_STREAMTYPE_H265_HEVC 7
#define VIDEO_STREAMTYPE_AVS 16 #define VIDEO_STREAMTYPE_AVS 16
#if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(58, 133, 100)
static void get_packet_defaults(AVPacket *pkt)
{
memset(pkt, 0, sizeof(*pkt));
pkt->pts = AV_NOPTS_VALUE;
pkt->dts = AV_NOPTS_VALUE;
pkt->pos = -1;
}
#endif
ssize_t write_all(int fd, const void *buf, size_t count) ssize_t write_all(int fd, const void *buf, size_t count)
{ {
int retval; int retval;
@@ -267,6 +276,8 @@ void write_frame(AVFrame *in_frame, int fd)
AVPacket pkt; AVPacket pkt;
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 133, 100) #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 133, 100)
av_init_packet(&pkt); av_init_packet(&pkt);
#else
get_packet_defaults(&pkt);
#endif #endif
/* encode the image */ /* encode the image */
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(57,37,100) #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(57,37,100)
@@ -434,6 +445,8 @@ int image_to_mpeg2(const char *image_name, int fd)
AVPacket packet; AVPacket packet;
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 133, 100) #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 133, 100)
av_init_packet(&packet); av_init_packet(&packet);
#else
get_packet_defaults(&packet);
#endif #endif
if ((ret = av_read_frame(formatContext, &packet)) != -1) if ((ret = av_read_frame(formatContext, &packet)) != -1)
{ {

View File

@@ -64,6 +64,17 @@ Input::~Input()
{ {
} }
#if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(58, 133, 100)
static void get_packet_defaults(AVPacket *pkt)
{
memset(pkt, 0, sizeof(*pkt));
pkt->pts = AV_NOPTS_VALUE;
pkt->dts = AV_NOPTS_VALUE;
pkt->pos = -1;
}
#endif
int64_t Input::calcPts(AVStream *stream, int64_t pts) int64_t Input::calcPts(AVStream *stream, int64_t pts)
{ {
if (pts == AV_NOPTS_VALUE) if (pts == AV_NOPTS_VALUE)
@@ -263,6 +274,8 @@ bool Input::Play()
AVPacket packet; AVPacket packet;
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 133, 100) #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 133, 100)
av_init_packet(&packet); av_init_packet(&packet);
#else
get_packet_defaults(&packet);
#endif #endif
int err = av_read_frame(avfc, &packet); int err = av_read_frame(avfc, &packet);
if (err == AVERROR(EAGAIN)) if (err == AVERROR(EAGAIN))
@@ -452,6 +465,8 @@ bool Input::ReadSubtitle(const char *filename, const char *format, int pid)
AVPacket packet; AVPacket packet;
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 133, 100) #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 133, 100)
av_init_packet(&packet); av_init_packet(&packet);
#else
get_packet_defaults(&packet);
#endif #endif
while (av_read_frame(subavfc, &packet) > -1) while (av_read_frame(subavfc, &packet) > -1)
{ {

View File

@@ -58,6 +58,16 @@ static ao_sample_format sformat;
static AVCodecContext *c = NULL; static AVCodecContext *c = NULL;
static AVCodecParameters *p = NULL; static AVCodecParameters *p = NULL;
#if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(58, 133, 100)
static void get_packet_defaults(AVPacket *pkt)
{
memset(pkt, 0, sizeof(*pkt));
pkt->pts = AV_NOPTS_VALUE;
pkt->dts = AV_NOPTS_VALUE;
pkt->pos = -1;
}
#endif
cAudio::cAudio(void *, void *, void *) cAudio::cAudio(void *, void *, void *)
{ {
@@ -381,6 +391,8 @@ void cAudio::run()
curr_pts = 0; curr_pts = 0;
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 133, 100) #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 133, 100)
av_init_packet(&avpkt); av_init_packet(&avpkt);
#else
get_packet_defaults(&avpkt);
#endif #endif
inp = av_find_input_format("mpegts"); inp = av_find_input_format("mpegts");
AVIOContext *pIOCtx = avio_alloc_context(inbuf, INBUF_SIZE, // internal Buffer and its size AVIOContext *pIOCtx = avio_alloc_context(inbuf, INBUF_SIZE, // internal Buffer and its size

View File

@@ -65,6 +65,16 @@ extern bool HAL_nodec;
static uint8_t *dmxbuf; static uint8_t *dmxbuf;
static int bufpos; static int bufpos;
#if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(58, 133, 100)
static void get_packet_defaults(AVPacket *pkt)
{
memset(pkt, 0, sizeof(*pkt));
pkt->pts = AV_NOPTS_VALUE;
pkt->dts = AV_NOPTS_VALUE;
pkt->pos = -1;
}
#endif
static const AVRational aspect_ratios[6] = static const AVRational aspect_ratios[6] =
{ {
@@ -302,6 +312,8 @@ bool cVideo::ShowPicture(const char *fname)
} }
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 133, 100) #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 133, 100)
av_init_packet(&avpkt); av_init_packet(&avpkt);
#else
get_packet_defaults(&avpkt);
#endif #endif
if (av_read_frame(avfc, &avpkt) < 0) if (av_read_frame(avfc, &avpkt) < 0)
{ {
@@ -524,6 +536,8 @@ void cVideo::run(void)
dec_r = 0; dec_r = 0;
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 133, 100) #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 133, 100)
av_init_packet(&avpkt); av_init_packet(&avpkt);
#else
get_packet_defaults(&avpkt);
#endif #endif
inp = av_find_input_format("mpegts"); inp = av_find_input_format("mpegts");
AVIOContext *pIOCtx = avio_alloc_context(inbuf, INBUF_SIZE, // internal Buffer and its size AVIOContext *pIOCtx = avio_alloc_context(inbuf, INBUF_SIZE, // internal Buffer and its size

View File

@@ -155,6 +155,17 @@ static const char *vid_modes[] =
NULL NULL
}; };
#if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(58, 133, 100)
static void get_packet_defaults(AVPacket *pkt)
{
memset(pkt, 0, sizeof(*pkt));
pkt->pts = AV_NOPTS_VALUE;
pkt->dts = AV_NOPTS_VALUE;
pkt->pos = -1;
}
#endif
#define VIDEO_STREAMTYPE_MPEG2 0 #define VIDEO_STREAMTYPE_MPEG2 0
#define VIDEO_STREAMTYPE_MPEG4_H264 1 #define VIDEO_STREAMTYPE_MPEG4_H264 1
#define VIDEO_STREAMTYPE_VC1 3 #define VIDEO_STREAMTYPE_VC1 3
@@ -232,6 +243,8 @@ void write_frame(AVFrame *in_frame, FILE *fp)
AVPacket pkt; AVPacket pkt;
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 133, 100) #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 133, 100)
av_init_packet(&pkt); av_init_packet(&pkt);
#else
get_packet_defaults(&pkt);
#endif #endif
/* encode the image */ /* encode the image */
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(57,37,100) #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(57,37,100)
@@ -399,6 +412,8 @@ int image_to_mpeg2(const char *image_name, const char *encode_name)
AVPacket packet; AVPacket packet;
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 133, 100) #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 133, 100)
av_init_packet(&packet); av_init_packet(&packet);
#else
get_packet_defaults(&packet);
#endif #endif
if ((ret = av_read_frame(formatContext, &packet)) != -1) if ((ret = av_read_frame(formatContext, &packet)) != -1)
{ {