Merge commit '23aae62c2cb4504a09ceb8cd0cabc1c8b260f521'

* 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>
This commit is contained in:
Michael Niedermayer 2012-09-18 14:30:31 +02:00
commit 91af76099e
26 changed files with 54 additions and 53 deletions

View File

@ -295,7 +295,7 @@ static int configure_output_video_filter(FilterGraph *fg, OutputFilter *ofilter,
snprintf(name, sizeof(name), "output stream %d:%d", ost->file_index, ost->index);
ret = avfilter_graph_create_filter(&ofilter->filter,
avfilter_get_by_name("ffbuffersink"),
name, NULL, NULL/*buffersink_params*/, fg->graph);
name, NULL, NULL, fg->graph);
av_freep(&buffersink_params);
if (ret < 0)

View File

@ -325,8 +325,6 @@ void avcodec_register_all(void)
REGISTER_DECODER (SHORTEN, shorten);
REGISTER_DECODER (SIPR, sipr);
REGISTER_DECODER (SMACKAUD, smackaud);
REGISTER_ENCDEC (SONIC, sonic);
REGISTER_ENCODER (SONIC_LS, sonic_ls);
REGISTER_DECODER (TRUEHD, truehd);
REGISTER_DECODER (TRUESPEECH, truespeech);
REGISTER_DECODER (TTA, tta);

View File

@ -651,10 +651,10 @@ static int read_var_block_data(ALSDecContext *ctx, ALSBlockData *bd)
for (k = 1; k < sub_blocks; k++)
s[k] = s[k - 1] + decode_rice(gb, 0);
}
for (k = 0; k < sub_blocks; k++)
for (k = 1; k < sub_blocks; k++)
if (s[k] > 32) {
av_log(avctx, AV_LOG_ERROR, "k invalid for rice code.\n");
return -1;
return AVERROR_INVALIDDATA;
}
if (get_bits1(gb))

View File

