History

Merge remote-tracking branch 'newdev/master'

* 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

Michael Niedermayer committed 15 years ago

Commit 1caa4122 parents 8b8bf89 229e2639 files · +105 −29Browse files

Unified · Split

9 files
  1. doc/APIchanges +6 −0
  2. libavcodec/mlp_parser.c +57 −2
  3. libavformat/avio.h +5 −7
  4. libavformat/avio_internal.h +6 −0
  5. libavformat/aviobuf.c +12 −2
  6. libavformat/nutdec.c +8 −8
  7. libavformat/nutenc.c +8 −7
  8. libavformat/oggenc.c +2 −2
  9. libavformat/rtspdec.c +1 −1
doc/APIchanges+6−0
@@ -462,16 +462,22 @@ API changes, most recent first: · 461 unmodified lines
462462
463463 2010-05-26 - r23334 - lavc 52.72.0 - CODEC_CAP_EXPERIMENTAL
464464 Add CODEC_CAP_EXPERIMENTAL flag.
465+ NOTE: this was backported to 0.6
465466
466467 2010-05-23 - r23255 - lavu 50.16.0 - av_get_random_seed()
467468 Add av_get_random_seed().
468469
469470 2010-05-18 - r23161 - lavf 52.63.0 - AVFMT_FLAG_RTP_HINT
470471 Add AVFMT_FLAG_RTP_HINT as possible value for AVFormatContext.flags.
472+ NOTE: this was backported to 0.6
471473
472474 2010-05-09 - r23066 - lavfi 1.20.0 - AVFilterPicRef
473475 Add interlaced and top_field_first fields to AVFilterPicRef.
474476
477+------------------------------8<-------------------------------------
478+ 0.6 branch was cut here
479+----------------------------->8--------------------------------------
480+
475481 2010-05-01 - r23002 - lavf 52.62.0 - probe function
476482 Add av_probe_input_format2 to API, it allows ignoring probe
477483 results below given score and returns the actual probe score.
libavcodec/mlp_parser.c+57−2
@@ -42,11 +42,52 @@ static const uint8_t mlp_channels[32] = { · 41 unmodified lines
4242 5, 6, 5, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
4343 };
4444
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+
4570 static const uint8_t thd_chancount[13] = {
4671 // LR C LFE LRs LRvh LRc LRrs Cs Ts LRsd LRw Cvh LFE2
4772 2, 1, 1, 2, 2, 2, 2, 1, 1, 2, 2, 1, 1
4873 };
4974
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+
5091 static int mlp_samplerate(int in)
5192 {
5293 if (in == 0xF)
@@ -65,6 +106,16 @@ static int truehd_channels(int chanmap) · 12 unmodified lines
65106 return channels;
66107 }
67108
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+
68119 /** Read a major sync info header - contains high level information about
69120 * the stream - sample rate, channel arrangement etc. Most of this
70121 * information is not actually necessary for decoding, only for playback.
@@ -264,12 +315,16 @@ static int mlp_parse(AVCodecParserContext *s, · 193 unmodified lines
264315 if (mh.stream_type == 0xbb) {
265316 /* MLP stream */
266317 avctx->channels = mlp_channels[mh.channels_mlp];
318+ avctx->channel_layout = mlp_layout[mh.channels_mlp];
267319 } else { /* mh.stream_type == 0xba */
268320 /* TrueHD stream */
269− if (mh.channels_thd_stream2)
321+ if (mh.channels_thd_stream2) {
270322 avctx->channels = truehd_channels(mh.channels_thd_stream2);
271− else
323+ avctx->channel_layout = truehd_layout(mh.channels_thd_stream2);
324+ } else {
272325 avctx->channels = truehd_channels(mh.channels_thd_stream1);
326+ avctx->channel_layout = truehd_layout(mh.channels_thd_stream1);
327+ }
273328 }
274329
275330 if (!mh.is_vbr) /* Stream is CBR */
libavformat/avio.h+5−7
@@ -447,6 +447,11 @@ attribute_deprecated int url_ferror(AVIOContext *s); · 446 unmodified lines
447447
448448 attribute_deprecated int udp_set_remote_url(URLContext *h, const char *uri);
449449 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);
450455 #endif
451456
452457 AVIOContext *avio_alloc_context(
@@ -670,13 +675,6 @@ int url_open_dyn_packet_buf(AVIOContext **s, int max_packet_size); · 217 unmodified lines
670675 */
671676 int url_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer);
672677
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−
680678 #if FF_API_UDP_GET_FILE
681679 int udp_get_file_handle(URLContext *h);
682680 #endif
libavformat/avio_internal.h+6−0
@@ -74,5 +74,11 @@ int64_t ffio_read_seek (AVIOContext *h, int stream_index, · 73 unmodified lines
7474 int ff_udp_set_remote_url(URLContext *h, const char *uri);
7575 int ff_udp_get_local_port(URLContext *h);
7676
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);
7783
7884 #endif // AVFORMAT_AVIO_INTERNAL_H
libavformat/aviobuf.c+12−2
@@ -415,6 +415,16 @@ int64_t av_url_read_fseek(AVIOContext *s, int stream_index, · 414 unmodified lines
415415 {
416416 return ffio_read_seek(s, stream_index, timestamp, flags);
417417 }
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+}
418428 #endif
419429
420430 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
557567 return av_crc(av_crc_get_table(AV_CRC_32_IEEE), checksum, buf, len);
558568 }
559569
560−unsigned long get_checksum(AVIOContext *s)
570+unsigned long ffio_get_checksum(AVIOContext *s)
561571 {
562572 s->checksum= s->update_checksum(s->checksum, s->checksum_ptr, s->buf_ptr - s->checksum_ptr);
563573 s->update_checksum= NULL;
564574 return s->checksum;
565575 }
566576
567−void init_checksum(AVIOContext *s,
577+void ffio_init_checksum(AVIOContext *s,
568578 unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len),
569579 unsigned long checksum)
570580 {
libavformat/nutdec.c+8−8
@@ -104,14 +104,14 @@ static int get_packetheader(NUTContext *nut, AVIOContext *bc, int calculate_chec · 103 unmodified lines
104104 startcode= av_be2ne64(startcode);
105105 startcode= ff_crc04C11DB7_update(0, (uint8_t*)&startcode, 8);
106106
107− init_checksum(bc, ff_crc04C11DB7_update, startcode);
107+ ffio_init_checksum(bc, ff_crc04C11DB7_update, startcode);
108108 size= ffio_read_varlen(bc);
109109 if(size > 4096)
110110 avio_rb32(bc);
111− if(get_checksum(bc) && size > 4096)
111+ if(ffio_get_checksum(bc) && size > 4096)
112112 return -1;
113113
114− init_checksum(bc, calculate_checksum ? ff_crc04C11DB7_update : NULL, 0);
114+ ffio_init_checksum(bc, calculate_checksum ? ff_crc04C11DB7_update : NULL, 0);
115115
116116 return size;
117117 }
@@ -285,7 +285,7 @@ static int decode_main_header(NUTContext *nut){ · 167 unmodified lines
285285 assert(nut->header_len[0]==0);
286286 }
287287
288− if(skip_reserved(bc, end) || get_checksum(bc)){
288+ if(skip_reserved(bc, end) || ffio_get_checksum(bc)){
289289 av_log(s, AV_LOG_ERROR, "main header checksum mismatch\n");
290290 return AVERROR_INVALIDDATA;
291291 }
@@ -374,7 +374,7 @@ static int decode_stream_header(NUTContext *nut){ · 82 unmodified lines
374374 ffio_read_varlen(bc); // samplerate_den
375375 GET_V(st->codec->channels, tmp > 0)
376376 }
377− if(skip_reserved(bc, end) || get_checksum(bc)){
377+ if(skip_reserved(bc, end) || ffio_get_checksum(bc)){
378378 av_log(s, AV_LOG_ERROR, "stream header %d checksum mismatch\n", stream_id);
379379 return -1;
380380 }
@@ -469,7 +469,7 @@ static int decode_info_header(NUTContext *nut){ · 88 unmodified lines
469469 }
470470 }
471471
472− if(skip_reserved(bc, end) || get_checksum(bc)){
472+ if(skip_reserved(bc, end) || ffio_get_checksum(bc)){
473473 av_log(s, AV_LOG_ERROR, "info header checksum mismatch\n");
474474 return -1;
475475 }
@@ -493,7 +493,7 @@ static int decode_syncpoint(NUTContext *nut, int64_t *ts, int64_t *back_ptr){ · 17 unmodified lines
493493
494494 ff_nut_reset_ts(nut, nut->time_base[tmp % nut->time_base_count], tmp / nut->time_base_count);
495495
496− if(skip_reserved(bc, end) || get_checksum(bc)){
496+ if(skip_reserved(bc, end) || ffio_get_checksum(bc)){
497497 av_log(s, AV_LOG_ERROR, "sync point checksum mismatch\n");
498498 return -1;
499499 }
@@ -590,7 +590,7 @@ static int find_and_decode_index(NUTContext *nut){ · 90 unmodified lines
590590 }
591591 }
592592
593− if(skip_reserved(bc, end) || get_checksum(bc)){
593+ if(skip_reserved(bc, end) || ffio_get_checksum(bc)){
594594 av_log(s, AV_LOG_ERROR, "index checksum mismatch\n");
595595 goto fail;
596596 }
libavformat/nutenc.c+8−7
@@ -24,6 +24,7 @@ · 23 unmodified lines
2424 #include "libavcodec/mpegaudiodata.h"
2525 #include "nut.h"
2626 #include "internal.h"
27+#include "avio_internal.h"
2728
2829 static int find_expected_header(AVCodecContext *c, int size, int key_frame, uint8_t out[64]){
2930 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
284285 int forw_ptr= dyn_size + 4*calculate_checksum;
285286
286287 if(forw_ptr > 4096)
287− init_checksum(bc, ff_crc04C11DB7_update, 0);
288+ ffio_init_checksum(bc, ff_crc04C11DB7_update, 0);
288289 avio_wb64(bc, startcode);
289290 ff_put_v(bc, forw_ptr);
290291 if(forw_ptr > 4096)
291− avio_wl32(bc, get_checksum(bc));
292+ avio_wl32(bc, ffio_get_checksum(bc));
292293
293294 if(calculate_checksum)
294− init_checksum(bc, ff_crc04C11DB7_update, 0);
295+ ffio_init_checksum(bc, ff_crc04C11DB7_update, 0);
295296 avio_write(bc, dyn_buf, dyn_size);
296297 if(calculate_checksum)
297− avio_wl32(bc, get_checksum(bc));
298+ avio_wl32(bc, ffio_get_checksum(bc));
298299
299300 av_free(dyn_buf);
300301 }
@@ -806,7 +807,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt){ · 505 unmodified lines
806807 needed_flags= get_needed_flags(nut, nus, fc, pkt);
807808 header_idx= fc->header_idx;
808809
809− init_checksum(bc, ff_crc04C11DB7_update, 0);
810+ ffio_init_checksum(bc, ff_crc04C11DB7_update, 0);
810811 avio_w8(bc, frame_code);
811812 if(flags & FLAG_CODED){
812813 ff_put_v(bc, (flags^needed_flags) & ~(FLAG_CODED));
@@ -817,8 +818,8 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt){ · 4 unmodified lines
817818 if(flags & FLAG_SIZE_MSB) ff_put_v(bc, pkt->size / fc->size_mul);
818819 if(flags & FLAG_HEADER_IDX) ff_put_v(bc, header_idx= best_header_idx);
819820
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);
822823
823824 avio_write(bc, pkt->data + nut->header_len[header_idx], pkt->size - nut->header_len[header_idx]);
824825 nus->last_flags= flags;
libavformat/oggenc.c+2−2
@@ -68,7 +68,7 @@ typedef struct { · 67 unmodified lines
6868 static void ogg_update_checksum(AVFormatContext *s, AVIOContext *pb, int64_t crc_offset)
6969 {
7070 int64_t pos = avio_tell(pb);
71− uint32_t checksum = get_checksum(pb);
71+ uint32_t checksum = ffio_get_checksum(pb);
7272 avio_seek(pb, crc_offset, SEEK_SET);
7373 avio_wb32(pb, checksum);
7474 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
8585 ret = url_open_dyn_buf(&pb);
8686 if (ret < 0)
8787 return ret;
88− init_checksum(pb, ff_crc04C11DB7_update, 0);
88+ ffio_init_checksum(pb, ff_crc04C11DB7_update, 0);
8989 ffio_wfourcc(pb, "OggS");
9090 avio_w8(pb, 0);
9191 avio_w8(pb, page->flags | extra_flags);
libavformat/rtspdec.c+1−1
@@ -340,7 +340,7 @@ retry: · 339 unmodified lines
340340
341341 /* send dummy request to keep TCP connection alive */
342342 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) {
344344 ff_rtsp_send_cmd_async(s, "GET_PARAMETER", rt->control_uri, NULL);
345345 } else {
346346 ff_rtsp_send_cmd_async(s, "OPTIONS", "*", NULL);

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