lance.lmw...@gmail.com: > From: Limin Wang <lance.lmw...@gmail.com> > > Signed-off-by: Limin Wang <lance.lmw...@gmail.com> > --- > libavformat/rtpdec_rfc4175.c | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/libavformat/rtpdec_rfc4175.c b/libavformat/rtpdec_rfc4175.c > index 46d30ed..367567d 100644 > --- a/libavformat/rtpdec_rfc4175.c > +++ b/libavformat/rtpdec_rfc4175.c > @@ -25,9 +25,11 @@ > #include "rtpdec_formats.h" > #include "libavutil/avstring.h" > #include "libavutil/pixdesc.h" > +#include "libavutil/parseutils.h" > > struct PayloadContext { > char *sampling; > + char *framerate; > int depth; > int width; > int height; > @@ -45,6 +47,7 @@ static int rfc4175_parse_format(AVStream *stream, > PayloadContext *data) > enum AVPixelFormat pixfmt; > int tag; > const AVPixFmtDescriptor *desc; > + AVRational framerate; > > if (!strncmp(data->sampling, "YCbCr-4:2:2", 11)) { > tag = MKTAG('U', 'Y', 'V', 'Y'); > @@ -69,6 +72,14 @@ static int rfc4175_parse_format(AVStream *stream, > PayloadContext *data) > stream->codecpar->bits_per_coded_sample = av_get_bits_per_pixel(desc); > data->frame_size = data->width * data->height * data->pgroup / > data->xinc; > > + if (data->framerate) { > + if (av_parse_video_rate(&framerate, data->framerate) < 0) > + return AVERROR(EINVAL); > + stream->avg_frame_rate = framerate; > + if (framerate.den) > + stream->codecpar->bit_rate = data->frame_size * > av_q2d(framerate) * 8; > + } > + > return 0; > } > > @@ -84,6 +95,8 @@ static int rfc4175_parse_fmtp(AVFormatContext *s, AVStream > *stream, > data->sampling = av_strdup(value); > else if (!strncmp(attr, "depth", 5)) > data->depth = atoi(value); > + else if (!strncmp(attr, "exactframerate", 14)) > + data->framerate = av_strdup(value); > > return 0; > } > @@ -112,6 +125,7 @@ static int rfc4175_parse_sdp_line(AVFormatContext *s, int > st_index, > > ret = rfc4175_parse_format(stream, data); > av_freep(&data->sampling); > + av_freep(&data->framerate); > > return ret; > } >
Why the (unchecked!) allocation of a temporary string if you only want the number anyway? - Andreas _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".