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

Don't use a pointer-to-flags/timestamp in ff_rm_parse_packet(); the function

used to return packet data, which might update the flags/timestamp to be
used for the next packet data returned by the demuxer. However, that was
separated out into a new function, and the flags/timestamp are thus never
updated within ff_rm_parse_packet() anymore, and thus do not need to be
a pointer.

Originally committed as revision 19539 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Ronald S. Bultje 2009-07-30 15:04:19 +00:00
parent e4b8d05d47
commit 34bddc39b4
3 changed files with 14 additions and 15 deletions

View File

@ -308,7 +308,7 @@ rdt_parse_packet (AVFormatContext *ctx, PayloadContext *rdt, AVStream *st,
init_put_byte(&pb, buf, len, 0, NULL, NULL, NULL, NULL); init_put_byte(&pb, buf, len, 0, NULL, NULL, NULL, NULL);
flags = (flags & RTP_FLAG_KEY) ? 2 : 0; flags = (flags & RTP_FLAG_KEY) ? 2 : 0;
res = ff_rm_parse_packet (rdt->rmctx, &pb, st, rdt->rmst[st->index], len, pkt, res = ff_rm_parse_packet (rdt->rmctx, &pb, st, rdt->rmst[st->index], len, pkt,
&seq, &flags, timestamp); &seq, flags, *timestamp);
pos = url_ftell(&pb); pos = url_ftell(&pb);
if (res < 0) if (res < 0)
return res; return res;

View File

@ -61,16 +61,15 @@ int ff_rm_read_mdpr_codecdata (AVFormatContext *s, ByteIOContext *pb,
* @param pkt packet location to store the parsed packet data * @param pkt packet location to store the parsed packet data
* @param seq pointer to an integer containing the sequence number, may be * @param seq pointer to an integer containing the sequence number, may be
* updated * updated
* @param flags pointer to an integer containing the packet flags, may be * @param flags the packet flags
updated * @param ts timestamp of the current packet
* @param ts pointer to timestamp, may be updated
* @return <0 on error, 0 if a packet was placed in the pkt pointer. A * @return <0 on error, 0 if a packet was placed in the pkt pointer. A
* value >0 means that no data was placed in pkt, but that cached * value >0 means that no data was placed in pkt, but that cached
* data is available by calling ff_rm_retrieve_cache(). * data is available by calling ff_rm_retrieve_cache().
*/ */
int ff_rm_parse_packet (AVFormatContext *s, ByteIOContext *pb, int ff_rm_parse_packet (AVFormatContext *s, ByteIOContext *pb,
AVStream *st, RMStream *rst, int len, AVStream *st, RMStream *rst, int len,
AVPacket *pkt, int *seq, int *flags, int64_t *ts); AVPacket *pkt, int *seq, int flags, int64_t ts);
/** /**
* Retrieve one cached packet from the rm-context. The real container can * Retrieve one cached packet from the rm-context. The real container can

View File

@ -689,7 +689,7 @@ rm_reorder_sipr_data (RMStream *ast)
int int
ff_rm_parse_packet (AVFormatContext *s, ByteIOContext *pb, ff_rm_parse_packet (AVFormatContext *s, ByteIOContext *pb,
AVStream *st, RMStream *ast, int len, AVPacket *pkt, AVStream *st, RMStream *ast, int len, AVPacket *pkt,
int *seq, int *flags, int64_t *timestamp) int *seq, int flags, int64_t timestamp)
{ {
RMDemuxContext *rm = s->priv_data; RMDemuxContext *rm = s->priv_data;
@ -709,10 +709,10 @@ ff_rm_parse_packet (AVFormatContext *s, ByteIOContext *pb,
int y = ast->sub_packet_cnt; int y = ast->sub_packet_cnt;
int w = ast->audio_framesize; int w = ast->audio_framesize;
if (*flags & 2) if (flags & 2)
y = ast->sub_packet_cnt = 0; y = ast->sub_packet_cnt = 0;
if (!y) if (!y)
ast->audiotimestamp = *timestamp; ast->audiotimestamp = timestamp;
switch(st->codec->codec_id) { switch(st->codec->codec_id) {
case CODEC_ID_RA_288: case CODEC_ID_RA_288:
@ -745,7 +745,7 @@ ff_rm_parse_packet (AVFormatContext *s, ByteIOContext *pb,
for (x = 0; x < ast->sub_packet_cnt; x++) for (x = 0; x < ast->sub_packet_cnt; x++)
ast->sub_packet_lengths[x] = get_be16(pb); ast->sub_packet_lengths[x] = get_be16(pb);
rm->audio_pkt_cnt = ast->sub_packet_cnt; rm->audio_pkt_cnt = ast->sub_packet_cnt;
ast->audiotimestamp = *timestamp; ast->audiotimestamp = timestamp;
} else } else
return -1; return -1;
} else { } else {
@ -763,15 +763,15 @@ ff_rm_parse_packet (AVFormatContext *s, ByteIOContext *pb,
int seq= 128*(pkt->data[2]&0x7F) + (pkt->data[3]>>1); int seq= 128*(pkt->data[2]&0x7F) + (pkt->data[3]>>1);
av_log(s, AV_LOG_DEBUG, "%d %"PRId64" %d\n", *timestamp, *timestamp*512LL/25, seq); av_log(s, AV_LOG_DEBUG, "%d %"PRId64" %d\n", *timestamp, *timestamp*512LL/25, seq);
seq |= (*timestamp&~0x3FFF); seq |= (timestamp&~0x3FFF);
if(seq - *timestamp > 0x2000) seq -= 0x4000; if(seq - timestamp > 0x2000) seq -= 0x4000;
if(seq - *timestamp < -0x2000) seq += 0x4000; if(seq - timestamp < -0x2000) seq += 0x4000;
} }
} }
#endif #endif
pkt->pts= *timestamp; pkt->pts= timestamp;
if (*flags & 2) if (flags & 2)
pkt->flags |= PKT_FLAG_KEY; pkt->flags |= PKT_FLAG_KEY;
return st->codec->codec_type == CODEC_TYPE_AUDIO ? rm->audio_pkt_cnt : 0; return st->codec->codec_type == CODEC_TYPE_AUDIO ? rm->audio_pkt_cnt : 0;
@ -838,7 +838,7 @@ static int rm_read_packet(AVFormatContext *s, AVPacket *pkt)
old_flags = flags; old_flags = flags;
res = ff_rm_parse_packet (s, s->pb, st, st->priv_data, len, pkt, res = ff_rm_parse_packet (s, s->pb, st, st->priv_data, len, pkt,
&seq, &flags, &timestamp); &seq, flags, timestamp);
if((old_flags&2) && (seq&0x7F) == 1) if((old_flags&2) && (seq&0x7F) == 1)
av_add_index_entry(st, pos, timestamp, 0, 0, AVINDEX_KEYFRAME); av_add_index_entry(st, pos, timestamp, 0, 0, AVINDEX_KEYFRAME);
if (res) if (res)