* commit '142e76f1055de5dde44696e71a5f63f2cb11dedf':
swscale: fix crash with dithering due incorrect offset calculation.
matroskadec: fix stupid typo (!= -> ==)
build: remove duplicates from order-only directory prerequisite list
build: rework rules for things in the tools dir
configure: fix --cpu=host with gcc 4.6
ARM: use const macro to define constant data in asm
bitdepth: simplify FUNC/FUNCC macros
dsputil: remove ff_emulated_edge_mc macro used in one place
9/10-bit: simplify clipping macros
matroskadec: reindent
matroskadec: defer parsing of cues element until we seek.
lavc: add support for codec-specific defaults.
lavc: make avcodec_alloc_context3 officially public.
lavc: remove a half-working attempt at different defaults for audio/video codecs.
ac3dec: add a drc_scale private option
lavf: add avformat_find_stream_info()
lavc: introduce avcodec_open2() as a replacement for avcodec_open().
Conflicts:
Makefile
libavcodec/utils.c
libavformat/avformat.h
libswscale/swscale_internal.h
Merged-by: Michael Niedermayer <michaelni@gmx.at>
| ... | ... |
@@ -18,6 +18,8 @@ PROGS_G = $(PROGS-yes:%=%_g$(EXESUF)) |
| 18 | 18 |
OBJS = $(PROGS-yes:%=%.o) cmdutils.o |
| 19 | 19 |
TESTTOOLS = audiogen videogen rotozoom tiny_psnr base64 |
| 20 | 20 |
HOSTPROGS := $(TESTTOOLS:%=tests/%) |
| 21 |
+TOOLS = qt-faststart trasher |
|
| 22 |
+TOOLS-$(CONFIG_ZLIB) += cws2fws |
|
| 21 | 23 |
|
| 22 | 24 |
BASENAMES = ffmpeg ffplay ffprobe ffserver |
| 23 | 25 |
ALLPROGS = $(BASENAMES:%=%$(EXESUF)) |
| ... | ... |
@@ -51,6 +53,11 @@ $(PROGS): %$(EXESUF): %_g$(EXESUF) |
| 51 | 51 |
$(CP) $< $@ |
| 52 | 52 |
$(STRIP) $@ |
| 53 | 53 |
|
| 54 |
+$(TOOLS): %$(EXESUF): %.o |
|
| 55 |
+ $(LD) $(LDFLAGS) -o $@ $< $(ELIBS) |
|
| 56 |
+ |
|
| 57 |
+tools/cws2fws$(EXESUF): ELIBS = -lz |
|
| 58 |
+ |
|
| 54 | 59 |
config.h: .config |
| 55 | 60 |
.config: $(wildcard $(FFLIBS:%=$(SRC_PATH)/lib%/all*.c)) |
| 56 | 61 |
@-tput bold 2>/dev/null |
| ... | ... |
@@ -59,7 +66,7 @@ config.h: .config |
| 59 | 59 |
|
| 60 | 60 |
SUBDIR_VARS := OBJS FFLIBS CLEANFILES DIRS TESTPROGS EXAMPLES SKIPHEADERS \ |
| 61 | 61 |
ALTIVEC-OBJS MMX-OBJS NEON-OBJS X86-OBJS YASM-OBJS-FFT YASM-OBJS \ |
| 62 |
- HOSTPROGS BUILT_HEADERS TESTOBJS ARCH_HEADERS ARMV6-OBJS |
|
| 62 |
+ HOSTPROGS BUILT_HEADERS TESTOBJS ARCH_HEADERS ARMV6-OBJS TOOLS |
|
| 63 | 63 |
|
| 64 | 64 |
define RESET |
| 65 | 65 |
$(1) := |
| ... | ... |
@@ -81,18 +88,6 @@ ffserver_g$(EXESUF): FF_LDFLAGS += $(FFSERVERLDFLAGS) |
| 81 | 81 |
%_g$(EXESUF): %.o cmdutils.o $(FF_DEP_LIBS) |
| 82 | 82 |
$(LD) $(FF_LDFLAGS) -o $@ $< cmdutils.o $(FF_EXTRALIBS) |
| 83 | 83 |
|
| 84 |
-TOOLS = cws2fws graph2dot lavfi-showfiltfmts pktdumper probetest qt-faststart trasher |
|
| 85 |
-TOOLOBJS := $(TOOLS:%=tools/%.o) |
|
| 86 |
-TOOLS := $(TOOLS:%=tools/%$(EXESUF)) |
|
| 87 |
- |
|
| 88 |
-alltools: $(TOOLS) |
|
| 89 |
- |
|
| 90 |
-tools/%$(EXESUF): tools/%.o |
|
| 91 |
- $(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS) |
|
| 92 |
- |
|
| 93 |
-$(TOOLOBJS): %.o: %.c | tools |
|
| 94 |
- $(CC) $(CPPFLAGS) $(CFLAGS) -c $(CC_O) $< |
|
| 95 |
- |
|
| 96 | 84 |
OBJDIRS += tools |
| 97 | 85 |
|
| 98 | 86 |
-include $(wildcard tools/*.d) |
| ... | ... |
@@ -63,7 +63,7 @@ void init_opts(void) |
| 63 | 63 |
{
|
| 64 | 64 |
int i; |
| 65 | 65 |
for (i = 0; i < AVMEDIA_TYPE_NB; i++) |
| 66 |
- avcodec_opts[i] = avcodec_alloc_context2(i); |
|
| 66 |
+ avcodec_opts[i] = avcodec_alloc_context3(NULL); |
|
| 67 | 67 |
avformat_opts = avformat_alloc_context(); |
| 68 | 68 |
#if CONFIG_SWSCALE |
| 69 | 69 |
sws_opts = sws_getContext(16, 16, 0, 16, 16, 0, SWS_BICUBIC, NULL, NULL, NULL); |
| ... | ... |
@@ -77,6 +77,9 @@ TESTOBJS := $(TESTOBJS:%=$(SUBDIR)%) $(TESTPROGS:%=$(SUBDIR)%-test.o) |
| 77 | 77 |
TESTPROGS := $(TESTPROGS:%=$(SUBDIR)%-test$(EXESUF)) |
| 78 | 78 |
HOSTOBJS := $(HOSTPROGS:%=$(SUBDIR)%.o) |
| 79 | 79 |
HOSTPROGS := $(HOSTPROGS:%=$(SUBDIR)%$(HOSTEXESUF)) |
| 80 |
+TOOLS += $(TOOLS-yes) |
|
| 81 |
+TOOLOBJS := $(TOOLS:%=tools/%.o) |
|
| 82 |
+TOOLS := $(TOOLS:%=tools/%$(EXESUF)) |
|
| 80 | 83 |
|
| 81 | 84 |
DEP_LIBS := $(foreach NAME,$(FFLIBS),lib$(NAME)/$($(CONFIG_SHARED:yes=S)LIBNAME)) |
| 82 | 85 |
|
| ... | ... |
@@ -85,15 +88,18 @@ SKIPHEADERS += $(ARCH_HEADERS:%=$(ARCH)/%) $(SKIPHEADERS-) |
| 85 | 85 |
SKIPHEADERS := $(SKIPHEADERS:%=$(SUBDIR)%) |
| 86 | 86 |
checkheaders: $(filter-out $(SKIPHEADERS:.h=.ho),$(ALLHEADERS:.h=.ho)) |
| 87 | 87 |
|
| 88 |
+alltools: $(TOOLS) |
|
| 89 |
+ |
|
| 88 | 90 |
$(HOSTOBJS): %.o: %.c |
| 89 | 91 |
$(HOSTCC) $(HOSTCFLAGS) -c -o $@ $< |
| 90 | 92 |
|
| 91 | 93 |
$(HOSTPROGS): %$(HOSTEXESUF): %.o |
| 92 | 94 |
$(HOSTCC) $(HOSTLDFLAGS) -o $@ $< $(HOSTLIBS) |
| 93 | 95 |
|
| 94 |
-$(OBJS): | $(dir $(OBJS)) |
|
| 95 |
-$(HOSTOBJS): | $(dir $(HOSTOBJS)) |
|
| 96 |
-$(TESTOBJS): | $(dir $(TESTOBJS)) |
|
| 96 |
+$(OBJS): | $(sort $(dir $(OBJS))) |
|
| 97 |
+$(HOSTOBJS): | $(sort $(dir $(HOSTOBJS))) |
|
| 98 |
+$(TESTOBJS): | $(sort $(dir $(TESTOBJS))) |
|
| 99 |
+$(TOOLOBJS): | tools |
|
| 97 | 100 |
|
| 98 | 101 |
OBJDIRS := $(OBJDIRS) $(dir $(OBJS) $(HOSTOBJS) $(TESTOBJS)) |
| 99 | 102 |
|
| ... | ... |
@@ -56,7 +56,7 @@ static void audio_encode_example(const char *filename) |
| 56 | 56 |
exit(1); |
| 57 | 57 |
} |
| 58 | 58 |
|
| 59 |
- c= avcodec_alloc_context(); |
|
| 59 |
+ c = avcodec_alloc_context3(codec); |
|
| 60 | 60 |
|
| 61 | 61 |
/* put sample parameters */ |
| 62 | 62 |
c->bit_rate = 64000; |
| ... | ... |
@@ -127,7 +127,7 @@ static void audio_decode_example(const char *outfilename, const char *filename) |
| 127 | 127 |
exit(1); |
| 128 | 128 |
} |
| 129 | 129 |
|
| 130 |
- c= avcodec_alloc_context(); |
|
| 130 |
+ c = avcodec_alloc_context3(codec); |
|
| 131 | 131 |
|
| 132 | 132 |
/* open it */ |
| 133 | 133 |
if (avcodec_open(c, codec) < 0) {
|
| ... | ... |
@@ -208,7 +208,7 @@ static void video_encode_example(const char *filename) |
| 208 | 208 |
exit(1); |
| 209 | 209 |
} |
| 210 | 210 |
|
| 211 |
- c= avcodec_alloc_context(); |
|
| 211 |
+ c = avcodec_alloc_context3(codec); |
|
| 212 | 212 |
picture= avcodec_alloc_frame(); |
| 213 | 213 |
|
| 214 | 214 |
/* put sample parameters */ |
| ... | ... |
@@ -335,7 +335,7 @@ static void video_decode_example(const char *outfilename, const char *filename) |
| 335 | 335 |
exit(1); |
| 336 | 336 |
} |
| 337 | 337 |
|
| 338 |
- c= avcodec_alloc_context(); |
|
| 338 |
+ c = avcodec_alloc_context3(codec); |
|
| 339 | 339 |
picture= avcodec_alloc_frame(); |
| 340 | 340 |
|
| 341 | 341 |
if(codec->capabilities&CODEC_CAP_TRUNCATED) |
| ... | ... |
@@ -294,7 +294,7 @@ static int open_input_file(AVFormatContext **fmt_ctx_ptr, const char *filename) |
| 294 | 294 |
if (!(codec = avcodec_find_decoder(stream->codec->codec_id))) {
|
| 295 | 295 |
fprintf(stderr, "Unsupported codec with id %d for input stream %d\n", |
| 296 | 296 |
stream->codec->codec_id, stream->index); |
| 297 |
- } else if (avcodec_open(stream->codec, codec) < 0) {
|
|
| 297 |
+ } else if (avcodec_open2(stream->codec, codec, NULL) < 0) {
|
|
| 298 | 298 |
fprintf(stderr, "Error while opening codec for input stream %d\n", |
| 299 | 299 |
stream->index); |
| 300 | 300 |
} |
| ... | ... |
@@ -2117,7 +2117,7 @@ static void open_parser(AVFormatContext *s, int i) |
| 2117 | 2117 |
codec = avcodec_find_decoder(st->codec->codec_id); |
| 2118 | 2118 |
if (codec && (codec->capabilities & CODEC_CAP_PARSE_ONLY)) {
|
| 2119 | 2119 |
st->codec->parse_only = 1; |
| 2120 |
- if (avcodec_open(st->codec, codec) < 0) |
|
| 2120 |
+ if (avcodec_open2(st->codec, codec, NULL) < 0) |
|
| 2121 | 2121 |
st->codec->parse_only = 0; |
| 2122 | 2122 |
} |
| 2123 | 2123 |
} |
| ... | ... |
@@ -3468,7 +3468,7 @@ static AVStream *add_av_stream1(FFStream *stream, AVCodecContext *codec, int cop |
| 3468 | 3468 |
if (!fst) |
| 3469 | 3469 |
return NULL; |
| 3470 | 3470 |
if (copy) {
|
| 3471 |
- fst->codec= avcodec_alloc_context(); |
|
| 3471 |
+ fst->codec = avcodec_alloc_context3(NULL); |
|
| 3472 | 3472 |
memcpy(fst->codec, codec, sizeof(AVCodecContext)); |
| 3473 | 3473 |
if (codec->extradata_size) {
|
| 3474 | 3474 |
fst->codec->extradata = av_malloc(codec->extradata_size); |
| ... | ... |
@@ -3885,7 +3885,7 @@ static void add_codec(FFStream *stream, AVCodecContext *av) |
| 3885 | 3885 |
st = av_mallocz(sizeof(AVStream)); |
| 3886 | 3886 |
if (!st) |
| 3887 | 3887 |
return; |
| 3888 |
- st->codec = avcodec_alloc_context(); |
|
| 3888 |
+ st->codec = avcodec_alloc_context3(NULL); |
|
| 3889 | 3889 |
stream->streams[stream->nb_streams++] = st; |
| 3890 | 3890 |
memcpy(st->codec, av, sizeof(AVCodecContext)); |
| 3891 | 3891 |
} |
| ... | ... |
@@ -30,6 +30,7 @@ |
| 30 | 30 |
#include <string.h> |
| 31 | 31 |
|
| 32 | 32 |
#include "libavutil/crc.h" |
| 33 |
+#include "libavutil/opt.h" |
|
| 33 | 34 |
#include "internal.h" |
| 34 | 35 |
#include "aac_ac3_parser.h" |
| 35 | 36 |
#include "ac3_parser.h" |
| ... | ... |
@@ -1438,6 +1439,20 @@ static av_cold int ac3_decode_end(AVCodecContext *avctx) |
| 1438 | 1438 |
return 0; |
| 1439 | 1439 |
} |
| 1440 | 1440 |
|
| 1441 |
+#define OFFSET(x) offsetof(AC3DecodeContext, x) |
|
| 1442 |
+#define PAR (AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM) |
|
| 1443 |
+static const AVOption options[] = {
|
|
| 1444 |
+ { "drc_scale", "percentage of dynamic range compression to apply", OFFSET(drc_scale), FF_OPT_TYPE_FLOAT, {1.0}, 0.0, 1.0, PAR },
|
|
| 1445 |
+ { NULL},
|
|
| 1446 |
+}; |
|
| 1447 |
+ |
|
| 1448 |
+static const AVClass ac3_decoder_class = {
|
|
| 1449 |
+ .class_name = "(E-)AC3 decoder", |
|
| 1450 |
+ .item_name = av_default_item_name, |
|
| 1451 |
+ .option = options, |
|
| 1452 |
+ .version = LIBAVUTIL_VERSION_INT, |
|
| 1453 |
+}; |
|
| 1454 |
+ |
|
| 1441 | 1455 |
AVCodec ff_ac3_decoder = {
|
| 1442 | 1456 |
.name = "ac3", |
| 1443 | 1457 |
.type = AVMEDIA_TYPE_AUDIO, |
| ... | ... |
@@ -1450,6 +1465,7 @@ AVCodec ff_ac3_decoder = {
|
| 1450 | 1450 |
.sample_fmts = (const enum AVSampleFormat[]) {
|
| 1451 | 1451 |
AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE |
| 1452 | 1452 |
}, |
| 1453 |
+ .priv_class = &ac3_decoder_class, |
|
| 1453 | 1454 |
}; |
| 1454 | 1455 |
|
| 1455 | 1456 |
#if CONFIG_EAC3_DECODER |
| ... | ... |
@@ -1465,5 +1481,6 @@ AVCodec ff_eac3_decoder = {
|
| 1465 | 1465 |
.sample_fmts = (const enum AVSampleFormat[]) {
|
| 1466 | 1466 |
AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE |
| 1467 | 1467 |
}, |
| 1468 |
+ .priv_class = &ac3_decoder_class, |
|
| 1468 | 1469 |
}; |
| 1469 | 1470 |
#endif |
| ... | ... |
@@ -66,6 +66,7 @@ |
| 66 | 66 |
#define AC3_FRAME_BUFFER_SIZE 32768 |
| 67 | 67 |
|
| 68 | 68 |
typedef struct {
|
| 69 |
+ AVClass *class; ///< class for AVOptions |
|
| 69 | 70 |
AVCodecContext *avctx; ///< parent context |
| 70 | 71 |
GetBitContext gbc; ///< bitstream reader |
| 71 | 72 |
|
| ... | ... |
@@ -143,6 +144,7 @@ typedef struct {
|
| 143 | 143 |
|
| 144 | 144 |
///@name Dynamic range |
| 145 | 145 |
float dynamic_range[2]; ///< dynamic range |
| 146 |
+ float drc_scale; ///< percentage of dynamic range compression to be applied |
|
| 146 | 147 |
///@} |
| 147 | 148 |
|
| 148 | 149 |
///@name Bandwidth |
| ... | ... |
@@ -349,9 +349,7 @@ function ff_fft_permute_neon, export=1 |
| 349 | 349 |
pop {r4,pc}
|
| 350 | 350 |
endfunc |
| 351 | 351 |
|
| 352 |
- .section .rodata |
|
| 353 |
- .align 4 |
|
| 354 |
-fft_tab_neon: |
|
| 352 |
+const fft_tab_neon |
|
| 355 | 353 |
.word fft4_neon |
| 356 | 354 |
.word fft8_neon |
| 357 | 355 |
.word fft16_neon |
| ... | ... |
@@ -367,8 +365,12 @@ fft_tab_neon: |
| 367 | 367 |
.word fft16384_neon |
| 368 | 368 |
.word fft32768_neon |
| 369 | 369 |
.word fft65536_neon |
| 370 |
-ELF .size fft_tab_neon, . - fft_tab_neon |
|
| 370 |
+endconst |
|
| 371 | 371 |
|
| 372 |
- .align 4 |
|
| 373 |
-pmmp: .float +1.0, -1.0, -1.0, +1.0 |
|
| 374 |
-mppm: .float -M_SQRT1_2, M_SQRT1_2, M_SQRT1_2, -M_SQRT1_2 |
|
| 372 |
+const pmmp, align=4 |
|
| 373 |
+ .float +1.0, -1.0, -1.0, +1.0 |
|
| 374 |
+endconst |
|
| 375 |
+ |
|
| 376 |
+const mppm, align=4 |
|
| 377 |
+ .float -M_SQRT1_2, M_SQRT1_2, M_SQRT1_2, -M_SQRT1_2 |
|
| 378 |
+endconst |
| ... | ... |
@@ -383,8 +383,8 @@ function ff_h264_idct8_add4_neon, export=1 |
| 383 | 383 |
pop {r4-r8,pc}
|
| 384 | 384 |
endfunc |
| 385 | 385 |
|
| 386 |
- .section .rodata |
|
| 387 |
-scan8: .byte 4+ 1*8, 5+ 1*8, 4+ 2*8, 5+ 2*8 |
|
| 386 |
+const scan8 |
|
| 387 |
+ .byte 4+ 1*8, 5+ 1*8, 4+ 2*8, 5+ 2*8 |
|
| 388 | 388 |
.byte 6+ 1*8, 7+ 1*8, 6+ 2*8, 7+ 2*8 |
| 389 | 389 |
.byte 4+ 3*8, 5+ 3*8, 4+ 4*8, 5+ 4*8 |
| 390 | 390 |
.byte 6+ 3*8, 7+ 3*8, 6+ 4*8, 7+ 4*8 |
| ... | ... |
@@ -396,3 +396,4 @@ scan8: .byte 4+ 1*8, 5+ 1*8, 4+ 2*8, 5+ 2*8 |
| 396 | 396 |
.byte 6+11*8, 7+11*8, 6+12*8, 7+12*8 |
| 397 | 397 |
.byte 4+13*8, 5+13*8, 4+14*8, 5+14*8 |
| 398 | 398 |
.byte 6+13*8, 7+13*8, 6+14*8, 7+14*8 |
| 399 |
+endconst |
| ... | ... |
@@ -166,12 +166,9 @@ function ff_pred16x16_plane_neon, export=1 |
| 166 | 166 |
bx lr |
| 167 | 167 |
endfunc |
| 168 | 168 |
|
| 169 |
- .section .rodata |
|
| 170 |
- .align 4 |
|
| 171 |
-p16weight: |
|
| 169 |
+const p16weight, align=4 |
|
| 172 | 170 |
.short 1,2,3,4,5,6,7,8 |
| 173 |
- |
|
| 174 |
- .text |
|
| 171 |
+endconst |
|
| 175 | 172 |
|
| 176 | 173 |
function ff_pred8x8_hor_neon, export=1 |
| 177 | 174 |
sub r2, r0, #1 |
| ... | ... |
@@ -243,10 +243,9 @@ function idct_col4_st8_neon |
| 243 | 243 |
bx lr |
| 244 | 244 |
endfunc |
| 245 | 245 |
|
| 246 |
- .section .rodata |
|
| 247 |
- .align 4 |
|
| 248 |
-idct_coeff_neon: |
|
| 246 |
+const idct_coeff_neon, align=4 |
|
| 249 | 247 |
.short W1, W2, W3, W4, W5, W6, W7, W4c |
| 248 |
+endconst |
|
| 250 | 249 |
|
| 251 | 250 |
.macro idct_start data |
| 252 | 251 |
push {r4-r7, lr}
|
| ... | ... |
@@ -20,11 +20,9 @@ |
| 20 | 20 |
|
| 21 | 21 |
#include "asm.S" |
| 22 | 22 |
|
| 23 |
-.section .rodata |
|
| 24 |
-.align 4 |
|
| 25 |
- |
|
| 26 |
-vp3_idct_constants: |
|
| 23 |
+const vp3_idct_constants, align=4 |
|
| 27 | 24 |
.short 64277, 60547, 54491, 46341, 36410, 25080, 12785 |
| 25 |
+endconst |
|
| 28 | 26 |
|
| 29 | 27 |
#define xC1S7 d0[0] |
| 30 | 28 |
#define xC2S6 d0[1] |
| ... | ... |
@@ -34,8 +32,6 @@ vp3_idct_constants: |
| 34 | 34 |
#define xC6S2 d1[1] |
| 35 | 35 |
#define xC7S1 d1[2] |
| 36 | 36 |
|
| 37 |
-.text |
|
| 38 |
- |
|
| 39 | 37 |
.macro vp3_loop_filter |
| 40 | 38 |
vsubl.u8 q3, d18, d17 |
| 41 | 39 |
vsubl.u8 q2, d16, d19 |
| ... | ... |
@@ -30,6 +30,7 @@ |
| 30 | 30 |
#include "libavutil/samplefmt.h" |
| 31 | 31 |
#include "libavutil/avutil.h" |
| 32 | 32 |
#include "libavutil/cpu.h" |
| 33 |
+#include "libavutil/dict.h" |
|
| 33 | 34 |
#include "libavutil/log.h" |
| 34 | 35 |
#include "libavutil/pixfmt.h" |
| 35 | 36 |
#include "libavutil/rational.h" |
| ... | ... |
@@ -2590,13 +2591,16 @@ typedef struct AVCodecContext {
|
| 2590 | 2590 |
int request_channels; |
| 2591 | 2591 |
#endif |
| 2592 | 2592 |
|
| 2593 |
+#if FF_API_DRC_SCALE |
|
| 2593 | 2594 |
/** |
| 2594 | 2595 |
* Percentage of dynamic range compression to be applied by the decoder. |
| 2595 | 2596 |
* The default value is 1.0, corresponding to full compression. |
| 2596 | 2597 |
* - encoding: unused |
| 2597 | 2598 |
* - decoding: Set by user. |
| 2599 |
+ * @deprecated use AC3 decoder private option instead. |
|
| 2598 | 2600 |
*/ |
| 2599 |
- float drc_scale; |
|
| 2601 |
+ attribute_deprecated float drc_scale; |
|
| 2602 |
+#endif |
|
| 2600 | 2603 |
|
| 2601 | 2604 |
/** |
| 2602 | 2605 |
* opaque 64bit number (generally a PTS) that will be reordered and |
| ... | ... |
@@ -2916,6 +2920,8 @@ typedef struct AVProfile {
|
| 2916 | 2916 |
const char *name; ///< short name for the profile |
| 2917 | 2917 |
} AVProfile; |
| 2918 | 2918 |
|
| 2919 |
+typedef struct AVCodecDefault AVCodecDefault; |
|
| 2920 |
+ |
|
| 2919 | 2921 |
/** |
| 2920 | 2922 |
* AVCodec. |
| 2921 | 2923 |
*/ |
| ... | ... |
@@ -2978,6 +2984,11 @@ typedef struct AVCodec {
|
| 2978 | 2978 |
*/ |
| 2979 | 2979 |
int (*update_thread_context)(AVCodecContext *dst, const AVCodecContext *src); |
| 2980 | 2980 |
/** @} */ |
| 2981 |
+ |
|
| 2982 |
+ /** |
|
| 2983 |
+ * Private codec-specific defaults. |
|
| 2984 |
+ */ |
|
| 2985 |
+ const AVCodecDefault *defaults; |
|
| 2981 | 2986 |
} AVCodec; |
| 2982 | 2987 |
|
| 2983 | 2988 |
/** |
| ... | ... |
@@ -3593,21 +3604,38 @@ void avcodec_get_context_defaults2(AVCodecContext *s, enum AVMediaType); |
| 3593 | 3593 |
* we WILL change its arguments and name a few times! */ |
| 3594 | 3594 |
int avcodec_get_context_defaults3(AVCodecContext *s, AVCodec *codec); |
| 3595 | 3595 |
|
| 3596 |
+#if FF_API_ALLOC_CONTEXT |
|
| 3596 | 3597 |
/** |
| 3597 | 3598 |
* Allocate an AVCodecContext and set its fields to default values. The |
| 3598 | 3599 |
* resulting struct can be deallocated by simply calling av_free(). |
| 3599 | 3600 |
* |
| 3600 | 3601 |
* @return An AVCodecContext filled with default values or NULL on failure. |
| 3601 | 3602 |
* @see avcodec_get_context_defaults |
| 3603 |
+ * |
|
| 3604 |
+ * @deprecated use avcodec_alloc_context3() |
|
| 3602 | 3605 |
*/ |
| 3606 |
+attribute_deprecated |
|
| 3603 | 3607 |
AVCodecContext *avcodec_alloc_context(void); |
| 3604 | 3608 |
|
| 3605 | 3609 |
/** THIS FUNCTION IS NOT YET PART OF THE PUBLIC API! |
| 3606 | 3610 |
* we WILL change its arguments and name a few times! */ |
| 3611 |
+attribute_deprecated |
|
| 3607 | 3612 |
AVCodecContext *avcodec_alloc_context2(enum AVMediaType); |
| 3613 |
+#endif |
|
| 3608 | 3614 |
|
| 3609 |
-/** THIS FUNCTION IS NOT YET PART OF THE PUBLIC API! |
|
| 3610 |
- * we WILL change its arguments and name a few times! */ |
|
| 3615 |
+/** |
|
| 3616 |
+ * Allocate an AVCodecContext and set its fields to default values. The |
|
| 3617 |
+ * resulting struct can be deallocated by simply calling av_free(). |
|
| 3618 |
+ * |
|
| 3619 |
+ * @param codec if non-NULL, allocate private data and initialize defaults |
|
| 3620 |
+ * for the given codec. It is illegal to then call avcodec_open() |
|
| 3621 |
+ * with a different codec. |
|
| 3622 |
+ * |
|
| 3623 |
+ * @return An AVCodecContext filled with default values or NULL on failure. |
|
| 3624 |
+ * @see avcodec_get_context_defaults |
|
| 3625 |
+ * |
|
| 3626 |
+ * @deprecated use avcodec_alloc_context3() |
|
| 3627 |
+ */ |
|
| 3611 | 3628 |
AVCodecContext *avcodec_alloc_context3(AVCodec *codec); |
| 3612 | 3629 |
|
| 3613 | 3630 |
/** |
| ... | ... |
@@ -3617,7 +3645,7 @@ AVCodecContext *avcodec_alloc_context3(AVCodec *codec); |
| 3617 | 3617 |
* can use this AVCodecContext to decode/encode video/audio data. |
| 3618 | 3618 |
* |
| 3619 | 3619 |
* @param dest target codec context, should be initialized with |
| 3620 |
- * avcodec_alloc_context(), but otherwise uninitialized |
|
| 3620 |
+ * avcodec_alloc_context3(), but otherwise uninitialized |
|
| 3621 | 3621 |
* @param src source codec context |
| 3622 | 3622 |
* @return AVERROR() on error (e.g. memory allocation error), 0 on success |
| 3623 | 3623 |
*/ |
| ... | ... |
@@ -3687,6 +3715,7 @@ int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, v |
| 3687 | 3687 |
int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2, int, int),void *arg, int *ret, int count); |
| 3688 | 3688 |
//FIXME func typedef |
| 3689 | 3689 |
|
| 3690 |
+#if FF_API_AVCODEC_OPEN |
|
| 3690 | 3691 |
/** |
| 3691 | 3692 |
* Initialize the AVCodecContext to use the given AVCodec. Prior to using this |
| 3692 | 3693 |
* function the context has to be allocated. |
| ... | ... |
@@ -3703,7 +3732,7 @@ int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, |
| 3703 | 3703 |
* if (!codec) |
| 3704 | 3704 |
* exit(1); |
| 3705 | 3705 |
* |
| 3706 |
- * context = avcodec_alloc_context(); |
|
| 3706 |
+ * context = avcodec_alloc_context3(codec); |
|
| 3707 | 3707 |
* |
| 3708 | 3708 |
* if (avcodec_open(context, codec) < 0) |
| 3709 | 3709 |
* exit(1); |
| ... | ... |
@@ -3712,9 +3741,46 @@ int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, |
| 3712 | 3712 |
* @param avctx The context which will be set up to use the given codec. |
| 3713 | 3713 |
* @param codec The codec to use within the context. |
| 3714 | 3714 |
* @return zero on success, a negative value on error |
| 3715 |
- * @see avcodec_alloc_context, avcodec_find_decoder, avcodec_find_encoder, avcodec_close |
|
| 3715 |
+ * @see avcodec_alloc_context3, avcodec_find_decoder, avcodec_find_encoder, avcodec_close |
|
| 3716 |
+ * |
|
| 3717 |
+ * @deprecated use avcodec_open2 |
|
| 3716 | 3718 |
*/ |
| 3719 |
+attribute_deprecated |
|
| 3717 | 3720 |
int avcodec_open(AVCodecContext *avctx, AVCodec *codec); |
| 3721 |
+#endif |
|
| 3722 |
+ |
|
| 3723 |
+/** |
|
| 3724 |
+ * Initialize the AVCodecContext to use the given AVCodec. Prior to using this |
|
| 3725 |
+ * function the context has to be allocated with avcodec_alloc_context(). |
|
| 3726 |
+ * |
|
| 3727 |
+ * The functions avcodec_find_decoder_by_name(), avcodec_find_encoder_by_name(), |
|
| 3728 |
+ * avcodec_find_decoder() and avcodec_find_encoder() provide an easy way for |
|
| 3729 |
+ * retrieving a codec. |
|
| 3730 |
+ * |
|
| 3731 |
+ * @warning This function is not thread safe! |
|
| 3732 |
+ * |
|
| 3733 |
+ * @code |
|
| 3734 |
+ * avcodec_register_all(); |
|
| 3735 |
+ * av_dict_set(&opts, "b", "2.5M", 0); |
|
| 3736 |
+ * codec = avcodec_find_decoder(CODEC_ID_H264); |
|
| 3737 |
+ * if (!codec) |
|
| 3738 |
+ * exit(1); |
|
| 3739 |
+ * |
|
| 3740 |
+ * context = avcodec_alloc_context(); |
|
| 3741 |
+ * |
|
| 3742 |
+ * if (avcodec_open(context, codec, opts) < 0) |
|
| 3743 |
+ * exit(1); |
|
| 3744 |
+ * @endcode |
|
| 3745 |
+ * |
|
| 3746 |
+ * @param avctx The context to initialize. |
|
| 3747 |
+ * @param options A dictionary filled with AVCodecContext and codec-private options. |
|
| 3748 |
+ * On return this object will be filled with options that were not found. |
|
| 3749 |
+ * |
|
| 3750 |
+ * @return zero on success, a negative value on error |
|
| 3751 |
+ * @see avcodec_alloc_context3(), avcodec_find_decoder(), avcodec_find_encoder(), |
|
| 3752 |
+ * av_dict_set(), av_opt_find(). |
|
| 3753 |
+ */ |
|
| 3754 |
+int avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVDictionary **options); |
|
| 3718 | 3755 |
|
| 3719 | 3756 |
/** |
| 3720 | 3757 |
* Decode the audio frame of size avpkt->size from avpkt->data into samples. |
| ... | ... |
@@ -43,15 +43,6 @@ |
| 43 | 43 |
# undef PIXEL_SPLAT_X4 |
| 44 | 44 |
#else |
| 45 | 45 |
# define AVCODEC_H264_HIGH_DEPTH_H |
| 46 |
-# define CLIP_PIXEL(depth)\ |
|
| 47 |
- static inline uint16_t av_clip_pixel_ ## depth (int p)\ |
|
| 48 |
- {\
|
|
| 49 |
- const int pixel_max = (1 << depth)-1;\ |
|
| 50 |
- return (p & ~pixel_max) ? (-p)>>31 & pixel_max : p;\ |
|
| 51 |
- } |
|
| 52 |
- |
|
| 53 |
-CLIP_PIXEL( 9) |
|
| 54 |
-CLIP_PIXEL(10) |
|
| 55 | 46 |
#endif |
| 56 | 47 |
|
| 57 | 48 |
#if BIT_DEPTH > 8 |
| ... | ... |
@@ -70,6 +61,9 @@ CLIP_PIXEL(10) |
| 70 | 70 |
# define AV_WN4P AV_WN64 |
| 71 | 71 |
# define AV_WN4PA AV_WN64A |
| 72 | 72 |
# define PIXEL_SPLAT_X4(x) ((x)*0x0001000100010001ULL) |
| 73 |
+ |
|
| 74 |
+# define av_clip_pixel(a) av_clip_uintp2(a, BIT_DEPTH) |
|
| 75 |
+# define CLIP(a) av_clip_uintp2(a, BIT_DEPTH) |
|
| 73 | 76 |
#else |
| 74 | 77 |
# define pixel uint8_t |
| 75 | 78 |
# define pixel2 uint16_t |
| ... | ... |
@@ -86,21 +80,12 @@ CLIP_PIXEL(10) |
| 86 | 86 |
# define AV_WN4P AV_WN32 |
| 87 | 87 |
# define AV_WN4PA AV_WN32A |
| 88 | 88 |
# define PIXEL_SPLAT_X4(x) ((x)*0x01010101U) |
| 89 |
-#endif |
|
| 90 | 89 |
|
| 91 |
-#if BIT_DEPTH == 8 |
|
| 92 | 90 |
# define av_clip_pixel(a) av_clip_uint8(a) |
| 93 | 91 |
# define CLIP(a) cm[a] |
| 94 |
-# define FUNC(a) a ## _8 |
|
| 95 |
-# define FUNCC(a) a ## _8_c |
|
| 96 |
-#elif BIT_DEPTH == 9 |
|
| 97 |
-# define av_clip_pixel(a) av_clip_pixel_9(a) |
|
| 98 |
-# define CLIP(a) av_clip_pixel_9(a) |
|
| 99 |
-# define FUNC(a) a ## _9 |
|
| 100 |
-# define FUNCC(a) a ## _9_c |
|
| 101 |
-#elif BIT_DEPTH == 10 |
|
| 102 |
-# define av_clip_pixel(a) av_clip_pixel_10(a) |
|
| 103 |
-# define CLIP(a) av_clip_pixel_10(a) |
|
| 104 |
-# define FUNC(a) a ## _10 |
|
| 105 |
-# define FUNCC(a) a ## _10_c |
|
| 106 | 92 |
#endif |
| 93 |
+ |
|
| 94 |
+#define FUNC3(a, b, c) a ## _ ## b ## c |
|
| 95 |
+#define FUNC2(a, b, c) FUNC3(a, b, c) |
|
| 96 |
+#define FUNC(a) FUNC2(a, BIT_DEPTH,) |
|
| 97 |
+#define FUNCC(a) FUNC2(a, BIT_DEPTH, _c) |
| ... | ... |
@@ -211,8 +211,6 @@ EMULATED_EDGE(8) |
| 211 | 211 |
EMULATED_EDGE(9) |
| 212 | 212 |
EMULATED_EDGE(10) |
| 213 | 213 |
|
| 214 |
-#define ff_emulated_edge_mc ff_emulated_edge_mc_8 |
|
| 215 |
- |
|
| 216 | 214 |
void ff_add_pixels_clamped_c(const DCTELEM *block, uint8_t *dest, int linesize); |
| 217 | 215 |
void ff_put_pixels_clamped_c(const DCTELEM *block, uint8_t *dest, int linesize); |
| 218 | 216 |
void ff_put_signed_pixels_clamped_c(const DCTELEM *block, uint8_t *dest, int linesize); |
| ... | ... |
@@ -144,7 +144,7 @@ int main(int argc, char **argv) |
| 144 | 144 |
|
| 145 | 145 |
printf("ffmpeg motion test\n");
|
| 146 | 146 |
|
| 147 |
- ctx = avcodec_alloc_context(); |
|
| 147 |
+ ctx = avcodec_alloc_context3(NULL); |
|
| 148 | 148 |
ctx->dsp_mask = AV_CPU_FLAG_FORCE; |
| 149 | 149 |
dsputil_init(&cctx, ctx); |
| 150 | 150 |
for (c = 0; c < flags_size; c++) {
|
| ... | ... |
@@ -944,7 +944,7 @@ static int skip_check(MpegEncContext *s, Picture *p, Picture *ref){
|
| 944 | 944 |
|
| 945 | 945 |
static int estimate_best_b_count(MpegEncContext *s){
|
| 946 | 946 |
AVCodec *codec= avcodec_find_encoder(s->avctx->codec_id); |
| 947 |
- AVCodecContext *c= avcodec_alloc_context(); |
|
| 947 |
+ AVCodecContext *c = avcodec_alloc_context3(NULL); |
|
| 948 | 948 |
AVFrame input[FF_MAX_B_FRAMES+2]; |
| 949 | 949 |
const int scale= s->avctx->brd_scale; |
| 950 | 950 |
int i, j, out_size, p_lambda, b_lambda, lambda2; |
| ... | ... |
@@ -973,7 +973,7 @@ static int estimate_best_b_count(MpegEncContext *s){
|
| 973 | 973 |
c->time_base= s->avctx->time_base; |
| 974 | 974 |
c->max_b_frames= s->max_b_frames; |
| 975 | 975 |
|
| 976 |
- if (avcodec_open(c, codec) < 0) |
|
| 976 |
+ if (avcodec_open2(c, codec, NULL) < 0) |
|
| 977 | 977 |
return -1; |
| 978 | 978 |
|
| 979 | 979 |
for(i=0; i<s->max_b_frames+2; i++){
|
| ... | ... |
@@ -25,6 +25,8 @@ |
| 25 | 25 |
*/ |
| 26 | 26 |
|
| 27 | 27 |
#include "avcodec.h" |
| 28 |
+#include "internal.h" |
|
| 29 |
+#include "libavutil/avassert.h" |
|
| 28 | 30 |
#include "libavutil/opt.h" |
| 29 | 31 |
#include <float.h> /* FLT_MIN, FLT_MAX */ |
| 30 | 32 |
|
| ... | ... |
@@ -69,7 +71,7 @@ static const AVOption *opt_find(void *obj, const char *name, const char *unit, i |
| 69 | 69 |
|
| 70 | 70 |
static const AVOption options[]={
|
| 71 | 71 |
{"b", "set bitrate (in bits/s)", OFFSET(bit_rate), FF_OPT_TYPE_INT, {.dbl = AV_CODEC_DEFAULT_BITRATE }, INT_MIN, INT_MAX, V|E},
|
| 72 |
-{"ab", "set bitrate (in bits/s)", OFFSET(bit_rate), FF_OPT_TYPE_INT, {.dbl = 64*1000 }, INT_MIN, INT_MAX, A|E},
|
|
| 72 |
+{"ab", "set bitrate (in bits/s)", OFFSET(bit_rate), FF_OPT_TYPE_INT, {.dbl = AV_CODEC_DEFAULT_BITRATE }, INT_MIN, INT_MAX, A|E},
|
|
| 73 | 73 |
{"bt", "set video bitrate tolerance (in bits/s)", OFFSET(bit_rate_tolerance), FF_OPT_TYPE_INT, {.dbl = AV_CODEC_DEFAULT_BITRATE*20 }, 1, INT_MAX, V|E},
|
| 74 | 74 |
{"flags", NULL, OFFSET(flags), FF_OPT_TYPE_FLAGS, {.dbl = DEFAULT }, 0, UINT_MAX, V|A|E|D, "flags"},
|
| 75 | 75 |
{"mv4", "use four motion vector by macroblock (mpeg4)", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG_4MV }, INT_MIN, INT_MAX, V|E, "flags"},
|
| ... | ... |
@@ -413,7 +415,9 @@ static const AVOption options[]={
|
| 413 | 413 |
#if FF_API_REQUEST_CHANNELS |
| 414 | 414 |
{"request_channels", "set desired number of audio channels", OFFSET(request_channels), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, 0, INT_MAX, A|D},
|
| 415 | 415 |
#endif |
| 416 |
+#if FF_API_DRC_SCALE |
|
| 416 | 417 |
{"drc_scale", "percentage of dynamic range compression to apply", OFFSET(drc_scale), FF_OPT_TYPE_FLOAT, {.dbl = 1.0 }, 0.0, 1.0, A|D},
|
| 418 |
+#endif |
|
| 417 | 419 |
{"reservoir", "use bit reservoir", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_BIT_RESERVOIR }, INT_MIN, INT_MAX, A|E, "flags2"},
|
| 418 | 420 |
{"mbtree", "use macroblock tree ratecontrol (x264 only)", 0, FF_OPT_TYPE_CONST, {.dbl = CODEC_FLAG2_MBTREE }, INT_MIN, INT_MAX, V|E, "flags2"},
|
| 419 | 421 |
{"bits_per_raw_sample", NULL, OFFSET(bits_per_raw_sample), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX},
|
| ... | ... |
@@ -522,6 +526,15 @@ int avcodec_get_context_defaults3(AVCodecContext *s, AVCodec *codec){
|
| 522 | 522 |
av_opt_set_defaults(s->priv_data); |
| 523 | 523 |
} |
| 524 | 524 |
} |
| 525 |
+ if (codec && codec->defaults) {
|
|
| 526 |
+ int ret; |
|
| 527 |
+ AVCodecDefault *d = codec->defaults; |
|
| 528 |
+ while (d->key) {
|
|
| 529 |
+ ret = av_set_string3(s, d->key, d->value, 0, NULL); |
|
| 530 |
+ av_assert0(ret >= 0); |
|
| 531 |
+ d++; |
|
| 532 |
+ } |
|
| 533 |
+ } |
|
| 525 | 534 |
return 0; |
| 526 | 535 |
} |
| 527 | 536 |
|
| ... | ... |
@@ -538,6 +551,7 @@ AVCodecContext *avcodec_alloc_context3(AVCodec *codec){
|
| 538 | 538 |
return avctx; |
| 539 | 539 |
} |
| 540 | 540 |
|
| 541 |
+#if FF_API_ALLOC_CONTEXT |
|
| 541 | 542 |
AVCodecContext *avcodec_alloc_context2(enum AVMediaType codec_type){
|
| 542 | 543 |
AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext)); |
| 543 | 544 |
|
| ... | ... |
@@ -547,14 +561,17 @@ AVCodecContext *avcodec_alloc_context2(enum AVMediaType codec_type){
|
| 547 | 547 |
|
| 548 | 548 |
return avctx; |
| 549 | 549 |
} |
| 550 |
+#endif |
|
| 550 | 551 |
|
| 551 | 552 |
void avcodec_get_context_defaults(AVCodecContext *s){
|
| 552 | 553 |
avcodec_get_context_defaults2(s, AVMEDIA_TYPE_UNKNOWN); |
| 553 | 554 |
} |
| 554 | 555 |
|
| 556 |
+#if FF_API_ALLOC_CONTEXT |
|
| 555 | 557 |
AVCodecContext *avcodec_alloc_context(void){
|
| 556 | 558 |
return avcodec_alloc_context2(AVMEDIA_TYPE_UNKNOWN); |
| 557 | 559 |
} |
| 560 |
+#endif |
|
| 558 | 561 |
|
| 559 | 562 |
int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src) |
| 560 | 563 |
{
|
| ... | ... |
@@ -32,6 +32,7 @@ |
| 32 | 32 |
#include "libavutil/audioconvert.h" |
| 33 | 33 |
#include "libavutil/imgutils.h" |
| 34 | 34 |
#include "libavutil/samplefmt.h" |
| 35 |
+#include "libavutil/dict.h" |
|
| 35 | 36 |
#include "avcodec.h" |
| 36 | 37 |
#include "dsputil.h" |
| 37 | 38 |
#include "libavutil/opt.h" |
| ... | ... |
@@ -485,9 +486,20 @@ static void avcodec_get_subtitle_defaults(AVSubtitle *sub) |
| 485 | 485 |
sub->pts = AV_NOPTS_VALUE; |
| 486 | 486 |
} |
| 487 | 487 |
|
| 488 |
+#if FF_API_AVCODEC_OPEN |
|
| 488 | 489 |
int attribute_align_arg avcodec_open(AVCodecContext *avctx, AVCodec *codec) |
| 489 | 490 |
{
|
| 491 |
+ return avcodec_open2(avctx, codec, NULL); |
|
| 492 |
+} |
|
| 493 |
+#endif |
|
| 494 |
+ |
|
| 495 |
+int attribute_align_arg avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVDictionary **options) |
|
| 496 |
+{
|
|
| 490 | 497 |
int ret = 0; |
| 498 |
+ AVDictionary *tmp = NULL; |
|
| 499 |
+ |
|
| 500 |
+ if (options) |
|
| 501 |
+ av_dict_copy(&tmp, *options, 0); |
|
| 491 | 502 |
|
| 492 | 503 |
/* If there is a user-supplied mutex locking routine, call it. */ |
| 493 | 504 |
if (ff_lockmgr_cb) {
|
| ... | ... |
@@ -514,14 +526,18 @@ int attribute_align_arg avcodec_open(AVCodecContext *avctx, AVCodec *codec) |
| 514 | 514 |
ret = AVERROR(ENOMEM); |
| 515 | 515 |
goto end; |
| 516 | 516 |
} |
| 517 |
- if(codec->priv_class){ //this can be droped once all user apps use avcodec_get_context_defaults3()
|
|
| 517 |
+ if (codec->priv_class) {
|
|
| 518 | 518 |
*(AVClass**)avctx->priv_data= codec->priv_class; |
| 519 | 519 |
av_opt_set_defaults(avctx->priv_data); |
| 520 | 520 |
} |
| 521 | 521 |
} |
| 522 |
+ if (codec->priv_class && (ret = av_opt_set_dict(avctx->priv_data, &tmp) < 0)) |
|
| 523 |
+ goto free_and_end; |
|
| 522 | 524 |
} else {
|
| 523 | 525 |
avctx->priv_data = NULL; |
| 524 | 526 |
} |
| 527 |
+ if ((ret = av_opt_set_dict(avctx, &tmp)) < 0) |
|
| 528 |
+ goto free_and_end; |
|
| 525 | 529 |
|
| 526 | 530 |
if(avctx->coded_width && avctx->coded_height) |
| 527 | 531 |
avcodec_set_dimensions(avctx, avctx->coded_width, avctx->coded_height); |
| ... | ... |
@@ -640,8 +656,14 @@ end: |
| 640 | 640 |
if (ff_lockmgr_cb) {
|
| 641 | 641 |
(*ff_lockmgr_cb)(&codec_mutex, AV_LOCK_RELEASE); |
| 642 | 642 |
} |
| 643 |
+ if (options) {
|
|
| 644 |
+ av_dict_free(options); |
|
| 645 |
+ *options = tmp; |
|
| 646 |
+ } |
|
| 647 |
+ |
|
| 643 | 648 |
return ret; |
| 644 | 649 |
free_and_end: |
| 650 |
+ av_dict_free(&tmp); |
|
| 645 | 651 |
av_freep(&avctx->priv_data); |
| 646 | 652 |
avctx->codec= NULL; |
| 647 | 653 |
goto end; |
| ... | ... |
@@ -68,5 +68,14 @@ |
| 68 | 68 |
#ifndef FF_API_GET_PIX_FMT_NAME |
| 69 | 69 |
#define FF_API_GET_PIX_FMT_NAME (LIBAVCODEC_VERSION_MAJOR < 54) |
| 70 | 70 |
#endif |
| 71 |
+#ifndef FF_API_ALLOC_CONTEXT |
|
| 72 |
+#define FF_API_ALLOC_CONTEXT (LIBAVCODEC_VERSION_MAJOR < 54) |
|
| 73 |
+#endif |
|
| 74 |
+#ifndef FF_API_AVCODEC_OPEN |
|
| 75 |
+#define FF_API_AVCODEC_OPEN (LIBAVCODEC_VERSION_MAJOR < 54) |
|
| 76 |
+#endif |
|
| 77 |
+#ifndef FF_API_DRC_SCALE |
|
| 78 |
+#define FF_API_DRC_SCALE (LIBAVCODEC_VERSION_MAJOR < 54) |
|
| 79 |
+#endif |
|
| 71 | 80 |
|
| 72 | 81 |
#endif /* AVCODEC_VERSION_H */ |
| ... | ... |
@@ -1783,7 +1783,7 @@ static void gmc_mmx(uint8_t *dst, uint8_t *src, int stride, int h, int ox, int o |
| 1783 | 1783 |
int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height) |
| 1784 | 1784 |
{
|
| 1785 | 1785 |
gmc(dst, src, stride, h, ox, oy, dxx, dxy, dyx, dyy, shift, r, |
| 1786 |
- width, height, &ff_emulated_edge_mc); |
|
| 1786 |
+ width, height, &ff_emulated_edge_mc_8); |
|
| 1787 | 1787 |
} |
| 1788 | 1788 |
#endif |
| 1789 | 1789 |
|
| ... | ... |
@@ -97,7 +97,7 @@ static int movie_init(AVFilterContext *ctx) |
| 97 | 97 |
"Failed to avformat_open_input '%s'\n", movie->file_name); |
| 98 | 98 |
return ret; |
| 99 | 99 |
} |
| 100 |
- if ((ret = av_find_stream_info(movie->format_ctx)) < 0) |
|
| 100 |
+ if ((ret = avformat_find_stream_info(movie->format_ctx, NULL)) < 0) |
|
| 101 | 101 |
av_log(ctx, AV_LOG_WARNING, "Failed to find stream info\n"); |
| 102 | 102 |
|
| 103 | 103 |
// if seeking requested, we execute it |
| ... | ... |
@@ -140,7 +140,7 @@ static int movie_init(AVFilterContext *ctx) |
| 140 | 140 |
return AVERROR(EINVAL); |
| 141 | 141 |
} |
| 142 | 142 |
|
| 143 |
- if ((ret = avcodec_open(movie->codec_ctx, codec)) < 0) {
|
|
| 143 |
+ if ((ret = avcodec_open2(movie->codec_ctx, codec, NULL)) < 0) {
|
|
| 144 | 144 |
av_log(ctx, AV_LOG_ERROR, "Failed to open codec\n"); |
| 145 | 145 |
return ret; |
| 146 | 146 |
} |
| ... | ... |
@@ -1167,6 +1167,7 @@ AVFormatContext *avformat_alloc_output_context(const char *format, |
| 1167 | 1167 |
int avformat_alloc_output_context2(AVFormatContext **ctx, AVOutputFormat *oformat, |
| 1168 | 1168 |
const char *format_name, const char *filename); |
| 1169 | 1169 |
|
| 1170 |
+#if FF_API_FORMAT_PARAMETERS |
|
| 1170 | 1171 |
/** |
| 1171 | 1172 |
* Read packets of a media file to get stream information. This |
| 1172 | 1173 |
* is useful for file formats with no headers such as MPEG. This |
| ... | ... |
@@ -1179,8 +1180,34 @@ int avformat_alloc_output_context2(AVFormatContext **ctx, AVOutputFormat *oforma |
| 1179 | 1179 |
* @return >=0 if OK, AVERROR_xxx on error |
| 1180 | 1180 |
* @todo Let the user decide somehow what information is needed so that |
| 1181 | 1181 |
* we do not waste time getting stuff the user does not need. |
| 1182 |
+ * |
|
| 1183 |
+ * @deprecated use avformat_find_stream_info. |
|
| 1182 | 1184 |
*/ |
| 1183 | 1185 |
int av_find_stream_info(AVFormatContext *ic); |
| 1186 |
+#endif |
|
| 1187 |
+ |
|
| 1188 |
+/** |
|
| 1189 |
+ * Read packets of a media file to get stream information. This |
|
| 1190 |
+ * is useful for file formats with no headers such as MPEG. This |
|
| 1191 |
+ * function also computes the real framerate in case of MPEG-2 repeat |
|
| 1192 |
+ * frame mode. |
|
| 1193 |
+ * The logical file position is not changed by this function; |
|
| 1194 |
+ * examined packets may be buffered for later processing. |
|
| 1195 |
+ * |
|
| 1196 |
+ * @param ic media file handle |
|
| 1197 |
+ * @param options If non-NULL, an ic.nb_streams long array of pointers to |
|
| 1198 |
+ * dictionaries, where i-th member contains options for |
|
| 1199 |
+ * codec corresponding to i-th stream. |
|
| 1200 |
+ * On return each dictionary will be filled with options that were not found. |
|
| 1201 |
+ * @return >=0 if OK, AVERROR_xxx on error |
|
| 1202 |
+ * |
|
| 1203 |
+ * @note this function isn't guaranteed to open all the codecs, so |
|
| 1204 |
+ * options being non-empty at return is a perfectly normal behavior. |
|
| 1205 |
+ * |
|
| 1206 |
+ * @todo Let the user decide somehow what information is needed so that |
|
| 1207 |
+ * we do not waste time getting stuff the user does not need. |
|
| 1208 |
+ */ |
|
| 1209 |
+int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options); |
|
| 1184 | 1210 |
|
| 1185 | 1211 |
/** |
| 1186 | 1212 |
* Find the "best" stream in the file. |
| ... | ... |
@@ -255,6 +255,9 @@ typedef struct {
|
| 255 | 255 |
/* What to skip before effectively reading a packet. */ |
| 256 | 256 |
int skip_to_keyframe; |
| 257 | 257 |
uint64_t skip_to_timecode; |
| 258 |
+ |
|
| 259 |
+ /* File has a CUES element, but we defer parsing until it is needed. */ |
|
| 260 |
+ int cues_parsing_deferred; |
|
| 258 | 261 |
} MatroskaDemuxContext; |
| 259 | 262 |
|
| 260 | 263 |
typedef struct {
|
| ... | ... |
@@ -1139,7 +1142,7 @@ static void matroska_convert_tags(AVFormatContext *s) |
| 1139 | 1139 |
} |
| 1140 | 1140 |
} |
| 1141 | 1141 |
|
| 1142 |
-static void matroska_execute_seekhead(MatroskaDemuxContext *matroska) |
|
| 1142 |
+static int matroska_parse_seekhead_entry(MatroskaDemuxContext *matroska, int idx) |
|
| 1143 | 1143 |
{
|
| 1144 | 1144 |
EbmlList *seekhead_list = &matroska->seekhead; |
| 1145 | 1145 |
MatroskaSeekhead *seekhead = seekhead_list->elem; |
| ... | ... |
@@ -1147,6 +1150,54 @@ static void matroska_execute_seekhead(MatroskaDemuxContext *matroska) |
| 1147 | 1147 |
int64_t before_pos = avio_tell(matroska->ctx->pb); |
| 1148 | 1148 |
uint32_t saved_id = matroska->current_id; |
| 1149 | 1149 |
MatroskaLevel level; |
| 1150 |
+ int64_t offset; |
|
| 1151 |
+ int ret = 0; |
|
| 1152 |
+ |
|
| 1153 |
+ if (idx >= seekhead_list->nb_elem |
|
| 1154 |
+ || seekhead[idx].id == MATROSKA_ID_SEEKHEAD |
|
| 1155 |
+ || seekhead[idx].id == MATROSKA_ID_CLUSTER) |
|
| 1156 |
+ return 0; |
|
| 1157 |
+ |
|
| 1158 |
+ /* seek */ |
|
| 1159 |
+ offset = seekhead[idx].pos + matroska->segment_start; |
|
| 1160 |
+ if (avio_seek(matroska->ctx->pb, offset, SEEK_SET) == offset) {
|
|
| 1161 |
+ /* We don't want to lose our seekhead level, so we add |
|
| 1162 |
+ * a dummy. This is a crude hack. */ |
|
| 1163 |
+ if (matroska->num_levels == EBML_MAX_DEPTH) {
|
|
| 1164 |
+ av_log(matroska->ctx, AV_LOG_INFO, |
|
| 1165 |
+ "Max EBML element depth (%d) reached, " |
|
| 1166 |
+ "cannot parse further.\n", EBML_MAX_DEPTH); |
|
| 1167 |
+ ret = AVERROR_INVALIDDATA; |
|
| 1168 |
+ } else {
|
|
| 1169 |
+ level.start = 0; |
|
| 1170 |
+ level.length = (uint64_t)-1; |
|
| 1171 |
+ matroska->levels[matroska->num_levels] = level; |
|
| 1172 |
+ matroska->num_levels++; |
|
| 1173 |
+ matroska->current_id = 0; |
|
| 1174 |
+ |
|
| 1175 |
+ ebml_parse(matroska, matroska_segment, matroska); |
|
| 1176 |
+ |
|
| 1177 |
+ /* remove dummy level */ |
|
| 1178 |
+ while (matroska->num_levels) {
|
|
| 1179 |
+ uint64_t length = matroska->levels[--matroska->num_levels].length; |
|
| 1180 |
+ if (length == (uint64_t)-1) |
|
| 1181 |
+ break; |
|
| 1182 |
+ } |
|
| 1183 |
+ } |
|
| 1184 |
+ } |
|
| 1185 |
+ /* seek back */ |
|
| 1186 |
+ avio_seek(matroska->ctx->pb, before_pos, SEEK_SET); |
|
| 1187 |
+ matroska->level_up = level_up; |
|
| 1188 |
+ matroska->current_id = saved_id; |
|
| 1189 |
+ |
|
| 1190 |
+ return ret; |
|
| 1191 |
+} |
|
| 1192 |
+ |
|
| 1193 |
+static void matroska_execute_seekhead(MatroskaDemuxContext *matroska) |
|
| 1194 |
+{
|
|
| 1195 |
+ EbmlList *seekhead_list = &matroska->seekhead; |
|
| 1196 |
+ MatroskaSeekhead *seekhead = seekhead_list->elem; |
|
| 1197 |
+ int64_t before_pos = avio_tell(matroska->ctx->pb); |
|
| 1150 | 1198 |
int i; |
| 1151 | 1199 |
|
| 1152 | 1200 |
// we should not do any seeking in the streaming case |
| ... | ... |
@@ -1154,47 +1205,55 @@ static void matroska_execute_seekhead(MatroskaDemuxContext *matroska) |
| 1154 | 1154 |
(matroska->ctx->flags & AVFMT_FLAG_IGNIDX)) |
| 1155 | 1155 |
return; |
| 1156 | 1156 |
|
| 1157 |
- for (i=0; i<seekhead_list->nb_elem; i++) {
|
|
| 1158 |
- int64_t offset = seekhead[i].pos + matroska->segment_start; |
|
| 1159 |
- |
|
| 1160 |
- if (seekhead[i].pos <= before_pos |
|
| 1161 |
- || seekhead[i].id == MATROSKA_ID_SEEKHEAD |
|
| 1162 |
- || seekhead[i].id == MATROSKA_ID_CLUSTER) |
|
| 1157 |
+ for (i = 0; i < seekhead_list->nb_elem; i++) {
|
|
| 1158 |
+ if (seekhead[i].pos <= before_pos) |
|
| 1163 | 1159 |
continue; |
| 1164 | 1160 |
|
| 1165 |
- /* seek */ |
|
| 1166 |
- if (avio_seek(matroska->ctx->pb, offset, SEEK_SET) != offset) |
|
| 1161 |
+ // defer cues parsing until we actually need cue data. |
|
| 1162 |
+ if (seekhead[i].id == MATROSKA_ID_CUES) {
|
|
| 1163 |
+ matroska->cues_parsing_deferred = 1; |
|
| 1167 | 1164 |
continue; |
| 1165 |
+ } |
|
| 1168 | 1166 |
|
| 1169 |
- /* We don't want to lose our seekhead level, so we add |
|
| 1170 |
- * a dummy. This is a crude hack. */ |
|
| 1171 |
- if (matroska->num_levels == EBML_MAX_DEPTH) {
|
|
| 1172 |
- av_log(matroska->ctx, AV_LOG_INFO, |
|
| 1173 |
- "Max EBML element depth (%d) reached, " |
|
| 1174 |
- "cannot parse further.\n", EBML_MAX_DEPTH); |
|
| 1167 |
+ if (matroska_parse_seekhead_entry(matroska, i) < 0) |
|
| 1175 | 1168 |
break; |
| 1176 |
- } |
|
| 1169 |
+ } |
|
| 1170 |
+} |
|
| 1177 | 1171 |
|
| 1178 |
- level.start = 0; |
|
| 1179 |
- level.length = (uint64_t)-1; |
|
| 1180 |
- matroska->levels[matroska->num_levels] = level; |
|
| 1181 |
- matroska->num_levels++; |
|
| 1182 |
- matroska->current_id = 0; |
|
| 1172 |
+static void matroska_parse_cues(MatroskaDemuxContext *matroska) {
|
|
| 1173 |
+ EbmlList *seekhead_list = &matroska->seekhead; |
|
| 1174 |
+ MatroskaSeekhead *seekhead = seekhead_list->elem; |
|
| 1175 |
+ EbmlList *index_list; |
|
| 1176 |
+ MatroskaIndex *index; |
|
| 1177 |
+ int index_scale = 1; |
|
| 1178 |
+ int i, j; |
|
| 1183 | 1179 |
|
| 1184 |
- ebml_parse(matroska, matroska_segment, matroska); |
|
| 1180 |
+ for (i = 0; i < seekhead_list->nb_elem; i++) |
|
| 1181 |
+ if (seekhead[i].id == MATROSKA_ID_CUES) |
|
| 1182 |
+ break; |
|
| 1183 |
+ assert(i <= seekhead_list->nb_elem); |
|
| 1185 | 1184 |
|
| 1186 |
- /* remove dummy level */ |
|
| 1187 |
- while (matroska->num_levels) {
|
|
| 1188 |
- uint64_t length = matroska->levels[--matroska->num_levels].length; |
|
| 1189 |
- if (length == (uint64_t)-1) |
|
| 1190 |
- break; |
|
| 1185 |
+ matroska_parse_seekhead_entry(matroska, i); |
|
| 1186 |
+ |
|
| 1187 |
+ index_list = &matroska->index; |
|
| 1188 |
+ index = index_list->elem; |
|
| 1189 |
+ if (index_list->nb_elem |
|
| 1190 |
+ && index[0].time > 1E14/matroska->time_scale) {
|
|
| 1191 |
+ av_log(matroska->ctx, AV_LOG_WARNING, "Working around broken index.\n"); |
|
| 1192 |
+ index_scale = matroska->time_scale; |
|
| 1193 |
+ } |
|
| 1194 |
+ for (i = 0; i < index_list->nb_elem; i++) {
|
|
| 1195 |
+ EbmlList *pos_list = &index[i].pos; |
|
| 1196 |
+ MatroskaIndexPos *pos = pos_list->elem; |
|
| 1197 |
+ for (j = 0; j < pos_list->nb_elem; j++) {
|
|
| 1198 |
+ MatroskaTrack *track = matroska_find_track_by_num(matroska, pos[j].track); |
|
| 1199 |
+ if (track && track->stream) |
|
| 1200 |
+ av_add_index_entry(track->stream, |
|
| 1201 |
+ pos[j].pos + matroska->segment_start, |
|
| 1202 |
+ index[i].time/index_scale, 0, 0, |
|
| 1203 |
+ AVINDEX_KEYFRAME); |
|
| 1191 | 1204 |
} |
| 1192 | 1205 |
} |
| 1193 |
- |
|
| 1194 |
- /* seek back */ |
|
| 1195 |
- avio_seek(matroska->ctx->pb, before_pos, SEEK_SET); |
|
| 1196 |
- matroska->level_up = level_up; |
|
| 1197 |
- matroska->current_id = saved_id; |
|
| 1198 | 1206 |
} |
| 1199 | 1207 |
|
| 1200 | 1208 |
static int matroska_aac_profile(char *codec_id) |
| ... | ... |
@@ -1226,9 +1285,6 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 1226 | 1226 |
EbmlList *chapters_list = &matroska->chapters; |
| 1227 | 1227 |
MatroskaChapter *chapters; |
| 1228 | 1228 |
MatroskaTrack *tracks; |
| 1229 |
- EbmlList *index_list; |
|
| 1230 |
- MatroskaIndex *index; |
|
| 1231 |
- int index_scale = 1; |
|
| 1232 | 1229 |
uint64_t max_start = 0; |
| 1233 | 1230 |
Ebml ebml = { 0 };
|
| 1234 | 1231 |
AVStream *st; |
| ... | ... |
@@ -1587,27 +1643,6 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 1587 | 1587 |
max_start = chapters[i].start; |
| 1588 | 1588 |
} |
| 1589 | 1589 |
|
| 1590 |
- index_list = &matroska->index; |
|
| 1591 |
- index = index_list->elem; |
|
| 1592 |
- if (index_list->nb_elem |
|
| 1593 |
- && index[0].time > 100000000000000/matroska->time_scale) {
|
|
| 1594 |
- av_log(matroska->ctx, AV_LOG_WARNING, "Working around broken index.\n"); |
|
| 1595 |
- index_scale = matroska->time_scale; |
|
| 1596 |
- } |
|
| 1597 |
- for (i=0; i<index_list->nb_elem; i++) {
|
|
| 1598 |
- EbmlList *pos_list = &index[i].pos; |
|
| 1599 |
- MatroskaIndexPos *pos = pos_list->elem; |
|
| 1600 |
- for (j=0; j<pos_list->nb_elem; j++) {
|
|
| 1601 |
- MatroskaTrack *track = matroska_find_track_by_num(matroska, |
|
| 1602 |
- pos[j].track); |
|
| 1603 |
- if (track && track->stream) |
|
| 1604 |
- av_add_index_entry(track->stream, |
|
| 1605 |
- pos[j].pos + matroska->segment_start, |
|
| 1606 |
- index[i].time/index_scale, 0, 0, |
|
| 1607 |
- AVINDEX_KEYFRAME); |
|
| 1608 |
- } |
|
| 1609 |
- } |
|
| 1610 |
- |
|
| 1611 | 1590 |
matroska_convert_tags(s); |
| 1612 | 1591 |
|
| 1613 | 1592 |
return 0; |
| ... | ... |
@@ -1954,6 +1989,12 @@ static int matroska_read_seek(AVFormatContext *s, int stream_index, |
| 1954 | 1954 |
AVStream *st = s->streams[stream_index]; |
| 1955 | 1955 |
int i, index, index_sub, index_min; |
| 1956 | 1956 |
|
| 1957 |
+ /* Parse the CUES now since we need the index data to seek. */ |
|
| 1958 |
+ if (matroska->cues_parsing_deferred) {
|
|
| 1959 |
+ matroska_parse_cues(matroska); |
|
| 1960 |
+ matroska->cues_parsing_deferred = 0; |
|
| 1961 |
+ } |
|
| 1962 |
+ |
|
| 1957 | 1963 |
if (!st->nb_index_entries) |
| 1958 | 1964 |
return 0; |
| 1959 | 1965 |
timestamp = FFMAX(timestamp, st->index_entries[0].timestamp); |
| ... | ... |
@@ -2115,7 +2115,7 @@ static void mov_create_chapter_track(AVFormatContext *s, int tracknum) |
| 2115 | 2115 |
track->mode = mov->mode; |
| 2116 | 2116 |
track->tag = MKTAG('t','e','x','t');
|
| 2117 | 2117 |
track->timescale = MOV_TIMESCALE; |
| 2118 |
- track->enc = avcodec_alloc_context(); |
|
| 2118 |
+ track->enc = avcodec_alloc_context3(NULL); |
|
| 2119 | 2119 |
track->enc->codec_type = AVMEDIA_TYPE_SUBTITLE; |
| 2120 | 2120 |
|
| 2121 | 2121 |
for (i = 0; i < s->nb_chapters; i++) {
|
| ... | ... |
@@ -36,7 +36,7 @@ int ff_mov_init_hinting(AVFormatContext *s, int index, int src_index) |
| 36 | 36 |
track->tag = MKTAG('r','t','p',' ');
|
| 37 | 37 |
track->src_track = src_index; |
| 38 | 38 |
|
| 39 |
- track->enc = avcodec_alloc_context(); |
|
| 39 |
+ track->enc = avcodec_alloc_context3(NULL); |
|
| 40 | 40 |
if (!track->enc) |
| 41 | 41 |
goto fail; |
| 42 | 42 |
track->enc->codec_type = AVMEDIA_TYPE_DATA; |
| ... | ... |
@@ -2113,7 +2113,7 @@ static int has_decode_delay_been_guessed(AVStream *st) |
| 2113 | 2113 |
st->codec_info_nb_frames >= 6 + st->codec->has_b_frames; |
| 2114 | 2114 |
} |
| 2115 | 2115 |
|
| 2116 |
-static int try_decode_frame(AVStream *st, AVPacket *avpkt) |
|
| 2116 |
+static int try_decode_frame(AVStream *st, AVPacket *avpkt, AVDictionary **options) |
|
| 2117 | 2117 |
{
|
| 2118 | 2118 |
int16_t *samples; |
| 2119 | 2119 |
AVCodec *codec; |
| ... | ... |
@@ -2124,7 +2124,7 @@ static int try_decode_frame(AVStream *st, AVPacket *avpkt) |
| 2124 | 2124 |
codec = avcodec_find_decoder(st->codec->codec_id); |
| 2125 | 2125 |
if (!codec) |
| 2126 | 2126 |
return -1; |
| 2127 |
- ret = avcodec_open(st->codec, codec); |
|
| 2127 |
+ ret = avcodec_open2(st->codec, codec, options); |
|
| 2128 | 2128 |
if (ret < 0) |
| 2129 | 2129 |
return ret; |
| 2130 | 2130 |
} |
| ... | ... |
@@ -2243,12 +2243,20 @@ static int tb_unreliable(AVCodecContext *c){
|
| 2243 | 2243 |
return 0; |
| 2244 | 2244 |
} |
| 2245 | 2245 |
|
| 2246 |
+#if FF_API_FORMAT_PARAMETERS |
|
| 2246 | 2247 |
int av_find_stream_info(AVFormatContext *ic) |
| 2247 | 2248 |
{
|
| 2249 |
+ return avformat_find_stream_info(ic, NULL); |
|
| 2250 |
+} |
|
| 2251 |
+#endif |
|
| 2252 |
+ |
|
| 2253 |
+int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options) |
|
| 2254 |
+{
|
|
| 2248 | 2255 |
int i, count, ret, read_size, j; |
| 2249 | 2256 |
AVStream *st; |
| 2250 | 2257 |
AVPacket pkt1, *pkt; |
| 2251 | 2258 |
int64_t old_offset = avio_tell(ic->pb); |
| 2259 |
+ int orig_nb_streams = ic->nb_streams; // new streams might appear, no options for those |
|
| 2252 | 2260 |
|
| 2253 | 2261 |
for(i=0;i<ic->nb_streams;i++) {
|
| 2254 | 2262 |
AVCodec *codec; |
| ... | ... |
@@ -2274,12 +2282,12 @@ int av_find_stream_info(AVFormatContext *ic) |
| 2274 | 2274 |
/* Ensure that subtitle_header is properly set. */ |
| 2275 | 2275 |
if (st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE |
| 2276 | 2276 |
&& codec && !st->codec->codec) |
| 2277 |
- avcodec_open(st->codec, codec); |
|
| 2277 |
+ avcodec_open2(st->codec, codec, options ? &options[i] : NULL); |
|
| 2278 | 2278 |
|
| 2279 | 2279 |
//try to just open decoders, in case this is enough to get parameters |
| 2280 | 2280 |
if(!has_codec_parameters(st->codec)){
|
| 2281 | 2281 |
if (codec && !st->codec->codec) |
| 2282 |
- avcodec_open(st->codec, codec); |
|
| 2282 |
+ avcodec_open2(st->codec, codec, options ? &options[i] : NULL); |
|
| 2283 | 2283 |
} |
| 2284 | 2284 |
} |
| 2285 | 2285 |
|
| ... | ... |
@@ -2423,7 +2431,7 @@ int av_find_stream_info(AVFormatContext *ic) |
| 2423 | 2423 |
!has_decode_delay_been_guessed(st) || |
| 2424 | 2424 |
(st->codec->codec && |
| 2425 | 2425 |
st->codec->codec->capabilities & CODEC_CAP_CHANNEL_CONF)) |
| 2426 |
- try_decode_frame(st, pkt); |
|
| 2426 |
+ try_decode_frame(st, pkt, (options && i <= orig_nb_streams )? &options[i] : NULL); |
|
| 2427 | 2427 |
|
| 2428 | 2428 |
st->codec_info_nb_frames++; |
| 2429 | 2429 |
count++; |
| ... | ... |
@@ -2703,7 +2711,7 @@ AVStream *av_new_stream(AVFormatContext *s, int id) |
| 2703 | 2703 |
return NULL; |
| 2704 | 2704 |
} |
| 2705 | 2705 |
|
| 2706 |
- st->codec= avcodec_alloc_context(); |
|
| 2706 |
+ st->codec = avcodec_alloc_context3(NULL); |
|
| 2707 | 2707 |
if (s->iformat) {
|
| 2708 | 2708 |
/* no default bitrate if decoding */ |
| 2709 | 2709 |
st->codec->bit_rate = 0; |
| ... | ... |
@@ -347,10 +347,13 @@ typedef struct SwsContext {
|
| 347 | 347 |
DECLARE_ALIGNED(8, uint64_t, v_temp); |
| 348 | 348 |
DECLARE_ALIGNED(8, uint64_t, y_temp); |
| 349 | 349 |
int32_t alpMmxFilter[4*MAX_FILTER_SIZE]; |
| 350 |
+ // alignment of these values is not necessary, but merely here |
|
| 351 |
+ // to maintain the same offset across x8632 and x86-64. Once we |
|
| 352 |
+ // use proper offset macros in the asm, they can be removed. |
|
| 350 | 353 |
DECLARE_ALIGNED(8, ptrdiff_t, uv_off); ///< offset (in pixels) between u and v planes |
| 351 | 354 |
DECLARE_ALIGNED(8, ptrdiff_t, uv_offx2); ///< offset (in bytes) between u and v planes |
| 352 |
- uint16_t dither16[8]; |
|
| 353 |
- uint32_t dither32[8]; |
|
| 355 |
+ DECLARE_ALIGNED(8, uint16_t, dither16)[8]; |
|
| 356 |
+ DECLARE_ALIGNED(8, uint32_t, dither32)[8]; |
|
| 354 | 357 |
|
| 355 | 358 |
const uint8_t *chrDither8, *lumDither8; |
| 356 | 359 |
|
| ... | ... |
@@ -34,7 +34,7 @@ install-libs-$(CONFIG_STATIC): install-lib$(NAME)-static |
| 34 | 34 |
install-libs-$(CONFIG_SHARED): install-lib$(NAME)-shared |
| 35 | 35 |
|
| 36 | 36 |
define RULES |
| 37 |
-$(SUBDIR)%$(EXESUF): $(SUBDIR)%.o |
|
| 37 |
+$(TESTPROGS) $(TOOLS): %$(EXESUF): %.o |
|
| 38 | 38 |
$$(LD) $(FFLDFLAGS) -o $$@ $$^ -l$(FULLNAME) $(FFEXTRALIBS) $$(ELIBS) |
| 39 | 39 |
|
| 40 | 40 |
$(SUBDIR)$(SLIBNAME): $(SUBDIR)$(SLIBNAME_WITH_MAJOR) |
| ... | ... |
@@ -96,7 +96,7 @@ endef |
| 96 | 96 |
|
| 97 | 97 |
$(eval $(RULES)) |
| 98 | 98 |
|
| 99 |
-$(EXAMPLES) $(TESTPROGS): $(THIS_LIB) $(DEP_LIBS) |
|
| 99 |
+$(EXAMPLES) $(TESTPROGS) $(TOOLS): $(THIS_LIB) $(DEP_LIBS) |
|
| 100 | 100 |
|
| 101 | 101 |
examples: $(EXAMPLES) |
| 102 | 102 |
testprogs: $(TESTPROGS) |
| ... | ... |
@@ -31,9 +31,6 @@ tests/data/asynth1.sw tests/vsynth%/00.pgm: TAG = GEN |
| 31 | 31 |
tests/seek_test$(EXESUF): tests/seek_test.o $(FF_DEP_LIBS) |
| 32 | 32 |
$(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS) |
| 33 | 33 |
|
| 34 |
-tools/lavfi-showfiltfmts$(EXESUF): tools/lavfi-showfiltfmts.o $(FF_DEP_LIBS) |
|
| 35 |
- $(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS) |
|
| 36 |
- |
|
| 37 | 34 |
include $(SRC_PATH)/tests/fate.mak |
| 38 | 35 |
include $(SRC_PATH)/tests/fate2.mak |
| 39 | 36 |
|
| ... | ... |
@@ -14,7 +14,7 @@ eval do_$test=y |
| 14 | 14 |
do_lavf() |
| 15 | 15 |
{
|
| 16 | 16 |
file=${outfile}lavf.$1
|
| 17 |
- do_ffmpeg $file $DEC_OPTS -f image2 -vcodec pgmyuv -i $raw_src $DEC_OPTS -ar 44100 -f s16le -i $pcm_src $ENC_OPTS -t 1 -qscale 10 $2 |
|
| 17 |
+ do_ffmpeg $file $DEC_OPTS -f image2 -vcodec pgmyuv -i $raw_src $DEC_OPTS -ar 44100 -f s16le -i $pcm_src $ENC_OPTS -ab 64k -t 1 -qscale 10 $2 |
|
| 18 | 18 |
do_ffmpeg_crc $file $DEC_OPTS -i $target_path/$file $3 |
| 19 | 19 |
} |
| 20 | 20 |
|
| ... | ... |
@@ -53,7 +53,7 @@ fi |
| 53 | 53 |
|
| 54 | 54 |
if [ -n "$do_rm" ] ; then |
| 55 | 55 |
file=${outfile}lavf.rm
|
| 56 |
-do_ffmpeg $file $DEC_OPTS -f image2 -vcodec pgmyuv -i $raw_src $DEC_OPTS -ar 44100 -f s16le -i $pcm_src $ENC_OPTS -t 1 -qscale 10 -acodec ac3_fixed |
|
| 56 |
+do_ffmpeg $file $DEC_OPTS -f image2 -vcodec pgmyuv -i $raw_src $DEC_OPTS -ar 44100 -f s16le -i $pcm_src $ENC_OPTS -t 1 -qscale 10 -acodec ac3_fixed -ab 64k |
|
| 57 | 57 |
# broken |
| 58 | 58 |
#do_ffmpeg_crc $file -i $target_path/$file |
| 59 | 59 |
fi |