Commit 09f3c937 authored by Vladimir Pantelic's avatar Vladimir Pantelic Committed by Anton Khirnov

asfenc: remember send time and offset of the index entries

Signed-off-by: 's avatarVladimir Pantelic <vladoman@gmail.com>
Signed-off-by: 's avatarAnton Khirnov <anton@khirnov.net>
parent 1eb93280
...@@ -78,6 +78,8 @@ typedef struct ASFMainHeader { ...@@ -78,6 +78,8 @@ typedef struct ASFMainHeader {
typedef struct ASFIndex { typedef struct ASFIndex {
uint32_t packet_number; uint32_t packet_number;
uint16_t packet_count; uint16_t packet_count;
uint64_t send_time;
uint64_t offset;
} ASFIndex; } ASFIndex;
extern const ff_asf_guid ff_asf_header; extern const ff_asf_guid ff_asf_header;
......
...@@ -762,12 +762,14 @@ static void put_frame(AVFormatContext *s, ASFStream *stream, AVStream *avst, ...@@ -762,12 +762,14 @@ static void put_frame(AVFormatContext *s, ASFStream *stream, AVStream *avst,
static int asf_write_packet(AVFormatContext *s, AVPacket *pkt) static int asf_write_packet(AVFormatContext *s, AVPacket *pkt)
{ {
ASFContext *asf = s->priv_data; ASFContext *asf = s->priv_data;
AVIOContext *pb = s->pb;
ASFStream *stream; ASFStream *stream;
int64_t duration; int64_t duration;
AVCodecContext *codec; AVCodecContext *codec;
int64_t packet_st, pts; int64_t packet_st, pts;
int start_sec, i; int start_sec, i;
int flags = pkt->flags; int flags = pkt->flags;
uint64_t offset = avio_tell(pb);
codec = s->streams[pkt->stream_index]->codec; codec = s->streams[pkt->stream_index]->codec;
stream = &asf->streams[pkt->stream_index]; stream = &asf->streams[pkt->stream_index];
...@@ -802,6 +804,8 @@ static int asf_write_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -802,6 +804,8 @@ static int asf_write_packet(AVFormatContext *s, AVPacket *pkt)
// store // store
asf->index_ptr[i].packet_number = (uint32_t)packet_st; asf->index_ptr[i].packet_number = (uint32_t)packet_st;
asf->index_ptr[i].packet_count = (uint16_t)(asf->nb_packets - packet_st); asf->index_ptr[i].packet_count = (uint16_t)(asf->nb_packets - packet_st);
asf->index_ptr[i].send_time = start_sec * INT64_C(10000000);
asf->index_ptr[i].offset = offset;
asf->maximum_packet = FFMAX(asf->maximum_packet, asf->maximum_packet = FFMAX(asf->maximum_packet,
(uint16_t)(asf->nb_packets - packet_st)); (uint16_t)(asf->nb_packets - packet_st));
} }
......
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