1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

Set AVPacket pos also for audio packets in nuv demuxer.

Originally committed as revision 17904 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Reimar Döffinger 2009-03-09 11:35:59 +00:00
parent 082dea8e40
commit fb2e95c97a

View File

@ -197,6 +197,7 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt) {
int ret, size; int ret, size;
while (!url_feof(pb)) { while (!url_feof(pb)) {
int copyhdrsize = ctx->rtjpg_video ? HDRSIZE : 0; int copyhdrsize = ctx->rtjpg_video ? HDRSIZE : 0;
uint64_t pos = url_ftell(pb);
ret = get_buffer(pb, hdr, HDRSIZE); ret = get_buffer(pb, hdr, HDRSIZE);
if (ret <= 0) if (ret <= 0)
return ret ? ret : -1; return ret ? ret : -1;
@ -217,7 +218,7 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt) {
ret = av_new_packet(pkt, copyhdrsize + size); ret = av_new_packet(pkt, copyhdrsize + size);
if (ret < 0) if (ret < 0)
return ret; return ret;
pkt->pos = url_ftell(pb) - copyhdrsize; pkt->pos = pos;
pkt->pts = AV_RL32(&hdr[4]); pkt->pts = AV_RL32(&hdr[4]);
pkt->stream_index = ctx->v_id; pkt->stream_index = ctx->v_id;
memcpy(pkt->data, hdr, copyhdrsize); memcpy(pkt->data, hdr, copyhdrsize);
@ -230,6 +231,7 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt) {
break; break;
} }
ret = av_get_packet(pb, pkt, size); ret = av_get_packet(pb, pkt, size);
pkt->pos = pos;
pkt->pts = AV_RL32(&hdr[4]); pkt->pts = AV_RL32(&hdr[4]);
pkt->stream_index = ctx->a_id; pkt->stream_index = ctx->a_id;
return ret; return ret;