Skip to content

Commit

Permalink
Merge remote-tracking branch 'qatar/master'
Browse files Browse the repository at this point in the history
* qatar/master:
  presets: rename presets directory
  lavc: make avcodec_get_context_defaults3 "officially" public
  lavf: replace av_new_stream->avformat_new_stream part II.
  lavf,lavd: replace av_new_stream->avformat_new_stream part I.
  lavf: add avformat_new_stream as a replacement for av_new_stream.
  Use correct scaling table for bwd-pred MVs in second B-field
  Ut Video decoder
  Makefile: change presets extension to .avpreset
  lavfi: add rgbtestsrc source, ported from MPlayer libmpcodecs
  lavfi: add testsrc source
  AVOptions: add documentation.
  presets: update libx264 ffpresets

Conflicts:
	Changelog
	doc/APIchanges
	doc/ffmpeg.texi
	ffpresets/libx264-ipod320.ffpreset
	ffpresets/libx264-ipod640.ffpreset
	ffserver.c
	libavcodec/avcodec.h
	libavcodec/options.c
	libavcodec/version.h
	libavdevice/libdc1394.c
	libavfilter/avfilter.h
	libavfilter/vsrc_testsrc.c
	libavformat/flvdec.c
	libavformat/riff.c
	libavformat/version.h
	libavformat/wtv.c

Merged-by: Michael Niedermayer <[email protected]>
  • Loading branch information
michaelni committed Oct 20, 2011
2 parents 9ef7143 + 8096fdf commit d049257
Show file tree
Hide file tree
Showing 181 changed files with 1,021 additions and 256 deletions.
1 change: 1 addition & 0 deletions Changelog
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ easier to use. The changes are:
- VC-1 interlaced decoding
- libutvideo wrapper (--enable-libutvideo)
- aevalsrc audio source added
- Ut Video decoder


version 0.8:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ FFLIBS-$(CONFIG_SWSCALE) += swscale

FFLIBS := avutil

