Skip to content

Commit

Permalink
Merge pull request Kurento#2 from mconf/mconf-mkv-api
Browse files Browse the repository at this point in the history
Add option to record with MKV profile to the API
  • Loading branch information
prlanzarin authored Jun 19, 2018
2 parents cc517df + 980b028 commit ddca087
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
43 changes: 43 additions & 0 deletions src/gst-plugins/commons/kmsrecordingprofile.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,40 @@ kms_recording_profile_create_webm_profile (gboolean has_audio,
return cprof;
}

static GstEncodingContainerProfile *
kms_recording_profile_create_mkv_profile (gboolean has_audio,
gboolean has_video)
{
GstEncodingContainerProfile *cprof;
GstCaps *pc;

pc = gst_caps_from_string ("video/quicktime, variant=(string)iso");

cprof = gst_encoding_container_profile_new ("Mkv", NULL, pc, NULL);
gst_caps_unref (pc);

if (has_audio) {
GstCaps *ac = gst_caps_from_string ("audio/x-aac");

gst_encoding_container_profile_add_profile (cprof, (GstEncodingProfile *)
gst_encoding_audio_profile_new (ac, NULL, NULL, 0));

gst_caps_unref (ac);
}

if (has_video) {
GstCaps *vc = gst_caps_from_string ("video/x-h264, "
"stream-format=(string)avc, alignment=(string)au");

gst_encoding_container_profile_add_profile (cprof, (GstEncodingProfile *)
gst_encoding_video_profile_new (vc, NULL, NULL, 0));

gst_caps_unref (vc);
}

return cprof;
}

static GstEncodingContainerProfile *
kms_recording_profile_create_mp4_profile (gboolean has_audio,
gboolean has_video)
Expand Down Expand Up @@ -166,6 +200,8 @@ kms_recording_profile_create_profile (KmsRecordingProfile profile,
return kms_recording_profile_create_webm_profile (has_audio, has_video);
case KMS_RECORDING_PROFILE_MP4:
return kms_recording_profile_create_mp4_profile (has_audio, has_video);
case KMS_RECORDING_PROFILE_MKV:
return kms_recording_profile_create_mkv_profile (has_audio, has_video);
case KMS_RECORDING_PROFILE_WEBM_VIDEO_ONLY:
return kms_recording_profile_create_webm_profile (FALSE, has_video);
case KMS_RECORDING_PROFILE_WEBM_AUDIO_ONLY:
Expand All @@ -174,6 +210,10 @@ kms_recording_profile_create_profile (KmsRecordingProfile profile,
return kms_recording_profile_create_mp4_profile (FALSE, has_video);
case KMS_RECORDING_PROFILE_MP4_AUDIO_ONLY:
return kms_recording_profile_create_mp4_profile (has_audio, FALSE);
case KMS_RECORDING_PROFILE_MKV_VIDEO_ONLY:
return kms_recording_profile_create_mkv_profile (FALSE, has_video);
case KMS_RECORDING_PROFILE_MKV_AUDIO_ONLY:
return kms_recording_profile_create_mkv_profile (has_audio, FALSE);
case KMS_RECORDING_PROFILE_JPEG_VIDEO_ONLY:
return kms_recording_profile_create_jpeg_profile ();
case KMS_RECORDING_PROFILE_KSR:
Expand All @@ -196,12 +236,15 @@ kms_recording_profile_supports_type (KmsRecordingProfile profile,
switch (profile) {
case KMS_RECORDING_PROFILE_WEBM:
case KMS_RECORDING_PROFILE_MP4:
case KMS_RECORDING_PROFILE_MKV:
return TRUE;
case KMS_RECORDING_PROFILE_WEBM_VIDEO_ONLY:
case KMS_RECORDING_PROFILE_MP4_VIDEO_ONLY:
case KMS_RECORDING_PROFILE_JPEG_VIDEO_ONLY:
case KMS_RECORDING_PROFILE_MKV_VIDEO_ONLY:
return type == KMS_ELEMENT_PAD_TYPE_VIDEO;
case KMS_RECORDING_PROFILE_WEBM_AUDIO_ONLY:
case KMS_RECORDING_PROFILE_MKV_AUDIO_ONLY:
case KMS_RECORDING_PROFILE_MP4_AUDIO_ONLY:
return type == KMS_ELEMENT_PAD_TYPE_AUDIO;
case KMS_RECORDING_PROFILE_KSR:
Expand Down
3 changes: 3 additions & 0 deletions src/gst-plugins/commons/kmsrecordingprofile.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,12 @@ typedef enum
{
KMS_RECORDING_PROFILE_NONE = -1,
KMS_RECORDING_PROFILE_WEBM,
KMS_RECORDING_PROFILE_MKV,
KMS_RECORDING_PROFILE_MP4,
KMS_RECORDING_PROFILE_WEBM_VIDEO_ONLY,
KMS_RECORDING_PROFILE_WEBM_AUDIO_ONLY,
KMS_RECORDING_PROFILE_MKV_VIDEO_ONLY,
KMS_RECORDING_PROFILE_MKV_AUDIO_ONLY,
KMS_RECORDING_PROFILE_MP4_VIDEO_ONLY,
KMS_RECORDING_PROFILE_MP4_AUDIO_ONLY,
KMS_RECORDING_PROFILE_JPEG_VIDEO_ONLY,
Expand Down

0 comments on commit ddca087

Please sign in to comment.