Skip to content

Commit

Permalink
for ossrs#250, parse pes packet ok, ts message ok.
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Jan 29, 2015
1 parent 4862770 commit 1685cdd
Show file tree
Hide file tree
Showing 6 changed files with 740 additions and 25 deletions.
3 changes: 2 additions & 1 deletion trunk/research/hls/ts_info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1539,7 +1539,8 @@ int TSPayloadPES::demux(TSContext* ctx, TSPacket* pkt, u_int8_t* start, u_int8_t
// for (i = 0; i < PES_packet_length; i++) {
// PES_packet_data_byte
// }
} else if (stream_id != PES_padding_stream) {
// TODO: FIXME: implements it.
} else if (stream_id == PES_padding_stream) {
// for (i = 0; i < PES_packet_length; i++) {
// padding_byte
// }
Expand Down
12 changes: 10 additions & 2 deletions trunk/src/app/srs_app_mpegts_udp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ int SrsMpegtsOverUdp::on_udp_packet(sockaddr_in* from, char* buf, int nb_buf)

// process each ts packet
if ((ret = on_ts_packet(stream)) != ERROR_SUCCESS) {
break;
srs_warn("mpegts: ignore parse ts packet failed. ret=%d", ret);
continue;
}
srs_info("mpegts: parse ts packet completed");
}
Expand All @@ -86,12 +87,19 @@ int SrsMpegtsOverUdp::on_ts_packet(SrsStream* stream)
{
int ret = ERROR_SUCCESS;

if ((ret = context->decode(stream)) != ERROR_SUCCESS) {
if ((ret = context->decode(stream, this)) != ERROR_SUCCESS) {
srs_error("mpegts: decode ts packet failed. ret=%d", ret);
return ret;
}

return ret;
}

int SrsMpegtsOverUdp::on_ts_message(SrsTsMessage* msg)
{
int ret = ERROR_SUCCESS;
// TODO: FIXME: implements it.
return ret;
}

#endif
7 changes: 6 additions & 1 deletion trunk/src/app/srs_app_mpegts_udp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,12 @@ class SrsConfDirective;

#ifdef SRS_AUTO_STREAM_CASTER

#include <srs_kernel_ts.hpp>

/**
* the mpegts over udp stream caster.
*/
class SrsMpegtsOverUdp
class SrsMpegtsOverUdp : public ISrsTsHandler
{
private:
SrsStream* stream;
Expand All @@ -67,6 +69,9 @@ class SrsMpegtsOverUdp
* the stream contains the ts packet to parse.
*/
virtual int on_ts_packet(SrsStream* stream);
// interface ISrsTsHandler
public:
virtual int on_ts_message(SrsTsMessage* msg);
};

#endif
Expand Down
1 change: 1 addition & 0 deletions trunk/src/kernel/srs_kernel_error.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define ERROR_STREAM_CASTER_TS_PSI 4016
#define ERROR_STREAM_CASTER_TS_PAT 4017
#define ERROR_STREAM_CASTER_TS_PMT 4018
#define ERROR_STREAM_CASTER_TS_PSE 4019

/**
* whether the error code is an system control error.
Expand Down
Loading

0 comments on commit 1685cdd

Please sign in to comment.