History

Merge remote-tracking branch 'qatar/master'

* qatar/master: (22 commits) configure: add check for w32threads to enable it automatically rtmp: do not hardcode invoke numbers cinepack: return non-generic errors fate-lavf-ts: use -mpegts_transport_stream_id option. Add an APIchanges entry and a minor bump for avio changes. avio: Mark the old interrupt callback mechanism as deprecated avplay: Set the new interrupt callback avconv: Set new interrupt callbacks for all AVFormatContexts, use avio_open2() everywhere cinepak: remove redundant coordinate checks cinepak: check strip_size cinepak, simplify, use AV_RB24() cinepak: simplify, use FFMIN() cinepak: Fix division by zero, ask for sample if encoded_buf_size is 0 applehttp: Fix seeking in streams not starting at DTS=0 http: Don't use the normal http proxy mechanism for https tls: Handle connection via a http proxy http: Reorder two code blocks http: Add a new protocol for opening connections via http proxies http: Split out the non-chunked buffer reading part from http_read segafilm: add support for raw videos ... Conflicts: avconv.c configure doc/APIchanges libavcodec/cinepak.c libavformat/applehttp.c libavformat/version.h tests/lavf-regression.sh tests/ref/lavf/ts

Michael Niedermayer committed 15 years ago

Commit e161b072 parents 36a60fa ff3755c20 files · +284 −87Browse files

Unified · Split

20 files
  1. avconv.c +15 −13
  2. configure +4 −1
  3. doc/APIchanges +10 −0
  4. ffmpeg.c +15 −14
  5. ffplay.c +3 −2
  6. libavcodec/cinepak.c +18 −18
  7. libavformat/allformats.c +1 −0
  8. libavformat/applehttp.c +2 −1
  9. libavformat/avio.c +9 −1
  10. libavformat/avio.h +5 −1
  11. libavformat/http.c +149 −26
  12. libavformat/rtmpproto.c +5 −4
  13. libavformat/rtpdec.c +8 −2
  14. libavformat/rtpdec.h +1 −0
  15. libavformat/rtspdec.c +2 −0
  16. libavformat/segafilm.c +14 −1
  17. libavformat/tls.c +17 −0
  18. libavformat/version.h +4 −1
  19. tests/lavf-regression.sh +1 −1
  20. tests/ref/lavf/ts +1 −1