@ -37,9 +37,9 @@ static av_cold int ass_encode_init(AVCodecContext *avctx)
}
static int ass_encode_frame(AVCodecContext *avctx,
unsigned char *buf, int bufsize, void *data)
unsigned char *buf, int bufsize,
const AVSubtitle *sub)
{
AVSubtitle *sub = data;
int i, len, total_len = 0;
for (i=0; i<sub->num_rects; i++) {
@ -67,5 +67,5 @@ AVCodec ff_ass_encoder = {
.type = AVMEDIA_TYPE_SUBTITLE,
.id = AV_CODEC_ID_SSA,
.init = ass_encode_init,
.encode = ass_encode_frame,
.encode_sub = ass_encode_frame,
};

View File

@ -3099,6 +3099,8 @@ typedef struct AVProfile {
typedef struct AVCodecDefault AVCodecDefault;
struct AVSubtitle;
/**
* AVCodec.
*/
@ -3171,7 +3173,8 @@ typedef struct AVCodec {
void (*init_static_data)(struct AVCodec *codec);
int (*init)(AVCodecContext *);
int (*encode)(AVCodecContext *, uint8_t *buf, int buf_size, void *data);
int (*encode_sub)(AVCodecContext *, uint8_t *buf, int buf_size,
const struct AVSubtitle *sub);
/**
* Encode data to an AVPacket.
*

View File

@ -248,7 +248,7 @@ static void dvb_encode_rle8(uint8_t **pq,
}
static int encode_dvb_subtitles(DVBSubtitleContext *s,
uint8_t *outbuf, AVSubtitle *h)
uint8_t *outbuf, const AVSubtitle *h)
{
uint8_t *q, *pseg_len;
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,
}
static int dvbsub_encode(AVCodecContext *avctx,
unsigned char *buf, int buf_size, void *data)
unsigned char *buf, int buf_size,
const AVSubtitle *sub)
{
DVBSubtitleContext *s = avctx->priv_data;
AVSubtitle *sub = data;
int ret;
ret = encode_dvb_subtitles(s, buf, sub);
@ -459,6 +459,6 @@ AVCodec ff_dvbsub_encoder = {
.type = AVMEDIA_TYPE_SUBTITLE,
.id = AV_CODEC_ID_DVB_SUBTITLE,
.priv_data_size = sizeof(DVBSubtitleContext),
.encode = dvbsub_encode,
.encode_sub = dvbsub_encode,
.long_name = NULL_IF_CONFIG_SMALL("DVB subtitles"),
};

View File

@ -416,10 +416,10 @@ static int dvdsub_init(AVCodecContext *avctx)
}
static int dvdsub_encode(AVCodecContext *avctx,
unsigned char *buf, int buf_size, void *data)
unsigned char *buf, int buf_size,
const AVSubtitle *sub)
{
//DVDSubtitleContext *s = avctx->priv_data;
AVSubtitle *sub = data;
int ret;
ret = encode_dvd_subtitles(avctx, buf, buf_size, sub);
@ -431,7 +431,7 @@ AVCodec ff_dvdsub_encoder = {
.type = AVMEDIA_TYPE_SUBTITLE,
.id = AV_CODEC_ID_DVD_SUBTITLE,
.init = dvdsub_init,
.encode = dvdsub_encode,
.encode_sub = dvdsub_encode,
.long_name = NULL_IF_CONFIG_SMALL("DVD subtitles"),
.priv_data_size = sizeof(DVDSubtitleContext),
};

View File

@ -104,10 +104,9 @@ static const ASSCodesCallbacks mov_text_callbacks = {
};
static int mov_text_encode_frame(AVCodecContext *avctx, unsigned char *buf,
int bufsize, void *data)
int bufsize, const AVSubtitle *sub)
{
MovTextContext *s = avctx->priv_data;
AVSubtitle *sub = data;
ASSDialog *dialog;
int i, len, num;
@ -157,6 +156,6 @@ AVCodec ff_movtext_encoder = {
.id = AV_CODEC_ID_MOV_TEXT,
.priv_data_size = sizeof(MovTextContext),
.init = mov_text_encode_init,
.encode = mov_text_encode_frame,
.encode_sub = mov_text_encode_frame,
.close = mov_text_encode_close,
};

View File

@ -233,10 +233,9 @@ static const ASSCodesCallbacks srt_callbacks = {
};
static int srt_encode_frame(AVCodecContext *avctx,
unsigned char *buf, int bufsize, void *data)
unsigned char *buf, int bufsize, const AVSubtitle *sub)
{
SRTContext *s = avctx->priv_data;
AVSubtitle *sub = data;
ASSDialog *dialog;
int i, len, num;
@ -299,7 +298,7 @@ AVCodec ff_srt_encoder = {
.id = AV_CODEC_ID_SRT,
.priv_data_size = sizeof(SRTContext),
.init = srt_encode_init,
.encode = srt_encode_frame,
.encode_sub = srt_encode_frame,
.close = srt_encode_close,
};
#endif
@ -312,7 +311,7 @@ AVCodec ff_subrip_encoder = {
.id = AV_CODEC_ID_SUBRIP,
.priv_data_size = sizeof(SRTContext),
.init = srt_encode_init,
.encode = srt_encode_frame,
.encode_sub = srt_encode_frame,
.close = srt_encode_close,
};
#endif

View File

@ -134,7 +134,7 @@ static void avcodec_init(void)
int av_codec_is_encoder(const AVCodec *codec)
{
return codec && (codec->encode || codec->encode2);
return codec && (codec->encode_sub || codec->encode2);
}
int av_codec_is_decoder(const AVCodec *codec)
@ -804,7 +804,7 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code
goto end;
}
if (codec->priv_class) {
*(const AVClass**)avctx->priv_data= codec->priv_class;
*(const AVClass**)avctx->priv_data = codec->priv_class;
av_opt_set_defaults(avctx->priv_data);
}
}
@ -1407,7 +1407,7 @@ int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size,
return -1;
}
ret = avctx->codec->encode(avctx, buf, buf_size, (void *)(intptr_t)sub);
ret = avctx->codec->encode_sub(avctx, buf, buf_size, sub);
avctx->frame_number++;
return ret;
}

View File

@ -111,9 +111,8 @@ static int make_tc(uint64_t ms, int *tc)
}
static int xsub_encode(AVCodecContext *avctx, unsigned char *buf,
int bufsize, void *data)
int bufsize, const AVSubtitle *h)
{
AVSubtitle *h = data;
uint64_t startTime = h->pts / 1000; // FIXME: need better solution...
uint64_t endTime = startTime + h->end_display_time - h->start_display_time;
int start_tc[4], end_tc[4];
@ -211,10 +210,10 @@ static av_cold int xsub_encoder_init(AVCodecContext *avctx)
}
AVCodec ff_xsub_encoder = {
.name = "xsub",
.type = AVMEDIA_TYPE_SUBTITLE,
.id = AV_CODEC_ID_XSUB,
.init = xsub_encoder_init,
.encode = xsub_encode,
.long_name = NULL_IF_CONFIG_SMALL("DivX subtitles (XSUB)"),
.name = "xsub",
.type = AVMEDIA_TYPE_SUBTITLE,
.id = AV_CODEC_ID_XSUB,
.init = xsub_encoder_init,
.encode_sub = xsub_encode,
.long_name = NULL_IF_CONFIG_SMALL("DivX subtitles (XSUB)"),
};

View File

@ -549,7 +549,7 @@ AVFilter avfilter_af_amix = {
.uninit = uninit,
.query_formats = query_formats,
.inputs = (const AVFilterPad[]) {{ .name = NULL}},
.inputs = NULL,
.outputs = (const AVFilterPad[]) {{ .name = "default",
.type = AVMEDIA_TYPE_AUDIO,
.config_props = config_output,

View File

@ -142,6 +142,6 @@ AVFilter avfilter_af_channelsplit = {
.type = AVMEDIA_TYPE_AUDIO,
.filter_samples = filter_samples, },
{ NULL }},
.outputs = (const AVFilterPad[]){{ NULL }},
.outputs = NULL,
.priv_class = &channelsplit_class,
};

View File

@ -494,7 +494,7 @@ AVFilter avfilter_af_join = {
.uninit = join_uninit,
.query_formats = join_query_formats,
.inputs = (const AVFilterPad[]){{ NULL }},
.inputs = NULL,
.outputs = (const AVFilterPad[]){{ .name = "default",
.type = AVMEDIA_TYPE_AUDIO,
.config_props = join_config_output,

View File

@ -41,5 +41,5 @@ AVFilter avfilter_asink_anullsink = {
},
{ .name = NULL},
},
.outputs = (const AVFilterPad[]) {{ .name = NULL }},
.outputs = NULL,
};

View File

@ -126,7 +126,7 @@ AVFilter avfilter_asrc_anullsrc = {
.init = init,
.priv_size = sizeof(ANullContext),
.inputs = (const AVFilterPad[]) {{ .name = NULL}},
.inputs = NULL,
.outputs = (const AVFilterPad[]) {{ .name = "default",
.type = AVMEDIA_TYPE_AUDIO,

View File

@ -436,6 +436,9 @@ static int pad_count(const AVFilterPad *pads)
{
int count;
if (!pads)
return 0;
for(count = 0; pads->name; count ++) pads ++;
return count;
}

View File

@ -679,7 +679,7 @@ static void swap_channel_layouts_on_filter(AVFilterContext *filter)
best_count_diff = count_diff;
}
}
av_assert1(best_idx>=0);
av_assert0(best_idx >= 0);
FFSWAP(uint64_t, outlink->in_channel_layouts->channel_layouts[0],
outlink->in_channel_layouts->channel_layouts[best_idx]);
}

View File

@ -156,7 +156,7 @@ AVFilter avfilter_vsink_buffer = {
.min_perms = AV_PERM_READ,
.needs_fifo = 1 },
{ .name = NULL }},
.outputs = (const AVFilterPad[]) {{ .name = NULL }},
.outputs = NULL,
};
AVFilter avfilter_asink_abuffer = {
@ -175,5 +175,5 @@ AVFilter avfilter_asink_abuffer = {
.min_perms = AV_PERM_READ,
.needs_fifo = 1 },
{ .name = NULL }},
.outputs = (const AVFilterPad[]) {{ .name = NULL }},
.outputs = NULL,
};

View File

@ -94,7 +94,7 @@ int av_buffersrc_add_frame(AVFilterContext *buffer_src,
return ret;
}
int av_buffersrc_write_frame(AVFilterContext *buffer_filter, AVFrame *frame)
int av_buffersrc_write_frame(AVFilterContext *buffer_filter, const AVFrame *frame)
{
return av_buffersrc_add_frame(buffer_filter, frame, 0);
}
@ -409,7 +409,7 @@ AVFilter avfilter_vsrc_buffer = {
.init = init_video,
.uninit = uninit,
.inputs = (const AVFilterPad[]) {{ .name = NULL }},
.inputs = NULL,
.outputs = (const AVFilterPad[]) {{ .name = "default",
.type = AVMEDIA_TYPE_VIDEO,
.request_frame = request_frame,
@ -428,7 +428,7 @@ AVFilter avfilter_asrc_abuffer = {
.init = init_audio,
.uninit = uninit,
.inputs = (const AVFilterPad[]) {{ .name = NULL }},
.inputs = NULL,
.outputs = (const AVFilterPad[]) {{ .name = "default",
.type = AVMEDIA_TYPE_AUDIO,
.request_frame = request_frame,

View File

@ -90,6 +90,6 @@ int av_buffersrc_buffer(AVFilterContext *s, AVFilterBufferRef *buf);
* @warning frame data will be memcpy()ed, which may be a big performance
* hit. Use av_buffersrc_buffer() to avoid copying the data.
*/
int av_buffersrc_write_frame(AVFilterContext *s, AVFrame *frame);
int av_buffersrc_write_frame(AVFilterContext *s, const AVFrame *frame);
#endif /* AVFILTER_BUFFERSRC_H */

View File

@ -133,7 +133,7 @@ AVFilter avfilter_vf_split = {
.draw_slice = draw_slice,
.end_frame = end_frame, },
{ .name = NULL}},
.outputs = (const AVFilterPad[]) {{ .name = NULL}},
.outputs = NULL,
};
static int filter_samples(AVFilterLink *inlink, AVFilterBufferRef *samplesref)
@ -169,5 +169,5 @@ AVFilter avfilter_af_asplit = {
.get_audio_buffer = ff_null_get_audio_buffer,
.filter_samples = filter_samples },
{ .name = NULL }},
.outputs = (const AVFilterPad[]) {{ .name = NULL }},
.outputs = NULL,
};

