* commit '23aae62c2cb4504a09ceb8cd0cabc1c8b260f521':
alsdec: Check k used for rice decoder.
avfiltergraph: silence an uninitialized variable warning
xsubenc: reindent
lavc: replace AVCodecContext.encode with subtitle-specific callback
lavc: add const to private codec class initialization.
avconv: don't pass a bogus parameter to avfilter_graph_create_filter().
id3v2: strdup the genre name explicitly.
lavf/id3v2: do not export empty fields.
buffersrc: add const to the AVFrame* argument of av_buffersrc_write_frame()
lavfi: replace empty input/output lists with null pointers
Conflicts:
ffmpeg_filter.c
libavcodec/alsdec.c
libavcodec/dvdsubenc.c
libavcodec/utils.c
libavcodec/v210dec.h
libavfilter/af_channelsplit.c
libavfilter/avfiltergraph.c
libavfilter/buffersrc.c
libavfilter/src_movie.c
libavfilter/vf_ass.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
... | ... |
@@ -295,7 +295,7 @@ static int configure_output_video_filter(FilterGraph *fg, OutputFilter *ofilter, |
295 | 295 |
snprintf(name, sizeof(name), "output stream %d:%d", ost->file_index, ost->index); |
296 | 296 |
ret = avfilter_graph_create_filter(&ofilter->filter, |
297 | 297 |
avfilter_get_by_name("ffbuffersink"), |
298 |
- name, NULL, NULL/*buffersink_params*/, fg->graph); |
|
298 |
+ name, NULL, NULL, fg->graph); |
|
299 | 299 |
av_freep(&buffersink_params); |
300 | 300 |
|
301 | 301 |
if (ret < 0) |
... | ... |
@@ -325,8 +325,6 @@ void avcodec_register_all(void) |
325 | 325 |
REGISTER_DECODER (SHORTEN, shorten); |
326 | 326 |
REGISTER_DECODER (SIPR, sipr); |
327 | 327 |
REGISTER_DECODER (SMACKAUD, smackaud); |
328 |
- REGISTER_ENCDEC (SONIC, sonic); |
|
329 |
- REGISTER_ENCODER (SONIC_LS, sonic_ls); |
|
330 | 328 |
REGISTER_DECODER (TRUEHD, truehd); |
331 | 329 |
REGISTER_DECODER (TRUESPEECH, truespeech); |
332 | 330 |
REGISTER_DECODER (TTA, tta); |
... | ... |
@@ -651,10 +651,10 @@ static int read_var_block_data(ALSDecContext *ctx, ALSBlockData *bd) |
651 | 651 |
for (k = 1; k < sub_blocks; k++) |
652 | 652 |
s[k] = s[k - 1] + decode_rice(gb, 0); |
653 | 653 |
} |
654 |
- for (k = 0; k < sub_blocks; k++) |
|
654 |
+ for (k = 1; k < sub_blocks; k++) |
|
655 | 655 |
if (s[k] > 32) { |
656 | 656 |
av_log(avctx, AV_LOG_ERROR, "k invalid for rice code.\n"); |
657 |
- return -1; |
|
657 |
+ return AVERROR_INVALIDDATA; |
|
658 | 658 |
} |
659 | 659 |
|
660 | 660 |
if (get_bits1(gb)) |
... | ... |
@@ -37,9 +37,9 @@ static av_cold int ass_encode_init(AVCodecContext *avctx) |
37 | 37 |
} |
38 | 38 |
|
39 | 39 |
static int ass_encode_frame(AVCodecContext *avctx, |
40 |
- unsigned char *buf, int bufsize, void *data) |
|
40 |
+ unsigned char *buf, int bufsize, |
|
41 |
+ const AVSubtitle *sub) |
|
41 | 42 |
{ |
42 |
- AVSubtitle *sub = data; |
|
43 | 43 |
int i, len, total_len = 0; |
44 | 44 |
|
45 | 45 |
for (i=0; i<sub->num_rects; i++) { |
... | ... |
@@ -67,5 +67,5 @@ AVCodec ff_ass_encoder = { |
67 | 67 |
.type = AVMEDIA_TYPE_SUBTITLE, |
68 | 68 |
.id = AV_CODEC_ID_SSA, |
69 | 69 |
.init = ass_encode_init, |
70 |
- .encode = ass_encode_frame, |
|
70 |
+ .encode_sub = ass_encode_frame, |
|
71 | 71 |
}; |
... | ... |
@@ -3099,6 +3099,8 @@ typedef struct AVProfile { |
3099 | 3099 |
|
3100 | 3100 |
typedef struct AVCodecDefault AVCodecDefault; |
3101 | 3101 |
|
3102 |
+struct AVSubtitle; |
|
3103 |
+ |
|
3102 | 3104 |
/** |
3103 | 3105 |
* AVCodec. |
3104 | 3106 |
*/ |
... | ... |
@@ -3171,7 +3173,8 @@ typedef struct AVCodec { |
3171 | 3171 |
void (*init_static_data)(struct AVCodec *codec); |
3172 | 3172 |
|
3173 | 3173 |
int (*init)(AVCodecContext *); |
3174 |
- int (*encode)(AVCodecContext *, uint8_t *buf, int buf_size, void *data); |
|
3174 |
+ int (*encode_sub)(AVCodecContext *, uint8_t *buf, int buf_size, |
|
3175 |
+ const struct AVSubtitle *sub); |
|
3175 | 3176 |
/** |
3176 | 3177 |
* Encode data to an AVPacket. |
3177 | 3178 |
* |
... | ... |
@@ -248,7 +248,7 @@ static void dvb_encode_rle8(uint8_t **pq, |
248 | 248 |
} |
249 | 249 |
|
250 | 250 |
static int encode_dvb_subtitles(DVBSubtitleContext *s, |
251 |
- uint8_t *outbuf, AVSubtitle *h) |
|
251 |
+ uint8_t *outbuf, const AVSubtitle *h) |
|
252 | 252 |
{ |
253 | 253 |
uint8_t *q, *pseg_len; |
254 | 254 |
int page_id, region_id, clut_id, object_id, i, bpp_index, page_state; |
... | ... |
@@ -444,10 +444,10 @@ static int encode_dvb_subtitles(DVBSubtitleContext *s, |
444 | 444 |
} |
445 | 445 |
|
446 | 446 |
static int dvbsub_encode(AVCodecContext *avctx, |
447 |
- unsigned char *buf, int buf_size, void *data) |
|
447 |
+ unsigned char *buf, int buf_size, |
|
448 |
+ const AVSubtitle *sub) |
|
448 | 449 |
{ |
449 | 450 |
DVBSubtitleContext *s = avctx->priv_data; |
450 |
- AVSubtitle *sub = data; |
|
451 | 451 |
int ret; |
452 | 452 |
|
453 | 453 |
ret = encode_dvb_subtitles(s, buf, sub); |
... | ... |
@@ -459,6 +459,6 @@ AVCodec ff_dvbsub_encoder = { |
459 | 459 |
.type = AVMEDIA_TYPE_SUBTITLE, |
460 | 460 |
.id = AV_CODEC_ID_DVB_SUBTITLE, |
461 | 461 |
.priv_data_size = sizeof(DVBSubtitleContext), |
462 |
- .encode = dvbsub_encode, |
|
462 |
+ .encode_sub = dvbsub_encode, |
|
463 | 463 |
.long_name = NULL_IF_CONFIG_SMALL("DVB subtitles"), |
464 | 464 |
}; |
... | ... |
@@ -416,10 +416,10 @@ static int dvdsub_init(AVCodecContext *avctx) |
416 | 416 |
} |
417 | 417 |
|
418 | 418 |
static int dvdsub_encode(AVCodecContext *avctx, |
419 |
- unsigned char *buf, int buf_size, void *data) |
|
419 |
+ unsigned char *buf, int buf_size, |
|
420 |
+ const AVSubtitle *sub) |
|
420 | 421 |
{ |
421 | 422 |
//DVDSubtitleContext *s = avctx->priv_data; |
422 |
- AVSubtitle *sub = data; |
|
423 | 423 |
int ret; |
424 | 424 |
|
425 | 425 |
ret = encode_dvd_subtitles(avctx, buf, buf_size, sub); |
... | ... |
@@ -431,7 +431,7 @@ AVCodec ff_dvdsub_encoder = { |
431 | 431 |
.type = AVMEDIA_TYPE_SUBTITLE, |
432 | 432 |
.id = AV_CODEC_ID_DVD_SUBTITLE, |
433 | 433 |
.init = dvdsub_init, |
434 |
- .encode = dvdsub_encode, |
|
434 |
+ .encode_sub = dvdsub_encode, |
|
435 | 435 |
.long_name = NULL_IF_CONFIG_SMALL("DVD subtitles"), |
436 | 436 |
.priv_data_size = sizeof(DVDSubtitleContext), |
437 | 437 |
}; |
... | ... |
@@ -104,10 +104,9 @@ static const ASSCodesCallbacks mov_text_callbacks = { |
104 | 104 |
}; |
105 | 105 |
|
106 | 106 |
static int mov_text_encode_frame(AVCodecContext *avctx, unsigned char *buf, |
107 |
- int bufsize, void *data) |
|
107 |
+ int bufsize, const AVSubtitle *sub) |
|
108 | 108 |
{ |
109 | 109 |
MovTextContext *s = avctx->priv_data; |
110 |
- AVSubtitle *sub = data; |
|
111 | 110 |
ASSDialog *dialog; |
112 | 111 |
int i, len, num; |
113 | 112 |
|
... | ... |
@@ -157,6 +156,6 @@ AVCodec ff_movtext_encoder = { |
157 | 157 |
.id = AV_CODEC_ID_MOV_TEXT, |
158 | 158 |
.priv_data_size = sizeof(MovTextContext), |
159 | 159 |
.init = mov_text_encode_init, |
160 |
- .encode = mov_text_encode_frame, |
|
160 |
+ .encode_sub = mov_text_encode_frame, |
|
161 | 161 |
.close = mov_text_encode_close, |
162 | 162 |
}; |
... | ... |
@@ -233,10 +233,9 @@ static const ASSCodesCallbacks srt_callbacks = { |
233 | 233 |
}; |
234 | 234 |
|
235 | 235 |
static int srt_encode_frame(AVCodecContext *avctx, |
236 |
- unsigned char *buf, int bufsize, void *data) |
|
236 |
+ unsigned char *buf, int bufsize, const AVSubtitle *sub) |
|
237 | 237 |
{ |
238 | 238 |
SRTContext *s = avctx->priv_data; |
239 |
- AVSubtitle *sub = data; |
|
240 | 239 |
ASSDialog *dialog; |
241 | 240 |
int i, len, num; |
242 | 241 |
|
... | ... |
@@ -299,7 +298,7 @@ AVCodec ff_srt_encoder = { |
299 | 299 |
.id = AV_CODEC_ID_SRT, |
300 | 300 |
.priv_data_size = sizeof(SRTContext), |
301 | 301 |
.init = srt_encode_init, |
302 |
- .encode = srt_encode_frame, |
|
302 |
+ .encode_sub = srt_encode_frame, |
|
303 | 303 |
.close = srt_encode_close, |
304 | 304 |
}; |
305 | 305 |
#endif |
... | ... |
@@ -312,7 +311,7 @@ AVCodec ff_subrip_encoder = { |
312 | 312 |
.id = AV_CODEC_ID_SUBRIP, |
313 | 313 |
.priv_data_size = sizeof(SRTContext), |
314 | 314 |
.init = srt_encode_init, |
315 |
- .encode = srt_encode_frame, |
|
315 |
+ .encode_sub = srt_encode_frame, |
|
316 | 316 |
.close = srt_encode_close, |
317 | 317 |
}; |
318 | 318 |
#endif |
... | ... |
@@ -134,7 +134,7 @@ static void avcodec_init(void) |
134 | 134 |
|
135 | 135 |
int av_codec_is_encoder(const AVCodec *codec) |
136 | 136 |
{ |
137 |
- return codec && (codec->encode || codec->encode2); |
|
137 |
+ return codec && (codec->encode_sub || codec->encode2); |
|
138 | 138 |
} |
139 | 139 |
|
140 | 140 |
int av_codec_is_decoder(const AVCodec *codec) |
... | ... |
@@ -804,7 +804,7 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code |
804 | 804 |
goto end; |
805 | 805 |
} |
806 | 806 |
if (codec->priv_class) { |
807 |
- *(const AVClass**)avctx->priv_data= codec->priv_class; |
|
807 |
+ *(const AVClass**)avctx->priv_data = codec->priv_class; |
|
808 | 808 |
av_opt_set_defaults(avctx->priv_data); |
809 | 809 |
} |
810 | 810 |
} |
... | ... |
@@ -1407,7 +1407,7 @@ int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size, |
1407 | 1407 |
return -1; |
1408 | 1408 |
} |
1409 | 1409 |
|
1410 |
- ret = avctx->codec->encode(avctx, buf, buf_size, (void *)(intptr_t)sub); |
|
1410 |
+ ret = avctx->codec->encode_sub(avctx, buf, buf_size, sub); |
|
1411 | 1411 |
avctx->frame_number++; |
1412 | 1412 |
return ret; |
1413 | 1413 |
} |
... | ... |
@@ -111,9 +111,8 @@ static int make_tc(uint64_t ms, int *tc) |
111 | 111 |
} |
112 | 112 |
|
113 | 113 |
static int xsub_encode(AVCodecContext *avctx, unsigned char *buf, |
114 |
- int bufsize, void *data) |
|
114 |
+ int bufsize, const AVSubtitle *h) |
|
115 | 115 |
{ |
116 |
- AVSubtitle *h = data; |
|
117 | 116 |
uint64_t startTime = h->pts / 1000; // FIXME: need better solution... |
118 | 117 |
uint64_t endTime = startTime + h->end_display_time - h->start_display_time; |
119 | 118 |
int start_tc[4], end_tc[4]; |
... | ... |
@@ -211,10 +210,10 @@ static av_cold int xsub_encoder_init(AVCodecContext *avctx) |
211 | 211 |
} |
212 | 212 |
|
213 | 213 |
AVCodec ff_xsub_encoder = { |
214 |
- .name = "xsub", |
|
215 |
- .type = AVMEDIA_TYPE_SUBTITLE, |
|
216 |
- .id = AV_CODEC_ID_XSUB, |
|
217 |
- .init = xsub_encoder_init, |
|
218 |
- .encode = xsub_encode, |
|
219 |
- .long_name = NULL_IF_CONFIG_SMALL("DivX subtitles (XSUB)"), |
|
214 |
+ .name = "xsub", |
|
215 |
+ .type = AVMEDIA_TYPE_SUBTITLE, |
|
216 |
+ .id = AV_CODEC_ID_XSUB, |
|
217 |
+ .init = xsub_encoder_init, |
|
218 |
+ .encode_sub = xsub_encode, |
|
219 |
+ .long_name = NULL_IF_CONFIG_SMALL("DivX subtitles (XSUB)"), |
|
220 | 220 |
}; |
... | ... |
@@ -549,7 +549,7 @@ AVFilter avfilter_af_amix = { |
549 | 549 |
.uninit = uninit, |
550 | 550 |
.query_formats = query_formats, |
551 | 551 |
|
552 |
- .inputs = (const AVFilterPad[]) {{ .name = NULL}}, |
|
552 |
+ .inputs = NULL, |
|
553 | 553 |
.outputs = (const AVFilterPad[]) {{ .name = "default", |
554 | 554 |
.type = AVMEDIA_TYPE_AUDIO, |
555 | 555 |
.config_props = config_output, |
... | ... |
@@ -494,7 +494,7 @@ AVFilter avfilter_af_join = { |
494 | 494 |
.uninit = join_uninit, |
495 | 495 |
.query_formats = join_query_formats, |
496 | 496 |
|
497 |
- .inputs = (const AVFilterPad[]){{ NULL }}, |
|
497 |
+ .inputs = NULL, |
|
498 | 498 |
.outputs = (const AVFilterPad[]){{ .name = "default", |
499 | 499 |
.type = AVMEDIA_TYPE_AUDIO, |
500 | 500 |
.config_props = join_config_output, |
... | ... |
@@ -126,7 +126,7 @@ AVFilter avfilter_asrc_anullsrc = { |
126 | 126 |
.init = init, |
127 | 127 |
.priv_size = sizeof(ANullContext), |
128 | 128 |
|
129 |
- .inputs = (const AVFilterPad[]) {{ .name = NULL}}, |
|
129 |
+ .inputs = NULL, |
|
130 | 130 |
|
131 | 131 |
.outputs = (const AVFilterPad[]) {{ .name = "default", |
132 | 132 |
.type = AVMEDIA_TYPE_AUDIO, |
... | ... |
@@ -679,7 +679,7 @@ static void swap_channel_layouts_on_filter(AVFilterContext *filter) |
679 | 679 |
best_count_diff = count_diff; |
680 | 680 |
} |
681 | 681 |
} |
682 |
- av_assert1(best_idx>=0); |
|
682 |
+ av_assert0(best_idx >= 0); |
|
683 | 683 |
FFSWAP(uint64_t, outlink->in_channel_layouts->channel_layouts[0], |
684 | 684 |
outlink->in_channel_layouts->channel_layouts[best_idx]); |
685 | 685 |
} |
... | ... |
@@ -156,7 +156,7 @@ AVFilter avfilter_vsink_buffer = { |
156 | 156 |
.min_perms = AV_PERM_READ, |
157 | 157 |
.needs_fifo = 1 }, |
158 | 158 |
{ .name = NULL }}, |
159 |
- .outputs = (const AVFilterPad[]) {{ .name = NULL }}, |
|
159 |
+ .outputs = NULL, |
|
160 | 160 |
}; |
161 | 161 |
|
162 | 162 |
AVFilter avfilter_asink_abuffer = { |
... | ... |
@@ -175,5 +175,5 @@ AVFilter avfilter_asink_abuffer = { |
175 | 175 |
.min_perms = AV_PERM_READ, |
176 | 176 |
.needs_fifo = 1 }, |
177 | 177 |
{ .name = NULL }}, |
178 |
- .outputs = (const AVFilterPad[]) {{ .name = NULL }}, |
|
178 |
+ .outputs = NULL, |
|
179 | 179 |
}; |
... | ... |
@@ -94,7 +94,7 @@ int av_buffersrc_add_frame(AVFilterContext *buffer_src, |
94 | 94 |
return ret; |
95 | 95 |
} |
96 | 96 |
|
97 |
-int av_buffersrc_write_frame(AVFilterContext *buffer_filter, AVFrame *frame) |
|
97 |
+int av_buffersrc_write_frame(AVFilterContext *buffer_filter, const AVFrame *frame) |
|
98 | 98 |
{ |
99 | 99 |
return av_buffersrc_add_frame(buffer_filter, frame, 0); |
100 | 100 |
} |
... | ... |
@@ -409,7 +409,7 @@ AVFilter avfilter_vsrc_buffer = { |
409 | 409 |
.init = init_video, |
410 | 410 |
.uninit = uninit, |
411 | 411 |
|
412 |
- .inputs = (const AVFilterPad[]) {{ .name = NULL }}, |
|
412 |
+ .inputs = NULL, |
|
413 | 413 |
.outputs = (const AVFilterPad[]) {{ .name = "default", |
414 | 414 |
.type = AVMEDIA_TYPE_VIDEO, |
415 | 415 |
.request_frame = request_frame, |
... | ... |
@@ -428,7 +428,7 @@ AVFilter avfilter_asrc_abuffer = { |
428 | 428 |
.init = init_audio, |
429 | 429 |
.uninit = uninit, |
430 | 430 |
|
431 |
- .inputs = (const AVFilterPad[]) {{ .name = NULL }}, |
|
431 |
+ .inputs = NULL, |
|
432 | 432 |
.outputs = (const AVFilterPad[]) {{ .name = "default", |
433 | 433 |
.type = AVMEDIA_TYPE_AUDIO, |
434 | 434 |
.request_frame = request_frame, |
... | ... |
@@ -90,6 +90,6 @@ int av_buffersrc_buffer(AVFilterContext *s, AVFilterBufferRef *buf); |
90 | 90 |
* @warning frame data will be memcpy()ed, which may be a big performance |
91 | 91 |
* hit. Use av_buffersrc_buffer() to avoid copying the data. |
92 | 92 |
*/ |
93 |
-int av_buffersrc_write_frame(AVFilterContext *s, AVFrame *frame); |
|
93 |
+int av_buffersrc_write_frame(AVFilterContext *s, const AVFrame *frame); |
|
94 | 94 |
|
95 | 95 |
#endif /* AVFILTER_BUFFERSRC_H */ |
... | ... |
@@ -133,7 +133,7 @@ AVFilter avfilter_vf_split = { |
133 | 133 |
.draw_slice = draw_slice, |
134 | 134 |
.end_frame = end_frame, }, |
135 | 135 |
{ .name = NULL}}, |
136 |
- .outputs = (const AVFilterPad[]) {{ .name = NULL}}, |
|
136 |
+ .outputs = NULL, |
|
137 | 137 |
}; |
138 | 138 |
|
139 | 139 |
static int filter_samples(AVFilterLink *inlink, AVFilterBufferRef *samplesref) |
... | ... |
@@ -169,5 +169,5 @@ AVFilter avfilter_af_asplit = { |
169 | 169 |
.get_audio_buffer = ff_null_get_audio_buffer, |
170 | 170 |
.filter_samples = filter_samples }, |
171 | 171 |
{ .name = NULL }}, |
172 |
- .outputs = (const AVFilterPad[]) {{ .name = NULL }}, |
|
172 |
+ .outputs = NULL, |
|
173 | 173 |
}; |
... | ... |
@@ -611,7 +611,7 @@ AVFilter avfilter_avsrc_movie = { |
611 | 611 |
.uninit = movie_uninit, |
612 | 612 |
.query_formats = movie_query_formats, |
613 | 613 |
|
614 |
- .inputs = (const AVFilterPad[]) {{ .name = NULL }}, |
|
614 |
+ .inputs = NULL, |
|
615 | 615 |
.outputs = (const AVFilterPad[]) {{ .name = NULL }}, |
616 | 616 |
.priv_class = &movie_class, |
617 | 617 |
}; |
... | ... |
@@ -488,7 +488,7 @@ AVFilter avfilter_vsrc_frei0r_src = { |
488 | 488 |
|
489 | 489 |
.query_formats = query_formats, |
490 | 490 |
|
491 |
- .inputs = (const AVFilterPad[]) {{ .name = NULL}}, |
|
491 |
+ .inputs = NULL, |
|
492 | 492 |
|
493 | 493 |
.outputs = (const AVFilterPad[]) {{ .name = "default", |
494 | 494 |
.type = AVMEDIA_TYPE_VIDEO, |
... | ... |
@@ -533,7 +533,7 @@ AVFilter avfilter_vsrc_testsrc = { |
533 | 533 |
|
534 | 534 |
.query_formats = test_query_formats, |
535 | 535 |
|
536 |
- .inputs = (const AVFilterPad[]) {{ .name = NULL}}, |
|
536 |
+ .inputs = NULL, |
|
537 | 537 |
|
538 | 538 |
.outputs = (const AVFilterPad[]) {{ .name = "default", |
539 | 539 |
.type = AVMEDIA_TYPE_VIDEO, |
... | ... |
@@ -647,7 +647,7 @@ AVFilter avfilter_vsrc_rgbtestsrc = { |
647 | 647 |
|
648 | 648 |
.query_formats = rgbtest_query_formats, |
649 | 649 |
|
650 |
- .inputs = (const AVFilterPad[]) {{ .name = NULL}}, |
|
650 |
+ .inputs = NULL, |
|
651 | 651 |
|
652 | 652 |
.outputs = (const AVFilterPad[]) {{ .name = "default", |
653 | 653 |
.type = AVMEDIA_TYPE_VIDEO, |