diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-07-13 00:42:11 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-07-13 00:42:11 +0200 |
commit | bb258fb995a42112d1fe14f53ec599b2cd19b707 (patch) | |
tree | d7152f06fcff2c66509c57a5dd906ca225069ae1 /libavformat | |
parent | 896e59758a11ff645879098b5ebca2e753731b4e (diff) | |
parent | 2cb6dec61c8e6676105de628ba20a5b3d162976e (diff) | |
download | ffmpeg-bb258fb995a42112d1fe14f53ec599b2cd19b707.tar.gz |
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
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/avformat.h | 7 | ||||
-rw-r--r-- | libavformat/dvenc.c | 14 | ||||
-rw-r--r-- | libavformat/gxfenc.c | 18 | ||||
-rw-r--r-- | libavformat/matroskaenc.c | 2 | ||||
-rw-r--r-- | libavformat/movenc.c | 14 | ||||
-rw-r--r-- | libavformat/mxfenc.c | 14 | ||||
-rw-r--r-- | libavformat/oggdec.c | 5 | ||||
-rw-r--r-- | libavformat/version.h | 3 |
8 files changed, 67 insertions, 10 deletions
diff --git a/libavformat/avformat.h b/libavformat/avformat.h index a0c2047e61..7c041f6e80 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -698,7 +698,12 @@ typedef struct AVFormatContext { AVStream **streams; char filename[1024]; /**< input or output filename */ /* stream info */ - int64_t timestamp; +#if FF_API_TIMESTAMP + /** + * @deprecated use 'creation_time' metadata tag instead + */ + attribute_deprecated int64_t timestamp; +#endif int ctx_flags; /**< Format-specific flags, see AVFMTCTX_xx */ /* private data for pts handling (do not modify directly). */ diff --git a/libavformat/dvenc.c b/libavformat/dvenc.c index 0cbe7a5484..3b2a8eb711 100644 --- a/libavformat/dvenc.c +++ b/libavformat/dvenc.c @@ -43,7 +43,7 @@ struct DVMuxContext { AVStream *ast[2]; /* stereo audio streams */ AVFifoBuffer *audio_data[2]; /* FIFO for storing excessive amounts of PCM */ int frames; /* current frame number */ - time_t start_time; /* recording start time */ + int64_t start_time; /* recording start time */ int has_audio; /* frame under contruction has audio */ int has_video; /* frame under contruction has video */ uint8_t frame_buf[DV_MAX_FRAME_SIZE]; /* frame under contruction */ @@ -290,6 +290,7 @@ static DVMuxContext* dv_init_mux(AVFormatContext* s) { DVMuxContext *c = s->priv_data; AVStream *vst = NULL; + AVDictionaryEntry *t; int i; /* we support at most 1 video and 2 audio streams */ @@ -337,7 +338,16 @@ static DVMuxContext* dv_init_mux(AVFormatContext* s) c->frames = 0; c->has_audio = 0; c->has_video = 0; - c->start_time = (time_t)s->timestamp; +#if FF_API_TIMESTAMP + if (s->timestamp) + c->start_time = s->timestamp; + else +#endif + if (t = av_dict_get(s->metadata, "creation_time", NULL, 0)) { + struct tm time = {0}; + strptime(t->value, "%Y - %m - %dT%T", &time); + c->start_time = mktime(&time); + } for (i=0; i < c->n_ast; i++) { if (c->ast[i] && !(c->audio_data[i]=av_fifo_alloc(100*AVCODEC_MAX_AUDIO_FRAME_SIZE))) { diff --git a/libavformat/gxfenc.c b/libavformat/gxfenc.c index da25ddcc2a..62ee4eb751 100644 --- a/libavformat/gxfenc.c +++ b/libavformat/gxfenc.c @@ -394,6 +394,20 @@ static int gxf_write_umf_material_description(AVFormatContext *s) GXFContext *gxf = s->priv_data; AVIOContext *pb = s->pb; int timecode_base = gxf->time_base.den == 60000 ? 60 : 50; + int64_t timestamp = 0; + AVDictionaryEntry *t; + +#if FF_API_TIMESTAMP + if (s->timestamp) + timestamp = s->timestamp; + else +#endif + if (t = av_dict_get(s->metadata, "creation_time", NULL, 0)) { + struct tm time = {0}; + strptime(t->value, "%Y - %m - %dT%T", &time); + timestamp = mktime(&time); + } + // XXX drop frame uint32_t timecode = @@ -409,8 +423,8 @@ static int gxf_write_umf_material_description(AVFormatContext *s) avio_wl32(pb, gxf->nb_fields); /* mark out */ avio_wl32(pb, 0); /* timecode mark in */ avio_wl32(pb, timecode); /* timecode mark out */ - avio_wl64(pb, s->timestamp); /* modification time */ - avio_wl64(pb, s->timestamp); /* creation time */ + avio_wl64(pb, timestamp); /* modification time */ + avio_wl64(pb, timestamp); /* creation time */ avio_wl16(pb, 0); /* reserved */ avio_wl16(pb, 0); /* reserved */ avio_wl16(pb, gxf->audio_tracks); diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 4bfd197c52..063e8320db 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -1212,7 +1212,7 @@ AVOutputFormat ff_matroska_muxer = { mkv_write_trailer, .flags = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS, .codec_tag = (const AVCodecTag* const []){ff_codec_bmp_tags, ff_codec_wav_tags, 0}, - .subtitle_codec = CODEC_ID_TEXT, + .subtitle_codec = CODEC_ID_SSA, }; #endif diff --git a/libavformat/movenc.c b/libavformat/movenc.c index b0cdcbc87c..41c59d49c1 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -2142,6 +2142,7 @@ static int mov_write_header(AVFormatContext *s) { AVIOContext *pb = s->pb; MOVMuxContext *mov = s->priv_data; + AVDictionaryEntry *t; int i, hint_track = 0; if (!s->pb->seekable) { @@ -2272,7 +2273,18 @@ static int mov_write_header(AVFormatContext *s) } mov_write_mdat_tag(pb, mov); - mov->time = s->timestamp + 0x7C25B080; //1970 based -> 1904 based + +#if FF_API_TIMESTAMP + if (s->timestamp) + mov->time = s->timestamp; + else +#endif + if (t = av_dict_get(s->metadata, "creation_time", NULL, 0)) { + struct tm time = {0}; + strptime(t->value, "%Y - %m - %dT%T", &time); + mov->time = mktime(&time); + } + mov->time += 0x7C25B080; //1970 based -> 1904 based if (mov->chapter_track) mov_create_chapter_track(s, mov->chapter_track); diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c index d44e7676d6..ad91c6a2ad 100644 --- a/libavformat/mxfenc.c +++ b/libavformat/mxfenc.c @@ -1407,6 +1407,8 @@ static int mxf_write_header(AVFormatContext *s) int i; uint8_t present[FF_ARRAY_ELEMS(mxf_essence_container_uls)] = {0}; const int *samples_per_frame = NULL; + AVDictionaryEntry *t; + int64_t timestamp = 0; if (!s->nb_streams) return -1; @@ -1512,8 +1514,18 @@ static int mxf_write_header(AVFormatContext *s) sc->order = AV_RB32(sc->track_essence_element_key+12); } +#if FF_API_TIMESTAMP if (s->timestamp) - mxf->timestamp = mxf_parse_timestamp(s->timestamp); + timestamp = s->timestamp; + else +#endif + if (t = av_dict_get(s->metadata, "creation_time", NULL, 0)) { + struct tm time = {0}; + strptime(t->value, "%Y - %m - %dT%T", &time); + timestamp = mktime(&time); + } + if (timestamp) + mxf->timestamp = mxf_parse_timestamp(timestamp); mxf->duration = -1; mxf->timecode_track = av_mallocz(sizeof(*mxf->timecode_track)); diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c index 597ea3bd80..cd5592208a 100644 --- a/libavformat/oggdec.c +++ b/libavformat/oggdec.c @@ -605,15 +605,15 @@ static int64_t ogg_read_timestamp(AVFormatContext *s, int stream_index, int64_t *pos_arg, int64_t pos_limit) { struct ogg *ogg = s->priv_data; - struct ogg_stream *os = ogg->streams + stream_index; AVIOContext *bc = s->pb; int64_t pts = AV_NOPTS_VALUE; - int i; + int i = -1; avio_seek(bc, *pos_arg, SEEK_SET); ogg_reset(ogg); while (avio_tell(bc) < pos_limit && !ogg_packet(s, &i, NULL, NULL, pos_arg)) { if (i == stream_index) { + struct ogg_stream *os = ogg->streams + stream_index; pts = ogg_calc_pts(s, i, NULL); if (os->keyframe_seek && !(os->pflags & AV_PKT_FLAG_KEY)) pts = AV_NOPTS_VALUE; @@ -639,6 +639,7 @@ static int ogg_read_seek(AVFormatContext *s, int stream_index, os->keyframe_seek = 1; ret = av_seek_frame_binary(s, stream_index, timestamp, flags); + os = ogg->streams + stream_index; if (ret < 0) os->keyframe_seek = 0; return ret; diff --git a/libavformat/version.h b/libavformat/version.h index 96cc6d4a14..7eb30768b5 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -86,5 +86,8 @@ #ifndef FF_API_LOOP_OUTPUT #define FF_API_LOOP_OUTPUT (LIBAVFORMAT_VERSION_MAJOR < 54) #endif +#ifndef FF_API_TIMESTAMP +#define FF_API_TIMESTAMP (LIBAVFORMAT_VERSION_MAJOR < 54) +#endif #endif /* AVFORMAT_VERSION_H */ |