* 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
Merged-by: Michael Niedermayer <michaelni@gmx.at>
| ... | ... |
@@ -34,6 +34,7 @@ You can use libavcodec or libavformat in your commercial program, but |
| 34 | 34 |
@emph{any patch you make must be published}. The best way to proceed is
|
| 35 | 35 |
to send your patches to the FFmpeg mailing list. |
| 36 | 36 |
|
| 37 |
+ |
|
| 37 | 38 |
@anchor{Coding Rules}
|
| 38 | 39 |
@section Coding Rules |
| 39 | 40 |
|
| ... | ... |
@@ -47,7 +47,7 @@ Likely reasons |
| 47 | 47 |
@item We are busy and haven't had time yet to read your report or |
| 48 | 48 |
investigate the issue. |
| 49 | 49 |
@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. |
|
| 51 | 51 |
@item You reported a segmentation fault without gdb output. |
| 52 | 52 |
@item You describe a problem but not how to reproduce it. |
| 53 | 53 |
@item It's unclear if you use ffmpeg as command line tool or use |
| ... | ... |
@@ -123,7 +123,8 @@ problem and an NP-hard problem... |
| 123 | 123 |
|
| 124 | 124 |
@section ffmpeg does not work; what is wrong? |
| 125 | 125 |
|
| 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 |
|
| 127 | 128 |
(@url{http://ffmpeg.org/bugreports.html}).
|
| 128 | 129 |
|
| 129 | 130 |
@section How do I encode single pictures into movies? |
| ... | ... |
@@ -285,7 +286,8 @@ Just create an "input.avs" text file with this single line ... |
| 285 | 285 |
ffmpeg -i input.avs |
| 286 | 286 |
@end example |
| 287 | 287 |
|
| 288 |
-For ANY other help on Avisynth, please visit @url{http://www.avisynth.org/}.
|
|
| 288 |
+For ANY other help on Avisynth, please visit the |
|
| 289 |
+@uref{http://www.avisynth.org/, Avisynth homepage}.
|
|
| 289 | 290 |
|
| 290 | 291 |
@section How can I join video files? |
| 291 | 292 |
|
| ... | ... |
@@ -417,7 +419,7 @@ No. These tools are too bloated and they complicate the build. |
| 417 | 417 |
FFmpeg is already organized in a highly modular manner and does not need to |
| 418 | 418 |
be rewritten in a formal object language. Further, many of the developers |
| 419 | 419 |
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}).
|
|
| 420 |
+read @uref{http://www.tux.org/lkml/#s15, "Programming Religion"}.
|
|
| 421 | 421 |
|
| 422 | 422 |
@section Why are the ffmpeg programs devoid of debugging symbols? |
| 423 | 423 |
|
| ... | ... |
@@ -888,8 +888,8 @@ ffmpeg -f oss -i /dev/dsp -f video4linux2 -i /dev/video0 /tmp/out.mpg |
| 888 | 888 |
@end example |
| 889 | 889 |
|
| 890 | 890 |
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
|
|
| 893 | 893 |
have to set the audio recording levels correctly with a |
| 894 | 894 |
standard mixer. |
| 895 | 895 |
|
| ... | ... |
@@ -848,7 +848,7 @@ noticeable when running make for a second time (for example in |
| 848 | 848 |
@code{make install}).
|
| 849 | 849 |
|
| 850 | 850 |
@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}.
|
|
| 852 | 852 |
Edit the @file{bin/sdl-config} script so that it points to the correct prefix
|
| 853 | 853 |
where SDL was installed. Verify that @file{sdl-config} can be launched from
|
| 854 | 854 |
the MSYS command line. |
| ... | ... |
@@ -1044,8 +1044,7 @@ Then configure FFmpeg with the following options: |
| 1044 | 1044 |
(you can change the cross-prefix according to the prefix chosen for the |
| 1045 | 1045 |
MinGW tools). |
| 1046 | 1046 |
|
| 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}.
|
|
| 1049 | 1048 |
|
| 1050 | 1049 |
@subsection Compilation under Cygwin |
| 1051 | 1050 |
|
| ... | ... |
@@ -1084,8 +1083,8 @@ If you want to build FFmpeg with additional libraries, download Cygwin |
| 1084 | 1084 |
libogg-devel, libvorbis-devel |
| 1085 | 1085 |
@end example |
| 1086 | 1086 |
|
| 1087 |
-These library packages are only available from Cygwin Ports |
|
| 1088 |
-(@url{http://sourceware.org/cygwinports/}) :
|
|
| 1087 |
+These library packages are only available from |
|
| 1088 |
+@uref{http://sourceware.org/cygwinports/, Cygwin Ports}:
|
|
| 1089 | 1089 |
|
| 1090 | 1090 |
@example |
| 1091 | 1091 |
yasm, libSDL-devel, libdirac-devel, libfaac-devel, libgsm-devel, |
| ... | ... |
@@ -242,7 +242,7 @@ data transferred over RDT). |
| 242 | 242 |
|
| 243 | 243 |
The muxer can be used to send a stream using RTSP ANNOUNCE to a server |
| 244 | 244 |
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}).
|
|
| 246 | 246 |
|
| 247 | 247 |
The required syntax for a RTSP url is: |
| 248 | 248 |
@example |
| ... | ... |
@@ -117,8 +117,8 @@ static const OptionDef options[]; |
| 117 | 117 |
#define MAX_STREAMS 1024 /* arbitrary sanity check value */ |
| 118 | 118 |
|
| 119 | 119 |
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; |
|
| 122 | 122 |
|
| 123 | 123 |
static AVFormatContext *output_files[MAX_FILES]; |
| 124 | 124 |
static int nb_output_files = 0; |
| ... | ... |
@@ -171,7 +171,6 @@ static char *vfilters = NULL; |
| 171 | 171 |
|
| 172 | 172 |
static int intra_only = 0; |
| 173 | 173 |
static int audio_sample_rate = 0; |
| 174 |
-static int64_t channel_layout = 0; |
|
| 175 | 174 |
#define QSCALE_NONE -99999 |
| 176 | 175 |
static float audio_qscale = QSCALE_NONE; |
| 177 | 176 |
static int audio_disable = 0; |
| ... | ... |
@@ -194,7 +193,6 @@ static float mux_max_delay= 0.7; |
| 194 | 194 |
|
| 195 | 195 |
static int64_t recording_time = INT64_MAX; |
| 196 | 196 |
static int64_t start_time = 0; |
| 197 |
-static int64_t recording_timestamp = 0; |
|
| 198 | 197 |
static int64_t input_ts_offset = 0; |
| 199 | 198 |
static int file_overwrite = 0; |
| 200 | 199 |
static AVDictionary *metadata; |
| ... | ... |
@@ -327,6 +325,7 @@ typedef struct InputStream {
|
| 327 | 327 |
int64_t next_pts; /* synthetic pts for cases where pkt.pts |
| 328 | 328 |
is not defined */ |
| 329 | 329 |
int64_t pts; /* current pts */ |
| 330 |
+ double ts_scale; |
|
| 330 | 331 |
int is_start; /* is 1 at the start and after a discontinuity */ |
| 331 | 332 |
int showed_multi_packet_warning; |
| 332 | 333 |
int is_past_recording_time; |
| ... | ... |
@@ -538,7 +537,6 @@ static int ffmpeg_exit(int ret) |
| 538 | 538 |
} |
| 539 | 539 |
for(i=0;i<nb_input_files;i++) {
|
| 540 | 540 |
av_close_input_file(input_files[i].ctx); |
| 541 |
- av_free(input_files_ts_scale[i]); |
|
| 542 | 541 |
} |
| 543 | 542 |
|
| 544 | 543 |
av_free(intra_matrix); |
| ... | ... |
@@ -671,10 +669,16 @@ static void choose_pixel_fmt(AVStream *st, AVCodec *codec) |
| 671 | 671 |
} |
| 672 | 672 |
} |
| 673 | 673 |
|
| 674 |
-static OutputStream *new_output_stream(AVFormatContext *oc, int file_idx) |
|
| 674 |
+static OutputStream *new_output_stream(AVFormatContext *oc, int file_idx, AVCodec *codec) |
|
| 675 | 675 |
{
|
| 676 |
- int idx = oc->nb_streams - 1; |
|
| 677 | 676 |
OutputStream *ost; |
| 677 |
+ AVStream *st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0); |
|
| 678 |
+ int idx = oc->nb_streams - 1; |
|
| 679 |
+ |
|
| 680 |
+ if (!st) {
|
|
| 681 |
+ av_log(NULL, AV_LOG_ERROR, "Could not alloc stream.\n"); |
|
| 682 |
+ ffmpeg_exit(1); |
|
| 683 |
+ } |
|
| 678 | 684 |
|
| 679 | 685 |
output_streams_for_file[file_idx] = |
| 680 | 686 |
grow_array(output_streams_for_file[file_idx], |
| ... | ... |
@@ -689,6 +693,10 @@ static OutputStream *new_output_stream(AVFormatContext *oc, int file_idx) |
| 689 | 689 |
} |
| 690 | 690 |
ost->file_index = file_idx; |
| 691 | 691 |
ost->index = idx; |
| 692 |
+ ost->st = st; |
|
| 693 |
+ ost->enc = codec; |
|
| 694 |
+ |
|
| 695 |
+ avcodec_get_context_defaults3(st->codec, codec); |
|
| 692 | 696 |
|
| 693 | 697 |
ost->sws_flags = av_get_int(sws_opts, "sws_flags", NULL); |
| 694 | 698 |
return ost; |
| ... | ... |
@@ -704,28 +712,21 @@ static int read_ffserver_streams(AVFormatContext *s, const char *filename) |
| 704 | 704 |
if (err < 0) |
| 705 | 705 |
return err; |
| 706 | 706 |
/* copy stream format */ |
| 707 |
- s->nb_streams = 0; |
|
| 708 |
- s->streams = av_mallocz(sizeof(AVStream *) * ic->nb_streams); |
|
| 709 | 707 |
for(i=0;i<ic->nb_streams;i++) {
|
| 710 | 708 |
AVStream *st; |
| 709 |
+ OutputStream *ost; |
|
| 711 | 710 |
AVCodec *codec; |
| 712 | 711 |
|
| 713 |
- s->nb_streams++; |
|
| 712 |
+ codec = avcodec_find_encoder(ic->streams[i]->codec->codec_id); |
|
| 713 |
+ ost = new_output_stream(s, nb_output_files, codec); |
|
| 714 |
+ st = ost->st; |
|
| 714 | 715 |
|
| 715 | 716 |
// FIXME: a more elegant solution is needed |
| 716 |
- st = av_mallocz(sizeof(AVStream)); |
|
| 717 | 717 |
memcpy(st, ic->streams[i], sizeof(AVStream)); |
| 718 | 718 |
st->info = av_malloc(sizeof(*st->info)); |
| 719 | 719 |
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 |
- } |
|
| 725 | 720 |
avcodec_copy_context(st->codec, ic->streams[i]->codec); |
| 726 |
- s->streams[i] = st; |
|
| 727 | 721 |
|
| 728 |
- codec = avcodec_find_encoder(st->codec->codec_id); |
|
| 729 | 722 |
if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
|
| 730 | 723 |
if (audio_stream_copy) {
|
| 731 | 724 |
st->stream_copy = 1; |
| ... | ... |
@@ -740,13 +741,8 @@ static int read_ffserver_streams(AVFormatContext *s, const char *filename) |
| 740 | 740 |
|
| 741 | 741 |
if(st->codec->flags & CODEC_FLAG_BITEXACT) |
| 742 | 742 |
nopts = 1; |
| 743 |
- |
|
| 744 |
- new_output_stream(s, nb_output_files); |
|
| 745 | 743 |
} |
| 746 | 744 |
|
| 747 |
- if (!nopts) |
|
| 748 |
- s->timestamp = av_gettime(); |
|
| 749 |
- |
|
| 750 | 745 |
av_close_input_file(ic); |
| 751 | 746 |
return 0; |
| 752 | 747 |
} |
| ... | ... |
@@ -2102,7 +2098,6 @@ static int transcode(AVFormatContext **output_files, |
| 2102 | 2102 |
for(i=0;i<os->nb_streams;i++,n++) {
|
| 2103 | 2103 |
int found; |
| 2104 | 2104 |
ost = ost_table[n] = output_streams_for_file[k][i]; |
| 2105 |
- ost->st = os->streams[i]; |
|
| 2106 | 2105 |
if (nb_stream_maps > 0) {
|
| 2107 | 2106 |
ost->source_index = input_files[stream_maps[n].file_index].ist_index + |
| 2108 | 2107 |
stream_maps[n].stream_index; |
| ... | ... |
@@ -2278,6 +2273,9 @@ static int transcode(AVFormatContext **output_files, |
| 2278 | 2278 |
} |
| 2279 | 2279 |
choose_sample_rate(ost->st, ost->enc); |
| 2280 | 2280 |
codec->time_base = (AVRational){1, codec->sample_rate};
|
| 2281 |
+ if (codec->sample_fmt == AV_SAMPLE_FMT_NONE) |
|
| 2282 |
+ codec->sample_fmt = icodec->sample_fmt; |
|
| 2283 |
+ choose_sample_fmt(ost->st, ost->enc); |
|
| 2281 | 2284 |
if (!codec->channels) {
|
| 2282 | 2285 |
codec->channels = icodec->channels; |
| 2283 | 2286 |
codec->channel_layout = icodec->channel_layout; |
| ... | ... |
@@ -2738,12 +2736,11 @@ static int transcode(AVFormatContext **output_files, |
| 2738 | 2738 |
if (pkt.pts != AV_NOPTS_VALUE) |
| 2739 | 2739 |
pkt.pts += av_rescale_q(input_files[ist->file_index].ts_offset, AV_TIME_BASE_Q, ist->st->time_base); |
| 2740 | 2740 |
|
| 2741 |
- if (pkt.stream_index < nb_input_files_ts_scale[file_index] |
|
| 2742 |
- && input_files_ts_scale[file_index][pkt.stream_index]){
|
|
| 2741 |
+ if (ist->ts_scale) {
|
|
| 2743 | 2742 |
if(pkt.pts != AV_NOPTS_VALUE) |
| 2744 |
- pkt.pts *= input_files_ts_scale[file_index][pkt.stream_index]; |
|
| 2743 |
+ pkt.pts *= ist->ts_scale; |
|
| 2745 | 2744 |
if(pkt.dts != AV_NOPTS_VALUE) |
| 2746 |
- pkt.dts *= input_files_ts_scale[file_index][pkt.stream_index]; |
|
| 2745 |
+ pkt.dts *= ist->ts_scale; |
|
| 2747 | 2746 |
} |
| 2748 | 2747 |
|
| 2749 | 2748 |
// 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) |
| 3203 | 3203 |
if(stream >= MAX_STREAMS) |
| 3204 | 3204 |
ffmpeg_exit(1); |
| 3205 | 3205 |
|
| 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; |
|
| 3206 |
+ ts_scale = grow_array(ts_scale, sizeof(*ts_scale), &nb_ts_scale, stream + 1); |
|
| 3207 |
+ ts_scale[stream] = scale; |
|
| 3208 | 3208 |
return 0; |
| 3209 | 3209 |
} |
| 3210 | 3210 |
|
| ... | ... |
@@ -3222,7 +3219,14 @@ static int opt_start_time(const char *opt, const char *arg) |
| 3222 | 3222 |
|
| 3223 | 3223 |
static int opt_recording_timestamp(const char *opt, const char *arg) |
| 3224 | 3224 |
{
|
| 3225 |
- recording_timestamp = parse_time_or_die(opt, arg, 0) / 1000000; |
|
| 3225 |
+ char buf[128]; |
|
| 3226 |
+ int64_t recording_timestamp = parse_time_or_die(opt, arg, 0) / 1E6; |
|
| 3227 |
+ struct tm time = *gmtime((time_t*)&recording_timestamp); |
|
| 3228 |
+ strftime(buf, sizeof(buf), "creation_time=%FT%T%z", &time); |
|
| 3229 |
+ opt_metadata("metadata", buf);
|
|
| 3230 |
+ |
|
| 3231 |
+ av_log(NULL, AV_LOG_WARNING, "%s is deprecated, set the 'creation_time' metadata " |
|
| 3232 |
+ "tag instead.\n", opt); |
|
| 3226 | 3233 |
return 0; |
| 3227 | 3234 |
} |
| 3228 | 3235 |
|
| ... | ... |
@@ -3401,14 +3405,15 @@ static int opt_input_file(const char *opt, const char *filename) |
| 3401 | 3401 |
ist->file_index = nb_input_files; |
| 3402 | 3402 |
ist->discard = 1; |
| 3403 | 3403 |
|
| 3404 |
+ if (i < nb_ts_scale) |
|
| 3405 |
+ ist->ts_scale = ts_scale[i]; |
|
| 3406 |
+ |
|
| 3404 | 3407 |
switch (dec->codec_type) {
|
| 3405 | 3408 |
case AVMEDIA_TYPE_AUDIO: |
| 3406 | 3409 |
ist->dec = avcodec_find_decoder_by_name(audio_codec_name); |
| 3407 | 3410 |
if(!ist->dec) |
| 3408 | 3411 |
ist->dec = avcodec_find_decoder(dec->codec_id); |
| 3409 | 3412 |
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; |
|
| 3412 | 3413 |
if(audio_disable) |
| 3413 | 3414 |
st->discard= AVDISCARD_ALL; |
| 3414 | 3415 |
break; |
| ... | ... |
@@ -3475,6 +3480,9 @@ static int opt_input_file(const char *opt, const char *filename) |
| 3475 | 3475 |
frame_width = 0; |
| 3476 | 3476 |
audio_sample_rate = 0; |
| 3477 | 3477 |
audio_channels = 0; |
| 3478 |
+ audio_sample_fmt = AV_SAMPLE_FMT_NONE; |
|
| 3479 |
+ av_freep(&ts_scale); |
|
| 3480 |
+ nb_ts_scale = 0; |
|
| 3478 | 3481 |
|
| 3479 | 3482 |
av_freep(&video_codec_name); |
| 3480 | 3483 |
av_freep(&audio_codec_name); |
| ... | ... |
@@ -3535,23 +3543,20 @@ static void new_video_stream(AVFormatContext *oc, int file_idx) |
| 3535 | 3535 |
enum CodecID codec_id = CODEC_ID_NONE; |
| 3536 | 3536 |
AVCodec *codec= NULL; |
| 3537 | 3537 |
|
| 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 |
- |
|
| 3545 | 3538 |
if(!video_stream_copy){
|
| 3546 | 3539 |
if (video_codec_name) {
|
| 3547 | 3540 |
codec_id = find_codec_or_die(video_codec_name, AVMEDIA_TYPE_VIDEO, 1, |
| 3548 | 3541 |
avcodec_opts[AVMEDIA_TYPE_VIDEO]->strict_std_compliance); |
| 3549 | 3542 |
codec = avcodec_find_encoder_by_name(video_codec_name); |
| 3550 |
- ost->enc = codec; |
|
| 3551 | 3543 |
} else {
|
| 3552 | 3544 |
codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, AVMEDIA_TYPE_VIDEO); |
| 3553 | 3545 |
codec = avcodec_find_encoder(codec_id); |
| 3554 | 3546 |
} |
| 3547 |
+ } |
|
| 3548 |
+ |
|
| 3549 |
+ ost = new_output_stream(oc, file_idx, codec); |
|
| 3550 |
+ st = ost->st; |
|
| 3551 |
+ if (!video_stream_copy) {
|
|
| 3555 | 3552 |
ost->frame_aspect_ratio = frame_aspect_ratio; |
| 3556 | 3553 |
frame_aspect_ratio = 0; |
| 3557 | 3554 |
#if CONFIG_AVFILTER |
| ... | ... |
@@ -3560,7 +3565,6 @@ static void new_video_stream(AVFormatContext *oc, int file_idx) |
| 3560 | 3560 |
#endif |
| 3561 | 3561 |
} |
| 3562 | 3562 |
|
| 3563 |
- avcodec_get_context_defaults3(st->codec, codec); |
|
| 3564 | 3563 |
ost->bitstream_filters = video_bitstream_filters; |
| 3565 | 3564 |
video_bitstream_filters= NULL; |
| 3566 | 3565 |
|
| ... | ... |
@@ -3674,26 +3678,18 @@ static void new_audio_stream(AVFormatContext *oc, int file_idx) |
| 3674 | 3674 |
AVCodecContext *audio_enc; |
| 3675 | 3675 |
enum CodecID codec_id = CODEC_ID_NONE; |
| 3676 | 3676 |
|
| 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 |
- |
|
| 3684 | 3677 |
if(!audio_stream_copy){
|
| 3685 | 3678 |
if (audio_codec_name) {
|
| 3686 | 3679 |
codec_id = find_codec_or_die(audio_codec_name, AVMEDIA_TYPE_AUDIO, 1, |
| 3687 | 3680 |
avcodec_opts[AVMEDIA_TYPE_AUDIO]->strict_std_compliance); |
| 3688 | 3681 |
codec = avcodec_find_encoder_by_name(audio_codec_name); |
| 3689 |
- ost->enc = codec; |
|
| 3690 | 3682 |
} else {
|
| 3691 | 3683 |
codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, AVMEDIA_TYPE_AUDIO); |
| 3692 | 3684 |
codec = avcodec_find_encoder(codec_id); |
| 3693 | 3685 |
} |
| 3694 | 3686 |
} |
| 3695 |
- |
|
| 3696 |
- avcodec_get_context_defaults3(st->codec, codec); |
|
| 3687 |
+ ost = new_output_stream(oc, file_idx, codec); |
|
| 3688 |
+ st = ost->st; |
|
| 3697 | 3689 |
|
| 3698 | 3690 |
ost->bitstream_filters = audio_bitstream_filters; |
| 3699 | 3691 |
audio_bitstream_filters= NULL; |
| ... | ... |
@@ -3722,11 +3718,10 @@ static void new_audio_stream(AVFormatContext *oc, int file_idx) |
| 3722 | 3722 |
} |
| 3723 | 3723 |
if (audio_channels) |
| 3724 | 3724 |
audio_enc->channels = audio_channels; |
| 3725 |
- audio_enc->sample_fmt = audio_sample_fmt; |
|
| 3725 |
+ if (audio_sample_fmt != AV_SAMPLE_FMT_NONE) |
|
| 3726 |
+ audio_enc->sample_fmt = audio_sample_fmt; |
|
| 3726 | 3727 |
if (audio_sample_rate) |
| 3727 | 3728 |
audio_enc->sample_rate = audio_sample_rate; |
| 3728 |
- audio_enc->channel_layout = channel_layout; |
|
| 3729 |
- choose_sample_fmt(st, codec); |
|
| 3730 | 3729 |
} |
| 3731 | 3730 |
if (audio_language) {
|
| 3732 | 3731 |
av_dict_set(&st->metadata, "language", audio_language, 0); |
| ... | ... |
@@ -3742,21 +3737,16 @@ static void new_audio_stream(AVFormatContext *oc, int file_idx) |
| 3742 | 3742 |
static void new_data_stream(AVFormatContext *oc, int file_idx) |
| 3743 | 3743 |
{
|
| 3744 | 3744 |
AVStream *st; |
| 3745 |
- AVCodec *codec=NULL; |
|
| 3745 |
+ OutputStream *ost; |
|
| 3746 | 3746 |
AVCodecContext *data_enc; |
| 3747 | 3747 |
|
| 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); |
|
| 3748 |
+ ost = new_output_stream(oc, file_idx, NULL); |
|
| 3749 |
+ st = ost->st; |
|
| 3754 | 3750 |
data_enc = st->codec; |
| 3755 | 3751 |
if (!data_stream_copy) {
|
| 3756 | 3752 |
fprintf(stderr, "Data stream encoding not supported yet (only streamcopy)\n"); |
| 3757 | 3753 |
ffmpeg_exit(1); |
| 3758 | 3754 |
} |
| 3759 |
- avcodec_get_context_defaults3(st->codec, codec); |
|
| 3760 | 3755 |
|
| 3761 | 3756 |
data_enc->codec_type = AVMEDIA_TYPE_DATA; |
| 3762 | 3757 |
|
| ... | ... |
@@ -3784,25 +3774,19 @@ static void new_subtitle_stream(AVFormatContext *oc, int file_idx) |
| 3784 | 3784 |
AVCodecContext *subtitle_enc; |
| 3785 | 3785 |
enum CodecID codec_id = CODEC_ID_NONE; |
| 3786 | 3786 |
|
| 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; |
|
| 3794 | 3787 |
if(!subtitle_stream_copy){
|
| 3795 | 3788 |
if (subtitle_codec_name) {
|
| 3796 | 3789 |
codec_id = find_codec_or_die(subtitle_codec_name, AVMEDIA_TYPE_SUBTITLE, 1, |
| 3797 | 3790 |
avcodec_opts[AVMEDIA_TYPE_SUBTITLE]->strict_std_compliance); |
| 3798 | 3791 |
codec = avcodec_find_encoder_by_name(subtitle_codec_name); |
| 3799 |
- ost->enc = codec; |
|
| 3800 | 3792 |
} else {
|
| 3801 | 3793 |
codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, AVMEDIA_TYPE_SUBTITLE); |
| 3802 | 3794 |
codec = avcodec_find_encoder(codec_id); |
| 3803 | 3795 |
} |
| 3804 | 3796 |
} |
| 3805 |
- avcodec_get_context_defaults3(st->codec, codec); |
|
| 3797 |
+ ost = new_output_stream(oc, file_idx, codec); |
|
| 3798 |
+ st = ost->st; |
|
| 3799 |
+ subtitle_enc = st->codec; |
|
| 3806 | 3800 |
|
| 3807 | 3801 |
ost->bitstream_filters = subtitle_bitstream_filters; |
| 3808 | 3802 |
subtitle_bitstream_filters= NULL; |
| ... | ... |
@@ -3938,8 +3922,6 @@ static int opt_output_file(const char *opt, const char *filename) |
| 3938 | 3938 |
if (use_subtitle) new_subtitle_stream(oc, nb_output_files); |
| 3939 | 3939 |
if (use_data) new_data_stream(oc, nb_output_files); |
| 3940 | 3940 |
|
| 3941 |
- oc->timestamp = recording_timestamp; |
|
| 3942 |
- |
|
| 3943 | 3941 |
av_dict_copy(&oc->metadata, metadata, 0); |
| 3944 | 3942 |
av_dict_free(&metadata); |
| 3945 | 3943 |
} |
| ... | ... |
@@ -4005,6 +3987,7 @@ static int opt_output_file(const char *opt, const char *filename) |
| 4005 | 4005 |
frame_height = 0; |
| 4006 | 4006 |
audio_sample_rate = 0; |
| 4007 | 4007 |
audio_channels = 0; |
| 4008 |
+ audio_sample_fmt = AV_SAMPLE_FMT_NONE; |
|
| 4008 | 4009 |
|
| 4009 | 4010 |
av_freep(&forced_key_frames); |
| 4010 | 4011 |
uninit_opts(); |
| ... | ... |
@@ -1431,7 +1431,7 @@ static int queue_picture(VideoState *is, AVFrame *src_frame, double pts1, int64_ |
| 1431 | 1431 |
|
| 1432 | 1432 |
static int get_video_frame(VideoState *is, AVFrame *frame, int64_t *pts, AVPacket *pkt) |
| 1433 | 1433 |
{
|
| 1434 |
- int len1 av_unused, got_picture, i; |
|
| 1434 |
+ int got_picture, i; |
|
| 1435 | 1435 |
|
| 1436 | 1436 |
if (packet_queue_get(&is->videoq, pkt, 1) < 0) |
| 1437 | 1437 |
return -1; |
| ... | ... |
@@ -1458,9 +1458,7 @@ static int get_video_frame(VideoState *is, AVFrame *frame, int64_t *pts, AVPacke |
| 1458 | 1458 |
return 0; |
| 1459 | 1459 |
} |
| 1460 | 1460 |
|
| 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); |
|
| 1464 | 1462 |
|
| 1465 | 1463 |
if (got_picture) {
|
| 1466 | 1464 |
if (decoder_reorder_pts == -1) {
|
| ... | ... |
@@ -1807,7 +1805,7 @@ static int subtitle_thread(void *arg) |
| 1807 | 1807 |
VideoState *is = arg; |
| 1808 | 1808 |
SubPicture *sp; |
| 1809 | 1809 |
AVPacket pkt1, *pkt = &pkt1; |
| 1810 |
- int len1 av_unused, got_subtitle; |
|
| 1810 |
+ int got_subtitle; |
|
| 1811 | 1811 |
double pts; |
| 1812 | 1812 |
int i, j; |
| 1813 | 1813 |
int r, g, b, y, u, v, a; |
| ... | ... |
@@ -1841,9 +1839,9 @@ static int subtitle_thread(void *arg) |
| 1841 | 1841 |
if (pkt->pts != AV_NOPTS_VALUE) |
| 1842 | 1842 |
pts = av_q2d(is->subtitle_st->time_base)*pkt->pts; |
| 1843 | 1843 |
|
| 1844 |
- len1 = avcodec_decode_subtitle2(is->subtitle_st->codec, |
|
| 1845 |
- &sp->sub, &got_subtitle, |
|
| 1846 |
- pkt); |
|
| 1844 |
+ avcodec_decode_subtitle2(is->subtitle_st->codec, &sp->sub, |
|
| 1845 |
+ &got_subtitle, pkt); |
|
| 1846 |
+ |
|
| 1847 | 1847 |
if (got_subtitle && sp->sub.format == 0) {
|
| 1848 | 1848 |
sp->pts = pts; |
| 1849 | 1849 |
|
| ... | ... |
@@ -28,6 +28,7 @@ |
| 28 | 28 |
#include "avcodec.h" |
| 29 | 29 |
#include "dsputil.h" |
| 30 | 30 |
#include "mpegvideo.h" |
| 31 |
+#include "mpegvideo_common.h" |
|
| 31 | 32 |
#include "dnxhdenc.h" |
| 32 | 33 |
|
| 33 | 34 |
#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM |
| ... | ... |
@@ -38,8 +39,6 @@ static const AVOption options[]={
|
| 38 | 38 |
}; |
| 39 | 39 |
static const AVClass class = { "dnxhd", av_default_item_name, options, LIBAVUTIL_VERSION_INT };
|
| 40 | 40 |
|
| 41 |
-int dct_quantize_c(MpegEncContext *s, DCTELEM *block, int n, int qscale, int *overflow); |
|
| 42 |
- |
|
| 43 | 41 |
#define LAMBDA_FRAC_BITS 10 |
| 44 | 42 |
|
| 45 | 43 |
static av_always_inline void dnxhd_get_pixels_8x4(DCTELEM *restrict block, const uint8_t *pixels, int line_size) |
| ... | ... |
@@ -770,8 +770,6 @@ static av_always_inline int get_chroma_qp(H264Context *h, int t, int qscale){
|
| 770 | 770 |
return h->pps.chroma_qp_table[t][qscale]; |
| 771 | 771 |
} |
| 772 | 772 |
|
| 773 |
-static av_always_inline void pred_pskip_motion(H264Context * const h); |
|
| 774 |
- |
|
| 775 | 773 |
static void fill_decode_neighbors(H264Context *h, int mb_type){
|
| 776 | 774 |
MpegEncContext * const s = &h->s; |
| 777 | 775 |
const int mb_xy= h->mb_xy; |
| ... | ... |
@@ -1302,45 +1300,4 @@ static av_always_inline int get_dct8x8_allowed(H264Context *h){
|
| 1302 | 1302 |
return !(AV_RN64A(h->sub_mb_type) & ((MB_TYPE_16x8|MB_TYPE_8x16|MB_TYPE_8x8|MB_TYPE_DIRECT2)*0x0001000100010001ULL)); |
| 1303 | 1303 |
} |
| 1304 | 1304 |
|
| 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 |
- |
|
| 1346 | 1305 |
#endif /* AVCODEC_H264_H */ |
| ... | ... |
@@ -327,4 +327,43 @@ zeromv: |
| 327 | 327 |
return; |
| 328 | 328 |
} |
| 329 | 329 |
|
| 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 |
+ |
|
| 330 | 369 |
#endif /* AVCODEC_H264_MVPRED_H */ |
| ... | ... |
@@ -698,7 +698,12 @@ typedef struct AVFormatContext {
|
| 698 | 698 |
AVStream **streams; |
| 699 | 699 |
char filename[1024]; /**< input or output filename */ |
| 700 | 700 |
/* 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 |
|
| 702 | 707 |
|
| 703 | 708 |
int ctx_flags; /**< Format-specific flags, see AVFMTCTX_xx */ |
| 704 | 709 |
/* private data for pts handling (do not modify directly). */ |
| ... | ... |
@@ -43,7 +43,7 @@ struct DVMuxContext {
|
| 43 | 43 |
AVStream *ast[2]; /* stereo audio streams */ |
| 44 | 44 |
AVFifoBuffer *audio_data[2]; /* FIFO for storing excessive amounts of PCM */ |
| 45 | 45 |
int frames; /* current frame number */ |
| 46 |
- time_t start_time; /* recording start time */ |
|
| 46 |
+ int64_t start_time; /* recording start time */ |
|
| 47 | 47 |
int has_audio; /* frame under contruction has audio */ |
| 48 | 48 |
int has_video; /* frame under contruction has video */ |
| 49 | 49 |
uint8_t frame_buf[DV_MAX_FRAME_SIZE]; /* frame under contruction */ |
| ... | ... |
@@ -290,6 +290,7 @@ static DVMuxContext* dv_init_mux(AVFormatContext* s) |
| 290 | 290 |
{
|
| 291 | 291 |
DVMuxContext *c = s->priv_data; |
| 292 | 292 |
AVStream *vst = NULL; |
| 293 |
+ AVDictionaryEntry *t; |
|
| 293 | 294 |
int i; |
| 294 | 295 |
|
| 295 | 296 |
/* we support at most 1 video and 2 audio streams */ |
| ... | ... |
@@ -337,7 +338,16 @@ static DVMuxContext* dv_init_mux(AVFormatContext* s) |
| 337 | 337 |
c->frames = 0; |
| 338 | 338 |
c->has_audio = 0; |
| 339 | 339 |
c->has_video = 0; |
| 340 |
- c->start_time = (time_t)s->timestamp; |
|
| 340 |
+#if FF_API_TIMESTAMP |
|
| 341 |
+ if (s->timestamp) |
|
| 342 |
+ c->start_time = s->timestamp; |
|
| 343 |
+ else |
|
| 344 |
+#endif |
|
| 345 |
+ if (t = av_dict_get(s->metadata, "creation_time", NULL, 0)) {
|
|
| 346 |
+ struct tm time = {0};
|
|
| 347 |
+ strptime(t->value, "%Y - %m - %dT%T", &time); |
|
| 348 |
+ c->start_time = mktime(&time); |
|
| 349 |
+ } |
|
| 341 | 350 |
|
| 342 | 351 |
for (i=0; i < c->n_ast; i++) {
|
| 343 | 352 |
if (c->ast[i] && !(c->audio_data[i]=av_fifo_alloc(100*AVCODEC_MAX_AUDIO_FRAME_SIZE))) {
|
| ... | ... |
@@ -394,6 +394,20 @@ static int gxf_write_umf_material_description(AVFormatContext *s) |
| 394 | 394 |
GXFContext *gxf = s->priv_data; |
| 395 | 395 |
AVIOContext *pb = s->pb; |
| 396 | 396 |
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 |
+ |
|
| 397 | 411 |
|
| 398 | 412 |
// XXX drop frame |
| 399 | 413 |
uint32_t timecode = |
| ... | ... |
@@ -409,8 +423,8 @@ static int gxf_write_umf_material_description(AVFormatContext *s) |
| 409 | 409 |
avio_wl32(pb, gxf->nb_fields); /* mark out */ |
| 410 | 410 |
avio_wl32(pb, 0); /* timecode mark in */ |
| 411 | 411 |
avio_wl32(pb, timecode); /* timecode mark out */ |
| 412 |
- avio_wl64(pb, s->timestamp); /* modification time */ |
|
| 413 |
- avio_wl64(pb, s->timestamp); /* creation time */ |
|
| 412 |
+ avio_wl64(pb, timestamp); /* modification time */ |
|
| 413 |
+ avio_wl64(pb, timestamp); /* creation time */ |
|
| 414 | 414 |
avio_wl16(pb, 0); /* reserved */ |
| 415 | 415 |
avio_wl16(pb, 0); /* reserved */ |
| 416 | 416 |
avio_wl16(pb, gxf->audio_tracks); |
| ... | ... |
@@ -1212,7 +1212,7 @@ AVOutputFormat ff_matroska_muxer = {
|
| 1212 | 1212 |
mkv_write_trailer, |
| 1213 | 1213 |
.flags = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS, |
| 1214 | 1214 |
.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, |
|
| 1216 | 1216 |
}; |
| 1217 | 1217 |
#endif |
| 1218 | 1218 |
|
| ... | ... |
@@ -2142,6 +2142,7 @@ static int mov_write_header(AVFormatContext *s) |
| 2142 | 2142 |
{
|
| 2143 | 2143 |
AVIOContext *pb = s->pb; |
| 2144 | 2144 |
MOVMuxContext *mov = s->priv_data; |
| 2145 |
+ AVDictionaryEntry *t; |
|
| 2145 | 2146 |
int i, hint_track = 0; |
| 2146 | 2147 |
|
| 2147 | 2148 |
if (!s->pb->seekable) {
|
| ... | ... |
@@ -2272,7 +2273,18 @@ static int mov_write_header(AVFormatContext *s) |
| 2272 | 2272 |
} |
| 2273 | 2273 |
|
| 2274 | 2274 |
mov_write_mdat_tag(pb, mov); |
| 2275 |
- mov->time = s->timestamp + 0x7C25B080; //1970 based -> 1904 based |
|
| 2275 |
+ |
|
| 2276 |
+#if FF_API_TIMESTAMP |
|
| 2277 |
+ if (s->timestamp) |
|
| 2278 |
+ mov->time = s->timestamp; |
|
| 2279 |
+ else |
|
| 2280 |
+#endif |
|
| 2281 |
+ if (t = av_dict_get(s->metadata, "creation_time", NULL, 0)) {
|
|
| 2282 |
+ struct tm time = {0};
|
|
| 2283 |
+ strptime(t->value, "%Y - %m - %dT%T", &time); |
|
| 2284 |
+ mov->time = mktime(&time); |
|
| 2285 |
+ } |
|
| 2286 |
+ mov->time += 0x7C25B080; //1970 based -> 1904 based |
|
| 2276 | 2287 |
|
| 2277 | 2288 |
if (mov->chapter_track) |
| 2278 | 2289 |
mov_create_chapter_track(s, mov->chapter_track); |
| ... | ... |
@@ -1407,6 +1407,8 @@ static int mxf_write_header(AVFormatContext *s) |
| 1407 | 1407 |
int i; |
| 1408 | 1408 |
uint8_t present[FF_ARRAY_ELEMS(mxf_essence_container_uls)] = {0};
|
| 1409 | 1409 |
const int *samples_per_frame = NULL; |
| 1410 |
+ AVDictionaryEntry *t; |
|
| 1411 |
+ int64_t timestamp = 0; |
|
| 1410 | 1412 |
|
| 1411 | 1413 |
if (!s->nb_streams) |
| 1412 | 1414 |
return -1; |
| ... | ... |
@@ -1512,8 +1514,18 @@ static int mxf_write_header(AVFormatContext *s) |
| 1512 | 1512 |
sc->order = AV_RB32(sc->track_essence_element_key+12); |
| 1513 | 1513 |
} |
| 1514 | 1514 |
|
| 1515 |
+#if FF_API_TIMESTAMP |
|
| 1515 | 1516 |
if (s->timestamp) |
| 1516 |
- mxf->timestamp = mxf_parse_timestamp(s->timestamp); |
|
| 1517 |
+ timestamp = s->timestamp; |
|
| 1518 |
+ else |
|
| 1519 |
+#endif |
|
| 1520 |
+ if (t = av_dict_get(s->metadata, "creation_time", NULL, 0)) {
|
|
| 1521 |
+ struct tm time = {0};
|
|
| 1522 |
+ strptime(t->value, "%Y - %m - %dT%T", &time); |
|
| 1523 |
+ timestamp = mktime(&time); |
|
| 1524 |
+ } |
|
| 1525 |
+ if (timestamp) |
|
| 1526 |
+ mxf->timestamp = mxf_parse_timestamp(timestamp); |
|
| 1517 | 1527 |
mxf->duration = -1; |
| 1518 | 1528 |
|
| 1519 | 1529 |
mxf->timecode_track = av_mallocz(sizeof(*mxf->timecode_track)); |
| ... | ... |
@@ -605,15 +605,15 @@ static int64_t ogg_read_timestamp(AVFormatContext *s, int stream_index, |
| 605 | 605 |
int64_t *pos_arg, int64_t pos_limit) |
| 606 | 606 |
{
|
| 607 | 607 |
struct ogg *ogg = s->priv_data; |
| 608 |
- struct ogg_stream *os = ogg->streams + stream_index; |
|
| 609 | 608 |
AVIOContext *bc = s->pb; |
| 610 | 609 |
int64_t pts = AV_NOPTS_VALUE; |
| 611 |
- int i; |
|
| 610 |
+ int i = -1; |
|
| 612 | 611 |
avio_seek(bc, *pos_arg, SEEK_SET); |
| 613 | 612 |
ogg_reset(ogg); |
| 614 | 613 |
|
| 615 | 614 |
while (avio_tell(bc) < pos_limit && !ogg_packet(s, &i, NULL, NULL, pos_arg)) {
|
| 616 | 615 |
if (i == stream_index) {
|
| 616 |
+ struct ogg_stream *os = ogg->streams + stream_index; |
|
| 617 | 617 |
pts = ogg_calc_pts(s, i, NULL); |
| 618 | 618 |
if (os->keyframe_seek && !(os->pflags & AV_PKT_FLAG_KEY)) |
| 619 | 619 |
pts = AV_NOPTS_VALUE; |
| ... | ... |
@@ -639,6 +639,7 @@ static int ogg_read_seek(AVFormatContext *s, int stream_index, |
| 639 | 639 |
os->keyframe_seek = 1; |
| 640 | 640 |
|
| 641 | 641 |
ret = av_seek_frame_binary(s, stream_index, timestamp, flags); |
| 642 |
+ os = ogg->streams + stream_index; |
|
| 642 | 643 |
if (ret < 0) |
| 643 | 644 |
os->keyframe_seek = 0; |
| 644 | 645 |
return ret; |
| ... | ... |
@@ -918,9 +918,9 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
|
| 918 | 918 |
.log2_chroma_w= 0, |
| 919 | 919 |
.log2_chroma_h= 0, |
| 920 | 920 |
.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 */
|
|
| 924 | 924 |
}, |
| 925 | 925 |
.flags = PIX_FMT_BE, |
| 926 | 926 |
}, |