Skip to content

Commit 574e517

Browse files
committed
feat(codec): extend CodecId enum with additional codecs
- Added support for new audio and video codecs: `AAC`, `G711A`, `G711U`, `Opus`, `L16`, `VP8`, `VP9`, `AV1`, and `JPEG`. - Updated `Into<i32>` implementation to map new codecs to their respective integer values. - Enhanced `Into<i32>` for `CodecId` to include unsafe mappings for new codecs.
1 parent be2bfa7 commit 574e517

File tree

1 file changed

+40
-2
lines changed

1 file changed

+40
-2
lines changed

src/obj.rs

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,8 +357,28 @@ impl From<mk_parser> for Parser {
357357
}
358358

359359
pub enum CodecId {
360+
// 0
360361
H264,
362+
// 1
361363
H265,
364+
// 2
365+
AAC,
366+
// 3
367+
G711A,
368+
// 4
369+
G711U,
370+
// 5
371+
Opus,
372+
// 6
373+
L16,
374+
// 7
375+
VP8,
376+
// 8
377+
VP9,
378+
// 9
379+
AV1,
380+
// 10
381+
JPEG,
362382
}
363383

364384
/// i do not why
@@ -370,8 +390,17 @@ pub enum CodecId {
370390
impl Into<i32> for CodecId {
371391
fn into(self) -> i32 {
372392
match self {
373-
CodecId::H264 => 0,
374-
CodecId::H265 => 1,
393+
VideoCodecId::H264 => 0,
394+
VideoCodecId::H265 => 1,
395+
CodecId::AAC => 2,
396+
CodecId::G711A => 3,
397+
CodecId::G711U => 4,
398+
CodecId::Opus => 5,
399+
CodecId::L16 => 6,
400+
VideoCodecId::VP8 => 7,
401+
VideoCodecId::VP9 => 8,
402+
VideoCodecId::AV1 => 9,
403+
VideoCodecId::JPEG => 10,
375404
}
376405
}
377406
}
@@ -382,6 +411,15 @@ impl Into<i32> for CodecId {
382411
match self {
383412
CodecId::H264 => unsafe { MKCodecH264 },
384413
CodecId::H265 => unsafe { MKCodecH265 },
414+
CodecId::VP8 => unsafe { MKCodecVP8 },
415+
CodecId::VP9 => unsafe { MKCodecVP9 },
416+
CodecId::AV1 => unsafe { MKCodecAV1 },
417+
CodecId::JPEG => unsafe { MKCodecJPEG },
418+
CodecId::AAC => unsafe { MKCodecAAC },
419+
CodecId::G711A => unsafe { MKCodecG711A },
420+
CodecId::G711U => unsafe { MKCodecG711U },
421+
CodecId::Opus => unsafe { MKCodecOpus },
422+
CodecId::L16 => unsafe { MKCodecL16 },
385423
}
386424
}
387425
}

0 commit comments

Comments
 (0)