Compare using AVCodecParameters instead of the deprecated
AVStream.codec field
Signed-off-by: Reynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
... | ... |
@@ -44,6 +44,7 @@ |
44 | 44 |
#include "libavutil/intreadwrite.h" |
45 | 45 |
#include "libavutil/mathematics.h" |
46 | 46 |
#include "libavutil/random_seed.h" |
47 |
+#include "libavutil/rational.h" |
|
47 | 48 |
#include "libavutil/parseutils.h" |
48 | 49 |
#include "libavutil/opt.h" |
49 | 50 |
#include "libavutil/time.h" |
... | ... |
@@ -239,8 +240,7 @@ static int rtp_new_av_stream(HTTPContext *c, |
239 | 239 |
/* utils */ |
240 | 240 |
static size_t htmlencode (const char *src, char **dest); |
241 | 241 |
static inline void cp_html_entity (char *buffer, const char *entity); |
242 |
-static inline int check_codec_match(AVCodecContext *ccf, AVCodecContext *ccs, |
|
243 |
- int stream); |
|
242 |
+static inline int check_codec_match(AVStream *ccf, AVStream *ccs, int stream); |
|
244 | 243 |
|
245 | 244 |
static const char *my_program_name; |
246 | 245 |
|
... | ... |
@@ -3711,26 +3711,25 @@ static void build_file_streams(void) |
3711 | 3711 |
} |
3712 | 3712 |
|
3713 | 3713 |
static inline |
3714 |
-int check_codec_match(AVCodecContext *ccf, AVCodecContext *ccs, int stream) |
|
3714 |
+int check_codec_match(AVStream *ccf, AVStream *ccs, int stream) |
|
3715 | 3715 |
{ |
3716 | 3716 |
int matches = 1; |
3717 | 3717 |
|
3718 |
-#define CHECK_CODEC(x) (ccf->x != ccs->x) |
|
3718 |
+/* FIXME: Missed check on AVCodecContext.flags */ |
|
3719 |
+#define CHECK_CODEC(x) (ccf->codecpar->x != ccs->codecpar->x) |
|
3719 | 3720 |
if (CHECK_CODEC(codec_id) || CHECK_CODEC(codec_type)) { |
3720 | 3721 |
http_log("Codecs do not match for stream %d\n", stream); |
3721 | 3722 |
matches = 0; |
3722 |
- } else if (CHECK_CODEC(bit_rate) || CHECK_CODEC(flags)) { |
|
3723 |
+ } else if (CHECK_CODEC(bit_rate)) { |
|
3723 | 3724 |
http_log("Codec bitrates do not match for stream %d\n", stream); |
3724 | 3725 |
matches = 0; |
3725 |
- } else if (ccf->codec_type == AVMEDIA_TYPE_VIDEO) { |
|
3726 |
- if (CHECK_CODEC(time_base.den) || |
|
3727 |
- CHECK_CODEC(time_base.num) || |
|
3728 |
- CHECK_CODEC(width) || |
|
3729 |
- CHECK_CODEC(height)) { |
|
3726 |
+ } else if (ccf->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { |
|
3727 |
+ if (av_cmp_q(ccf->time_base, ccs->time_base) || |
|
3728 |
+ CHECK_CODEC(width) || CHECK_CODEC(height)) { |
|
3730 | 3729 |
http_log("Codec width, height or framerate do not match for stream %d\n", stream); |
3731 | 3730 |
matches = 0; |
3732 | 3731 |
} |
3733 |
- } else if (ccf->codec_type == AVMEDIA_TYPE_AUDIO) { |
|
3732 |
+ } else if (ccf->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) { |
|
3734 | 3733 |
if (CHECK_CODEC(sample_rate) || |
3735 | 3734 |
CHECK_CODEC(channels) || |
3736 | 3735 |
CHECK_CODEC(frame_size)) { |
... | ... |
@@ -3812,7 +3811,7 @@ static int build_feed_streams(void) |
3812 | 3812 |
break; |
3813 | 3813 |
} |
3814 | 3814 |
|
3815 |
- matches = check_codec_match (sf->codec, ss->codec, i); |
|
3815 |
+ matches = check_codec_match (sf, ss, i); |
|
3816 | 3816 |
if (!matches) |
3817 | 3817 |
break; |
3818 | 3818 |
} |