* newdev/master: rtsp: Use GET_PARAMETER for keep-alive for generic RTSP servers mlp_parse.c: set AVCodecContext channel_layout APIChanges: mark the place where 0.6 was branched. avio: make get_checksum() internal. avio: move ff_crc04C11DB7_update() from avio.h -> avio_internal.h avio: make init_checksum() internal. NOT MERGED Add MxPEG decoder NOT MERGED Add support for picture_ptr field in MJpegDecodeContext NOT MERGED Move MJPEG's input buffer preprocessing in separate public function NOT MERGED Support reference picture defined by bitmask in MJPEG's SOS decoder sndio bug fix
Unified · Split
| @@ -462,16 +462,22 @@ API changes, most recent first: · 461 unmodified lines | ||
| 462 | 462 | |
| 463 | 463 | 2010-05-26 - r23334 - lavc 52.72.0 - CODEC_CAP_EXPERIMENTAL |
| 464 | 464 | Add CODEC_CAP_EXPERIMENTAL flag. |
| 465 | + NOTE: this was backported to 0.6 | |
| 465 | 466 | |
| 466 | 467 | 2010-05-23 - r23255 - lavu 50.16.0 - av_get_random_seed() |
| 467 | 468 | Add av_get_random_seed(). |
| 468 | 469 | |
| 469 | 470 | 2010-05-18 - r23161 - lavf 52.63.0 - AVFMT_FLAG_RTP_HINT |
| 470 | 471 | Add AVFMT_FLAG_RTP_HINT as possible value for AVFormatContext.flags. |
| 472 | + NOTE: this was backported to 0.6 | |
| 471 | 473 | |
| 472 | 474 | 2010-05-09 - r23066 - lavfi 1.20.0 - AVFilterPicRef |
| 473 | 475 | Add interlaced and top_field_first fields to AVFilterPicRef. |
| 474 | 476 | |
| 477 | +------------------------------8<------------------------------------- | |
| 478 | + 0.6 branch was cut here | |
| 479 | +----------------------------->8-------------------------------------- | |
| 480 | + | |
| 475 | 481 | 2010-05-01 - r23002 - lavf 52.62.0 - probe function |
| 476 | 482 | Add av_probe_input_format2 to API, it allows ignoring probe |
| 477 | 483 | results below given score and returns the actual probe score. |
| @@ -42,11 +42,52 @@ static const uint8_t mlp_channels[32] = { · 41 unmodified lines | ||
| 42 | 42 | 5, 6, 5, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 43 | 43 | }; |
| 44 | 44 | |
| 45 | +static const uint64_t mlp_layout[32] = { | |
| 46 | + AV_CH_LAYOUT_MONO, | |
| 47 | + AV_CH_LAYOUT_STEREO, | |
| 48 | + AV_CH_LAYOUT_2_1, | |
| 49 | + AV_CH_LAYOUT_2_2, | |
| 50 | + AV_CH_LAYOUT_STEREO|AV_CH_LOW_FREQUENCY, | |
| 51 | + AV_CH_LAYOUT_2_1|AV_CH_LOW_FREQUENCY, | |
| 52 | + AV_CH_LAYOUT_2_2|AV_CH_LOW_FREQUENCY, | |
| 53 | + AV_CH_LAYOUT_SURROUND, | |
| 54 | + AV_CH_LAYOUT_4POINT0, | |
| 55 | + AV_CH_LAYOUT_5POINT0, | |
| 56 | + AV_CH_LAYOUT_SURROUND|AV_CH_LOW_FREQUENCY, | |
| 57 | + AV_CH_LAYOUT_4POINT0|AV_CH_LOW_FREQUENCY, | |
| 58 | + AV_CH_LAYOUT_5POINT1, | |
| 59 | + AV_CH_LAYOUT_4POINT0, | |
| 60 | + AV_CH_LAYOUT_5POINT0, | |
| 61 | + AV_CH_LAYOUT_SURROUND|AV_CH_LOW_FREQUENCY, | |
| 62 | + AV_CH_LAYOUT_4POINT0|AV_CH_LOW_FREQUENCY, | |
| 63 | + AV_CH_LAYOUT_5POINT1, | |
| 64 | + AV_CH_LAYOUT_2_2|AV_CH_LOW_FREQUENCY, | |
| 65 | + AV_CH_LAYOUT_5POINT0, | |
| 66 | + AV_CH_LAYOUT_5POINT1, | |
| 67 | + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 | |
| 68 | +}; | |
| 69 | + | |
| 45 | 70 | static const uint8_t thd_chancount[13] = { |
| 46 | 71 | // LR C LFE LRs LRvh LRc LRrs Cs Ts LRsd LRw Cvh LFE2 |
| 47 | 72 | 2, 1, 1, 2, 2, 2, 2, 1, 1, 2, 2, 1, 1 |
| 48 | 73 | }; |
| 49 | 74 | |
| 75 | +static const uint64_t thd_layout[13] = { | |
| 76 | + AV_CH_FRONT_LEFT|AV_CH_FRONT_RIGHT, // LR | |
| 77 | + AV_CH_FRONT_CENTER, // C | |
| 78 | + AV_CH_LOW_FREQUENCY, // LFE | |
| 79 | + AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT, // LRs | |
| 80 | + AV_CH_TOP_FRONT_LEFT|AV_CH_TOP_FRONT_RIGHT, // LRvh | |
| 81 | + AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT, // LRc | |
| 82 | + AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT, // LRrs | |
| 83 | + AV_CH_BACK_CENTER, // Cs | |
| 84 | + AV_CH_TOP_BACK_CENTER, // Ts | |
| 85 | + AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT, // LRsd | |
| 86 | + AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER, // LRw | |
| 87 | + AV_CH_TOP_BACK_CENTER, // Cvh | |
| 88 | + AV_CH_LOW_FREQUENCY // LFE2 | |
| 89 | +}; | |
| 90 | + | |
| 50 | 91 | static int mlp_samplerate(int in) |
| 51 | 92 | { |
| 52 | 93 | if (in == 0xF) |
| @@ -65,6 +106,16 @@ static int truehd_channels(int chanmap) · 12 unmodified lines | ||
| 65 | 106 | return channels; |
| 66 | 107 | } |
| 67 | 108 | |
| 109 | +static int64_t truehd_layout(int chanmap) | |
| 110 | +{ | |
| 111 | + int layout = 0, i; | |
| 112 | + | |
| 113 | + for (i = 0; i < 13; i++) | |
| 114 | + layout |= thd_layout[i] * ((chanmap >> i) & 1); | |
| 115 | + | |
| 116 | + return layout; | |
| 117 | +} | |
| 118 | + | |
| 68 | 119 | /** Read a major sync info header - contains high level information about |
| 69 | 120 | * the stream - sample rate, channel arrangement etc. Most of this |
| 70 | 121 | * information is not actually necessary for decoding, only for playback. |
| @@ -264,12 +315,16 @@ static int mlp_parse(AVCodecParserContext *s, · 193 unmodified lines | ||
| 264 | 315 | if (mh.stream_type == 0xbb) { |
| 265 | 316 | /* MLP stream */ |
| 266 | 317 | avctx->channels = mlp_channels[mh.channels_mlp]; |
| 318 | + avctx->channel_layout = mlp_layout[mh.channels_mlp]; | |
| 267 | 319 | } else { /* mh.stream_type == 0xba */ |
| 268 | 320 | /* TrueHD stream */ |
| 269 | − if (mh.channels_thd_stream2) | |
| 321 | + if (mh.channels_thd_stream2) { | |
| 270 | 322 | avctx->channels = truehd_channels(mh.channels_thd_stream2); |
| 271 | − else | |
| 323 | + avctx->channel_layout = truehd_layout(mh.channels_thd_stream2); | |
| 324 | + } else { | |
| 272 | 325 | avctx->channels = truehd_channels(mh.channels_thd_stream1); |
| 326 | + avctx->channel_layout = truehd_layout(mh.channels_thd_stream1); | |
| 327 | + } | |
| 273 | 328 | } |
| 274 | 329 | |
| 275 | 330 | if (!mh.is_vbr) /* Stream is CBR */ |
| @@ -447,6 +447,11 @@ attribute_deprecated int url_ferror(AVIOContext *s); · 446 unmodified lines | ||
| 447 | 447 | |
| 448 | 448 | attribute_deprecated int udp_set_remote_url(URLContext *h, const char *uri); |
| 449 | 449 | attribute_deprecated int udp_get_local_port(URLContext *h); |
| 450 | + | |
| 451 | +attribute_deprecated void init_checksum(AVIOContext *s, | |
| 452 | + unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len), | |
| 453 | + unsigned long checksum); | |
| 454 | +attribute_deprecated unsigned long get_checksum(AVIOContext *s); | |
| 450 | 455 | #endif |
| 451 | 456 | |
| 452 | 457 | AVIOContext *avio_alloc_context( |
| @@ -670,13 +675,6 @@ int url_open_dyn_packet_buf(AVIOContext **s, int max_packet_size); · 217 unmodified lines | ||
| 670 | 675 | */ |
| 671 | 676 | int url_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer); |
| 672 | 677 | |
| 673 | −unsigned long ff_crc04C11DB7_update(unsigned long checksum, const uint8_t *buf, | |
| 674 | − unsigned int len); | |
| 675 | −unsigned long get_checksum(AVIOContext *s); | |
| 676 | −void init_checksum(AVIOContext *s, | |
| 677 | − unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len), | |
| 678 | − unsigned long checksum); | |
| 679 | − | |
| 680 | 678 | #if FF_API_UDP_GET_FILE |
| 681 | 679 | int udp_get_file_handle(URLContext *h); |
| 682 | 680 | #endif |
| @@ -74,5 +74,11 @@ int64_t ffio_read_seek (AVIOContext *h, int stream_index, · 73 unmodified lines | ||
| 74 | 74 | int ff_udp_set_remote_url(URLContext *h, const char *uri); |
| 75 | 75 | int ff_udp_get_local_port(URLContext *h); |
| 76 | 76 | |
| 77 | +void ffio_init_checksum(AVIOContext *s, | |
| 78 | + unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len), | |
| 79 | + unsigned long checksum); | |
| 80 | +unsigned long ffio_get_checksum(AVIOContext *s); | |
| 81 | +unsigned long ff_crc04C11DB7_update(unsigned long checksum, const uint8_t *buf, | |
| 82 | + unsigned int len); | |
| 77 | 83 | |
| 78 | 84 | #endif // AVFORMAT_AVIO_INTERNAL_H |
| @@ -415,6 +415,16 @@ int64_t av_url_read_fseek(AVIOContext *s, int stream_index, · 414 unmodified lines | ||
| 415 | 415 | { |
| 416 | 416 | return ffio_read_seek(s, stream_index, timestamp, flags); |
| 417 | 417 | } |
| 418 | +void init_checksum(AVIOContext *s, | |
| 419 | + unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len), | |
| 420 | + unsigned long checksum) | |
| 421 | +{ | |
| 422 | + ffio_init_checksum(s, update_checksum, checksum); | |
| 423 | +} | |
| 424 | +unsigned long get_checksum(AVIOContext *s) | |
| 425 | +{ | |
| 426 | + return ffio_get_checksum(s); | |
| 427 | +} | |
| 418 | 428 | #endif |
| 419 | 429 | |
| 420 | 430 | int avio_put_str(AVIOContext *s, const char *str) |
| @@ -557,14 +567,14 @@ unsigned long ff_crc04C11DB7_update(unsigned long checksum, const uint8_t *buf, · 136 unmodified lines | ||
| 557 | 567 | return av_crc(av_crc_get_table(AV_CRC_32_IEEE), checksum, buf, len); |
| 558 | 568 | } |
| 559 | 569 | |
| 560 | −unsigned long get_checksum(AVIOContext *s) | |
| 570 | +unsigned long ffio_get_checksum(AVIOContext *s) | |
| 561 | 571 | { |
| 562 | 572 | s->checksum= s->update_checksum(s->checksum, s->checksum_ptr, s->buf_ptr - s->checksum_ptr); |
| 563 | 573 | s->update_checksum= NULL; |
| 564 | 574 | return s->checksum; |
| 565 | 575 | } |
| 566 | 576 | |
| 567 | −void init_checksum(AVIOContext *s, | |
| 577 | +void ffio_init_checksum(AVIOContext *s, | |
| 568 | 578 | unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len), |
| 569 | 579 | unsigned long checksum) |
| 570 | 580 | { |
| @@ -104,14 +104,14 @@ static int get_packetheader(NUTContext *nut, AVIOContext *bc, int calculate_chec · 103 unmodified lines | ||
| 104 | 104 | startcode= av_be2ne64(startcode); |
| 105 | 105 | startcode= ff_crc04C11DB7_update(0, (uint8_t*)&startcode, 8); |
| 106 | 106 | |
| 107 | − init_checksum(bc, ff_crc04C11DB7_update, startcode); | |
| 107 | + ffio_init_checksum(bc, ff_crc04C11DB7_update, startcode); | |
| 108 | 108 | size= ffio_read_varlen(bc); |
| 109 | 109 | if(size > 4096) |
| 110 | 110 | avio_rb32(bc); |
| 111 | − if(get_checksum(bc) && size > 4096) | |
| 111 | + if(ffio_get_checksum(bc) && size > 4096) | |
| 112 | 112 | return -1; |
| 113 | 113 | |
| 114 | − init_checksum(bc, calculate_checksum ? ff_crc04C11DB7_update : NULL, 0); | |
| 114 | + ffio_init_checksum(bc, calculate_checksum ? ff_crc04C11DB7_update : NULL, 0); | |
| 115 | 115 | |
| 116 | 116 | return size; |
| 117 | 117 | } |
| @@ -285,7 +285,7 @@ static int decode_main_header(NUTContext *nut){ · 167 unmodified lines | ||
| 285 | 285 | assert(nut->header_len[0]==0); |
| 286 | 286 | } |
| 287 | 287 | |
| 288 | − if(skip_reserved(bc, end) || get_checksum(bc)){ | |
| 288 | + if(skip_reserved(bc, end) || ffio_get_checksum(bc)){ | |
| 289 | 289 | av_log(s, AV_LOG_ERROR, "main header checksum mismatch\n"); |
| 290 | 290 | return AVERROR_INVALIDDATA; |
| 291 | 291 | } |
| @@ -374,7 +374,7 @@ static int decode_stream_header(NUTContext *nut){ · 82 unmodified lines | ||
| 374 | 374 | ffio_read_varlen(bc); // samplerate_den |
| 375 | 375 | GET_V(st->codec->channels, tmp > 0) |
| 376 | 376 | } |
| 377 | − if(skip_reserved(bc, end) || get_checksum(bc)){ | |
| 377 | + if(skip_reserved(bc, end) || ffio_get_checksum(bc)){ | |
| 378 | 378 | av_log(s, AV_LOG_ERROR, "stream header %d checksum mismatch\n", stream_id); |
| 379 | 379 | return -1; |
| 380 | 380 | } |
| @@ -469,7 +469,7 @@ static int decode_info_header(NUTContext *nut){ · 88 unmodified lines | ||
| 469 | 469 | } |
| 470 | 470 | } |
| 471 | 471 | |
| 472 | − if(skip_reserved(bc, end) || get_checksum(bc)){ | |
| 472 | + if(skip_reserved(bc, end) || ffio_get_checksum(bc)){ | |
| 473 | 473 | av_log(s, AV_LOG_ERROR, "info header checksum mismatch\n"); |
| 474 | 474 | return -1; |
| 475 | 475 | } |
| @@ -493,7 +493,7 @@ static int decode_syncpoint(NUTContext *nut, int64_t *ts, int64_t *back_ptr){ · 17 unmodified lines | ||
| 493 | 493 | |
| 494 | 494 | ff_nut_reset_ts(nut, nut->time_base[tmp % nut->time_base_count], tmp / nut->time_base_count); |
| 495 | 495 | |
| 496 | − if(skip_reserved(bc, end) || get_checksum(bc)){ | |
| 496 | + if(skip_reserved(bc, end) || ffio_get_checksum(bc)){ | |
| 497 | 497 | av_log(s, AV_LOG_ERROR, "sync point checksum mismatch\n"); |
| 498 | 498 | return -1; |
| 499 | 499 | } |
| @@ -590,7 +590,7 @@ static int find_and_decode_index(NUTContext *nut){ · 90 unmodified lines | ||
| 590 | 590 | } |
| 591 | 591 | } |
| 592 | 592 | |
| 593 | − if(skip_reserved(bc, end) || get_checksum(bc)){ | |
| 593 | + if(skip_reserved(bc, end) || ffio_get_checksum(bc)){ | |
| 594 | 594 | av_log(s, AV_LOG_ERROR, "index checksum mismatch\n"); |
| 595 | 595 | goto fail; |
| 596 | 596 | } |
| @@ -24,6 +24,7 @@ · 23 unmodified lines | ||
| 24 | 24 | #include "libavcodec/mpegaudiodata.h" |
| 25 | 25 | #include "nut.h" |
| 26 | 26 | #include "internal.h" |
| 27 | +#include "avio_internal.h" | |
| 27 | 28 | |
| 28 | 29 | static int find_expected_header(AVCodecContext *c, int size, int key_frame, uint8_t out[64]){ |
| 29 | 30 | int sample_rate= c->sample_rate; |
| @@ -284,17 +285,17 @@ static void put_packet(NUTContext *nut, AVIOContext *bc, AVIOContext *dyn_bc, in · 254 unmodified lines | ||
| 284 | 285 | int forw_ptr= dyn_size + 4*calculate_checksum; |
| 285 | 286 | |
| 286 | 287 | if(forw_ptr > 4096) |
| 287 | − init_checksum(bc, ff_crc04C11DB7_update, 0); | |
| 288 | + ffio_init_checksum(bc, ff_crc04C11DB7_update, 0); | |
| 288 | 289 | avio_wb64(bc, startcode); |
| 289 | 290 | ff_put_v(bc, forw_ptr); |
| 290 | 291 | if(forw_ptr > 4096) |
| 291 | − avio_wl32(bc, get_checksum(bc)); | |
| 292 | + avio_wl32(bc, ffio_get_checksum(bc)); | |
| 292 | 293 | |
| 293 | 294 | if(calculate_checksum) |
| 294 | − init_checksum(bc, ff_crc04C11DB7_update, 0); | |
| 295 | + ffio_init_checksum(bc, ff_crc04C11DB7_update, 0); | |
| 295 | 296 | avio_write(bc, dyn_buf, dyn_size); |
| 296 | 297 | if(calculate_checksum) |
| 297 | − avio_wl32(bc, get_checksum(bc)); | |
| 298 | + avio_wl32(bc, ffio_get_checksum(bc)); | |
| 298 | 299 | |
| 299 | 300 | av_free(dyn_buf); |
| 300 | 301 | } |
| @@ -806,7 +807,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt){ · 505 unmodified lines | ||
| 806 | 807 | needed_flags= get_needed_flags(nut, nus, fc, pkt); |
| 807 | 808 | header_idx= fc->header_idx; |
| 808 | 809 | |
| 809 | − init_checksum(bc, ff_crc04C11DB7_update, 0); | |
| 810 | + ffio_init_checksum(bc, ff_crc04C11DB7_update, 0); | |
| 810 | 811 | avio_w8(bc, frame_code); |
| 811 | 812 | if(flags & FLAG_CODED){ |
| 812 | 813 | ff_put_v(bc, (flags^needed_flags) & ~(FLAG_CODED)); |
| @@ -817,8 +818,8 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt){ · 4 unmodified lines | ||
| 817 | 818 | if(flags & FLAG_SIZE_MSB) ff_put_v(bc, pkt->size / fc->size_mul); |
| 818 | 819 | if(flags & FLAG_HEADER_IDX) ff_put_v(bc, header_idx= best_header_idx); |
| 819 | 820 | |
| 820 | − if(flags & FLAG_CHECKSUM) avio_wl32(bc, get_checksum(bc)); | |
| 821 | − else get_checksum(bc); | |
| 821 | + if(flags & FLAG_CHECKSUM) avio_wl32(bc, ffio_get_checksum(bc)); | |
| 822 | + else ffio_get_checksum(bc); | |
| 822 | 823 | |
| 823 | 824 | avio_write(bc, pkt->data + nut->header_len[header_idx], pkt->size - nut->header_len[header_idx]); |
| 824 | 825 | nus->last_flags= flags; |
| @@ -68,7 +68,7 @@ typedef struct { · 67 unmodified lines | ||
| 68 | 68 | static void ogg_update_checksum(AVFormatContext *s, AVIOContext *pb, int64_t crc_offset) |
| 69 | 69 | { |
| 70 | 70 | int64_t pos = avio_tell(pb); |
| 71 | − uint32_t checksum = get_checksum(pb); | |
| 71 | + uint32_t checksum = ffio_get_checksum(pb); | |
| 72 | 72 | avio_seek(pb, crc_offset, SEEK_SET); |
| 73 | 73 | avio_wb32(pb, checksum); |
| 74 | 74 | avio_seek(pb, pos, SEEK_SET); |
| @@ -85,7 +85,7 @@ static int ogg_write_page(AVFormatContext *s, OGGPage *page, int extra_flags) · 10 unmodified lines | ||
| 85 | 85 | ret = url_open_dyn_buf(&pb); |
| 86 | 86 | if (ret < 0) |
| 87 | 87 | return ret; |
| 88 | − init_checksum(pb, ff_crc04C11DB7_update, 0); | |
| 88 | + ffio_init_checksum(pb, ff_crc04C11DB7_update, 0); | |
| 89 | 89 | ffio_wfourcc(pb, "OggS"); |
| 90 | 90 | avio_w8(pb, 0); |
| 91 | 91 | avio_w8(pb, page->flags | extra_flags); |
| @@ -340,7 +340,7 @@ retry: · 339 unmodified lines | ||
| 340 | 340 | |
| 341 | 341 | /* send dummy request to keep TCP connection alive */ |
| 342 | 342 | if ((av_gettime() - rt->last_cmd_time) / 1000000 >= rt->timeout / 2) { |
| 343 | − if (rt->server_type == RTSP_SERVER_WMS) { | |
| 343 | + if (rt->server_type != RTSP_SERVER_REAL) { | |
| 344 | 344 | ff_rtsp_send_cmd_async(s, "GET_PARAMETER", rt->control_uri, NULL); |
| 345 | 345 | } else { |
| 346 | 346 | ff_rtsp_send_cmd_async(s, "OPTIONS", "*", NULL); |