DATA_FILES := $(wildcard $(SRC_PATH)/ffpresets/*.ffpreset)
DATA_FILES := $(wildcard $(SRC_PATH)/presets/*.ffpreset)

SKIPHEADERS = cmdutils_common_opts.h

Expand Down
5 changes: 4 additions & 1 deletion avconv.c
Original file line number Diff line number Diff line change
Expand Up @@ -3137,7 +3137,7 @@ static int get_preset_file_2(const char *preset_name, const char *codec_name, AV
static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, enum AVMediaType type)
{
OutputStream *ost;
AVStream *st = av_new_stream(oc, oc->nb_streams < o->nb_streamid_map ? o->streamid_map[oc->nb_streams] : 0);
AVStream *st = avformat_new_stream(oc, NULL);
int idx = oc->nb_streams - 1, ret = 0;
int64_t max_frames = INT64_MAX;
char *bsf = NULL, *next, *codec_tag = NULL;
Expand All @@ -3151,6 +3151,9 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e
exit_program(1);
}

if (oc->nb_streams - 1 < o->nb_streamid_map)
st->id = o->streamid_map[oc->nb_streams - 1];

output_streams = grow_array(output_streams, sizeof(*output_streams), &nb_output_streams,
nb_output_streams + 1);
ost = &output_streams[nb_output_streams - 1];
Expand Down
3 changes: 3 additions & 0 deletions doc/APIchanges
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ API changes, most recent first:
2011-10-20 - b35e9e1 - lavu 51.22.0
Add av_strtok() to avstring.h.

2011-10-xx - xxxxxxx - lavf 53.10.0
Add avformat_new_stream(). Deprecate av_new_stream().

2011-xx-xx - xxxxxxx - lavf 53.9.0
Add AVFMT_NO_BYTE_SEEK AVInputFormat flag.

Expand Down
2 changes: 1 addition & 1 deletion doc/avconv.texi
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ A preset file contains a sequence of @var{option=value} pairs, one for
each line, specifying a sequence of options which can be specified also on
the command line. Lines starting with the hash ('#') character are ignored and
are used to provide comments. Empty lines are also ignored. Check the
@file{ffpresets} directory in the Libav source tree for examples.
@file{presets} directory in the Libav source tree for examples.

Preset files are specified with the @code{pre} option, this option takes a
preset name as input. Avconv searches for a file named @var{preset_name}.avpreset in
Expand Down
2 changes: 1 addition & 1 deletion doc/examples/muxing.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ static AVStream *add_video_stream(AVFormatContext *oc, enum CodecID codec_id)
AVCodecContext *c;
AVStream *st;

st = av_new_stream(oc, 0);
st = avformat_new_stream(oc, NULL);
if (!st) {
fprintf(stderr, "Could not alloc stream\n");
exit(1);
Expand Down
2 changes: 1 addition & 1 deletion doc/ffmpeg.texi
Original file line number Diff line number Diff line change
Expand Up @@ -873,7 +873,7 @@ A preset file contains a sequence of @var{option}=@var{value} pairs,
one for each line, specifying a sequence of options which would be
awkward to specify on the command line. Lines starting with the hash
('#') character are ignored and are used to provide comments. Check
the @file{ffpresets} directory in the FFmpeg source tree for examples.
the @file{presets} directory in the FFmpeg source tree for examples.

Preset files are specified with the @code{vpre}, @code{apre},
@code{spre}, and @code{fpre} options. The @code{fpre} option takes the
Expand Down
1 change: 1 addition & 0 deletions doc/general.texi
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,7 @@ following image formats are supported:
@tab encoding supported through external library libtheora
@item Tiertex Limited SEQ video @tab @tab X
@tab Codec used in DOS CD-ROM FlashBack game.
@item Ut Video @tab @tab X
@item V210 Quicktime Uncompressed 4:2:2 10-bit @tab X @tab X
@item VMware Screen Codec / VMware Video @tab @tab X
@tab Codec used in videos captured by VMware.
Expand Down
5 changes: 4 additions & 1 deletion ffmpeg.c
Original file line number Diff line number Diff line change
Expand Up @@ -3252,7 +3252,7 @@ static int get_preset_file_2(const char *preset_name, const char *codec_name, AV
static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, enum AVMediaType type)
{
OutputStream *ost;
AVStream *st = av_new_stream(oc, oc->nb_streams < o->nb_streamid_map ? o->streamid_map[oc->nb_streams] : 0);
AVStream *st = avformat_new_stream(oc, NULL);
int idx = oc->nb_streams - 1, ret = 0;
int64_t max_frames = INT64_MAX;
char *bsf = NULL, *next, *codec_tag = NULL;
Expand All @@ -3266,6 +3266,9 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e
exit_program(1);
}

if (oc->nb_streams - 1 < o->nb_streamid_map)
st->id = o->streamid_map[oc->nb_streams - 1];

output_streams = grow_array(output_streams, sizeof(*output_streams), &nb_output_streams,
nb_output_streams + 1);
ost = &output_streams[nb_output_streams - 1];
Expand Down
8 changes: 0 additions & 8 deletions ffpresets/libx264-ipod320.ffpreset

This file was deleted.

9 changes: 0 additions & 9 deletions ffpresets/libx264-ipod640.ffpreset

This file was deleted.

1 change: 1 addition & 0 deletions ffserver.c
Original file line number Diff line number Diff line change
Expand Up @@ -4236,6 +4236,7 @@ static int parse_ffconfig(const char *filename)
stream->fmt = ffserver_guess_format(NULL, stream->filename, NULL);
avcodec_get_context_defaults2(&video_enc, AVMEDIA_TYPE_VIDEO);
avcodec_get_context_defaults2(&audio_enc, AVMEDIA_TYPE_AUDIO);

audio_id = CODEC_ID_NONE;
video_id = CODEC_ID_NONE;
if (stream->fmt) {
Expand Down
1 change: 1 addition & 0 deletions libavcodec/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ OBJS-$(CONFIG_TTA_DECODER) += tta.o
OBJS-$(CONFIG_TWINVQ_DECODER) += twinvq.o celp_math.o
OBJS-$(CONFIG_TXD_DECODER) += txd.o s3tc.o
OBJS-$(CONFIG_ULTI_DECODER) += ulti.o
OBJS-$(CONFIG_UTVIDEO_DECODER) += utvideo.o
OBJS-$(CONFIG_V210_DECODER) += v210dec.o
OBJS-$(CONFIG_V210_ENCODER) += v210enc.o
OBJS-$(CONFIG_V210X_DECODER) += v210x.o
Expand Down
1 change: 1 addition & 0 deletions libavcodec/allcodecs.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ void avcodec_register_all(void)
REGISTER_DECODER (TSCC, tscc);
REGISTER_DECODER (TXD, txd);
REGISTER_DECODER (ULTI, ulti);
REGISTER_DECODER (UTVIDEO, utvideo);
REGISTER_ENCDEC (V210, v210);
REGISTER_DECODER (V210X, v210x);
REGISTER_DECODER (VB, vb);
Expand Down
17 changes: 15 additions & 2 deletions libavcodec/avcodec.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ enum CodecID {
CODEC_ID_VC1IMAGE,
CODEC_ID_8SVX_RAW,
CODEC_ID_G2M,
CODEC_ID_UTVIDEO_DEPRECATED,
CODEC_ID_UTVIDEO = 0x800,

/* various PCM "codecs" */
Expand Down Expand Up @@ -3707,19 +3708,31 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode);
*/
const char *av_get_profile_name(const AVCodec *codec, int profile);

