summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-06-18 04:40:18 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-06-18 05:10:38 +0200
commit2905e3ff6462431d55f89614b24e2a407707c82a (patch)
treed482d458a449228c8475942117c7eb81ec8934c6 /libavcodec
parent44d1b4088f2959912a27ffbffc5884db1b35a645 (diff)
parent78440c007cd310bb27ac2af5fb7ea5b7555efc84 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: lavc: add opt_find to AVCodecContext class. h264: Complexify frame num gap shortening code intreadwrite.h: fix AV_RL32/AV_RB32 signedness. Fix decoding of mpegts streams with h264 video that does *NOT* have b frames Add minor bumps and APIChanges entries for lavf private options. ffmpeg: deprecate -vc and -tvstd ffmpeg: use new avformat_open_* API. ffserver: use new avformat_open_* API. ffprobe: use new avformat_open_* API. ffplay: use new avformat_open_* API. cmdutils: add opt_default2(). dict: add AV_DICT_APPEND flag. lavf: add avformat_write_header() as a replacement for av_write_header(). Deprecate av_open_input_* and remove their uses. lavf: add avformat_open_input() as a replacement for av_open_input_* AVOptions: add av_opt_find() as a replacement for av_find_opt. AVOptions: add av_opt_set_dict() mapping a dictionary struct to a context. ffmpeg: don't abuse a global for passing frame size from input to output ffmpeg: don't abuse a global for passing pixel format from input to output ffmpeg: initialise encoders earlier. Conflicts: cmdutils.c doc/APIchanges ffmpeg.c ffplay.c ffprobe.c libavcodec/h264.c libavformat/avformat.h libavformat/utils.c libavformat/version.h libavutil/avutil.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/h264.c4
-rw-r--r--libavcodec/options.c21
2 files changed, 22 insertions, 3 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 0919c12b92..b88622d432 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -3784,8 +3784,8 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){
init_get_bits(&s->gb, ptr, bit_length);
ff_h264_decode_seq_parameter_set(h);
- if(s->flags& CODEC_FLAG_LOW_DELAY ||
- (h->sps.bitstream_restriction_flag && !h->sps.num_reorder_frames))
+ if (s->flags& CODEC_FLAG_LOW_DELAY ||
+ (h->sps.bitstream_restriction_flag && !h->sps.num_reorder_frames))
s->low_delay=1;
if(avctx->has_b_frames < 2)
diff --git a/libavcodec/options.c b/libavcodec/options.c
index 78a7bc8a40..b6ad5d8763 100644
--- a/libavcodec/options.c
+++ b/libavcodec/options.c
@@ -37,6 +37,25 @@ static const char* context_to_name(void* ptr) {
return "NULL";
}
+static const AVOption *opt_find(void *obj, const char *name, const char *unit, int opt_flags, int search_flags)
+{
+ AVCodecContext *s = obj;
+ AVCodec *c = NULL;
+
+ if (s->priv_data) {
+ if (s->codec->priv_class)
+ return av_opt_find(s->priv_data, name, unit, opt_flags, search_flags);
+ return NULL;
+ }
+
+ while ((c = av_codec_next(c))) {
+ const AVOption *o;
+ if (c->priv_class && (o = av_opt_find(&c->priv_class, name, unit, opt_flags, search_flags)))
+ return o;
+ }
+ return NULL;
+}
+
#define OFFSET(x) offsetof(AVCodecContext,x)
#define DEFAULT 0 //should be NAN but it does not work as it is not a constant in glibc as required by ANSI/ISO C
//these names are too long to be readable
@@ -457,7 +476,7 @@ static const AVOption options[]={
#undef D
#undef DEFAULT
-static const AVClass av_codec_context_class = { "AVCodecContext", context_to_name, options, LIBAVUTIL_VERSION_INT, OFFSET(log_level_offset) };
+static const AVClass av_codec_context_class = { "AVCodecContext", context_to_name, options, LIBAVUTIL_VERSION_INT, OFFSET(log_level_offset), .opt_find = opt_find};
void avcodec_get_context_defaults2(AVCodecContext *s, enum AVMediaType codec_type){
int flags=0;