Compare commits
30 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
1690c1fa88 | ||
![]() |
3f27158040 | ||
![]() |
c459c7b23e | ||
![]() |
08e2c7a45f | ||
![]() |
89e16e675d | ||
![]() |
4cd1dad91a | ||
![]() |
3e196e4def | ||
![]() |
2502914c5f | ||
![]() |
6df0d3e291 | ||
![]() |
85a14dbd5d | ||
![]() |
db0f7f7394 | ||
![]() |
b666debffe | ||
![]() |
c3744b415a | ||
![]() |
7df878ac15 | ||
![]() |
bc58fe0309 | ||
![]() |
8eda888683 | ||
![]() |
f3144b0cc6 | ||
![]() |
86f072ceb3 | ||
![]() |
21185028b4 | ||
![]() |
0c2a350762 | ||
![]() |
299dc3baea | ||
![]() |
5c1a1b47f3 | ||
![]() |
4f8b7eb87f | ||
![]() |
d807022283 | ||
![]() |
f7bf3becf6 | ||
![]() |
7ca4b91898 | ||
![]() |
75aa373bec | ||
![]() |
bec97981ba | ||
![]() |
78526c279f | ||
![]() |
5ee483ae62 |
2
Doxyfile
2
Doxyfile
@@ -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 = 1.0.2
|
||||
PROJECT_NUMBER = 1.0.4
|
||||
|
||||
# With the PROJECT_LOGO tag one can specify an logo or icon that is included
|
||||
# in the documentation. The maximum height of the logo should not exceed 55
|
||||
|
@@ -641,10 +641,11 @@ Write an mp3 with an ID3v2.3 header and an ID3v1 footer:
|
||||
ffmpeg -i INPUT -id3v2_version 3 -write_id3v1 1 out.mp3
|
||||
@end example
|
||||
|
||||
Attach a picture to an mp3:
|
||||
To attach a picture to an mp3 file select both the audio and the picture stream
|
||||
with @code{map}:
|
||||
@example
|
||||
ffmpeg -i input.mp3 -i cover.png -c copy -metadata:s:v title="Album cover"
|
||||
-metadata:s:v comment="Cover (Front)" out.mp3
|
||||
ffmpeg -i input.mp3 -i cover.png -c copy -map 0 -map 1
|
||||
-metadata:s:v title="Album cover" -metadata:s:v comment="Cover (Front)" out.mp3
|
||||
@end example
|
||||
|
||||
@c man end MUXERS
|
||||
|
@@ -1141,9 +1141,11 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, in
|
||||
if (do_pass) {
|
||||
if (do_pass & 1) {
|
||||
video_enc->flags |= CODEC_FLAG_PASS1;
|
||||
av_dict_set(&ost->opts, "flags", "+pass1", AV_DICT_APPEND);
|
||||
}
|
||||
if (do_pass & 2) {
|
||||
video_enc->flags |= CODEC_FLAG_PASS2;
|
||||
av_dict_set(&ost->opts, "flags", "+pass2", AV_DICT_APPEND);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -883,6 +883,11 @@ static av_cold int aac_decode_init(AVCodecContext *avctx)
|
||||
}
|
||||
}
|
||||
|
||||
if (avctx->channels > MAX_CHANNELS) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Too many channels\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
AAC_INIT_VLC_STATIC( 0, 304);
|
||||
AAC_INIT_VLC_STATIC( 1, 270);
|
||||
AAC_INIT_VLC_STATIC( 2, 550);
|
||||
|
@@ -755,7 +755,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data,
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
}
|
||||
for (n = nb_samples >> (1 - st); n > 0; n--) {
|
||||
for (n = (nb_samples - 1) >> (1 - st); n > 0; n--) {
|
||||
int v = bytestream2_get_byteu(&gb);
|
||||
*samples++ = adpcm_ima_expand_nibble(&c->status[0 ], v >> 4 , 3);
|
||||
*samples++ = adpcm_ima_expand_nibble(&c->status[st], v & 0x0F, 3);
|
||||
|
@@ -552,12 +552,15 @@ static void get_block_sizes(ALSDecContext *ctx, unsigned int *div_blocks,
|
||||
|
||||
/** Read the block data for a constant block
|
||||
*/
|
||||
static void read_const_block_data(ALSDecContext *ctx, ALSBlockData *bd)
|
||||
static int read_const_block_data(ALSDecContext *ctx, ALSBlockData *bd)
|
||||
{
|
||||
ALSSpecificConfig *sconf = &ctx->sconf;
|
||||
AVCodecContext *avctx = ctx->avctx;
|
||||
GetBitContext *gb = &ctx->gb;
|
||||
|
||||
if (bd->block_length <= 0)
|
||||
return -1;
|
||||
|
||||
*bd->raw_samples = 0;
|
||||
*bd->const_block = get_bits1(gb); // 1 = constant value, 0 = zero block (silence)
|
||||
bd->js_blocks = get_bits1(gb);
|
||||
@@ -572,6 +575,8 @@ static void read_const_block_data(ALSDecContext *ctx, ALSBlockData *bd)
|
||||
|
||||
// ensure constant block decoding by reusing this field
|
||||
*bd->const_block = 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -971,7 +976,8 @@ static int read_block(ALSDecContext *ctx, ALSBlockData *bd)
|
||||
if (read_var_block_data(ctx, bd))
|
||||
return -1;
|
||||
} else {
|
||||
read_const_block_data(ctx, bd);
|
||||
if (read_const_block_data(ctx, bd) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@@ -955,6 +955,11 @@ static av_cold int atrac3_decode_init(AVCodecContext *avctx)
|
||||
}
|
||||
/* Check the extradata. */
|
||||
|
||||
if (q->codingMode == JOINT_STEREO && avctx->channels < 2) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid coding mode\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
if (q->atrac3version != 4) {
|
||||
av_log(avctx,AV_LOG_ERROR,"Version %d != 4.\n",q->atrac3version);
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
@@ -923,6 +923,12 @@ void ff_er_frame_end(MpegEncContext *s)
|
||||
return;
|
||||
};
|
||||
|
||||
if ( s->picture_structure == PICT_FRAME
|
||||
&& s->current_picture.f.linesize[0] != s->current_picture_ptr->f.linesize[0]) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Error concealment not possible, frame not fully initialized\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (s->current_picture.f.motion_val[0] == NULL) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Warning MVs not available\n");
|
||||
|
||||
|
@@ -2280,7 +2280,7 @@ static int field_end(H264Context *h, int in_setup)
|
||||
* past end by one (callers fault) and resync_mb_y != 0
|
||||
* causes problems for the first MB line, too.
|
||||
*/
|
||||
if (!FIELD_PICTURE)
|
||||
if (!FIELD_PICTURE && h->current_slice)
|
||||
ff_er_frame_end(s);
|
||||
|
||||
ff_MPV_frame_end(s);
|
||||
@@ -2360,7 +2360,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
|
||||
MpegEncContext *const s0 = &h0->s;
|
||||
unsigned int first_mb_in_slice;
|
||||
unsigned int pps_id;
|
||||
int num_ref_idx_active_override_flag;
|
||||
int num_ref_idx_active_override_flag, ret;
|
||||
unsigned int slice_type, tmp, i, j;
|
||||
int default_ref_list_done = 0;
|
||||
int last_pic_structure, last_pic_dropable;
|
||||
@@ -2795,7 +2795,9 @@ static int decode_slice_header(H264Context *h, H264Context *h0)
|
||||
s->current_picture_ptr->frame_num = h->prev_frame_num;
|
||||
ff_thread_report_progress(&s->current_picture_ptr->f, INT_MAX, 0);
|
||||
ff_thread_report_progress(&s->current_picture_ptr->f, INT_MAX, 1);
|
||||
ff_generate_sliding_window_mmcos(h, 1);
|
||||
if ((ret = ff_generate_sliding_window_mmcos(h, 1)) < 0 &&
|
||||
s->avctx->err_recognition & AV_EF_EXPLODE)
|
||||
return ret;
|
||||
if (ff_h264_execute_ref_pic_marking(h, h->mmco, h->mmco_index) < 0 &&
|
||||
(s->avctx->err_recognition & AV_EF_EXPLODE))
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
@@ -671,7 +671,7 @@ int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count);
|
||||
int ff_h264_decode_ref_pic_marking(H264Context *h, GetBitContext *gb,
|
||||
int first_slice);
|
||||
|
||||
void ff_generate_sliding_window_mmcos(H264Context *h, int first_slice);
|
||||
int ff_generate_sliding_window_mmcos(H264Context *h, int first_slice);
|
||||
|
||||
/**
|
||||
* Check if the top & left blocks are available if needed & change the
|
||||
|
@@ -485,14 +485,17 @@ static int check_opcodes(MMCO *mmco1, MMCO *mmco2, int n_mmcos)
|
||||
int i;
|
||||
|
||||
for (i = 0; i < n_mmcos; i++) {
|
||||
if (mmco1[i].opcode != mmco2[i].opcode)
|
||||
if (mmco1[i].opcode != mmco2[i].opcode) {
|
||||
av_log(NULL, AV_LOG_ERROR, "MMCO opcode [%d, %d] at %d mismatches between slices\n",
|
||||
mmco1[i].opcode, mmco2[i].opcode, i);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ff_generate_sliding_window_mmcos(H264Context *h, int first_slice)
|
||||
int ff_generate_sliding_window_mmcos(H264Context *h, int first_slice)
|
||||
{
|
||||
MpegEncContext * const s = &h->s;
|
||||
MMCO mmco_temp[MAX_MMCO_COUNT], *mmco = first_slice ? h->mmco : mmco_temp;
|
||||
@@ -519,10 +522,11 @@ void ff_generate_sliding_window_mmcos(H264Context *h, int first_slice)
|
||||
(mmco_index != h->mmco_index ||
|
||||
(i = check_opcodes(h->mmco, mmco_temp, mmco_index)))) {
|
||||
av_log(h->s.avctx, AV_LOG_ERROR,
|
||||
"Inconsistent MMCO state between slices [%d, %d, %d]\n",
|
||||
mmco_index, h->mmco_index, i);
|
||||
"Inconsistent MMCO state between slices [%d, %d]\n",
|
||||
mmco_index, h->mmco_index);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count){
|
||||
@@ -696,7 +700,7 @@ int ff_h264_decode_ref_pic_marking(H264Context *h, GetBitContext *gb,
|
||||
int first_slice)
|
||||
{
|
||||
MpegEncContext * const s = &h->s;
|
||||
int i;
|
||||
int i, ret;
|
||||
MMCO mmco_temp[MAX_MMCO_COUNT], *mmco = first_slice ? h->mmco : mmco_temp;
|
||||
int mmco_index = 0;
|
||||
|
||||
@@ -753,8 +757,11 @@ int ff_h264_decode_ref_pic_marking(H264Context *h, GetBitContext *gb,
|
||||
}
|
||||
mmco_index = i;
|
||||
} else {
|
||||
if (first_slice)
|
||||
ff_generate_sliding_window_mmcos(h, first_slice);
|
||||
if (first_slice) {
|
||||
ret = ff_generate_sliding_window_mmcos(h, first_slice);
|
||||
if (ret < 0 && s->avctx->err_recognition & AV_EF_EXPLODE)
|
||||
return ret;
|
||||
}
|
||||
mmco_index = -1;
|
||||
}
|
||||
}
|
||||
@@ -765,8 +772,8 @@ int ff_h264_decode_ref_pic_marking(H264Context *h, GetBitContext *gb,
|
||||
(mmco_index != h->mmco_index ||
|
||||
(i = check_opcodes(h->mmco, mmco_temp, mmco_index)))) {
|
||||
av_log(h->s.avctx, AV_LOG_ERROR,
|
||||
"Inconsistent MMCO state between slices [%d, %d, %d]\n",
|
||||
mmco_index, h->mmco_index, i);
|
||||
"Inconsistent MMCO state between slices [%d, %d]\n",
|
||||
mmco_index, h->mmco_index);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
|
@@ -267,12 +267,13 @@ static void generate_joint_tables(HYuvContext *s)
|
||||
for (i = y = 0; y < 256; y++) {
|
||||
int len0 = s->len[0][y];
|
||||
int limit = VLC_BITS - len0;
|
||||
if(limit <= 0)
|
||||
if(limit <= 0 || !len0)
|
||||
continue;
|
||||
for (u = 0; u < 256; u++) {
|
||||
int len1 = s->len[p][u];
|
||||
if (len1 > limit)
|
||||
if (len1 > limit || !len1)
|
||||
continue;
|
||||
av_assert0(i < (1 << VLC_BITS));
|
||||
len[i] = len0 + len1;
|
||||
bits[i] = (s->bits[0][y] << len1) + s->bits[p][u];
|
||||
symbols[i] = (y << 8) + u;
|
||||
@@ -295,18 +296,19 @@ static void generate_joint_tables(HYuvContext *s)
|
||||
for (i = 0, g = -16; g < 16; g++) {
|
||||
int len0 = s->len[p0][g & 255];
|
||||
int limit0 = VLC_BITS - len0;
|
||||
if (limit0 < 2)
|
||||
if (limit0 < 2 || !len0)
|
||||
continue;
|
||||
for (b = -16; b < 16; b++) {
|
||||
int len1 = s->len[p1][b & 255];
|
||||
int limit1 = limit0 - len1;
|
||||
if (limit1 < 1)
|
||||
if (limit1 < 1 || !len1)
|
||||
continue;
|
||||
code = (s->bits[p0][g & 255] << len1) + s->bits[p1][b & 255];
|
||||
for (r = -16; r < 16; r++) {
|
||||
int len2 = s->len[2][r & 255];
|
||||
if (len2 > limit1)
|
||||
if (len2 > limit1 || !len2)
|
||||
continue;
|
||||
av_assert0(i < (1 << VLC_BITS));
|
||||
len[i] = len0 + len1 + len2;
|
||||
bits[i] = (code << len2) + s->bits[2][r & 255];
|
||||
if (s->decorrelate) {
|
||||
@@ -331,6 +333,7 @@ static int read_huffman_tables(HYuvContext *s, const uint8_t *src, int length)
|
||||
{
|
||||
GetBitContext gb;
|
||||
int i;
|
||||
int ret;
|
||||
|
||||
init_get_bits(&gb, src, length * 8);
|
||||
|
||||
@@ -341,8 +344,9 @@ static int read_huffman_tables(HYuvContext *s, const uint8_t *src, int length)
|
||||
return -1;
|
||||
}
|
||||
ff_free_vlc(&s->vlc[i]);
|
||||
init_vlc(&s->vlc[i], VLC_BITS, 256, s->len[i], 1, 1,
|
||||
s->bits[i], 4, 4, 0);
|
||||
if ((ret = init_vlc(&s->vlc[i], VLC_BITS, 256, s->len[i], 1, 1,
|
||||
s->bits[i], 4, 4, 0)) < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
generate_joint_tables(s);
|
||||
@@ -354,6 +358,7 @@ static int read_old_huffman_tables(HYuvContext *s)
|
||||
{
|
||||
GetBitContext gb;
|
||||
int i;
|
||||
int ret;
|
||||
|
||||
init_get_bits(&gb, classic_shift_luma,
|
||||
classic_shift_luma_table_size * 8);
|
||||
@@ -377,8 +382,9 @@ static int read_old_huffman_tables(HYuvContext *s)
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
ff_free_vlc(&s->vlc[i]);
|
||||
init_vlc(&s->vlc[i], VLC_BITS, 256, s->len[i], 1, 1,
|
||||
s->bits[i], 4, 4, 0);
|
||||
if ((ret = init_vlc(&s->vlc[i], VLC_BITS, 256, s->len[i], 1, 1,
|
||||
s->bits[i], 4, 4, 0)) < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
generate_joint_tables(s);
|
||||
|
@@ -21,6 +21,7 @@
|
||||
|
||||
#include <stdarg.h>
|
||||
#include "avcodec.h"
|
||||
#include "libavutil/avassert.h"
|
||||
#include "libavutil/avstring.h"
|
||||
#include "libavutil/intreadwrite.h"
|
||||
#include "ass_split.h"
|
||||
@@ -87,15 +88,18 @@ static av_cold int mov_text_encode_init(AVCodecContext *avctx)
|
||||
static void mov_text_text_cb(void *priv, const char *text, int len)
|
||||
{
|
||||
MovTextContext *s = priv;
|
||||
av_assert0(s->end >= s->ptr);
|
||||
av_strlcpy(s->ptr, text, FFMIN(s->end - s->ptr, len + 1));
|
||||
s->ptr += len;
|
||||
s->ptr += FFMIN(s->end - s->ptr, len);
|
||||
}
|
||||
|
||||
static void mov_text_new_line_cb(void *priv, int forced)
|
||||
{
|
||||
MovTextContext *s = priv;
|
||||
av_assert0(s->end >= s->ptr);
|
||||
av_strlcpy(s->ptr, "\n", FFMIN(s->end - s->ptr, 2));
|
||||
s->ptr++;
|
||||
if (s->end > s->ptr)
|
||||
s->ptr++;
|
||||
}
|
||||
|
||||
static const ASSCodesCallbacks mov_text_callbacks = {
|
||||
|
@@ -25,6 +25,7 @@
|
||||
#include "avcodec.h"
|
||||
#include "bytestream.h"
|
||||
#include "libavutil/bswap.h"
|
||||
#include "libavutil/imgutils.h"
|
||||
#include "libavcodec/dsputil.h"
|
||||
#include "sanm_data.h"
|
||||
|
||||
@@ -637,6 +638,11 @@ static int old_codec47(SANMVideoContext *ctx, int top,
|
||||
decoded_size = bytestream2_get_le32(&ctx->gb);
|
||||
bytestream2_skip(&ctx->gb, 8);
|
||||
|
||||
if (decoded_size > height * stride - left - top * stride) {
|
||||
decoded_size = height * stride - left - top * stride;
|
||||
av_log(ctx->avctx, AV_LOG_WARNING, "decoded size is too large\n");
|
||||
}
|
||||
|
||||
if (skip & 1)
|
||||
bytestream2_skip(&ctx->gb, 0x8080);
|
||||
if (!seq) {
|
||||
@@ -715,8 +721,11 @@ static int process_frame_obj(SANMVideoContext *ctx)
|
||||
h = bytestream2_get_le16u(&ctx->gb);
|
||||
|
||||
if (ctx->width < left + w || ctx->height < top + h) {
|
||||
ctx->avctx->width = FFMAX(left + w, ctx->width);
|
||||
ctx->avctx->height = FFMAX(top + h, ctx->height);
|
||||
if (av_image_check_size(FFMAX(left + w, ctx->width),
|
||||
FFMAX(top + h, ctx->height), 0, ctx->avctx) < 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
avcodec_set_dimensions(ctx->avctx, FFMAX(left + w, ctx->width),
|
||||
FFMAX(top + h, ctx->height));
|
||||
init_sizes(ctx, left + w, top + h);
|
||||
if (init_buffers(ctx)) {
|
||||
av_log(ctx->avctx, AV_LOG_ERROR, "error resizing buffers\n");
|
||||
|
@@ -1744,7 +1744,7 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx,
|
||||
* make sure it's set correctly; assume decoders that actually use
|
||||
* extended_data are doing it correctly */
|
||||
planar = av_sample_fmt_is_planar(frame->format);
|
||||
channels = av_get_channel_layout_nb_channels(frame->channel_layout);
|
||||
channels = frame->channels;
|
||||
if (!(planar && channels > AV_NUM_DATA_POINTERS))
|
||||
frame->extended_data = frame->data;
|
||||
|
||||
|
@@ -536,6 +536,11 @@ static int vqa_decode_chunk(VqaContext *s)
|
||||
bytestream2_seek(&s->gb, cbp0_chunk, SEEK_SET);
|
||||
chunk_size = bytestream2_get_be32(&s->gb);
|
||||
|
||||
if (chunk_size > MAX_CODEBOOK_SIZE - s->next_codebook_buffer_index) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "cbp0 chunk too large (0x%X bytes)\n", chunk_size);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
/* accumulate partial codebook */
|
||||
bytestream2_get_buffer(&s->gb, &s->next_codebook_buffer[s->next_codebook_buffer_index],
|
||||
chunk_size);
|
||||
@@ -559,6 +564,11 @@ static int vqa_decode_chunk(VqaContext *s)
|
||||
bytestream2_seek(&s->gb, cbpz_chunk, SEEK_SET);
|
||||
chunk_size = bytestream2_get_be32(&s->gb);
|
||||
|
||||
if (chunk_size > MAX_CODEBOOK_SIZE - s->next_codebook_buffer_index) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "cbpz chunk too large (0x%X bytes)\n", chunk_size);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
/* accumulate partial codebook */
|
||||
bytestream2_get_buffer(&s->gb, &s->next_codebook_buffer[s->next_codebook_buffer_index],
|
||||
chunk_size);
|
||||
|
@@ -220,6 +220,7 @@ static int filter_samples(AVFilterLink *inlink, AVFilterBufferRef *insamples)
|
||||
}
|
||||
if (showwaves->buf_idx == showwaves->w)
|
||||
push_frame(outlink);
|
||||
outpicref = showwaves->outpicref;
|
||||
}
|
||||
|
||||
avfilter_unref_buffer(insamples);
|
||||
|
@@ -376,8 +376,8 @@ static int dv_write_header(AVFormatContext *s)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (tcr)
|
||||
return av_timecode_init_from_string(&dvc->tc, rate, tcr->value, s);
|
||||
if (tcr && av_timecode_init_from_string(&dvc->tc, rate, tcr->value, s) >= 0)
|
||||
return 0;
|
||||
return av_timecode_init(&dvc->tc, rate, 0, 0, s);
|
||||
}
|
||||
|
||||
|
@@ -712,13 +712,13 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
st = s->streams[i];
|
||||
if (stream_type == FLV_STREAM_TYPE_AUDIO) {
|
||||
if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO &&
|
||||
flv_same_audio_codec(st->codec, flags)) {
|
||||
(s->audio_codec_id || flv_same_audio_codec(st->codec, flags))) {
|
||||
break;
|
||||
}
|
||||
} else
|
||||
if (stream_type == FLV_STREAM_TYPE_VIDEO) {
|
||||
if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO &&
|
||||
flv_same_video_codec(st->codec, flags)) {
|
||||
(s->video_codec_id || flv_same_video_codec(st->codec, flags))) {
|
||||
break;
|
||||
}
|
||||
} else if (stream_type == FLV_STREAM_TYPE_DATA) {
|
||||
|
@@ -21,6 +21,9 @@
|
||||
|
||||
#include "matroska.h"
|
||||
|
||||
/* If you add a tag here that is not in ff_codec_bmp_tags[]
|
||||
or ff_codec_wav_tags[], add it also to additional_audio_tags[]
|
||||
or additional_video_tags[] in matroskaenc.c */
|
||||
const CodecTags ff_mkv_codec_tags[]={
|
||||
{"A_AAC" , AV_CODEC_ID_AAC},
|
||||
{"A_AC3" , AV_CODEC_ID_AC3},
|
||||
|
@@ -1325,6 +1325,33 @@ static int mkv_query_codec(enum AVCodecID codec_id, int std_compliance)
|
||||
return 0;
|
||||
}
|
||||
|
||||
const AVCodecTag additional_audio_tags[] = {
|
||||
{ AV_CODEC_ID_ALAC, 0XFFFFFFFF },
|
||||
{ AV_CODEC_ID_EAC3, 0XFFFFFFFF },
|
||||
{ AV_CODEC_ID_MLP, 0xFFFFFFFF },
|
||||
{ AV_CODEC_ID_OPUS, 0xFFFFFFFF },
|
||||
{ AV_CODEC_ID_PCM_S16BE, 0xFFFFFFFF },
|
||||
{ AV_CODEC_ID_PCM_S24BE, 0xFFFFFFFF },
|
||||
{ AV_CODEC_ID_PCM_S32BE, 0xFFFFFFFF },
|
||||
{ AV_CODEC_ID_QDM2, 0xFFFFFFFF },
|
||||
{ AV_CODEC_ID_RA_144, 0xFFFFFFFF },
|
||||
{ AV_CODEC_ID_RA_288, 0xFFFFFFFF },
|
||||
{ AV_CODEC_ID_COOK, 0xFFFFFFFF },
|
||||
{ AV_CODEC_ID_TRUEHD, 0xFFFFFFFF },
|
||||
{ AV_CODEC_ID_TTA, 0xFFFFFFFF },
|
||||
{ AV_CODEC_ID_WAVPACK, 0xFFFFFFFF },
|
||||
{ AV_CODEC_ID_NONE, 0xFFFFFFFF }
|
||||
};
|
||||
|
||||
const AVCodecTag additional_video_tags[] = {
|
||||
{ AV_CODEC_ID_PRORES, 0xFFFFFFFF },
|
||||
{ AV_CODEC_ID_RV10, 0xFFFFFFFF },
|
||||
{ AV_CODEC_ID_RV20, 0xFFFFFFFF },
|
||||
{ AV_CODEC_ID_RV30, 0xFFFFFFFF },
|
||||
{ AV_CODEC_ID_RV40, 0xFFFFFFFF },
|
||||
{ AV_CODEC_ID_NONE, 0xFFFFFFFF }
|
||||
};
|
||||
|
||||
#if CONFIG_MATROSKA_MUXER
|
||||
AVOutputFormat ff_matroska_muxer = {
|
||||
.name = "matroska",
|
||||
@@ -1341,6 +1368,10 @@ AVOutputFormat ff_matroska_muxer = {
|
||||
.write_trailer = mkv_write_trailer,
|
||||
.flags = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS |
|
||||
AVFMT_TS_NONSTRICT,
|
||||
.codec_tag = (const AVCodecTag* const []){
|
||||
ff_codec_bmp_tags, ff_codec_wav_tags,
|
||||
additional_audio_tags, additional_video_tags, 0
|
||||
},
|
||||
.subtitle_codec = AV_CODEC_ID_SSA,
|
||||
.query_codec = mkv_query_codec,
|
||||
};
|
||||
@@ -1377,5 +1408,8 @@ AVOutputFormat ff_matroska_audio_muxer = {
|
||||
.write_packet = mkv_write_packet,
|
||||
.write_trailer = mkv_write_trailer,
|
||||
.flags = AVFMT_GLOBALHEADER | AVFMT_TS_NONSTRICT,
|
||||
.codec_tag = (const AVCodecTag* const []){
|
||||
ff_codec_wav_tags, additional_audio_tags, 0
|
||||
},
|
||||
};
|
||||
#endif
|
||||
|
@@ -676,6 +676,9 @@ static int mov_read_chan(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
if (atom.size < 16)
|
||||
return 0;
|
||||
|
||||
/* skip version and flags */
|
||||
avio_skip(pb, 4);
|
||||
|
||||
ff_mov_read_chan(c->fc, pb, st, atom.size - 4);
|
||||
|
||||
return 0;
|
||||
|
@@ -343,11 +343,11 @@ int ff_amf_tag_size(const uint8_t *data, const uint8_t *data_end)
|
||||
data++;
|
||||
break;
|
||||
}
|
||||
if (data + size >= data_end || data + size < data)
|
||||
if (size < 0 || size >= data_end - data)
|
||||
return -1;
|
||||
data += size;
|
||||
t = ff_amf_tag_size(data, data_end);
|
||||
if (t < 0 || data + t >= data_end)
|
||||
if (t < 0 || t >= data_end - data)
|
||||
return -1;
|
||||
data += t;
|
||||
}
|
||||
@@ -376,7 +376,7 @@ int ff_amf_get_field_value(const uint8_t *data, const uint8_t *data_end,
|
||||
int size = bytestream_get_be16(&data);
|
||||
if (!size)
|
||||
break;
|
||||
if (data + size >= data_end || data + size < data)
|
||||
if (size < 0 || size >= data_end - data)
|
||||
return -1;
|
||||
data += size;
|
||||
if (size == namelen && !memcmp(data-size, name, namelen)) {
|
||||
@@ -397,7 +397,7 @@ int ff_amf_get_field_value(const uint8_t *data, const uint8_t *data_end,
|
||||
return 0;
|
||||
}
|
||||
len = ff_amf_tag_size(data, data_end);
|
||||
if (len < 0 || data + len >= data_end || data + len < data)
|
||||
if (len < 0 || len >= data_end - data)
|
||||
return -1;
|
||||
data += len;
|
||||
}
|
||||
@@ -427,7 +427,7 @@ static const char* rtmp_packet_type(int type)
|
||||
|
||||
static void ff_amf_tag_contents(void *ctx, const uint8_t *data, const uint8_t *data_end)
|
||||
{
|
||||
int size;
|
||||
unsigned int size;
|
||||
char buf[1024];
|
||||
|
||||
if (data >= data_end)
|
||||
@@ -446,7 +446,7 @@ static void ff_amf_tag_contents(void *ctx, const uint8_t *data, const uint8_t *d
|
||||
} else {
|
||||
size = bytestream_get_be32(&data);
|
||||
}
|
||||
size = FFMIN(size, 1023);
|
||||
size = FFMIN(size, sizeof(buf) - 1);
|
||||
memcpy(buf, data, size);
|
||||
buf[size] = 0;
|
||||
av_log(ctx, AV_LOG_DEBUG, " string '%s'\n", buf);
|
||||
@@ -459,22 +459,21 @@ static void ff_amf_tag_contents(void *ctx, const uint8_t *data, const uint8_t *d
|
||||
case AMF_DATA_TYPE_OBJECT:
|
||||
av_log(ctx, AV_LOG_DEBUG, " {\n");
|
||||
for (;;) {
|
||||
int size = bytestream_get_be16(&data);
|
||||
int t;
|
||||
memcpy(buf, data, size);
|
||||
buf[size] = 0;
|
||||
size = bytestream_get_be16(&data);
|
||||
av_strlcpy(buf, data, FFMIN(sizeof(buf), size + 1));
|
||||
if (!size) {
|
||||
av_log(ctx, AV_LOG_DEBUG, " }\n");
|
||||
data++;
|
||||
break;
|
||||
}
|
||||
if (data + size >= data_end || data + size < data)
|
||||
if (size >= data_end - data)
|
||||
return;
|
||||
data += size;
|
||||
av_log(ctx, AV_LOG_DEBUG, " %s: ", buf);
|
||||
ff_amf_tag_contents(ctx, data, data_end);
|
||||
t = ff_amf_tag_size(data, data_end);
|
||||
if (t < 0 || data + t >= data_end)
|
||||
if (t < 0 || t >= data_end - data)
|
||||
return;
|
||||
data += t;
|
||||
}
|
||||
|
@@ -31,14 +31,14 @@
|
||||
|
||||
static const uint8_t *avc_mp4_find_startcode(const uint8_t *start, const uint8_t *end, int nal_length_size)
|
||||
{
|
||||
int res = 0;
|
||||
unsigned int res = 0;
|
||||
|
||||
if (end - start < nal_length_size)
|
||||
return NULL;
|
||||
while (nal_length_size--)
|
||||
res = (res << 8) | *start++;
|
||||
|
||||
if (start + res > end || res < 0 || start + res < start)
|
||||
if (res > end - start)
|
||||
return NULL;
|
||||
|
||||
return start + res;
|
||||
|
@@ -413,6 +413,7 @@ static void get_attachment(AVFormatContext *s, AVIOContext *pb, int length)
|
||||
char description[1024];
|
||||
unsigned int filesize;
|
||||
AVStream *st;
|
||||
int ret;
|
||||
int64_t pos = avio_tell(pb);
|
||||
|
||||
avio_get_str16le(pb, INT_MAX, mime, sizeof(mime));
|
||||
@@ -429,13 +430,14 @@ static void get_attachment(AVFormatContext *s, AVIOContext *pb, int length)
|
||||
if (!st)
|
||||
goto done;
|
||||
av_dict_set(&st->metadata, "title", description, 0);
|
||||
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
|
||||
st->codec->codec_id = AV_CODEC_ID_MJPEG;
|
||||
st->codec->codec_type = AVMEDIA_TYPE_ATTACHMENT;
|
||||
st->codec->extradata = av_mallocz(filesize);
|
||||
if (!st->codec->extradata)
|
||||
ret = av_get_packet(pb, &st->attached_pic, filesize);
|
||||
if (ret < 0)
|
||||
goto done;
|
||||
st->codec->extradata_size = filesize;
|
||||
avio_read(pb, st->codec->extradata, filesize);
|
||||
st->attached_pic.stream_index = st->index;
|
||||
st->attached_pic.flags |= AV_PKT_FLAG_KEY;
|
||||
st->disposition |= AV_DISPOSITION_ATTACHED_PIC;
|
||||
done:
|
||||
avio_seek(pb, pos + length, SEEK_SET);
|
||||
}
|
||||
|
Reference in New Issue
Block a user