Skip to content
This repository was archived by the owner on Apr 5, 2025. It is now read-only.

Commit 7cb1180

Browse files
committed
Revise for newer ffmpeg versions
1 parent ce2b9dd commit 7cb1180

4 files changed

Lines changed: 19 additions & 9 deletions

File tree

src/movie.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -315,10 +315,7 @@ static int movie_encode_video(ctx_movie *movie)
315315
// Encoder did not provide metadata, set it up manually
316316
movie->pkt->size = retcd;
317317
movie->pkt->data = video_outbuf;
318-
319-
if (movie->picture->key_frame == 1) {
320-
movie->pkt->flags |= AV_PKT_FLAG_KEY;
321-
}
318+
myframe_key(movie->picture);
322319

323320
movie->pkt->pts = movie->picture->pts;
324321
movie->pkt->dts = movie->pkt->pts;
@@ -1445,11 +1442,10 @@ int movie_put_image(ctx_movie *movie, ctx_image_data *img_data, const struct tim
14451442
movie->gop_cnt ++;
14461443
if (movie->gop_cnt == movie->ctx_codec->gop_size ) {
14471444
movie->picture->pict_type = AV_PICTURE_TYPE_I;
1448-
movie->picture->key_frame = 1;
1445+
myframe_key(movie->picture);
14491446
movie->gop_cnt = 0;
14501447
} else {
14511448
movie->picture->pict_type = AV_PICTURE_TYPE_P;
1452-
movie->picture->key_frame = 0;
14531449
}
14541450

14551451
/* A return code of -2 is thrown by the put_frame

src/util.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,14 @@ char* mytranslate_text(const char *msgid, int setnls)
713713
* These are designed to be extremely simple version specific
714714
* variants of the libav functions.
715715
****************************************************************************/
716-
716+
void myframe_key(AVFrame *frame)
717+
{
718+
#if (MYFFVER < 60016)
719+
frame->key_frame = 1;
720+
#else
721+
frame->flags |= AV_FRAME_FLAG_KEY;
722+
#endif
723+
}
717724
/*********************************************/
718725
AVFrame *myframe_alloc(void)
719726
{

src/util.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,12 @@
7878
typedef AVCodec myAVCodec; /* Version independent definition for AVCodec*/
7979
#endif
8080

81+
#if (MYFFVER <= 60016)
82+
typedef uint8_t myuint; /* Version independent uint */
83+
#else
84+
typedef const uint8_t myuint; /* Version independent uint */
85+
#endif
86+
8187
#ifdef HAVE_GETTEXT
8288
#include <libintl.h>
8389
extern int _nl_msg_cat_cntr; /* Required for changing the locale dynamically */
@@ -128,6 +134,7 @@
128134
void mytrim(std::string &parm);
129135
void myunquote(std::string &parm);
130136

137+
void myframe_key(AVFrame *frame);
131138
AVFrame *myframe_alloc(void);
132139
void myframe_free(AVFrame *frame);
133140
void mypacket_free(AVPacket *pkt);

src/webu_mpegts.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ static int webu_mpegts_pic_send(ctx_webui *webui, unsigned char *img)
7070
webui->picture->height = webui->ctx_codec->height;
7171

7272
webui->picture->pict_type = AV_PICTURE_TYPE_I;
73-
webui->picture->key_frame = 1;
73+
myframe_key(webui->picture);
7474
webui->picture->pts = 1;
7575
}
7676

@@ -198,7 +198,7 @@ static int webu_mpegts_getimg(ctx_webui *webui)
198198
return 0;
199199
}
200200

201-
static int webu_mpegts_avio_buf(void *opaque, uint8_t *buf, int buf_size)
201+
static int webu_mpegts_avio_buf(void *opaque, myuint *buf, int buf_size)
202202
{
203203
ctx_webui *webui =(ctx_webui *)opaque;
204204

0 commit comments

Comments
 (0)