mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-21 23:10:13 +00:00
rtsp/rdt: Assign the RTSPStream index to AVStream->id
This is used for mapping AVStreams back to their corresponding
RTSPStream. Since d9c0510
, the RTSPStream pointer isn't stored in
AVStream->priv_data any longer, breaking this mapping from AVStreams
to RTSPStreams.
Also, we don't need to clear the priv_data in rdt cleanup any longer,
since it isn't set to duplicate pointers.
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
This commit is contained in:
parent
74b1f96859
commit
b2dd842d21
@ -63,7 +63,7 @@ ff_rdt_parse_open(AVFormatContext *ic, int first_stream_of_set_idx,
|
|||||||
do {
|
do {
|
||||||
s->n_streams++;
|
s->n_streams++;
|
||||||
} while (first_stream_of_set_idx + s->n_streams < ic->nb_streams &&
|
} while (first_stream_of_set_idx + s->n_streams < ic->nb_streams &&
|
||||||
s->streams[s->n_streams]->priv_data == s->streams[0]->priv_data);
|
s->streams[s->n_streams]->id == s->streams[0]->id);
|
||||||
s->prev_set_id = -1;
|
s->prev_set_id = -1;
|
||||||
s->prev_stream_id = -1;
|
s->prev_stream_id = -1;
|
||||||
s->prev_timestamp = -1;
|
s->prev_timestamp = -1;
|
||||||
@ -76,11 +76,6 @@ ff_rdt_parse_open(AVFormatContext *ic, int first_stream_of_set_idx,
|
|||||||
void
|
void
|
||||||
ff_rdt_parse_close(RDTDemuxContext *s)
|
ff_rdt_parse_close(RDTDemuxContext *s)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 1; i < s->n_streams; i++)
|
|
||||||
s->streams[i]->priv_data = NULL;
|
|
||||||
|
|
||||||
av_free(s);
|
av_free(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -422,7 +417,7 @@ rdt_parse_sdp_line (AVFormatContext *s, int st_index,
|
|||||||
int n, first = -1;
|
int n, first = -1;
|
||||||
|
|
||||||
for (n = 0; n < s->nb_streams; n++)
|
for (n = 0; n < s->nb_streams; n++)
|
||||||
if (s->streams[n]->priv_data == stream->priv_data) {
|
if (s->streams[n]->id == stream->id) {
|
||||||
int count = s->streams[n]->index + 1;
|
int count = s->streams[n]->index + 1;
|
||||||
if (first == -1) first = n;
|
if (first == -1) first = n;
|
||||||
if (rdt->nb_rmst < count) {
|
if (rdt->nb_rmst < count) {
|
||||||
@ -463,10 +458,9 @@ add_dstream(AVFormatContext *s, AVStream *orig_st)
|
|||||||
{
|
{
|
||||||
AVStream *st;
|
AVStream *st;
|
||||||
|
|
||||||
if (!(st = av_new_stream(s, 0)))
|
if (!(st = av_new_stream(s, orig_st->id)))
|
||||||
return NULL;
|
return NULL;
|
||||||
st->codec->codec_type = orig_st->codec->codec_type;
|
st->codec->codec_type = orig_st->codec->codec_type;
|
||||||
st->priv_data = orig_st->priv_data;
|
|
||||||
st->first_dts = orig_st->first_dts;
|
st->first_dts = orig_st->first_dts;
|
||||||
|
|
||||||
return st;
|
return st;
|
||||||
|
@ -322,7 +322,7 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1,
|
|||||||
if (!strcmp(ff_rtp_enc_name(rtsp_st->sdp_payload_type), "MP2T")) {
|
if (!strcmp(ff_rtp_enc_name(rtsp_st->sdp_payload_type), "MP2T")) {
|
||||||
/* no corresponding stream */
|
/* no corresponding stream */
|
||||||
} else {
|
} else {
|
||||||
st = av_new_stream(s, 0);
|
st = av_new_stream(s, rt->nb_rtsp_streams - 1);
|
||||||
if (!st)
|
if (!st)
|
||||||
return;
|
return;
|
||||||
rtsp_st->stream_index = st->index;
|
rtsp_st->stream_index = st->index;
|
||||||
|
@ -283,7 +283,7 @@ retry:
|
|||||||
for (i = 0; i < rt->nb_rtsp_streams; i++) {
|
for (i = 0; i < rt->nb_rtsp_streams; i++) {
|
||||||
rule_nr = 0;
|
rule_nr = 0;
|
||||||
for (r = 0; r < s->nb_streams; r++) {
|
for (r = 0; r < s->nb_streams; r++) {
|
||||||
if (s->streams[r]->priv_data == rt->rtsp_streams[i]) {
|
if (s->streams[r]->id == i) {
|
||||||
if (s->streams[r]->discard != AVDISCARD_ALL) {
|
if (s->streams[r]->discard != AVDISCARD_ALL) {
|
||||||
if (!first)
|
if (!first)
|
||||||
av_strlcat(rt->last_subscription, ",",
|
av_strlcat(rt->last_subscription, ",",
|
||||||
|
Loading…
Reference in New Issue
Block a user