View File

@ -611,7 +611,7 @@ AVFilter avfilter_avsrc_movie = {
.uninit = movie_uninit,
.query_formats = movie_query_formats,
.inputs = (const AVFilterPad[]) {{ .name = NULL }},
.inputs = NULL,
.outputs = (const AVFilterPad[]) {{ .name = NULL }},
.priv_class = &movie_class,
};

View File

@ -488,7 +488,7 @@ AVFilter avfilter_vsrc_frei0r_src = {
.query_formats = query_formats,
.inputs = (const AVFilterPad[]) {{ .name = NULL}},
.inputs = NULL,
.outputs = (const AVFilterPad[]) {{ .name = "default",
.type = AVMEDIA_TYPE_VIDEO,

View File

@ -45,5 +45,5 @@ AVFilter avfilter_vsink_nullsink = {
},
{ .name = NULL},
},
.outputs = (const AVFilterPad[]) {{ .name = NULL }},
.outputs = NULL,
};

View File

@ -533,7 +533,7 @@ AVFilter avfilter_vsrc_testsrc = {
.query_formats = test_query_formats,
.inputs = (const AVFilterPad[]) {{ .name = NULL}},
.inputs = NULL,
.outputs = (const AVFilterPad[]) {{ .name = "default",
.type = AVMEDIA_TYPE_VIDEO,
@ -647,7 +647,7 @@ AVFilter avfilter_vsrc_rgbtestsrc = {
.query_formats = rgbtest_query_formats,
.inputs = (const AVFilterPad[]) {{ .name = NULL}},
.inputs = NULL,
.outputs = (const AVFilterPad[]) {{ .name = "default",
.type = AVMEDIA_TYPE_VIDEO,