Commit 50c629a2 authored by romansh's avatar romansh

   * making it possible to specify recording date and time in a stream


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@2971 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 3b8d6655
...@@ -166,6 +166,7 @@ static int audio_codec_id = CODEC_ID_NONE; ...@@ -166,6 +166,7 @@ static int audio_codec_id = CODEC_ID_NONE;
static int64_t recording_time = 0; static int64_t recording_time = 0;
static int64_t start_time = 0; static int64_t start_time = 0;
static int64_t rec_timestamp = 0;
static int file_overwrite = 0; static int file_overwrite = 0;
static char *str_title = NULL; static char *str_title = NULL;
static char *str_author = NULL; static char *str_author = NULL;
...@@ -2213,6 +2214,11 @@ static void opt_start_time(const char *arg) ...@@ -2213,6 +2214,11 @@ static void opt_start_time(const char *arg)
start_time = parse_date(arg, 1); start_time = parse_date(arg, 1);
} }
static void opt_rec_timestamp(const char *arg)
{
rec_timestamp = parse_date(arg, 0) / 1000000;
}
static void opt_input_file(const char *filename) static void opt_input_file(const char *filename)
{ {
AVFormatContext *ic; AVFormatContext *ic;
...@@ -2658,6 +2664,8 @@ static void opt_output_file(const char *filename) ...@@ -2658,6 +2664,8 @@ static void opt_output_file(const char *filename)
exit(1); exit(1);
} }
oc->timestamp = rec_timestamp;
if (str_title) if (str_title)
pstrcpy(oc->title, sizeof(oc->title), str_title); pstrcpy(oc->title, sizeof(oc->title), str_title);
if (str_author) if (str_author)
...@@ -3127,6 +3135,7 @@ const OptionDef options[] = { ...@@ -3127,6 +3135,7 @@ const OptionDef options[] = {
{ "t", HAS_ARG, {(void*)opt_recording_time}, "set the recording time", "duration" }, { "t", HAS_ARG, {(void*)opt_recording_time}, "set the recording time", "duration" },
{ "ss", HAS_ARG, {(void*)opt_start_time}, "set the start time offset", "time_off" }, { "ss", HAS_ARG, {(void*)opt_start_time}, "set the start time offset", "time_off" },
{ "title", HAS_ARG | OPT_STRING, {(void*)&str_title}, "set the title", "string" }, { "title", HAS_ARG | OPT_STRING, {(void*)&str_title}, "set the title", "string" },
{ "timestamp", HAS_ARG, {(void*)&opt_rec_timestamp}, "set the timestamp", "time" },
{ "author", HAS_ARG | OPT_STRING, {(void*)&str_author}, "set the author", "string" }, { "author", HAS_ARG | OPT_STRING, {(void*)&str_author}, "set the author", "string" },
{ "copyright", HAS_ARG | OPT_STRING, {(void*)&str_copyright}, "set the copyright", "string" }, { "copyright", HAS_ARG | OPT_STRING, {(void*)&str_copyright}, "set the copyright", "string" },
{ "comment", HAS_ARG | OPT_STRING, {(void*)&str_comment}, "set the comment", "string" }, { "comment", HAS_ARG | OPT_STRING, {(void*)&str_comment}, "set the comment", "string" },
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <sys/poll.h> #include <sys/poll.h>
#include <errno.h> #include <errno.h>
#include <sys/time.h> #include <sys/time.h>
#undef time //needed because HAVE_AV_CONFIG_H is defined on top
#include <time.h> #include <time.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
......
...@@ -251,6 +251,7 @@ typedef struct AVFormatContext { ...@@ -251,6 +251,7 @@ typedef struct AVFormatContext {
AVStream *streams[MAX_STREAMS]; AVStream *streams[MAX_STREAMS];
char filename[1024]; /* input or output filename */ char filename[1024]; /* input or output filename */
/* stream info */ /* stream info */
int64_t timestamp;
char title[512]; char title[512];
char author[512]; char author[512];
char copyright[512]; char copyright[512];
......
...@@ -685,7 +685,7 @@ DVMuxContext* dv_init_mux(AVFormatContext* s) ...@@ -685,7 +685,7 @@ DVMuxContext* dv_init_mux(AVFormatContext* s)
/* Ok, everything seems to be in working order */ /* Ok, everything seems to be in working order */
c->frames = 0; c->frames = 0;
c->has_audio = c->has_video = 0; c->has_audio = c->has_video = 0;
c->start_time = 0; c->start_time = (time_t)s->timestamp;
c->aspect = 0; /* 4:3 is the default */ c->aspect = 0; /* 4:3 is the default */
if ((int)(av_q2d(vst->codec.sample_aspect_ratio) * vst->codec.width / vst->codec.height * 10) == 17) /* 16:9 */ if ((int)(av_q2d(vst->codec.sample_aspect_ratio) * vst->codec.width / vst->codec.height * 10) == 17) /* 16:9 */
c->aspect = 0x07; c->aspect = 0x07;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment