History

Merge remote-tracking branch 'qatar/master'

* qatar/master: doc: Improve references to external URLs. h264: move decode_mb_skip() from h264.h to h.264_mvpred.h ffplay: skip return value of avcodec_decode_video2 / avcodec_decode_subtitle2 dnxhdenc: Replace a forward declaration by the proper #include. h264: move h264_mvpred.h include. pix_fmt: Fix number of bits per component in yuv444p9be lavf: deprecate AVFormatContext.timestamp ffmpeg: merge input_files_ts_scale into InputStream. ffmpeg: don't abuse a global for passing sample format from input to output ffmpeg: don't abuse a global for passing channel layout from input to output ffmpeg: factor common code from new_a/v/s/d_stream to new_output_stream() matroskaenc: make SSA default subtitle codec. oggdec: prevent heap corruption. Conflicts: doc/developer.texi doc/faq.texi doc/general.texi ffmpeg.c ffplay.c

Michael Niedermayer committed 15 years ago

Commit bb258fb2 parents 896e597 2cb6dec19 files · +187 −152Browse files

Unified · Split

19 files
  1. doc/developer.texi +1 −0
  2. doc/faq.texi +6 −4
  3. doc/ffmpeg.texi +2 −2
  4. doc/general.texi +4 −5
  5. doc/protocols.texi +1 −1
  6. ffmpeg.c +57 −74
  7. ffplay.c +6 −8
  8. libavcodec/dnxhdenc.c +1 −2
  9. libavcodec/h264.h +0 −43
  10. libavcodec/h264_mvpred.h +39 −0
  11. libavformat/avformat.h +6 −1
  12. libavformat/dvenc.c +12 −2
  13. libavformat/gxfenc.c +16 −2
  14. libavformat/matroskaenc.c +1 −1
  15. libavformat/movenc.c +13 −1
  16. libavformat/mxfenc.c +13 −1
  17. libavformat/oggdec.c +3 −2
  18. libavformat/version.h +3 −0
  19. libavutil/pixdesc.c +3 −3
