webkit  2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
Functions
barcode_encoder Namespace Reference

Functions

def generate_upca_barcodes (number_of_barcodes, barcode_width, barcode_height, output_directory='.', path_to_zxing='zxing-read-only')
 
def convert_png_to_yuv_barcodes (input_directory='.', output_directory='.')
 
def combine_yuv_frames_into_one_file (output_file_name, input_directory='.')
 
def overlay_yuv_files (barcode_width, barcode_height, base_width, base_height, barcodes_file_name, base_file_name, output_file_name)
 
def calculate_frames_number_from_yuv (yuv_width, yuv_height, file_name)
 

Function Documentation

◆ calculate_frames_number_from_yuv()

def barcode_encoder.calculate_frames_number_from_yuv (   yuv_width,
  yuv_height,
  file_name 
)
Calculates the number of frames of a YUV video.

Args:
  yuv_width(int): Width of a frame of the yuv file.
  yuv_height(int): Height of a frame of the YUV file.
  file_name(string): The name of the YUV file.
Return:
  (int): The number of frames in the YUV file.

◆ combine_yuv_frames_into_one_file()

def barcode_encoder.combine_yuv_frames_into_one_file (   output_file_name,
  input_directory = '.' 
)
Combines several YUV frames into one YUV video file.

The function combines the YUV frames from input_directory into one YUV video
file. The frames should be named in the format frame_xxxx.yuv where xxxx
stands for the frame number. The numbers have to be consecutive and start from
0000. The YUV frames are removed after they have been added to the video.

Args:
  output_file_name(string): The name of the file to produce.
  input_directory(string): The directory from which the YUV frames are read.
Return:
  (bool): True if the frame stitching went OK.

◆ convert_png_to_yuv_barcodes()

def barcode_encoder.convert_png_to_yuv_barcodes (   input_directory = '.',
  output_directory = '.' 
)
Converts PNG barcodes to YUV barcode images.

This function reads all the PNG files from the input directory which are in
the format frame_xxxx.png, where xxxx is the number of the frame, starting
from 0000. The frames should be consecutive numbers. The output YUV file is
named frame_xxxx.yuv. The function uses ffmpeg to do the conversion.

Args:
  input_directory(string): The input direcotry to read the PNG barcodes from.
  output_directory(string): The putput directory to write the YUV files to.
Return:
  (bool): True if the conversion was without errors.

◆ generate_upca_barcodes()

def barcode_encoder.generate_upca_barcodes (   number_of_barcodes,
  barcode_width,
  barcode_height,
  output_directory = '.',
  path_to_zxing = 'zxing-read-only' 
)
Generates UPC-A barcodes.

This function generates a number_of_barcodes UPC-A barcodes. The function
calls an example Java encoder from the Zxing library. The barcodes are
generated as PNG images. The width of the barcodes shouldn't be less than 102
pixels because otherwise Zxing can't properly generate the barcodes.

Args:
  number_of_barcodes(int): The number of barcodes to generate.
  barcode_width(int): Width of barcode in pixels.
  barcode_height(int): Height of barcode in pixels.
  output_directory(string): Output directory where to store generated
    barcodes.
  path_to_zxing(string): The path to Zxing.

Return:
  (bool): True if the conversion is successful.

◆ overlay_yuv_files()

def barcode_encoder.overlay_yuv_files (   barcode_width,
  barcode_height,
  base_width,
  base_height,
  barcodes_file_name,
  base_file_name,
  output_file_name 
)
Overlays two YUV files starting from the upper left corner of both.

Args:
  barcode_width(int): The width of the barcode (to be overlaid).
  barcode_height(int): The height of the barcode (to be overlaid).
  base_width(int): The width of a frame of the base file.
  base_height(int): The height of a frame of the base file.
  barcodes_file_name(string): The name of the YUV file containing the YUV
    barcodes.
  base_file_name(string): The name of the base YUV file.
  output_file_name(string): The name of the output file where the overlaid
    video will be written.