Skip to content

Commit

Permalink
Merge pull request #614 from bluecherrydvr/rc9-testing
Browse files Browse the repository at this point in the history
RC9
  • Loading branch information
curtishall authored Aug 28, 2023
2 parents 7815122 + 1153003 commit a151add
Show file tree
Hide file tree
Showing 36 changed files with 810 additions and 436 deletions.
1 change: 1 addition & 0 deletions debian/control.in
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Depends: ${shlibs:Depends}, ssl-cert, ucf, curl, sysstat,
i965-va-driver,
# python3-pip,
#focal php-sqlite3, php-gd, php-curl, php-mysql
#jammy php-sqlite3, php-gd, php-curl, php-mysql
#xenial php-sqlite3, php-gd, php-curl, php-mysql
#bionic php-sqlite3, php-gd, php-curl, php-mysql
#buster php-sqlite3, php-gd, php-curl, php-mysql
Expand Down
12 changes: 6 additions & 6 deletions lib/bc-core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ static int lavf_handle_init(struct bc_handle *bc, BC_DB_RES dbres)
if (get_creds(dbres, creds, sizeof(creds)) < 0)
return -1;

bool rtsp_rtp_prefer_tcp = true;
int rtsp_rtp_prefer_tcp = 0;
const char *protocol = bc_db_get_val(dbres, "protocol", NULL);
const char *uri_schema;
if (protocol && !strncmp(protocol, "IP-MJPEG", 8)) {
Expand All @@ -156,10 +156,10 @@ static int lavf_handle_init(struct bc_handle *bc, BC_DB_RES dbres)

const char *rtsp_rtp_prefer_tcp_raw = bc_db_get_val(dbres, "rtsp_rtp_prefer_tcp", NULL);
if (rtsp_rtp_prefer_tcp_raw && strlen(rtsp_rtp_prefer_tcp_raw)) {
rtsp_rtp_prefer_tcp = atoi(rtsp_rtp_prefer_tcp_raw) ? true : false;
rtsp_rtp_prefer_tcp = atoi(rtsp_rtp_prefer_tcp_raw);
} else {
bc_log(Error, "rtsp_rtp_prefer_tcp field is absent in Devices table, "
"DB schema not updated. Using default field value, \"true\"");
"DB schema not updated. Using default field value, \"AUTO\"");
}

val = bc_db_get_val(dbres, "device", NULL);
Expand Down Expand Up @@ -330,11 +330,11 @@ int bc_device_config_init(struct bc_device_config *cfg, BC_DB_RES dbres)
return -1;

if (rtsp_rtp_prefer_tcp_raw && strlen(rtsp_rtp_prefer_tcp_raw)) {
cfg->rtsp_rtp_prefer_tcp = atoi(rtsp_rtp_prefer_tcp_raw) ? true : false;
cfg->rtsp_rtp_prefer_tcp = atoi(rtsp_rtp_prefer_tcp_raw);
} else {
bc_log(Error, "rtsp_rtp_prefer_tcp field is absent in Devices table, "
"DB schema not updated. Using default field value, \"true\"");
cfg->rtsp_rtp_prefer_tcp = true;
"DB schema not updated. Using default field value, \"AUTO\"");
cfg->rtsp_rtp_prefer_tcp = 0;
}

strlcpy(cfg->dev, dev, sizeof(cfg->dev));
Expand Down
42 changes: 42 additions & 0 deletions lib/input_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,26 @@ void stream_properties::video_properties::apply(AVCodecContext *cc) const
}
}

void stream_properties::video_properties::apply(AVCodecParameters *cp) const
{
cp->codec_id = codec_id;
cp->codec_type = AVMEDIA_TYPE_VIDEO;
cp->format = pix_fmt;
cp->width = width;
cp->height = height;
cp->profile = profile;
if (!extradata.empty()) {
cp->extradata_size = extradata.size();
size_t size = extradata.size() + AV_INPUT_BUFFER_PADDING_SIZE;
cp->extradata = (uint8_t*)av_malloc(size);
memcpy(cp->extradata, &extradata.front(), extradata.size());
memset(cp->extradata + extradata.size(), 0, AV_INPUT_BUFFER_PADDING_SIZE);
} else {
cp->extradata_size = 0;
cp->extradata = 0;
}
}

stream_properties::audio_properties::audio_properties()
: codec_id(AV_CODEC_ID_NONE), bit_rate(0), sample_rate(0), sample_fmt(AV_SAMPLE_FMT_NONE),
channels(0), time_base({ 1, 1}), profile(FF_PROFILE_UNKNOWN)
Expand Down Expand Up @@ -233,3 +253,25 @@ void stream_properties::audio_properties::apply(AVCodecContext *cc) const
}
}

void stream_properties::audio_properties::apply(AVCodecParameters *cp) const
{
cp->codec_id = codec_id;
cp->codec_type = AVMEDIA_TYPE_AUDIO;
cp->bit_rate = bit_rate;
cp->sample_rate = sample_rate;
cp->format = sample_fmt;
cp->channels = channels;
cp->profile = profile;
cp->bits_per_coded_sample = bits_per_coded_sample;
if (!extradata.empty()) {
cp->extradata_size = extradata.size();
size_t size = extradata.size() + AV_INPUT_BUFFER_PADDING_SIZE;
cp->extradata = (uint8_t*)av_malloc(size);
memcpy(cp->extradata, &extradata.front(), extradata.size());
memset(cp->extradata + extradata.size(), 0, AV_INPUT_BUFFER_PADDING_SIZE);
} else {
cp->extradata_size = 0;
cp->extradata = 0;
}
}

2 changes: 2 additions & 0 deletions lib/input_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ class stream_properties
/* Apply these properties to an allocated AVCodecContext instance,
* suitable for creating encoders, decoders, etc. */
void apply(AVCodecContext *cc) const;
void apply(AVCodecParameters *cp) const;
} video;

struct audio_properties {
Expand All @@ -172,6 +173,7 @@ class stream_properties
/* Apply these properties to an allocated AVCodecContext instance,
* suitable for creating encoders, decoders, etc. */
void apply(AVCodecContext *cc) const;
void apply(AVCodecParameters *cp) const;
} audio;

bool operator!=(const stream_properties&) const;
Expand Down
Loading

0 comments on commit a151add

Please sign in to comment.