doc/developer.texi+1−0
@@ -34,6 +34,7 @@ You can use libavcodec or libavformat in your commercial program, but · 33 unmodified lines
3434 @emph{any patch you make must be published}. The best way to proceed is
3535 to send your patches to the FFmpeg mailing list.
3636
37+
3738 @anchor{Coding Rules}
3839 @section Coding Rules
3940
doc/faq.texi+6−4
@@ -47,7 +47,7 @@ Likely reasons · 46 unmodified lines
4747 @item We are busy and haven't had time yet to read your report or
4848 investigate the issue.
4949 @item You didn't follow @url{http://ffmpeg.org/bugreports.html}.
50−@item You didn't use git HEAD.
50+@item You didn't use git master.
5151 @item You reported a segmentation fault without gdb output.
5252 @item You describe a problem but not how to reproduce it.
5353 @item It's unclear if you use ffmpeg as command line tool or use
@@ -123,7 +123,8 @@ problem and an NP-hard problem... · 69 unmodified lines
123123
124124 @section ffmpeg does not work; what is wrong?
125125
126−Try a @code{make distclean} in the ffmpeg source directory before the build. If this does not help see
126+Try a @code{make distclean} in the ffmpeg source directory before the build.
127+If this does not help see
127128 (@url{http://ffmpeg.org/bugreports.html}).
128129
129130 @section How do I encode single pictures into movies?
@@ -285,7 +286,8 @@ Just create an "input.avs" text file with this single line ... · 155 unmodified lines
285286 ffmpeg -i input.avs
286287 @end example
287288
288−For ANY other help on Avisynth, please visit @url{http://www.avisynth.org/}.
289+For ANY other help on Avisynth, please visit the
290+@uref{http://www.avisynth.org/, Avisynth homepage}.
289291
290292 @section How can I join video files?
291293
@@ -417,7 +419,7 @@ No. These tools are too bloated and they complicate the build. · 125 unmodified lines
417419 FFmpeg is already organized in a highly modular manner and does not need to
418420 be rewritten in a formal object language. Further, many of the developers
419421 favor straight C; it works for them. For more arguments on this matter,
420−read "Programming Religion" at (@url{http://www.tux.org/lkml/#s15}).
422+read @uref{http://www.tux.org/lkml/#s15, "Programming Religion"}.
421423
422424 @section Why are the ffmpeg programs devoid of debugging symbols?
423425
doc/ffmpeg.texi+2−2
@@ -888,8 +888,8 @@ ffmpeg -f oss -i /dev/dsp -f video4linux2 -i /dev/video0 /tmp/out.mpg · 887 unmodified lines
888888 @end example
889889
890890 Note that you must activate the right video source and channel before
891−launching ffmpeg with any TV viewer such as xawtv
892−(@url{http://linux.bytesex.org/xawtv/}) by Gerd Knorr. You also
891+launching ffmpeg with any TV viewer such as
892+@uref{http://linux.bytesex.org/xawtv/, xawtv} by Gerd Knorr. You also
893893 have to set the audio recording levels correctly with a
894894 standard mixer.
895895
doc/general.texi+4−5
@@ -848,7 +848,7 @@ noticeable when running make for a second time (for example in · 847 unmodified lines
848848 @code{make install}).
849849
850850 @item In order to compile FFplay, you must have the MinGW development library
851−of SDL. Get it from @url{http://www.libsdl.org}.
851+of @uref{http://www.libsdl.org/, SDL}.
852852 Edit the @file{bin/sdl-config} script so that it points to the correct prefix
853853 where SDL was installed. Verify that @file{sdl-config} can be launched from
854854 the MSYS command line.
@@ -1044,8 +1044,7 @@ Then configure FFmpeg with the following options: · 189 unmodified lines
10441044 (you can change the cross-prefix according to the prefix chosen for the
10451045 MinGW tools).
10461046
1047−Then you can easily test FFmpeg with Wine
1048−(@url{http://www.winehq.com/}).
1047+Then you can easily test FFmpeg with @uref{http://www.winehq.com/, Wine}.
10491048
10501049 @subsection Compilation under Cygwin
10511050
@@ -1084,8 +1083,8 @@ If you want to build FFmpeg with additional libraries, download Cygwin · 32 unmodified lines
10841083 libogg-devel, libvorbis-devel
10851084 @end example
10861085
1087−These library packages are only available from Cygwin Ports
1088−(@url{http://sourceware.org/cygwinports/}) :
1086+These library packages are only available from
1087+@uref{http://sourceware.org/cygwinports/, Cygwin Ports}:
10891088
10901089 @example
10911090 yasm, libSDL-devel, libdirac-devel, libfaac-devel, libgsm-devel,
doc/protocols.texi+1−1
@@ -242,7 +242,7 @@ data transferred over RDT). · 241 unmodified lines
242242
243243 The muxer can be used to send a stream using RTSP ANNOUNCE to a server
244244 supporting it (currently Darwin Streaming Server and Mischa Spiegelmock's
245−RTSP server, @url{http://github.com/revmischa/rtsp-server}).
245+@uref{http://github.com/revmischa/rtsp-server, RTSP server}).
246246
247247 The required syntax for a RTSP url is:
248248 @example
ffmpeg.c+57−74
@@ -117,8 +117,8 @@ static const OptionDef options[]; · 116 unmodified lines
117117 #define MAX_STREAMS 1024 /* arbitrary sanity check value */
118118
119119 static const char *last_asked_format = NULL;
120−static double *input_files_ts_scale[MAX_FILES] = {NULL};
121−static int nb_input_files_ts_scale[MAX_FILES] = {0};
120+static double *ts_scale;
121+static int nb_ts_scale;
122122
123123 static AVFormatContext *output_files[MAX_FILES];
124124 static int nb_output_files = 0;
@@ -171,7 +171,6 @@ static char *vfilters = NULL; · 46 unmodified lines
171171
172172 static int intra_only = 0;
173173 static int audio_sample_rate = 0;
174−static int64_t channel_layout = 0;
175174 #define QSCALE_NONE -99999
176175 static float audio_qscale = QSCALE_NONE;
177176 static int audio_disable = 0;
@@ -194,7 +193,6 @@ static float mux_max_delay= 0.7; · 16 unmodified lines
194193
195194 static int64_t recording_time = INT64_MAX;
196195 static int64_t start_time = 0;
197−static int64_t recording_timestamp = 0;
198196 static int64_t input_ts_offset = 0;
199197 static int file_overwrite = 0;
200198 static AVDictionary *metadata;
@@ -327,6 +325,7 @@ typedef struct InputStream { · 126 unmodified lines
327325 int64_t next_pts; /* synthetic pts for cases where pkt.pts
328326 is not defined */
329327 int64_t pts; /* current pts */
328+ double ts_scale;
330329 int is_start; /* is 1 at the start and after a discontinuity */
331330 int showed_multi_packet_warning;
332331 int is_past_recording_time;
@@ -538,7 +537,6 @@ static int ffmpeg_exit(int ret) · 205 unmodified lines
538537 }
539538 for(i=0;i<nb_input_files;i++) {
540539 av_close_input_file(input_files[i].ctx);
541− av_free(input_files_ts_scale[i]);
542540 }
543541
544542 av_free(intra_matrix);
@@ -671,10 +669,16 @@ static void choose_pixel_fmt(AVStream *st, AVCodec *codec) · 126 unmodified lines
671669 }
672670 }
673671
674−static OutputStream *new_output_stream(AVFormatContext *oc, int file_idx)
672+static OutputStream *new_output_stream(AVFormatContext *oc, int file_idx, AVCodec *codec)
675673 {
676− int idx = oc->nb_streams - 1;
677674 OutputStream *ost;
675+ AVStream *st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0);
676+ int idx = oc->nb_streams - 1;
677+
678+ if (!st) {
679+ av_log(NULL, AV_LOG_ERROR, "Could not alloc stream.\n");
680+ ffmpeg_exit(1);
681+ }
678682
679683 output_streams_for_file[file_idx] =
680684 grow_array(output_streams_for_file[file_idx],
@@ -689,6 +693,10 @@ static OutputStream *new_output_stream(AVFormatContext *oc, int file_idx) · 8 unmodified lines
689693 }
690694 ost->file_index = file_idx;
691695 ost->index = idx;
696+ ost->st = st;
697+ ost->enc = codec;
698+
699+ avcodec_get_context_defaults3(st->codec, codec);
692700
693701 ost->sws_flags = av_get_int(sws_opts, "sws_flags", NULL);
694702 return ost;
@@ -704,28 +712,21 @@ static int read_ffserver_streams(AVFormatContext *s, const char *filename) · 9 unmodified lines
704712 if (err < 0)
705713 return err;
706714 /* copy stream format */
707− s->nb_streams = 0;
708− s->streams = av_mallocz(sizeof(AVStream *) * ic->nb_streams);
709715 for(i=0;i<ic->nb_streams;i++) {
710716 AVStream *st;
717+ OutputStream *ost;
711718 AVCodec *codec;
712719
713− s->nb_streams++;
720+ codec = avcodec_find_encoder(ic->streams[i]->codec->codec_id);
721+ ost = new_output_stream(s, nb_output_files, codec);
722+ st = ost->st;
714723
715724 // FIXME: a more elegant solution is needed
716− st = av_mallocz(sizeof(AVStream));
717725 memcpy(st, ic->streams[i], sizeof(AVStream));
718726 st->info = av_malloc(sizeof(*st->info));
719727 memcpy(st->info, ic->streams[i]->info, sizeof(*st->info));
720− st->codec = avcodec_alloc_context();
721− if (!st->codec) {
722− print_error(filename, AVERROR(ENOMEM));
723− ffmpeg_exit(1);
724− }
725728 avcodec_copy_context(st->codec, ic->streams[i]->codec);
726− s->streams[i] = st;
727729
728− codec = avcodec_find_encoder(st->codec->codec_id);
729730 if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
730731 if (audio_stream_copy) {
731732 st->stream_copy = 1;
@@ -740,13 +741,8 @@ static int read_ffserver_streams(AVFormatContext *s, const char *filename) · 8 unmodified lines
740741
741742 if(st->codec->flags & CODEC_FLAG_BITEXACT)
742743 nopts = 1;
743−
744− new_output_stream(s, nb_output_files);
745744 }
746745
747− if (!nopts)
748− s->timestamp = av_gettime();
749−
750746 av_close_input_file(ic);
751747 return 0;
752748 }
@@ -2102,7 +2098,6 @@ static int transcode(AVFormatContext **output_files, · 1349 unmodified lines
21022098 for(i=0;i<os->nb_streams;i++,n++) {
21032099 int found;
21042100 ost = ost_table[n] = output_streams_for_file[k][i];
2105− ost->st = os->streams[i];
21062101 if (nb_stream_maps > 0) {
21072102 ost->source_index = input_files[stream_maps[n].file_index].ist_index +
21082103 stream_maps[n].stream_index;
@@ -2278,6 +2273,9 @@ static int transcode(AVFormatContext **output_files, · 169 unmodified lines
22782273 }
22792274 choose_sample_rate(ost->st, ost->enc);
22802275 codec->time_base = (AVRational){1, codec->sample_rate};
2276+ if (codec->sample_fmt == AV_SAMPLE_FMT_NONE)
2277+ codec->sample_fmt = icodec->sample_fmt;
2278+ choose_sample_fmt(ost->st, ost->enc);
22812279 if (!codec->channels) {
22822280 codec->channels = icodec->channels;
22832281 codec->channel_layout = icodec->channel_layout;
@@ -2738,12 +2736,11 @@ static int transcode(AVFormatContext **output_files, · 454 unmodified lines
27382736 if (pkt.pts != AV_NOPTS_VALUE)
27392737 pkt.pts += av_rescale_q(input_files[ist->file_index].ts_offset, AV_TIME_BASE_Q, ist->st->time_base);
27402738
2741− if (pkt.stream_index < nb_input_files_ts_scale[file_index]
2742− && input_files_ts_scale[file_index][pkt.stream_index]){
2739+ if (ist->ts_scale) {
27432740 if(pkt.pts != AV_NOPTS_VALUE)
2744− pkt.pts *= input_files_ts_scale[file_index][pkt.stream_index];
2741+ pkt.pts *= ist->ts_scale;
27452742 if(pkt.dts != AV_NOPTS_VALUE)
2746− pkt.dts *= input_files_ts_scale[file_index][pkt.stream_index];
2743+ pkt.dts *= ist->ts_scale;
27472744 }
27482745
27492746 // fprintf(stderr, "next:%"PRId64" dts:%"PRId64" off:%"PRId64" %d\n", ist->next_pts, pkt.dts, input_files[ist->file_index].ts_offset, ist->st->codec->codec_type);
@@ -3203,8 +3200,8 @@ static int opt_input_ts_scale(const char *opt, const char *arg) · 453 unmodified lines
32033200 if(stream >= MAX_STREAMS)
32043201 ffmpeg_exit(1);
32053202
3206− input_files_ts_scale[nb_input_files] = grow_array(input_files_ts_scale[nb_input_files], sizeof(*input_files_ts_scale[nb_input_files]), &nb_input_files_ts_scale[nb_input_files], stream + 1);
3207− input_files_ts_scale[nb_input_files][stream]= scale;
3203+ ts_scale = grow_array(ts_scale, sizeof(*ts_scale), &nb_ts_scale, stream + 1);
3204+ ts_scale[stream] = scale;
32083205 return 0;
32093206 }
32103207
@@ -3222,7 +3219,14 @@ static int opt_start_time(const char *opt, const char *arg) · 11 unmodified lines
32223219
32233220 static int opt_recording_timestamp(const char *opt, const char *arg)
32243221 {
3225− recording_timestamp = parse_time_or_die(opt, arg, 0) / 1000000;
3222+ char buf[128];
3223+ int64_t recording_timestamp = parse_time_or_die(opt, arg, 0) / 1E6;
3224+ struct tm time = *gmtime((time_t*)&recording_timestamp);
3225+ strftime(buf, sizeof(buf), "creation_time=%FT%T%z", &time);
3226+ opt_metadata("metadata", buf);
3227+
3228+ av_log(NULL, AV_LOG_WARNING, "%s is deprecated, set the 'creation_time' metadata "
3229+ "tag instead.\n", opt);
32263230 return 0;
32273231 }
32283232
@@ -3401,14 +3405,15 @@ static int opt_input_file(const char *opt, const char *filename) · 172 unmodified lines
34013405 ist->file_index = nb_input_files;
34023406 ist->discard = 1;
34033407
3408+ if (i < nb_ts_scale)
3409+ ist->ts_scale = ts_scale[i];
3410+
34043411 switch (dec->codec_type) {
34053412 case AVMEDIA_TYPE_AUDIO:
34063413 ist->dec = avcodec_find_decoder_by_name(audio_codec_name);
34073414 if(!ist->dec)
34083415 ist->dec = avcodec_find_decoder(dec->codec_id);
34093416 set_context_opts(dec, avcodec_opts[AVMEDIA_TYPE_AUDIO], AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_DECODING_PARAM, ist->dec);
3410− channel_layout = dec->channel_layout;
3411− audio_sample_fmt = dec->sample_fmt;
34123417 if(audio_disable)
34133418 st->discard= AVDISCARD_ALL;
34143419 break;
@@ -3475,6 +3480,9 @@ static int opt_input_file(const char *opt, const char *filename) · 60 unmodified lines
34753480 frame_width = 0;
34763481 audio_sample_rate = 0;
34773482 audio_channels = 0;
3483+ audio_sample_fmt = AV_SAMPLE_FMT_NONE;
3484+ av_freep(&ts_scale);
3485+ nb_ts_scale = 0;
34783486
34793487 av_freep(&video_codec_name);
34803488 av_freep(&audio_codec_name);
@@ -3535,23 +3543,20 @@ static void new_video_stream(AVFormatContext *oc, int file_idx) · 54 unmodified lines
35353543 enum CodecID codec_id = CODEC_ID_NONE;
35363544 AVCodec *codec= NULL;
35373545
3538− st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0);
3539− if (!st) {
3540− fprintf(stderr, "Could not alloc stream\n");
3541− ffmpeg_exit(1);
3542− }
3543− ost = new_output_stream(oc, file_idx);
3544−
35453546 if(!video_stream_copy){
35463547 if (video_codec_name) {
35473548 codec_id = find_codec_or_die(video_codec_name, AVMEDIA_TYPE_VIDEO, 1,
35483549 avcodec_opts[AVMEDIA_TYPE_VIDEO]->strict_std_compliance);
35493550 codec = avcodec_find_encoder_by_name(video_codec_name);
3550− ost->enc = codec;
35513551 } else {
35523552 codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, AVMEDIA_TYPE_VIDEO);
35533553 codec = avcodec_find_encoder(codec_id);
35543554 }
3555+ }
3556+
3557+ ost = new_output_stream(oc, file_idx, codec);
3558+ st = ost->st;
3559+ if (!video_stream_copy) {
35553560 ost->frame_aspect_ratio = frame_aspect_ratio;
35563561 frame_aspect_ratio = 0;
35573562 #if CONFIG_AVFILTER
@@ -3560,7 +3565,6 @@ static void new_video_stream(AVFormatContext *oc, int file_idx) · 2 unmodified lines
35603565 #endif
35613566 }
35623567
3563− avcodec_get_context_defaults3(st->codec, codec);
35643568 ost->bitstream_filters = video_bitstream_filters;
35653569 video_bitstream_filters= NULL;
35663570
@@ -3674,26 +3678,18 @@ static void new_audio_stream(AVFormatContext *oc, int file_idx) · 107 unmodified lines
36743678 AVCodecContext *audio_enc;
36753679 enum CodecID codec_id = CODEC_ID_NONE;
36763680
3677− st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0);
3678− if (!st) {
3679− fprintf(stderr, "Could not alloc stream\n");
3680− ffmpeg_exit(1);
3681− }
3682− ost = new_output_stream(oc, file_idx);
3683−
36843681 if(!audio_stream_copy){
36853682 if (audio_codec_name) {
36863683 codec_id = find_codec_or_die(audio_codec_name, AVMEDIA_TYPE_AUDIO, 1,
36873684 avcodec_opts[AVMEDIA_TYPE_AUDIO]->strict_std_compliance);
36883685 codec = avcodec_find_encoder_by_name(audio_codec_name);
3689− ost->enc = codec;
36903686 } else {
36913687 codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, AVMEDIA_TYPE_AUDIO);
36923688 codec = avcodec_find_encoder(codec_id);
36933689 }
36943690 }
3695−
3696− avcodec_get_context_defaults3(st->codec, codec);
3691+ ost = new_output_stream(oc, file_idx, codec);
3692+ st = ost->st;
36973693
36983694 ost->bitstream_filters = audio_bitstream_filters;
36993695 audio_bitstream_filters= NULL;
@@ -3722,11 +3718,10 @@ static void new_audio_stream(AVFormatContext *oc, int file_idx) · 22 unmodified lines
37223718 }
37233719 if (audio_channels)
37243720 audio_enc->channels = audio_channels;
3725− audio_enc->sample_fmt = audio_sample_fmt;
3721+ if (audio_sample_fmt != AV_SAMPLE_FMT_NONE)
3722+ audio_enc->sample_fmt = audio_sample_fmt;
37263723 if (audio_sample_rate)
37273724 audio_enc->sample_rate = audio_sample_rate;
3728− audio_enc->channel_layout = channel_layout;
3729− choose_sample_fmt(st, codec);
37303725 }
37313726 if (audio_language) {
37323727 av_dict_set(&st->metadata, "language", audio_language, 0);
@@ -3742,21 +3737,16 @@ static void new_audio_stream(AVFormatContext *oc, int file_idx) · 9 unmodified lines
37423737 static void new_data_stream(AVFormatContext *oc, int file_idx)
37433738 {
37443739 AVStream *st;
3745− AVCodec *codec=NULL;
3740+ OutputStream *ost;
37463741 AVCodecContext *data_enc;
37473742
3748− st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0);
3749− if (!st) {
3750− fprintf(stderr, "Could not alloc stream\n");
3751− ffmpeg_exit(1);
3752− }
3753− new_output_stream(oc, file_idx);
3743+ ost = new_output_stream(oc, file_idx, NULL);
3744+ st = ost->st;
37543745 data_enc = st->codec;
37553746 if (!data_stream_copy) {
37563747 fprintf(stderr, "Data stream encoding not supported yet (only streamcopy)\n");
37573748 ffmpeg_exit(1);
37583749 }
3759− avcodec_get_context_defaults3(st->codec, codec);
37603750
37613751 data_enc->codec_type = AVMEDIA_TYPE_DATA;
37623752
@@ -3784,25 +3774,19 @@ static void new_subtitle_stream(AVFormatContext *oc, int file_idx) · 21 unmodified lines
37843774 AVCodecContext *subtitle_enc;
37853775 enum CodecID codec_id = CODEC_ID_NONE;
37863776
3787− st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0);
3788− if (!st) {
3789− fprintf(stderr, "Could not alloc stream\n");
3790− ffmpeg_exit(1);
3791− }
3792− ost = new_output_stream(oc, file_idx);
3793− subtitle_enc = st->codec;
37943777 if(!subtitle_stream_copy){
37953778 if (subtitle_codec_name) {
37963779 codec_id = find_codec_or_die(subtitle_codec_name, AVMEDIA_TYPE_SUBTITLE, 1,
37973780 avcodec_opts[AVMEDIA_TYPE_SUBTITLE]->strict_std_compliance);
37983781 codec = avcodec_find_encoder_by_name(subtitle_codec_name);
3799− ost->enc = codec;
38003782 } else {
38013783 codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, AVMEDIA_TYPE_SUBTITLE);
38023784 codec = avcodec_find_encoder(codec_id);
38033785 }
38043786 }
3805− avcodec_get_context_defaults3(st->codec, codec);
3787+ ost = new_output_stream(oc, file_idx, codec);
3788+ st = ost->st;
3789+ subtitle_enc = st->codec;
38063790
38073791 ost->bitstream_filters = subtitle_bitstream_filters;
38083792 subtitle_bitstream_filters= NULL;
@@ -3938,8 +3922,6 @@ static int opt_output_file(const char *opt, const char *filename) · 129 unmodified lines
39383922 if (use_subtitle) new_subtitle_stream(oc, nb_output_files);
39393923 if (use_data) new_data_stream(oc, nb_output_files);
39403924
3941− oc->timestamp = recording_timestamp;
3942−
39433925 av_dict_copy(&oc->metadata, metadata, 0);
39443926 av_dict_free(&metadata);
39453927 }
@@ -4005,6 +3987,7 @@ static int opt_output_file(const char *opt, const char *filename) · 59 unmodified lines
40053987 frame_height = 0;
40063988 audio_sample_rate = 0;
40073989 audio_channels = 0;
3990+ audio_sample_fmt = AV_SAMPLE_FMT_NONE;
40083991
40093992 av_freep(&forced_key_frames);
40103993 uninit_opts();
ffplay.c+6−8
@@ -1431,7 +1431,7 @@ static int queue_picture(VideoState *is, AVFrame *src_frame, double pts1, int64_ · 1430 unmodified lines
14311431
14321432 static int get_video_frame(VideoState *is, AVFrame *frame, int64_t *pts, AVPacket *pkt)
14331433 {
1434− int len1 av_unused, got_picture, i;
1434+ int got_picture, i;
14351435
14361436 if (packet_queue_get(&is->videoq, pkt, 1) < 0)
14371437 return -1;
@@ -1458,9 +1458,7 @@ static int get_video_frame(VideoState *is, AVFrame *frame, int64_t *pts, AVPacke · 20 unmodified lines
14581458 return 0;
14591459 }
14601460
1461− len1 = avcodec_decode_video2(is->video_st->codec,
1462− frame, &got_picture,
1463− pkt);
1461+ avcodec_decode_video2(is->video_st->codec, frame, &got_picture, pkt);
14641462
14651463 if (got_picture) {
14661464 if (decoder_reorder_pts == -1) {
@@ -1807,7 +1805,7 @@ static int subtitle_thread(void *arg) · 340 unmodified lines
18071805 VideoState *is = arg;
18081806 SubPicture *sp;
18091807 AVPacket pkt1, *pkt = &pkt1;
1810− int len1 av_unused, got_subtitle;
1808+ int got_subtitle;
18111809 double pts;
18121810 int i, j;
18131811 int r, g, b, y, u, v, a;
@@ -1841,9 +1839,9 @@ static int subtitle_thread(void *arg) · 27 unmodified lines
18411839 if (pkt->pts != AV_NOPTS_VALUE)
18421840 pts = av_q2d(is->subtitle_st->time_base)*pkt->pts;
18431841
1844− len1 = avcodec_decode_subtitle2(is->subtitle_st->codec,
1845− &sp->sub, &got_subtitle,
1846− pkt);
1842+ avcodec_decode_subtitle2(is->subtitle_st->codec, &sp->sub,
1843+ &got_subtitle, pkt);
1844+
18471845 if (got_subtitle && sp->sub.format == 0) {
18481846 sp->pts = pts;
18491847
libavcodec/dnxhdenc.c+1−2
@@ -28,6 +28,7 @@ · 27 unmodified lines
2828 #include "avcodec.h"
2929 #include "dsputil.h"
3030 #include "mpegvideo.h"
31+#include "mpegvideo_common.h"
3132 #include "dnxhdenc.h"
3233
3334 #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
@@ -38,8 +39,6 @@ static const AVOption options[]={ · 4 unmodified lines
3839 };
3940 static const AVClass class = { "dnxhd", av_default_item_name, options, LIBAVUTIL_VERSION_INT };
4041
41−int dct_quantize_c(MpegEncContext *s, DCTELEM *block, int n, int qscale, int *overflow);
42−
4342 #define LAMBDA_FRAC_BITS 10
4443
4544 static av_always_inline void dnxhd_get_pixels_8x4(DCTELEM *restrict block, const uint8_t *pixels, int line_size)
libavcodec/h264.h+0−43
@@ -770,8 +770,6 @@ static av_always_inline int get_chroma_qp(H264Context *h, int t, int qscale){ · 769 unmodified lines
770770 return h->pps.chroma_qp_table[t][qscale];
771771 }
772772
773−static av_always_inline void pred_pskip_motion(H264Context * const h);
774−
775773 static void fill_decode_neighbors(H264Context *h, int mb_type){
776774 MpegEncContext * const s = &h->s;
777775 const int mb_xy= h->mb_xy;
@@ -1302,45 +1300,4 @@ static av_always_inline int get_dct8x8_allowed(H264Context *h){ · 524 unmodified lines
13021300 return !(AV_RN64A(h->sub_mb_type) & ((MB_TYPE_16x8|MB_TYPE_8x16|MB_TYPE_8x8|MB_TYPE_DIRECT2)*0x0001000100010001ULL));
13031301 }
13041302
1305−/**
1306− * decodes a P_SKIP or B_SKIP macroblock
1307− */
1308−static void av_unused decode_mb_skip(H264Context *h){
1309− MpegEncContext * const s = &h->s;
1310− const int mb_xy= h->mb_xy;
1311− int mb_type=0;
1312−
1313− memset(h->non_zero_count[mb_xy], 0, 48);
1314−
1315− if(MB_FIELD)
1316− mb_type|= MB_TYPE_INTERLACED;
1317−
1318− if( h->slice_type_nos == AV_PICTURE_TYPE_B )
1319− {
1320− // just for fill_caches. pred_direct_motion will set the real mb_type
1321− mb_type|= MB_TYPE_L0L1|MB_TYPE_DIRECT2|MB_TYPE_SKIP;
1322− if(h->direct_spatial_mv_pred){
1323− fill_decode_neighbors(h, mb_type);
1324− fill_decode_caches(h, mb_type); //FIXME check what is needed and what not ...
1325− }
1326− ff_h264_pred_direct_motion(h, &mb_type);
1327− mb_type|= MB_TYPE_SKIP;
1328− }
1329− else
1330− {
1331− mb_type|= MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P1L0|MB_TYPE_SKIP;
1332−
1333− fill_decode_neighbors(h, mb_type);
1334− pred_pskip_motion(h);
1335− }
1336−
1337− write_back_motion(h, mb_type);
1338− s->current_picture.f.mb_type[mb_xy] = mb_type;
1339− s->current_picture.f.qscale_table[mb_xy] = s->qscale;
1340− h->slice_table[ mb_xy ]= h->slice_num;
1341− h->prev_mb_skipped= 1;
1342−}
1343−
1344−#include "h264_mvpred.h" //For pred_pskip_motion()
1345−
13461303 #endif /* AVCODEC_H264_H */
libavcodec/h264_mvpred.h+39−0
@@ -327,4 +327,43 @@ zeromv: · 326 unmodified lines
327327 return;
328328 }
329329
330+/**
331+ * decodes a P_SKIP or B_SKIP macroblock
332+ */
333+static void av_unused decode_mb_skip(H264Context *h){
334+ MpegEncContext * const s = &h->s;
335+ const int mb_xy= h->mb_xy;
336+ int mb_type=0;
337+
338+ memset(h->non_zero_count[mb_xy], 0, 48);
339+
340+ if(MB_FIELD)
341+ mb_type|= MB_TYPE_INTERLACED;
342+
343+ if( h->slice_type_nos == AV_PICTURE_TYPE_B )
344+ {
345+ // just for fill_caches. pred_direct_motion will set the real mb_type
346+ mb_type|= MB_TYPE_L0L1|MB_TYPE_DIRECT2|MB_TYPE_SKIP;
347+ if(h->direct_spatial_mv_pred){
348+ fill_decode_neighbors(h, mb_type);
349+ fill_decode_caches(h, mb_type); //FIXME check what is needed and what not ...
350+ }
351+ ff_h264_pred_direct_motion(h, &mb_type);
352+ mb_type|= MB_TYPE_SKIP;
353+ }
354+ else
355+ {
356+ mb_type|= MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P1L0|MB_TYPE_SKIP;
357+
358+ fill_decode_neighbors(h, mb_type);
359+ pred_pskip_motion(h);
360+ }
361+
362+ write_back_motion(h, mb_type);
363+ s->current_picture.f.mb_type[mb_xy] = mb_type;
364+ s->current_picture.f.qscale_table[mb_xy] = s->qscale;
365+ h->slice_table[ mb_xy ]= h->slice_num;
366+ h->prev_mb_skipped= 1;
367+}
368+
330369 #endif /* AVCODEC_H264_MVPRED_H */
libavformat/avformat.h+6−1
@@ -698,7 +698,12 @@ typedef struct AVFormatContext { · 697 unmodified lines
698698 AVStream **streams;
699699 char filename[1024]; /**< input or output filename */
700700 /* stream info */
701− int64_t timestamp;
701+#if FF_API_TIMESTAMP
702+ /**
703+ * @deprecated use 'creation_time' metadata tag instead
704+ */
705+ attribute_deprecated int64_t timestamp;
706+#endif
702707
703708 int ctx_flags; /**< Format-specific flags, see AVFMTCTX_xx */
704709 /* private data for pts handling (do not modify directly). */
libavformat/dvenc.c+12−2
@@ -43,7 +43,7 @@ struct DVMuxContext { · 42 unmodified lines
4343 AVStream *ast[2]; /* stereo audio streams */
4444 AVFifoBuffer *audio_data[2]; /* FIFO for storing excessive amounts of PCM */
4545 int frames; /* current frame number */
46− time_t start_time; /* recording start time */
46+ int64_t start_time; /* recording start time */
4747 int has_audio; /* frame under contruction has audio */
4848 int has_video; /* frame under contruction has video */
4949 uint8_t frame_buf[DV_MAX_FRAME_SIZE]; /* frame under contruction */
@@ -290,6 +290,7 @@ static DVMuxContext* dv_init_mux(AVFormatContext* s) · 240 unmodified lines
290290 {
291291 DVMuxContext *c = s->priv_data;
292292 AVStream *vst = NULL;
293+ AVDictionaryEntry *t;
293294 int i;
294295
295296 /* we support at most 1 video and 2 audio streams */
@@ -337,7 +338,16 @@ static DVMuxContext* dv_init_mux(AVFormatContext* s) · 41 unmodified lines
337338 c->frames = 0;
338339 c->has_audio = 0;
339340 c->has_video = 0;
340− c->start_time = (time_t)s->timestamp;
341+#if FF_API_TIMESTAMP
342+ if (s->timestamp)
343+ c->start_time = s->timestamp;
344+ else
345+#endif
346+ if (t = av_dict_get(s->metadata, "creation_time", NULL, 0)) {
347+ struct tm time = {0};
348+ strptime(t->value, "%Y - %m - %dT%T", &time);
349+ c->start_time = mktime(&time);
350+ }
341351
342352 for (i=0; i < c->n_ast; i++) {
343353 if (c->ast[i] && !(c->audio_data[i]=av_fifo_alloc(100*AVCODEC_MAX_AUDIO_FRAME_SIZE))) {
libavformat/gxfenc.c+16−2
@@ -394,6 +394,20 @@ static int gxf_write_umf_material_description(AVFormatContext *s) · 393 unmodified lines
394394 GXFContext *gxf = s->priv_data;
395395 AVIOContext *pb = s->pb;
396396 int timecode_base = gxf->time_base.den == 60000 ? 60 : 50;
397+ int64_t timestamp = 0;
398+ AVDictionaryEntry *t;
399+
400+#if FF_API_TIMESTAMP
401+ if (s->timestamp)
402+ timestamp = s->timestamp;
403+ else
404+#endif
405+ if (t = av_dict_get(s->metadata, "creation_time", NULL, 0)) {
406+ struct tm time = {0};
407+ strptime(t->value, "%Y - %m - %dT%T", &time);
408+ timestamp = mktime(&time);
409+ }
410+
397411
398412 // XXX drop frame
399413 uint32_t timecode =
@@ -409,8 +423,8 @@ static int gxf_write_umf_material_description(AVFormatContext *s) · 9 unmodified lines
409423 avio_wl32(pb, gxf->nb_fields); /* mark out */
410424 avio_wl32(pb, 0); /* timecode mark in */
411425 avio_wl32(pb, timecode); /* timecode mark out */
412− avio_wl64(pb, s->timestamp); /* modification time */
413− avio_wl64(pb, s->timestamp); /* creation time */
426+ avio_wl64(pb, timestamp); /* modification time */
427+ avio_wl64(pb, timestamp); /* creation time */
414428 avio_wl16(pb, 0); /* reserved */
415429 avio_wl16(pb, 0); /* reserved */
416430 avio_wl16(pb, gxf->audio_tracks);
libavformat/matroskaenc.c+1−1
@@ -1212,7 +1212,7 @@ AVOutputFormat ff_matroska_muxer = { · 1211 unmodified lines
12121212 mkv_write_trailer,
12131213 .flags = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS,
12141214 .codec_tag = (const AVCodecTag* const []){ff_codec_bmp_tags, ff_codec_wav_tags, 0},
1215− .subtitle_codec = CODEC_ID_TEXT,
1215+ .subtitle_codec = CODEC_ID_SSA,
12161216 };
12171217 #endif
12181218
libavformat/movenc.c+13−1
@@ -2142,6 +2142,7 @@ static int mov_write_header(AVFormatContext *s) · 2141 unmodified lines
21422142 {
21432143 AVIOContext *pb = s->pb;
21442144 MOVMuxContext *mov = s->priv_data;
2145+ AVDictionaryEntry *t;
21452146 int i, hint_track = 0;
21462147
21472148 if (!s->pb->seekable) {
@@ -2272,7 +2273,18 @@ static int mov_write_header(AVFormatContext *s) · 124 unmodified lines
22722273 }
22732274
22742275 mov_write_mdat_tag(pb, mov);
2275− mov->time = s->timestamp + 0x7C25B080; //1970 based -> 1904 based
2276+
2277+#if FF_API_TIMESTAMP
2278+ if (s->timestamp)
2279+ mov->time = s->timestamp;
2280+ else
2281+#endif
2282+ if (t = av_dict_get(s->metadata, "creation_time", NULL, 0)) {
2283+ struct tm time = {0};
2284+ strptime(t->value, "%Y - %m - %dT%T", &time);
2285+ mov->time = mktime(&time);
2286+ }
2287+ mov->time += 0x7C25B080; //1970 based -> 1904 based
22762288
22772289 if (mov->chapter_track)
22782290 mov_create_chapter_track(s, mov->chapter_track);
libavformat/mxfenc.c+13−1
@@ -1407,6 +1407,8 @@ static int mxf_write_header(AVFormatContext *s) · 1406 unmodified lines
14071407 int i;
14081408 uint8_t present[FF_ARRAY_ELEMS(mxf_essence_container_uls)] = {0};
14091409 const int *samples_per_frame = NULL;
1410+ AVDictionaryEntry *t;
1411+ int64_t timestamp = 0;
14101412
14111413 if (!s->nb_streams)
14121414 return -1;
@@ -1512,8 +1514,18 @@ static int mxf_write_header(AVFormatContext *s) · 99 unmodified lines
15121514 sc->order = AV_RB32(sc->track_essence_element_key+12);
15131515 }
15141516
1517+#if FF_API_TIMESTAMP
15151518 if (s->timestamp)
1516− mxf->timestamp = mxf_parse_timestamp(s->timestamp);
1519+ timestamp = s->timestamp;
1520+ else
1521+#endif
1522+ if (t = av_dict_get(s->metadata, "creation_time", NULL, 0)) {
1523+ struct tm time = {0};
1524+ strptime(t->value, "%Y - %m - %dT%T", &time);
1525+ timestamp = mktime(&time);
1526+ }
1527+ if (timestamp)
1528+ mxf->timestamp = mxf_parse_timestamp(timestamp);
15171529 mxf->duration = -1;
15181530
15191531 mxf->timecode_track = av_mallocz(sizeof(*mxf->timecode_track));
libavformat/oggdec.c+3−2
@@ -605,15 +605,15 @@ static int64_t ogg_read_timestamp(AVFormatContext *s, int stream_index, · 604 unmodified lines
605605 int64_t *pos_arg, int64_t pos_limit)
606606 {
607607 struct ogg *ogg = s->priv_data;
608− struct ogg_stream *os = ogg->streams + stream_index;
609608 AVIOContext *bc = s->pb;
610609 int64_t pts = AV_NOPTS_VALUE;
611− int i;
610+ int i = -1;
612611 avio_seek(bc, *pos_arg, SEEK_SET);
613612 ogg_reset(ogg);
614613
615614 while (avio_tell(bc) < pos_limit && !ogg_packet(s, &i, NULL, NULL, pos_arg)) {
616615 if (i == stream_index) {
616+ struct ogg_stream *os = ogg->streams + stream_index;
617617 pts = ogg_calc_pts(s, i, NULL);
618618 if (os->keyframe_seek && !(os->pflags & AV_PKT_FLAG_KEY))
619619 pts = AV_NOPTS_VALUE;
@@ -639,6 +639,7 @@ static int ogg_read_seek(AVFormatContext *s, int stream_index, · 19 unmodified lines
639639 os->keyframe_seek = 1;
640640
641641 ret = av_seek_frame_binary(s, stream_index, timestamp, flags);
642+ os = ogg->streams + stream_index;
642643 if (ret < 0)
643644 os->keyframe_seek = 0;
644645 return ret;
libavformat/version.h+3−0
@@ -86,5 +86,8 @@ · 85 unmodified lines
8686 #ifndef FF_API_LOOP_OUTPUT
8787 #define FF_API_LOOP_OUTPUT (LIBAVFORMAT_VERSION_MAJOR < 54)
8888 #endif
89+#ifndef FF_API_TIMESTAMP
90+#define FF_API_TIMESTAMP (LIBAVFORMAT_VERSION_MAJOR < 54)
91+#endif
8992
9093 #endif /* AVFORMAT_VERSION_H */
libavutil/pixdesc.c+3−3
@@ -918,9 +918,9 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = { · 917 unmodified lines
918918 .log2_chroma_w= 0,
919919 .log2_chroma_h= 0,
920920 .comp = {
921− {0,1,1,0,9}, /* Y */
922− {1,1,1,0,9}, /* U */
923− {2,1,1,0,9}, /* V */
921+ {0,1,1,0,8}, /* Y */
922+ {1,1,1,0,8}, /* U */
923+ {2,1,1,0,8}, /* V */
924924 },
925925 .flags = PIX_FMT_BE,
926926 },

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t