mirror of
https://github.com/jellyfin/jellyfin-ffmpeg.git
synced 2026-09-03 05:09:58 +03:00
New upstream version 3.1.4
This commit is contained in:
@@ -3,6 +3,33 @@ releases are sorted from youngest to oldest.
|
||||
|
||||
version <next>:
|
||||
|
||||
version 3.1.4:
|
||||
- avformat/avidec: Check nb_streams in read_gab2_sub()
|
||||
- avformat/avidec: Remove ancient assert
|
||||
- avfilter/vf_colorspace: fix range for output colorspace option
|
||||
- lavc/mediacodecdec_h264: fix SODB escaping
|
||||
- avcodec/nvenc: fix const options for hevc gpu setting
|
||||
- avformat/avidec: Fix memleak with dv in avi
|
||||
- lavc/movtextdec.c: Avoid infinite loop on invalid data.
|
||||
- avcodec/ansi: Check dimensions
|
||||
- avcodec/cavsdsp: use av_clip_uint8() for idct
|
||||
- avformat/movenc: Check packet in mov_write_single_packet() too
|
||||
- avformat/movenc: Factor check_pkt() out
|
||||
- avformat/utils: fix timebase error in avformat_seek_file()
|
||||
- avcodec/g726: Add missing ADDB output mask
|
||||
- avcodec/avpacket: clear side_data_elems
|
||||
- avformat/movenc: Check first DTS similar to dts difference
|
||||
- avcodec/ccaption_dec: Use simple array instead of AVBuffer
|
||||
- avcodec/svq3: Reintroduce slice_type
|
||||
- avformat/mov: Fix potential integer overflow in mov_read_keys
|
||||
- swscale/swscale_unscaled: Try to fix Rgb16ToPlanarRgb16Wrapper() with slices
|
||||
- swscale/swscale_unscaled: Fix packed_16bpc_bswap() with slices
|
||||
- avformat/avidec: Fix infinite loop in avi_read_nikon()
|
||||
- lavf/utils: Avoid an overflow for huge negative durations.
|
||||
- avformat/hls: Fix handling of EXT-X-BYTERANGE streams over 2GB
|
||||
- lavc/avpacket: Fix undefined behaviour, do not pass a null pointer to memcpy().
|
||||
- lavc/mjpegdec: Do not skip reading quantization tables.
|
||||
- cmdutils: fix implicit declaration of SetDllDirectory function
|
||||
|
||||
version 3.1.3:
|
||||
- examples/demuxing_decoding: convert to codecpar
|
||||
|
||||
@@ -61,6 +61,9 @@
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
#endif
|
||||
#if HAVE_SETDLLDIRECTORY
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
static int init_report(const char *env);
|
||||
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ PROJECT_NAME = FFmpeg
|
||||
# This could be handy for archiving the generated documentation or
|
||||
# if some version control system is used.
|
||||
|
||||
PROJECT_NUMBER = 3.1.3
|
||||
PROJECT_NUMBER = 3.1.4
|
||||
|
||||
# With the PROJECT_LOGO tag one can specify a logo or icon that is included
|
||||
# in the documentation. The maximum height of the logo should not exceed 55
|
||||
|
||||
@@ -94,6 +94,9 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
int ret = ff_set_dimensions(avctx, 80 << 3, 25 << 4);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
} else if (avctx->width % FONT_WIDTH || avctx->height % s->font_height) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid dimensions %d %d\n", avctx->width, avctx->height);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -139,7 +139,8 @@ int av_grow_packet(AVPacket *pkt, int grow_by)
|
||||
pkt->buf = av_buffer_alloc(new_size);
|
||||
if (!pkt->buf)
|
||||
return AVERROR(ENOMEM);
|
||||
memcpy(pkt->buf->data, pkt->data, pkt->size);
|
||||
if (pkt->size > 0)
|
||||
memcpy(pkt->buf->data, pkt->data, pkt->size);
|
||||
pkt->data = pkt->buf->data;
|
||||
}
|
||||
pkt->size += grow_by;
|
||||
@@ -198,6 +199,7 @@ static int copy_packet_data(AVPacket *pkt, const AVPacket *src, int dup)
|
||||
{
|
||||
pkt->data = NULL;
|
||||
pkt->side_data = NULL;
|
||||
pkt->side_data_elems = 0;
|
||||
if (pkt->buf) {
|
||||
AVBufferRef *ref = av_buffer_ref(src->buf);
|
||||
if (!ref)
|
||||
@@ -207,9 +209,11 @@ static int copy_packet_data(AVPacket *pkt, const AVPacket *src, int dup)
|
||||
} else {
|
||||
DUP_DATA(pkt->data, src->data, pkt->size, 1, ALLOC_BUF);
|
||||
}
|
||||
if (pkt->side_data_elems && dup)
|
||||
if (src->side_data_elems && dup) {
|
||||
pkt->side_data = src->side_data;
|
||||
if (pkt->side_data_elems && !dup) {
|
||||
pkt->side_data_elems = src->side_data_elems;
|
||||
}
|
||||
if (src->side_data_elems && !dup) {
|
||||
return av_copy_packet_side_data(pkt, src);
|
||||
}
|
||||
return 0;
|
||||
|
||||
@@ -188,7 +188,6 @@ static void cavs_filter_ch_c(uint8_t *d, int stride, int alpha, int beta, int tc
|
||||
static void cavs_idct8_add_c(uint8_t *dst, int16_t *block, int stride) {
|
||||
int i;
|
||||
int16_t (*src)[8] = (int16_t(*)[8])block;
|
||||
const uint8_t *cm = ff_crop_tab + MAX_NEG_CROP;
|
||||
|
||||
src[0][0] += 8;
|
||||
|
||||
@@ -243,14 +242,14 @@ static void cavs_idct8_add_c(uint8_t *dst, int16_t *block, int stride) {
|
||||
const int b2 = a5 - a7;
|
||||
const int b3 = a4 - a6;
|
||||
|
||||
dst[i + 0*stride] = cm[ dst[i + 0*stride] + ((b0 + b4) >> 7)];
|
||||
dst[i + 1*stride] = cm[ dst[i + 1*stride] + ((b1 + b5) >> 7)];
|
||||
dst[i + 2*stride] = cm[ dst[i + 2*stride] + ((b2 + b6) >> 7)];
|
||||
dst[i + 3*stride] = cm[ dst[i + 3*stride] + ((b3 + b7) >> 7)];
|
||||
dst[i + 4*stride] = cm[ dst[i + 4*stride] + ((b3 - b7) >> 7)];
|
||||
dst[i + 5*stride] = cm[ dst[i + 5*stride] + ((b2 - b6) >> 7)];
|
||||
dst[i + 6*stride] = cm[ dst[i + 6*stride] + ((b1 - b5) >> 7)];
|
||||
dst[i + 7*stride] = cm[ dst[i + 7*stride] + ((b0 - b4) >> 7)];
|
||||
dst[i + 0*stride] = av_clip_uint8( dst[i + 0*stride] + ((b0 + b4) >> 7));
|
||||
dst[i + 1*stride] = av_clip_uint8( dst[i + 1*stride] + ((b1 + b5) >> 7));
|
||||
dst[i + 2*stride] = av_clip_uint8( dst[i + 2*stride] + ((b2 + b6) >> 7));
|
||||
dst[i + 3*stride] = av_clip_uint8( dst[i + 3*stride] + ((b3 + b7) >> 7));
|
||||
dst[i + 4*stride] = av_clip_uint8( dst[i + 4*stride] + ((b3 - b7) >> 7));
|
||||
dst[i + 5*stride] = av_clip_uint8( dst[i + 5*stride] + ((b2 - b6) >> 7));
|
||||
dst[i + 6*stride] = av_clip_uint8( dst[i + 6*stride] + ((b1 - b5) >> 7));
|
||||
dst[i + 7*stride] = av_clip_uint8( dst[i + 7*stride] + ((b0 - b4) >> 7));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+11
-16
@@ -247,7 +247,8 @@ typedef struct CCaptionSubContext {
|
||||
int64_t last_real_time;
|
||||
char prev_cmd[2];
|
||||
/* buffer to store pkt data */
|
||||
AVBufferRef *pktbuf;
|
||||
uint8_t *pktbuf;
|
||||
int pktbuf_size;
|
||||
int readorder;
|
||||
} CCaptionSubContext;
|
||||
|
||||
@@ -273,11 +274,7 @@ static av_cold int init_decoder(AVCodecContext *avctx)
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
/* allocate pkt buffer */
|
||||
ctx->pktbuf = av_buffer_alloc(128);
|
||||
if (!ctx->pktbuf) {
|
||||
ret = AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -285,7 +282,8 @@ static av_cold int close_decoder(AVCodecContext *avctx)
|
||||
{
|
||||
CCaptionSubContext *ctx = avctx->priv_data;
|
||||
av_bprint_finalize(&ctx->buffer, NULL);
|
||||
av_buffer_unref(&ctx->pktbuf);
|
||||
av_freep(&ctx->pktbuf);
|
||||
ctx->pktbuf_size = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -729,16 +727,13 @@ static int decode(AVCodecContext *avctx, void *data, int *got_sub, AVPacket *avp
|
||||
int ret = 0;
|
||||
int i;
|
||||
|
||||
if (ctx->pktbuf->size < len) {
|
||||
ret = av_buffer_realloc(&ctx->pktbuf, len);
|
||||
if (ret < 0) {
|
||||
av_log(ctx, AV_LOG_WARNING, "Insufficient Memory of %d truncated to %d\n", len, ctx->pktbuf->size);
|
||||
len = ctx->pktbuf->size;
|
||||
ret = 0;
|
||||
}
|
||||
av_fast_padded_malloc(&ctx->pktbuf, &ctx->pktbuf_size, len);
|
||||
if (!ctx->pktbuf) {
|
||||
av_log(ctx, AV_LOG_WARNING, "Insufficient Memory of %d truncated to %d\n", len, ctx->pktbuf_size);
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
memcpy(ctx->pktbuf->data, avpkt->data, len);
|
||||
bptr = ctx->pktbuf->data;
|
||||
memcpy(ctx->pktbuf, avpkt->data, len);
|
||||
bptr = ctx->pktbuf;
|
||||
|
||||
for (i = 0; i < len; i += 3) {
|
||||
uint8_t cc_type = *(bptr + i) & 3;
|
||||
|
||||
+1
-1
@@ -206,7 +206,7 @@ static int16_t g726_decode(G726Context* c, int I)
|
||||
|
||||
if (I_sig) /* get the sign */
|
||||
dq = -dq;
|
||||
re_signal = c->se + dq;
|
||||
re_signal = (int16_t)(c->se + dq);
|
||||
|
||||
/* Update second order predictor coefficient A2 and A1 */
|
||||
pk0 = (c->sez + dq) ? sgn(c->sez + dq) : 0;
|
||||
|
||||
@@ -103,9 +103,9 @@ static int h264_ps_to_nalu(const uint8_t *src, int src_size, uint8_t **out, int
|
||||
}
|
||||
*out = p = new;
|
||||
|
||||
i = i + 3;
|
||||
memmove(p + i, p + i - 1, *out_size - i);
|
||||
p[i - 1] = 0x03;
|
||||
i = i + 2;
|
||||
memmove(p + i + 1, p + i, *out_size - (i + 1));
|
||||
p[i] = 0x03;
|
||||
}
|
||||
}
|
||||
done:
|
||||
|
||||
@@ -2119,6 +2119,8 @@ int ff_mjpeg_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
ret = mjpeg_decode_com(s);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
} else if (start_code == DQT) {
|
||||
ff_mjpeg_decode_dqt(s);
|
||||
}
|
||||
|
||||
ret = -1;
|
||||
@@ -2151,9 +2153,6 @@ int ff_mjpeg_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
s->restart_count = 0;
|
||||
/* nothing to do on SOI */
|
||||
break;
|
||||
case DQT:
|
||||
ff_mjpeg_decode_dqt(s);
|
||||
break;
|
||||
case DHT:
|
||||
if ((ret = ff_mjpeg_decode_dht(s)) < 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "huffman table decode error\n");
|
||||
|
||||
@@ -471,6 +471,10 @@ static int mov_text_decode_frame(AVCodecContext *avctx,
|
||||
tsmb_type = AV_RB32(tsmb);
|
||||
tsmb += 4;
|
||||
|
||||
if (tsmb_size == 0) {
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (tsmb_size == 1) {
|
||||
if (m->tracksize + 16 > avpkt->size)
|
||||
break;
|
||||
|
||||
@@ -76,7 +76,7 @@ static const AVOption options[] = {
|
||||
{ "surfaces", "Number of concurrent surfaces", OFFSET(nb_surfaces), AV_OPT_TYPE_INT, { .i64 = 32 }, 0, INT_MAX, VE },
|
||||
{ "cbr", "Use cbr encoding mode", OFFSET(cbr), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
|
||||
{ "2pass", "Use 2pass encoding mode", OFFSET(twopass), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, VE },
|
||||
{ "gpu", "Selects which NVENC capable GPU to use. First GPU is 0, second is 1, and so on.", OFFSET(device), AV_OPT_TYPE_INT, { .i64 = ANY_DEVICE }, -2, INT_MAX, VE },
|
||||
{ "gpu", "Selects which NVENC capable GPU to use. First GPU is 0, second is 1, and so on.", OFFSET(device), AV_OPT_TYPE_INT, { .i64 = ANY_DEVICE }, -2, INT_MAX, VE, "device" },
|
||||
{ "any", "Pick the first device available", 0, AV_OPT_TYPE_CONST, { .i64 = ANY_DEVICE }, 0, 0, VE, "device" },
|
||||
{ "list", "List the available devices", 0, AV_OPT_TYPE_CONST, { .i64 = LIST_DEVICES }, 0, 0, VE, "device" },
|
||||
{ "delay", "Delay frame output by the given amount of frames", OFFSET(async_depth), AV_OPT_TYPE_INT, { .i64 = INT_MAX }, 0, INT_MAX, VE },
|
||||
|
||||
+7
-1
@@ -102,6 +102,7 @@ typedef struct SVQ3Context {
|
||||
int prev_frame_num;
|
||||
|
||||
enum AVPictureType pict_type;
|
||||
enum AVPictureType slice_type;
|
||||
int low_delay;
|
||||
|
||||
int mb_x, mb_y;
|
||||
@@ -1057,7 +1058,7 @@ static int svq3_decode_slice_header(AVCodecContext *avctx)
|
||||
return -1;
|
||||
}
|
||||
|
||||
s->pict_type = ff_h264_golomb_to_pict_type[slice_id];
|
||||
s->slice_type = ff_h264_golomb_to_pict_type[slice_id];
|
||||
|
||||
if ((header & 0x9F) == 2) {
|
||||
i = (s->mb_num < 64) ? 6 : (1 + av_log2(s->mb_num - 1));
|
||||
@@ -1426,6 +1427,8 @@ static int svq3_decode_frame(AVCodecContext *avctx, void *data,
|
||||
if (svq3_decode_slice_header(avctx))
|
||||
return -1;
|
||||
|
||||
s->pict_type = s->slice_type;
|
||||
|
||||
if (s->pict_type != AV_PICTURE_TYPE_B)
|
||||
FFSWAP(H264Picture*, s->next_pic, s->last_pic);
|
||||
|
||||
@@ -1539,6 +1542,9 @@ static int svq3_decode_frame(AVCodecContext *avctx, void *data,
|
||||
if (svq3_decode_slice_header(avctx))
|
||||
return -1;
|
||||
}
|
||||
if (s->slice_type != s->pict_type) {
|
||||
avpriv_request_sample(avctx, "non constant slice type\n");
|
||||
}
|
||||
/* TODO: support s->mb_skip_run */
|
||||
}
|
||||
|
||||
|
||||
@@ -1008,7 +1008,7 @@ static const AVOption colorspace_options[] = {
|
||||
|
||||
{ "space", "Output colorspace",
|
||||
OFFSET(user_csp), AV_OPT_TYPE_INT, { .i64 = AVCOL_SPC_UNSPECIFIED },
|
||||
AVCOL_PRI_RESERVED0, AVCOL_PRI_NB - 1, FLAGS, "csp" },
|
||||
AVCOL_SPC_RGB, AVCOL_SPC_NB - 1, FLAGS, "csp"},
|
||||
ENUM("bt709", AVCOL_SPC_BT709, "csp"),
|
||||
ENUM("fcc", AVCOL_SPC_FCC, "csp"),
|
||||
ENUM("bt470bg", AVCOL_SPC_BT470BG, "csp"),
|
||||
|
||||
@@ -344,14 +344,14 @@ static void avi_metadata_creation_time(AVDictionary **metadata, char *date)
|
||||
|
||||
static void avi_read_nikon(AVFormatContext *s, uint64_t end)
|
||||
{
|
||||
while (avio_tell(s->pb) < end) {
|
||||
while (avio_tell(s->pb) < end && !avio_feof(s->pb)) {
|
||||
uint32_t tag = avio_rl32(s->pb);
|
||||
uint32_t size = avio_rl32(s->pb);
|
||||
switch (tag) {
|
||||
case MKTAG('n', 'c', 't', 'g'): /* Nikon Tags */
|
||||
{
|
||||
uint64_t tag_end = avio_tell(s->pb) + size;
|
||||
while (avio_tell(s->pb) < tag_end) {
|
||||
while (avio_tell(s->pb) < tag_end && !avio_feof(s->pb)) {
|
||||
uint16_t tag = avio_rl16(s->pb);
|
||||
uint16_t size = avio_rl16(s->pb);
|
||||
const char *name = NULL;
|
||||
@@ -605,9 +605,13 @@ static int avi_read_header(AVFormatContext *s)
|
||||
ast = s->streams[0]->priv_data;
|
||||
av_freep(&s->streams[0]->codecpar->extradata);
|
||||
av_freep(&s->streams[0]->codecpar);
|
||||
av_freep(&s->streams[0]->codec);
|
||||
if (s->streams[0]->info)
|
||||
av_freep(&s->streams[0]->info->duration_error);
|
||||
av_freep(&s->streams[0]->info);
|
||||
if (s->streams[0]->internal)
|
||||
av_freep(&s->streams[0]->internal->avctx);
|
||||
av_freep(&s->streams[0]->internal);
|
||||
av_freep(&s->streams[0]);
|
||||
s->nb_streams = 0;
|
||||
if (CONFIG_DV_DEMUXER) {
|
||||
@@ -1093,6 +1097,8 @@ static int read_gab2_sub(AVFormatContext *s, AVStream *st, AVPacket *pkt)
|
||||
goto error;
|
||||
|
||||
if (!avformat_open_input(&ast->sub_ctx, "", sub_demuxer, NULL)) {
|
||||
if (ast->sub_ctx->nb_streams != 1)
|
||||
goto error;
|
||||
ff_read_packet(ast->sub_ctx, &ast->sub_pkt);
|
||||
avcodec_parameters_copy(st->codecpar, ast->sub_ctx->streams[0]->codecpar);
|
||||
time_base = ast->sub_ctx->streams[0]->time_base;
|
||||
@@ -1849,7 +1855,6 @@ static int avi_read_seek(AVFormatContext *s, int stream_index,
|
||||
continue;
|
||||
|
||||
// av_assert1(st2->codecpar->block_align);
|
||||
av_assert0(fabs(av_q2d(st2->time_base) - ast2->scale / (double)ast2->rate) < av_q2d(st2->time_base) * 0.00000001);
|
||||
index = av_index_search_timestamp(st2,
|
||||
av_rescale_q(timestamp,
|
||||
st->time_base,
|
||||
|
||||
+5
-5
@@ -416,10 +416,10 @@ static struct segment *new_init_section(struct playlist *pls,
|
||||
}
|
||||
|
||||
if (info->byterange[0]) {
|
||||
sec->size = atoi(info->byterange);
|
||||
sec->size = strtoll(info->byterange, NULL, 10);
|
||||
ptr = strchr(info->byterange, '@');
|
||||
if (ptr)
|
||||
sec->url_offset = atoi(ptr+1);
|
||||
sec->url_offset = strtoll(ptr+1, NULL, 10);
|
||||
} else {
|
||||
/* the entire file is the init section */
|
||||
sec->size = -1;
|
||||
@@ -731,7 +731,7 @@ static int parse_playlist(HLSContext *c, const char *url,
|
||||
ret = ensure_playlist(c, &pls, url);
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
pls->target_duration = atoi(ptr) * AV_TIME_BASE;
|
||||
pls->target_duration = strtoll(ptr, NULL, 10) * AV_TIME_BASE;
|
||||
} else if (av_strstart(line, "#EXT-X-MEDIA-SEQUENCE:", &ptr)) {
|
||||
ret = ensure_playlist(c, &pls, url);
|
||||
if (ret < 0)
|
||||
@@ -760,10 +760,10 @@ static int parse_playlist(HLSContext *c, const char *url,
|
||||
is_segment = 1;
|
||||
duration = atof(ptr) * AV_TIME_BASE;
|
||||
} else if (av_strstart(line, "#EXT-X-BYTERANGE:", &ptr)) {
|
||||
seg_size = atoi(ptr);
|
||||
seg_size = strtoll(ptr, NULL, 10);
|
||||
ptr = strchr(ptr, '@');
|
||||
if (ptr)
|
||||
seg_offset = atoi(ptr+1);
|
||||
seg_offset = strtoll(ptr+1, NULL, 10);
|
||||
} else if (av_strstart(line, "#", NULL)) {
|
||||
continue;
|
||||
} else if (line[0]) {
|
||||
|
||||
+1
-1
@@ -3243,7 +3243,7 @@ static int mov_read_keys(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
|
||||
avio_skip(pb, 4);
|
||||
count = avio_rb32(pb);
|
||||
if (count > UINT_MAX / sizeof(*c->meta_keys)) {
|
||||
if (count > UINT_MAX / sizeof(*c->meta_keys) - 1) {
|
||||
av_log(c->fc, AV_LOG_ERROR,
|
||||
"The 'keys' atom with the invalid key count: %d\n", count);
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
+29
-6
@@ -4592,15 +4592,10 @@ static int mov_auto_flush_fragment(AVFormatContext *s, int force)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
static int check_pkt(AVFormatContext *s, AVPacket *pkt)
|
||||
{
|
||||
MOVMuxContext *mov = s->priv_data;
|
||||
AVIOContext *pb = s->pb;
|
||||
MOVTrack *trk = &mov->tracks[pkt->stream_index];
|
||||
AVCodecParameters *par = trk->par;
|
||||
unsigned int samples_in_chunk = 0;
|
||||
int size = pkt->size, ret = 0;
|
||||
uint8_t *reformatted_data = NULL;
|
||||
|
||||
if (trk->entry) {
|
||||
int64_t duration = pkt->dts - trk->cluster[trk->entry - 1].dts;
|
||||
@@ -4612,11 +4607,35 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
pkt->dts = trk->cluster[trk->entry - 1].dts + 1;
|
||||
pkt->pts = AV_NOPTS_VALUE;
|
||||
}
|
||||
} else if (pkt->dts <= INT_MIN || pkt->dts >= INT_MAX) {
|
||||
av_log(s, AV_LOG_ERROR, "Application provided initial timestamp: %"PRId64" is out of range for mov/mp4 format\n",
|
||||
pkt->dts
|
||||
);
|
||||
|
||||
pkt->dts = 0;
|
||||
pkt->pts = AV_NOPTS_VALUE;
|
||||
}
|
||||
if (pkt->duration < 0 || pkt->duration > INT_MAX) {
|
||||
av_log(s, AV_LOG_ERROR, "Application provided duration: %"PRId64" is invalid\n", pkt->duration);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
{
|
||||
MOVMuxContext *mov = s->priv_data;
|
||||
AVIOContext *pb = s->pb;
|
||||
MOVTrack *trk = &mov->tracks[pkt->stream_index];
|
||||
AVCodecParameters *par = trk->par;
|
||||
unsigned int samples_in_chunk = 0;
|
||||
int size = pkt->size, ret = 0;
|
||||
uint8_t *reformatted_data = NULL;
|
||||
|
||||
ret = check_pkt(s, pkt);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
if (mov->flags & FF_MOV_FLAG_FRAGMENT) {
|
||||
int ret;
|
||||
if (mov->moov_written || mov->flags & FF_MOV_FLAG_EMPTY_MOOV) {
|
||||
@@ -4882,6 +4901,10 @@ static int mov_write_single_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
int64_t frag_duration = 0;
|
||||
int size = pkt->size;
|
||||
|
||||
int ret = check_pkt(s, pkt);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
if (mov->flags & FF_MOV_FLAG_FRAG_DISCONT) {
|
||||
int i;
|
||||
for (i = 0; i < s->nb_streams; i++)
|
||||
|
||||
+6
-2
@@ -307,7 +307,7 @@ static int set_codec_from_probe_data(AVFormatContext *s, AVStream *st,
|
||||
int score;
|
||||
AVInputFormat *fmt = av_probe_input_format3(pd, 1, &score);
|
||||
|
||||
if (fmt && st->request_probe <= score) {
|
||||
if (fmt) {
|
||||
int i;
|
||||
av_log(s, AV_LOG_DEBUG,
|
||||
"Probe with size=%d, packets=%d detected %s with score=%d\n",
|
||||
@@ -318,6 +318,9 @@ static int set_codec_from_probe_data(AVFormatContext *s, AVStream *st,
|
||||
if (fmt_id_type[i].type != AVMEDIA_TYPE_AUDIO &&
|
||||
st->codecpar->sample_rate)
|
||||
continue;
|
||||
if (st->request_probe > score &&
|
||||
st->codecpar->codec_id != fmt_id_type[i].id)
|
||||
continue;
|
||||
st->codecpar->codec_id = fmt_id_type[i].id;
|
||||
st->codecpar->codec_type = fmt_id_type[i].type;
|
||||
st->internal->need_context_update = 1;
|
||||
@@ -2411,6 +2414,7 @@ int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts,
|
||||
max_ts = av_rescale_rnd(max_ts, time_base.den,
|
||||
time_base.num * (int64_t)AV_TIME_BASE,
|
||||
AV_ROUND_DOWN | AV_ROUND_PASS_MINMAX);
|
||||
stream_index = 0;
|
||||
}
|
||||
|
||||
ret = s->iformat->read_seek2(s, stream_index, min_ts,
|
||||
@@ -2500,7 +2504,7 @@ static void update_stream_timings(AVFormatContext *ic)
|
||||
end_time1 = av_rescale_q_rnd(st->duration, st->time_base,
|
||||
AV_TIME_BASE_Q,
|
||||
AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX);
|
||||
if (end_time1 != AV_NOPTS_VALUE && start_time1 <= INT64_MAX - end_time1) {
|
||||
if (end_time1 != AV_NOPTS_VALUE && (end_time1 > 0 ? start_time1 <= INT64_MAX - end_time1 : start_time1 >= INT64_MIN - end_time1)) {
|
||||
end_time1 += start_time1;
|
||||
end_time = FFMAX(end_time, end_time1);
|
||||
}
|
||||
|
||||
@@ -352,6 +352,7 @@ static int packed_16bpc_bswap(SwsContext *c, const uint8_t *src[],
|
||||
int min_stride = FFMIN(FFABS(srcstr), FFABS(dststr));
|
||||
if(!dstPtr || !srcPtr)
|
||||
continue;
|
||||
dstPtr += (srcSliceY >> c->chrDstVSubSample) * dststr;
|
||||
for (i = 0; i < (srcSliceH >> c->chrDstVSubSample); i++) {
|
||||
for (j = 0; j < min_stride; j++) {
|
||||
dstPtr[j] = av_bswap16(srcPtr[j]);
|
||||
@@ -557,6 +558,8 @@ static int Rgb16ToPlanarRgb16Wrapper(SwsContext *c, const uint8_t *src[],
|
||||
int bpc = dst_format->comp[0].depth;
|
||||
int alpha = src_format->flags & AV_PIX_FMT_FLAG_ALPHA;
|
||||
int swap = 0;
|
||||
int i;
|
||||
|
||||
if ( HAVE_BIGENDIAN && !(src_format->flags & AV_PIX_FMT_FLAG_BE) ||
|
||||
!HAVE_BIGENDIAN && src_format->flags & AV_PIX_FMT_FLAG_BE)
|
||||
swap++;
|
||||
@@ -570,6 +573,12 @@ static int Rgb16ToPlanarRgb16Wrapper(SwsContext *c, const uint8_t *src[],
|
||||
src_format->name, dst_format->name);
|
||||
return srcSliceH;
|
||||
}
|
||||
|
||||
for(i=0; i<4; i++) {
|
||||
dst2013[i] += stride2013[i] * srcSliceY / 2;
|
||||
dst1023[i] += stride1023[i] * srcSliceY / 2;
|
||||
}
|
||||
|
||||
switch (c->srcFormat) {
|
||||
case AV_PIX_FMT_RGB48LE:
|
||||
case AV_PIX_FMT_RGB48BE:
|
||||
|
||||
Reference in New Issue
Block a user