mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-08-30 17:58:37 +08:00
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:
@@ -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');
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user