[Sumover-dev] [svn commit] r3977 - vic/branches/mpeg4/codec
sumover-dev at cs.ucl.ac.uk
sumover-dev at cs.ucl.ac.uk
Tue Mar 27 11:22:56 BST 2007
Author: piers
Date: Tue Mar 27 11:23:40 2007
New Revision: 3977
Modified:
vic/branches/mpeg4/codec/decoder-h264.cpp
vic/branches/mpeg4/codec/encoder-h264.cpp
vic/branches/mpeg4/codec/rtp_h264_depayloader.cpp
Log:
Updates for Windows compile - and fix for encoder-h264 destructor.
Modified: vic/branches/mpeg4/codec/decoder-h264.cpp
==============================================================================
--- vic/branches/mpeg4/codec/decoder-h264.cpp (original)
+++ vic/branches/mpeg4/codec/decoder-h264.cpp Tue Mar 27 11:23:40 2007
@@ -5,6 +5,8 @@
#include <iostream>
#include <errno.h>
#include <fcntl.h>
+#include <io.h>
+#include <sys/stat.h>
#include "inet.h"
#include "rtp.h"
#include "decoder.h"
@@ -122,13 +124,12 @@
H264Decoder::handleSDP()
{
char SdpFilename[SDP_LINE_LEN];
- char *line, *sdp_string;
+ char *sdp_string;
char *SdpLine=NULL;
int n_char;
int sdp_fptr;
struct stat s;
size_t nBytes = 0;
- ssize_t SdpRead;
char defaultSDP[]="a=rtpmap:96 H264/90000\na=fmtp:96 profile-level-id=00000d; packetization-mode=1\n";
sprintf(SdpFilename, "%s/default.sdp", getenv("HOME"));
@@ -150,19 +151,18 @@
}
close(sdp_fptr);
} else {
- fprintf(stderr, "H264_RTP: Couldn't open SDP file %s to read. Errno = %d\n", SdpFilename, errno);
- fprintf(stderr, "H264_RTP: Using default SDP: %s \n", defaultSDP);
+ debug_msg( "H264_RTP: Couldn't open SDP file %s to read. Errno = %d\n", SdpFilename, errno);
+ debug_msg("H264_RTP: Using default SDP: %s \n", defaultSDP);
sdp_string=defaultSDP;
}
- do {
- n_char = strcspn(sdp_string, "\n");
+ while ((n_char = strcspn(sdp_string, "\n"))!=0) {
SdpLine=(char*)realloc((void*)SdpLine, n_char+1);
memset(SdpLine, '\0', n_char+1);
strncpy(SdpLine, sdp_string, n_char);
sdp_string += n_char + 1;
- h264depayloader->parse_h264_sdp_line(h264.c, h264depayloader->h264_extradata, SdpLine);
- } while (n_char != 0);
+ h264depayloader->parse_h264_sdp_line(h264.c, h264depayloader->h264_extradata, SdpLine);
+ }
free(SdpLine);
}
Modified: vic/branches/mpeg4/codec/encoder-h264.cpp
==============================================================================
--- vic/branches/mpeg4/codec/encoder-h264.cpp (original)
+++ vic/branches/mpeg4/codec/encoder-h264.cpp Tue Mar 27 11:23:40 2007
@@ -76,12 +76,13 @@
fps = 20;
kbps = 512;
gop = 20;
+ fOut=NULL;
}
H264Encoder::~H264Encoder()
{
delete enc;
- delete fOut;
+ if (fOut) delete fOut;
}
void H264Encoder::size(int w, int h)
Modified: vic/branches/mpeg4/codec/rtp_h264_depayloader.cpp
==============================================================================
--- vic/branches/mpeg4/codec/rtp_h264_depayloader.cpp (original)
+++ vic/branches/mpeg4/codec/rtp_h264_depayloader.cpp Tue Mar 27 11:23:40 2007
@@ -42,23 +42,24 @@
#include <assert.h>
#include "config.h"
-
+#ifndef WIN32
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <netdb.h>
+#endif
#include <assert.h>
//#ifndef __BEOS__
-# include <arpa/inet.h>
//#else
//# include "barpainet.h"
//#endif
-#include <netdb.h>
#include "rtp_h264_depayloader.h"
#include "packetbuffer.h"
-using namespace std;
+//using namespace std;
@@ -231,11 +232,11 @@
uint8_t level_idc;
buffer[0] = value[0]; buffer[1] = value[1]; buffer[2] = '\0';
- profile_idc = strtol(buffer, NULL, 16);
+ profile_idc = (uint8_t)strtol(buffer, NULL, 16);
buffer[0] = value[2]; buffer[1] = value[3];
- profile_iop = strtol(buffer, NULL, 16);
+ profile_iop = (uint8_t)strtol(buffer, NULL, 16);
buffer[0] = value[4]; buffer[1] = value[5];
- level_idc = strtol(buffer, NULL, 16);
+ level_idc = (uint8_t)strtol(buffer, NULL, 16);
// set the parameters...
//fprintf(stderr, /* NULL, AV_LOG_DEBUG,*/ "H.264/RTP Profile IDC: %x Profile IOP: %x Level: %x\n", profile_idc, profile_iop, level_idc);
@@ -296,9 +297,6 @@
const uint8_t * buf,
int len)
{
-
- char *temp; //SV: XXX
-
//h264_rtp_extra_data *data = s->dynamic_protocol_context;
uint8_t nal = buf[0];
uint8_t type = (nal & 0x1f);
More information about the Sumover-dev
mailing list