obs-outputs: Add video_id_t value for 0

This will be initialized to 0 in various cases, so let's make that
a valid enum value (even if it's not valid in rtmp?)
This commit is contained in:
Ruwen Hahn
2023-11-28 15:36:14 +01:00
committed by Ryan Foster
parent fab8f0f80e
commit 64caf0401d
4 changed files with 27 additions and 0 deletions
+4
View File
@@ -66,6 +66,10 @@ enum datatype_t {
static void s_w4cc(struct serializer *s, enum video_id_t id)
{
switch (id) {
case CODEC_NONE:
assert(0 && "Tried to serialize CODEC_NONE");
break;
case CODEC_AV1:
s_w8(s, 'a');
s_w8(s, 'v');
+1
View File
@@ -22,6 +22,7 @@
#define MILLISECOND_DEN 1000
enum video_id_t {
CODEC_NONE = 0, // not valid in rtmp
CODEC_H264 = 1, // legacy & Y2023 spec
CODEC_AV1, // Y2023 spec
CODEC_HEVC,
+11
View File
@@ -271,6 +271,12 @@ static bool write_video_header(struct flv_output *stream, size_t idx)
return false;
switch (stream->video_codec[idx]) {
case CODEC_NONE:
do_log(LOG_ERROR,
"Codec not initialized for track %zu while sending header",
idx);
return false;
case CODEC_H264:
packet.size = obs_parse_avc_header(&packet.data, header, size);
// Always send H.264 on track 0 as old style for compatibility.
@@ -541,6 +547,11 @@ static void flv_output_data(void *data, struct encoder_packet *packet)
}
switch (stream->video_codec[packet->track_idx]) {
case CODEC_NONE:
do_log(LOG_ERROR, "Codec not initialized for track %zu",
packet->track_idx);
goto unlock;
case CODEC_H264:
obs_parse_avc_packet(&parsed_packet, packet);
break;
+11
View File
@@ -815,6 +815,12 @@ static bool send_video_header(struct rtmp_stream *stream, size_t idx)
return false;
switch (stream->video_codec[idx]) {
case CODEC_NONE:
do_log(LOG_ERROR,
"Codec not initialized for track %zu while sending header",
idx);
return false;
case CODEC_H264:
packet.size = obs_parse_avc_header(&packet.data, header, size);
// Always send H.264 on track 0 as old style for compatibility.
@@ -1747,6 +1753,11 @@ static void rtmp_stream_data(void *data, struct encoder_packet *packet)
}
switch (stream->video_codec[packet->track_idx]) {
case CODEC_NONE:
do_log(LOG_ERROR, "Codec not initialized for track %zu",
packet->track_idx);
return;
case CODEC_H264:
obs_parse_avc_packet(&new_packet, packet);
break;