Mercurial > libavformat.hg
comparison rtp.c @ 2760:034925441d67 libavformat
Add MPEG2 support to the RTP muxer
author | lucabe |
---|---|
date | Fri, 16 Nov 2007 13:13:53 +0000 |
parents | b252e318023a |
children | d52c718e83f9 |
comparison
equal
deleted
inserted
replaced
2759:b252e318023a | 2760:034925441d67 |
---|---|
77 {28, "nv", CODEC_TYPE_VIDEO, CODEC_ID_NONE, 90000, -1}, | 77 {28, "nv", CODEC_TYPE_VIDEO, CODEC_ID_NONE, 90000, -1}, |
78 {29, "unassigned", CODEC_TYPE_VIDEO, CODEC_ID_NONE, -1, -1}, | 78 {29, "unassigned", CODEC_TYPE_VIDEO, CODEC_ID_NONE, -1, -1}, |
79 {30, "unassigned", CODEC_TYPE_VIDEO, CODEC_ID_NONE, -1, -1}, | 79 {30, "unassigned", CODEC_TYPE_VIDEO, CODEC_ID_NONE, -1, -1}, |
80 {31, "H261", CODEC_TYPE_VIDEO, CODEC_ID_H261, 90000, -1}, | 80 {31, "H261", CODEC_TYPE_VIDEO, CODEC_ID_H261, 90000, -1}, |
81 {32, "MPV", CODEC_TYPE_VIDEO, CODEC_ID_MPEG1VIDEO, 90000, -1}, | 81 {32, "MPV", CODEC_TYPE_VIDEO, CODEC_ID_MPEG1VIDEO, 90000, -1}, |
82 {32, "MPV", CODEC_TYPE_VIDEO, CODEC_ID_MPEG2VIDEO, 90000, -1}, | |
82 {33, "MP2T", CODEC_TYPE_DATA, CODEC_ID_MPEG2TS, 90000, -1}, | 83 {33, "MP2T", CODEC_TYPE_DATA, CODEC_ID_MPEG2TS, 90000, -1}, |
83 {34, "H263", CODEC_TYPE_VIDEO, CODEC_ID_H263, 90000, -1}, | 84 {34, "H263", CODEC_TYPE_VIDEO, CODEC_ID_H263, 90000, -1}, |
84 {35, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1}, | 85 {35, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1}, |
85 {36, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1}, | 86 {36, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1}, |
86 {37, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1}, | 87 {37, "unassigned", CODEC_TYPE_UNKNOWN, CODEC_ID_NONE, -1, -1}, |
557 static void finalize_packet(RTPDemuxContext *s, AVPacket *pkt, uint32_t timestamp) | 558 static void finalize_packet(RTPDemuxContext *s, AVPacket *pkt, uint32_t timestamp) |
558 { | 559 { |
559 switch(s->st->codec->codec_id) { | 560 switch(s->st->codec->codec_id) { |
560 case CODEC_ID_MP2: | 561 case CODEC_ID_MP2: |
561 case CODEC_ID_MPEG1VIDEO: | 562 case CODEC_ID_MPEG1VIDEO: |
563 case CODEC_ID_MPEG2VIDEO: | |
562 if (s->last_rtcp_ntp_time != AV_NOPTS_VALUE) { | 564 if (s->last_rtcp_ntp_time != AV_NOPTS_VALUE) { |
563 int64_t addend; | 565 int64_t addend; |
564 | 566 |
565 int delta_timestamp; | 567 int delta_timestamp; |
566 /* XXX: is it really necessary to unify the timestamp base ? */ | 568 /* XXX: is it really necessary to unify the timestamp base ? */ |
681 buf += 4; | 683 buf += 4; |
682 av_new_packet(pkt, len); | 684 av_new_packet(pkt, len); |
683 memcpy(pkt->data, buf, len); | 685 memcpy(pkt->data, buf, len); |
684 break; | 686 break; |
685 case CODEC_ID_MPEG1VIDEO: | 687 case CODEC_ID_MPEG1VIDEO: |
688 case CODEC_ID_MPEG2VIDEO: | |
686 /* better than nothing: skip mpeg video RTP header */ | 689 /* better than nothing: skip mpeg video RTP header */ |
687 if (len <= 4) | 690 if (len <= 4) |
688 return -1; | 691 return -1; |
689 h = AV_RB32(buf); | 692 h = AV_RB32(buf); |
690 buf += 4; | 693 buf += 4; |
797 case CODEC_ID_MP2: | 800 case CODEC_ID_MP2: |
798 case CODEC_ID_MP3: | 801 case CODEC_ID_MP3: |
799 s->buf_ptr = s->buf + 4; | 802 s->buf_ptr = s->buf + 4; |
800 break; | 803 break; |
801 case CODEC_ID_MPEG1VIDEO: | 804 case CODEC_ID_MPEG1VIDEO: |
805 case CODEC_ID_MPEG2VIDEO: | |
802 break; | 806 break; |
803 case CODEC_ID_MPEG2TS: | 807 case CODEC_ID_MPEG2TS: |
804 n = s->max_payload_size / TS_PACKET_SIZE; | 808 n = s->max_payload_size / TS_PACKET_SIZE; |
805 if (n < 1) | 809 if (n < 1) |
806 n = 1; | 810 n = 1; |
1038 case CODEC_ID_MP2: | 1042 case CODEC_ID_MP2: |
1039 case CODEC_ID_MP3: | 1043 case CODEC_ID_MP3: |
1040 rtp_send_mpegaudio(s1, buf1, size); | 1044 rtp_send_mpegaudio(s1, buf1, size); |
1041 break; | 1045 break; |
1042 case CODEC_ID_MPEG1VIDEO: | 1046 case CODEC_ID_MPEG1VIDEO: |
1047 case CODEC_ID_MPEG2VIDEO: | |
1043 ff_rtp_send_mpegvideo(s1, buf1, size); | 1048 ff_rtp_send_mpegvideo(s1, buf1, size); |
1044 break; | 1049 break; |
1045 case CODEC_ID_AAC: | 1050 case CODEC_ID_AAC: |
1046 ff_rtp_send_aac(s1, buf1, size); | 1051 ff_rtp_send_aac(s1, buf1, size); |
1047 break; | 1052 break; |