#if FF_API_ALLOC_CONTEXT
/**
* Set the fields of the given AVCodecContext to default values.
*
* @param s The AVCodecContext of which the fields should be set to default values.
* @deprecated use avcodec_get_context_defaults3
*/
attribute_deprecated
void avcodec_get_context_defaults(AVCodecContext *s);

/** THIS FUNCTION IS NOT YET PART OF THE PUBLIC API!
* we WILL change its arguments and name a few times! */
attribute_deprecated
void avcodec_get_context_defaults2(AVCodecContext *s, enum AVMediaType);
#endif

/** THIS FUNCTION IS NOT YET PART OF THE PUBLIC API!
* we WILL change its arguments and name a few times! */
/**
* Set the fields of the given AVCodecContext to default values corresponding
* to the given codec (defaults may be codec-dependent).
*
* Do not call this function if a non-NULL codec has been passed
* to avcodec_alloc_context3() that allocated this AVCodecContext.
* If codec is non-NULL, it is illegal to call avcodec_open2() with a
* different codec on this AVCodecContext.
*/
int avcodec_get_context_defaults3(AVCodecContext *s, AVCodec *codec);

#if FF_API_ALLOC_CONTEXT
Expand Down
48 changes: 25 additions & 23 deletions libavcodec/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -532,37 +532,41 @@ static const AVClass av_codec_context_class = {
.child_class_next = codec_child_class_next,
};

#if FF_API_ALLOC_CONTEXT
void avcodec_get_context_defaults2(AVCodecContext *s, enum AVMediaType codec_type){
AVCodec c= {0};
c.type= codec_type;
avcodec_get_context_defaults3(s, &c);
}
#endif

int avcodec_get_context_defaults3(AVCodecContext *s, AVCodec *codec){
int flags=0;
memset(s, 0, sizeof(AVCodecContext));

s->av_class= &av_codec_context_class;
s->av_class = &av_codec_context_class;

s->codec_type = codec_type;
if(codec_type == AVMEDIA_TYPE_AUDIO)
s->codec_type = codec ? codec->type : AVMEDIA_TYPE_UNKNOWN;
if(s->codec_type == AVMEDIA_TYPE_AUDIO)
flags= AV_OPT_FLAG_AUDIO_PARAM;
else if(codec_type == AVMEDIA_TYPE_VIDEO)
else if(s->codec_type == AVMEDIA_TYPE_VIDEO)
flags= AV_OPT_FLAG_VIDEO_PARAM;
else if(codec_type == AVMEDIA_TYPE_SUBTITLE)
else if(s->codec_type == AVMEDIA_TYPE_SUBTITLE)
flags= AV_OPT_FLAG_SUBTITLE_PARAM;
av_opt_set_defaults2(s, flags, flags);

s->time_base= (AVRational){0,1};
s->get_buffer= avcodec_default_get_buffer;
s->release_buffer= avcodec_default_release_buffer;
s->get_format= avcodec_default_get_format;
s->execute= avcodec_default_execute;
s->execute2= avcodec_default_execute2;
s->sample_aspect_ratio= (AVRational){0,1};
s->pix_fmt= PIX_FMT_NONE;
s->sample_fmt= AV_SAMPLE_FMT_NONE;

s->reget_buffer= avcodec_default_reget_buffer;
s->reordered_opaque= AV_NOPTS_VALUE;
}

int avcodec_get_context_defaults3(AVCodecContext *s, AVCodec *codec){
avcodec_get_context_defaults2(s, codec ? codec->type : AVMEDIA_TYPE_UNKNOWN);
s->time_base = (AVRational){0,1};
s->get_buffer = avcodec_default_get_buffer;
s->release_buffer = avcodec_default_release_buffer;
s->get_format = avcodec_default_get_format;
s->execute = avcodec_default_execute;
s->execute2 = avcodec_default_execute2;
s->sample_aspect_ratio = (AVRational){0,1};
s->pix_fmt = PIX_FMT_NONE;
s->sample_fmt = AV_SAMPLE_FMT_NONE;

s->reget_buffer = avcodec_default_reget_buffer;
s->reordered_opaque = AV_NOPTS_VALUE;
if(codec && codec->priv_data_size){
if(!s->priv_data){
s->priv_data= av_mallocz(codec->priv_data_size);
Expand Down Expand Up @@ -610,13 +614,11 @@ AVCodecContext *avcodec_alloc_context2(enum AVMediaType codec_type){

return avctx;
}
#endif

void avcodec_get_context_defaults(AVCodecContext *s){
avcodec_get_context_defaults2(s, AVMEDIA_TYPE_UNKNOWN);
}

#if FF_API_ALLOC_CONTEXT
AVCodecContext *avcodec_alloc_context(void){
return avcodec_alloc_context2(AVMEDIA_TYPE_UNKNOWN);
}
Expand Down
Loading

0 comments on commit d049257

Please sign in to comment.