99, 99, 99, 99, 99, 99, 99, 99
};
-static PayloadContext *jpeg_new_context(void)
-{
- return av_mallocz(sizeof(PayloadContext));
-}
-
-static inline void free_frame_if_needed(PayloadContext *jpeg)
+static inline void free_frame(PayloadContext *jpeg)
{
if (jpeg->frame) {
uint8_t *p;
static void jpeg_free_context(PayloadContext *jpeg)
{
- free_frame_if_needed(jpeg);
+ free_frame(jpeg);
av_free(jpeg);
}
/* Skip the current frame in case of the end packet
* has been lost somewhere. */
- free_frame_if_needed(jpeg);
+ free_frame(jpeg);
if ((ret = avio_open_dyn_buf(&jpeg->frame)) < 0)
return ret;
if (jpeg->timestamp != *timestamp) {
/* Skip the current frame if timestamp is incorrect.
* A start packet has been lost somewhere. */
- free_frame_if_needed(jpeg);
+ free_frame(jpeg);
av_log(ctx, AV_LOG_ERROR, "RTP timestamps don't match.\n");
return AVERROR_INVALIDDATA;
}
.enc_name = "JPEG",
.codec_type = AVMEDIA_TYPE_VIDEO,
.codec_id = AV_CODEC_ID_MJPEG,
- .alloc = jpeg_new_context,
+ .priv_data_size = sizeof(PayloadContext),
.free = jpeg_free_context,
.parse_packet = jpeg_parse_packet,
.static_payload_id = 26,