Skip to content

Commit 67732b9

Browse files
committed
Merge remote-tracking branch 'qatar/master'
* qatar/master: mpegts: Remove disabled extension matching probe. fate: avoid freopen(NULL) in videogen/rotozoom Conflicts: tests/rotozoom.c tests/videogen.c Merged-by: Michael Niedermayer <[email protected]>
2 parents b4d4436 + a8656cd commit 67732b9

File tree

4 files changed

+14
-20
lines changed

4 files changed

+14
-20
lines changed

libavformat/mpegts.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1868,7 +1868,6 @@ static int handle_packets(MpegTSContext *ts, int nb_packets)
18681868

18691869
static int mpegts_probe(AVProbeData *p)
18701870
{
1871-
#if 1
18721871
const int size= p->buf_size;
18731872
int score, fec_score, dvhs_score;
18741873
int check_count= size / TS_FEC_PACKET_SIZE;
@@ -1887,13 +1886,6 @@ static int mpegts_probe(AVProbeData *p)
18871886
else if(dvhs_score > score && dvhs_score > fec_score && dvhs_score > 6) return AVPROBE_SCORE_MAX + dvhs_score - CHECK_COUNT;
18881887
else if( fec_score > 6) return AVPROBE_SCORE_MAX + fec_score - CHECK_COUNT;
18891888
else return -1;
1890-
#else
1891-
/* only use the extension for safer guess */
1892-
if (av_match_ext(p->filename, "ts"))
1893-
return AVPROBE_SCORE_MAX;
1894-
else
1895-
return 0;
1896-
#endif
18971889
}
18981890

18991891
/* return the 90kHz PCR and the extension for the 27MHz PCR. return

tests/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ tests/data/asynth-%.wav: tests/audiogen$(HOSTEXESUF) | tests/data
2828
$(M)./$< $@ $(subst -, ,$*)
2929

3030
tests/data/vsynth1.yuv: tests/videogen$(HOSTEXESUF) | tests/data
31-
$(M)$< >$@
31+
$(M)$< $@
3232

3333
tests/data/vsynth2.yuv: tests/rotozoom$(HOSTEXESUF) | tests/data
34-
$(M)$< $(SRC_PATH)/tests/lena.pnm >$@
34+
$(M)$< $(SRC_PATH)/tests/lena.pnm $@
3535

3636
tests/data/%.sw tests/data/asynth% tests/data/vsynth%.yuv tests/vsynth%/00.pgm: TAG = GEN
3737

tests/rotozoom.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,15 +158,16 @@ int main(int argc, char **argv)
158158
{
159159
int w, h, i;
160160
char buf[1024];
161+
int isdir = 0;
161162

162-
if (argc > 3) {
163-
printf("usage: %s image.pnm [directory/]\n"
163+
if (argc != 3) {
164+
printf("usage: %s image.pnm file|dir\n"
164165
"generate a test video stream\n", argv[0]);
165166
return 1;
166167
}
167168

168-
// if (argc < 3)
169-
// err_if(!freopen(NULL, "wb", stdout));
169+
if (!freopen(argv[2], "wb", stdout))
170+
isdir = 1;
170171

171172
w = DEFAULT_WIDTH;
172173
h = DEFAULT_HEIGHT;
@@ -181,7 +182,7 @@ int main(int argc, char **argv)
181182

182183
for (i = 0; i < DEFAULT_NB_PICT; i++) {
183184
gen_image(i, w, h);
184-
if (argc > 2) {
185+
if (isdir) {
185186
snprintf(buf, sizeof(buf), "%s%02d.pgm", argv[2], i);
186187
pgmyuv_save(buf, w, h, rgb_tab);
187188
} else {

tests/videogen.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,15 +145,16 @@ int main(int argc, char **argv)
145145
{
146146
int w, h, i;
147147
char buf[1024];
148+
int isdir = 0;
148149

149-
if (argc > 2) {
150-
printf("usage: %s [file]\n"
150+
if (argc != 2) {
151+
printf("usage: %s file|dir\n"
151152
"generate a test video stream\n", argv[0]);
152153
exit(1);
153154
}
154155

155-
// if (argc < 2)
156-
// err_if(!freopen(NULL, "wb", stdout));
156+
if (!freopen(argv[1], "wb", stdout))
157+
isdir = 1;
157158

158159
w = DEFAULT_WIDTH;
159160
h = DEFAULT_HEIGHT;
@@ -165,7 +166,7 @@ int main(int argc, char **argv)
165166

166167
for (i = 0; i < DEFAULT_NB_PICT; i++) {
167168
gen_image(i, w, h);
168-
if (argc > 1) {
169+
if (isdir) {
169170
snprintf(buf, sizeof(buf), "%s%02d.pgm", argv[1], i);
170171
pgmyuv_save(buf, w, h, rgb_tab);
171172
} else {

0 commit comments

Comments
 (0)