avconv.c+15−13
@@ -588,12 +588,14 @@ static int read_key(void) · 587 unmodified lines
588 return -1;588 return -1;
589}589}
590 590
591static int decode_interrupt_cb(void)591static int decode_interrupt_cb(void *ctx)
592{592{
593 q_pressed += read_key() == 'q';593 q_pressed += read_key() == 'q';
594 return q_pressed > 1;594 return q_pressed > 1;
595}595}
596 596
597static const AVIOInterruptCB int_cb = { decode_interrupt_cb, NULL };
598
597void exit_program(int ret)599void exit_program(int ret)
598{600{
599 int i;601 int i;
@@ -2336,6 +2338,7 @@ static int transcode_init(OutputFile *output_files, · 1736 unmodified lines
2336 /* open files and write file headers */2338 /* open files and write file headers */
2337 for (i = 0; i < nb_output_files; i++) {2339 for (i = 0; i < nb_output_files; i++) {
2338 os = output_files[i].ctx;2340 os = output_files[i].ctx;
2341 os->interrupt_callback = int_cb;
2339 if (avformat_write_header(os, &output_files[i].opts) < 0) {2342 if (avformat_write_header(os, &output_files[i].opts) < 0) {
2340 snprintf(error, sizeof(error), "Could not write header for output file #%d (incorrect codec parameters ?)", i);2343 snprintf(error, sizeof(error), "Could not write header for output file #%d (incorrect codec parameters ?)", i);
2341 ret = AVERROR(EINVAL);2344 ret = AVERROR(EINVAL);
@@ -3010,7 +3013,7 @@ static void dump_attachment(AVStream *st, const char *filename) · 668 unmodified lines
3010 3013
3011 assert_file_overwrite(filename);3014 assert_file_overwrite(filename);
3012 3015
3013 if ((ret = avio_open (&out, filename, AVIO_FLAG_WRITE)) < 0) {3016 if ((ret = avio_open2(&out, filename, AVIO_FLAG_WRITE, &int_cb, NULL)) < 0) {
3014 av_log(NULL, AV_LOG_FATAL, "Could not open file %s for writing.\n",3017 av_log(NULL, AV_LOG_FATAL, "Could not open file %s for writing.\n",
3015 filename);3018 filename);
3016 exit_program(1);3019 exit_program(1);
@@ -3068,6 +3071,7 @@ static int opt_input_file(OptionsContext *o, const char *opt, const char *filena · 51 unmodified lines
3068 av_dict_set(&format_opts, "pixel_format", o->frame_pix_fmts[o->nb_frame_pix_fmts - 1].u.str, 0);3071 av_dict_set(&format_opts, "pixel_format", o->frame_pix_fmts[o->nb_frame_pix_fmts - 1].u.str, 0);
3069 3072
3070 ic->flags |= AVFMT_FLAG_NONBLOCK;3073 ic->flags |= AVFMT_FLAG_NONBLOCK;
3074 ic->interrupt_callback = int_cb;
3071 3075
3072 /* open the input file with generic libav function */3076 /* open the input file with generic libav function */
3073 err = avformat_open_input(&ic, filename, file_iformat, &format_opts);3077 err = avformat_open_input(&ic, filename, file_iformat, &format_opts);
@@ -3197,12 +3201,12 @@ static int get_preset_file_2(const char *preset_name, const char *codec_name, AV · 123 unmodified lines
3197 if (codec_name) {3201 if (codec_name) {
3198 snprintf(filename, sizeof(filename), "%s%s/%s-%s.avpreset", base[i],3202 snprintf(filename, sizeof(filename), "%s%s/%s-%s.avpreset", base[i],
3199 i != 1 ? "" : "/.avconv", codec_name, preset_name);3203 i != 1 ? "" : "/.avconv", codec_name, preset_name);
3200 ret = avio_open(s, filename, AVIO_FLAG_READ);3204 ret = avio_open2(s, filename, AVIO_FLAG_READ, &int_cb, NULL);
3201 }3205 }
3202 if (ret) {3206 if (ret) {
3203 snprintf(filename, sizeof(filename), "%s%s/%s.avpreset", base[i],3207 snprintf(filename, sizeof(filename), "%s%s/%s.avpreset", base[i],
3204 i != 1 ? "" : "/.avconv", preset_name);3208 i != 1 ? "" : "/.avconv", preset_name);
3205 ret = avio_open(s, filename, AVIO_FLAG_READ);3209 ret = avio_open2(s, filename, AVIO_FLAG_READ, &int_cb, NULL);
3206 }3210 }
3207 }3211 }
3208 return ret;3212 return ret;
@@ -3588,8 +3592,9 @@ static int copy_chapters(InputFile *ifile, OutputFile *ofile, int copy_metadata) · 379 unmodified lines
3588static int read_ffserver_streams(OptionsContext *o, AVFormatContext *s, const char *filename)3592static int read_ffserver_streams(OptionsContext *o, AVFormatContext *s, const char *filename)
3589{3593{
3590 int i, err;3594 int i, err;
3591 AVFormatContext *ic = NULL;3595 AVFormatContext *ic = avformat_alloc_context();
3592 3596
3597 ic->interrupt_callback = int_cb;
3593 err = avformat_open_input(&ic, filename, NULL, NULL);3598 err = avformat_open_input(&ic, filename, NULL, NULL);
3594 if (err < 0)3599 if (err < 0)
3595 return err;3600 return err;
@@ -3638,6 +3643,7 @@ static void opt_output_file(void *optctx, const char *filename) · 42 unmodified lines
3638 }3643 }
3639 3644
3640 file_oformat= oc->oformat;3645 file_oformat= oc->oformat;
3646 oc->interrupt_callback = int_cb;
3641 3647
3642 if (!strcmp(file_oformat->name, "ffm") &&3648 if (!strcmp(file_oformat->name, "ffm") &&
3643 av_strstart(filename, "http:", NULL)) {3649 av_strstart(filename, "http:", NULL)) {
@@ -3729,7 +3735,7 @@ static void opt_output_file(void *optctx, const char *filename) · 85 unmodified lines
3729 const char *p;3735 const char *p;
3730 int64_t len;3736 int64_t len;
3731 3737
3732 if ((err = avio_open(&pb, o->attachments[i], AVIO_FLAG_READ)) < 0) {3738 if ((err = avio_open2(&pb, o->attachments[i], AVIO_FLAG_READ, &int_cb, NULL)) < 0) {
3733 av_log(NULL, AV_LOG_FATAL, "Could not open attachment file %s.\n",3739 av_log(NULL, AV_LOG_FATAL, "Could not open attachment file %s.\n",
3734 o->attachments[i]);3740 o->attachments[i]);
3735 exit_program(1);3741 exit_program(1);
@@ -3779,7 +3785,9 @@ static void opt_output_file(void *optctx, const char *filename) · 43 unmodified lines
3779 assert_file_overwrite(filename);3785 assert_file_overwrite(filename);
3780 3786
3781 /* open the file */3787 /* open the file */
3782 if ((err = avio_open(&oc->pb, filename, AVIO_FLAG_WRITE)) < 0) {3788 if ((err = avio_open2(&oc->pb, filename, AVIO_FLAG_WRITE,
3789 &oc->interrupt_callback,
3790 &output_files[nb_output_files - 1].opts)) < 0) {
3783 print_error(filename, err);3791 print_error(filename, err);
3784 exit_program(1);3792 exit_program(1);
3785 }3793 }
@@ -4350,12 +4358,6 @@ int main(int argc, char **argv) · 564 unmodified lines
4350 av_register_all();4358 av_register_all();
4351 avformat_network_init();4359 avformat_network_init();
4352 4360
4353#if HAVE_ISATTY
4354 if(isatty(STDIN_FILENO))
4355 avio_set_interrupt_cb(decode_interrupt_cb);
4356#endif
4357
4358 show_banner();
4359 4361
4360 /* parse options */4362 /* parse options */
4361 parse_options(&o, argc, argv, options, opt_output_file);4363 parse_options(&o, argc, argv, options, opt_output_file);
configure+4−1
@@ -2583,7 +2583,6 @@ case $target_os in · 2582 unmodified lines
2583 disable network2583 disable network
2584 else2584 else
2585 target_os=mingw322585 target_os=mingw32
2586 enable_weak w32threads
2587 fi2586 fi
2588 LIBTARGET=i3862587 LIBTARGET=i386
2589 if enabled x86_64; then2588 if enabled x86_64; then
@@ -2999,6 +2998,10 @@ if ! disabled vda; then · 409 unmodified lines
2999 fi2998 fi
3000fi2999fi
3001 3000
3001if ! disabled w32threads && ! enabled pthreads; then
3002 check_func _beginthreadex && enable w32threads
3003fi
3004
3002# check for some common methods of building with pthread support3005# check for some common methods of building with pthread support
3003# do this before the optional library checks as some of them require pthreads3006# do this before the optional library checks as some of them require pthreads
3004if ! disabled pthreads && ! enabled w32threads && ! enabled os2threads; then3007if ! disabled pthreads && ! enabled w32threads && ! enabled os2threads; then
doc/APIchanges+10−0
@@ -19,6 +19,16 @@ API changes, most recent first: · 18 unmodified lines
192011-10-20 - b35e9e1 - lavu 51.22.0192011-10-20 - b35e9e1 - lavu 51.22.0
20 Add av_strtok() to avstring.h.20 Add av_strtok() to avstring.h.
21 21
222011-11-13 - lavf 53.15.0
23 New interrupt callback API, allowing per-AVFormatContext/AVIOContext
24 interrupt callbacks.
25 6aa0b98 Add AVIOInterruptCB struct and the interrupt_callback field to
26 AVFormatContext.
27 1dee0ac Add avio_open2() with additional parameters. Those are
28 an interrupt callback and an options AVDictionary.
29 This will allow passing AVOptions to protocols after lavf
30 54.0.
31
222011-11-xx - xxxxxxx - lavu 51.16.0322011-11-xx - xxxxxxx - lavu 51.16.0
23 Add av_timegm()33 Add av_timegm()
24 34
ffmpeg.c+15−14
@@ -635,11 +635,13 @@ static int read_key(void) · 634 unmodified lines
635 return -1;635 return -1;
636}636}
637 637
638static int decode_interrupt_cb(void)638static int decode_interrupt_cb(void *ctx)
639{639{
640 return received_nb_signals > 1;640 return received_nb_signals > 1;
641}641}
642 642
643static const AVIOInterruptCB int_cb = { decode_interrupt_cb, NULL };
644
643void av_noreturn exit_program(int ret)645void av_noreturn exit_program(int ret)
644{646{
645 int i;647 int i;
@@ -2403,6 +2405,7 @@ static int transcode_init(OutputFile *output_files, int nb_output_files, · 1757 unmodified lines
2403 /* open files and write file headers */2405 /* open files and write file headers */
2404 for (i = 0; i < nb_output_files; i++) {2406 for (i = 0; i < nb_output_files; i++) {
2405 os = output_files[i].ctx;2407 os = output_files[i].ctx;
2408 os->interrupt_callback = int_cb;
2406 if (avformat_write_header(os, &output_files[i].opts) < 0) {2409 if (avformat_write_header(os, &output_files[i].opts) < 0) {
2407 snprintf(error, sizeof(error), "Could not write header for output file #%d (incorrect codec parameters ?)", i);2410 snprintf(error, sizeof(error), "Could not write header for output file #%d (incorrect codec parameters ?)", i);
2408 ret = AVERROR(EINVAL);2411 ret = AVERROR(EINVAL);
@@ -2495,7 +2498,6 @@ static int transcode(OutputFile *output_files, int nb_output_files, · 86 unmodified lines
2495 2498
2496 if (!using_stdin) {2499 if (!using_stdin) {
2497 av_log(NULL, AV_LOG_INFO, "Press [q] to stop, [?] for help\n");2500 av_log(NULL, AV_LOG_INFO, "Press [q] to stop, [?] for help\n");
2498 avio_set_interrupt_cb(decode_interrupt_cb);
2499 }2501 }
2500 2502
2501 timer_start = av_gettime();2503 timer_start = av_gettime();
@@ -3243,7 +3245,7 @@ static void dump_attachment(AVStream *st, const char *filename) · 741 unmodified lines
3243 3245
3244 assert_file_overwrite(filename);3246 assert_file_overwrite(filename);
3245 3247
3246 if ((ret = avio_open (&out, filename, AVIO_FLAG_WRITE)) < 0) {3248 if ((ret = avio_open2(&out, filename, AVIO_FLAG_WRITE, &int_cb, NULL)) < 0) {
3247 av_log(NULL, AV_LOG_FATAL, "Could not open file %s for writing.\n",3249 av_log(NULL, AV_LOG_FATAL, "Could not open file %s for writing.\n",
3248 filename);3250 filename);
3249 exit_program(1);3251 exit_program(1);
@@ -3307,6 +3309,7 @@ static int opt_input_file(OptionsContext *o, const char *opt, const char *filena · 57 unmodified lines
3307 ic->subtitle_codec_id= subtitle_codec_name ?3309 ic->subtitle_codec_id= subtitle_codec_name ?
3308 find_codec_or_die(subtitle_codec_name, AVMEDIA_TYPE_SUBTITLE, 0)->id : CODEC_ID_NONE;3310 find_codec_or_die(subtitle_codec_name, AVMEDIA_TYPE_SUBTITLE, 0)->id : CODEC_ID_NONE;
3309 ic->flags |= AVFMT_FLAG_NONBLOCK;3311 ic->flags |= AVFMT_FLAG_NONBLOCK;
3312 ic->interrupt_callback = int_cb;
3310 3313
3311 if (loop_input) {3314 if (loop_input) {
3312 av_log(NULL, AV_LOG_WARNING, "-loop_input is deprecated, use -loop 1\n");3315 av_log(NULL, AV_LOG_WARNING, "-loop_input is deprecated, use -loop 1\n");
@@ -3438,12 +3441,12 @@ static int get_preset_file_2(const char *preset_name, const char *codec_name, AV · 125 unmodified lines
3438 if (codec_name) {3441 if (codec_name) {
3439 snprintf(filename, sizeof(filename), "%s%s/%s-%s.avpreset", base[i],3442 snprintf(filename, sizeof(filename), "%s%s/%s-%s.avpreset", base[i],
3440 i != 1 ? "" : "/.avconv", codec_name, preset_name);3443 i != 1 ? "" : "/.avconv", codec_name, preset_name);
3441 ret = avio_open(s, filename, AVIO_FLAG_READ);3444 ret = avio_open2(s, filename, AVIO_FLAG_READ, &int_cb, NULL);
3442 }3445 }
3443 if (ret) {3446 if (ret) {
3444 snprintf(filename, sizeof(filename), "%s%s/%s.avpreset", base[i],3447 snprintf(filename, sizeof(filename), "%s%s/%s.avpreset", base[i],
3445 i != 1 ? "" : "/.avconv", preset_name);3448 i != 1 ? "" : "/.avconv", preset_name);
3446 ret = avio_open(s, filename, AVIO_FLAG_READ);3449 ret = avio_open2(s, filename, AVIO_FLAG_READ, &int_cb, NULL);
3447 }3450 }
3448 }3451 }
3449 return ret;3452 return ret;
@@ -3856,8 +3859,9 @@ static int copy_chapters(InputFile *ifile, OutputFile *ofile, int copy_metadata) · 406 unmodified lines
3856static int read_ffserver_streams(OptionsContext *o, AVFormatContext *s, const char *filename)3859static int read_ffserver_streams(OptionsContext *o, AVFormatContext *s, const char *filename)
3857{3860{
3858 int i, err;3861 int i, err;
3859 AVFormatContext *ic = NULL;3862 AVFormatContext *ic = avformat_alloc_context();
3860 3863
3864 ic->interrupt_callback = int_cb;
3861 err = avformat_open_input(&ic, filename, NULL, NULL);3865 err = avformat_open_input(&ic, filename, NULL, NULL);
3862 if (err < 0)3866 if (err < 0)
3863 return err;3867 return err;
@@ -3908,6 +3912,7 @@ static void opt_output_file(void *optctx, const char *filename) · 44 unmodified lines
3908 exit_program(1);3912 exit_program(1);
3909 }3913 }
3910 file_oformat= oc->oformat;3914 file_oformat= oc->oformat;
3915 oc->interrupt_callback = int_cb;
3911 3916
3912 if (!strcmp(file_oformat->name, "ffm") &&3917 if (!strcmp(file_oformat->name, "ffm") &&
3913 av_strstart(filename, "http:", NULL)) {3918 av_strstart(filename, "http:", NULL)) {
@@ -4019,7 +4024,7 @@ static void opt_output_file(void *optctx, const char *filename) · 105 unmodified lines
4019 const char *p;4024 const char *p;
4020 int64_t len;4025 int64_t len;
4021 4026
4022 if ((err = avio_open(&pb, o->attachments[i], AVIO_FLAG_READ)) < 0) {4027 if ((err = avio_open2(&pb, o->attachments[i], AVIO_FLAG_READ, &int_cb, NULL)) < 0) {
4023 av_log(NULL, AV_LOG_FATAL, "Could not open attachment file %s.\n",4028 av_log(NULL, AV_LOG_FATAL, "Could not open attachment file %s.\n",
4024 o->attachments[i]);4029 o->attachments[i]);
4025 exit_program(1);4030 exit_program(1);
@@ -4069,7 +4074,9 @@ static void opt_output_file(void *optctx, const char *filename) · 43 unmodified lines
4069 assert_file_overwrite(filename);4074 assert_file_overwrite(filename);
4070 4075
4071 /* open the file */4076 /* open the file */
4072 if ((err = avio_open(&oc->pb, filename, AVIO_FLAG_WRITE)) < 0) {4077 if ((err = avio_open2(&oc->pb, filename, AVIO_FLAG_WRITE,
4078 &oc->interrupt_callback,
4079 &output_files[nb_output_files - 1].opts)) < 0) {
4073 print_error(filename, err);4080 print_error(filename, err);
4074 exit_program(1);4081 exit_program(1);
4075 }4082 }
@@ -4725,12 +4732,6 @@ int main(int argc, char **argv) · 649 unmodified lines
4725 av_register_all();4732 av_register_all();
4726 avformat_network_init();4733 avformat_network_init();
4727 4734
4728#if HAVE_ISATTY
4729 if(isatty(STDIN_FILENO))
4730 avio_set_interrupt_cb(decode_interrupt_cb);
4731#endif
4732
4733 show_banner();
4734 4735
4735 term_init();4736 term_init();
4736 4737
ffplay.c+3−2
@@ -2414,7 +2414,7 @@ static void stream_component_close(VideoState *is, int stream_index) · 2413 unmodified lines
2414 variable instead of a thread local variable */2414 variable instead of a thread local variable */
2415static VideoState *global_video_state;2415static VideoState *global_video_state;
2416 2416
2417static int decode_interrupt_cb(void)2417static int decode_interrupt_cb(void *ctx)
2418{2418{
2419 return (global_video_state && global_video_state->abort_request);2419 return (global_video_state && global_video_state->abort_request);
2420}2420}
@@ -2439,8 +2439,9 @@ static int read_thread(void *arg) · 18 unmodified lines
2439 is->subtitle_stream = -1;2439 is->subtitle_stream = -1;
2440 2440
2441 global_video_state = is;2441 global_video_state = is;
2442 avio_set_interrupt_cb(decode_interrupt_cb);
2443 2442
2443 ic = avformat_alloc_context();
2444 ic->interrupt_callback.callback = decode_interrupt_cb;
2444 err = avformat_open_input(&ic, is->filename, is->iformat, &format_opts);2445 err = avformat_open_input(&ic, is->filename, is->iformat, &format_opts);
2445 if (err < 0) {2446 if (err < 0) {
2446 print_error(is->filename, err);2447 print_error(is->filename, err);
libavcodec/cinepak.c+18−18
@@ -147,7 +147,7 @@ static int cinepak_decode_vectors (CinepakContext *s, cvid_strip *strip, · 146 unmodified lines
147 for (x=strip->x1; x < strip->x2; x+=4) {147 for (x=strip->x1; x < strip->x2; x+=4) {
148 if ((chunk_id & 0x01) && !(mask >>= 1)) {148 if ((chunk_id & 0x01) && !(mask >>= 1)) {
149 if ((data + 4) > eod)149 if ((data + 4) > eod)
150 return -1;150 return AVERROR_INVALIDDATA;
151 151
152 flag = AV_RB32 (data);152 flag = AV_RB32 (data);
153 data += 4;153 data += 4;
@@ -157,7 +157,7 @@ static int cinepak_decode_vectors (CinepakContext *s, cvid_strip *strip, · 3 unmodified lines
157 if (!(chunk_id & 0x01) || (flag & mask)) {157 if (!(chunk_id & 0x01) || (flag & mask)) {
158 if (!(chunk_id & 0x02) && !(mask >>= 1)) {158 if (!(chunk_id & 0x02) && !(mask >>= 1)) {
159 if ((data + 4) > eod)159 if ((data + 4) > eod)
160 return -1;160 return AVERROR_INVALIDDATA;
161 161
162 flag = AV_RB32 (data);162 flag = AV_RB32 (data);
163 data += 4;163 data += 4;
@@ -166,7 +166,7 @@ static int cinepak_decode_vectors (CinepakContext *s, cvid_strip *strip, · 2 unmodified lines
166 166
167 if ((chunk_id & 0x02) || (~flag & mask)) {167 if ((chunk_id & 0x02) || (~flag & mask)) {
168 if (data >= eod)168 if (data >= eod)
169 return -1;169 return AVERROR_INVALIDDATA;
170 170
171 codebook = &strip->v1_codebook[*data++];171 codebook = &strip->v1_codebook[*data++];
172 s->frame.data[0][iy[0] + 0] = codebook->y0;172 s->frame.data[0][iy[0] + 0] = codebook->y0;
@@ -207,7 +207,7 @@ static int cinepak_decode_vectors (CinepakContext *s, cvid_strip *strip, · 34 unmodified lines
207 207
208 } else if (flag & mask) {208 } else if (flag & mask) {
209 if ((data + 4) > eod)209 if ((data + 4) > eod)
210 return -1;210 return AVERROR_INVALIDDATA;
211 211
212 codebook = &strip->v4_codebook[*data++];212 codebook = &strip->v4_codebook[*data++];
213 s->frame.data[0][iy[0] + 0] = codebook->y0;213 s->frame.data[0][iy[0] + 0] = codebook->y0;
@@ -269,16 +269,16 @@ static int cinepak_decode_strip (CinepakContext *s, · 55 unmodified lines
269 int chunk_id, chunk_size;269 int chunk_id, chunk_size;
270 270
271 /* coordinate sanity checks */271 /* coordinate sanity checks */
272 if (strip->x2 > s->width ||272 if (strip->x2 > s->width ||
273 strip->y2 > s->height ||273 strip->y2 > s->height ||
274 strip->x1 >= strip->x2 || strip->y1 >= strip->y2)274 strip->x1 >= strip->x2 || strip->y1 >= strip->y2)
275 return -1;275 return AVERROR_INVALIDDATA;
276 276
277 while ((data + 4) <= eod) {277 while ((data + 4) <= eod) {
278 chunk_id = data[0];278 chunk_id = data[0];
279 chunk_size = AV_RB24 (&data[1]) - 4;279 chunk_size = AV_RB24 (&data[1]) - 4;
280 if(chunk_size < 0)280 if(chunk_size < 0)
281 return -1;281 return AVERROR_INVALIDDATA;
282 282
283 data += 4;283 data += 4;
284 chunk_size = ((data + chunk_size) > eod) ? (eod - data) : chunk_size;284 chunk_size = ((data + chunk_size) > eod) ? (eod - data) : chunk_size;
@@ -311,7 +311,7 @@ static int cinepak_decode_strip (CinepakContext *s, · 26 unmodified lines
311 data += chunk_size;311 data += chunk_size;
312 }312 }
313 313
314 return -1;314 return AVERROR_INVALIDDATA;
315}315}
316 316
317static int cinepak_decode (CinepakContext *s)317static int cinepak_decode (CinepakContext *s)
@@ -322,7 +322,7 @@ static int cinepak_decode (CinepakContext *s) · 4 unmodified lines
322 int encoded_buf_size;322 int encoded_buf_size;
323 323
324 if (s->size < 10)324 if (s->size < 10)
325 return -1;325 return AVERROR_INVALIDDATA;
326 326
327 frame_flags = s->data[0];327 frame_flags = s->data[0];
328 num_strips = AV_RB16 (&s->data[8]);328 num_strips = AV_RB16 (&s->data[8]);
@@ -330,9 +330,9 @@ static int cinepak_decode (CinepakContext *s) · 1 unmodified line
330 330
331 /* if this is the first frame, check for deviant Sega FILM data */331 /* if this is the first frame, check for deviant Sega FILM data */
332 if (s->sega_film_skip_bytes == -1) {332 if (s->sega_film_skip_bytes == -1) {
333 if (!encoded_buf_size){333 if (!encoded_buf_size) {
334 av_log_ask_for_sample(s->avctx, "encoded_buf_size is 0");334 av_log_ask_for_sample(s->avctx, "encoded_buf_size is 0");
335 return -1;335 return AVERROR_INVALIDDATA;
336 }336 }
337 if (encoded_buf_size != s->size && (s->size % encoded_buf_size) != 0) {337 if (encoded_buf_size != s->size && (s->size % encoded_buf_size) != 0) {
338 /* If the encoded frame size differs from the frame size as indicated338 /* If the encoded frame size differs from the frame size as indicated
@@ -363,7 +363,7 @@ static int cinepak_decode (CinepakContext *s) · 24 unmodified lines
363 363
364 for (i=0; i < num_strips; i++) {364 for (i=0; i < num_strips; i++) {
365 if ((s->data + 12) > eod)365 if ((s->data + 12) > eod)
366 return -1;366 return AVERROR_INVALIDDATA;
367 367
368 s->strips[i].id = s->data[0];368 s->strips[i].id = s->data[0];
369 s->strips[i].y1 = y0;369 s->strips[i].y1 = y0;
@@ -375,8 +375,8 @@ static int cinepak_decode (CinepakContext *s) · 5 unmodified lines
375 s->frame.key_frame = 1;375 s->frame.key_frame = 1;
376 376
377 strip_size = AV_RB24 (&s->data[1]) - 12;377 strip_size = AV_RB24 (&s->data[1]) - 12;
378 if(strip_size < 0)378 if (strip_size < 0)
379 return -1;379 return AVERROR_INVALIDDATA;
380 s->data += 12;380 s->data += 12;
381 strip_size = ((s->data + strip_size) > eod) ? (eod - s->data) : strip_size;381 strip_size = ((s->data + strip_size) > eod) ? (eod - s->data) : strip_size;
382 382
@@ -427,7 +427,7 @@ static int cinepak_decode_frame(AVCodecContext *avctx, · 44 unmodified lines
427 AVPacket *avpkt)427 AVPacket *avpkt)
428{428{
429 const uint8_t *buf = avpkt->data;429 const uint8_t *buf = avpkt->data;
430 int buf_size = avpkt->size;430 int ret = 0, buf_size = avpkt->size;
431 CinepakContext *s = avctx->priv_data;431 CinepakContext *s = avctx->priv_data;
432 432
433 s->data = buf;433 s->data = buf;
@@ -436,9 +436,9 @@ static int cinepak_decode_frame(AVCodecContext *avctx, · 2 unmodified lines
436 s->frame.reference = 3;436 s->frame.reference = 3;
437 s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE |437 s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE |
438 FF_BUFFER_HINTS_REUSABLE;438 FF_BUFFER_HINTS_REUSABLE;
439 if (avctx->reget_buffer(avctx, &s->frame)) {439 if ((ret = avctx->reget_buffer(avctx, &s->frame))) {
440 av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");440 av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
441 return -1;441 return ret;
442 }442 }
443 443
444 if (s->palette_video) {444 if (s->palette_video) {
libavformat/allformats.c+1−0
@@ -259,6 +259,7 @@ void av_register_all(void) · 258 unmodified lines
259 REGISTER_PROTOCOL (FILE, file);259 REGISTER_PROTOCOL (FILE, file);
260 REGISTER_PROTOCOL (GOPHER, gopher);260 REGISTER_PROTOCOL (GOPHER, gopher);
261 REGISTER_PROTOCOL (HTTP, http);261 REGISTER_PROTOCOL (HTTP, http);
262 REGISTER_PROTOCOL (HTTPPROXY, httpproxy);
262 REGISTER_PROTOCOL (HTTPS, https);263 REGISTER_PROTOCOL (HTTPS, https);
263 REGISTER_PROTOCOL (MMSH, mmsh);264 REGISTER_PROTOCOL (MMSH, mmsh);
264 REGISTER_PROTOCOL (MMST, mmst);265 REGISTER_PROTOCOL (MMST, mmst);
libavformat/applehttp.c+2−1
@@ -644,7 +644,8 @@ static int applehttp_read_seek(AVFormatContext *s, int stream_index, · 643 unmodified lines
644 for (i = 0; i < c->n_variants; i++) {644 for (i = 0; i < c->n_variants; i++) {
645 /* Reset reading */645 /* Reset reading */
646 struct variant *var = c->variants[i];646 struct variant *var = c->variants[i];
647 int64_t pos = av_rescale_rnd(c->first_timestamp, 1, stream_index >= 0 ?647 int64_t pos = c->first_timestamp == AV_NOPTS_VALUE ? 0 :
648 av_rescale_rnd(c->first_timestamp, 1, stream_index >= 0 ?
648 s->streams[stream_index]->time_base.den :649 s->streams[stream_index]->time_base.den :
649 AV_TIME_BASE, flags & AVSEEK_FLAG_BACKWARD ?650 AV_TIME_BASE, flags & AVSEEK_FLAG_BACKWARD ?
650 AV_ROUND_DOWN : AV_ROUND_UP);651 AV_ROUND_DOWN : AV_ROUND_UP);
libavformat/avio.c+9−1
@@ -83,9 +83,11 @@ const AVClass ffurl_context_class = { · 82 unmodified lines
83};83};
84/*@}*/84/*@}*/
85 85
86static int default_interrupt_cb(void);
87 86
87#if FF_API_OLD_INTERRUPT_CB
88static int default_interrupt_cb(void);
88int (*url_interrupt_cb)(void) = default_interrupt_cb;89int (*url_interrupt_cb)(void) = default_interrupt_cb;
90#endif
89 91
90URLProtocol *av_protocol_next(URLProtocol *p)92URLProtocol *av_protocol_next(URLProtocol *p)
91{93{
@@ -444,6 +446,7 @@ int ffurl_get_file_handle(URLContext *h) · 352 unmodified lines
444 return h->prot->url_get_file_handle(h);446 return h->prot->url_get_file_handle(h);
445}447}
446 448
449#if FF_API_OLD_INTERRUPT_CB
447static int default_interrupt_cb(void)450static int default_interrupt_cb(void)
448{451{
449 return 0;452 return 0;
@@ -455,13 +458,18 @@ void avio_set_interrupt_cb(int (*interrupt_cb)(void)) · 5 unmodified lines
455 interrupt_cb = default_interrupt_cb;458 interrupt_cb = default_interrupt_cb;
456 url_interrupt_cb = interrupt_cb;459 url_interrupt_cb = interrupt_cb;
457}460}
461#endif
458 462
459int ff_check_interrupt(AVIOInterruptCB *cb)463int ff_check_interrupt(AVIOInterruptCB *cb)
460{464{
461 int ret;465 int ret;
462 if (cb && cb->callback && (ret = cb->callback(cb->opaque)))466 if (cb && cb->callback && (ret = cb->callback(cb->opaque)))
463 return ret;467 return ret;
468#if FF_API_OLD_INTERRUPT_CB
464 return url_interrupt_cb();469 return url_interrupt_cb();
470#else
471 return 0;
472#endif
465}473}
466 474
467#if FF_API_OLD_AVIO475#if FF_API_OLD_AVIO
libavformat/avio.h+5−1
@@ -386,13 +386,17 @@ attribute_deprecated int url_exist(const char *url); · 385 unmodified lines
386 */386 */
387int avio_check(const char *url, int flags);387int avio_check(const char *url, int flags);
388 388
389#if FF_API_OLD_INTERRUPT_CB
389/**390/**
390 * The callback is called in blocking functions to test regulary if391 * The callback is called in blocking functions to test regulary if
391 * asynchronous interruption is needed. AVERROR_EXIT is returned392 * asynchronous interruption is needed. AVERROR_EXIT is returned
392 * in this case by the interrupted function. 'NULL' means no interrupt393 * in this case by the interrupted function. 'NULL' means no interrupt
393 * callback is given.394 * callback is given.
395 * @deprecated Use interrupt_callback in AVFormatContext/avio_open2
396 * instead.
394 */397 */
395void avio_set_interrupt_cb(int (*interrupt_cb)(void));398attribute_deprecated void avio_set_interrupt_cb(int (*interrupt_cb)(void));
399#endif
396 400
397/**401/**
398 * Allocate and initialize an AVIOContext for buffered I/O. It must be later402 * Allocate and initialize an AVIOContext for buffered I/O. It must be later
libavformat/http.c+149−26
@@ -110,6 +110,15 @@ static int http_open_cnx(URLContext *h) · 109 unmodified lines
110 path1, sizeof(path1), s->location);110 path1, sizeof(path1), s->location);
111 ff_url_join(hoststr, sizeof(hoststr), NULL, NULL, hostname, port, NULL);111 ff_url_join(hoststr, sizeof(hoststr), NULL, NULL, hostname, port, NULL);
112 112
113 if (!strcmp(proto, "https")) {
114 lower_proto = "tls";
115 use_proxy = 0;
116 if (port < 0)
117 port = 443;
118 }
119 if (port < 0)
120 port = 80;
121
113 if (path1[0] == '\0')122 if (path1[0] == '\0')
114 path = "/";123 path = "/";
115 else124 else
@@ -124,13 +133,6 @@ static int http_open_cnx(URLContext *h) · 8 unmodified lines
124 av_url_split(NULL, 0, proxyauth, sizeof(proxyauth),133 av_url_split(NULL, 0, proxyauth, sizeof(proxyauth),
125 hostname, sizeof(hostname), &port, NULL, 0, proxy_path);134 hostname, sizeof(hostname), &port, NULL, 0, proxy_path);
126 }135 }
127 if (!strcmp(proto, "https")) {
128 lower_proto = "tls";
129 if (port < 0)
130 port = 443;
131 }
132 if (port < 0)
133 port = 80;
134 136
135 ff_url_join(buf, sizeof(buf), lower_proto, NULL, hostname, port, NULL);137 ff_url_join(buf, sizeof(buf), lower_proto, NULL, hostname, port, NULL);
136 err = ffurl_open(&hd, buf, AVIO_FLAG_READ_WRITE,138 err = ffurl_open(&hd, buf, AVIO_FLAG_READ_WRITE,
@@ -413,10 +415,33 @@ static int http_connect(URLContext *h, const char *path, const char *local_path, · 276 unmodified lines
413}415}
414 416
415 417
416static int http_read(URLContext *h, uint8_t *buf, int size)418static int http_buf_read(URLContext *h, uint8_t *buf, int size)
417{419{
418 HTTPContext *s = h->priv_data;420 HTTPContext *s = h->priv_data;
419 int len;421 int len;
422 /* read bytes from input buffer first */
423 len = s->buf_end - s->buf_ptr;
424 if (len > 0) {
425 if (len > size)
426 len = size;
427 memcpy(buf, s->buf_ptr, len);
428 s->buf_ptr += len;
429 } else {
430 if (!s->willclose && s->filesize >= 0 && s->off >= s->filesize)
431 return AVERROR_EOF;
432 len = ffurl_read(s->hd, buf, size);
433 }
434 if (len > 0) {
435 s->off += len;
436 if (s->chunksize > 0)
437 s->chunksize -= len;
438 }
439 return len;
440}
441
442static int http_read(URLContext *h, uint8_t *buf, int size)
443{
444 HTTPContext *s = h->priv_data;
420 445
421 if (s->chunksize >= 0) {446 if (s->chunksize >= 0) {
422 if (!s->chunksize) {447 if (!s->chunksize) {
@@ -439,24 +464,7 @@ static int http_read(URLContext *h, uint8_t *buf, int size) · 16 unmodified lines
439 }464 }
440 size = FFMIN(size, s->chunksize);465 size = FFMIN(size, s->chunksize);
441 }466 }
442 /* read bytes from input buffer first */467 return http_buf_read(h, buf, size);
443 len = s->buf_end - s->buf_ptr;
444 if (len > 0) {
445 if (len > size)
446 len = size;
447 memcpy(buf, s->buf_ptr, len);
448 s->buf_ptr += len;
449 } else {
450 if (!s->willclose && s->filesize >= 0 && s->off >= s->filesize)
451 return AVERROR_EOF;
452 len = ffurl_read(s->hd, buf, size);
453 }
454 if (len > 0) {
455 s->off += len;
456 if (s->chunksize > 0)
457 s->chunksize -= len;
458 }
459 return len;
460}468}
461 469
462/* used only when posting data */470/* used only when posting data */
@@ -572,3 +580,118 @@ URLProtocol ff_https_protocol = { · 109 unmodified lines
572 .priv_data_class = &https_context_class,580 .priv_data_class = &https_context_class,
573};581};
574#endif582#endif
583
584#if CONFIG_HTTPPROXY_PROTOCOL
585static int http_proxy_close(URLContext *h)
586{
587 HTTPContext *s = h->priv_data;
588 if (s->hd)
589 ffurl_close(s->hd);
590 return 0;
591}
592
593static int http_proxy_open(URLContext *h, const char *uri, int flags)
594{
595 HTTPContext *s = h->priv_data;
596 char hostname[1024], hoststr[1024];
597 char auth[1024], pathbuf[1024], *path;
598 char line[1024], lower_url[100];
599 int port, ret = 0;
600 HTTPAuthType cur_auth_type;
601 char *authstr;
602
603 h->is_streamed = 1;
604
605 av_url_split(NULL, 0, auth, sizeof(auth), hostname, sizeof(hostname), &port,
606 pathbuf, sizeof(pathbuf), uri);
607 ff_url_join(hoststr, sizeof(hoststr), NULL, NULL, hostname, port, NULL);
608 path = pathbuf;
609 if (*path == '/')
610 path++;
611
612 ff_url_join(lower_url, sizeof(lower_url), "tcp", NULL, hostname, port,
613 NULL);
614redo:
615 ret = ffurl_open(&s->hd, lower_url, AVIO_FLAG_READ_WRITE,
616 &h->interrupt_callback, NULL);
617 if (ret < 0)
618 return ret;
619
620 authstr = ff_http_auth_create_response(&s->proxy_auth_state, auth,
621 path, "CONNECT");
622 snprintf(s->buffer, sizeof(s->buffer),
623 "CONNECT %s HTTP/1.1\r\n"
624 "Host: %s\r\n"
625 "Connection: close\r\n"
626 "%s%s"
627 "\r\n",
628 path,
629 hoststr,
630 authstr ? "Proxy-" : "", authstr ? authstr : "");
631 av_freep(&authstr);
632
633 if ((ret = ffurl_write(s->hd, s->buffer, strlen(s->buffer))) < 0)
634 goto fail;
635
636 s->buf_ptr = s->buffer;
637 s->buf_end = s->buffer;
638 s->line_count = 0;
639 s->filesize = -1;
640 cur_auth_type = s->proxy_auth_state.auth_type;
641
642 for (;;) {
643 int new_loc;
644 // Note: This uses buffering, potentially reading more than the
645 // HTTP header. If tunneling a protocol where the server starts
646 // the conversation, we might buffer part of that here, too.
647 // Reading that requires using the proper ffurl_read() function
648 // on this URLContext, not using the fd directly (as the tls
649 // protocol does). This shouldn't be an issue for tls though,
650 // since the client starts the conversation there, so there
651 // is no extra data that we might buffer up here.
652 if (http_get_line(s, line, sizeof(line)) < 0) {
653 ret = AVERROR(EIO);
654 goto fail;
655 }
656
657 av_dlog(h, "header='%s'\n", line);
658
659 ret = process_line(h, line, s->line_count, &new_loc);
660 if (ret < 0)
661 goto fail;
662 if (ret == 0)
663 break;
664 s->line_count++;
665 }
666 if (s->http_code == 407 && cur_auth_type == HTTP_AUTH_NONE &&
667 s->proxy_auth_state.auth_type != HTTP_AUTH_NONE) {
668 ffurl_close(s->hd);
669 s->hd = NULL;
670 goto redo;
671 }
672
673 if (s->http_code < 400)
674 return 0;
675 ret = AVERROR(EIO);
676
677fail:
678 http_proxy_close(h);
679 return ret;
680}
681
682static int http_proxy_write(URLContext *h, const uint8_t *buf, int size)
683{
684 HTTPContext *s = h->priv_data;
685 return ffurl_write(s->hd, buf, size);
686}
687
688URLProtocol ff_httpproxy_protocol = {
689 .name = "httpproxy",
690 .url_open = http_proxy_open,
691 .url_read = http_buf_read,
692 .url_write = http_proxy_write,
693 .url_close = http_proxy_close,
694 .url_get_file_handle = http_get_file_handle,
695 .priv_data_size = sizeof(HTTPContext),
696};
697#endif
libavformat/rtmpproto.c+5−4
@@ -74,6 +74,7 @@ typedef struct RTMPContext { · 73 unmodified lines
74 int skip_bytes; ///< number of bytes to skip from the input FLV stream in the next write call74 int skip_bytes; ///< number of bytes to skip from the input FLV stream in the next write call
75 uint8_t flv_header[11]; ///< partial incoming flv packet header75 uint8_t flv_header[11]; ///< partial incoming flv packet header
76 int flv_header_bytes; ///< number of initialized bytes in flv_header76 int flv_header_bytes; ///< number of initialized bytes in flv_header
77 int nb_invokes; ///< keeps track of invoke messages
77} RTMPContext;78} RTMPContext;
78 79
79#define PLAYER_KEY_OPEN_PART_LEN 30 ///< length of partial key used for first client digest signing80#define PLAYER_KEY_OPEN_PART_LEN 30 ///< length of partial key used for first client digest signing
@@ -166,7 +167,7 @@ static void gen_release_stream(URLContext *s, RTMPContext *rt) · 86 unmodified lines
166 av_log(s, AV_LOG_DEBUG, "Releasing stream...\n");167 av_log(s, AV_LOG_DEBUG, "Releasing stream...\n");
167 p = pkt.data;168 p = pkt.data;
168 ff_amf_write_string(&p, "releaseStream");169 ff_amf_write_string(&p, "releaseStream");
169 ff_amf_write_number(&p, 2.0);170 ff_amf_write_number(&p, ++rt->nb_invokes);
170 ff_amf_write_null(&p);171 ff_amf_write_null(&p);
171 ff_amf_write_string(&p, rt->playpath);172 ff_amf_write_string(&p, rt->playpath);
172 173
@@ -189,7 +190,7 @@ static void gen_fcpublish_stream(URLContext *s, RTMPContext *rt) · 16 unmodified lines
189 av_log(s, AV_LOG_DEBUG, "FCPublish stream...\n");190 av_log(s, AV_LOG_DEBUG, "FCPublish stream...\n");
190 p = pkt.data;191 p = pkt.data;
191 ff_amf_write_string(&p, "FCPublish");192 ff_amf_write_string(&p, "FCPublish");
192 ff_amf_write_number(&p, 3.0);193 ff_amf_write_number(&p, ++rt->nb_invokes);
193 ff_amf_write_null(&p);194 ff_amf_write_null(&p);
194 ff_amf_write_string(&p, rt->playpath);195 ff_amf_write_string(&p, rt->playpath);
195 196
@@ -212,7 +213,7 @@ static void gen_fcunpublish_stream(URLContext *s, RTMPContext *rt) · 16 unmodified lines
212 av_log(s, AV_LOG_DEBUG, "UnPublishing stream...\n");213 av_log(s, AV_LOG_DEBUG, "UnPublishing stream...\n");
213 p = pkt.data;214 p = pkt.data;
214 ff_amf_write_string(&p, "FCUnpublish");215 ff_amf_write_string(&p, "FCUnpublish");
215 ff_amf_write_number(&p, 5.0);216 ff_amf_write_number(&p, ++rt->nb_invokes);
216 ff_amf_write_null(&p);217 ff_amf_write_null(&p);
217 ff_amf_write_string(&p, rt->playpath);218 ff_amf_write_string(&p, rt->playpath);
218 219
@@ -234,7 +235,7 @@ static void gen_create_stream(URLContext *s, RTMPContext *rt) · 15 unmodified lines
234 235
235 p = pkt.data;236 p = pkt.data;
236 ff_amf_write_string(&p, "createStream");237 ff_amf_write_string(&p, "createStream");
237 ff_amf_write_number(&p, rt->is_input ? 3.0 : 4.0);238 ff_amf_write_number(&p, ++rt->nb_invokes);
238 ff_amf_write_null(&p);239 ff_amf_write_null(&p);
239 240
240 ff_rtmp_packet_write(rt->stream, &pkt, rt->chunk_size, rt->prev_pkt[1]);241 ff_rtmp_packet_write(rt->stream, &pkt, rt->chunk_size, rt->prev_pkt[1]);
libavformat/rtpdec.c+8−2
@@ -429,7 +429,7 @@ static void finalize_packet(RTPDemuxContext *s, AVPacket *pkt, uint32_t timestam · 428 unmodified lines
429 if (timestamp == RTP_NOTS_VALUE)429 if (timestamp == RTP_NOTS_VALUE)
430 return;430 return;
431 431
432 if (s->last_rtcp_ntp_time != AV_NOPTS_VALUE) {432 if (s->last_rtcp_ntp_time != AV_NOPTS_VALUE && s->ic->nb_streams > 1) {
433 int64_t addend;433 int64_t addend;
434 int delta_timestamp;434 int delta_timestamp;
435 435
@@ -444,7 +444,13 @@ static void finalize_packet(RTPDemuxContext *s, AVPacket *pkt, uint32_t timestam · 8 unmodified lines
444 444
445 if (!s->base_timestamp)445 if (!s->base_timestamp)
446 s->base_timestamp = timestamp;446 s->base_timestamp = timestamp;
447 pkt->pts = s->range_start_offset + timestamp - s->base_timestamp;447 /* assume that the difference is INT32_MIN < x < INT32_MAX, but allow the first timestamp to exceed INT32_MAX */
448 if (!s->timestamp)
449 s->unwrapped_timestamp += timestamp;
450 else
451 s->unwrapped_timestamp += (int32_t)(timestamp - s->timestamp);
452 s->timestamp = timestamp;
453 pkt->pts = s->unwrapped_timestamp + s->range_start_offset - s->base_timestamp;
448}454}
449 455
450static int rtp_parse_packet_internal(RTPDemuxContext *s, AVPacket *pkt,456static int rtp_parse_packet_internal(RTPDemuxContext *s, AVPacket *pkt,
libavformat/rtpdec.h+1−0
@@ -151,6 +151,7 @@ struct RTPDemuxContext { · 150 unmodified lines
151 uint32_t timestamp;151 uint32_t timestamp;
152 uint32_t base_timestamp;152 uint32_t base_timestamp;
153 uint32_t cur_timestamp;153 uint32_t cur_timestamp;
154 int64_t unwrapped_timestamp;
154 int64_t range_start_offset;155 int64_t range_start_offset;
155 int max_payload_size;156 int max_payload_size;
156 struct MpegTSContext *ts; /* only used for MP2T payloads */157 struct MpegTSContext *ts; /* only used for MP2T payloads */
libavformat/rtspdec.c+2−0
@@ -52,6 +52,8 @@ static int rtsp_read_play(AVFormatContext *s) · 51 unmodified lines
52 rtpctx->last_rtcp_ntp_time = AV_NOPTS_VALUE;52 rtpctx->last_rtcp_ntp_time = AV_NOPTS_VALUE;
53 rtpctx->first_rtcp_ntp_time = AV_NOPTS_VALUE;53 rtpctx->first_rtcp_ntp_time = AV_NOPTS_VALUE;
54 rtpctx->base_timestamp = 0;54 rtpctx->base_timestamp = 0;
55 rtpctx->timestamp = 0;
56 rtpctx->unwrapped_timestamp = 0;
55 rtpctx->rtcp_ts_offset = 0;57 rtpctx->rtcp_ts_offset = 0;
56 }58 }
57 }59 }
libavformat/segafilm.c+14−1
@@ -34,6 +34,7 @@ · 33 unmodified lines
34#define FDSC_TAG MKBETAG('F', 'D', 'S', 'C')34#define FDSC_TAG MKBETAG('F', 'D', 'S', 'C')
35#define STAB_TAG MKBETAG('S', 'T', 'A', 'B')35#define STAB_TAG MKBETAG('S', 'T', 'A', 'B')
36#define CVID_TAG MKBETAG('c', 'v', 'i', 'd')36#define CVID_TAG MKBETAG('c', 'v', 'i', 'd')
37#define RAW_TAG MKBETAG('r', 'a', 'w', ' ')
37 38
38typedef struct {39typedef struct {
39 int stream;40 int stream;
@@ -129,8 +130,11 @@ static int film_read_header(AVFormatContext *s, · 89 unmodified lines
129 130
130 if (AV_RB32(&scratch[8]) == CVID_TAG) {131 if (AV_RB32(&scratch[8]) == CVID_TAG) {
131 film->video_type = CODEC_ID_CINEPAK;132 film->video_type = CODEC_ID_CINEPAK;
132 } else133 } else if (AV_RB32(&scratch[8]) == RAW_TAG) {
134 film->video_type = CODEC_ID_RAWVIDEO;
135 } else {
133 film->video_type = CODEC_ID_NONE;136 film->video_type = CODEC_ID_NONE;
137 }
134 138
135 /* initialize the decoder streams */139 /* initialize the decoder streams */
136 if (film->video_type) {140 if (film->video_type) {
@@ -143,6 +147,15 @@ static int film_read_header(AVFormatContext *s, · 6 unmodified lines
143 st->codec->codec_tag = 0; /* no fourcc */147 st->codec->codec_tag = 0; /* no fourcc */
144 st->codec->width = AV_RB32(&scratch[16]);148 st->codec->width = AV_RB32(&scratch[16]);
145 st->codec->height = AV_RB32(&scratch[12]);149 st->codec->height = AV_RB32(&scratch[12]);
150
151 if (film->video_type == CODEC_ID_RAWVIDEO) {
152 if (scratch[20] == 24) {
153 st->codec->pix_fmt = PIX_FMT_RGB24;
154 } else {
155 av_log(s, AV_LOG_ERROR, "raw video is using unhandled %dbpp\n", scratch[20]);
156 return -1;
157 }
158 }
146 }159 }
147 160
148 if (film->audio_type) {161 if (film->audio_type) {
libavformat/tls.c+17−0
@@ -111,9 +111,15 @@ static int tls_open(URLContext *h, const char *uri, int flags) · 110 unmodified lines
111 char buf[200], host[200];111 char buf[200], host[200];
112 int numerichost = 0;112 int numerichost = 0;
113 struct addrinfo hints = { 0 }, *ai = NULL;113 struct addrinfo hints = { 0 }, *ai = NULL;
114 const char *proxy_path;
115 int use_proxy;
114 116
115 ff_tls_init();117 ff_tls_init();
116 118
119 proxy_path = getenv("http_proxy");
120 use_proxy = (proxy_path != NULL) && !getenv("no_proxy") &&
121 av_strstart(proxy_path, "http://", NULL);
122
117 av_url_split(NULL, 0, NULL, 0, host, sizeof(host), &port, NULL, 0, uri);123 av_url_split(NULL, 0, NULL, 0, host, sizeof(host), &port, NULL, 0, uri);
118 ff_url_join(buf, sizeof(buf), "tcp", NULL, host, port, NULL);124 ff_url_join(buf, sizeof(buf), "tcp", NULL, host, port, NULL);
119 125
@@ -123,6 +129,17 @@ static int tls_open(URLContext *h, const char *uri, int flags) · 3 unmodified lines
123 freeaddrinfo(ai);129 freeaddrinfo(ai);
124 }130 }
125 131
132 if (use_proxy) {
133 char proxy_host[200], proxy_auth[200], dest[200];
134 int proxy_port;
135 av_url_split(NULL, 0, proxy_auth, sizeof(proxy_auth),
136 proxy_host, sizeof(proxy_host), &proxy_port, NULL, 0,
137 proxy_path);
138 ff_url_join(dest, sizeof(dest), NULL, NULL, host, port, NULL);
139 ff_url_join(buf, sizeof(buf), "httpproxy", proxy_auth, proxy_host,
140 proxy_port, "/%s", dest);
141 }
142
126 ret = ffurl_open(&c->tcp, buf, AVIO_FLAG_READ_WRITE,143 ret = ffurl_open(&c->tcp, buf, AVIO_FLAG_READ_WRITE,
127 &h->interrupt_callback, NULL);144 &h->interrupt_callback, NULL);
128 if (ret)145 if (ret)
libavformat/version.h+4−1
@@ -24,7 +24,7 @@ · 23 unmodified lines
24#include "libavutil/avutil.h"24#include "libavutil/avutil.h"
25 25
26#define LIBAVFORMAT_VERSION_MAJOR 5326#define LIBAVFORMAT_VERSION_MAJOR 53
27#define LIBAVFORMAT_VERSION_MINOR 2027#define LIBAVFORMAT_VERSION_MINOR 21
28#define LIBAVFORMAT_VERSION_MICRO 028#define LIBAVFORMAT_VERSION_MICRO 0
29 29
30#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \30#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
@@ -113,5 +113,8 @@ · 82 unmodified lines
113#ifndef FF_API_REORDER_PRIVATE113#ifndef FF_API_REORDER_PRIVATE
114#define FF_API_REORDER_PRIVATE (LIBAVFORMAT_VERSION_MAJOR < 54)114#define FF_API_REORDER_PRIVATE (LIBAVFORMAT_VERSION_MAJOR < 54)
115#endif115#endif
116#ifndef FF_API_OLD_INTERRUPT_CB
117#define FF_API_OLD_INTERRUPT_CB (LIBAVFORMAT_VERSION_MAJOR < 54)
118#endif
116 119
117#endif /* AVFORMAT_VERSION_H */120#endif /* AVFORMAT_VERSION_H */
tests/lavf-regression.sh+1−1
@@ -71,7 +71,7 @@ do_lavf mxf_d10 "-ar 48000 -ac 2 -r 25 -s 720x576 -vf pad=720:608:0:32 -vcodec m · 70 unmodified lines
71fi71fi
72 72
73if [ -n "$do_ts" ] ; then73if [ -n "$do_ts" ] ; then
74do_lavf ts "-ab 64k"74do_lavf ts "-ab 64k -mpegts_transport_stream_id 42"
75fi75fi
76 76
77if [ -n "$do_swf" ] ; then77if [ -n "$do_swf" ] ; then
tests/ref/lavf/ts+1−1
@@ -1,3 +1,3 @@
1151774afed45b19da9b7e83613a1e72b *./tests/data/lavf/lavf.ts1024f0cdd4c51a158b2a38b901d2ed2e5 *./tests/data/lavf/lavf.ts
2406644 ./tests/data/lavf/lavf.ts2406644 ./tests/data/lavf/lavf.ts
3./tests/data/lavf/lavf.ts CRC=0x133216c13./tests/data/lavf/lavf.ts CRC=0x133216c1

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t