Commit 3438d82d authored by Baptiste Coudurier's avatar Baptiste Coudurier

remove ugly ffm_nopts hack, use AVFormatContext->timestamp

Originally committed as revision 13718 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent fbd971a4
...@@ -427,6 +427,7 @@ static int read_ffserver_streams(AVFormatContext *s, const char *filename) ...@@ -427,6 +427,7 @@ static int read_ffserver_streams(AVFormatContext *s, const char *filename)
{ {
int i, err; int i, err;
AVFormatContext *ic; AVFormatContext *ic;
int nopts = 0;
err = av_open_input_file(&ic, filename, NULL, FFM_PACKET_SIZE, NULL); err = av_open_input_file(&ic, filename, NULL, FFM_PACKET_SIZE, NULL);
if (err < 0) if (err < 0)
...@@ -442,8 +443,13 @@ static int read_ffserver_streams(AVFormatContext *s, const char *filename) ...@@ -442,8 +443,13 @@ static int read_ffserver_streams(AVFormatContext *s, const char *filename)
st->codec = avcodec_alloc_context(); st->codec = avcodec_alloc_context();
memcpy(st->codec, ic->streams[i]->codec, sizeof(AVCodecContext)); memcpy(st->codec, ic->streams[i]->codec, sizeof(AVCodecContext));
s->streams[i] = st; s->streams[i] = st;
if(st->codec->flags & CODEC_FLAG_BITEXACT)
nopts = 1;
} }
if (!nopts)
s->timestamp = av_gettime();
av_close_input_file(ic); av_close_input_file(ic);
return 0; return 0;
} }
...@@ -2177,8 +2183,6 @@ static void opt_format(const char *arg) ...@@ -2177,8 +2183,6 @@ static void opt_format(const char *arg)
} }
} }
extern int ffm_nopts;
static int opt_default(const char *opt, const char *arg){ static int opt_default(const char *opt, const char *arg){
int type; int type;
const AVOption *o= NULL; const AVOption *o= NULL;
...@@ -2210,12 +2214,6 @@ static int opt_default(const char *opt, const char *arg){ ...@@ -2210,12 +2214,6 @@ static int opt_default(const char *opt, const char *arg){
opt_names= av_realloc(opt_names, sizeof(void*)*(opt_name_count+1)); opt_names= av_realloc(opt_names, sizeof(void*)*(opt_name_count+1));
opt_names[opt_name_count++]= o->name; opt_names[opt_name_count++]= o->name;
#ifdef CONFIG_FFM_MUXER
/* disable generate of real time pts in ffm (need to be supressed anyway) */
if(avctx_opts[0]->flags & CODEC_FLAG_BITEXACT)
ffm_nopts = 1;
#endif
if(avctx_opts[0]->debug) if(avctx_opts[0]->debug)
av_log_set_level(AV_LOG_DEBUG); av_log_set_level(AV_LOG_DEBUG);
return 0; return 0;
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#define FFMPEG_AVFORMAT_H #define FFMPEG_AVFORMAT_H
#define LIBAVFORMAT_VERSION_MAJOR 52 #define LIBAVFORMAT_VERSION_MAJOR 52
#define LIBAVFORMAT_VERSION_MINOR 14 #define LIBAVFORMAT_VERSION_MINOR 15
#define LIBAVFORMAT_VERSION_MICRO 0 #define LIBAVFORMAT_VERSION_MICRO 0
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
......
...@@ -51,7 +51,6 @@ typedef struct FFMContext { ...@@ -51,7 +51,6 @@ typedef struct FFMContext {
int64_t pts; int64_t pts;
uint8_t *packet_ptr, *packet_end; uint8_t *packet_ptr, *packet_end;
uint8_t packet[FFM_PACKET_SIZE]; uint8_t packet[FFM_PACKET_SIZE];
int64_t start_time;
} FFMContext; } FFMContext;
#endif /* FFMPEG_FFM_H */ #endif /* FFMPEG_FFM_H */
...@@ -22,9 +22,6 @@ ...@@ -22,9 +22,6 @@
#include "avformat.h" #include "avformat.h"
#include "ffm.h" #include "ffm.h"
/* disable pts hack for testing */
int ffm_nopts = 0;
static void flush_packet(AVFormatContext *s) static void flush_packet(AVFormatContext *s)
{ {
FFMContext *ffm = s->priv_data; FFMContext *ffm = s->priv_data;
...@@ -173,12 +170,6 @@ static int ffm_write_header(AVFormatContext *s) ...@@ -173,12 +170,6 @@ static int ffm_write_header(AVFormatContext *s)
} }
} }
/* hack to have real time */
if (ffm_nopts)
ffm->start_time = 0;
else
ffm->start_time = av_gettime();
/* flush until end of block reached */ /* flush until end of block reached */
while ((url_ftell(pb) % ffm->packet_size) != 0) while ((url_ftell(pb) % ffm->packet_size) != 0)
put_byte(pb, 0); put_byte(pb, 0);
...@@ -203,7 +194,7 @@ static int ffm_write_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -203,7 +194,7 @@ static int ffm_write_packet(AVFormatContext *s, AVPacket *pkt)
int64_t pts; int64_t pts;
uint8_t header[FRAME_HEADER_SIZE]; uint8_t header[FRAME_HEADER_SIZE];
pts = ffm->start_time + pkt->pts; pts = s->timestamp + pkt->pts;
/* packet size & key_frame */ /* packet size & key_frame */
header[0] = pkt->stream_index; header[0] = pkt->stream_index;
header[1] = 0; header[1] = 0;
......
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